PEP-81: epics tab and the epic label on board cards (WIP, not verified in the browser)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
parent
accfe52ac6
commit
63576a9845
@ -22,7 +22,7 @@ import { cn } from "@/lib/utils";
|
||||
import { db } from "@/lib/db";
|
||||
import { board, projectForUserByKey, projectSessions } from "@/lib/queries";
|
||||
import { addProjectMember, addTask, deployProdAction, grantRepoAccessToMembers, removeProjectMember, saveReviewSettingsAction, setProjectVisibilityAction, connectOwnSubscriptionAction, chooseSharedSubscriptionAction } from "../../actions";
|
||||
import { AgentsMdTab, CodeTab, EpicsPanel, MemorySection, ProgressBar, PullsTab, SpecsTab } from "./tabs";
|
||||
import { AgentsMdTab, CodeTab, EpicsPanel, EpicsTab, MemorySection, ProgressBar, PullsTab, SpecsTab } from "./tabs";
|
||||
import { setProjectPoolAction } from "../../subscriptions/actions";
|
||||
import { JournalFilters, JournalList, MetricsTab, ProjectBudgetPanel } from "@/components/Accounting";
|
||||
import { saveProjectBudgetAction } from "../../actions";
|
||||
@ -37,6 +37,7 @@ const RELEASE_STATUS: Record<Release["status"], { label: string; tone: "info" |
|
||||
|
||||
const TABS = [
|
||||
{ id: "board", label: "Доска" },
|
||||
{ id: "epics", label: "Эпики" },
|
||||
{ id: "code", label: "Код" },
|
||||
{ id: "specs", label: "Спеки" },
|
||||
{ id: "agents", label: "AGENTS.md" },
|
||||
@ -351,7 +352,7 @@ export default async function ProjectPage({ params, searchParams }: { params: Pr
|
||||
<Button variant="default" size="sm" className="self-start">Создать стори</Button>
|
||||
</form>
|
||||
);
|
||||
const tabCount: Partial<Record<(typeof TABS)[number]["id"], number>> = { board: tasks.length, bugs: incidents.length, sessions: sessions.length };
|
||||
const tabCount: Partial<Record<(typeof TABS)[number]["id"], number>> = { board: tasks.length, epics: epics.length, bugs: incidents.length, sessions: sessions.length };
|
||||
|
||||
return (
|
||||
<Workspace aside={null} wide>
|
||||
@ -412,7 +413,7 @@ export default async function ProjectPage({ params, searchParams }: { params: Pr
|
||||
<>
|
||||
{epics.length > 0 && (
|
||||
<nav aria-label="Фильтр по эпику" className="mb-3 flex flex-wrap items-center gap-1.5 text-sm">
|
||||
<span className="text-xs text-muted-foreground">Эпик:</span>
|
||||
<a href={`/p/${p.key}?tab=epics`} className="text-xs text-muted-foreground" title="Эпик — большая цель; карточки на доске — стори, шаги к ней">Эпики:</a>
|
||||
{[{ id: 0, title: "все" }, ...epics].map((e) => {
|
||||
const active = (epicFilter?.id ?? 0) === e.id;
|
||||
return (
|
||||
@ -443,6 +444,17 @@ export default async function ProjectPage({ params, searchParams }: { params: Pr
|
||||
</>
|
||||
)}
|
||||
|
||||
{tab === "epics" && (
|
||||
<EpicsTab
|
||||
projectId={p.id}
|
||||
projectKey={p.key}
|
||||
epics={epics}
|
||||
stories={tasks.map((t) => ({ key: `${p.key}-${t.number}`, title: t.title, status: t.status, goalId: t.goalId }))}
|
||||
progress={progress}
|
||||
back={back}
|
||||
/>
|
||||
)}
|
||||
|
||||
{tab === "code" && code && <CodeTab code={code} />}
|
||||
|
||||
{tab === "specs" && (
|
||||
|
||||
@ -312,3 +312,78 @@ const AGENTS_MD_STARTER = `# AGENTS.md
|
||||
- Безопасность (ИБ): нет секретов в коде и логах; весь ввод проверяется; доступ к данным — только своему пользователю;
|
||||
новые зависимости — без известных уязвимостей. Итог проверки — раздел «ИБ» в описании PR.
|
||||
`;
|
||||
|
||||
interface EpicStory {
|
||||
key: string;
|
||||
title: string;
|
||||
status: string;
|
||||
goalId: number | null;
|
||||
}
|
||||
|
||||
/** PEP-81: epics in plain sight — each epic (a big goal) with its stories (the steps agents do). */
|
||||
export function EpicsTab({ projectId, projectKey, epics, stories, progress, back }: { projectId: number; projectKey: string; epics: Epic[]; stories: EpicStory[]; progress: Map<number, { done: number; total: number }>; back: string }) {
|
||||
const loose = stories.filter((s) => !s.goalId || !epics.some((e) => e.id === s.goalId));
|
||||
const list = (items: EpicStory[]) =>
|
||||
items.length ? (
|
||||
<ul className="m-0 flex list-none flex-col gap-1 p-0 text-sm">
|
||||
{items.map((s) => (
|
||||
<li key={s.key} className="flex flex-wrap items-center gap-x-2 gap-y-0.5">
|
||||
<Key href={`/t/${s.key}`}>{s.key}</Key>
|
||||
<span className="min-w-0 flex-[1_1_12em] truncate">{s.title}</span>
|
||||
<StatusBadge status={s.status} />
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<p className="m-0 text-sm text-muted-foreground">Стори пока нет.</p>
|
||||
);
|
||||
return (
|
||||
<Section title="Эпики" count={epics.length}>
|
||||
<p className="m-0 text-sm text-muted-foreground">
|
||||
<b className="text-foreground">Эпик</b> — большая цель, например «Оплата» или «Личный кабинет». <b className="text-foreground">Стори</b> — один конкретный шаг к ней: её делает агент, она — карточка на
|
||||
доске. У стори может быть один эпик; его описание агент получает вместе со стори.
|
||||
</p>
|
||||
<form action={addEpic} className="flex flex-wrap items-end gap-2 rounded-lg border bg-card px-4 py-3">
|
||||
<Hidden fields={{ projectId, back }} />
|
||||
<Input name="title" required minLength={2} placeholder="Новый эпик: большая цель" aria-label="Название нового эпика" className="h-8 min-w-48 flex-1" />
|
||||
<Input name="description" placeholder="Зачем он — одной фразой (необязательно)" aria-label="Описание нового эпика" className="h-8 min-w-48 flex-[2]" />
|
||||
<Button size="sm" variant="default">Добавить эпик</Button>
|
||||
</form>
|
||||
{epics.map((e) => {
|
||||
const pr = progress.get(e.id) ?? { done: 0, total: 0 };
|
||||
return (
|
||||
<article key={e.id} id={`epic-${e.id}`} className="flex flex-col gap-2.5 rounded-lg border bg-card px-4 py-3" data-epic={e.id}>
|
||||
<header className="flex flex-wrap items-center gap-2">
|
||||
<Badge variant="primary">эпик</Badge>
|
||||
<h3 className="m-0 min-w-0 flex-1 truncate text-base font-medium">{e.title}</h3>
|
||||
<ProgressBar done={pr.done} total={pr.total} className="w-24" />
|
||||
<span className="text-xs text-muted-foreground tabular-nums">
|
||||
готово {pr.done} из {pr.total}
|
||||
</span>
|
||||
</header>
|
||||
{e.description && <p className="m-0 text-sm text-muted-foreground">{e.description}</p>}
|
||||
{list(stories.filter((s) => s.goalId === e.id))}
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<Button asChild size="xs" variant="outline">
|
||||
<a href={`/p/${projectKey}?epic=${e.id}`}>На доске</a>
|
||||
</Button>
|
||||
<Button asChild size="xs" variant="outline">
|
||||
<a href={`/p/${projectKey}/plan/${e.id}`}>Спланировать стори</a>
|
||||
</Button>
|
||||
</div>
|
||||
</article>
|
||||
);
|
||||
})}
|
||||
{loose.length > 0 && (
|
||||
<article className="flex flex-col gap-2.5 rounded-lg border border-dashed px-4 py-3">
|
||||
<header className="flex items-center gap-2">
|
||||
<h3 className="m-0 text-base font-medium text-muted-foreground">Стори без эпика</h3>
|
||||
<span className="text-xs text-muted-foreground">{loose.length}</span>
|
||||
</header>
|
||||
{list(loose)}
|
||||
</article>
|
||||
)}
|
||||
<p className="m-0 text-xs text-muted-foreground">Переименовать эпик, изменить описание или убрать в архив — «⋯ Настройки проекта → Эпики». Эпик стори меняется кнопкой «Изменить» на её странице.</p>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
|
||||
@ -198,6 +198,7 @@ export function Board({ cards, back }: { cards: Card[]; back: string }) {
|
||||
)}
|
||||
{card.epic && (
|
||||
<Badge variant="outline" className="max-w-full min-w-0" title={`Эпик: ${card.epic}`}>
|
||||
<span className="shrink-0 text-muted-foreground">эпик</span>
|
||||
<span className="truncate">{card.epic}</span>
|
||||
</Badge>
|
||||
)}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user