peppa/apps/web/components/PlatformDelays.tsx
peppa-bot f3d10a4c25 PEP-243: платформа называется FORGE — название во всех текстах для людей и подсказках агентам, адрес forge.telecom.quest
«Peppa FACTORY» → «FORGE» в экранах, сообщениях, словарях en/kk, шаблоне и тестах; «Пеппа» → «FORGE» в подсказках
агентам и правилах; логотип, значок, версия кэша service worker; в словаре старые названия — в «Нельзя».
Внутренние имена (CLI peppa, PEPPA_*, MCP-сервер peppa, ключи PEP-N) не меняются. Второй адрес — в mac-route.sh.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 11:18:49 +05:00

52 lines
3.1 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Link from "next/link";
import { DELAY_REASON_NAMES, type DelayView } from "@peppa/core";
import { delayActionForm } from "@/app/(app)/dashboard/actions";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Key } from "@/components/common";
import { getT } from "@/lib/i18n";
/**
* PEP-150/209: what is held up on the platform's side — the superadmin's list in «Дашборд →
* Задержки». Owners see one line on the story instead; a row leaves when its cause is gone.
* With `actions` every card has «Перезапустить», «Перевести на ревью» (story cards) and «Закрыть».
*/
export async function PlatformDelays({ delays, actions = false }: { delays: DelayView[]; actions?: boolean }) {
const t = await getT();
const hhmm = (ms: number) => new Date(ms).toLocaleString("ru-RU", { day: "2-digit", month: "2-digit", hour: "2-digit", minute: "2-digit", timeZone: process.env.PEPPA_TZ || undefined });
return (
<ul className="m-0 flex list-none flex-col gap-2 p-0" data-delays>
{delays.map((d) => (
<li key={`${d.key}:${d.reason}`} className="rounded-lg border bg-card px-3 py-2 text-sm" data-delay={d.reason}>
<div className="flex flex-wrap items-center gap-x-2 gap-y-1">
<Link href={d.url} className="hover:underline">
<Key>{d.key}</Key>
</Link>
<span className="font-medium">{t.text(DELAY_REASON_NAMES[d.reason])}</span>
{d.exhausted ? <Badge variant="danger">{t("нужен администратор")}</Badge> : <Badge variant="muted">{t("FORGE пробует сама")}</Badge>}
<span className="text-xs text-muted-foreground">{t("с {time} · попыток: {n}", { time: hhmm(d.since), n: d.attempts })}</span>
{!d.exhausted && d.retryAt != null && <span className="text-xs text-muted-foreground">{t("следующая попытка: {time}", { time: hhmm(d.retryAt) })}</span>}
</div>
{d.title && <div className="text-muted-foreground">{d.title}</div>}
<p className="m-0 mt-1 line-clamp-3 whitespace-pre-wrap break-words text-xs text-muted-foreground">{t.text(d.details)}</p>
{actions && (
<div className="mt-2 flex flex-wrap gap-2">
{(["restart", ...(d.taskId != null ? ["review"] : []), "close"] as const).map((a) => (
<form key={a} action={delayActionForm}>
<input type="hidden" name="project" value={d.projectId} />
{d.taskId != null && <input type="hidden" name="task" value={d.taskId} />}
<input type="hidden" name="reason" value={d.reason} />
<input type="hidden" name="action" value={a} />
<Button size="sm" variant={a === "close" ? "outline" : "secondary"} data-delay-action={a}>
{a === "restart" ? t("Перезапустить") : a === "review" ? t("Перевести на ревью") : t("Закрыть")}
</Button>
</form>
))}
</div>
)}
</li>
))}
</ul>
);
}