import Link from "next/link"; import { ago } from "@/components/common"; import { requireUser, words } from "@/lib/auth"; import { activeSessions, inbox } from "@/lib/queries"; import { SESSION_STATUS, TONE_BG } from "@/lib/status"; import { cn } from "@/lib/utils"; import { getT } from "@/lib/i18n"; import { questionText } from "@peppa/core"; /** Default right panel: what waits for the PM and what is running now. */ export async function ActivityAside({ questions = true }: { questions?: boolean }) { const user = await requireUser(); const t = await getT(); const w = await words(); const [items, sessions] = await Promise.all([questions ? inbox(user.id) : [], activeSessions(user.id)]); return (
{questions && ( {items.length === 0 ? (

{t("Агентам ничего не нужно.")}

) : ( items.slice(0, 6).map((q) => ( {q.taskKey ?? `#${q.id}`}{" "} {t.text(questionText(q))} )) )}
)} {sessions.length === 0 ? (

{t("Сейчас ничего не запущено.")}

) : ( sessions.slice(0, 12).map((s) => { const st = SESSION_STATUS[s.status] ?? { label: s.status, tone: "muted" as const }; return ( {s.taskKey ?? s.projectKey} {s.taskTitle} {ago(s.lastActivityAt, t)} ); }) )}
); } export function PanelSection({ title, count, href, more, children }: { title: string; count?: number; href?: string; more?: string; children: React.ReactNode }) { return (

{title} {count != null && count > 0 && {count}} {href && more && ( {more} → )}

{children}
); }