Skip to content

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

feat(ui): responsive settings dialog for narrow windows

Gabriel Stein0c496d329d5a
diff --git a/src/components/DeveloperSection.tsx b/src/components/DeveloperSection.tsx
index 9c6647c3e..5daedc0f4 100644
--- a/src/components/DeveloperSection.tsx
+++ b/src/components/DeveloperSection.tsx
@@ -4,10 +4,12 @@ import { Button } from "./ui/button";
import { FolderOpen, Copy, Check } from "lucide-react";
import { useToast } from "./ui/Toast";
import { Toggle } from "./ui/toggle";
+import { useSettingsLayout } from "./ui/SidebarModal";
import logger from "../utils/logger";
export default function DeveloperSection() {
const { t } = useTranslation();
+ const { isCompact } = useSettingsLayout();
const [debugEnabled, setDebugEnabled] = useState(false);
const [logPath, setLogPath] = useState<string | null>(null);
const [isLoading, setIsLoading] = useState(true);
@@ -197,7 +199,9 @@ export default function DeveloperSection() {
</div>
<div className="rounded-xl border border-border/60 dark:border-border-subtle bg-card dark:bg-surface-2">
<div className="px-5 py-4">
- <div className="grid grid-cols-2 gap-x-6 gap-y-2">
+ <div
+ className={`grid gap-y-2 ${isCompact ? "grid-cols-1 gap-x-0" : "grid-cols-2 gap-x-6"}`}
+ >
{[
t("developerSection.whatGetsLogged.items.audioProcessing"),
t("developerSection.whatGetsLogged.items.apiRequests"),
diff --git a/src/components/ReasoningModelSelector.tsx b/src/components/ReasoningModelSelector.tsx
index 3e75b80d3..57bac5dc8 100644
--- a/src/components/ReasoningModelSelector.tsx
+++ b/src/components/ReasoningModelSelector.tsx
@@ -824,7 +824,7 @@ export default function ReasoningModelSelector({
</div>
<p className="text-xs text-muted-foreground">
{t("reasoning.custom.queryPrefix")}{" "}
- <code>
+ <code className="break-all">
{hasCustomBase
? `${effectiveReasoningBase}/models`
: `${defaultOpenAIBase}/models`}
diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsx
index 122f33132..226621e35 100644
--- a/src/components/SettingsPage.tsx
+++ b/src/components/SettingsPage.tsx
@@ -74,6 +74,7 @@ import { useTheme } from "../hooks/useTheme";
import type { GpuDevice, LocalTranscriptionProvider } from "../types/electron";
import logger from "../utils/logger";
import { SettingsRow } from "./ui/SettingsSection";
+import { useSettingsLayout } from "./ui/SidebarModal";
import { useUsage } from "../hooks/useUsage";
import { cn } from "./lib/utils";
import { startMigration, useMigration } from "../stores/noteStore.js";
@@ -137,7 +138,11 @@ function SettingsPanelRow({
children: React.ReactNode;
className?: string;
}) {
- return <div className={`px-4 py-3 ${className}`}>{children}</div>;
+ const { isCompact } = useSettingsLayout();
+
+ return (
+ <div className={`${isCompact ? "px-3 py-2.5" : "px-4 py-3"} ${className}`}>{children}</div>
+ );
}
function SectionHeader({ title, description }: { title: string; description?: string }) {
@@ -692,6 +697,7 @@ function GpuDeviceSelector({ purpose }: { purpose: "transcription" | "intelligen
}
export default function SettingsPage({ activeSection = "general" }: SettingsPageProps) {
+ const { isCompact } = useSettingsLayout();
const {
confirmDialog,
alertDialog,
@@ -1505,7 +1511,7 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage
) : isLoaded ? (
<>
<SectionHeader title={t("settingsPage.account.pricing.title")} />
- <div className="grid grid-cols-4 gap-1.5">
+ <div className={`grid gap-1.5 ${isCompact ? "grid-cols-2" : "grid-cols-4"}`}>
{/* Free */}
<div
className={cn(
diff --git a/src/components/notes/NoteBottomBar.tsx b/src/components/notes/NoteBottomBar.tsx
index 23de72a7d..54fd0bafe 100644
--- a/src/components/notes/NoteBottomBar.tsx
+++ b/src/components/notes/NoteBottomBar.tsx
@@ -99,18 +99,18 @@ export default function NoteBottomBar({
onClick={onStopRecording}
className={cn(
"flex items-center gap-2 h-10 pl-3.5 pr-3 rounded-xl",
- "bg-foreground/3 dark:bg-white/4",
- "border border-border/20 dark:border-white/6",
+ "bg-primary/6 dark:bg-primary/10",
+ "border border-primary/20 dark:border-primary/25",
"backdrop-blur-sm",
"transition-colors duration-150",
- "hover:bg-foreground/5 dark:hover:bg-white/6"
+ "hover:bg-primary/10 dark:hover:bg-primary/15"
)}
>
<div className="flex items-end gap-0.5 h-3.5">
{Array.from({ length: BAR_COUNT }, (_, i) => (
<div
key={i}
- className="w-0.5 rounded-full bg-foreground/40 dark:bg-white/40 origin-bottom"
+ className="w-0.5 rounded-full bg-primary/60 dark:bg-primary/70 origin-bottom"
style={{
height: "100%",
animation: `waveform-bar ${0.5 + i * 0.07}s ease-in-out infinite`,
@@ -119,10 +119,10 @@ export default function NoteBottomBar({
/>
))}
</div>
- <span className="text-[11px] font-medium tabular-nums text-foreground/40 dark:text-foreground/30">
+ <span className="text-[11px] font-medium tabular-nums text-primary/60 dark:text-primary/70">
{minutes}:{seconds}
</span>
- <Square size={9} fill="currentColor" className="text-foreground/30" />
+ <Square size={9} fill="currentColor" className="text-primary/50" />
</button>
) : isProcessing ? (
<div
diff --git a/src/components/ui/SettingsSection.tsx b/src/components/ui/SettingsSection.tsx
index ec176d7e5..daf4c9e9a 100644
--- a/src/components/ui/SettingsSection.tsx
+++ b/src/components/ui/SettingsSection.tsx
@@ -1,4 +1,5 @@
import React from "react";
+import { useSettingsLayout } from "./SidebarModal";
interface SettingsSectionProps {
title: string;
@@ -66,15 +67,21 @@ export const SettingsRow: React.FC<SettingsRowProps> = ({
children,
className = "",
}) => {
+ const { isCompact } = useSettingsLayout();
+
return (
- <div className={`flex items-center justify-between gap-4 ${className}`}>
+ <div
+ className={`flex ${
+ isCompact ? "flex-col items-start gap-2" : "items-center justify-between gap-4"
+ } ${className}`}
+ >
<div className="min-w-0 flex-1">
<p className="text-xs font-medium text-foreground">{label}</p>
{description && (
<p className="text-xs text-muted-foreground/80 mt-0.5 leading-relaxed">{description}</p>
)}
</div>
- <div className="shrink-0">{children}</div>
+ <div className={isCompact ? "" : "shrink-0"}>{children}</div>
</div>
);
};
@@ -102,7 +109,11 @@ export function SettingsPanelRow({
children: React.ReactNode;
className?: string;
}) {
- return <div className={`px-4 py-3 ${className}`}>{children}</div>;
+ const { isCompact } = useSettingsLayout();
+
+ return (
+ <div className={`${isCompact ? "px-3 py-2.5" : "px-4 py-3"} ${className}`}>{children}</div>
+ );
}
export function SectionHeader({ title, description }: { title: string; description?: string }) {
diff --git a/src/components/ui/SidebarModal.tsx b/src/components/ui/SidebarModal.tsx
index 82ebfc9e1..229c9e6a9 100644
--- a/src/components/ui/SidebarModal.tsx
+++ b/src/components/ui/SidebarModal.tsx
@@ -3,6 +3,9 @@ import { useTranslation } from "react-i18next";
import * as DialogPrimitive from "@radix-ui/react-dialog";
import { X } from "lucide-react";
+const SettingsLayoutContext = React.createContext({ isCompact: false });
+export const useSettingsLayout = () => React.useContext(SettingsLayoutContext);
+
export interface SidebarItem<T extends string> {
id: T;
label: string;
@@ -38,6 +41,24 @@ export default function SidebarModal<T extends string>({
version,
}: SidebarModalProps<T>) {
const { t } = useTranslation();
+
+ const [isCompact, setIsCompact] = React.useState(false);
+ const observerRef = React.useRef<ResizeObserver | null>(null);
+
+ const containerRef = React.useCallback((el: HTMLDivElement | null) => {
+ if (observerRef.current) {
+ observerRef.current.disconnect();
+ observerRef.current = null;
+ }
+ if (!el) return;
+ const observer = new ResizeObserver((entries) => {
+ const width = entries[0]?.contentRect.width ?? 0;
+ setIsCompact(width > 0 && width < 800);
+ });
+ observer.observe(el);
+ observerRef.current = observer;
+ }, []);
+
// Group items by their group property
const groupedItems = React.useMemo(() => {
const groups: { label: string | null; items: SidebarItem<T>[] }[] = [];
@@ -78,6 +99,8 @@ export default function SidebarModal<T extends string>({
);
};
+ const actualSidebarWidth = isCompact ? "w-12" : sidebarWidth;
+
return (
<DialogPrimitive.Root open={open} onOpenChange={onOpenChange}>
<DialogPrimitive.Portal>
@@ -89,23 +112,29 @@ export default function SidebarModal<T extends string>({
<span className="sr-only">{t("common.close")}</span>
</DialogPrimitive.Close>
- <div className="flex h-[85vh]">
+ <div ref={containerRef} className="flex h-[85vh]">
{/* Sidebar */}
<div
- className={`${sidebarWidth} shrink-0 border-r border-border/40 dark:border-border-subtle flex flex-col bg-surface-1 dark:bg-surface-0`}
+ className={`${actualSidebarWidth} shrink-0 border-r border-border/40 dark:border-border-subtle flex flex-col bg-surface-1 dark:bg-surface-0 transition-[width] duration-200 ease-out`}
>
{/* Title */}
- <div className="px-4 pt-5 pb-0.5">
- <h2 className="text-xs font-semibold uppercase tracking-widest text-muted-foreground/70">
- {title}
- </h2>
- </div>
+ {!isCompact && (
+ <div className="px-4 pt-5 pb-0.5">
+ <h2 className="text-xs font-semibold uppercase tracking-widest text-muted-foreground/70">
+ {title}
+ </h2>
+ </div>
+ )}
{/* Navigation */}
- <nav className="relative flex-1 px-2 pt-2.5 pb-2 overflow-y-auto">
+ <nav
+ className={`relative flex-1 pb-2 overflow-y-auto ${
+ isCompact ? "px-1.5 pt-4" : "px-2 pt-2.5"
+ }`}
+ >
{groupedItems.map((group, groupIndex) => (
<div key={groupIndex} className={groupIndex > 0 ? "mt-3" : ""}>
- {group.label && (
+ {!isCompact && group.label && (
<div className="px-2 pb-0.5 pt-1.5">
<span className="text-xs font-medium tracking-[0.08em] uppercase text-muted-foreground/60 dark:text-muted-foreground/65">
{group.label}
@@ -116,12 +145,16 @@ export default function SidebarModal<T extends string>({
{group.items.map((item) => {
const Icon = item.icon;
const isActive = activeSection === item.id;
+
return (
<button
key={item.id}
data-section-id={item.id}
onClick={() => onSectionChange(item.id)}
- className={`group relative w-full flex items-center gap-2.5 px-2.5 py-2 text-left text-xs rounded-lg transition-colors duration-100 outline-none ${
+ title={isCompact ? item.label : undefined}
+ className={`group relative w-full flex items-center text-left text-xs rounded-lg transition-colors duration-100 outline-none ${
+ isCompact ? "justify-center px-0 py-2" : "gap-2.5 px-2.5 py-2"
+ } ${
isActive
? "text-foreground bg-muted dark:bg-surface-raised"
: "text-muted-foreground dark:text-foreground/75 hover:text-foreground hover:bg-muted/50 dark:hover:bg-surface-2"
@@ -140,16 +173,23 @@ export default function SidebarModal<T extends string>({
}`}
/>
</div>
- <span
- className={`flex-1 truncate leading-tight ${isActive ? "font-medium" : "font-normal"}`}
- >
- {item.label}
- </span>
- {renderBadge(item)}
- {item.shortcut && !item.badge && (
- <kbd className="ml-auto text-xs text-muted-foreground/25 font-mono shrink-0">
- {item.shortcut}
- </kbd>
+ {!isCompact && (
+ <>
+ <span
+ className={`flex-1 truncate leading-tight ${isActive ? "font-medium" : "font-normal"}`}
+ >
+ {item.label}
+ </span>
+ {renderBadge(item)}
+ {item.shortcut && !item.badge && (
+ <kbd className="ml-auto text-xs text-muted-foreground/25 font-mono shrink-0">
+ {item.shortcut}
+ </kbd>
+ )}
+ </>
+ )}
+ {isCompact && item.badgeVariant === "dot" && (
+ <span className="absolute top-1.5 right-1.5 h-1.5 w-1.5 rounded-full bg-primary" />
)}
</button>
);
@@ -161,12 +201,18 @@ export default function SidebarModal<T extends string>({
{/* Footer / version */}
{version && (
- <div className="px-3 py-2.5 border-t border-border/20 dark:border-border-subtle">
+ <div
+ className={`border-t border-border/20 dark:border-border-subtle ${
+ isCompact ? "flex justify-center py-2.5" : "px-3 py-2.5"
+ }`}
+ >
<div className="flex items-center gap-1.5">
<div className="h-1 w-1 rounded-full bg-success/60" />
- <span className="text-xs text-muted-foreground/40 tabular-nums tracking-wide">
- v{version}
- </span>
+ {!isCompact && (
+ <span className="text-xs text-muted-foreground/40 tabular-nums tracking-wide">
+ v{version}
+ </span>
+ )}
</div>
</div>
)}
@@ -174,7 +220,9 @@ export default function SidebarModal<T extends string>({
{/* Main Content */}
<div className="flex-1 overflow-y-auto bg-background dark:bg-surface-1">
- <div className="p-6">{children}</div>
+ <SettingsLayoutContext.Provider value={{ isCompact }}>
+ <div className={isCompact ? "p-4" : "p-6"}>{children}</div>
+ </SettingsLayoutContext.Provider>
</div>
</div>
</div>