From 959905312a3594a7b5595999084db462295e5556 Mon Sep 17 00:00:00 2001 From: Emir Karabeg Date: Mon, 29 Dec 2025 20:35:39 -0800 Subject: [PATCH] improvement(copilot): ui/ux; refactor: store dimensions --- apps/sim/app/_styles/globals.css | 13 ++-- apps/sim/app/layout.tsx | 9 ++- .../components/file-display.tsx | 2 +- .../copilot-message/copilot-message.tsx | 11 ++- .../model-selector/model-selector.tsx | 2 +- .../components/user-input/user-input.tsx | 30 ++++---- .../panel/hooks/use-panel-resize.ts | 11 +-- .../terminal/hooks/use-output-panel-resize.ts | 4 +- .../components/terminal/terminal.tsx | 7 +- .../components/general/general.tsx | 74 +++++++++---------- .../usage-indicator/usage-indicator.tsx | 7 +- .../components/invite-modal/invite-modal.tsx | 2 +- .../sidebar/hooks/use-sidebar-resize.ts | 12 +-- .../w/components/sidebar/sidebar.tsx | 5 +- apps/sim/stores/constants.ts | 55 ++++++++++++++ apps/sim/stores/panel/editor/store.ts | 20 ++--- apps/sim/stores/panel/store.ts | 11 +-- apps/sim/stores/panel/toolbar/store.ts | 18 ++--- apps/sim/stores/sidebar/store.ts | 12 +-- apps/sim/stores/terminal/index.ts | 2 +- apps/sim/stores/terminal/store.ts | 29 ++------ 21 files changed, 178 insertions(+), 158 deletions(-) diff --git a/apps/sim/app/_styles/globals.css b/apps/sim/app/_styles/globals.css index 1ece0a9660..be0629e5e3 100644 --- a/apps/sim/app/_styles/globals.css +++ b/apps/sim/app/_styles/globals.css @@ -5,13 +5,16 @@ /** * CSS-based sidebar and panel widths to prevent SSR hydration mismatches. * Default widths are set here and updated via blocking script before React hydrates. + * + * @important These values must stay in sync with stores/constants.ts + * @see stores/constants.ts for the source of truth */ :root { - --sidebar-width: 232px; - --panel-width: 260px; - --toolbar-triggers-height: 300px; - --editor-connections-height: 200px; - --terminal-height: 155px; + --sidebar-width: 232px; /* SIDEBAR_WIDTH.DEFAULT */ + --panel-width: 290px; /* PANEL_WIDTH.DEFAULT */ + --toolbar-triggers-height: 300px; /* TOOLBAR_TRIGGERS_HEIGHT.DEFAULT */ + --editor-connections-height: 172px; /* EDITOR_CONNECTIONS_HEIGHT.DEFAULT */ + --terminal-height: 155px; /* TERMINAL_HEIGHT.DEFAULT */ } .sidebar-container { diff --git a/apps/sim/app/layout.tsx b/apps/sim/app/layout.tsx index da80a06d21..6be1e579c5 100644 --- a/apps/sim/app/layout.tsx +++ b/apps/sim/app/layout.tsx @@ -41,7 +41,12 @@ export default function RootLayout({ children }: { children: React.ReactNode }) }} /> - {/* Workspace layout dimensions: set CSS vars before hydration to avoid layout jump */} + {/* + Workspace layout dimensions: set CSS vars before hydration to avoid layout jump. + + IMPORTANT: These hardcoded values must stay in sync with stores/constants.ts + We cannot use imports here since this is a blocking script that runs before React. + */}