import { DashboardSection } from "./DashboardSection"; import { DashboardEmptyState } from "./DashboardEmptyState"; export type SessionSummary = { key: string; title: string; subtitle: string; usage: string; lastSeenAt: string | null; isMain: boolean; /** Enriched from runtime usage when session IDs match */ costUsd?: number | null; totalTokens?: number | null; model?: string | null; }; interface SessionsSectionProps { sessions: SessionSummary[]; activeSessions: number; hasConfiguredGateways: boolean; isLoading: boolean; gatewayUnavailableCount: number; gatewayTargetsCount: number; formatCount: (n: number) => string; formatRelative: (ts: string) => string; dash: string; } export function SessionsSection({ sessions, activeSessions, hasConfiguredGateways, isLoading, gatewayUnavailableCount, gatewayTargetsCount, formatCount, formatRelative, dash, }: SessionsSectionProps) { return ( 0 ? "warning" : "success"} >
{!hasConfiguredGateways ? ( ) : isLoading ? (
{[0, 1].map((i) => (
))}
) : sessions.length > 0 ? ( <> {gatewayUnavailableCount > 0 && ( )} {sessions.map((session) => (

{session.title}

{session.subtitle}

{session.costUsd != null ? session.costUsd === 0 ? "$0.00" : session.costUsd < 0.01 ? `$${session.costUsd.toFixed(4)}` : `$${session.costUsd.toFixed(2)}` : session.usage === dash ? "Usage unavailable" : session.usage}

{session.model ? session.model.includes("/") ? session.model.split("/")[1] : session.model : null} {session.model && session.lastSeenAt ? " ยท " : null} {session.lastSeenAt ? formatRelative(session.lastSeenAt) : "Activity unavailable"}

))} ) : gatewayUnavailableCount === gatewayTargetsCount ? ( ) : ( )}
); }