Skip to content

Commit c98fda7

Browse files
committed
refactor(workspaces): Phase 3 — Routing + Scope sections, badge wiring
Split BindingForm into RoutingFields (space + feature sets) and ScopeFields (machine + workspace root). Replace the single Mapping collapsible with Routing (default open) and Scope (collapsed, ref.expand). Wire header machine badge to expand Scope. Move create-from-live icon appearance autosave to the panel. Add CollapsibleSectionRef.expand(). Autonomous decisions: - Added forwardRef/useImperativeHandle to CollapsibleSection in WorkspacesPage.tsx (required for scopeSectionRef.expand(); not in the phase file list but unavoidable without duplicating the component) - Routing section uses Route icon; Scope uses Monitor - Edit-mode routing subtitle reflects live form state (spaceId/fsIds), not the saved binding snapshot - Removed BindingForm entirely; create-mode submit stays in ScopeFields Signed-off-by: crimsonsunset <jsangio1@gmail.com>
1 parent fadda96 commit c98fda7

4 files changed

Lines changed: 323 additions & 270 deletions

File tree

apps/desktop/src/features/workspaces/WorkspacesPage.tsx

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import {
2+
forwardRef,
23
useCallback,
34
useEffect,
5+
useImperativeHandle,
46
useMemo,
57
useRef,
68
useState,
@@ -1138,31 +1140,46 @@ const SECTION_TONES: Record<SectionTone, SectionToneSpec> = {
11381140
},
11391141
};
11401142

1141-
export function CollapsibleSection({
1142-
icon,
1143-
tone = 'primary',
1144-
title,
1145-
subtitle,
1146-
defaultOpen = true,
1147-
badge,
1148-
headerExtra,
1149-
testId,
1150-
children,
1151-
}: {
1152-
icon: React.ReactNode;
1153-
tone?: SectionTone;
1154-
title: string;
1155-
subtitle?: React.ReactNode;
1156-
defaultOpen?: boolean;
1157-
badge?: number;
1158-
/** Small element rendered next to the title (e.g. save status). */
1159-
headerExtra?: React.ReactNode;
1160-
testId?: string;
1161-
children: React.ReactNode;
1162-
}) {
1143+
/** Imperative handle for programmatically expanding a collapsible section. */
1144+
export type CollapsibleSectionRef = {
1145+
expand: () => void;
1146+
};
1147+
1148+
export const CollapsibleSection = forwardRef<
1149+
CollapsibleSectionRef,
1150+
{
1151+
icon: React.ReactNode;
1152+
tone?: SectionTone;
1153+
title: string;
1154+
subtitle?: React.ReactNode;
1155+
defaultOpen?: boolean;
1156+
badge?: number;
1157+
/** Small element rendered next to the title (e.g. save status). */
1158+
headerExtra?: React.ReactNode;
1159+
testId?: string;
1160+
children: React.ReactNode;
1161+
}
1162+
>(function CollapsibleSection(
1163+
{
1164+
icon,
1165+
tone = 'primary',
1166+
title,
1167+
subtitle,
1168+
defaultOpen = true,
1169+
badge,
1170+
headerExtra,
1171+
testId,
1172+
children,
1173+
},
1174+
ref,
1175+
) {
11631176
const [open, setOpen] = useState(defaultOpen);
11641177
const toneSpec = SECTION_TONES[tone] ?? SECTION_TONES.primary;
11651178

1179+
useImperativeHandle(ref, () => ({
1180+
expand: () => setOpen(true),
1181+
}));
1182+
11661183
return (
11671184
<div
11681185
className="bg-[rgb(var(--background))] rounded-xl border-2 border-[rgb(var(--border))] overflow-hidden transition-all"
@@ -1228,7 +1245,7 @@ export function CollapsibleSection({
12281245
)}
12291246
</div>
12301247
);
1231-
}
1248+
});
12321249

12331250
// ---------------------------------------------------------------------------
12341251
// Effective features — what tools / prompts / resources this folder sees

0 commit comments

Comments
 (0)