import Link from "next/link"; import type { ProgressOverview as Overview, ProjectProgress } from "@peppa/core"; import { AgentBadge } from "@/components/AgentBadge"; import { Empty, Key } from "@/components/common"; import { cn } from "@/lib/utils"; import { words } from "@/lib/auth"; import type { Words } from "@peppa/shared/wording"; const PARTS = [ { k: "done", label: "готово", bar: "bg-ok" }, { k: "review", label: "ревью", bar: "bg-primary" }, { k: "inProgress", label: "в работе", bar: "bg-info" }, { k: "backlog", label: "бэклог", bar: "bg-muted-foreground/40" }, ] as const; type Counts = Pick; /** One bar split by board column: done · review · in work · backlog. */ function StackedBar({ c, className, w }: { c: Counts; className?: string; w: Words }) { const label = PARTS.map((p) => `${p.label} ${c[p.k]}`).join(", "); return ( {c.total > 0 && PARTS.map((p) => (c[p.k] ? : null))} ); } const pct = (c: Counts) => (c.total ? Math.round((c.done / c.total) * 100) : 0); function Legend({ c }: { c: Counts }) { return ( {PARTS.map((p) => ( {p.label} {c[p.k]} ))} ); } function ProjectRow({ p, w }: { p: ProjectProgress; w: Words }) { return (
  • {p.key} {p.name} {p.ownerLogin && {p.ownerLogin}} {p.product && ( {p.product.live ? "Открыть продукт ↗" : "Версия для проверки ↗"} )} {p.total ? ( <> готово {p.done} из {p.total} · {pct(p)}% ) : ( `${w.task("genPl")} пока нет` )}
    {p.working.length > 0 && (
      {p.working.map((s) => (
    • {s.key} {s.title} {s.agent && } {s.total ? ( {s.done}/{s.total} ) : null}
    • ))}
    )} {p.reviewKeys.length > 0 && (

    Ждут «Принять»: {p.reviewKeys.slice(0, 8).map((k) => ( {k} ))} {p.reviewKeys.length > 8 && и ещё {p.reviewKeys.length - 8}}

    )}
  • ); } /** PEP-77: progress of the user's own projects on the Home page (other people's projects — on «Проекты», for a superadmin). */ export async function ProgressOverview({ data }: { data: Overview }) { const w = await words(); if (!data.mine.length) return Проектов пока нет — прогресс появится с первой {w.task("ins")}.; const t = data.totals; return (
    {data.mine.length > 0 && (
    {pct(t)}% готово {t.done} из {t.total} {w.task("genPl")} в {data.mine.length} {data.mine.length === 1 ? "проекте" : "проектах"}
    )}
      {data.mine.map((p) => ( ))}
    ); }