import Link from "next/link"; import { prisma } from "@streamclipper/db"; import { addChannel, toggleChannelActive, toggleAllChannels, checkChannelNow } from "./actions"; import { fetchChannelStatuses } from "../lib/apiDaemon"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Badge } from "@/components/ui/badge"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; export const dynamic = "force-dynamic"; export default async function DashboardPage() { const [channels, statuses] = await Promise.all([ prisma.channel.findMany({ orderBy: { name: "asc" }, include: { sessions: { where: { endedAt: null }, orderBy: { startedAt: "desc" }, take: 1, }, }, }), fetchChannelStatuses(), ]); return (

Kanal Durumu

Yeni Kanal Ekle
{channels.length === 0 ? (

Henüz kanal eklenmedi.

) : ( {channels.length} kanal
Kanal Durum Kayıt Son Kontrol Aksiyon {channels.map((c) => { const recording = c.sessions.length > 0; const status = statuses.get(c.id); return ( {c.name} {" "} {c.youtubeHandle} {c.isActive ? "Aktif" : "Pasif"}
{recording ? "🔴 Kayıtta" : "—"} {status?.lastPollError && hata}
{c.lastCheckedAt ? new Date(c.lastCheckedAt).toLocaleString("tr-TR") : "—"}
); })}
)}
); }