Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

feat(sidebar): collapsible sidebar with hover-to-peek reveal (#1011)

Gabriel Stein64eaf3e3f46e
diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsx
index 90a1d73b5..7705b325d 100644
--- a/src/components/ControlPanel.tsx
+++ b/src/components/ControlPanel.tsx
@@ -1,7 +1,16 @@
import React, { Suspense, useState, useEffect, useRef, useCallback } from "react";
import { useTranslation } from "react-i18next";
import { Button } from "./ui/button";
-import { Download, RefreshCw, Loader2, AlertTriangle, Zap, ChevronLeft } from "lucide-react";
+import {
+ Download,
+ RefreshCw,
+ Loader2,
+ AlertTriangle,
+ Zap,
+ ChevronLeft,
+ PanelLeftOpen,
+ PanelLeftClose,
+} from "lucide-react";
import UpgradePrompt from "./UpgradePrompt";
import PostMigrationOnboarding from "./PostMigrationOnboarding";
import { ConfirmDialog, AlertDialog } from "./ui/dialog";
@@ -12,6 +21,7 @@ import { useUpdater } from "../hooks/useUpdater";
import { useSettings } from "../hooks/useSettings";
import { useAuth } from "../hooks/useAuth";
import { useUsage } from "../hooks/useUsage";
+import { useCollapsibleSidebar } from "../hooks/useCollapsibleSidebar";
import {
useTranscriptions,
useShowDiscarded,
@@ -54,6 +64,11 @@ import { WORKSPACES_ENABLED } from "../lib/features";
const platform = getCachedPlatform();
+const SIDEBAR_WIDTH_PX = 192;
+
+const toggleIconClass =
+ "text-foreground/60 group-hover:text-foreground/75 dark:text-foreground/50 dark:group-hover:text-foreground/65 transition-colors duration-150";
+
const SettingsModal = React.lazy(() => import("./SettingsModal"));
const ReferralModal = React.lazy(() => import("./ReferralModal"));
const PersonalNotesView = React.lazy(() => import("./notes/PersonalNotesView"));
@@ -89,6 +104,14 @@ export default function ControlPanel({ initialSettingsSection }: ControlPanelPro
const showDiscarded = useShowDiscarded();
const [showCloudMigrationBanner, setShowCloudMigrationBanner] = useState(false);
const [activeView, setActiveView] = useState<ControlPanelView>("home");
+ const {
+ collapsed: sidebarCollapsed,
+ peek: sidebarPeek,
+ toggle: toggleSidebar,
+ showPeek: showSidebarPeek,
+ hidePeek: hideSidebarPeek,
+ leaveToggle: leaveSidebarToggle,
+ } = useCollapsibleSidebar();
const isMeetingMode = useIsMeetingMode();
const isNarrowWindow = useIsNarrowWindow();
const activeNoteId = useActiveNoteId();
@@ -807,10 +830,25 @@ export default function ControlPanel({ initialSettingsSection }: ControlPanelPro
</Suspense>
)}
- <div className="flex flex-1 overflow-hidden">
+ <div className="flex flex-1 overflow-hidden relative">
+ <div
+ className="shrink-0 transition-[width] duration-300 ease-out"
+ style={{ width: sidebarCollapsed || isSidePanelLayout ? 0 : SIDEBAR_WIDTH_PX }}
+ />
<div
- className="shrink-0 overflow-hidden transition-[width] duration-300 ease-out"
- style={{ width: isSidePanelLayout ? 0 : undefined }}
+ className={`absolute inset-y-0 left-0 z-30 transition-transform duration-300 ease-out${
+ sidebarCollapsed && sidebarPeek && !isSidePanelLayout
+ ? " shadow-[10px_0_40px_-18px_rgba(0,0,0,0.2)]"
+ : ""
+ }`}
+ style={{
+ transform:
+ !isSidePanelLayout && (!sidebarCollapsed || sidebarPeek)
+ ? "translateX(0)"
+ : "translateX(-100%)",
+ }}
+ onMouseEnter={sidebarCollapsed ? showSidebarPeek : undefined}
+ onMouseLeave={sidebarCollapsed ? hideSidebarPeek : undefined}
>
<ControlPanelSidebar
activeView={activeView}
@@ -1032,6 +1070,28 @@ export default function ControlPanel({ initialSettingsSection }: ControlPanelPro
)}
</div>
</main>
+ {!isSidePanelLayout && (
+ <div
+ className={`absolute z-40 flex h-10 items-center ${
+ platform === "darwin" ? "left-21 top-2" : "left-2 top-0"
+ }`}
+ style={{ WebkitAppRegion: "no-drag" } as React.CSSProperties}
+ onMouseEnter={sidebarCollapsed ? showSidebarPeek : undefined}
+ onMouseLeave={sidebarCollapsed ? leaveSidebarToggle : undefined}
+ >
+ <button
+ onClick={toggleSidebar}
+ aria-label={sidebarCollapsed ? t("sidebar.expand") : t("sidebar.collapse")}
+ className="group flex items-center justify-center h-7 w-7 rounded-md outline-none hover:bg-foreground/5 dark:hover:bg-white/5 focus-visible:ring-1 focus-visible:ring-primary/30 transition-colors duration-150"
+ >
+ {sidebarCollapsed ? (
+ <PanelLeftOpen size={15} className={toggleIconClass} />
+ ) : (
+ <PanelLeftClose size={15} className={toggleIconClass} />
+ )}
+ </button>
+ </div>
+ )}
</div>
<BackgroundActionToastListener />
</div>
diff --git a/src/components/ControlPanelSidebar.tsx b/src/components/ControlPanelSidebar.tsx
index d74d90ea8..0c76ccaec 100644
--- a/src/components/ControlPanelSidebar.tsx
+++ b/src/components/ControlPanelSidebar.tsx
@@ -27,8 +27,20 @@ import { WORKSPACES_ENABLED } from "../lib/features";
const platform = getCachedPlatform();
+const rowIconClass =
+ "shrink-0 text-foreground/60 group-hover:text-foreground/75 dark:text-foreground/50 dark:group-hover:text-foreground/65 transition-colors duration-150";
+const rowLabelClass =
+ "text-xs text-foreground/80 group-hover:text-foreground dark:text-foreground/70 dark:group-hover:text-foreground/85 transition-colors duration-150";
+const rowButtonClass =
+ "group flex items-center gap-2.5 w-full h-8 px-2.5 rounded-md text-left outline-none hover:bg-foreground/4 dark:hover:bg-white/4 focus-visible:ring-1 focus-visible:ring-primary/30 transition-colors duration-150";
+
export type ControlPanelView =
- "home" | "chat" | "personal-notes" | "dictionary" | "upload" | "integrations";
+ | "home"
+ | "chat"
+ | "personal-notes"
+ | "dictionary"
+ | "upload"
+ | "integrations";
interface ControlPanelSidebarProps {
activeView: ControlPanelView;
@@ -237,15 +249,10 @@ export default function ControlPanelSidebar({
<button
onClick={onOpenReferrals}
aria-label={t("sidebar.referral")}
- className="group flex items-center gap-2.5 w-full h-8 px-2.5 rounded-md text-left outline-none hover:bg-foreground/4 dark:hover:bg-white/4 focus-visible:ring-1 focus-visible:ring-primary/30 transition-colors duration-150"
+ className={rowButtonClass}
>
- <Gift
- size={15}
- className="shrink-0 text-foreground/60 group-hover:text-foreground/75 dark:text-foreground/50 dark:group-hover:text-foreground/65 transition-colors duration-150"
- />
- <span className="text-xs text-foreground/80 group-hover:text-foreground dark:text-foreground/70 dark:group-hover:text-foreground/85 transition-colors duration-150">
- {t("sidebar.referral")}
- </span>
+ <Gift size={15} className={rowIconClass} />
+ <span className={rowLabelClass}>{t("sidebar.referral")}</span>
</button>
)}
@@ -255,13 +262,10 @@ export default function ControlPanelSidebar({
aria-label={
activeWorkspace ? t("sidebar.inviteTeammate") : t("sidebar.createWorkspace")
}
- className="group flex items-center gap-2.5 w-full h-8 px-2.5 rounded-md text-left outline-none hover:bg-foreground/4 dark:hover:bg-white/4 focus-visible:ring-1 focus-visible:ring-primary/30 transition-colors duration-150"
+ className={rowButtonClass}
>
- <UserPlus
- size={15}
- className="shrink-0 text-foreground/60 group-hover:text-foreground/75 dark:text-foreground/50 dark:group-hover:text-foreground/65 transition-colors duration-150"
- />
- <span className="text-xs text-foreground/80 group-hover:text-foreground dark:text-foreground/70 dark:group-hover:text-foreground/85 transition-colors duration-150">
+ <UserPlus size={15} className={rowIconClass} />
+ <span className={rowLabelClass}>
{activeWorkspace ? t("sidebar.inviteTeammate") : t("sidebar.createWorkspace")}
</span>
</button>
@@ -270,30 +274,17 @@ export default function ControlPanelSidebar({
<button
onClick={onOpenSettings}
aria-label={t("sidebar.settings")}
- className="group flex items-center gap-2.5 w-full h-8 px-2.5 rounded-md text-left outline-none hover:bg-foreground/4 dark:hover:bg-white/4 focus-visible:ring-1 focus-visible:ring-primary/30 transition-colors duration-150"
+ className={rowButtonClass}
>
- <Settings
- size={15}
- className="shrink-0 text-foreground/60 group-hover:text-foreground/75 dark:text-foreground/50 dark:group-hover:text-foreground/65 transition-colors duration-150"
- />
- <span className="text-xs text-foreground/80 group-hover:text-foreground dark:text-foreground/70 dark:group-hover:text-foreground/85 transition-colors duration-150">
- {t("sidebar.settings")}
- </span>
+ <Settings size={15} className={rowIconClass} />
+ <span className={rowLabelClass}>{t("sidebar.settings")}</span>
</button>
<SupportDropdown
trigger={
- <button
- aria-label={t("sidebar.support")}
- className="group flex items-center gap-2.5 w-full h-8 px-2.5 rounded-md text-left outline-none hover:bg-foreground/4 dark:hover:bg-white/4 focus-visible:ring-1 focus-visible:ring-primary/30 transition-colors duration-150"
- >
- <HelpCircle
- size={15}
- className="shrink-0 text-foreground/60 group-hover:text-foreground/75 dark:text-foreground/50 dark:group-hover:text-foreground/65 transition-colors duration-150"
- />
- <span className="text-xs text-foreground/80 group-hover:text-foreground dark:text-foreground/70 dark:group-hover:text-foreground/85 transition-colors duration-150">
- {t("sidebar.support")}
- </span>
+ <button aria-label={t("sidebar.support")} className={rowButtonClass}>
+ <HelpCircle size={15} className={rowIconClass} />
+ <span className={rowLabelClass}>{t("sidebar.support")}</span>
</button>
}
/>
diff --git a/src/hooks/useCollapsibleSidebar.ts b/src/hooks/useCollapsibleSidebar.ts
new file mode 100644
index 000000000..ef3210e1c
--- /dev/null
+++ b/src/hooks/useCollapsibleSidebar.ts
@@ -0,0 +1,41 @@
+import { useCallback, useEffect, useRef, useState } from "react";
+
+const PEEK_CLOSE_DELAY_MS = 120;
+
+export function useCollapsibleSidebar() {
+ const [collapsed, setCollapsed] = useState(
+ () => localStorage.getItem("sidebarCollapsed") === "true"
+ );
+ const [peek, setPeek] = useState(false);
+ const peekTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
+ const suppressPeek = useRef(false);
+
+ const toggle = useCallback(() => {
+ clearTimeout(peekTimer.current);
+ setPeek(false);
+ const next = !collapsed;
+ suppressPeek.current = next;
+ localStorage.setItem("sidebarCollapsed", String(next));
+ setCollapsed(next);
+ }, [collapsed]);
+
+ const showPeek = useCallback(() => {
+ if (suppressPeek.current) return;
+ clearTimeout(peekTimer.current);
+ setPeek(true);
+ }, []);
+
+ const hidePeek = useCallback(() => {
+ clearTimeout(peekTimer.current);
+ peekTimer.current = setTimeout(() => setPeek(false), PEEK_CLOSE_DELAY_MS);
+ }, []);
+
+ const leaveToggle = useCallback(() => {
+ suppressPeek.current = false;
+ hidePeek();
+ }, [hidePeek]);
+
+ useEffect(() => () => clearTimeout(peekTimer.current), []);
+
+ return { collapsed, peek, toggle, showPeek, hidePeek, leaveToggle };
+}
diff --git a/src/locales/de/translation.json b/src/locales/de/translation.json
index ac81c12b8..50d1ae7b6 100644
--- a/src/locales/de/translation.json
+++ b/src/locales/de/translation.json
@@ -2430,7 +2430,9 @@
"notSignedIn": "Nicht angemeldet",
"chat": "Chat",
"inviteTeammate": "Teammitglied einladen",
- "createWorkspace": "Workspace erstellen"
+ "createWorkspace": "Workspace erstellen",
+ "collapse": "Seitenleiste einklappen",
+ "expand": "Seitenleiste ausklappen"
},
"chat": {
"newChat": "Neuer Chat",
diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json
index 02e8f67b2..1d4a33e0c 100644
--- a/src/locales/en/translation.json
+++ b/src/locales/en/translation.json
@@ -2116,7 +2116,9 @@
"notSignedIn": "Not signed in",
"chat": "Chat",
"inviteTeammate": "Invite teammate",
- "createWorkspace": "Create workspace"
+ "createWorkspace": "Create workspace",
+ "collapse": "Collapse sidebar",
+ "expand": "Expand sidebar"
},
"workspaces": {
"switcher": {
diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json
index 7c8dd7607..f21d69424 100644
--- a/src/locales/es/translation.json
+++ b/src/locales/es/translation.json
@@ -2478,7 +2478,9 @@
"notSignedIn": "Sin sesión iniciada",
"chat": "Chat",
"inviteTeammate": "Invitar compañero",
- "createWorkspace": "Crear espacio de trabajo"
+ "createWorkspace": "Crear espacio de trabajo",
+ "collapse": "Contraer barra lateral",
+ "expand": "Expandir barra lateral"
},
"chat": {
"newChat": "Nuevo chat",
diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json
index 8230ac0ce..c3c7987d2 100644
--- a/src/locales/fr/translation.json
+++ b/src/locales/fr/translation.json
@@ -2076,7 +2076,9 @@
"notSignedIn": "Non connecté",
"chat": "Chat",
"inviteTeammate": "Inviter un coéquipier",
- "createWorkspace": "Créer un espace de travail"
+ "createWorkspace": "Créer un espace de travail",
+ "collapse": "Réduire la barre latérale",
+ "expand": "Développer la barre latérale"
},
"chat": {
"newChat": "Nouveau chat",
diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json
index aa0fe18f1..db3412593 100644
--- a/src/locales/it/translation.json
+++ b/src/locales/it/translation.json
@@ -2430,7 +2430,9 @@
"notSignedIn": "Non hai effettuato l'accesso",
"chat": "Chat",
"inviteTeammate": "Inviter un coéquipier",
- "createWorkspace": "Créer un espace de travail"
+ "createWorkspace": "Créer un espace de travail",
+ "collapse": "Comprimi barra laterale",
+ "expand": "Espandi barra laterale"
},
"chat": {
"newChat": "Nuova chat",
diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json
index e116e5989..c7fa28ffa 100644
--- a/src/locales/ja/translation.json
+++ b/src/locales/ja/translation.json
@@ -2430,7 +2430,9 @@
"notSignedIn": "未サインイン",
"chat": "チャット",
"inviteTeammate": "Invitar compañero",
- "createWorkspace": "Crear espacio de trabajo"
+ "createWorkspace": "Crear espacio de trabajo",
+ "collapse": "サイドバーを折りたたむ",
+ "expand": "サイドバーを展開"
},
"chat": {
"newChat": "新しいチャット",
diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json
index 5ace4e29f..8ab56278e 100644
--- a/src/locales/pt/translation.json
+++ b/src/locales/pt/translation.json
@@ -2430,7 +2430,9 @@
"notSignedIn": "Não conectado",
"chat": "Chat",
"inviteTeammate": "Invitar compañero",
- "createWorkspace": "Crear espacio de trabajo"
+ "createWorkspace": "Crear espacio de trabajo",
+ "collapse": "Recolher barra lateral",
+ "expand": "Expandir barra lateral"
},
"chat": {
"newChat": "Novo chat",
diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json
index da4a4968b..4fd40a959 100644
--- a/src/locales/ru/translation.json
+++ b/src/locales/ru/translation.json
@@ -2434,7 +2434,9 @@
"notSignedIn": "Не авторизован",
"chat": "Чат",
"inviteTeammate": "Teammitglied einladen",
- "createWorkspace": "Workspace erstellen"
+ "createWorkspace": "Workspace erstellen",
+ "collapse": "Свернуть боковую панель",
+ "expand": "Развернуть боковую панель"
},
"chat": {
"newChat": "Новый чат",
diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json
index 238199d32..42aaf4f16 100644
--- a/src/locales/zh-CN/translation.json
+++ b/src/locales/zh-CN/translation.json
@@ -2425,7 +2425,9 @@
"notSignedIn": "未登录",
"chat": "聊天",
"inviteTeammate": "Invitar compañero",
- "createWorkspace": "Crear espacio de trabajo"
+ "createWorkspace": "Crear espacio de trabajo",
+ "collapse": "折叠侧边栏",
+ "expand": "展开侧边栏"
},
"chat": {
"newChat": "新对话",
diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json
index c32d305a4..eb1f84c18 100644
--- a/src/locales/zh-TW/translation.json
+++ b/src/locales/zh-TW/translation.json
@@ -2425,7 +2425,9 @@
"notSignedIn": "尚未登入",
"chat": "聊天",
"inviteTeammate": "Invitar compañero",
- "createWorkspace": "Crear espacio de trabajo"
+ "createWorkspace": "Crear espacio de trabajo",
+ "collapse": "收合側邊欄",
+ "expand": "展開側邊欄"
},
"chat": {
"newChat": "新對話",