frontend: kanal detay sayfası (canlı durum + poll hatası + yayın geçmişi)

/channels/[id] rotası eklendi: dashboard'daki kanal adı artık oraya
link veriyor. Sayfa api-daemon'un /status'undan canlı durum ve son
poll hatasını (lastPollError, DB'de değil sadece bellekte tutuluyordu)
çekiyor, Prisma'dan da o kanala ait tüm StreamSession/RawSegment/
CandidateSegment geçmişini transkript önizlemesiyle listeliyor.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-30 17:34:15 +03:00
co-authored by Claude Sonnet 5
parent b62d6a7e5f
commit 19fe430549
4 changed files with 181 additions and 10 deletions
+28
View File
@@ -0,0 +1,28 @@
export interface ChannelStatus {
id: string;
name: string;
isActive: boolean;
lastCheckedAt: string | null;
recording: boolean;
activeSessionId: string | null;
lastPollError: string | null;
}
const API_DAEMON_URL = process.env.API_DAEMON_URL ?? "http://localhost:4001";
/**
* lastPollError only exists in api-daemon's in-memory map (not persisted to
* the DB), so the panel fetches it live over HTTP rather than via Prisma.
* Failures here (api-daemon down, network hiccup) shouldn't break the page —
* they just mean live-status fields fall back to unknown.
*/
export async function fetchChannelStatuses(): Promise<Map<string, ChannelStatus>> {
try {
const res = await fetch(`${API_DAEMON_URL}/status`, { cache: "no-store" });
if (!res.ok) return new Map();
const data = (await res.json()) as { channels: ChannelStatus[] };
return new Map(data.channels.map((c) => [c.id, c]));
} catch {
return new Map();
}
}