diff --git a/packages/web/src/components/InitiativeCard.tsx b/packages/web/src/components/InitiativeCard.tsx index 32bfb98..6bbeddf 100644 --- a/packages/web/src/components/InitiativeCard.tsx +++ b/packages/web/src/components/InitiativeCard.tsx @@ -36,6 +36,21 @@ export function InitiativeCard({ onSpawnArchitect, onDelete, }: InitiativeCardProps) { + const utils = trpc.useUtils(); + const archiveMutation = trpc.updateInitiative.useMutation({ + onSuccess: () => utils.listInitiatives.invalidate(), + }); + + function handleArchive(e: React.MouseEvent) { + if ( + !e.shiftKey && + !window.confirm(`Archive "${initiative.name}"?`) + ) { + return; + } + archiveMutation.mutate({ id: initiative.id, status: "archived" }); + } + // Each card fetches its own phase stats (N+1 acceptable for v1 small counts) const phasesQuery = trpc.listPhases.useQuery({ initiativeId: initiative.id, @@ -109,7 +124,7 @@ export function InitiativeCard({ - Archive + Archive