refactor: remove legacy workspace UI state
This commit is contained in:
@@ -64,11 +64,10 @@ export function WorkspaceManager({ open, onClose }: { open: boolean; onClose: ()
|
||||
const workspaces = workspacesQuery.data ?? [];
|
||||
const selectedSummary = useMemo(() => workspaces.find((workspace) => workspace.id === selectedId), [selectedId, workspaces]);
|
||||
const selectedSummaryIncomplete = Boolean(selectedSummary && !selectedSummary.revision);
|
||||
const selectedIsLegacy = selectedSummary?.revision?.state === "migration_required";
|
||||
const detailQuery = useQuery({
|
||||
queryKey: ["workspace", selectedId],
|
||||
queryFn: () => getWorkspace(selectedId!),
|
||||
enabled: Boolean(open && selectedId && !localDraft && !selectedSummaryIncomplete && !selectedIsLegacy),
|
||||
enabled: Boolean(open && selectedId && !localDraft && !selectedSummaryIncomplete),
|
||||
});
|
||||
const status = statusQuery.data;
|
||||
const record = detailQuery.data;
|
||||
@@ -317,13 +316,8 @@ export function WorkspaceManager({ open, onClose }: { open: boolean; onClose: ()
|
||||
<p className="font-semibold">Workspace summary unavailable</p>
|
||||
<p className="mt-1">This workspace summary is incomplete. Refresh the registry or choose another workspace before creating sessions or editing drafts.</p>
|
||||
</div>
|
||||
) : selectedIsLegacy ? (
|
||||
<div className="rounded-md border border-amber-500/30 bg-amber-500/10 px-4 py-3 text-sm">
|
||||
<p className="font-semibold">Migration required</p>
|
||||
<p className="mt-1">This workspace uses a legacy descriptor and must be migrated to schema v3 before new sessions or publication.</p>
|
||||
</div>
|
||||
) : detailQuery.isError && selectedId && !localDraft ? <QueryError name="Workspace details failed" message="Could not load workspace details." retryLabel="Retry workspace details" onRetry={() => { void detailQuery.refetch(); }} /> : !currentDraft && !detailQuery.isLoading && <div className="grid min-h-64 place-items-center text-center"><div><h3 className="font-heading font-semibold">Select a workspace</h3><p className="mt-1 text-sm text-muted-foreground">Review an existing definition or start a browser-only draft.</p></div></div>}
|
||||
{!selectedSummaryIncomplete && !selectedIsLegacy && !detailQuery.isError && (currentDraft || detailQuery.isLoading) && (
|
||||
{!selectedSummaryIncomplete && !detailQuery.isError && (currentDraft || detailQuery.isLoading) && (
|
||||
<>
|
||||
{detailQuery.isLoading && !currentDraft ? <p className="text-sm text-muted-foreground">Loading workspace definition…</p> : currentDraft && <>
|
||||
<div className="mb-5 flex flex-wrap items-start justify-between gap-3 border-b border-border/70 pb-4">
|
||||
@@ -347,7 +341,7 @@ export function WorkspaceManager({ open, onClose }: { open: boolean; onClose: ()
|
||||
<section className="mt-6 border-t border-border/70 pt-5" aria-label="Git status and history">
|
||||
<h3 className="font-heading text-sm font-semibold">Git status & history</h3>
|
||||
<p className="mt-2 text-sm text-muted-foreground">{status?.degraded ? "Using the last valid local snapshot." : "Registry checkout is current."}</p>
|
||||
{record && <p className="mt-1 font-mono text-xs text-muted-foreground">Revision {record.revision.commit.slice(0, 12)} · {record.revision.state}</p>}
|
||||
{record && <p className="mt-1 font-mono text-xs text-muted-foreground">Revision {record.revision.commit.slice(0, 12)}</p>}
|
||||
</section>
|
||||
</>}
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user