feat(frontend): migrate resources, app store, and blueprint sheets to §9.11 chrome (#962)

Final PR of the System Sheet (§9.11) chrome rollout, stacked on PR 2.
Migrates the last five sheet consumers and extracts the inline network
detail sheet from ResourcesView into its own file.

Sheets migrated:
* VolumeBrowserSheet: crumb Resources > Volumes > {name}, Refresh tree
  primary, footer audit-log notice. Uses the new SystemSheet noScroll
  prop because the body is a 2-pane file browser that manages its own
  scroll regions; each pane (file tree, file preview) wraps its scroll
  region in ScrollArea per §10 Scrollbars.
* ImageDetailsSheet: crumb Resources > Images > {name}. Three sections
  (Overview, Config, Layers) flush against hairlines. Removed the
  icon-prefixed title and per-layer card wrapping (replaced with
  divide-y dividers).
* NetworkDetailSheet: NEW file extracted from the inline 150-line
  network sheet that lived inside ResourcesView.tsx. Crumb Resources >
  Networks > {name}. Five sections (Overview, IPAM, Options, Connected,
  Labels). Re-exports NetworkInspectData so ResourcesView can import
  the type. ResourcesView now renders the extracted component and drops
  its now-unused Sheet, ScrollArea, copyToClipboard, Copy, and Container
  imports.
* AppStoreView template detail sheet: crumb App store > {template}.
  Tabs Essentials | Advanced. Deploy lifted from SheetFooter into the
  toolbar primary slot. The remote-target signal (was a Badge in the
  header) collapses into the meta line as "→ {remoteName}".
* BlueprintDetail: the §9.11 reference implementation, intentionally
  migrated last. Crumb Blueprints > {name}. The kebab dropdown
  dissolves into individual toolbar actions: Apply now (primary), Edit
  (secondary, when not in editMode), Enable/Disable (secondary), Delete
  (destructive). Body has Description, Deployments, Compose sections.

Primitive enhancement:
* Added noScroll?: boolean to SystemSheet. When true, the body is
  rendered as a flex container instead of being wrapped in ScrollArea.
  Caller manages its own scroll regions and body padding.

Final state: frontend/src/components/ui/sheet.tsx is now imported only
by TopBar.tsx (mobile nav drawer, intentionally out of scope per the
plan) and SystemSheet itself. The §9.11 rollout is complete.
This commit is contained in:
Anso
2026-05-06 23:23:25 -04:00
committed by GitHub
parent 3ec0a45ff0
commit 907e7427e5
7 changed files with 735 additions and 745 deletions
@@ -1,13 +1,10 @@
import { useEffect, useState, useCallback } from 'react';
import { ChevronLeft, MoreHorizontal, Pencil, Play, Trash2 } from 'lucide-react';
import { Sheet, SheetContent, SheetHeader, SheetTitle } from '@/components/ui/sheet';
import { Pencil, Play, Power, Trash2 } from 'lucide-react';
import { SystemSheet, SheetSection } from '@/components/ui/system-sheet';
import { Modal, ModalDestructiveHeader, ModalBody, ModalFooter } from '@/components/ui/modal';
import { Input } from '@/components/ui/input';
import { Button } from '@/components/ui/button';
import { Skeleton } from '@/components/ui/skeleton';
import {
DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator,
} from '@/components/ui/dropdown-menu';
import { toast } from '@/components/ui/toast-store';
import {
type BlueprintSummary,
@@ -199,70 +196,63 @@ export function BlueprintDetail({ blueprintId, open, onOpenChange, onChanged, ca
setStateReviewTarget({ nodeId, nodeName: node.name });
}
return (
<Sheet open={open} onOpenChange={onOpenChange}>
<SheetContent side="right" className="w-full sm:max-w-2xl flex flex-col gap-0 overflow-y-auto p-0">
<SheetHeader className="sticky top-0 z-10 bg-popover/95 backdrop-blur-md border-b border-border px-6 py-4">
<div className="flex items-center justify-between gap-3">
<Button variant="ghost" size="sm" onClick={() => onOpenChange(false)} className="gap-1.5 -ml-2">
<ChevronLeft className="h-4 w-4" strokeWidth={1.5} />
Back
</Button>
{blueprint && (
<div className="flex items-center gap-1.5">
<Button size="sm" onClick={handleApply} disabled={submitting || !blueprint.enabled} className="gap-1.5">
<Play className="h-3.5 w-3.5" strokeWidth={1.5} />
Apply now
</Button>
{canEdit && !editMode && (
<Button size="sm" variant="outline" onClick={() => setEditMode(true)} className="gap-1.5">
<Pencil className="h-3.5 w-3.5" strokeWidth={1.5} />
Edit
</Button>
)}
{canEdit && (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button size="icon" variant="ghost" className="h-8 w-8" disabled={submitting}>
<MoreHorizontal className="h-4 w-4" strokeWidth={1.5} />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem onClick={handleToggleEnabled} disabled={submitting}>
{blueprint.enabled ? 'Disable reconciler' : 'Enable reconciler'}
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem onClick={() => setDeleteOpen(true)} className="text-destructive">
<Trash2 className="h-3.5 w-3.5 mr-2" strokeWidth={1.5} />
Delete blueprint
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
)}
</div>
)}
</div>
<div className="space-y-1.5">
<span className="font-mono text-[10px] uppercase tracking-[0.18em] text-stat-icon">
Blueprint
</span>
<SheetTitle className="font-serif italic text-2xl tracking-[-0.01em] text-stat-value">
{blueprint?.name ?? <Skeleton className="h-7 w-40" />}
</SheetTitle>
{blueprint?.description && (
<p className="text-xs text-stat-subtitle">{blueprint.description}</p>
)}
</div>
</SheetHeader>
const meta = blueprint
? `${describeSelector(blueprint.selector)} · ${blueprint.drift_mode} · rev ${blueprint.revision}`
: (loading ? 'Loading…' : '');
<div className="px-6 py-5 space-y-5">
{loading || !blueprint || !summary ? (
<div className="space-y-3">
<Skeleton className="h-12 w-full" />
<Skeleton className="h-32 w-full" />
<Skeleton className="h-40 w-full" />
</div>
) : editMode ? (
const footerContext = blueprint
? `Updated ${formatTimeAgo(blueprint.updated_at)}${blueprint.enabled ? '' : ' · reconciler disabled'}`
: undefined;
const secondaryActions = blueprint && canEdit
? [
...(!editMode ? [{
label: 'Edit',
icon: Pencil,
onClick: () => setEditMode(true),
disabled: submitting,
}] : []),
{
label: blueprint.enabled ? 'Disable' : 'Enable',
icon: Power,
onClick: handleToggleEnabled,
disabled: submitting,
},
]
: undefined;
return (
<>
<SystemSheet
open={open}
onOpenChange={onOpenChange}
crumb={['Blueprints', blueprint?.name ?? '…']}
name={blueprint?.name ?? <Skeleton className="h-7 w-40 inline-block" />}
meta={meta}
primaryAction={blueprint ? {
label: 'Apply now',
icon: Play,
onClick: handleApply,
disabled: submitting || !blueprint.enabled || editMode,
} : undefined}
secondaryActions={secondaryActions}
destructiveAction={blueprint && canEdit ? {
label: 'Delete',
icon: Trash2,
onClick: () => setDeleteOpen(true),
disabled: submitting || editMode,
} : undefined}
footerContext={footerContext}
size="lg"
>
{loading || !blueprint || !summary ? (
<div className="space-y-3">
<Skeleton className="h-12 w-full" />
<Skeleton className="h-32 w-full" />
<Skeleton className="h-40 w-full" />
</div>
) : editMode ? (
<SheetSection title="Edit blueprint" hideHeader>
<BlueprintEditor
mode="edit"
initial={blueprint}
@@ -271,15 +261,16 @@ export function BlueprintDetail({ blueprintId, open, onOpenChange, onChanged, ca
onSubmit={handleSaveEdit}
submitting={submitting}
/>
) : (
<>
<div className="grid grid-cols-2 md:grid-cols-4 gap-3 text-xs">
<Stat label="Selector" value={describeSelector(blueprint.selector)} />
<Stat label="Drift" value={blueprint.drift_mode} />
<Stat label="Revision" value={String(blueprint.revision)} />
<Stat label="Last updated" value={formatTimeAgo(blueprint.updated_at)} />
</div>
</SheetSection>
) : (
<>
{blueprint.description && (
<SheetSection title="Description" hideHeader>
<p className="text-xs text-stat-subtitle">{blueprint.description}</p>
</SheetSection>
)}
<SheetSection title="Deployments">
<BlueprintDeploymentTable
deployments={summary.deployments}
classification={blueprint.classification}
@@ -289,20 +280,23 @@ export function BlueprintDetail({ blueprintId, open, onOpenChange, onChanged, ca
onAcceptStateReview={openAcceptStateReview}
onRetry={handleRetryRow}
/>
</SheetSection>
<details className="rounded-lg border border-card-border bg-card">
<summary className="cursor-pointer px-3 py-2 font-mono text-[10px] uppercase tracking-[0.18em] text-stat-icon hover:text-stat-value">
Compose
<SheetSection title="Compose">
<details>
<summary className="cursor-pointer font-mono text-[10px] uppercase tracking-[0.18em] text-stat-subtitle hover:text-stat-value">
Show compose source
</summary>
<pre className="px-3 pb-3 font-mono text-[11px] text-stat-value overflow-x-auto whitespace-pre-wrap">
<pre className="mt-2 font-mono text-[11px] text-stat-value overflow-x-auto whitespace-pre-wrap">
{blueprint.compose_content}
</pre>
</details>
</>
)}
</div>
</SheetSection>
</>
)}
</SystemSheet>
{evictTarget && blueprint && (
{evictTarget && blueprint && (
<EvictionDialog
open={!!evictTarget}
onOpenChange={(o) => { if (!o) setEvictTarget(null); }}
@@ -366,16 +360,6 @@ export function BlueprintDetail({ blueprintId, open, onOpenChange, onChanged, ca
/>
</Modal>
)}
</SheetContent>
</Sheet>
);
}
function Stat({ label, value }: { label: string; value: string }) {
return (
<div className="space-y-0.5">
<span className="font-mono text-[10px] uppercase tracking-[0.18em] text-stat-icon">{label}</span>
<p className="font-mono text-sm tabular-nums tracking-tight text-stat-value truncate">{value}</p>
</div>
</>
);
}