import { prisma } from "@streamclipper/db"; import { deleteRawSegment, deleteCandidateSegment, retryRender, cancelRender } from "../actions"; import { formatTr } from "../../lib/formatDate"; import { ConfirmButton } from "../components/ConfirmButton"; import { Button } from "@/components/ui/button"; import { Badge, type badgeVariants } from "@/components/ui/badge"; import { Card, CardContent, CardHeader } from "@/components/ui/card"; import type { VariantProps } from "class-variance-authority"; export const dynamic = "force-dynamic"; const STATUS_BADGE: Record["variant"]> = { PENDING: "muted", PROCESSED: "ok", DISCARDED: "err", PENDING_STT: "warn", TRANSCRIBED: "ok", RENDERING: "warn", READY: "ok", FAILED: "err", }; function transcriptPreview(transcriptJson: unknown): string | null { if (!transcriptJson || typeof transcriptJson !== "object") return null; const text = (transcriptJson as { text?: string }).text; return text ? text.slice(0, 240) : null; } export default async function SegmentsPage() { const segments = await prisma.rawSegment.findMany({ orderBy: { createdAt: "desc" }, take: 50, include: { candidates: { orderBy: { createdAt: "desc" }, include: { short: true } } }, }); return (

Segment & Aday Klip Kütüphanesi

{segments.length === 0 ? (

Henüz işlenmiş segment yok.

) : (
{segments.map((segment) => (
{segment.filePath}

{segment.duration}sn · {formatTr(segment.startedAt)}

{segment.status}
{segment.candidates.length === 0 ? (

Bu segmentte aday klip bulunamadı.

) : ( segment.candidates.map((c) => (
{c.startSec}s – {c.endSec}s {c.audioPeakScore != null && ` · peak ${c.audioPeakScore.toFixed(1)}dB`} {c.chatVelocityScore != null && " · chat spike"} {c.status}
{transcriptPreview(c.transcriptJson) && (

{transcriptPreview(c.transcriptJson)}

)} {c.short && (
9:16: {c.short.status} {c.short.status === "READY" && c.short.filePath && ( <> )} {c.short.status === "READY" && !c.short.filePath && (

✅ Telegram'a gönderildi, sunucuda saklanmıyor.

)} {c.short.status === "FAILED" && ( <> {c.short.errorMessage && (

{c.short.errorMessage}

)}
)} {c.short.status === "RENDERING" && (
)}
)} {!c.short && c.status === "TRANSCRIBED" && (
)}
)) )}
))}
)}
); }