import Link from "next/link"; import { prisma } from "@streamclipper/db"; import { addChannel } from "./actions"; import { fetchChannelStatuses } from "../lib/apiDaemon"; 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

{channels.length === 0 ? (

Henüz kanal eklenmedi.

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