From c79cd183d42098de32823b293c7a76621938dd54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gjermund=20H=C3=B8s=C3=B8ien=20Wiggen?= Date: Tue, 9 Jun 2026 13:24:33 +0200 Subject: [PATCH] refactor: replace dashboard sidebar list with compact dropdown - Single-line select dropdown instead of one list item per dashboard - Scales to any number of teams without clutter - "+ New dashboard" as last option in dropdown - Preserves the create flow with inline name input Co-Authored-By: Claude Opus 4.8 --- web/src/components/app-shell.tsx | 116 ++++++++++++++++--------------- 1 file changed, 60 insertions(+), 56 deletions(-) diff --git a/web/src/components/app-shell.tsx b/web/src/components/app-shell.tsx index f68d43e..b5e4fad 100644 --- a/web/src/components/app-shell.tsx +++ b/web/src/components/app-shell.tsx @@ -202,66 +202,70 @@ function SidebarNav() { {dashboards.length > 0 && (
{!collapsed && ( -
- + )} + {expanded.dashboards && dashboards.length > 0 && ( +
+ setNewDashboardName(e.target.value)} - placeholder="Name" - className="h-6 w-24 rounded border border-sidebar-border bg-sidebar-accent px-1.5 text-[11px] text-sidebar-foreground outline-none" - autoFocus - onKeyDown={async (e) => { - if (e.key === "Enter" && newDashboardName.trim()) { - const { data } = await createDashboard({ name: newDashboardName.trim(), is_default: false }); - if (data) { - setDashboards((prev) => [...prev, data]); - setNewDashboardName(""); - setAddingDashboard(false); - window.location.href = `/dashboards/${data.id}`; - } - } else if (e.key === "Escape") { - setNewDashboardName(""); - setAddingDashboard(false); - } - }} - /> -
- ) : ( - - )} + {dashboards.map((dash) => ( + + ))} + +
)} - {expanded.dashboards && dashboards.map((dash) => { - const active = - pathname.startsWith("/dashboards/") && pathname.endsWith(dash.id); - return ( - + setNewDashboardName(e.target.value)} + placeholder="Dashboard name" + className="h-7 w-full rounded border border-sidebar-border bg-sidebar-accent px-1.5 text-[12px] text-sidebar-foreground outline-none" + autoFocus + onKeyDown={async (e) => { + if (e.key === "Enter" && newDashboardName.trim()) { + const { data } = await createDashboard({ name: newDashboardName.trim(), is_default: false }); + if (data) { + setDashboards((prev) => [...prev, data]); + setNewDashboardName(""); + setAddingDashboard(false); + window.location.href = `/dashboards/${data.id}`; + } + } else if (e.key === "Escape") { + setNewDashboardName(""); + setAddingDashboard(false); + } + }} + onBlur={() => { + if (!newDashboardName.trim()) { + setNewDashboardName(""); + setAddingDashboard(false); + } + }} /> - ); - })} +
+ )} )}