diff --git a/app/[workspace]/project/[projectId]/design/page.tsx b/app/[workspace]/project/[projectId]/design/page.tsx index b17c38c..72df47c 100644 --- a/app/[workspace]/project/[projectId]/design/page.tsx +++ b/app/[workspace]/project/[projectId]/design/page.tsx @@ -553,6 +553,7 @@ export default function DesignPage({ const [surfaces, setSurfaces] = useState([]); const [surfaceThemes, setSurfaceThemes] = useState>({}); const [selectedThemes, setSelectedThemes] = useState>({}); + const [activeSurfaceId, setActiveSurfaceId] = useState(null); const [savingLock, setSavingLock] = useState(null); const [savingSurfaces, setSavingSurfaces] = useState(false); const [loading, setLoading] = useState(true); @@ -561,9 +562,11 @@ export default function DesignPage({ fetch(`/api/projects/${projectId}/design-surfaces`) .then(r => r.json()) .then(d => { - setSurfaces(d.surfaces ?? []); + const loaded = (d.surfaces ?? []) as string[]; + setSurfaces(loaded); setSurfaceThemes(d.surfaceThemes ?? {}); setSelectedThemes(d.surfaceThemes ?? {}); + if (loaded.length > 0) setActiveSurfaceId(loaded[0]); }) .catch(() => toast.error("Failed to load design data")) .finally(() => setLoading(false)); @@ -579,6 +582,7 @@ export default function DesignPage({ }); if (!res.ok) throw new Error(); setSurfaces(ids); + setActiveSurfaceId(ids[0] ?? null); toast.success("Surfaces saved"); } catch { toast.error("Failed to save surfaces"); @@ -619,7 +623,7 @@ export default function DesignPage({ if (loading) { return ( -
+
); @@ -634,51 +638,74 @@ export default function DesignPage({ ); } - // Phase 2 — surfaces set, pick themes + // Phase 2 — left nav + main content const activeSurfaces = ALL_SURFACES.filter(s => surfaces.includes(s.id)); + const currentSurface = activeSurfaces.find(s => s.id === activeSurfaceId) ?? activeSurfaces[0]; const lockedCount = Object.keys(surfaceThemes).length; return ( -
-
-
-

Design

-

- Choose a UI library for each surface — the AI coder will reference these when building. -

+
+ {/* Left nav */} +
+
+

Surfaces

-
+ + + +
{lockedCount === activeSurfaces.length && lockedCount > 0 && ( - - - All locked in - +

+ All surfaces locked +

)} - + + Edit surfaces +
-
- {activeSurfaces.map((surface, i) => ( -
0 ? "pt-10" : ""}> - setSelectedThemes(prev => ({ ...prev, [surface.id]: themeId }))} - onLock={() => handleLock(surface.id)} - onUnlock={() => handleUnlock(surface.id)} - saving={savingLock === surface.id} - /> -
- ))} + {/* Main content */} +
+ {currentSurface && ( + setSelectedThemes(prev => ({ ...prev, [currentSurface.id]: themeId }))} + onLock={() => handleLock(currentSurface.id)} + onUnlock={() => handleUnlock(currentSurface.id)} + saving={savingLock === currentSurface.id} + /> + )}
);