Skip to content

VoiceStudio is the open-source, fully-local ElevenLabs alternative — voice cloning, voice design, video dubbing, dictation, transcription & audiobook creation in 646 languages.

feat(electron): slim icon rail with section panes, one-pill star button, and saved projects in section panes

debpalash99bb21fc10c6
diff --git a/docs/electron-dubbing.md b/docs/electron-dubbing.md
index fa76d9dbb..7685b3b57 100644
--- a/docs/electron-dubbing.md
+++ b/docs/electron-dubbing.md
@@ -41,6 +41,8 @@ Generate. Persisted provider error pages are discarded and restored to the sourc
dialogue with a retryable error state.
Long projects virtualize transcript rows, so only the visible editors are mounted.
+
+The Dubbing pane has a Projects tab beside its controls that lists saved dub projects, newest first. One tap opens a project in place (it waits while a dub is running); the Projects workspace remains the place to save, rename and delete.
Timeline waveform peaks and onsets are computed once by the backend and cached as a
small JSON payload; Chromium never decodes the full separated-vocals WAV to draw the
timeline. Video previews are written atomically with MP4 fast-start metadata and are
diff --git a/docs/electron-longform.md b/docs/electron-longform.md
index 7040b2373..7f3ffa8ad 100644
--- a/docs/electron-longform.md
+++ b/docs/electron-longform.md
@@ -36,7 +36,7 @@ WebVTT (`.vtt`) captions also import locally; their cue metadata is dropped befo
Stories imports TXT, Markdown and SRT locally; EPUB/PDF still use the shared backend importer. The EPUB importer skips marked pagination and ancillary sections such as cover, title, dedication, contents and copyright pages. Unmarked pages are judged by the book's own structure: only a short, heading-less, unlisted page ahead of the reading start is skipped, even when an EPUB 2 guide or EPUB 3 landmark declares that start; headed or substantial unlisted prologues are retained; the same kind of stray page is skipped at the back only once back matter that the contents lists has begun, so an unlisted file that continues the last chapter is always kept. Publisher and bibliography headings such as “Published by” and “Novels by” are skipped only on short, unlisted pages before the reading start; an ambiguous heading alone (for example “Works”) is not enough to delete a section. Unmarked numeric paragraphs and page-break layout classes remain narration. Chapter titles prefer the EPUB 3 table of contents, then NCX labels and headings; namespace aliases and declared encodings are supported. Malformed optional navigation falls back to headings, while malformed package/container XML reports an import error. Imported text goes into a persisted review buffer, then Auto-cast or Split into lines appends to existing work. The splitter is shared with the browser app and offers three presets: Sentences (the sentence-aware splitter with the same 40-2000 character limit), Paragraphs (the default; one line per blank-line paragraph, or per line when the text has no blank lines at all; LF, CRLF and lone-CR endings are all understood) and Chapters (one line per chapter body, split only at chapter headings — a non-empty `# Title`, the same grammar the renderer uses). A chapter heading is always its own line so it renders as a chapter marker.
-The Electron workspace keeps title, default voice, language and output format together in a fixed setup card. Advanced cast, project, production and book controls use separate collapsed cards. The editor keeps its full working width; an empty Story shows one Add First Line action, while an empty Audiobook shows the supported chapter and voice markup directly in the script field.
+The Electron workspace keeps title, default voice, language and output format together in a fixed setup card. Advanced cast, production and book controls use separate collapsed cards; saving, opening and deleting named projects sits in the pane's Projects tab beside the controls. The editor keeps its full working width; an empty Story shows one Add First Line action, while an empty Audiobook shows the supported chapter and voice markup directly in the script field.
Stories line auditions reuse the shared WAV assembler and canonical voice/pause/speed parser. Auditions resolve inline names with the same fallback as full renders, expose Stop, and play through Vidstack independently. Changing synthesis inputs clears stale playback; navigation aborts pending auditions. Browser coverage verifies actual playback with mocked generation.
diff --git a/docs/electron-parity.md b/docs/electron-parity.md
index c9bd0c07b..f0edcbeec 100644
--- a/docs/electron-parity.md
+++ b/docs/electron-parity.md
@@ -86,10 +86,12 @@ The main workspace sidebar stays visible on Settings routes, including while the
## Navigation order
-In the expanded sidebar, workspace navigation sits immediately below the header and above the voice library. The status bar and Settings entry remain at the bottom; voice-library scrolling does not move the navigation.
+The expanded sidebar is a slim 216px column: workspace navigation sits immediately below the header, and the status bar and Settings entry stay at the bottom. On macOS the window's traffic lights get their own row above the brand; in full screen the brand moves into that corner. The status area is a slim speed/quality slider (a tier icon, the tier name and an icon-only Auto toggle); hovering or clicking the label, or changing the slider, opens a popover with the model for each engine, the hardware fit and the Simple/Models/Details view switch.
+
+Saved voices and Recent takes live in a context sidebar beside the navigation on Home and Clone (and as a Saved voices tab in the Design pane), so the navigation never carries a library. Any section that brings its own pane keeps navigation as the icon rail below, as in VS Code, Slack and Linear, so the window does not show two wide sidebars. The rail's gauge button opens the same speed/quality popover.
In the compact rail, Voice, Stories and Dubbing open flyouts on mouse hover or click, with full-row click targets. Hover uses a short opening delay and a pointer transit delay into the flyout; touch users can click, and keyboard users can press Enter or Arrow Right/Down to open it, then Arrow Left or Escape to return to the trigger. Choosing a destination keeps its flyout mounted until the route changes; choosing the current destination closes it immediately. Outside clicks close flyouts. Double-clicking the compact rail expands the full sidebar; the header button remains the single-click control. The flyout appears beside its icon without a scale shift while the pointer moves into it.
## Sidebar expansion preference
-Settings → Appearance → Keep sidebar expanded persists the choice locally. It disables automatic compaction on narrower secondary-pane workspaces; the default remains automatic. The explicit close control still works, and the Profiles workspace still avoids duplicating its voice library. The header toggle and sidebar share one state. A compact rail can reopen itself on every desktop platform, using the brand icon on Windows/Linux.
+Settings → Appearance → Keep sidebar expanded persists the choice locally. It disables automatic compaction beside a section pane and on narrow windows. With the default automatic setting, windows up to 1200px wide use the rail. The explicit close control still works. The header toggle and sidebar share one state. A compact rail can reopen itself on every desktop platform, using the brand icon on Windows/Linux.
diff --git a/docs/electron-projects.md b/docs/electron-projects.md
index aa0efcb8e..018ae734d 100644
--- a/docs/electron-projects.md
+++ b/docs/electron-projects.md
@@ -16,7 +16,16 @@ The library combines backend dubbing projects, local IndexedDB Stories and Audio
voice profiles, transcription history, generated takes, export history and completed longform
renders. A stable secondary sidebar filters each source and shows live counts; one search and the
list/grid switch operate without moving the workspace origin. At compact widths the global
-sidebar becomes its icon rail, matching the other secondary-sidebar workspaces.
+sidebar becomes its icon rail, matching the other secondary-sidebar workspaces. The same work
+is also reachable where it is made: Stories and Audiobook show their projects, Dubbing its saved
+dub projects, and Clone, Home and Design the saved voices, each in the workspace's own side pane.
+
+Section tabs support arrow-key navigation (including right-to-left layouts), Home and End.
+Switching tabs keeps unfinished project-name edits. Opening a saved dub asks for confirmation,
+waits for its load before another selection, and rechecks running work before replacing the
+draft. Returning to the controls tab, collapsing the pane or leaving the workspace cancels
+a pending load so its response cannot replace newer edits. Editing the current dub while a
+project loads also keeps those edits and asks for confirmation again before replacing them.
Opening a book or story restores its saved draft after confirmation; deletion detaches the draft
without removing generated media. Inline rename changes only the saved name: dubbing uses the
diff --git a/docs/electron-runtime.md b/docs/electron-runtime.md
index 2fa8c4c63..60a632e06 100644
--- a/docs/electron-runtime.md
+++ b/docs/electron-runtime.md
@@ -9,7 +9,7 @@
Design proposal: [installer plans and recovery review](specs/installer-redesign/readme.md).
This proposal does not change the implemented behavior described below.
-The top bar places a GitHub Star button immediately right of Get Pro, showing the exact star count from GitHub's small public endpoint. It refreshes when shown and every 20 minutes while visible; browser caching keeps repeat requests small. A bundled count remains visible if GitHub is unavailable. Requests send no credentials or referrer, and clicking the shortcut opens GitHub in the external browser. Community, donation and follow links live on the Support page (Settings → Support). Get Pro remains in the top bar.
+The top bar places a GitHub Star button immediately right of Get Pro: one star icon and label, then the exact star count in a divided segment (the star fills on hover), taken from GitHub's small public endpoint. It refreshes when shown and every 20 minutes while visible; browser caching keeps repeat requests small. A bundled count remains visible if GitHub is unavailable. Requests send no credentials or referrer, and clicking the shortcut opens GitHub in the external browser. Community, donation and follow links live on the Support page (Settings → Support). Get Pro remains in the top bar.
Low-disk warnings in the notification menu open Settings > Storage, where users can inspect disk use and clear temporary files.
diff --git a/electron/src/renderer/src/components/app-shell/app-shell.test.tsx b/electron/src/renderer/src/components/app-shell/app-shell.test.tsx
index f5195e21e..aef903a3a 100644
--- a/electron/src/renderer/src/components/app-shell/app-shell.test.tsx
+++ b/electron/src/renderer/src/components/app-shell/app-shell.test.tsx
@@ -13,6 +13,7 @@ vi.mock('@tanstack/react-router', () => ({
vi.mock('./workspace-sidebar', () => ({
WorkspaceSidebar: () => <aside data-testid="main-sidebar" />,
}));
+vi.mock('./context-sidebar', () => ({ ContextSidebar: () => null }));
vi.mock('./repair-agent-dock', () => ({ RepairAgentDock: () => null }));
vi.mock('./system-notifications', () => ({ SystemNotifications: () => null }));
vi.mock('./account-corner', () => ({ AccountCorner: () => <div data-testid="account-corner" /> }));
diff --git a/electron/src/renderer/src/components/app-shell/app-shell.tsx b/electron/src/renderer/src/components/app-shell/app-shell.tsx
index 29242369f..bc7d6746e 100644
--- a/electron/src/renderer/src/components/app-shell/app-shell.tsx
+++ b/electron/src/renderer/src/components/app-shell/app-shell.tsx
@@ -1,4 +1,5 @@
import { WorkspaceSidebar } from './workspace-sidebar';
+import { ContextSidebar } from './context-sidebar';
import { CommandPalette } from '@/components/command-palette';
import { Outlet, useRouterState } from '@tanstack/react-router';
import { BackendGate } from '../backend-gate';
@@ -46,6 +47,7 @@ export function AppShell() {
<BackendGate repairDock={<RepairAgentDock />}>
<CommandPalette />
<WorkspaceSidebar />
+ <ContextSidebar />
<main
data-slot="workspace-content"
className="@container relative flex min-w-0 flex-1 flex-col overflow-hidden"
diff --git a/electron/src/renderer/src/components/app-shell/context-sidebar.test.tsx b/electron/src/renderer/src/components/app-shell/context-sidebar.test.tsx
new file mode 100644
index 000000000..fd877521e
--- /dev/null
+++ b/electron/src/renderer/src/components/app-shell/context-sidebar.test.tsx
@@ -0,0 +1,44 @@
+import { fireEvent, render, screen } from '@testing-library/react';
+import { beforeEach, expect, it, vi } from 'vitest';
+
+const route = vi.hoisted(() => ({ pathname: '/clone' }));
+const workspace = vi.hoisted(() => ({ libraryOpen: false, libraryTab: 'voices' as const }));
+const setWorkspace = vi.hoisted(() => vi.fn());
+
+vi.mock('@tanstack/react-router', () => ({
+ useRouterState: ({ select }: any) => select({ location: route }),
+}));
+vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key: string) => key }) }));
+vi.mock('@/lib/store/workspace', () => ({
+ useWorkspace: () => workspace,
+ setWorkspace,
+}));
+vi.mock('@/features/clone/voices-sidebar', () => ({
+ VoicesSidebar: () => <div>Voice library</div>,
+}));
+
+import { ContextSidebar } from './context-sidebar';
+
+beforeEach(() => {
+ workspace.libraryOpen = false;
+ workspace.libraryTab = 'voices';
+ setWorkspace.mockClear();
+});
+
+it('reopens a collapsed library pane when a library shortcut opens it', () => {
+ const view = render(<ContextSidebar />);
+ expect(document.querySelector('[data-slot="secondary-sidebar"]')).toHaveAttribute(
+ 'data-collapsed',
+ 'true',
+ );
+
+ workspace.libraryOpen = true;
+ view.rerender(<ContextSidebar />);
+ expect(document.querySelector('[data-slot="secondary-sidebar"]')).not.toHaveAttribute(
+ 'data-collapsed',
+ );
+ expect(screen.getByText('Voice library')).toBeVisible();
+
+ fireEvent.click(screen.getByRole('button', { name: 'paneActions.collapse' }));
+ expect(setWorkspace).toHaveBeenCalledWith({ libraryOpen: false });
+});
diff --git a/electron/src/renderer/src/components/app-shell/context-sidebar.tsx b/electron/src/renderer/src/components/app-shell/context-sidebar.tsx
new file mode 100644
index 000000000..3c534a1af
--- /dev/null
+++ b/electron/src/renderer/src/components/app-shell/context-sidebar.tsx
@@ -0,0 +1,27 @@
+import { useRouterState } from '@tanstack/react-router';
+import { LibraryIcon } from 'lucide-react';
+import { useTranslation } from 'react-i18next';
+import { SecondarySidebar } from '@/components/workspace-sidebar';
+import { VoicesSidebar } from '@/features/clone/voices-sidebar';
+import { setWorkspace, useWorkspace } from '@/lib/store/workspace';
+import { LIBRARY_ROUTES } from './use-workspace-sidebar';
+
+/** The user's saved voices and recent takes, beside the slim navigation column. */
+export function ContextSidebar() {
+ const { t } = useTranslation();
+ const { libraryOpen, libraryTab } = useWorkspace();
+ const pathname = useRouterState({ select: (state) => state.location.pathname });
+ if (!LIBRARY_ROUTES.has(pathname.replace(/\/+$/, '') || '/')) return null;
+ return (
+ <SecondarySidebar
+ title={t('nav.voice')}
+ icon={LibraryIcon}
+ variant="library"
+ className="flex flex-col overflow-hidden p-0"
+ collapsed={!libraryOpen}
+ onCollapsedChange={(collapsed) => setWorkspace({ libraryOpen: !collapsed })}
+ >
+ <VoicesSidebar key={libraryTab} initialTab={libraryTab} />
+ </SecondarySidebar>
+ );
+}
diff --git a/electron/src/renderer/src/components/app-shell/github-star.tsx b/electron/src/renderer/src/components/app-shell/github-star.tsx
index 0fdf61787..96f70733c 100644
--- a/electron/src/renderer/src/components/app-shell/github-star.tsx
+++ b/electron/src/renderer/src/components/app-shell/github-star.tsx
@@ -6,14 +6,6 @@ import { runRendererTask } from '@/lib/global-error-recovery';
import { REPO_URL } from '@shared/utils/contactLinks';
import { Tooltip, TooltipTrigger, TooltipContent } from '@/components/ui/tooltip';
-function GithubIcon({ className }: { className?: string }) {
- return (
- <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" className={className}>
- <path d="M12 .5a12 12 0 0 0-3.79 23.39c.6.11.82-.26.82-.58v-2.23c-3.34.73-4.04-1.42-4.04-1.42-.55-1.39-1.33-1.76-1.33-1.76-1.09-.75.08-.73.08-.73 1.2.08 1.84 1.24 1.84 1.24 1.07 1.83 2.81 1.3 3.49.99.11-.78.42-1.3.76-1.6-2.67-.3-5.47-1.34-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.12-.3-.54-1.52.12-3.18 0 0 1.01-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.29-1.55 3.3-1.23 3.3-1.23.66 1.66.24 2.88.12 3.18.77.84 1.24 1.91 1.24 3.22 0 4.6-2.81 5.63-5.49 5.93.43.37.81 1.1.81 2.22v3.29c0 .32.22.7.83.58A12 12 0 0 0 12 .5Z" />
- </svg>
- );
-}
-
const STARS_URL = 'https://api.github.com/repos/debpalash/VoiceStudio';
const REFRESH_MS = 20 * 60 * 1000;
// The last bundled count remains visible when GitHub cannot be reached.
@@ -56,7 +48,7 @@ export function GithubStar() {
target="_blank"
rel="noopener noreferrer"
aria-label={t('support.star_github')}
- className="github-star-shortcut app-no-drag inline-flex h-8 shrink-0 items-center gap-1.5 px-2.5 text-xs font-semibold focus-visible:outline-2 focus-visible:outline-ring"
+ className="github-star-shortcut app-no-drag inline-flex h-8 shrink-0 items-stretch text-xs font-semibold focus-visible:outline-2 focus-visible:outline-ring"
onClick={(event) => {
const bridge = getBridge();
if (!bridge) return;
@@ -66,10 +58,11 @@ export function GithubStar() {
/>
}
>
- <GithubIcon className="size-3.5" />
- <span>{t('support.star_short')}</span>
+ <span className="github-star-label">
+ <StarIcon aria-hidden="true" className="size-3.5" />
+ <span>{t('support.star_short')}</span>
+ </span>
<span className="github-star-count">
- <StarIcon aria-hidden="true" className="size-3" />
{formatCount.format(stars.data ?? BUNDLED_STARS)}
</span>
</TooltipTrigger>
diff --git a/electron/src/renderer/src/components/app-shell/status-bar.tsx b/electron/src/renderer/src/components/app-shell/status-bar.tsx
index 98c9989fb..817c85fd9 100644
--- a/electron/src/renderer/src/components/app-shell/status-bar.tsx
+++ b/electron/src/renderer/src/components/app-shell/status-bar.tsx
@@ -22,6 +22,7 @@ import {
LayersIcon,
CodeXmlIcon,
CpuIcon,
+ GaugeIcon,
MemoryStickIcon,
MonitorUpIcon,
} from 'lucide-react';
@@ -576,6 +577,40 @@ export function StatusBar({
})}
</div>
);
+ // The simplest view is icon-only: the status dot and tooltip carry what a label did.
+ const deviceIconOnly = level === 'simple';
+ const handleApplied = (applied: PerformanceProfileState) => {
+ appliedRefreshStarted.current = presetRefreshing;
+ setAppliedProfile(applied);
+ };
+ // The icon rail has no room for the slider, so the gauge opens it as a popover.
+ const railProfile = (
+ <Popover>
+ <PopoverTrigger
+ render={
+ <button
+ type="button"
+ aria-label={t('performanceProfile.title')}
+ title={t('performanceProfile.title')}
+ // In the macOS rail's two-column footer the gauge takes its own row above Settings.
+ className={cn(engineLinkClass, 'h-7 w-full', inline && 'order-first col-span-2')}
+ />
+ }
+ >
+ <GaugeIcon className={engineIconClass} aria-hidden="true" />
+ </PopoverTrigger>
+ <PopoverContent
+ side="right"
+ align="end"
+ className="max-h-[min(36rem,80dvh)] w-72 space-y-2 overflow-y-auto p-3 text-xs"
+ >
+ {isBackendReachable(status.stage) && (
+ <PerformanceProfile showHardware={false} onApplied={handleApplied} />
+ )}
+ {engineRows('models')}
+ </PopoverContent>
+ </Popover>
+ );
const iconDevicePopover = (
<Popover open={deviceOpen} onOpenChange={setDeviceOpen}>
<PopoverTrigger
@@ -583,17 +618,23 @@ export function StatusBar({
<button
type="button"
aria-label={`${deviceLabel}: ${stageText}`}
- className={cn(engineLinkClass, 'h-7 w-full', !compact && 'justify-start gap-2 px-2')}
+ className={cn(
+ engineLinkClass,
+ 'relative h-7 w-full',
+ !compact && !deviceIconOnly && 'justify-start gap-2 px-2',
+ )}
/>
}
>
<CpuIcon className={engineIconClass} aria-hidden="true" />
- {!compact && <span className="min-w-0 truncate">{deviceLabel}</span>}
+ {!compact && !deviceIconOnly && <span className="min-w-0 truncate">{deviceLabel}</span>}
<span
className={cn(
compact
? 'absolute inset-x-2 bottom-0.5 h-0.5 rounded-full'
- : 'ml-auto size-1.5 shrink-0 rounded-full',
+ : deviceIconOnly
+ ? 'absolute end-1.5 top-1 size-1.5 rounded-full'
+ : 'ml-auto size-1.5 shrink-0 rounded-full',
stageDot,
)}
aria-hidden="true"
@@ -610,6 +651,7 @@ export function StatusBar({
inline ? 'contents' : 'border-t border-border/50 px-1.5 py-2',
)}
>
+ {railProfile}
{iconDevicePopover}
</footer>
);
@@ -640,17 +682,24 @@ export function StatusBar({
</PopoverTrigger>
{deviceContent}
</Popover>
- {viewControl}
+ {level !== 'simple' && viewControl}
</div>
)}
{isBackendReachable(status.stage) && (
<PerformanceProfile
showHardware={level !== 'simple'}
- extra={level === 'simple' ? engineRows('models') : undefined}
- onApplied={(applied) => {
- appliedRefreshStarted.current = presetRefreshing;
- setAppliedProfile(applied);
- }}
+ extra={
+ level === 'simple' ? (
+ <>
+ <div className="flex items-center justify-between gap-2">
+ <span className="text-muted-foreground">{t('sidebarTools.title')}</span>
+ {viewControl}
+ </div>
+ {engineRows('models')}
+ </>
+ ) : undefined
+ }
+ onApplied={handleApplied}
/>
)}
{level !== 'simple' && (
@@ -667,7 +716,7 @@ export function StatusBar({
<div className="sticky bottom-0 mt-1.5 flex items-center gap-1 border-t border-border/50 bg-sidebar pt-1.5">
{footerLeading}
<div className="min-w-0 flex-1">{iconDevicePopover}</div>
- {viewControl}
+ {level !== 'simple' && viewControl}
</div>
)}
</div>
diff --git a/electron/src/renderer/src/components/app-shell/support-shortcut.css b/electron/src/renderer/src/components/app-shell/support-shortcut.css
index 59f16daa9..2258b0266 100644
--- a/electron/src/renderer/src/components/app-shell/support-shortcut.css
+++ b/electron/src/renderer/src/components/app-shell/support-shortcut.css
@@ -40,10 +40,11 @@
transform: translateX(35%);
}
.github-star-shortcut {
- border: 1px solid color-mix(in oklab, #d9b36a 22%, var(--border));
+ overflow: hidden;
+ border: 1px solid color-mix(in oklab, #d9b36a 28%, var(--border));
border-radius: 9px;
- color: color-mix(in oklab, #d9b36a 18%, var(--foreground));
- background: linear-gradient(120deg, color-mix(in oklab, #d9b36a 5%, var(--card)), var(--card));
+ color: color-mix(in oklab, #d9b36a 22%, var(--foreground));
+ background: linear-gradient(120deg, color-mix(in oklab, #d9b36a 7%, var(--card)), var(--card));
box-shadow: inset 0 1px 0 color-mix(in srgb, var(--foreground) 5%, transparent);
transition:
border-color 180ms ease,
@@ -51,28 +52,45 @@
}
.github-star-shortcut:hover,
.github-star-shortcut:focus-visible {
- border-color: color-mix(in oklab, #d9b36a 50%, var(--border));
- box-shadow: 0 0 14px rgb(217 179 106 / 9%);
+ border-color: color-mix(in oklab, #d9b36a 60%, var(--border));
+ box-shadow: 0 0 16px rgb(217 179 106 / 14%);
+}
+.github-star-label {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ padding: 0 10px;
+}
+.github-star-label svg {
+ color: color-mix(in oklab, #d9b36a 85%, var(--foreground));
+ fill: color-mix(in srgb, #d9b36a 25%, transparent);
+ transition:
+ fill 180ms ease,
+ transform 260ms ease;
+}
+.github-star-shortcut:hover .github-star-label svg,
+.github-star-shortcut:focus-visible .github-star-label svg {
+ fill: #d9b36a;
+ transform: rotate(72deg) scale(1.12);
}
.github-star-count {
display: inline-flex;
align-items: center;
- gap: 4px;
- margin-left: 2px;
- padding: 3px 6px;
- border-radius: 5px;
- background: color-mix(in oklab, #d9b36a 9%, transparent);
+ padding: 0 10px;
+ border-left: 1px solid color-mix(in oklab, #d9b36a 22%, var(--border));
+ background: color-mix(in oklab, #d9b36a 10%, transparent);
font-size: 11px;
font-variant-numeric: tabular-nums;
}
-.github-star-count svg {
- color: color-mix(in oklab, #d9b36a 70%, var(--foreground));
- fill: color-mix(in srgb, #d9b36a 22%, transparent);
-}
@media (prefers-reduced-motion: reduce) {
.support-shortcut,
.support-shortcut::before,
- .github-star-shortcut {
+ .github-star-shortcut,
+ .github-star-label svg {
transition: none;
}
+ .github-star-shortcut:hover .github-star-label svg,
+ .github-star-shortcut:focus-visible .github-star-label svg {
+ transform: none;
+ }
}
diff --git a/electron/src/renderer/src/components/app-shell/support-shortcut.tsx b/electron/src/renderer/src/components/app-shell/support-shortcut.tsx
index cb2bd7817..325ff8fde 100644
--- a/electron/src/renderer/src/components/app-shell/support-shortcut.tsx
+++ b/electron/src/renderer/src/components/app-shell/support-shortcut.tsx
@@ -1,5 +1,5 @@
import { Link } from '@tanstack/react-router';
-import { ArrowUpRightIcon, GemIcon } from 'lucide-react';
+import { GemIcon } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { Tooltip, TooltipTrigger, TooltipContent } from '@/components/ui/tooltip';
import './support-shortcut.css';
@@ -23,7 +23,6 @@ export function SupportShortcut() {
<span className="hidden text-xs font-semibold sm:inline">
{t('supportPlans.get_pro')}
</span>
- <ArrowUpRightIcon aria-hidden="true" className="size-3" />
</TooltipTrigger>
<TooltipContent surface="theme" side="bottom">
{t('supportPlans.get_pro')}
diff --git a/electron/src/renderer/src/components/app-shell/use-workspace-sidebar.test.tsx b/electron/src/renderer/src/components/app-shell/use-workspace-sidebar.test.tsx
index d593fd64d..9628538bc 100644
--- a/electron/src/renderer/src/components/app-shell/use-workspace-sidebar.test.tsx
+++ b/electron/src/renderer/src/components/app-shell/use-workspace-sidebar.test.tsx
@@ -47,8 +47,19 @@ it('does not carry a forced expansion to another workspace', () => {
rerender();
expect(result.current.compact).toBe(true);
});
-it('keeps the clone workspace toggle in sync with explicit collapse', () => {
+it('uses the icon rail beside a section pane, including the Clone and Home library', () => {
+ state.narrow = false;
+ for (const path of ['/clone', '/', '/design']) {
+ state.path = path;
+ const { result } = renderHook(useWorkspaceSidebarState);
+ expect(result.current.compact, path).toBe(true);
+ }
+ state.layout.autoCollapseSidebar = false;
state.path = '/clone';
+ expect(renderHook(useWorkspaceSidebarState).result.current.compact).toBe(false);
+});
+it('keeps the full navigation where a page has no pane of its own and syncs explicit collapse', () => {
+ state.path = '/integrations';
state.narrow = false;
const { result, rerender } = renderHook(useWorkspaceSidebarState);
expect(result.current.compact).toBe(false);
@@ -64,10 +75,10 @@ it('keeps the full sidebar on a secondary workspace when auto-collapse is off',
state.path = '/projects';
rerender();
expect(result.current.compact).toBe(false);
- // A workspace that shows the voice library itself still collapses the duplicate.
+ // The library no longer lives in the navigation column, so there is no duplicate to hide.
state.path = '/personas';
rerender();
- expect(result.current.compact).toBe(true);
+ expect(result.current.compact).toBe(false);
// The explicit close still works.
state.path = '/tools';
act(() => result.current.setOpen(false));
diff --git a/electron/src/renderer/src/components/app-shell/use-workspace-sidebar.ts b/electron/src/renderer/src/components/app-shell/use-workspace-sidebar.ts
index 23d4829b7..0138dfc49 100644
--- a/electron/src/renderer/src/components/app-shell/use-workspace-sidebar.ts
+++ b/electron/src/renderer/src/components/app-shell/use-workspace-sidebar.ts
@@ -16,23 +16,26 @@ const SECONDARY_ROUTES = new Set([
'/calls',
'/settings',
]);
-// A local-controls pane needs enough room for the actual workspace. At the
-// default desktop window, preserve navigation as a rail and restore the full
-// voice library automatically once both it and a local-controls pane leave a
-// useful editing canvas. Browser zoom and Windows display scaling are included
-// in the CSS viewport width, so this threshold also covers high-DPI layouts.
-const COMPACT_QUERY = '(max-width: 1680px)';
+// Voice-section routes whose context pane is the shared library (ContextSidebar).
+export const LIBRARY_ROUTES = new Set(['/', '/clone']);
+// Rail + context panel, as in VS Code, Slack and Linear: a section that brings its
+// own pane keeps navigation to an icon rail so the window never shows two wide
+// sidebars. The full navigation stays one click (or the Keep-expanded
+// preference) away. A genuinely narrow window always uses the rail.
+// Browser zoom and Windows display scaling are included in the CSS viewport
+// width, so this threshold also covers high-DPI layouts.
+const COMPACT_QUERY = '(max-width: 1200px)';
-function routeHasSecondarySidebar(pathname: string): boolean {
- const normalized = pathname.replace(/\/+$/, '') || '/';
- return [...SECONDARY_ROUTES].some(
- (route) => normalized === route || normalized.startsWith(`${route}/`),
- );
+function normalize(pathname: string): string {
+ return pathname.replace(/\/+$/, '') || '/';
}
-function routeOwnsVoiceLibrary(pathname: string): boolean {
- const normalized = pathname.replace(/\/+$/, '') || '/';
- return normalized === '/personas' || normalized.startsWith('/personas/');
+function routeHasSecondarySidebar(pathname: string): boolean {
+ const normalized = normalize(pathname);
+ return (
+ LIBRARY_ROUTES.has(normalized) ||
+ [...SECONDARY_ROUTES].some((route) => normalized === route || normalized.startsWith(`${route}/`))
+ );
}
function useCompactViewport(): boolean {
@@ -54,13 +57,10 @@ export function useWorkspaceSidebarState() {
const compactContext = `${pathname}:${compactViewport}`;
const forceExpanded = expandedLibraryContext === compactContext;
// Auto-collapse is a preference (Settings → Appearance → Keep sidebar
- // expanded): off means a secondary workspace on a narrow window keeps the
- // full sidebar. A workspace that shows the voice library itself still
- // collapses the duplicate.
+ // expanded): off keeps the full navigation beside a section's own pane.
const autoCollapse =
- autoCollapseSidebar !== false && compactViewport && routeHasSecondarySidebar(pathname);
- const compact =
- !libraryOpen || ((routeOwnsVoiceLibrary(pathname) || autoCollapse) && !forceExpanded);
+ autoCollapseSidebar !== false && (routeHasSecondarySidebar(pathname) || compactViewport);
+ const compact = !libraryOpen || (autoCollapse && !forceExpanded);
const setOpen = (open: boolean) =>
setWorkspace({ libraryOpen: open, expandedLibraryContext: open ? compactContext : null });
return {
diff --git a/electron/src/renderer/src/components/app-shell/workspace-sidebar.test.tsx b/electron/src/renderer/src/components/app-shell/workspace-sidebar.test.tsx
index 6d2106df5..663ed6ac7 100644
--- a/electron/src/renderer/src/components/app-shell/workspace-sidebar.test.tsx
+++ b/electron/src/renderer/src/components/app-shell/workspace-sidebar.test.tsx
@@ -74,15 +74,13 @@ it('expands the compact rail on double-click without changing single-click navig
expect(sidebar.setOpen).toHaveBeenCalledWith(true);
});
-it('places the navigation above the voice library in the expanded sidebar', () => {
+it('keeps only navigation and status in the slim expanded sidebar', () => {
render(<WorkspaceSidebar />);
const navigation = screen.getByTestId('navigation');
- const library = screen.getByTestId('library');
const status = screen.getByTestId('status');
- expect(
- navigation.compareDocumentPosition(library) & Node.DOCUMENT_POSITION_FOLLOWING,
- ).toBeTruthy();
- expect(library.compareDocumentPosition(status) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
+ expect(navigation.compareDocumentPosition(status) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
+ // The saved voices and takes live in the section's own secondary sidebar.
+ expect(screen.queryByTestId('library')).toBeNull();
});
it('shows the app version beneath the brand name in the expanded sidebar', () => {
diff --git a/electron/src/renderer/src/components/app-shell/workspace-sidebar.tsx b/electron/src/renderer/src/components/app-shell/workspace-sidebar.tsx
index c82e7ef08..8cef3e0b6 100644
--- a/electron/src/renderer/src/components/app-shell/workspace-sidebar.tsx
+++ b/electron/src/renderer/src/components/app-shell/workspace-sidebar.tsx
@@ -9,7 +9,6 @@ import { usePaneResize } from '@/hooks/use-pane-resize';
import { useWindowFullscreen } from '@/hooks/use-window-fullscreen';
import { useWorkspace } from '@/lib/store/workspace';
import { useWorkspaceSidebarState } from './use-workspace-sidebar';
-import { VoicesSidebar } from '@/features/clone/voices-sidebar';
import { WorkspaceNavigation } from './workspace-menu';
import { StatusBar } from './status-bar';
@@ -25,17 +24,17 @@ export function WorkspaceSidebar() {
const versionLabel = t(versionTranslationKey(import.meta.env.DEV), {
version: appVersion(),
});
- const { libraryOpen, libraryTab } = useWorkspace();
+ const { libraryOpen } = useWorkspace();
// One source of truth for "rail or full sidebar": the header toggle and the
// sidebar's own buttons used to keep separate copies of this state.
const { compact, compactViewport, forceExpanded, secondaryWorkspace, setOpen } =
useWorkspaceSidebarState();
const sidebarResize = usePaneResize({
- storageKey: 'voicestudio.library-width',
+ storageKey: 'voicestudio.nav-width',
side: 'left',
- minimum: mac ? 288 : 220,
- initial: mac ? 288 : 256,
- maximum: 360,
+ minimum: 196,
+ initial: 216,
+ maximum: 288,
reserve: compactViewport && secondaryWorkspace && forceExpanded ? 520 : 640,
enabled: libraryOpen,
});
@@ -118,8 +117,8 @@ export function WorkspaceSidebar() {
<aside
ref={sidebarResize.host}
style={{ width: sidebarResize.width }}
- aria-label={t('clone.saved_profiles')}
- className="brand-sidebar relative isolate grid h-full min-h-0 min-w-0 shrink-0 grid-cols-[minmax(0,1fr)] grid-rows-[auto_minmax(0,auto)_minmax(7rem,1fr)_auto] overflow-hidden border-r border-border/50 bg-sidebar"
+ aria-label={t('app.name')}
+ className="brand-sidebar relative isolate grid h-full min-h-0 min-w-0 shrink-0 grid-cols-[minmax(0,1fr)] grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden border-r border-border/50 bg-sidebar"
>
<img
src={brandArtwork}
@@ -129,8 +128,10 @@ export function WorkspaceSidebar() {
/>
<header
className={cn(
- 'workspace-titlebar flex shrink-0 items-center gap-2 px-4',
- trafficLights && 'pl-24',
+ 'workspace-titlebar flex shrink-0 gap-2 px-3',
+ // The traffic lights get their own row above the brand, so the narrow
+ // column never has to reserve their width beside the wordmark.
+ trafficLights ? 'min-h-[72px] items-end pb-2' : 'items-center',
)}
>
<Link
@@ -157,15 +158,14 @@ export function WorkspaceSidebar() {
</header>
<div
{...sidebarResize.separatorProps}
- aria-label={t('clone.saved_profiles')}
+ aria-label={t('app.name')}
className="absolute inset-y-0 right-0 z-20 w-2 cursor-col-resize touch-none outline-none hover:bg-primary/15 focus-visible:bg-primary/30"
/>
{/* Navigation first, like the compact rail: it stays at a fixed
position under the header instead of riding the library's height. */}
- <div className="min-h-0 min-w-0 overflow-y-auto border-b border-border/50">
+ <div className="min-h-0 min-w-0 overflow-y-auto">
<WorkspaceNavigation />
</div>
- <VoicesSidebar key={libraryTab} initialTab={libraryTab} />
<div className="flex min-w-0 shrink-0 flex-col border-t border-border/50">
<StatusBar
footerLeading={
diff --git a/electron/src/renderer/src/components/performance-profile.tsx b/electron/src/renderer/src/components/performance-profile.tsx
index d8954bf03..a0d3d1ac4 100644
--- a/electron/src/renderer/src/components/performance-profile.tsx
+++ b/electron/src/renderer/src/components/performance-profile.tsx
@@ -250,10 +250,9 @@ export function PerformanceProfile({
: plan?.status === 'unknown'
? CircleHelpIcon
: CircleGaugeIcon;
- const sliderPosition = Math.max(
- 0,
- tiers.indexOf((shownTier ?? 'balanced') as (typeof tiers)[number]),
- );
+ const sliderTier = (shownTier === 'auto' ? plan?.resolved : shownTier) ?? 'balanced';
+ const sliderPosition = Math.max(0, tiers.indexOf(sliderTier as (typeof tiers)[number]));
+ const TierIcon = [GaugeIcon, SparkleIcon, SparklesIcon, CrownIcon][Math.min(3, sliderPosition)];
const panel = (
<PopoverContent
side="inline-end"
@@ -263,69 +262,69 @@ export function PerformanceProfile({
{extra}
{plan && !family && (
<>
- <div>
- <p className="font-medium">
- {t('performanceProfile.max') +
+ <div>
+ <p className="font-medium">
+ {t('performanceProfile.max') +
+ ' · ' +
+ t(
+ 'performanceHardware.' +
+ (plan.max_status === 'limited' ? 'reason.memory' : plan.max_status),
+ )}
+ </p>
+ <p className="mt-1 text-muted-foreground">{t('performanceHardware.voiceFirst')}</p>
+ </div>
+ <LiveDeviceUsage open={hardwareOpen} />
+ <div className="-mx-1">
+ {(['tts', 'asr', 'translation', 'dictation', 'diarisation'] as const).map((name) => {
+ const entry = plan.families[name];
+ return (
+ <Link
+ key={name}
+ to="/settings/models/$family"
+ params={{ family: name }}
+ className="group flex min-h-7 items-center justify-between gap-3 rounded-md px-1 py-1 outline-none hover:bg-muted/60 focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ <span>{t('sidebarTools.' + name)}</span>
+ <span className="flex items-center gap-1.5 text-end text-[11px] text-muted-foreground">
+ {t('performanceHardware.reason.' + entry.reason)}
+ <ChevronRightIcon
+ className="size-3 shrink-0 opacity-50 group-hover:opacity-100 rtl:rotate-180"
+ aria-hidden="true"
+ />
+ </span>
+ </Link>
+ );
+ })}
+ </div>
+ <details className="group/details border-t pt-1 text-muted-foreground">
+ <summary className="flex min-h-8 cursor-pointer list-none items-center justify-between gap-2 rounded outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden">
+ {t('sidebarTools.details')}
+ <ChevronRightIcon
+ className="size-3.5 shrink-0 group-open/details:rotate-90 rtl:rotate-180"
+ aria-hidden="true"
+ />
+ </summary>
+ <div className="space-y-2 pt-1 leading-relaxed">
+ <p className="text-foreground/80 tabular-nums">
+ {t('performanceHardware.specs', {
+ ram:
+ plan.hardware.ram_gb?.toLocaleString(i18n.language, {
+ maximumFractionDigits: 0,
+ }) ?? '—',
+ cores: plan.hardware.cpu_threads,
+ })}
+ {plan.hardware.vram_gb != null &&
' · ' +
- t(
- 'performanceHardware.' +
- (plan.max_status === 'limited' ? 'reason.memory' : plan.max_status),
- )}
+ t('performanceHardware.vram', {
+ memory: plan.hardware.vram_gb.toLocaleString(i18n.language, {
+ maximumFractionDigits: 0,
+ }),
+ })}
</p>
- <p className="mt-1 text-muted-foreground">{t('performanceHardware.voiceFirst')}</p>
+ <p>{t('performanceHardware.priority')}</p>
+ <p>{t('performanceHardware.estimate')}</p>
</div>
- <LiveDeviceUsage open={hardwareOpen} />
- <div className="-mx-1">
- {(['tts', 'asr', 'translation', 'dictation', 'diarisation'] as const).map((name) => {
- const entry = plan.families[name];
- return (
- <Link
- key={name}
- to="/settings/models/$family"
- params={{ family: name }}
- className="group flex min-h-7 items-center justify-between gap-3 rounded-md px-1 py-1 outline-none hover:bg-muted/60 focus-visible:ring-2 focus-visible:ring-ring"
- >
- <span>{t('sidebarTools.' + name)}</span>
- <span className="flex items-center gap-1.5 text-end text-[11px] text-muted-foreground">
- {t('performanceHardware.reason.' + entry.reason)}
- <ChevronRightIcon
- className="size-3 shrink-0 opacity-50 group-hover:opacity-100 rtl:rotate-180"
- aria-hidden="true"
- />
- </span>
- </Link>
- );
- })}
- </div>
- <details className="group/details border-t pt-1 text-muted-foreground">
- <summary className="flex min-h-8 cursor-pointer list-none items-center justify-between gap-2 rounded outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden">
- {t('sidebarTools.details')}
- <ChevronRightIcon
- className="size-3.5 shrink-0 group-open/details:rotate-90 rtl:rotate-180"
- aria-hidden="true"
- />
- </summary>
- <div className="space-y-2 pt-1 leading-relaxed">
- <p className="text-foreground/80 tabular-nums">
- {t('performanceHardware.specs', {
- ram:
- plan.hardware.ram_gb?.toLocaleString(i18n.language, {
- maximumFractionDigits: 0,
- }) ?? '—',
- cores: plan.hardware.cpu_threads,
- })}
- {plan.hardware.vram_gb != null &&
- ' · ' +
- t('performanceHardware.vram', {
- memory: plan.hardware.vram_gb.toLocaleString(i18n.language, {
- maximumFractionDigits: 0,
- }),
- })}
- </p>
- <p>{t('performanceHardware.priority')}</p>
- <p>{t('performanceHardware.estimate')}</p>
- </div>
- </details>
+ </details>
</>
)}
</PopoverContent>
@@ -340,50 +339,56 @@ export function PerformanceProfile({
render={
<button
type="button"
+ data-slot="performance-trigger"
aria-label={hardwareSummary || undefined}
- className="group/hw flex min-w-0 items-center gap-1 rounded px-1 py-0.5 text-start text-[11px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"
+ className="group/hw flex min-w-0 items-center gap-1.5 rounded-md px-1.5 py-1 text-xs whitespace-nowrap text-foreground/85 outline-none hover:bg-sidebar-accent/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"
/>
}
>
- <span id={groupId}>
+ <TierIcon className="size-3.5 shrink-0 text-primary" aria-hidden="true" />
+ {/* The control's name for assistive tech; sighted users read the tier and its icon. */}
+ <span id={groupId} className="sr-only">
{t(supported ? 'performanceProfile.title' : 'modelSettings.unavailable')}
</span>
- {supported && shownTier && shownTier !== 'auto' && (
- <span className="font-medium text-foreground/80">
- {t('performanceProfile.' + shownTier)}
- </span>
- )}
+ <span className="min-w-0 truncate font-medium">
+ {shownTier && shownTier !== 'auto'
+ ? t('performanceProfile.' + shownTier)
+ : t('performanceProfile.auto')}
+ </span>
<ChevronRightIcon
- className="size-3 shrink-0 opacity-60 transition-transform group-hover/hw:translate-x-0.5 rtl:rotate-180 motion-reduce:transition-none"
+ className="size-3 shrink-0 opacity-50 transition-transform group-hover/hw:translate-x-0.5 rtl:rotate-180 motion-reduce:transition-none"
aria-hidden="true"
/>
</PopoverTrigger>
) : (
- <span className="min-w-0 truncate text-[11px] text-muted-foreground">
- <span id={groupId}>
- {t(supported ? 'performanceProfile.title' : 'modelSettings.unavailable')}
- </span>
- {supported && shownTier && shownTier !== 'auto' && (
- <span className="ms-1.5 font-medium text-foreground/80">
- {t('performanceProfile.' + shownTier)}
+ <span className="min-w-0 truncate text-[11px] whitespace-nowrap text-muted-foreground">
+ <span id={groupId}>
+ {t(supported ? 'performanceProfile.title' : 'modelSettings.unavailable')}
</span>
- )}
- </span>
+ {supported && shownTier && shownTier !== 'auto' && (
+ <span className="ms-1.5 font-medium text-foreground/80">
+ {t('performanceProfile.' + shownTier)}
+ </span>
+ )}
+ </span>
)}
<button
type="button"
aria-pressed={autoOn}
+ aria-label={popoverMode ? t('performanceProfile.auto') : undefined}
+ title={popoverMode ? t('performanceProfile.auto') : undefined}
disabled={disabled}
onClick={() => void choose(autoOn ? (plan?.resolved ?? 'balanced') : 'auto')}
className={cn(
- 'inline-flex h-6 items-center gap-1 rounded-full px-2 text-[11px] font-medium outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50',
+ 'inline-flex h-6 shrink-0 items-center justify-center gap-1 rounded-full text-[11px] font-medium outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50',
+ popoverMode ? 'w-6' : 'px-2',
autoOn
? 'bg-primary/15 text-primary ring-1 ring-inset ring-primary/30'
: 'text-muted-foreground ring-1 ring-inset ring-border/60 hover:text-foreground',
)}
>
<WandSparklesIcon className="size-3" aria-hidden="true" />
- {t('performanceProfile.auto')}
+ {!popoverMode && t('performanceProfile.auto')}
</button>
</div>
<DirectionProvider direction={i18n.dir(i18n.language)}>
@@ -426,7 +431,9 @@ export function PerformanceProfile({
<HardwareIcon
className={cn(
'size-3 shrink-0',
- plan.status === 'fits' ? 'text-success' : plan.status !== 'unknown' && 'text-warning',
+ plan.status === 'fits'
+ ? 'text-success'
+ : plan.status !== 'unknown' && 'text-warning',
)}
aria-hidden="true"
/>
diff --git a/electron/src/renderer/src/components/workspace-sidebar.test.tsx b/electron/src/renderer/src/components/workspace-sidebar.test.tsx
index e83f54bfe..18363594e 100644
--- a/electron/src/renderer/src/components/workspace-sidebar.test.tsx
+++ b/electron/src/renderer/src/components/workspace-sidebar.test.tsx
@@ -59,3 +59,95 @@ it('pins a footer outside the scrolling content and reports collapse so a page c
expect(onCollapsedChange).toHaveBeenLastCalledWith(true);
expect(document.querySelector('[data-slot="secondary-sidebar-footer"]')).toBeNull();
});
+
+it("switches between a page's controls and its section library, hiding the pinned footer in the library", () => {
+ render(
+ <SecondarySidebar
+ title="Design"
+ icon={FilmIcon}
+ library={<div>Voices list</div>}
+ libraryLabel="Saved voices"
+ footer={<button type="button">Generate</button>}
+ >
+ <section>Controls body</section>
+ </SecondarySidebar>,
+ );
+ expect(screen.getByRole('tab', { name: 'Design' })).toHaveAttribute('aria-selected', 'true');
+ expect(screen.queryByText('Voices list')).toBeNull();
+ fireEvent.click(screen.getByRole('tab', { name: 'Saved voices' }));
+ expect(screen.getByText('Voices list')).toBeVisible();
+ expect(screen.queryByRole('button', { name: 'Generate' })).toBeNull();
+ fireEvent.click(screen.getByRole('tab', { name: 'Design' }));
+ expect(screen.getByRole('button', { name: 'Generate' })).toBeVisible();
+});
+
+it.each([
+ ['ltr', 'ArrowRight'],
+ ['rtl', 'ArrowLeft'],
+])(
+ 'selects section tabs with the keyboard in %s without discarding controls',
+ (direction, forward) => {
+ render(
+ <SecondarySidebar
+ title="Design"
+ icon={FilmIcon}
+ library={<div>Voices list</div>}
+ libraryLabel="Saved voices"
+ >
+ <input aria-label="Draft" defaultValue="My next voice" />
+ </SecondarySidebar>,
+ );
+ screen.getByRole('tablist').style.direction = direction;
+ const controls = screen.getByRole('tab', { name: 'Design' });
+ controls.focus();
+ fireEvent.keyDown(controls, { key: forward });
+ const library = screen.getByRole('tab', { name: 'Saved voices' });
+ expect(library).toHaveFocus();
+ expect(library).toHaveAttribute('aria-selected', 'true');
+ expect(screen.getByText('Voices list')).toBeVisible();
+ fireEvent.keyDown(library, { key: 'Home' });
+ expect(screen.getByRole('textbox', { name: 'Draft' })).toHaveValue('My next voice');
+ expect(controls).toHaveFocus();
+ },
+);
+
+it('preserves edits in a section library when switching back to the controls', () => {
+ render(
+ <SecondarySidebar
+ title="Stories"
+ icon={FilmIcon}
+ library={<input aria-label="Project name" defaultValue="Draft" />}
+ libraryLabel="Projects"
+ >
+ <section>Controls</section>
+ </SecondarySidebar>,
+ );
+ fireEvent.click(screen.getByRole('tab', { name: 'Projects' }));
+ fireEvent.change(screen.getByRole('textbox', { name: 'Project name' }), {
+ target: { value: 'My story' },
+ });
+ fireEvent.click(screen.getByRole('tab', { name: 'Stories' }));
+ fireEvent.click(screen.getByRole('tab', { name: 'Projects' }));
+ expect(screen.getByRole('textbox', { name: 'Project name' })).toHaveValue('My story');
+});
+
+it('reports a retained library as inactive when its tab is hidden', () => {
+ render(
+ <SecondarySidebar
+ title="Dub"
+ icon={FilmIcon}
+ library={(active) => <input aria-label="Load active" value={String(active)} readOnly />}
+ libraryLabel="Projects"
+ >
+ <section>Controls</section>
+ </SecondarySidebar>,
+ );
+ fireEvent.click(screen.getByRole('tab', { name: 'Projects' }));
+ const field = screen.getByRole('textbox', { name: 'Load active' });
+ expect(field).toHaveValue('true');
+ fireEvent.click(screen.getByRole('tab', { name: 'Dub' }));
+ expect(field).toHaveValue('false');
+ fireEvent.click(screen.getByRole('tab', { name: 'Projects' }));
+ expect(screen.getByRole('textbox', { name: 'Load active' })).toBe(field);
+ expect(field).toHaveValue('true');
+});
diff --git a/electron/src/renderer/src/components/workspace-sidebar.tsx b/electron/src/renderer/src/components/workspace-sidebar.tsx
index 1129c4e5c..ca0ba341e 100644
--- a/electron/src/renderer/src/components/workspace-sidebar.tsx
+++ b/electron/src/renderer/src/components/workspace-sidebar.tsx
@@ -1,4 +1,4 @@
-import { useState, type CSSProperties, type ReactNode } from 'react';
+import { useId, useState, type CSSProperties, type ReactNode } from 'react';
import { PanelLeftCloseIcon, PanelLeftOpenIcon, type LucideIcon } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { Button } from '@/components/ui/button';
@@ -30,6 +30,9 @@ export function SecondarySidebar({
variant = 'controls',
meta,
footer,
+ library,
+ libraryLabel,
+ collapsed: controlledCollapsed,
onCollapsedChange,
}: {
title: string;
@@ -41,17 +44,31 @@ export function SecondarySidebar({
meta?: ReactNode;
/** Pinned below the scrolling content — never scrolls out of view. */
footer?: ReactNode;
+ /** Saved items beside the controls. A render callback receives visibility so retained panes can cancel hidden work. */
+ library?: ReactNode | ((active: boolean) => ReactNode);
+ libraryLabel?: string;
+ /** Controls the collapsed state when the parent owns a shared pane shortcut. */
+ collapsed?: boolean;
/** Lets the page re-home the footer's content while the pane is collapsed. */
onCollapsedChange?: (collapsed: boolean) => void;
}) {
const { t } = useTranslation();
- const [collapsed, setCollapsedState] = useState(false);
+ const [uncontrolledCollapsed, setUncontrolledCollapsed] = useState(false);
+ const collapsed = controlledCollapsed ?? uncontrolledCollapsed;
+ const [view, setView] = useState<'controls' | 'library'>('controls');
+ const [libraryVisited, setLibraryVisited] = useState(false);
+ const tabsId = useId();
+ const chooseView = (next: 'controls' | 'library') => {
+ if (next === 'library') setLibraryVisited(true);
+ setView(next);
+ };
+ const showLibrary = library != null && view === 'library';
// Notify from the event handler, never from inside a state updater: updaters
// must stay pure (StrictMode runs them twice, which would double-fire this).
const setCollapsed = (next: boolean | ((value: boolean) => boolean)) => {
const resolved = typeof next === 'function' ? next(collapsed) : next;
if (resolved === collapsed) return;
- setCollapsedState(resolved);
+ if (controlledCollapsed === undefined) setUncontrolledCollapsed(resolved);
onCollapsedChange?.(resolved);
};
const dimensions = WIDTHS[size];
@@ -127,19 +144,96 @@ export function SecondarySidebar({
{collapsed ? <PanelLeftOpenIcon /> : <PanelLeftCloseIcon />}
</Button>
</div>
+ {library != null && !collapsed && (
+ <div
+ role="tablist"
+ aria-label={title}
+ data-slot="secondary-sidebar-tabs"
+ className="flex shrink-0 gap-1 border-b border-border/45 px-2.5 py-2"
+ onKeyDown={(event) => {
+ if (event.altKey || event.ctrlKey || event.metaKey) return;
+ const tabs = [
+ ...event.currentTarget.querySelectorAll<HTMLButtonElement>('[role="tab"]'),
+ ];
+ const current = tabs.findIndex((tab) => tab === event.target);
+ if (current < 0) return;
+ const forward =
+ getComputedStyle(event.currentTarget).direction === 'rtl'
+ ? 'ArrowLeft'
+ : 'ArrowRight';
+ const backward = forward === 'ArrowRight' ? 'ArrowLeft' : 'ArrowRight';
+ const next =
+ event.key === 'Home'
+ ? 0
+ : event.key === 'End'
+ ? 1
+ : event.key === forward || event.key === backward
+ ? 1 - current
+ : null;
+ if (next === null) return;
+ event.preventDefault();
+ chooseView(next === 0 ? 'controls' : 'library');
+ tabs[next]?.focus();
+ }}
+ >
+ {(
+ [
+ ['controls', title],
+ ['library', libraryLabel ?? title],
+ ] as const
+ ).map(([value, label]) => (
+ <button
+ key={value}
+ type="button"
+ role="tab"
+ id={`${tabsId}-${value}`}
+ aria-controls={`${tabsId}-panel-${value}`}
+ aria-selected={view === value}
+ tabIndex={view === value ? 0 : -1}
+ onClick={() => chooseView(value)}
+ className={cn(
+ 'h-7 min-w-0 flex-1 truncate rounded-md px-2 text-xs font-medium outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring',
+ view === value
+ ? 'bg-accent/80 text-foreground'
+ : 'text-muted-foreground hover:bg-accent/45 hover:text-foreground',
+ )}
+ >
+ {label}
+ </button>
+ ))}
+ </div>
+ )}
+ {library != null && (
+ <div
+ role="tabpanel"
+ id={`${tabsId}-panel-library`}
+ aria-labelledby={`${tabsId}-library`}
+ hidden={!showLibrary || collapsed}
+ className={cn('flex min-h-0 flex-1 flex-col', (!showLibrary || collapsed) && 'hidden')}
+ >
+ {libraryVisited
+ ? typeof library === 'function'
+ ? library(showLibrary && !collapsed)
+ : library
+ : null}
+ </div>
+ )}
<div
- hidden={collapsed}
+ hidden={collapsed || showLibrary}
+ role={library != null ? 'tabpanel' : undefined}
+ id={library != null ? `${tabsId}-panel-controls` : undefined}
+ aria-labelledby={library != null ? `${tabsId}-controls` : undefined}
data-slot="secondary-sidebar-content"
className={cn(
'studio-scrollbar min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain p-3.5 text-[13px] [scroll-padding-block:0.875rem] [scrollbar-gutter:stable] [&>*]:min-w-0 [&>section]:w-full [&>section]:shrink-0 [&_button]:max-w-full [&_h2]:tracking-[-0.012em] [&_h3]:tracking-[-0.01em] [&_input]:max-w-full [&_label]:leading-5 [&_p]:leading-[1.55] [&_summary]:rounded-lg [&_summary]:outline-none [&_summary]:transition-[color,background-color] [&_summary]:duration-150 [&_summary:hover]:text-foreground [&_summary:focus-visible]:ring-2 [&_summary:focus-visible]:ring-ring/35 [&_textarea]:max-w-full',
VARIANT_STYLES[variant],
- collapsed && 'hidden',
+ (collapsed || showLibrary) && 'hidden',
className,
)}
>
{children}
</div>
- {footer !== undefined && footer !== null && !collapsed && (
+ {footer !== undefined && footer !== null && !collapsed && !showLibrary && (
<div
data-slot="secondary-sidebar-footer"
className="flex min-h-0 max-h-[70%] flex-col space-y-3 border-t border-border/55 bg-background/40 p-3.5 text-[13px] backdrop-blur-xl"
diff --git a/electron/src/renderer/src/features/clone/voices-sidebar.tsx b/electron/src/renderer/src/features/clone/voices-sidebar.tsx
index c76d54b60..27b9cc3d9 100644
--- a/electron/src/renderer/src/features/clone/voices-sidebar.tsx
+++ b/electron/src/renderer/src/features/clone/voices-sidebar.tsx
@@ -677,7 +677,6 @@ export function VoicesSidebar({
aria-label={t('clone.saved_profiles')}
className="min-w-0 flex-1 rounded-lg text-sidebar-foreground/60 hover:bg-sidebar-accent/50 data-active:bg-[var(--sidebar-row-active)] data-active:text-sidebar-foreground dark:data-active:border-transparent dark:data-active:bg-[var(--sidebar-row-active)] dark:data-active:text-sidebar-foreground"
>
- <FingerprintIcon data-icon="inline-start" />
<span className="min-w-0 truncate">{t('clone.saved_profiles')}</span>
</TabsTrigger>
<TabsTrigger
@@ -686,7 +685,6 @@ export function VoicesSidebar({
aria-label={t('clone.history_title')}
className="min-w-0 flex-1 rounded-lg text-sidebar-foreground/60 hover:bg-sidebar-accent/50 data-active:bg-[var(--sidebar-row-active)] data-active:text-sidebar-foreground dark:data-active:border-transparent dark:data-active:bg-[var(--sidebar-row-active)] dark:data-active:text-sidebar-foreground"
>
- <HistoryIcon data-icon="inline-start" />
<span className="min-w-0 truncate">{t('clone.history_title')}</span>
</TabsTrigger>
</TabsList>
diff --git a/electron/src/renderer/src/features/design/design-page.tsx b/electron/src/renderer/src/features/design/design-page.tsx
index c80360faa..66829d214 100644
--- a/electron/src/renderer/src/features/design/design-page.tsx
+++ b/electron/src/renderer/src/features/design/design-page.tsx
@@ -1,3 +1,4 @@
+import { VoicesSidebar } from '@/features/clone/voices-sidebar';
import { WandSparklesIcon } from 'lucide-react';
import { SecondarySidebar } from '@/components/workspace-sidebar';
import { WorkspaceHeader } from '@/components/app-shell/workspace-header';
@@ -179,6 +180,8 @@ export function DesignPage() {
icon={WandSparklesIcon}
size="wide"
variant="controls"
+ library={<VoicesSidebar />}
+ libraryLabel={t('clone.saved_profiles')}
className="space-y-3"
>
<section className="space-y-2 rounded-xl border border-border/60 bg-muted/20 p-3">
diff --git a/electron/src/renderer/src/features/dub/dub-page.tsx b/electron/src/renderer/src/features/dub/dub-page.tsx
index a48d6f489..e8c7fa4a6 100644
--- a/electron/src/renderer/src/features/dub/dub-page.tsx
+++ b/electron/src/renderer/src/features/dub/dub-page.tsx
@@ -1,3 +1,4 @@
+import { DubProjects } from './dub-projects';
import { Menu } from '@base-ui/react/menu';
import { useVirtualizer } from '@tanstack/react-virtual';
import { SecondarySidebar } from '@/components/workspace-sidebar';
@@ -1011,6 +1012,8 @@ export function DubPage() {
icon={FilmIcon}
size="spacious"
variant="controls"
+ library={(active) => <DubProjects active={active} />}
+ libraryLabel={t('projects.title')}
className="flex flex-col gap-2"
>
<section
@@ -1654,8 +1657,20 @@ export function DubPage() {
<p className="text-xs text-muted-foreground">{t('dub.fit_speed_hint')}</p>
{(
[
- { key: 'audio_rate_cap', label: 'dub.fit_max_speed', min: 1, max: 2, defaultValue: 1.5 },
- { key: 'min_audio_rate', label: 'dub.fit_min_speed', min: 0.5, max: 1, defaultValue: 0.85 },
+ {
+ key: 'audio_rate_cap',
+ label: 'dub.fit_max_speed',
+ min: 1,
+ max: 2,
+ defaultValue: 1.5,
+ },
+ {
+ key: 'min_audio_rate',
+ label: 'dub.fit_min_speed',
+ min: 0.5,
+ max: 1,
+ defaultValue: 0.85,
+ },
] as const
).map((knob) => {
const current = session.fitOptions?.[knob.key] ?? knob.defaultValue;
diff --git a/electron/src/renderer/src/features/dub/dub-projects.test.tsx b/electron/src/renderer/src/features/dub/dub-projects.test.tsx
new file mode 100644
index 000000000..a5aed8be4
--- /dev/null
+++ b/electron/src/renderer/src/features/dub/dub-projects.test.tsx
@@ -0,0 +1,198 @@
+import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
+import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
+import { afterEach, beforeEach, expect, it, vi } from 'vitest';
+
+const state = vi.hoisted(() => ({
+ navigate: vi.fn(),
+ dubs: [] as unknown[],
+ longform: {
+ active: null as string | null,
+ drafts: { stories: { projectId: null }, audiobook: { projectId: 'b2' } },
+ },
+ dub: { project: null as { id: string } | null, phase: 'idle', recovery: null, instruct: '' },
+ openDub: vi.fn(() => true),
+ readProject: vi.fn<(path: string, options?: { signal?: AbortSignal }) => Promise<unknown>>(),
+}));
+vi.mock('react-i18next', () => ({
+ useTranslation: () => ({ t: (key: string) => key, i18n: { language: 'en' } }),
+}));
+vi.mock('@tanstack/react-router', () => ({
+ useNavigate: () => state.navigate,
+ Link: ({ children, to }: { children: unknown; to: string }) => (
+ <a href={to}>{children as never}</a>
+ ),
+}));
+vi.mock('@/lib/api/client', () => ({
+ apiJson: async (path: string, options?: { signal?: AbortSignal }) =>
+ path === '/projects' ? state.dubs : state.readProject(path, options),
+ describeError: (error: unknown) => String(error),
+}));
+vi.mock('../longform/longform-session', () => ({
+ useLongformSession: () => state.longform,
+ longformSession: {
+ get state() {
+ return state.longform;
+ },
+ },
+}));
+vi.mock('./dub-session', () => ({
+ useDubSession: () => state.dub,
+ dubSession: {
+ get state() {
+ return state.dub;
+ },
+ },
+ openDubProject: state.openDub,
+}));
+import { DubProjects } from './dub-projects';
+
+const renderList = () => {
+ const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
+ const content = (active: boolean) => (
+ <QueryClientProvider client={client}>
+ <DubProjects active={active} />
+ </QueryClientProvider>
+ );
+ const view = render(content(true));
+ return { ...view, setActive: (active: boolean) => view.rerender(content(active)) };
+};
+
+async function confirmProject(name: RegExp) {
+ fireEvent.click(await screen.findByRole('button', { name }));
+ fireEvent.click(screen.getByRole('button', { name: 'common.confirm' }));
+}
+
+beforeEach(() => {
+ state.navigate.mockReset();
+ state.openDub.mockReset().mockReturnValue(true);
+ state.readProject
+ .mockReset()
+ .mockImplementation(async (path) =>
+ state.dubs.find((p) => path.endsWith((p as { id: string }).id)),
+ );
+ state.longform.active = null;
+ state.dub = { project: { id: 'd2' }, phase: 'idle', recovery: null, instruct: '' };
+ state.dubs = [
+ { id: 'd1', name: 'Launch video', updated_at: 1_700_000_000 },
+ { id: 'd2', name: 'Podcast intro', updated_at: 1_700_000_100 },
+ ];
+});
+afterEach(cleanup);
+
+it('lists dub projects newest first and marks the one that is open', async () => {
+ renderList();
+ const open = await screen.findByRole('button', { name: /Podcast intro/ });
+ expect(open).toHaveAttribute('aria-current', 'true');
+ const names = screen.getAllByRole('button').map((b) => b.textContent ?? '');
+ expect(names[0]).toContain('Podcast intro');
+ expect(screen.getByRole('link')).toHaveAttribute('href', '/projects');
+});
+
+it('opens a dub project into the Dub workspace', async () => {
+ renderList();
+ await confirmProject(/Launch video/);
+ await waitFor(() => expect(state.navigate).toHaveBeenCalledWith({ to: '/dub' }));
+ expect(state.openDub).toHaveBeenCalled();
+});
+
+it('waits while dubbing work is running', async () => {
+ state.dub = { project: null, phase: 'dubbing', recovery: null, instruct: '' };
+ renderList();
+ expect(await screen.findByRole('button', { name: /Launch video/ })).toBeDisabled();
+});
+
+it('shows the empty state when there are no dub projects yet', async () => {
+ state.dubs = [];
+ renderList();
+ expect(await screen.findByText('projects.empty')).toBeVisible();
+});
+
+it('asks before replacing a draft and leaves it unchanged when cancelled', async () => {
+ renderList();
+ fireEvent.click(await screen.findByRole('button', { name: /Launch video/ }));
+ expect(await screen.findByText('projectActions.open')).toBeVisible();
+ expect(state.readProject).not.toHaveBeenCalled();
+ expect(state.openDub).not.toHaveBeenCalled();
+ fireEvent.click(screen.getByRole('button', { name: 'common.cancel' }));
+ expect(screen.queryByText('projectActions.open')).toBeNull();
+ expect(state.openDub).not.toHaveBeenCalled();
+ expect(state.navigate).not.toHaveBeenCalled();
+});
+
+function pauseProjectRead() {
+ let resolve!: (value: unknown) => void;
+ state.readProject.mockReturnValue(
+ new Promise((done) => {
+ resolve = done;
+ }),
+ );
+ return resolve;
+}
+
+it('waits for one project to open before accepting another selection', async () => {
+ const resolve = pauseProjectRead();
+ renderList();
+ await confirmProject(/Launch video/);
+ const other = screen.getByRole('button', { name: /Podcast intro/ });
+ expect(other).toBeDisabled();
+ fireEvent.click(other);
+ await act(async () => resolve(state.dubs[0]));
+ await waitFor(() => expect(state.navigate).toHaveBeenCalledTimes(1));
+ expect(state.readProject).toHaveBeenCalledTimes(1);
+ expect(state.openDub).toHaveBeenCalledWith(state.dubs[0]);
+});
+
+it('does not open or navigate after leaving the projects pane during a load', async () => {
+ const resolve = pauseProjectRead();
+ const view = renderList();
+ await confirmProject(/Launch video/);
+ view.unmount();
+ await act(async () => resolve(state.dubs[0]));
+ expect(state.openDub).not.toHaveBeenCalled();
+ expect(state.navigate).not.toHaveBeenCalled();
+});
+
+it('cancels a load when its tab hides, even if the user returns before it finishes', async () => {
+ const resolve = pauseProjectRead();
+ const view = renderList();
+ await confirmProject(/Launch video/);
+ view.setActive(false);
+ view.setActive(true);
+ await act(async () => resolve(state.dubs[0]));
+ expect(state.openDub).not.toHaveBeenCalled();
+ expect(state.navigate).not.toHaveBeenCalled();
+});
+
+it('rechecks active work after a pending project read', async () => {
+ const resolve = pauseProjectRead();
+ renderList();
+ await confirmProject(/Launch video/);
+ state.longform = { ...state.longform, active: 'render' };
+ await act(async () => resolve(state.dubs[0]));
+ expect(await screen.findByRole('alert')).toHaveTextContent('sidebarTools.wait');
+ expect(state.openDub).not.toHaveBeenCalled();
+ expect(state.navigate).not.toHaveBeenCalled();
+});
+
+it('requires a fresh confirmation if the working draft changes during a load', async () => {
+ const resolve = pauseProjectRead();
+ renderList();
+ await confirmProject(/Launch video/);
+ state.dub = { ...state.dub, instruct: 'Keep these new directions' };
+ await act(async () => resolve(state.dubs[0]));
+ expect(state.openDub).not.toHaveBeenCalled();
+ expect(state.navigate).not.toHaveBeenCalled();
+ expect(await screen.findByRole('alert')).toHaveTextContent('projects.draft_changed');
+ expect(screen.getByRole('button', { name: 'common.confirm' })).toBeEnabled();
+ state.readProject.mockResolvedValueOnce(state.dubs[0]);
+ fireEvent.click(screen.getByRole('button', { name: 'common.confirm' }));
+ await waitFor(() => expect(state.navigate).toHaveBeenCalledWith({ to: '/dub' }));
+});
+
+it('localizes the error when dubbing work starts during a project load', async () => {
+ state.openDub.mockReturnValue(false);
+ renderList();
+ await confirmProject(/Launch video/);
+ expect(await screen.findByRole('alert')).toHaveTextContent('sidebarTools.wait');
+ expect(state.navigate).not.toHaveBeenCalled();
+});
diff --git a/electron/src/renderer/src/features/dub/dub-projects.tsx b/electron/src/renderer/src/features/dub/dub-projects.tsx
new file mode 100644
index 000000000..74ef761cd
--- /dev/null
+++ b/electron/src/renderer/src/features/dub/dub-projects.tsx
@@ -0,0 +1,212 @@
+import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
+import { Link, useNavigate } from '@tanstack/react-router';
+import { useQuery } from '@tanstack/react-query';
+import { useTranslation } from 'react-i18next';
+import { FilmIcon, FolderIcon, SearchIcon } from 'lucide-react';
+import { Input } from '@/components/ui/input';
+import { Button } from '@/components/ui/button';
+import { apiJson, describeError } from '@/lib/api/client';
+import { cn } from '@/lib/utils';
+import { formatRelative } from '../clone/format';
+import { longformSession, useLongformSession } from '../longform/longform-session';
+import type { DubProject } from '../projects/project-format';
+import { dubSession, openDubProject, useDubSession } from './dub-session';
+
+const SEARCH_ABOVE = 8;
+
+interface Row {
+ id: string;
+ name: string;
+ updatedAt: number | string | undefined;
+}
+
+/**
+ * Saved dub projects, in the Dub pane: the same projects the Projects page lists,
+ * newest first. Confirming a selection opens it in place; the footer links to the whole library.
+ */
+export function DubProjects({ active = true }: { active?: boolean }) {
+ const { t, i18n } = useTranslation();
+ const navigate = useNavigate();
+ const dub = useDubSession();
+ const longform = useLongformSession();
+ const [search, setSearch] = useState('');
+ const [error, setError] = useState<string | null>(null);
+ const [opening, setOpening] = useState<string | null>(null);
+ const [confirmation, setConfirmation] = useState<string | null>(null);
+ const request = useRef<AbortController | null>(null);
+ useLayoutEffect(() => {
+ if (!active) {
+ request.current?.abort();
+ request.current = null;
+ setOpening(null);
+ setConfirmation(null);
+ }
+ }, [active]);
+ useEffect(
+ () => () => {
+ request.current?.abort();
+ request.current = null;
+ },
+ [],
+ );
+ const query = useQuery({
+ queryKey: ['projects'],
+ queryFn: ({ signal }) => apiJson<DubProject[]>('/projects', { signal }),
+ });
+ const rows = useMemo<Row[]>(
+ () =>
+ (query.data ?? [])
+ .map((p) => ({ id: p.id, name: p.name, updatedAt: p.updated_at }))
+ .sort((a, b) => stamp(b.updatedAt) - stamp(a.updatedAt)),
+ [query.data],
+ );
+ const shown = useMemo(() => {
+ const needle = search.trim().toLocaleLowerCase();
+ return needle ? rows.filter((row) => row.name.toLocaleLowerCase().includes(needle)) : rows;
+ }, [rows, search]);
+ const activeId = dub.project?.id;
+ // Opening replaces the working project, so it waits while a dub or render is running.
+ const locked =
+ !!longform.active || !!dub.recovery || !['idle', 'editing', 'done'].includes(dub.phase);
+
+ const open = async (id: string) => {
+ if (!active || locked || request.current) return;
+ const snapshot = dubSession.state;
+ const controller = new AbortController();
+ request.current = controller;
+ setOpening(id);
+ setError(null);
+ try {
+ const project = await apiJson<DubProject>('/projects/' + encodeURIComponent(id), {
+ signal: controller.signal,
+ });
+ if (controller.signal.aborted) return;
+ if (longformSession.state.active) {
+ throw new Error(t('sidebarTools.wait'));
+ }
+ if (dubSession.state !== snapshot) {
+ throw new Error(t('projects.draft_changed'));
+ }
+ if (!openDubProject(project)) {
+ throw new Error(t('sidebarTools.wait'));
+ }
+ setConfirmation(null);
+ await navigate({ to: '/dub' });
+ } catch (failure) {
+ if (!controller.signal.aborted) setError(describeError(failure));
+ } finally {
+ if (request.current === controller) {
+ request.current = null;
+ setOpening(null);
+ }
+ }
+ };
+
+ return (
+ <div data-slot="dub-projects" className="flex min-h-0 flex-1 flex-col">
+ {rows.length > SEARCH_ABOVE && (
+ <div className="relative shrink-0 px-2.5 pt-2.5">
+ <SearchIcon
+ aria-hidden="true"
+ className="pointer-events-none absolute start-5 top-1/2 mt-1 size-3.5 -translate-y-1/2 text-muted-foreground"
+ />
+ <Input
+ value={search}
+ onChange={(event) => setSearch(event.target.value)}
+ aria-label={t('preferences.search')}
+ placeholder={t('preferences.search')}
+ className="h-8 ps-8 text-xs"
+ />
+ </div>
+ )}
+ <ul className="studio-scrollbar min-h-0 flex-1 space-y-0.5 overflow-y-auto p-2">
+ {shown.map((row) => {
+ const active = row.id === activeId;
+ const when = formatRelative(row.updatedAt, i18n.language);
+ return (
+ <li key={row.id}>
+ <button
+ type="button"
+ disabled={opening !== null || locked}
+ aria-busy={opening === row.id}
+ aria-current={active ? 'true' : undefined}
+ onClick={() => setConfirmation(row.id)}
+ className={cn(
+ 'flex w-full min-w-0 items-center gap-2.5 rounded-lg px-2 py-1.5 text-start outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50',
+ active
+ ? 'bg-accent/80 text-foreground'
+ : 'text-foreground/85 hover:bg-accent/50 hover:text-foreground',
+ )}
+ >
+ <FilmIcon
+ aria-hidden="true"
+ className={cn(
+ 'size-4 shrink-0',
+ active ? 'text-primary' : 'text-muted-foreground',
+ )}
+ />
+ <span className="flex min-w-0 flex-1 flex-col leading-tight">
+ <span className="truncate text-[13px] font-medium">{row.name}</span>
+ {when && (
+ <span className="truncate text-[11px] text-muted-foreground">{when}</span>
+ )}
+ </span>
+ </button>
+ {confirmation === row.id && (
+ <div className="space-y-2 rounded-md bg-muted/40 p-2 text-xs">
+ <p>{t('projectActions.open', { name: row.name })}</p>
+ <div className="flex gap-2">
+ <Button
+ size="sm"
+ disabled={locked || opening !== null}
+ onClick={() => void open(row.id)}
+ >
+ {t('common.confirm')}
+ </Button>
+ <Button
+ size="sm"
+ variant="ghost"
+ disabled={opening !== null}
+ onClick={() => setConfirmation(null)}
+ >
+ {t('common.cancel')}
+ </Button>
+ </div>
+ </div>
+ )}
+ </li>
+ );
+ })}
+ {!query.isPending && !query.isError && !shown.length && (
+ <li className="px-2 py-6 text-center text-xs text-muted-foreground">
+ {rows.length ? t('projects.no_matches', { query: search.trim() }) : t('projects.empty')}
+ </li>
+ )}
+ {query.isError && (
+ <li role="alert" className="px-2 py-3 text-xs text-destructive">
+ {t('common.error')}
+ </li>
+ )}
+ </ul>
+ {error && (
+ <p role="alert" className="shrink-0 px-3 pb-1 text-xs text-destructive">
+ {error}
+ </p>
+ )}
+ <Link
+ to="/projects"
+ className="flex h-9 shrink-0 items-center gap-2 border-t border-border/45 px-3 text-xs text-muted-foreground outline-none transition-colors hover:bg-accent/40 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ <FolderIcon aria-hidden="true" className="size-3.5" />
+ {t('projects.title')}
+ </Link>
+ </div>
+ );
+}
+
+function stamp(value: number | string | undefined): number {
+ if (!value) return 0;
+ if (typeof value === 'number') return value < 1e12 ? value * 1000 : value;
+ const parsed = Date.parse(value);
+ return Number.isNaN(parsed) ? 0 : parsed;
+}
diff --git a/electron/src/renderer/src/features/longform/longform-page.tsx b/electron/src/renderer/src/features/longform/longform-page.tsx
index b1b7a8c57..7176561f1 100644
--- a/electron/src/renderer/src/features/longform/longform-page.tsx
+++ b/electron/src/renderer/src/features/longform/longform-page.tsx
@@ -227,6 +227,19 @@ export function LongformPage({ mode }: { mode: Mode }) {
size="wide"
variant="controls"
footer={generatePanel}
+ library={
+ <div className="studio-scrollbar min-h-0 flex-1 overflow-y-auto p-3.5 text-[13px]">
+ <ProjectSettings
+ bare
+ mode={mode}
+ draft={draft}
+ disabled={locked}
+ onChange={set}
+ onBusy={setImporting}
+ />
+ </div>
+ }
+ libraryLabel={t('projects.title')}
onCollapsedChange={setSidebarCollapsed}
className="space-y-3 [&>details]:rounded-xl [&>details]:border [&>details]:border-border/60 [&>details]:bg-muted/20 [&>details]:p-3 [&>section]:rounded-xl [&>section]:border [&>section]:border-border/60 [&>section]:bg-muted/20 [&>section]:p-3"
>
@@ -317,13 +330,6 @@ export function LongformPage({ mode }: { mode: Mode }) {
onBusy={setImporting}
/>
)}
- <ProjectSettings
- mode={mode}
- draft={draft}
- disabled={locked}
- onChange={set}
- onBusy={setImporting}
- />
<ProductionSettings
value={draft.overrides}
disabled={locked}
diff --git a/electron/src/renderer/src/features/longform/project-settings.tsx b/electron/src/renderer/src/features/longform/project-settings.tsx
index d92396379..78d06e0bc 100644
--- a/electron/src/renderer/src/features/longform/project-settings.tsx
+++ b/electron/src/renderer/src/features/longform/project-settings.tsx
@@ -11,12 +11,15 @@ export function ProjectSettings({
mode,
draft,
disabled,
+ bare = false,
onChange,
onBusy,
}: {
mode: Mode;
draft: Draft;
disabled: boolean;
+ /** Rendered as the Projects tab of the section pane instead of a disclosure. */
+ bare?: boolean;
onChange: (value: Partial<Draft>) => void;
onBusy: (busy: boolean) => void;
}) {
@@ -85,9 +88,12 @@ export function ProjectSettings({
}
setConfirmation(null);
});
+ const Wrapper = bare ? 'div' : 'details';
return (
- <details className="space-y-3">
- <summary className="cursor-pointer text-sm font-medium">{t('stories.projects')}</summary>
+ <Wrapper className="space-y-3">
+ {!bare && (
+ <summary className="cursor-pointer text-sm font-medium">{t('stories.projects')}</summary>
+ )}
<label className="block space-y-1 text-xs">
{t('stories.projectName')}
<Input
@@ -134,7 +140,7 @@ export function ProjectSettings({
{t('common.loading')}
</p>
)}
- <div className="max-h-64 space-y-1 overflow-y-auto">
+ <div className={bare ? 'space-y-1' : 'max-h-64 space-y-1 overflow-y-auto'}>
{query.data
?.filter((project) => project.mode === mode)
.map((project) => (
@@ -192,6 +198,6 @@ export function ProjectSettings({
</div>
))}
</div>
- </details>
+ </Wrapper>
);
}
diff --git a/electron/src/renderer/src/hooks/use-performance-profile.test.tsx b/electron/src/renderer/src/hooks/use-performance-profile.test.tsx
index 94751c50e..332005f60 100644
--- a/electron/src/renderer/src/hooks/use-performance-profile.test.tsx
+++ b/electron/src/renderer/src/hooks/use-performance-profile.test.tsx
@@ -120,6 +120,9 @@ it('finishes saving before the clone draft mirror completes', async () => {
).resolves.toEqual(
expect.objectContaining({ targets: { tts: { steps: 16, postprocess: true } } }),
);
+ await act(async () => {
+ await vi.dynamicImportSettled();
+ });
expect(mocks.clone).toHaveBeenCalled();
finishMirror?.();
diff --git a/electron/src/renderer/src/i18n/locales/ar.json b/electron/src/renderer/src/i18n/locales/ar.json
index 3f60afef8..bbbc2c49a 100644
--- a/electron/src/renderer/src/i18n/locales/ar.json
+++ b/electron/src/renderer/src/i18n/locales/ar.json
@@ -1642,7 +1642,8 @@
"select_item": "تحديد {{name}}",
"delete_selected": "حذف المحدد ({{count}})",
"deleted_count": "تم الحذف: {{count}}",
- "delete_warning": "لا يمكن التراجع عن هذا الإجراء. تُحذف المشاريع والنصوص. حذف الأصوات أو التسجيلات يحذف أيضًا الصوت المخزن لها. تُحفظ الملفات المصدّرة وصوت العروض المكتملة."
+ "delete_warning": "لا يمكن التراجع عن هذا الإجراء. تُحذف المشاريع والنصوص. حذف الأصوات أو التسجيلات يحذف أيضًا الصوت المخزن لها. تُحفظ الملفات المصدّرة وصوت العروض المكتملة.",
+ "draft_changed": "تغيّرت مسودتك أثناء تحميل هذا المشروع. أكّد مرة أخرى لاستبدالها."
},
"projectActions": {
"delete": "هل تريد حذف «{{name}}»؟ لا يمكن التراجع عن ذلك.",
diff --git a/electron/src/renderer/src/i18n/locales/de.json b/electron/src/renderer/src/i18n/locales/de.json
index a53d74ad7..fc4e3e8a7 100644
--- a/electron/src/renderer/src/i18n/locales/de.json
+++ b/electron/src/renderer/src/i18n/locales/de.json
@@ -1634,7 +1634,8 @@
"select_item": "{{name}} auswählen",
"delete_selected": "Auswahl löschen ({{count}})",
"deleted_count": "Gelöscht: {{count}}",
- "delete_warning": "Dies kann nicht rückgängig gemacht werden. Projekte und Transkripte werden entfernt. Beim Löschen von Stimmen oder Aufnahmen wird auch deren gespeichertes Audio gelöscht. Exportierte Dateien und fertig gerendertes Audio bleiben erhalten."
+ "delete_warning": "Dies kann nicht rückgängig gemacht werden. Projekte und Transkripte werden entfernt. Beim Löschen von Stimmen oder Aufnahmen wird auch deren gespeichertes Audio gelöscht. Exportierte Dateien und fertig gerendertes Audio bleiben erhalten.",
+ "draft_changed": "Dein Entwurf wurde beim Laden dieses Projekts geändert. Bestätige erneut, um ihn zu ersetzen."
},
"projectActions": {
"delete": "„{{name}}“ löschen? Dies kann nicht rückgängig gemacht werden.",
diff --git a/electron/src/renderer/src/i18n/locales/en.json b/electron/src/renderer/src/i18n/locales/en.json
index 28d7093e0..ed99fafd5 100644
--- a/electron/src/renderer/src/i18n/locales/en.json
+++ b/electron/src/renderer/src/i18n/locales/en.json
@@ -1762,7 +1762,8 @@
"select_item": "Select {{name}}",
"delete_selected": "Delete selected ({{count}})",
"deleted_count": "Deleted: {{count}}",
- "delete_warning": "This cannot be undone. Projects and transcripts are removed. Deleting voices or takes also removes their stored audio. Exported files and finished render audio are kept."
+ "delete_warning": "This cannot be undone. Projects and transcripts are removed. Deleting voices or takes also removes their stored audio. Exported files and finished render audio are kept.",
+ "draft_changed": "Your draft changed while this project was loading. Confirm again to replace it."
},
"projectActions": {
"delete": "Delete “{{name}}”? This cannot be undone.",
diff --git a/electron/src/renderer/src/i18n/locales/es.json b/electron/src/renderer/src/i18n/locales/es.json
index 10e153573..8742be556 100644
--- a/electron/src/renderer/src/i18n/locales/es.json
+++ b/electron/src/renderer/src/i18n/locales/es.json
@@ -1636,7 +1636,8 @@
"select_item": "Seleccionar {{name}}",
"delete_selected": "Eliminar selección ({{count}})",
"deleted_count": "Eliminados: {{count}}",
- "delete_warning": "Esta acción no se puede deshacer. Se eliminan los proyectos y las transcripciones. Al eliminar voces o tomas también se borra su audio guardado. Se conservan los archivos exportados y el audio de los renderizados terminados."
+ "delete_warning": "Esta acción no se puede deshacer. Se eliminan los proyectos y las transcripciones. Al eliminar voces o tomas también se borra su audio guardado. Se conservan los archivos exportados y el audio de los renderizados terminados.",
+ "draft_changed": "Tu borrador cambió mientras se cargaba este proyecto. Confirma de nuevo para reemplazarlo."
},
"projectActions": {
"delete": "¿Eliminar «{{name}}»? No se puede deshacer.",
diff --git a/electron/src/renderer/src/i18n/locales/fr.json b/electron/src/renderer/src/i18n/locales/fr.json
index 61ad3e29a..e7bce230d 100644
--- a/electron/src/renderer/src/i18n/locales/fr.json
+++ b/electron/src/renderer/src/i18n/locales/fr.json
@@ -1636,7 +1636,8 @@
"select_item": "Sélectionner {{name}}",
"delete_selected": "Supprimer la sélection ({{count}})",
"deleted_count": "Supprimés : {{count}}",
- "delete_warning": "Cette action est irréversible. Les projets et transcriptions sont supprimés. Supprimer des voix ou des prises efface aussi leur audio enregistré. Les fichiers exportés et les rendus audio terminés sont conservés."
+ "delete_warning": "Cette action est irréversible. Les projets et transcriptions sont supprimés. Supprimer des voix ou des prises efface aussi leur audio enregistré. Les fichiers exportés et les rendus audio terminés sont conservés.",
+ "draft_changed": "Votre brouillon a changé pendant le chargement de ce projet. Confirmez à nouveau pour le remplacer."
},
"projectActions": {
"delete": "Supprimer « {{name}} » ? Cette action est irréversible.",
diff --git a/electron/src/renderer/src/i18n/locales/hi.json b/electron/src/renderer/src/i18n/locales/hi.json
index 3bbeb0c5a..43a505473 100644
--- a/electron/src/renderer/src/i18n/locales/hi.json
+++ b/electron/src/renderer/src/i18n/locales/hi.json
@@ -1634,7 +1634,8 @@
"select_item": "{{name}} चुनें",
"delete_selected": "चुने हुए हटाएँ ({{count}})",
"deleted_count": "हटाए गए: {{count}}",
- "delete_warning": "इसे वापस नहीं किया जा सकता। प्रोजेक्ट और ट्रांसक्रिप्ट हट जाएँगे। आवाज़ें या रिकॉर्डिंग हटाने पर उनका सहेजा हुआ ऑडियो भी हटेगा। एक्सपोर्ट की गई फ़ाइलें और पूर्ण रेंडर का ऑडियो बना रहेगा।"
+ "delete_warning": "इसे वापस नहीं किया जा सकता। प्रोजेक्ट और ट्रांसक्रिप्ट हट जाएँगे। आवाज़ें या रिकॉर्डिंग हटाने पर उनका सहेजा हुआ ऑडियो भी हटेगा। एक्सपोर्ट की गई फ़ाइलें और पूर्ण रेंडर का ऑडियो बना रहेगा।",
+ "draft_changed": "यह प्रोजेक्ट लोड होते समय आपका ड्राफ़्ट बदल गया। उसे बदलने के लिए फिर से पुष्टि करें।"
},
"projectActions": {
"delete": "“{{name}}” हटाएँ? इसे वापस नहीं किया जा सकता।",
diff --git a/electron/src/renderer/src/i18n/locales/id.json b/electron/src/renderer/src/i18n/locales/id.json
index 015fc2012..fb9993a7c 100644
--- a/electron/src/renderer/src/i18n/locales/id.json
+++ b/electron/src/renderer/src/i18n/locales/id.json
@@ -1634,7 +1634,8 @@
"select_item": "Pilih {{name}}",
"delete_selected": "Hapus pilihan ({{count}})",
"deleted_count": "Dihapus: {{count}}",
- "delete_warning": "Tindakan ini tidak dapat dibatalkan. Proyek dan transkrip dihapus. Menghapus suara atau rekaman juga menghapus audio tersimpannya. File ekspor dan audio hasil render yang selesai tetap disimpan."
+ "delete_warning": "Tindakan ini tidak dapat dibatalkan. Proyek dan transkrip dihapus. Menghapus suara atau rekaman juga menghapus audio tersimpannya. File ekspor dan audio hasil render yang selesai tetap disimpan.",
+ "draft_changed": "Draf Anda berubah saat proyek ini dimuat. Konfirmasikan lagi untuk menggantinya."
},
"projectActions": {
"delete": "Hapus “{{name}}”? Tindakan ini tidak dapat dibatalkan.",
diff --git a/electron/src/renderer/src/i18n/locales/it.json b/electron/src/renderer/src/i18n/locales/it.json
index 5131ae2a6..55d1ae78b 100644
--- a/electron/src/renderer/src/i18n/locales/it.json
+++ b/electron/src/renderer/src/i18n/locales/it.json
@@ -1636,7 +1636,8 @@
"select_item": "Seleziona {{name}}",
"delete_selected": "Elimina selezione ({{count}})",
"deleted_count": "Eliminati: {{count}}",
- "delete_warning": "Questa azione è irreversibile. Progetti e trascrizioni vengono rimossi. Eliminare voci o registrazioni rimuove anche il relativo audio salvato. I file esportati e i rendering audio completati vengono conservati."
+ "delete_warning": "Questa azione è irreversibile. Progetti e trascrizioni vengono rimossi. Eliminare voci o registrazioni rimuove anche il relativo audio salvato. I file esportati e i rendering audio completati vengono conservati.",
+ "draft_changed": "La bozza è cambiata durante il caricamento di questo progetto. Conferma di nuovo per sostituirla."
},
"projectActions": {
"delete": "Eliminare “{{name}}”? Questa azione è irreversibile.",
diff --git a/electron/src/renderer/src/i18n/locales/ja.json b/electron/src/renderer/src/i18n/locales/ja.json
index c60f92709..c2bc2a8f8 100644
--- a/electron/src/renderer/src/i18n/locales/ja.json
+++ b/electron/src/renderer/src/i18n/locales/ja.json
@@ -1634,7 +1634,8 @@
"select_item": "{{name}}を選択",
"delete_selected": "選択項目を削除({{count}})",
"deleted_count": "削除済み:{{count}}",
- "delete_warning": "この操作は取り消せません。プロジェクトと文字起こしが削除されます。音声やテイクを削除すると、保存された音声も削除されます。エクスポートしたファイルと完成したレンダリング音声は保持されます。"
+ "delete_warning": "この操作は取り消せません。プロジェクトと文字起こしが削除されます。音声やテイクを削除すると、保存された音声も削除されます。エクスポートしたファイルと完成したレンダリング音声は保持されます。",
+ "draft_changed": "プロジェクトの読み込み中に下書きが変更されました。置き換えるには、もう一度確認してください。"
},
"projectActions": {
"delete": "「{{name}}」を削除しますか?この操作は元に戻せません。",
diff --git a/electron/src/renderer/src/i18n/locales/ko.json b/electron/src/renderer/src/i18n/locales/ko.json
index 36e685b97..5c861c1c0 100644
--- a/electron/src/renderer/src/i18n/locales/ko.json
+++ b/electron/src/renderer/src/i18n/locales/ko.json
@@ -1634,7 +1634,8 @@
"select_item": "{{name}} 선택",
"delete_selected": "선택 항목 삭제 ({{count}})",
"deleted_count": "삭제됨: {{count}}",
- "delete_warning": "이 작업은 되돌릴 수 없습니다. 프로젝트와 전사 내용이 삭제됩니다. 음성이나 테이크를 삭제하면 저장된 오디오도 삭제됩니다. 내보낸 파일과 완료된 렌더링 오디오는 유지됩니다."
+ "delete_warning": "이 작업은 되돌릴 수 없습니다. 프로젝트와 전사 내용이 삭제됩니다. 음성이나 테이크를 삭제하면 저장된 오디오도 삭제됩니다. 내보낸 파일과 완료된 렌더링 오디오는 유지됩니다.",
+ "draft_changed": "프로젝트를 불러오는 동안 초안이 변경되었습니다. 바꾸려면 다시 확인하세요."
},
"projectActions": {
"delete": "“{{name}}”을(를) 삭제할까요? 되돌릴 수 없습니다.",
diff --git a/electron/src/renderer/src/i18n/locales/nl.json b/electron/src/renderer/src/i18n/locales/nl.json
index 6e7083285..79a5650cc 100644
--- a/electron/src/renderer/src/i18n/locales/nl.json
+++ b/electron/src/renderer/src/i18n/locales/nl.json
@@ -1634,7 +1634,8 @@
"select_item": "{{name}} selecteren",
"delete_selected": "Selectie verwijderen ({{count}})",
"deleted_count": "Verwijderd: {{count}}",
- "delete_warning": "Dit kan niet ongedaan worden gemaakt. Projecten en transcripties worden verwijderd. Bij het verwijderen van stemmen of opnamen wordt ook hun opgeslagen audio verwijderd. Geëxporteerde bestanden en voltooide audiorenders blijven bewaard."
+ "delete_warning": "Dit kan niet ongedaan worden gemaakt. Projecten en transcripties worden verwijderd. Bij het verwijderen van stemmen of opnamen wordt ook hun opgeslagen audio verwijderd. Geëxporteerde bestanden en voltooide audiorenders blijven bewaard.",
+ "draft_changed": "Je concept is gewijzigd tijdens het laden van dit project. Bevestig opnieuw om het te vervangen."
},
"projectActions": {
"delete": "‘{{name}}’ verwijderen? Dit kan niet ongedaan worden gemaakt.",
diff --git a/electron/src/renderer/src/i18n/locales/pl.json b/electron/src/renderer/src/i18n/locales/pl.json
index 4ecc96de3..e9a03ffcc 100644
--- a/electron/src/renderer/src/i18n/locales/pl.json
+++ b/electron/src/renderer/src/i18n/locales/pl.json
@@ -1638,7 +1638,8 @@
"select_item": "Zaznacz {{name}}",
"delete_selected": "Usuń zaznaczone ({{count}})",
"deleted_count": "Usunięto: {{count}}",
- "delete_warning": "Tej operacji nie można cofnąć. Projekty i transkrypcje zostaną usunięte. Usunięcie głosów lub nagrań usuwa też ich zapisany dźwięk. Wyeksportowane pliki i ukończone rendery audio pozostaną."
+ "delete_warning": "Tej operacji nie można cofnąć. Projekty i transkrypcje zostaną usunięte. Usunięcie głosów lub nagrań usuwa też ich zapisany dźwięk. Wyeksportowane pliki i ukończone rendery audio pozostaną.",
+ "draft_changed": "Szkic zmienił się podczas wczytywania tego projektu. Potwierdź ponownie, aby go zastąpić."
},
"projectActions": {
"delete": "Usunąć „{{name}}”? Tej czynności nie można cofnąć.",
diff --git a/electron/src/renderer/src/i18n/locales/pt.json b/electron/src/renderer/src/i18n/locales/pt.json
index 8a538e38d..ea7e45c5e 100644
--- a/electron/src/renderer/src/i18n/locales/pt.json
+++ b/electron/src/renderer/src/i18n/locales/pt.json
@@ -1636,7 +1636,8 @@
"select_item": "Selecionar {{name}}",
"delete_selected": "Excluir selecionados ({{count}})",
"deleted_count": "Excluídos: {{count}}",
- "delete_warning": "Esta ação não pode ser desfeita. Projetos e transcrições serão removidos. Excluir vozes ou gravações também remove o áudio salvo. Arquivos exportados e áudios de renderizações concluídas serão mantidos."
+ "delete_warning": "Esta ação não pode ser desfeita. Projetos e transcrições serão removidos. Excluir vozes ou gravações também remove o áudio salvo. Arquivos exportados e áudios de renderizações concluídas serão mantidos.",
+ "draft_changed": "Seu rascunho mudou enquanto este projeto era carregado. Confirme novamente para substituí-lo."
},
"projectActions": {
"delete": "Excluir “{{name}}”? Esta ação não pode ser desfeita.",
diff --git a/electron/src/renderer/src/i18n/locales/ru.json b/electron/src/renderer/src/i18n/locales/ru.json
index 41218ffe7..6be0e207f 100644
--- a/electron/src/renderer/src/i18n/locales/ru.json
+++ b/electron/src/renderer/src/i18n/locales/ru.json
@@ -1638,7 +1638,8 @@
"select_item": "Выбрать {{name}}",
"delete_selected": "Удалить выбранное ({{count}})",
"deleted_count": "Удалено: {{count}}",
- "delete_warning": "Это действие нельзя отменить. Проекты и расшифровки будут удалены. При удалении голосов или дублей также удаляется их сохранённое аудио. Экспортированные файлы и аудио завершённых рендеров сохранятся."
+ "delete_warning": "Это действие нельзя отменить. Проекты и расшифровки будут удалены. При удалении голосов или дублей также удаляется их сохранённое аудио. Экспортированные файлы и аудио завершённых рендеров сохранятся.",
+ "draft_changed": "Черновик изменился во время загрузки проекта. Подтвердите ещё раз, чтобы заменить его."
},
"projectActions": {
"delete": "Удалить «{{name}}»? Это действие нельзя отменить.",
diff --git a/electron/src/renderer/src/i18n/locales/sv.json b/electron/src/renderer/src/i18n/locales/sv.json
index 4d731400a..0e74e33ad 100644
--- a/electron/src/renderer/src/i18n/locales/sv.json
+++ b/electron/src/renderer/src/i18n/locales/sv.json
@@ -1634,7 +1634,8 @@
"select_item": "Markera {{name}}",
"delete_selected": "Ta bort markerade ({{count}})",
"deleted_count": "Borttagna: {{count}}",
- "delete_warning": "Detta kan inte ångras. Projekt och transkriptioner tas bort. När röster eller tagningar tas bort raderas även deras sparade ljud. Exporterade filer och färdigrenderat ljud behålls."
+ "delete_warning": "Detta kan inte ångras. Projekt och transkriptioner tas bort. När röster eller tagningar tas bort raderas även deras sparade ljud. Exporterade filer och färdigrenderat ljud behålls.",
+ "draft_changed": "Ditt utkast ändrades medan projektet laddades. Bekräfta igen för att ersätta det."
},
"projectActions": {
"delete": "Ta bort ”{{name}}”? Detta kan inte ångras.",
diff --git a/electron/src/renderer/src/i18n/locales/th.json b/electron/src/renderer/src/i18n/locales/th.json
index 64921be51..04297af42 100644
--- a/electron/src/renderer/src/i18n/locales/th.json
+++ b/electron/src/renderer/src/i18n/locales/th.json
@@ -1634,7 +1634,8 @@
"select_item": "เลือก {{name}}",
"delete_selected": "ลบที่เลือก ({{count}})",
"deleted_count": "ลบแล้ว: {{count}}",
- "delete_warning": "ไม่สามารถเลิกทำได้ โปรเจกต์และข้อความถอดเสียงจะถูกลบ การลบเสียงหรือเทคจะลบไฟล์เสียงที่บันทึกไว้ด้วย ไฟล์ที่ส่งออกและเสียงที่เรนเดอร์เสร็จแล้วจะยังคงอยู่"
+ "delete_warning": "ไม่สามารถเลิกทำได้ โปรเจกต์และข้อความถอดเสียงจะถูกลบ การลบเสียงหรือเทคจะลบไฟล์เสียงที่บันทึกไว้ด้วย ไฟล์ที่ส่งออกและเสียงที่เรนเดอร์เสร็จแล้วจะยังคงอยู่",
+ "draft_changed": "ฉบับร่างของคุณเปลี่ยนแปลงระหว่างโหลดโปรเจกต์นี้ ยืนยันอีกครั้งเพื่อแทนที่ฉบับร่าง"
},
"projectActions": {
"delete": "ลบ “{{name}}” หรือไม่? การดำเนินการนี้ไม่สามารถย้อนกลับได้",
diff --git a/electron/src/renderer/src/i18n/locales/tr.json b/electron/src/renderer/src/i18n/locales/tr.json
index 8f76c2bf3..5ac1d2c8c 100644
--- a/electron/src/renderer/src/i18n/locales/tr.json
+++ b/electron/src/renderer/src/i18n/locales/tr.json
@@ -1634,7 +1634,8 @@
"select_item": "{{name}} seç",
"delete_selected": "Seçilenleri sil ({{count}})",
"deleted_count": "Silinen: {{count}}",
- "delete_warning": "Bu işlem geri alınamaz. Projeler ve dökümler kaldırılır. Sesleri veya kayıtları silmek, saklanan ses dosyalarını da siler. Dışa aktarılan dosyalar ve tamamlanmış işleme sesleri korunur."
+ "delete_warning": "Bu işlem geri alınamaz. Projeler ve dökümler kaldırılır. Sesleri veya kayıtları silmek, saklanan ses dosyalarını da siler. Dışa aktarılan dosyalar ve tamamlanmış işleme sesleri korunur.",
+ "draft_changed": "Bu proje yüklenirken taslağınız değişti. Değiştirmek için yeniden onaylayın."
},
"projectActions": {
"delete": "“{{name}}” silinsin mi? Bu işlem geri alınamaz.",
diff --git a/electron/src/renderer/src/i18n/locales/uk.json b/electron/src/renderer/src/i18n/locales/uk.json
index e5e164e4e..653ac63b9 100644
--- a/electron/src/renderer/src/i18n/locales/uk.json
+++ b/electron/src/renderer/src/i18n/locales/uk.json
@@ -1638,7 +1638,8 @@
"select_item": "Вибрати {{name}}",
"delete_selected": "Видалити вибране ({{count}})",
"deleted_count": "Видалено: {{count}}",
- "delete_warning": "Цю дію неможливо скасувати. Проєкти та розшифровки буде видалено. Видалення голосів або дублів також видаляє їхнє збережене аудіо. Експортовані файли й аудіо завершених рендерів залишаться."
+ "delete_warning": "Цю дію неможливо скасувати. Проєкти та розшифровки буде видалено. Видалення голосів або дублів також видаляє їхнє збережене аудіо. Експортовані файли й аудіо завершених рендерів залишаться.",
+ "draft_changed": "Чернетка змінилася під час завантаження проєкту. Підтвердьте ще раз, щоб замінити її."
},
"projectActions": {
"delete": "Видалити «{{name}}»? Цю дію неможливо скасувати.",
diff --git a/electron/src/renderer/src/i18n/locales/vi.json b/electron/src/renderer/src/i18n/locales/vi.json
index efed61f7c..4d41922c4 100644
--- a/electron/src/renderer/src/i18n/locales/vi.json
+++ b/electron/src/renderer/src/i18n/locales/vi.json
@@ -1634,7 +1634,8 @@
"select_item": "Chọn {{name}}",
"delete_selected": "Xóa mục đã chọn ({{count}})",
"deleted_count": "Đã xóa: {{count}}",
- "delete_warning": "Không thể hoàn tác. Dự án và bản chép lời sẽ bị xóa. Xóa giọng nói hoặc bản thu cũng xóa âm thanh đã lưu của chúng. Tệp đã xuất và âm thanh kết xuất hoàn tất được giữ lại."
+ "delete_warning": "Không thể hoàn tác. Dự án và bản chép lời sẽ bị xóa. Xóa giọng nói hoặc bản thu cũng xóa âm thanh đã lưu của chúng. Tệp đã xuất và âm thanh kết xuất hoàn tất được giữ lại.",
+ "draft_changed": "Bản nháp của bạn đã thay đổi trong khi tải dự án này. Xác nhận lại để thay thế bản nháp."
},
"projectActions": {
"delete": "Xóa “{{name}}”? Không thể hoàn tác thao tác này.",
diff --git a/electron/src/renderer/src/i18n/locales/zh-CN.json b/electron/src/renderer/src/i18n/locales/zh-CN.json
index 381fe7b63..57d639f76 100644
--- a/electron/src/renderer/src/i18n/locales/zh-CN.json
+++ b/electron/src/renderer/src/i18n/locales/zh-CN.json
@@ -1634,7 +1634,8 @@
"select_item": "选择{{name}}",
"delete_selected": "删除所选项({{count}})",
"deleted_count": "已删除:{{count}}",
- "delete_warning": "此操作无法撤销。项目和转录文本将被删除。删除声音或录音也会删除其保存的音频。导出的文件和已完成渲染的音频将保留。"
+ "delete_warning": "此操作无法撤销。项目和转录文本将被删除。删除声音或录音也会删除其保存的音频。导出的文件和已完成渲染的音频将保留。",
+ "draft_changed": "加载此项目时,你的草稿已更改。请再次确认以替换草稿。"
},
"projectActions": {
"delete": "删除“{{name}}”?此操作无法撤销。",
diff --git a/electron/src/renderer/src/i18n/locales/zh-TW.json b/electron/src/renderer/src/i18n/locales/zh-TW.json
index e2d18919f..cc5325260 100644
--- a/electron/src/renderer/src/i18n/locales/zh-TW.json
+++ b/electron/src/renderer/src/i18n/locales/zh-TW.json
@@ -1634,7 +1634,8 @@
"select_item": "選取{{name}}",
"delete_selected": "刪除所選項目({{count}})",
"deleted_count": "已刪除:{{count}}",
- "delete_warning": "此操作無法復原。專案和轉錄文字將被刪除。刪除聲音或錄音也會刪除其儲存的音訊。匯出的檔案和已完成算繪的音訊將保留。"
+ "delete_warning": "此操作無法復原。專案和轉錄文字將被刪除。刪除聲音或錄音也會刪除其儲存的音訊。匯出的檔案和已完成算繪的音訊將保留。",
+ "draft_changed": "載入此專案時,你的草稿已變更。請再次確認以取代草稿。"
},
"projectActions": {
"delete": "刪除「{{name}}」?此操作無法復原。",
diff --git a/electron/tests/compact-workspace-navigation-smoke.mjs b/electron/tests/compact-workspace-navigation-smoke.mjs
index d9a58959c..68c6ca4f1 100644
--- a/electron/tests/compact-workspace-navigation-smoke.mjs
+++ b/electron/tests/compact-workspace-navigation-smoke.mjs
@@ -4,6 +4,13 @@ const browser = await chromium.launch({
...(process.env.CHROMIUM_PATH ? { executablePath: process.env.CHROMIUM_PATH } : {}),
headless: true,
});
+async function expectFocus(page, locator) {
+ await page.waitForFunction(
+ (element) => element === document.activeElement,
+ await locator.elementHandle(),
+ { timeout: 3000 },
+ );
+}
try {
const page = await browser.newPage({ viewport: { width: 1200, height: 800 } });
await page.addInitScript(() => localStorage.setItem('voicestudio.setup.complete.v1', '1'));
@@ -67,13 +74,13 @@ try {
await clone.waitFor();
await page.keyboard.press('Escape');
await clone.waitFor({ state: 'hidden' });
- assert.equal(await voice.evaluate((element) => element === document.activeElement), true);
+ await expectFocus(page, voice);
await page.keyboard.press('ArrowRight');
await clone.waitFor();
- assert.equal(await clone.evaluate((element) => element === document.activeElement), true);
+ await expectFocus(page, clone);
await page.keyboard.press('ArrowLeft');
await clone.waitFor({ state: 'hidden' });
- assert.equal(await voice.evaluate((element) => element === document.activeElement), true);
+ await expectFocus(page, voice);
await voice.dblclick();
await rail.waitFor({ state: 'hidden' });
assert.equal((await page.getByRole('button', { name: 'Close', exact: true }).count()) > 0, true);
diff --git a/electron/tests/desktop-harness-ports.test.mjs b/electron/tests/desktop-harness-ports.test.mjs
index 490bc7770..c8d6b3142 100644
--- a/electron/tests/desktop-harness-ports.test.mjs
+++ b/electron/tests/desktop-harness-ports.test.mjs
@@ -1,7 +1,33 @@
import assert from 'node:assert/strict';
import { createServer } from 'node:net';
import test from 'node:test';
-import { freePort, isPortConflict, launchWithFreshPorts } from './desktop-harness.mjs';
+import { freePort, isPortConflict, launchWithFreshPorts, readRequestLog } from './desktop-harness.mjs';
+
+test('a terminated app needs no disposed Playwright handle to collect its guards', async () => {
+ for (const child of [
+ { exitCode: 0, signalCode: null },
+ { exitCode: null, signalCode: 'SIGKILL' },
+ ]) {
+ const app = {
+ process: () => {
+ throw new TypeError("Cannot read properties of undefined (reading '_object')");
+ },
+ evaluate: () => assert.fail('a terminated app cannot answer IPC'),
+ };
+ assert.equal(await readRequestLog({ app, child }), null);
+ }
+});
+
+test('a live app still reports its request log and surfaces IPC failures', async () => {
+ const child = { exitCode: null, signalCode: null };
+ const seen = ['app://voicestudio/'];
+ const app = { process: () => child, evaluate: async () => seen };
+ assert.equal(await readRequestLog({ app, child }), seen);
+ app.evaluate = async () => {
+ throw new Error('request guard unavailable');
+ };
+ await assert.rejects(readRequestLog({ app, child }), /request guard unavailable/);
+});
const conflict = () =>
new Error(
diff --git a/electron/tests/desktop-harness.mjs b/electron/tests/desktop-harness.mjs
index 067c589be..8ebb41350 100644
--- a/electron/tests/desktop-harness.mjs
+++ b/electron/tests/desktop-harness.mjs
@@ -81,6 +81,13 @@ const slug = (name) =>
.replace(/^-|-$/g, '')
.toLowerCase();
+/** A killed app has already disposed its Playwright handle and cannot answer IPC. */
+export async function readRequestLog(started) {
+ const child = started.child;
+ if (child.exitCode !== null || child.signalCode !== null) return null;
+ return started.app.evaluate(() => globalThis.__requestLog);
+}
+
async function launch({ profile, backendPort, proxyPort, seed }) {
// VS Code terminals export ELECTRON_RUN_AS_NODE=1, which makes Electron boot as plain Node.
const { ELECTRON_RUN_AS_NODE: _runAsNode, ...inherited } = process.env;
@@ -105,7 +112,9 @@ async function launch({ profile, backendPort, proxyPort, seed }) {
timeout: 60000,
});
const output = [];
- for (const stream of [app.process().stdout, app.process().stderr]) {
+ // Capture while the handle is live: process() itself throws after Playwright disposes it.
+ const child = app.process();
+ for (const stream of [child.stdout, child.stderr]) {
stream?.on('data', (chunk) => output.push(String(chunk)));
}
const context = app.context();
@@ -154,7 +163,7 @@ async function launch({ profile, backendPort, proxyPort, seed }) {
});
// The main-process guard predates the app; one reload also replays the first page's console.
await page.reload();
- return { app, page, errors };
+ return { app, child, page, errors };
}
/**
@@ -209,10 +218,9 @@ export async function withApp(t, options, body) {
let unobserved = 0;
async function collectGuards(started) {
errors.push(...started.errors);
- const child = started.app.process();
// A killed app cannot be asked for its log; every other read error must fail the run.
- if (child.exitCode !== null || child.signalCode !== null) return;
- const seen = await started.app.evaluate(() => globalThis.__requestLog);
+ const seen = await readRequestLog(started);
+ if (seen === null) return;
// An empty log means the guard never ran (hook missing or replaced), not that all is well.
if (!seen.some((url) => url.startsWith('app:'))) unobserved += 1;
// The guard already left out the renderer's stubbed star-count request.
diff --git a/electron/tests/desktop-ui.test.mjs b/electron/tests/desktop-ui.test.mjs
index 2aa95fbe2..9ebf9bc56 100644
--- a/electron/tests/desktop-ui.test.mjs
+++ b/electron/tests/desktop-ui.test.mjs
@@ -2,6 +2,7 @@ import { test } from 'node:test';
import assert from 'node:assert/strict';
import { existsSync, mkdirSync, readFileSync, realpathSync, rmSync } from 'node:fs';
import { once } from 'node:events';
+import { execFileSync } from 'node:child_process';
import { dirname, join } from 'node:path';
import { withApp } from './desktop-harness.mjs';
import { ROUTES } from './fixtures/routes.mjs';
@@ -253,8 +254,16 @@ test('unclean exit: relaunch on the same profile starts normally', async (t) =>
await withApp(t, {}, async (session) => {
const child = session.app.process();
const exited = once(child, 'exit');
- child.kill('SIGKILL');
+ const closed = session.app.waitForEvent('close', { timeout: 30_000 });
+ if (process.platform === 'win32') {
+ // Playwright launches through cmd.exe here; killing only that wrapper leaves
+ // Electron alive with inherited output pipes, so the close event never fires.
+ execFileSync('taskkill', ['/pid', String(child.pid), '/T', '/F']);
+ } else {
+ child.kill('SIGKILL');
+ }
await exited;
+ await closed;
const restarted = await session.relaunch();
await restarted.page.waitForFunction(() => Boolean(window.voicestudio?.files?.saveData));
const facts = await bridgeFacts(restarted.page);
diff --git a/electron/tests/longform-smoke.mjs b/electron/tests/longform-smoke.mjs
index 0b604f0e4..c3fcb8e14 100644
--- a/electron/tests/longform-smoke.mjs
+++ b/electron/tests/longform-smoke.mjs
@@ -147,13 +147,12 @@ try {
);
assert.equal(await page.getByLabel('Author', { exact: true }).inputValue(), 'Test author');
assert.equal(await page.getByLabel('Word', { exact: true }).inputValue(), 'SQL');
- await page
- .locator('[data-slot=secondary-sidebar]')
- .getByText('Projects', { exact: true })
- .click();
+ // Projects is a tab beside the controls; Audiobook (the pane title) switches back.
+ await page.getByRole('tab', { name: 'Projects', exact: true }).click();
await page.getByLabel('Project name', { exact: true }).fill('Saved book fixture');
await page.getByRole('button', { name: 'Save', exact: true }).click();
await page.getByRole('button', { name: 'Saved book fixture', exact: true }).waitFor();
+ await page.getByRole('tab', { name: 'Audiobook', exact: true }).click();
await page.getByRole('textbox', { name: 'Script', exact: true }).fill('Unsaved edit');
await page.goto((process.env.VOICESTUDIO_UI_URL || 'http://localhost:3902') + '/#/projects');
await page.getByRole('button', { name: 'Rename Saved book fixture', exact: true }).click();
@@ -180,10 +179,7 @@ try {
.getByRole('navigation', { name: 'Workspaces', exact: true })
.getByRole('button', { name: 'Stories', exact: true })
.click();
- await page
- .getByRole('dialog')
- .getByRole('link', { name: 'Stories', exact: true })
- .click();
+ await page.getByRole('dialog').getByRole('link', { name: 'Stories', exact: true }).click();
await page
.locator('[data-slot=secondary-sidebar]')
.getByRole('button', { name: 'Narrator fixture', exact: true })
diff --git a/electron/tests/secondary-sidebar-smoke.mjs b/electron/tests/secondary-sidebar-smoke.mjs
index 572e904b1..d9dc32238 100644
--- a/electron/tests/secondary-sidebar-smoke.mjs
+++ b/electron/tests/secondary-sidebar-smoke.mjs
@@ -31,72 +31,56 @@ try {
await sideCandidates.first().waitFor({ state: "attached" });
await sideCandidates.first().getByRole("separator").waitFor({ state: "visible" });
const compactMain = page.locator("[data-slot=compact-main-sidebar]");
- if (width <= 1680) {
- await compactMain.waitFor();
- assert.equal(Math.round((await compactMain.boundingBox()).width), 48);
- // The notifications bell lives in the top-right account corner on every page and
- // platform, not in the sidebar.
- assert.equal(await compactMain.locator("button .lucide-bell").count(), 0);
- assert.equal(
- await page.locator('[data-slot="account-corner"] button .lucide-bell').count(),
- 1,
- );
- // Voice, Stories and Dubbing are flyout group buttons; the other five are direct links.
- const compactNav = compactMain.getByRole("navigation", {
- name: "Workspaces",
- });
- assert.equal(await compactNav.getByRole("button").count(), 3);
- assert.equal(await compactNav.getByRole("link").count(), 5);
- assert.equal(
- await page
- .locator(".brand-sidebar")
- .filter({ hasText: "Saved voices" })
- .count(),
- 0,
- );
- const openMain = compactMain.getByRole("button", {
- name: "Toggle Sidebar",
- });
- await openMain.click();
- await compactMain.waitFor({ state: "detached" });
- const expandedMain = page
- .locator(".brand-sidebar")
- .filter({ hasText: "Saved voices" });
- await expandedMain.waitFor();
- const before = await expandedMain.boundingBox();
- const separator = expandedMain.getByRole("separator");
- await separator.focus();
- const currentWidth = Number(
- await separator.getAttribute("aria-valuenow"),
- );
- const minimumWidth = Number(
- await separator.getAttribute("aria-valuemin"),
- );
- const maximumWidth = Number(
- await separator.getAttribute("aria-valuemax"),
- );
- const grow = currentWidth <= minimumWidth;
- await separator.press(grow ? "ArrowRight" : "ArrowLeft");
- const after = await expandedMain.boundingBox();
- const resizeDelta = Math.round(Math.abs(before.width - after.width));
- assert.ok(
- resizeDelta > 0 && resizeDelta <= 20,
- `${route} main sidebar did not resize: ${before.width}px -> ${after.width}px (now ${currentWidth}, min ${minimumWidth}, max ${maximumWidth})`,
- );
- await expandedMain.getByRole("button", { name: "Close" }).click();
- await compactMain.waitFor();
- } else {
- assert.equal(await compactMain.count(), 0);
- const expandedMain = page
- .locator(".brand-sidebar")
- .filter({ hasText: "Saved voices" });
- assert.equal(await expandedMain.count(), 1);
- assert.equal(await expandedMain.locator("button .lucide-bell").count(), 0);
- assert.equal(
- await page.locator('[data-slot="account-corner"] button .lucide-bell').count(),
- 1,
- );
- }
+ // A section with its own pane keeps navigation to the icon rail at every width.
+ await compactMain.waitFor();
+ assert.equal(Math.round((await compactMain.boundingBox()).width), 48);
+ // The notifications bell lives in the top-right account corner on every page and
+ // platform, not in the sidebar.
+ assert.equal(await compactMain.locator("button .lucide-bell").count(), 0);
+ assert.equal(
+ await page.locator('[data-slot="account-corner"] button .lucide-bell').count(),
+ 1,
+ );
+ // Voice, Stories and Dubbing are flyout group buttons; the other five are direct links.
+ const compactNav = compactMain.getByRole("navigation", {
+ name: "Workspaces",
+ });
+ assert.equal(await compactNav.getByRole("button").count(), 3);
+ assert.equal(await compactNav.getByRole("link").count(), 5);
+ assert.equal(
+ await page.locator(".brand-sidebar:not([data-slot=compact-main-sidebar])")
+ .count(),
+ 0,
+ );
+ const openMain = compactMain.getByRole("button", {
+ name: "Toggle Sidebar",
+ });
+ await openMain.click();
+ await compactMain.waitFor({ state: "detached" });
+ const expandedMain = page.locator(".brand-sidebar:not([data-slot=compact-main-sidebar])");
+ await expandedMain.waitFor();
+ const before = await expandedMain.boundingBox();
+ const separator = expandedMain.getByRole("separator");
+ await separator.focus();
+ const currentWidth = Number(
+ await separator.getAttribute("aria-valuenow"),
+ );
+ const minimumWidth = Number(
+ await separator.getAttribute("aria-valuemin"),
+ );
+ const maximumWidth = Number(
+ await separator.getAttribute("aria-valuemax"),
+ );
+ const grow = currentWidth <= minimumWidth;
+ await separator.press(grow ? "ArrowRight" : "ArrowLeft");
+ const after = await expandedMain.boundingBox();
+ const resizeDelta = Math.round(Math.abs(before.width - after.width));
+ assert.ok(
+ resizeDelta > 0 && resizeDelta <= 20,
+ `${route} main sidebar did not resize: ${before.width}px -> ${after.width}px (now ${currentWidth}, min ${minimumWidth}, max ${maximumWidth})`,
+ );
+ await expandedMain.getByRole("button", { name: "Close" }).click();
+ await compactMain.waitFor();
await page.waitForFunction(() => {
const elements = document.querySelectorAll(
'[data-slot="secondary-sidebar"]',
@@ -153,9 +137,10 @@ try {
.click();
await page.getByRole("link", { name: "Clone", exact: true }).click();
await page.waitForURL("**/#/clone");
+ // Clone shows its library as a context pane, so navigation stays an icon rail.
assert.equal(
await page.locator("[data-slot=compact-main-sidebar]").count(),
- 0,
+ 1,
);
await page.getByRole("tab", { name: "Saved voices", exact: true }).waitFor();
await page.setViewportSize({ width: 640, height: 900 });
diff --git a/electron/tests/sidebar-layout-smoke.mjs b/electron/tests/sidebar-layout-smoke.mjs
index b7e99a792..cce0ed16f 100644
--- a/electron/tests/sidebar-layout-smoke.mjs
+++ b/electron/tests/sidebar-layout-smoke.mjs
@@ -4,25 +4,44 @@ import { mkdtempSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
const browser = await chromium.launch({
- ...(process.env.PLAYWRIGHT_BUNDLED === '1' ? {} : { channel: process.env.PLAYWRIGHT_CHANNEL || 'msedge' }),
+ ...(process.env.PLAYWRIGHT_BUNDLED === '1'
+ ? {}
+ : { channel: process.env.PLAYWRIGHT_CHANNEL || 'msedge' }),
headless: true,
});
const page = await browser.newPage();
const out = mkdtempSync(join(tmpdir(), 'voicestudio-sidebar-'));
const ui = process.env.VOICESTUDIO_UI_URL || 'http://localhost:3912';
try {
- await page.addInitScript(() => localStorage.setItem('voicestudio.setup.complete.v1', '1'));
+ await page.addInitScript(() => {
+ localStorage.setItem('voicestudio.setup.complete.v1', '1');
+ // The expanded navigation is under test, so keep it open beside the library.
+ const saved = JSON.parse(localStorage.getItem('voicestudio.workspace-layout') || '{}');
+ localStorage.setItem(
+ 'voicestudio.workspace-layout',
+ JSON.stringify({ ...saved, autoCollapseSidebar: false }),
+ );
+ });
await page.goto(ui + '/#/clone');
const sidebar = page.locator('aside').first();
const chooseView = async (name) => {
- await sidebar
- .getByRole('radiogroup', { name: 'Tool settings', exact: true })
- .getByRole('radio', { name, exact: true })
- .click();
+ // The view switch lives in the popover that the speed/quality label opens.
+ const group = page.getByRole('radiogroup', { name: 'Tool settings', exact: true });
+ if (!(await group.isVisible())) {
+ await sidebar.locator('[data-slot=performance-trigger]').click();
+ await group.waitFor();
+ }
+ await group.getByRole('radio', { name, exact: true }).click();
+ const popup = page.locator('[data-slot=popover-content]');
+ if (await popup.count()) {
+ await page.keyboard.press('Escape');
+ await popup.waitFor({ state: 'hidden' });
+ }
};
const navigation = sidebar.getByRole('navigation', { name: 'Workspaces', exact: true });
await navigation.waitFor();
await sidebar.getByRole('slider', { name: 'Speed / quality', exact: true }).waitFor();
+ // Simple keeps engine links out of the sidebar; they open from the slider's popover.
assert.equal(await sidebar.locator('footer a:visible').count(), 0);
assert.equal(await sidebar.locator('[data-slot=engine-row]').count(), 0);
await chooseView('Models');
@@ -95,18 +114,22 @@ try {
await page.setViewportSize({ width, height: 720 });
await page.goto(ui + '/#/personas');
const compactMain = page.locator('[data-slot=compact-main-sidebar]');
- await compactMain.waitFor();
- assert.equal(Math.round((await compactMain.boundingBox()).width), 48);
- const openMain = compactMain.getByRole('button', { name: 'Toggle Sidebar' });
- assert.equal(await openMain.locator('img').count(), 1);
+ await page.getByRole('heading', { name: 'Saved voices', exact: true }).waitFor();
assert.equal(await page.getByRole('heading', { name: 'Saved voices', exact: true }).count(), 1);
if (width === 1920) {
- await openMain.click();
- await compactMain.waitFor({ state: 'detached' });
- const expandedMain = page.locator('.brand-sidebar').filter({ hasText: 'Saved voices' });
- await expandedMain.waitFor();
- await expandedMain.getByRole('button', { name: 'Close' }).click();
+ // A wide window keeps the slim navigation column; the library belongs to the page.
+ const slim = page.locator('.brand-sidebar').first();
+ await slim.waitFor();
+ assert.equal(await compactMain.count(), 0);
+ const slimWidth = (await slim.boundingBox()).width;
+ assert.ok(slimWidth >= 196 && slimWidth <= 288, `Slim navigation width ${slimWidth}`);
+ await slim.getByRole('button', { name: 'Close' }).click();
await compactMain.waitFor();
+ } else {
+ await compactMain.waitFor();
+ assert.equal(Math.round((await compactMain.boundingBox()).width), 48);
+ const openMain = compactMain.getByRole('button', { name: 'Toggle Sidebar' });
+ assert.equal(await openMain.locator('img').count(), 1);
}
}
const macStartupPage = await browser.newPage();
@@ -162,6 +185,10 @@ try {
try {
await macPage.addInitScript(() => {
localStorage.setItem('voicestudio.setup.complete.v1', '1');
+ localStorage.setItem(
+ 'voicestudio.workspace-layout',
+ JSON.stringify({ autoCollapseSidebar: false }),
+ );
Object.defineProperty(window, 'voicestudio', {
value: {
app: {
@@ -211,7 +238,8 @@ try {
await macPage.keyboard.press('Escape');
const brandLink = macSidebar.getByRole('link', { name: /^VoiceStudio v\S+/ });
const brandBounds = await brandLink.boundingBox();
- assert.ok(brandBounds && brandBounds.x >= 96, 'macOS brand must clear the traffic lights');
+ // The traffic lights have their own row above the brand.
+ assert.ok(brandBounds && brandBounds.y >= 28, 'macOS brand must sit below the traffic lights');
assert.ok(
await brandLink
.getByText('VoiceStudio', { exact: true })
diff --git a/electron/tests/sidebar-preset-smoke.mjs b/electron/tests/sidebar-preset-smoke.mjs
index e1956f880..34578b5a3 100644
--- a/electron/tests/sidebar-preset-smoke.mjs
+++ b/electron/tests/sidebar-preset-smoke.mjs
@@ -3,7 +3,9 @@ import { chromium } from 'playwright';
import { expect } from 'playwright/test';
const browser = await chromium.launch({
- ...(process.env.PLAYWRIGHT_BUNDLED === '1' ? {} : { channel: process.env.PLAYWRIGHT_CHANNEL || 'msedge' }),
+ ...(process.env.PLAYWRIGHT_BUNDLED === '1'
+ ? {}
+ : { channel: process.env.PLAYWRIGHT_CHANNEL || 'msedge' }),
headless: true,
});
const page = await browser.newPage({ viewport: { width: 1280, height: 1000 } });
@@ -13,6 +15,10 @@ let currentTier = 'fast';
let fail = false;
let releaseSave;
let releaseEngines;
+let releaseAutoSave;
+const autoSaveGate = new Promise((resolve) => {
+ releaseAutoSave = resolve;
+});
const saveGate = new Promise((resolve) => {
releaseSave = resolve;
});
@@ -66,7 +72,14 @@ const profile = () => ({
},
});
try {
- await page.addInitScript(() => localStorage.setItem('voicestudio.setup.complete.v1', '1'));
+ await page.addInitScript(() => {
+ localStorage.setItem('voicestudio.setup.complete.v1', '1');
+ // These checks inspect the expanded navigation, so keep it open beside the library.
+ localStorage.setItem(
+ 'voicestudio.workspace-layout',
+ JSON.stringify({ autoCollapseSidebar: false }),
+ );
+ });
await page.route('**/api/**', async (route) => {
const request = route.request();
const path = new URL(request.url()).pathname;
@@ -74,7 +87,8 @@ try {
if (request.method() === 'PUT') {
writes.push(request.postDataJSON());
if (fail) return route.fulfill({ status: 409, json: { detail: 'Test: engine busy' } });
- await saveGate;
+ if (request.postDataJSON().tier === 'auto') await autoSaveGate;
+ else await saveGate;
changed = true;
currentTier = request.postDataJSON().tier;
}
@@ -177,19 +191,19 @@ try {
await slider.focus();
await page.keyboard.press('ArrowLeft');
await footer.getByRole('alert').waitFor();
- assert.equal(
- await checkedTier(),
- 'Balanced',
- 'A rejected save restores the confirmed preset',
- );
+ assert.equal(await checkedTier(), 'Balanced', 'A rejected save restores the confirmed preset');
assert.ok(
(await asr.innerText()).includes('medium'),
'A rejected save preserves the confirmed model',
);
fail = false;
await footer.getByRole('button', { name: 'Auto', exact: true }).click();
+ await expect(slider).toBeDisabled();
+ await expect(slider).toHaveAttribute('aria-valuetext', 'Balanced');
+ releaseAutoSave();
await footer.getByRole('button', { name: 'Auto', exact: true, pressed: true }).waitFor();
await expect(slider).toBeEnabled();
+ await expect(slider).toHaveAttribute('aria-valuetext', 'Quality');
// The popover opened with the tier change and polled live usage; start counting afresh once closed.
await page.keyboard.press('Escape');
await popup.waitFor({ state: 'hidden' });
@@ -212,6 +226,7 @@ try {
assert.equal(await hardwareSpecs.isVisible(), false, 'Details collapse with the keyboard');
await details.blur();
await page.getByText('Memory limit', { exact: true }).first().waitFor();
+ // The engines now sit in the same popover as the hardware fit.
await popup.getByText('OmniVoice', { exact: true }).waitFor();
await popup.getByText('Parakeet TDT v3', { exact: true }).waitFor();
assert.deepEqual(writes.at(-1), { tier: 'auto', family: null });
@@ -240,6 +255,7 @@ try {
'Speed/quality tiers: confirmed model feedback, loading, rollback, Auto selection and hardware explanation passed; all writes mocked.',
);
} finally {
+ releaseAutoSave();
releaseSave();
releaseEngines();
await browser.close();
diff --git a/electron/tests/sidebar-tools-smoke.mjs b/electron/tests/sidebar-tools-smoke.mjs
index 616a0cdee..0bb6bcd4d 100644
--- a/electron/tests/sidebar-tools-smoke.mjs
+++ b/electron/tests/sidebar-tools-smoke.mjs
@@ -21,6 +21,11 @@ try {
({ platform, locale }) => {
localStorage.setItem('voicestudio.setup.complete.v1', '1');
localStorage.setItem('voicestudio.locale', locale);
+ // The expanded navigation is under test, so keep it open beside the library.
+ localStorage.setItem(
+ 'voicestudio.workspace-layout',
+ JSON.stringify({ autoCollapseSidebar: false }),
+ );
window.voicestudio = {
app: {
version: 'test',
@@ -53,17 +58,27 @@ try {
);
await page.goto(ui + '/#/clone');
const sidebar = page.locator('aside').first();
- await sidebar.locator('[data-slot=engine-view-toggle]').waitFor();
+ const footer = sidebar.locator('footer');
+ await footer.getByRole('slider', { name: strings.performanceProfile.title, exact: true }).waitFor();
+ // The three-way view switch lives in the popover that the speed/quality label opens.
const chooseView = async (level) => {
- await sidebar
- .getByRole('radiogroup', { name: strings.sidebarTools.title, exact: true })
+ const group = page.getByRole('radiogroup', { name: strings.sidebarTools.title, exact: true });
+ if (!(await group.isVisible())) {
+ await footer.locator('[data-slot=performance-trigger]').click();
+ await group.waitFor();
+ }
+ await group
.getByRole('radio', {
name: level === 'models' ? strings.modelSettings.models : strings.sidebarTools[level],
exact: true,
})
.click();
+ const popup = page.locator('[data-slot=popover-content]');
+ if (await popup.count()) {
+ await page.keyboard.press('Escape');
+ await popup.waitFor({ state: 'hidden' });
+ }
};
- const footer = sidebar.locator('footer');
assert.equal(
await footer.locator('[data-slot=engine-row]').count(),
0,
@@ -120,21 +135,16 @@ try {
bounds && bounds.y >= 0 && bounds.y + bounds.height <= 600,
`${platform}/${locale}: Settings must remain on-screen`,
);
- // A taller engine footer must leave a usable voice library, even when
- // navigation needs to scroll. Check its real visible bounds.
- const preview = sidebar
+ // The library lives in its own column now, so a tall engine footer can no
+ // longer squeeze it; it must stay usable beside the slim navigation.
+ const preview = page
+ .locator('[data-slot=secondary-sidebar]')
.getByRole('button', { name: strings.clone.preview_voice, exact: true })
.first();
await preview.scrollIntoViewIfNeeded();
- const previewBounds = await preview.boundingBox();
- const tabBounds = await sidebar
- .getByRole('tab', { name: strings.clone.saved_profiles, exact: true })
- .boundingBox();
- const footerBounds = await footer.boundingBox();
assert.ok(
- previewBounds.y >= tabBounds.y + tabBounds.height &&
- previewBounds.y + previewBounds.height <= footerBounds.y,
- `${platform}/${locale}/${level}: Voice preview must fit between tabs and engines`,
+ await preview.isVisible(),
+ `${platform}/${locale}/${level}: Voice preview must stay usable in the library column`,
);
assert.ok(
await footer.evaluate((el) => el.scrollWidth <= el.clientWidth),
diff --git a/electron/tests/workspace-shell-smoke.mjs b/electron/tests/workspace-shell-smoke.mjs
index ea42bdad7..6a082a7b1 100644
--- a/electron/tests/workspace-shell-smoke.mjs
+++ b/electron/tests/workspace-shell-smoke.mjs
@@ -51,17 +51,23 @@ try {
await nav.getByRole('button', { name: 'Voice', exact: true }).click();
await page.getByRole('link', { name: 'Clone', exact: true }).click();
await page.waitForURL('**/#/clone');
+ // Clone brings its library as a context pane, so navigation stays a rail beside it.
+ await page.getByRole('tab', { name: 'Saved voices', exact: true }).waitFor();
+ assert.equal(await compactSidebar.count(), 1);
+ // One click on the rail's toggle opens the full navigation.
+ await compactSidebar.getByRole('button', { name: 'Toggle Sidebar' }).click();
await compactSidebar.waitFor({ state: 'detached' });
- const expandedSidebar = page.locator('.brand-sidebar').filter({ hasText: 'Saved voices' });
+ const expandedSidebar = page.locator('.brand-sidebar:not([data-slot=compact-main-sidebar])');
await expandedSidebar.waitFor();
- assert.ok((await expandedSidebar.boundingBox()).width >= 220);
+ const expandedWidth = (await expandedSidebar.boundingBox()).width;
+ assert.ok(expandedWidth >= 196 && expandedWidth <= 288, `Expanded navigation width ${expandedWidth}`);
assert.equal(
await expandedSidebar.getByRole('navigation', { name: 'Workspaces', exact: true }).count(),
1,
);
assert.deepEqual(errors, [], `Workspace routes emitted renderer errors:\n${errors.join('\n')}`);
console.log(
- 'Shared compact rail stays mounted across all nine secondary workspaces and Clone restores the full library.',
+ 'Shared compact rail stays mounted across all nine secondary workspaces; Clone keeps it beside the library and one click opens the full navigation.',
);
} finally {
await browser.close();