import Link from "next/link"; import { prisma } from "@streamclipper/db"; import { addChannel, toggleChannelActive, toggleAllChannels, checkChannelNow } from "./actions"; import { fetchChannelStatuses } from "../lib/apiDaemon"; import { formatTr } from "../lib/formatDate"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Badge } from "@/components/ui/badge"; import { Card, CardContent, CardHeader, CardTitle, CardFooter } from "@/components/ui/card"; import { cn } from "@/lib/utils"; 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
{channels.map((c) => { const recording = c.sessions.length > 0; const status = statuses.get(c.id); return (
{c.name} {c.isActive ? "Aktif" : "Pasif"}
{c.youtubeHandle}
{recording ? "🔴 Kayıtta" : "Kayıtta değil"} {status?.lastPollError && ( hata )}
Son kontrol: {c.lastCheckedAt ? formatTr(c.lastCheckedAt) : "—"}
); })}
)}
); }