Skip to content

A full-featured download manager.

refactor(ui): unify toolbars, notifications, and scrolling (#2153)

Dr_rOot8713a48e1e86
diff --git a/docs/screenshots/panel-toolbar-dark-compact.png b/docs/screenshots/panel-toolbar-dark-compact.png
new file mode 100644
index 00000000..b485df1f
Binary files /dev/null and b/docs/screenshots/panel-toolbar-dark-compact.png differ
diff --git a/docs/screenshots/panel-toolbar-light.png b/docs/screenshots/panel-toolbar-light.png
new file mode 100644
index 00000000..9ce15084
Binary files /dev/null and b/docs/screenshots/panel-toolbar-light.png differ
diff --git a/e2e/downloads-toolbar-glass.spec.ts b/e2e/downloads-toolbar-glass.spec.ts
index 569e8e26..3763b8b8 100644
--- a/e2e/downloads-toolbar-glass.spec.ts
+++ b/e2e/downloads-toolbar-glass.spec.ts
@@ -80,7 +80,11 @@ test('toolbar glass follows the saved switch and preserves dragging, search, siz
path: testInfo.outputPath('rim-refraction.png'),
})
await glassSearch.evaluate((element) => {
- element.style.backdropFilter = 'blur(2px) saturate(1.08)'
+ // Isolate refraction while retaining the material's current frost.
+ element.style.backdropFilter = element.style.backdropFilter.replace(
+ /url\([^)]+\)\s*/,
+ ''
+ )
})
const frosted = await search.screenshot({
path: testInfo.outputPath('rim-frost.png'),
@@ -106,7 +110,8 @@ test('toolbar glass follows the saved switch and preserves dragging, search, siz
for (let x = 70; x < 150; x++) {
for (let y = 2; y < a.height - 2; y++) {
const index = (y * a.width + x) * 4
- if (Math.abs(a.data[index] - b.data[index]) <= 5) continue
+ // The denser material intentionally keeps the rim low contrast.
+ if (Math.abs(a.data[index] - b.data[index]) <= 1) continue
if (y < 7 || y >= a.height - 7) rim++
else if (y >= 12 && y < a.height - 12) center++
}
diff --git a/e2e/panel-toolbars.spec.ts b/e2e/panel-toolbars.spec.ts
new file mode 100644
index 00000000..290958b2
--- /dev/null
+++ b/e2e/panel-toolbars.spec.ts
@@ -0,0 +1,105 @@
+import { writeFile } from 'node:fs/promises'
+import path from 'node:path'
+import { CURRENT_SETTINGS_VERSION } from '../src/core/settings/migrations'
+import {
+ expect,
+ launchMotrix,
+ test,
+ waitForEngineReady,
+} from './fixtures/electron-app'
+import {
+ setTaskInspectorContentSize,
+ updateTaskInspectorAppearance,
+} from './fixtures/task-inspector-activity'
+
+test('Trackers and Plugins share expandable, keyboard-accessible panel toolbars', async ({
+ userDataDir,
+ rpcPort,
+}, testInfo) => {
+ await writeFile(
+ path.join(userDataDir, 'settings.json'),
+ JSON.stringify({
+ version: CURRENT_SETTINGS_VERSION,
+ app: { liquidGlassEffect: true, theme: 'light', language: 'en-US' },
+ tracker: { autoSync: false },
+ onboarding: { disclaimerAccepted: true },
+ })
+ )
+ const app = await launchMotrix({ userDataDir, rpcPort })
+ try {
+ const page = await app.firstWindow()
+ await waitForEngineReady(page)
+ await setTaskInspectorContentSize(app, page, 1100, 780)
+ await page.getByRole('link', { name: 'Trackers', exact: true }).click()
+ const trackers = page.getByRole('toolbar', { name: 'Trackers' })
+ const trackerSearch = trackers.getByRole('button', {
+ name: 'Filter by URL…',
+ })
+ await expect(trackers.getByRole('textbox')).toHaveCount(0)
+ await trackerSearch.click()
+ const trackerInput = trackers.getByRole('textbox')
+ await expect(trackerInput).toBeFocused()
+ await trackerInput.fill('tracker.example')
+ await page.getByRole('tab', { name: /blacklist/i }).click()
+ await expect(trackerInput).toHaveValue('tracker.example')
+ await trackerInput.press('Escape')
+ await expect(trackerInput).toHaveValue('')
+ await trackerInput.press('Escape')
+ await expect(trackerSearch).toBeFocused()
+ await page.screenshot({
+ path: testInfo.outputPath('trackers-toolbar.png'),
+ animations: 'disabled',
+ })
+
+ await page.getByRole('link', { name: 'Plugins', exact: true }).click()
+ const plugins = page.getByRole('toolbar', { name: 'Plugins' })
+ await expect(plugins.locator('[data-slot="toolbar-glass"]')).toHaveCount(2)
+ await expect(
+ plugins.getByRole('button', { name: 'Add plugin' })
+ ).toBeVisible()
+ await expect(plugins.getByTestId('registry-refresh-btn')).toBeVisible()
+ const search = plugins.getByRole('button', { name: 'Find a plugin' })
+ await search.click()
+ const input = plugins.getByRole('textbox', { name: 'Find a plugin' })
+ await expect(input).toBeFocused()
+ await input.fill('example')
+ await plugins.getByRole('button', { name: 'Clear search' }).click()
+ await expect(input).toBeFocused()
+ await input.press('Escape')
+ await expect(search).toBeFocused()
+ await plugins.getByRole('button', { name: 'Add plugin' }).click()
+ await expect(page.getByRole('dialog')).toBeVisible()
+ await page.getByRole('button', { name: 'Cancel', exact: true }).click()
+ await expect(page.getByRole('dialog')).toHaveCount(0)
+ await page.screenshot({
+ path: testInfo.outputPath('plugins-toolbar-light.png'),
+ animations: 'disabled',
+ })
+ await plugins.getByRole('link', { name: 'Diagnostics' }).click()
+ await expect.poll(() => page.url()).toContain('/plugins/diagnostics')
+ await page.getByRole('link', { name: 'Plugins', exact: true }).click()
+ await page
+ .getByRole('button', { name: 'Toggle sidebar', exact: true })
+ .click()
+ await expect(plugins).toHaveAttribute('data-density', 'compact')
+ await search.click()
+ await expect(input).toBeFocused()
+ await updateTaskInspectorAppearance(page, 'dark', 'en-US')
+ // The appearance helper reloads the page; reopen the ephemeral search.
+ await search.click()
+ await expect(input).toBeFocused()
+ await page.screenshot({
+ path: testInfo.outputPath('plugins-toolbar-dark-compact.png'),
+ animations: 'disabled',
+ })
+ await page.emulateMedia({ contrast: 'more' })
+ await expect(plugins.locator('[data-slot="toolbar-glass"]')).toHaveCount(0)
+ await expect(input).toBeFocused()
+ const overflow = await page.evaluate(
+ () => document.documentElement.scrollWidth > innerWidth
+ )
+ expect(overflow).toBe(false)
+ } finally {
+ await app.close()
+ }
+})
diff --git a/src/renderer/components/desktop-kit/toolbar-glass/toolbar-glass.css b/src/renderer/components/desktop-kit/toolbar-glass/toolbar-glass.css
index 5520265d..86ea8e29 100644
--- a/src/renderer/components/desktop-kit/toolbar-glass/toolbar-glass.css
+++ b/src/renderer/components/desktop-kit/toolbar-glass/toolbar-glass.css
@@ -4,29 +4,58 @@
}
.toolbar-glass-surface:has(> .toolbar-glass) {
+ --toolbar-glass-border: rgb(0 0 0 / 9%);
+ --toolbar-glass-hover: rgb(0 0 0 / 5%);
+ --toolbar-glass-pressed: rgb(0 0 0 / 9%);
background: transparent;
}
+.dark .toolbar-glass-surface:has(> .toolbar-glass) {
+ --toolbar-glass-border: rgb(255 255 255 / 6%);
+ --toolbar-glass-hover: rgb(255 255 255 / 8%);
+ --toolbar-glass-pressed: rgb(255 255 255 / 13%);
+}
+
+/* Keep the search field's focus border above the material's quiet rim. */
+.toolbar-glass-surface:has(> .toolbar-glass):not(:has(input:focus)) {
+ border-color: var(--toolbar-glass-border);
+}
+
.toolbar-glass {
position: absolute;
inset: 0;
z-index: -1;
pointer-events: none;
border-radius: inherit;
- background: rgb(255 255 255 / 58%);
- backdrop-filter: blur(8px) saturate(1.08);
+ background: linear-gradient(
+ 180deg,
+ rgb(255 255 255 / 92%),
+ rgb(248 248 248 / 88%)
+ );
+ backdrop-filter: blur(10px) saturate(1.03);
box-shadow:
- inset 0 1px 0 rgb(255 255 255 / 80%),
- inset 0 -1px 0 rgb(90 100 115 / 8%),
- 0 2px 5px rgb(20 30 45 / 5%);
+ inset 0 1px 0 rgb(255 255 255 / 40%),
+ inset 0 -1px 0 rgb(0 0 0 / 3%),
+ 0 1px 2px rgb(0 0 0 / 2%);
}
.dark .toolbar-glass {
- background: rgb(42 44 48 / 66%);
+ background: linear-gradient(180deg, rgb(44 46 50 / 88%), rgb(34 36 40 / 86%));
box-shadow:
- inset 0 1px 0 rgb(255 255 255 / 13%),
- inset 0 -1px 0 rgb(0 0 0 / 16%),
- 0 2px 5px rgb(0 0 0 / 12%);
+ inset 0 1px 0 rgb(255 255 255 / 7%),
+ inset 0 -1px 0 rgb(0 0 0 / 10%),
+ 0 1px 3px rgb(0 0 0 / 8%);
+}
+
+.toolbar-glass-surface .toolbar-button:hover:not(:disabled) {
+ background-color: var(--toolbar-glass-hover, var(--accent));
+}
+
+.toolbar-glass-surface
+ .toolbar-button:is(:active, [aria-pressed="true"], [data-popup-open]):not(
+ :disabled
+ ) {
+ background-color: var(--toolbar-glass-pressed, var(--accent));
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more),
diff --git a/src/renderer/components/desktop-kit/toolbar-glass/toolbar-glass.tsx b/src/renderer/components/desktop-kit/toolbar-glass/toolbar-glass.tsx
index 9d5b9529..a3062ef9 100644
--- a/src/renderer/components/desktop-kit/toolbar-glass/toolbar-glass.tsx
+++ b/src/renderer/components/desktop-kit/toolbar-glass/toolbar-glass.tsx
@@ -93,7 +93,7 @@ function GlassLayer() {
aria-hidden="true"
style={
ready
- ? { backdropFilter: `url("#${id}") blur(2px) saturate(1.08)` }
+ ? { backdropFilter: `url("#${id}") blur(3px) saturate(1.03)` }
: undefined
}
>
@@ -125,7 +125,7 @@ function GlassLayer() {
<feDisplacementMap
in="SourceGraphic"
in2="rim"
- scale="8"
+ scale="4"
xChannelSelector="R"
yChannelSelector="G"
/>
diff --git a/src/renderer/components/desktop-kit/toolbar/README.md b/src/renderer/components/desktop-kit/toolbar/README.md
new file mode 100644
index 00000000..fa2cac7c
--- /dev/null
+++ b/src/renderer/components/desktop-kit/toolbar/README.md
@@ -0,0 +1,51 @@
+# Panel toolbars
+
+`Toolbar` owns the saved Liquid Glass preference, standard/compact density,
+tooltips and Base UI's roving keyboard focus. Compose it from `ToolbarGroup`,
+`ToolbarButton`, `ToolbarLink`, `ToolbarSeparator` and `ToolbarSearch`.
+Keep transport calls, route changes, filtering and action priority in the page.
+
+```tsx
+<Toolbar label={t('plugins.title')}>
+ <ToolbarGroup>
+ <ToolbarButton label={t('plugins.install.title')} onClick={openInstaller}>
+ <Plus aria-hidden="true" />
+ </ToolbarButton>
+ <ToolbarLink
+ label={t('plugins.diagnostics.title')}
+ render={<Link to="/plugins/diagnostics" />}
+ >
+ <Workflow aria-hidden="true" />
+ </ToolbarLink>
+ </ToolbarGroup>
+ <ToolbarSearch
+ value={query}
+ onValueChange={setQuery}
+ label={t('plugins.search')}
+ clearLabel={t('common.clearSearch')}
+ />
+</Toolbar>
+```
+
+- Place the toolbar in `PanelShell.actions`, with `actionsDraggable` and
+ `actionsClassName="min-w-0 flex-1"` when it should occupy the available width.
+ Groups remain non-draggable; blank space can move the window.
+- `ToolbarButton.label` supplies both an accessible name and a tooltip. When
+ composing a menu/popover that already owns its tooltip, pass `aria-label`
+ instead. Button refs and Base UI `render` composition are supported.
+- Use `ToolbarLink` for navigation so link semantics and modifier clicks survive.
+- `ToolbarSearch` expands and focuses on activation. Escape clears text, then
+ collapses an empty field and returns focus. Empty fields collapse on blur;
+ populated fields remain visible. `width` is a preferred width that may shrink.
+- Optional `expanded` / `onExpandedChange` let a feature coordinate its responsive
+ layout. `keepExpanded` preserves active filters or an open popup. `leading`
+ receives an anchor ref and `collapseIfIdle` for portaled filter controls;
+ `onEmptyEscape` can return focus to that filter trigger. See Downloads.
+- Material overrides belong on `Toolbar.glassEnabled`, primarily for isolated
+ previews. By default all groups follow the saved setting and accessibility
+ preferences together. No page should reproduce material CSS.
+
+Toolbar arrow keys move between controls, skipping disabled actions. Search
+inputs retain their editing keys. Dynamic overflow priorities stay with the
+feature: Downloads can move lower-priority commands into its existing menu,
+while smaller toolbars can keep their actions visible as search shrinks.
diff --git a/src/renderer/components/desktop-kit/toolbar/toolbar-button.tsx b/src/renderer/components/desktop-kit/toolbar/toolbar-button.tsx
new file mode 100644
index 00000000..ef23d949
--- /dev/null
+++ b/src/renderer/components/desktop-kit/toolbar/toolbar-button.tsx
@@ -0,0 +1,68 @@
+import { Toolbar as ToolbarPrimitive } from '@base-ui/react/toolbar'
+import { buttonVariants } from '@renderer/components/ui/button'
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from '@renderer/components/ui/tooltip'
+import { cn } from '@renderer/lib/utils'
+import type { ComponentProps, ReactElement } from 'react'
+
+const controlClassName = cn(
+ buttonVariants({ variant: 'ghost', size: 'icon' }),
+ 'app-no-drag toolbar-button relative size-[30px] compact-header:size-6 rounded-full text-foreground bg-transparent transition-colors duration-150 active:duration-0 motion-reduce:transition-none hover:bg-accent active:bg-accent [&>svg]:size-[18px] compact-header:[&>svg]:size-4 [&>svg]:opacity-90 focus-visible:ring-1 focus-visible:ring-[#7388a3] dark:focus-visible:ring-[#97aac4] aria-pressed:bg-accent data-popup-open:bg-accent'
+)
+
+function withTooltip(control: ReactElement, label?: string) {
+ return label ? (
+ <Tooltip>
+ <TooltipTrigger delay={400} render={control} />
+ <TooltipContent side="bottom" sideOffset={8}>
+ {label}
+ </TooltipContent>
+ </Tooltip>
+ ) : (
+ control
+ )
+}
+
+/** `label` supplies the accessible name and tooltip; render composes menu triggers. */
+export function ToolbarButton({
+ label,
+ className,
+ ...props
+}: Omit<ComponentProps<typeof ToolbarPrimitive.Button>, 'className'> & {
+ label?: string
+ className?: string
+}) {
+ return withTooltip(
+ <ToolbarPrimitive.Button
+ data-slot="toolbar-button"
+ focusableWhenDisabled={false}
+ aria-label={label}
+ {...props}
+ className={cn(controlClassName, className)}
+ />,
+ label
+ )
+}
+
+/** Real link semantics, with the same visuals and toolbar keyboard navigation. */
+export function ToolbarLink({
+ label,
+ className,
+ ...props
+}: Omit<ComponentProps<typeof ToolbarPrimitive.Link>, 'className'> & {
+ label: string
+ className?: string
+}) {
+ return withTooltip(
+ <ToolbarPrimitive.Link
+ data-slot="toolbar-button"
+ aria-label={label}
+ {...props}
+ className={cn(controlClassName, className)}
+ />,
+ label
+ )
+}
diff --git a/src/renderer/components/desktop-kit/toolbar/toolbar-group.tsx b/src/renderer/components/desktop-kit/toolbar/toolbar-group.tsx
new file mode 100644
index 00000000..42991586
--- /dev/null
+++ b/src/renderer/components/desktop-kit/toolbar/toolbar-group.tsx
@@ -0,0 +1,25 @@
+import { cn } from '@renderer/lib/utils'
+import type { ComponentProps } from 'react'
+import { ToolbarGlass } from '../toolbar-glass/toolbar-glass'
+import { useToolbarMaterial } from './toolbar'
+
+/** Shared capsule geometry for panel actions in both header densities. */
+export function ToolbarGroup({
+ children,
+ className,
+ ...props
+}: ComponentProps<'div'>) {
+ const { glassEnabled } = useToolbarMaterial()
+ return (
+ <div
+ {...props}
+ className={cn(
+ 'app-no-drag toolbar-glass-surface flex h-9 shrink-0 items-center gap-1 rounded-full border border-border/70 bg-background/70 p-0.5 compact-header:h-[30px]',
+ className
+ )}
+ >
+ <ToolbarGlass enabled={glassEnabled} />
+ {children}
+ </div>
+ )
+}
diff --git a/src/renderer/components/desktop-kit/toolbar/toolbar-search.tsx b/src/renderer/components/desktop-kit/toolbar/toolbar-search.tsx
new file mode 100644
index 00000000..56cf1719
--- /dev/null
+++ b/src/renderer/components/desktop-kit/toolbar/toolbar-search.tsx
@@ -0,0 +1,176 @@
+import { Toolbar as ToolbarPrimitive } from '@base-ui/react/toolbar'
+import { cn } from '@renderer/lib/utils'
+import { CircleX, Search } from 'lucide-react'
+import {
+ type ReactNode,
+ type RefObject,
+ useEffect,
+ useId,
+ useLayoutEffect,
+ useRef,
+ useState,
+} from 'react'
+import { useCompactHeader } from '../hooks/use-compact-header'
+import { ToolbarButton } from './toolbar-button'
+import { ToolbarGroup } from './toolbar-group'
+
+export interface ToolbarSearchAccessory {
+ anchorRef: RefObject<HTMLDivElement | null>
+ collapseIfIdle: () => void
+}
+
+export interface ToolbarSearchProps {
+ value: string
+ onValueChange: (value: string) => void
+ label: string
+ clearLabel: string
+ placeholder?: string
+ expanded?: boolean
+ onExpandedChange?: (expanded: boolean) => void
+ /** Keep filters or a portaled popup visible even when the query is empty. */
+ keepExpanded?: boolean
+ onEmptyEscape?: () => void
+ leading?: (accessory: ToolbarSearchAccessory) => ReactNode
+ width?: number
+ 'data-slot'?: string
+ 'data-filter-active'?: boolean
+}
+
+/** Shared disclosure, focus, clear and Escape behavior for panel searches. */
+export function ToolbarSearch({
+ value,
+ onValueChange,
+ label,
+ clearLabel,
+ placeholder = label,
+ expanded: controlledExpanded,
+ onExpandedChange,
+ keepExpanded = false,
+ onEmptyEscape,
+ leading,
+ width = 230,
+ ...props
+}: ToolbarSearchProps) {
+ const compact = useCompactHeader()
+ const [requested, setRequested] = useState(false)
+ const expanded =
+ (controlledExpanded ?? requested) || Boolean(value.trim()) || keepExpanded
+ const rootRef = useRef<HTMLDivElement>(null)
+ const inputRef = useRef<HTMLInputElement>(null)
+ const triggerRef = useRef<HTMLButtonElement>(null)
+ const focusOnExpand = useRef(false)
+ const returnFocus = useRef(false)
+ const blurFrame = useRef<number | null>(null)
+ const inputId = useId()
+ const latest = useRef({ value, keepExpanded })
+ latest.current = { value, keepExpanded }
+ const requestExpanded = (next: boolean) => {
+ setRequested(next)
+ onExpandedChange?.(next)
+ }
+ const collapseIfIdle = () => {
+ if (blurFrame.current !== null) cancelAnimationFrame(blurFrame.current)
+ blurFrame.current = requestAnimationFrame(() => {
+ if (
+ !latest.current.value.trim() &&
+ !latest.current.keepExpanded &&
+ !rootRef.current?.contains(document.activeElement)
+ )
+ requestExpanded(false)
+ })
+ }
+ useEffect(
+ () => () => {
+ if (blurFrame.current !== null) cancelAnimationFrame(blurFrame.current)
+ },
+ []
+ )
+ useLayoutEffect(() => {
+ if (expanded && focusOnExpand.current) {
+ inputRef.current?.focus()
+ focusOnExpand.current = false
+ } else if (!expanded && returnFocus.current) {
+ triggerRef.current?.focus()
+ returnFocus.current = false
+ }
+ }, [expanded])
+
+ return (
+ <ToolbarGroup
+ ref={rootRef}
+ data-slot="toolbar-search"
+ data-expanded={expanded}
+ {...props}
+ onBlurCapture={(event) => {
+ if (rootRef.current?.contains(event.target)) collapseIfIdle()
+ }}
+ className={cn(
+ 'gap-0 transition-[width] duration-150 ease-out motion-reduce:transition-none',
+ expanded &&
+ 'min-w-20 shrink has-[input:focus]:border-[#7388a3] dark:has-[input:focus]:border-[#97aac4]'
+ )}
+ style={{ width: expanded ? width : compact ? 30 : 36 }}
+ >
+ {expanded ? (
+ <>
+ {leading ? (
+ leading({ anchorRef: rootRef, collapseIfIdle })
+ ) : (
+ <Search
+ aria-hidden="true"
+ className="mx-2 size-4 shrink-0 text-muted-foreground"
+ />
+ )}
+ <ToolbarPrimitive.Input
+ ref={inputRef}
+ id={inputId}
+ type="text"
+ inputMode="search"
+ aria-label={label}
+ placeholder={placeholder}
+ autoComplete="off"
+ spellCheck={false}
+ value={value}
+ onFocus={() => requestExpanded(true)}
+ onChange={(event) => onValueChange(event.target.value)}
+ onKeyDown={(event) => {
+ if (event.key !== 'Escape' || event.nativeEvent.isComposing)
+ return
+ event.preventDefault()
+ event.stopPropagation()
+ if (value) onValueChange('')
+ else if (!keepExpanded) {
+ returnFocus.current = true
+ requestExpanded(false)
+ } else onEmptyEscape?.()
+ }}
+ className="h-[30px] w-full min-w-0 border-0 bg-transparent px-1 text-[13px] outline-none placeholder:text-muted-foreground compact-header:h-6 compact-header:text-xs"
+ />
+ {value.length > 0 && (
+ <ToolbarButton
+ label={clearLabel}
+ onClick={() => {
+ onValueChange('')
+ inputRef.current?.focus()
+ }}
+ >
+ <CircleX aria-hidden="true" />
+ </ToolbarButton>
+ )}
+ </>
+ ) : (
+ <ToolbarButton
+ ref={triggerRef}
+ label={label}
+ aria-expanded={false}
+ onClick={() => {
+ focusOnExpand.current = true
+ requestExpanded(true)
+ }}
+ >
+ <Search aria-hidden="true" />
+ </ToolbarButton>
+ )}
+ </ToolbarGroup>
+ )
+}
diff --git a/src/renderer/components/desktop-kit/toolbar/toolbar.test.tsx b/src/renderer/components/desktop-kit/toolbar/toolbar.test.tsx
new file mode 100644
index 00000000..972000ad
--- /dev/null
+++ b/src/renderer/components/desktop-kit/toolbar/toolbar.test.tsx
@@ -0,0 +1,100 @@
+import '@testing-library/jest-dom/vitest'
+import { fireEvent, render, screen, waitFor } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
+import { useState } from 'react'
+import { describe, expect, it, vi } from 'vitest'
+import { Toolbar } from './toolbar'
+import { ToolbarButton, ToolbarLink } from './toolbar-button'
+import { ToolbarGroup } from './toolbar-group'
+import { ToolbarSearch } from './toolbar-search'
+
+vi.mock('@renderer/hooks/use-liquid-glass', () => ({
+ useLiquidGlass: () => false,
+}))
+
+function SearchExample({ initialValue = '', keepExpanded = false }) {
+ const [value, setValue] = useState(initialValue)
+ return (
+ <>
+ <Toolbar label="Files">
+ <ToolbarGroup>
+ <ToolbarButton label="Add">+</ToolbarButton>
+ <ToolbarButton label="Unavailable" disabled>
+ −
+ </ToolbarButton>
+ <ToolbarLink label="Details" href="#details">
+ i
+ </ToolbarLink>
+ </ToolbarGroup>
+ <ToolbarSearch
+ value={value}
+ onValueChange={setValue}
+ label="Search files"
+ clearLabel="Clear search"
+ keepExpanded={keepExpanded}
+ />
+ </Toolbar>
+ <button type="button">Outside</button>
+ </>
+ )
+}
+
+describe('Toolbar', () => {
+ it('moves focus across buttons and links with arrows, skipping disabled controls', async () => {
+ const user = userEvent.setup()
+ render(<SearchExample />)
+ await user.tab()
+ expect(screen.getByRole('button', { name: 'Add' })).toHaveFocus()
+ await user.keyboard('{ArrowRight}')
+ expect(screen.getByRole('link', { name: 'Details' })).toHaveFocus()
+ await user.keyboard('{ArrowRight}')
+ expect(screen.getByRole('button', { name: 'Search files' })).toHaveFocus()
+ await user.keyboard('{Enter}')
+ const input = screen.getByRole('textbox', { name: 'Search files' })
+ expect(input).toHaveFocus()
+ await user.type(input, 'abc')
+ await user.keyboard('{ArrowLeft}')
+ expect(input).toHaveFocus()
+ expect((input as HTMLInputElement).selectionStart).toBe(2)
+ })
+
+ it('keeps a query expanded outside, then clears and collapses with Escape', async () => {
+ const user = userEvent.setup()
+ render(<SearchExample />)
+ await user.click(screen.getByRole('button', { name: 'Search files' }))
+ const input = screen.getByRole('textbox')
+ await user.type(input, 'archive')
+ await user.click(screen.getByRole('button', { name: 'Outside' }))
+ expect(input).toBeVisible()
+ await user.click(input)
+ await user.keyboard('{Escape}')
+ expect(input).toHaveValue('')
+ expect(input).toHaveFocus()
+ await user.keyboard('{Escape}')
+ expect(screen.queryByRole('textbox')).toBeNull()
+ expect(screen.getByRole('button', { name: 'Search files' })).toHaveFocus()
+ })
+
+ it('collapses an empty search on blur and restores focus after clearing', async () => {
+ const user = userEvent.setup()
+ render(<SearchExample initialValue="archive" />)
+ await user.click(screen.getByRole('button', { name: 'Clear search' }))
+ expect(screen.getByRole('textbox')).toHaveFocus()
+ expect(screen.getByRole('textbox')).toHaveValue('')
+ await user.click(screen.getByRole('button', { name: 'Outside' }))
+ await waitFor(() => expect(screen.queryByRole('textbox')).toBeNull())
+ })
+
+ it('keeps active filters visible and ignores Escape while composing', async () => {
+ const user = userEvent.setup()
+ render(<SearchExample initialValue="archive" keepExpanded />)
+ const input = screen.getByRole('textbox')
+ fireEvent.keyDown(input, { key: 'Escape', isComposing: true })
+ expect(input).toHaveValue('archive')
+ await user.click(input)
+ await user.keyboard('{Escape}{Escape}')
+ await user.click(screen.getByRole('button', { name: 'Outside' }))
+ expect(input).toBeVisible()
+ expect(input).toHaveValue('')
+ })
+})
diff --git a/src/renderer/components/desktop-kit/toolbar/toolbar.tsx b/src/renderer/components/desktop-kit/toolbar/toolbar.tsx
new file mode 100644
index 00000000..0216e558
--- /dev/null
+++ b/src/renderer/components/desktop-kit/toolbar/toolbar.tsx
@@ -0,0 +1,53 @@
+import { Toolbar as ToolbarPrimitive } from '@base-ui/react/toolbar'
+import { TooltipProvider } from '@renderer/components/ui/tooltip'
+import { useLiquidGlass } from '@renderer/hooks/use-liquid-glass'
+import { cn } from '@renderer/lib/utils'
+import { type ComponentProps, createContext, useContext } from 'react'
+import { useCompactHeader } from '../hooks/use-compact-header'
+
+const ToolbarContext = createContext({ glassEnabled: false })
+
+export const useToolbarMaterial = () => useContext(ToolbarContext)
+
+/** Owns material, density and arrow-key navigation; pages own their actions. */
+export function Toolbar({
+ label,
+ glassEnabled,
+ className,
+ children,
+ ...props
+}: Omit<ComponentProps<typeof ToolbarPrimitive.Root>, 'className'> & {
+ label: string
+ glassEnabled?: boolean
+ className?: string
+}) {
+ const savedGlassEnabled = useLiquidGlass()
+ const compact = useCompactHeader()
+ return (
+ <ToolbarContext.Provider
+ value={{ glassEnabled: glassEnabled ?? savedGlassEnabled }}
+ >
+ <TooltipProvider>
+ <ToolbarPrimitive.Root
+ data-slot="toolbar"
+ data-density={compact ? 'compact' : 'standard'}
+ aria-label={label}
+ className={cn(
+ 'flex min-w-0 flex-1 items-center justify-end gap-2',
+ className
+ )}
+ {...props}
+ >
+ {children}
+ </ToolbarPrimitive.Root>
+ </TooltipProvider>
+ </ToolbarContext.Provider>
+ )
+}
+
+/** Optional boundary between related controls within one capsule. */
+export function ToolbarSeparator() {
+ return (
+ <ToolbarPrimitive.Separator className="mx-1 h-4 w-px shrink-0 bg-foreground/15" />
+ )
+}
diff --git a/src/renderer/components/notification-center/notifications-nav-item.tsx b/src/renderer/components/notification-center/notifications-nav-item.tsx
index a00fab02..368bcde4 100644
--- a/src/renderer/components/notification-center/notifications-nav-item.tsx
+++ b/src/renderer/components/notification-center/notifications-nav-item.tsx
@@ -50,14 +50,14 @@ export function NotificationsNavItem() {
aria-label={t('notification.center.unreadBadgeAria', {
count: unreadCount,
})}
- className="ml-auto flex h-4 min-w-4 items-center justify-center rounded-full bg-destructive px-1 text-[10px] font-medium leading-none text-white tabular-nums group-data-[collapsible=icon]:hidden"
+ className="ml-auto flex h-[18px] min-w-[18px] shrink-0 items-center justify-center rounded-full bg-[#007aff] px-1 text-[11px] font-semibold leading-none text-white proportional-nums group-data-[collapsible=icon]:hidden"
>
{badgeLabel}
</span>
<span
data-testid="notification-badge-dot"
aria-hidden="true"
- className="absolute top-1 right-1 hidden size-1.5 rounded-full bg-destructive group-data-[collapsible=icon]:block"
+ className="absolute top-1 right-1 hidden size-1.5 rounded-full bg-[#007aff] group-data-[collapsible=icon]:block"
/>
</>
)}
diff --git a/src/renderer/components/onboarding/disclaimer-step.test.tsx b/src/renderer/components/onboarding/disclaimer-step.test.tsx
index 01e9af45..c2367f8c 100644
--- a/src/renderer/components/onboarding/disclaimer-step.test.tsx
+++ b/src/renderer/components/onboarding/disclaimer-step.test.tsx
@@ -1,3 +1,4 @@
+import '@test-utils/dom-animations'
import '@renderer/lib/i18n'
import '@testing-library/jest-dom/vitest'
import { i18n } from '@renderer/lib/i18n'
diff --git a/src/renderer/components/onboarding/disclaimer-step.tsx b/src/renderer/components/onboarding/disclaimer-step.tsx
index 9d401921..9cc3171b 100644
--- a/src/renderer/components/onboarding/disclaimer-step.tsx
+++ b/src/renderer/components/onboarding/disclaimer-step.tsx
@@ -1,5 +1,11 @@
import { BlurHighlight } from '@renderer/components/ui/blur-highlight'
import { Button } from '@renderer/components/ui/button'
+import {
+ ScrollArea,
+ ScrollAreaContent,
+ ScrollAreaViewport,
+ ScrollBar,
+} from '@renderer/components/ui/scroll-area'
import { isCjkLocale } from '@renderer/lib/locale-script'
import { transport } from '@renderer/lib/transport'
import { cn } from '@renderer/lib/utils'
@@ -32,61 +38,68 @@ export function DisclaimerStep() {
return (
<main className="flex min-h-0 flex-1 flex-col px-5 pt-4 pb-5 text-[#1d1d1f] dark:text-foreground">
- <section
+ <ScrollArea
+ render={<section />}
+ role="region"
data-testid="disclaimer-panel"
aria-labelledby="disclaimer-title"
- className="min-h-0 flex-1 overflow-y-auto rounded-xl border border-black/14 bg-white px-6 py-6 shadow-[0_1px_2px_rgba(0,0,0,0.02)] dark:border-border dark:bg-card dark:text-card-foreground"
+ className="min-h-0 flex-1 flex min-w-0 flex-col rounded-xl border border-black/14 bg-white shadow-[0_1px_2px_rgba(0,0,0,0.02)] dark:border-border dark:bg-card dark:text-card-foreground"
>
- <div className="space-y-4">
- <h1
- id="disclaimer-title"
- className="text-[24px] leading-8 font-semibold tracking-[-0.02em]"
- >
- {t('onboarding.disclaimer.title')}
- </h1>
- <p className="text-[14px] leading-6 text-[#3f3f46] dark:text-card-foreground/80">
- {t('onboarding.disclaimer.summary')}
- </p>
- </div>
+ <ScrollAreaViewport className="min-h-0 flex-1 overscroll-contain">
+ <ScrollAreaContent className="px-6 py-6" style={{ minWidth: '100%' }}>
+ <div className="space-y-4">
+ <h1
+ id="disclaimer-title"
+ className="text-[24px] leading-8 font-semibold tracking-[-0.02em]"
+ >
+ {t('onboarding.disclaimer.title')}
+ </h1>
+ <p className="text-[14px] leading-6 text-[#3f3f46] dark:text-card-foreground/80">
+ {t('onboarding.disclaimer.summary')}
+ </p>
+ </div>
- <BlurHighlight
- key={language}
- highlightedBits={[
- t('onboarding.disclaimer.highlights.downloadManagement'),
- t('onboarding.disclaimer.highlights.authorized'),
- t('onboarding.disclaimer.highlights.responsibility'),
- ]}
- highlightColor="var(--onboarding-highlight-color)"
- highlightTextColor="var(--onboarding-highlight-text-color)"
- highlightClassName="font-medium"
- viewportOptions={{ once: true, amount: 0.5 }}
- className={cn(
- 'mt-6 text-[14px] tracking-[-0.006em] text-[#1d1d1f] dark:text-card-foreground',
- useCjkSpacing ? 'leading-[2.5]' : 'leading-[1.9]'
- )}
- >
- {t('onboarding.disclaimer.body')}
- </BlurHighlight>
+ <BlurHighlight
+ key={language}
+ highlightedBits={[
+ t('onboarding.disclaimer.highlights.downloadManagement'),
+ t('onboarding.disclaimer.highlights.authorized'),
+ t('onboarding.disclaimer.highlights.responsibility'),
+ ]}
+ highlightColor="var(--onboarding-highlight-color)"
+ highlightTextColor="var(--onboarding-highlight-text-color)"
+ highlightClassName="font-medium"
+ viewportOptions={{ once: true, amount: 0.5 }}
+ className={cn(
+ 'mt-6 text-[14px] tracking-[-0.006em] text-[#1d1d1f] dark:text-card-foreground',
+ useCjkSpacing ? 'leading-[2.5]' : 'leading-[1.9]'
+ )}
+ >
+ {t('onboarding.disclaimer.body')}
+ </BlurHighlight>
- <p
- className={cn(
- 'text-[13px] leading-5 text-[#6e6e73] dark:text-muted-foreground',
- useCjkSpacing ? 'mt-8' : 'mt-6'
- )}
- >
- {t('onboarding.disclaimer.localConsent')}
- </p>
+ <p
+ className={cn(
+ 'text-[13px] leading-5 text-[#6e6e73] dark:text-muted-foreground',
+ useCjkSpacing ? 'mt-8' : 'mt-6'
+ )}
+ >
+ {t('onboarding.disclaimer.localConsent')}
+ </p>
- {failed && (
- <p
- data-testid="disclaimer-error"
- role="alert"
- className="mt-4 text-[13px] leading-5 text-destructive"
- >
- {t('onboarding.disclaimer.saveFailed')}
- </p>
- )}
- </section>
+ {failed && (
+ <p
+ data-testid="disclaimer-error"
+ role="alert"
+ className="mt-4 text-[13px] leading-5 text-destructive"
+ >
+ {t('onboarding.disclaimer.saveFailed')}
+ </p>
+ )}
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ </ScrollArea>
<div className="shrink-0 space-y-3 pt-4">
<Button
diff --git a/src/renderer/components/ui/severity-icons.ts b/src/renderer/components/ui/severity-icons.ts
index 6ae7ec19..ef6cd5ef 100644
--- a/src/renderer/components/ui/severity-icons.ts
+++ b/src/renderer/components/ui/severity-icons.ts
@@ -7,12 +7,9 @@ import {
} from 'lucide-react'
/**
- * Single source for a severity/type's icon + accent — shared by the toast
- * surface (`ui/toast.tsx`) and the notifications page
- * (`routes/notifications/notifications-page.tsx`) so the two never drift
- * apart. `'success'` only applies to toasts; the
- * notification center's `NotificationSeverity` (`info` | `warning` |
- * `error`) is a subset of this key set.
+ * Severity icons and accents for toast feedback. The notification center
+ * uses category-specific icons in its persistent list. Toasts additionally
+ * support 'success', beyond the persisted info/warning/error severities.
*/
export type SeverityIconKind = 'success' | 'info' | 'warning' | 'error'
diff --git a/src/renderer/features/directory-preferences/directory-preferences-dialog.test.tsx b/src/renderer/features/directory-preferences/directory-preferences-dialog.test.tsx
index 8c8ad8d4..2523c4b4 100644
--- a/src/renderer/features/directory-preferences/directory-preferences-dialog.test.tsx
+++ b/src/renderer/features/directory-preferences/directory-preferences-dialog.test.tsx
@@ -1,3 +1,4 @@
+import '@test-utils/dom-animations'
import {
generalSettingsSnapshot,
TEST_GENERAL_REVISION,
diff --git a/src/renderer/features/directory-preferences/directory-preferences-dialog.tsx b/src/renderer/features/directory-preferences/directory-preferences-dialog.tsx
index 6ac11e8b..d00029a2 100644
--- a/src/renderer/features/directory-preferences/directory-preferences-dialog.tsx
+++ b/src/renderer/features/directory-preferences/directory-preferences-dialog.tsx
@@ -7,6 +7,12 @@ import {
DialogHeader,
DialogTitle,
} from '@renderer/components/ui/dialog'
+import {
+ ScrollArea,
+ ScrollAreaContent,
+ ScrollAreaViewport,
+ ScrollBar,
+} from '@renderer/components/ui/scroll-area'
import { type KeyboardEvent, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import {
@@ -86,29 +92,37 @@ function OpenDirectoryPreferencesDialog({ onClose }: { onClose: () => void }) {
{t('directoryPreferences.description')}
</DialogDescription>
</DialogHeader>
- <div
- ref={contentRef}
- tabIndex={-1}
- aria-busy={busy || draft.loading}
- data-testid="directory-preferences-content"
- className="min-h-0 flex-1 space-y-3 overflow-y-auto p-4 outline-none"
- >
- <DirectoryPreferencesStatus
- loading={draft.loading}
- error={draft.error}
- disabled={busy}
- onRetry={() => {
- contentRef.current?.focus({ preventScroll: true })
- void draft.refresh()
- }}
- />
- <DirectoryPreferencesSection
- preferences={draft.preferences}
- onChange={draft.setPreferences}
- disabled={draft.loading || busy || !draft.ready}
- onPickingChange={setPicking}
- />
- </div>
+ <ScrollArea className="flex min-h-0 min-w-0 flex-1 flex-col">
+ <ScrollAreaViewport
+ ref={contentRef}
+ tabIndex={-1}
+ aria-busy={busy || draft.loading}
+ data-testid="directory-preferences-content"
+ className="min-h-0 flex-1 overscroll-contain"
+ >
+ <ScrollAreaContent
+ className="space-y-3 p-4"
+ style={{ minWidth: '100%' }}
+ >
+ <DirectoryPreferencesStatus
+ loading={draft.loading}
+ error={draft.error}
+ disabled={busy}
+ onRetry={() => {
+ contentRef.current?.focus({ preventScroll: true })
+ void draft.refresh()
+ }}
+ />
+ <DirectoryPreferencesSection
+ preferences={draft.preferences}
+ onChange={draft.setPreferences}
+ disabled={draft.loading || busy || !draft.ready}
+ onPickingChange={setPicking}
+ />
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ </ScrollArea>
<DialogFooter className="shrink-0 flex-row justify-end border-t px-4 py-3">
<Button
type="button"
diff --git a/src/renderer/features/engine-diagnostics/engine-diagnostics-dialog.test.tsx b/src/renderer/features/engine-diagnostics/engine-diagnostics-dialog.test.tsx
index 578c88c1..a8f43c9c 100644
--- a/src/renderer/features/engine-diagnostics/engine-diagnostics-dialog.test.tsx
+++ b/src/renderer/features/engine-diagnostics/engine-diagnostics-dialog.test.tsx
@@ -1,3 +1,4 @@
+import '@test-utils/dom-animations'
import '@testing-library/jest-dom/vitest'
import '@renderer/lib/i18n'
import { Commands } from '@shared/protocol/commands'
@@ -117,9 +118,9 @@ describe('EngineDiagnosticsDialogHost', () => {
'grid-rows-[auto_minmax(0,1fr)_auto]',
'overflow-hidden'
)
- expect(screen.getByTestId('engine-diagnostics-scroll')).toHaveClass(
- 'min-h-0',
- 'overflow-y-auto'
+ expect(screen.getByTestId('engine-diagnostics-scroll')).toHaveAttribute(
+ 'data-slot',
+ 'scroll-area-viewport'
)
expect(
screen.queryByRole('button', {
diff --git a/src/renderer/features/engine-diagnostics/engine-diagnostics-dialog.tsx b/src/renderer/features/engine-diagnostics/engine-diagnostics-dialog.tsx
index 34c75f12..36714a39 100644
--- a/src/renderer/features/engine-diagnostics/engine-diagnostics-dialog.tsx
+++ b/src/renderer/features/engine-diagnostics/engine-diagnostics-dialog.tsx
@@ -19,6 +19,12 @@ import {
DialogHeader,
DialogTitle,
} from '@renderer/components/ui/dialog'
+import {
+ ScrollArea,
+ ScrollAreaContent,
+ ScrollAreaViewport,
+ ScrollBar,
+} from '@renderer/components/ui/scroll-area'
import { toast } from '@renderer/components/ui/toast'
import {
Tooltip,
@@ -235,227 +241,251 @@ export function EngineDiagnosticsDialogHost() {
</DialogDescription>
</DialogHeader>
- <div
- data-testid="engine-diagnostics-scroll"
- className="min-h-0 space-y-4 overflow-y-auto overscroll-contain px-5 pb-1 scrollbar-gutter-stable"
- >
- {loading && !report ? (
- <div className="flex items-center justify-center gap-2 py-12 text-sm text-muted-foreground">
- <LoaderCircle className="size-4 animate-spin" />
- {t('panel.dashboard.engine.diagnostics.checking')}
- </div>
- ) : report ? (
- <>
- <div className="flex items-center justify-between gap-3">
- <div>
- <div className="text-sm font-medium">
- {t('panel.dashboard.engine.diagnostics.currentStatus')}
- </div>
- <div className="mt-0.5 text-xs text-muted-foreground">
- {t('panel.dashboard.engine.diagnostics.lastChecked', {
- time: new Date(report.generatedAt).toLocaleTimeString(),
- })}
- </div>
+ <ScrollArea className="flex min-h-0 min-w-0 flex-1 flex-col">
+ <ScrollAreaViewport
+ data-testid="engine-diagnostics-scroll"
+ tabIndex={-1}
+ className="min-h-0 flex-1 overscroll-contain"
+ >
+ <ScrollAreaContent
+ className="space-y-4 px-5 pb-1"
+ style={{ minWidth: '100%' }}
+ >
+ {loading && !report ? (
+ <div className="flex items-center justify-center gap-2 py-12 text-sm text-muted-foreground">
+ <LoaderCircle className="size-4 animate-spin" />
+ {t('panel.dashboard.engine.diagnostics.checking')}
</div>
- <Badge
- variant={
- report.state === EngineState.Ready
- ? 'secondary'
- : 'destructive'
- }
- >
- {t(
- `panel.dashboard.engine.state.${
- report.state === EngineState.Restarting
- ? 'reconnecting'
- : report.state
- }`
- )}
- </Badge>
- </div>
-
- {report.recommendation !== 'none' && (
- <div className="flex gap-3 rounded-md bg-muted/60 p-3">
- <ShieldCheck className="mt-0.5 size-4 shrink-0 text-primary" />
- <div>
- <div className="text-sm font-medium">
- {t(
- 'panel.dashboard.engine.diagnostics.recommendation.title'
- )}
+ ) : report ? (
+ <>
+ <div className="flex items-center justify-between gap-3">
+ <div>
+ <div className="text-sm font-medium">
+ {t(
+ 'panel.dashboard.engine.diagnostics.currentStatus'
+ )}
+ </div>
+ <div className="mt-0.5 text-xs text-muted-foreground">
+ {t('panel.dashboard.engine.diagnostics.lastChecked', {
+ time: new Date(
+ report.generatedAt
+ ).toLocaleTimeString(),
+ })}
+ </div>
</div>
- <div className="mt-0.5 text-xs text-muted-foreground">
+ <Badge
+ variant={
+ report.state === EngineState.Ready
+ ? 'secondary'
+ : 'destructive'
+ }
+ >
{t(
- `panel.dashboard.engine.diagnostics.recommendation.${report.recommendation}`,
- {
- port: report.suggestedRpcPort ?? '',
- rpcPort: report.rpc.port,
- pid: report.process?.pid ?? '',
- }
+ `panel.dashboard.engine.state.${
+ report.state === EngineState.Restarting
+ ? 'reconnecting'
+ : report.state
+ }`
)}
- </div>
+ </Badge>
</div>
- </div>
- )}
- <div className="grid gap-2">
- <CheckRow
- label={t(
- 'panel.dashboard.engine.diagnostics.checks.binary'
- )}
- value={
- report.binary.available
- ? t(
- 'panel.dashboard.engine.diagnostics.binary.available',
- {
- name: report.binary.name,
- version: report.binary.version ?? '?',
- }
- )
- : t(
- 'panel.dashboard.engine.diagnostics.binary.unavailable',
- { name: report.binary.name }
- )
- }
- state={report.binary.available ? 'pass' : 'fail'}
- />
- <CheckRow
- label={t(
- 'panel.dashboard.engine.diagnostics.checks.features'
+ {report.recommendation !== 'none' && (
+ <div className="flex gap-3 rounded-md bg-muted/60 p-3">
+ <ShieldCheck className="mt-0.5 size-4 shrink-0 text-primary" />
+ <div>
+ <div className="text-sm font-medium">
+ {t(
+ 'panel.dashboard.engine.diagnostics.recommendation.title'
+ )}
+ </div>
+ <div className="mt-0.5 text-xs text-muted-foreground">
+ {t(
+ `panel.dashboard.engine.diagnostics.recommendation.${report.recommendation}`,
+ {
+ port: report.suggestedRpcPort ?? '',
+ rpcPort: report.rpc.port,
+ pid: report.process?.pid ?? '',
+ }
+ )}
+ </div>
+ </div>
+ </div>
)}
- value={
- engineFeatures.length > 0
- ? engineFeatures.join(', ')
- : report.binary.available
- ? t(
- 'panel.dashboard.engine.diagnostics.features.none'
- )
- : t(
- 'panel.dashboard.engine.diagnostics.features.unavailable'
- )
- }
- state={
- !report.binary.available
- ? 'fail'
- : engineFeatures.length > 0
- ? 'pass'
- : 'warn'
- }
- />
- <CheckRow
- testId="engine-check-rpc"
- label={t('panel.dashboard.engine.diagnostics.checks.rpc')}
- value={
- report.rpc.expectedListener
- ? t(
- 'panel.dashboard.engine.diagnostics.rpc.listening',
- { port: report.rpc.port }
- )
- : report.rpc.available
- ? t(
- 'panel.dashboard.engine.diagnostics.rpc.available',
- { port: report.rpc.port }
- )
- : t(
- 'panel.dashboard.engine.diagnostics.rpc.occupied',
- { port: report.rpc.port }
- )
- }
- state={
- report.rpc.available || report.rpc.expectedListener
- ? 'pass'
- : 'fail'
- }
- action={
- !report.defaultRpc.isCurrent ? (
- <TooltipProvider delay={300}>
- <Tooltip>
- <TooltipTrigger
- render={
- <span
- className="inline-flex"
- tabIndex={
- recovering || !report.defaultRpc.canRestore
- ? 0
- : undefined
+
+ <div className="grid gap-2">
+ <CheckRow
+ label={t(
+ 'panel.dashboard.engine.diagnostics.checks.binary'
+ )}
+ value={
+ report.binary.available
+ ? t(
+ 'panel.dashboard.engine.diagnostics.binary.available',
+ {
+ name: report.binary.name,
+ version: report.binary.version ?? '?',
+ }
+ )
+ : t(
+ 'panel.dashboard.engine.diagnostics.binary.unavailable',
+ { name: report.binary.name }
+ )
+ }
+ state={report.binary.available ? 'pass' : 'fail'}
+ />
+ <CheckRow
+ label={t(
+ 'panel.dashboard.engine.diagnostics.checks.features'
+ )}
+ value={
+ engineFeatures.length > 0
+ ? engineFeatures.join(', ')
+ : report.binary.available
+ ? t(
+ 'panel.dashboard.engine.diagnostics.features.none'
+ )
+ : t(
+ 'panel.dashboard.engine.diagnostics.features.unavailable'
+ )
+ }
+ state={
+ !report.binary.available
+ ? 'fail'
+ : engineFeatures.length > 0
+ ? 'pass'
+ : 'warn'
+ }
+ />
+ <CheckRow
+ testId="engine-check-rpc"
+ label={t(
+ 'panel.dashboard.engine.diagnostics.checks.rpc'
+ )}
+ value={
+ report.rpc.expectedListener
+ ? t(
+ 'panel.dashboard.engine.diagnostics.rpc.listening',
+ { port: report.rpc.port }
+ )
+ : report.rpc.available
+ ? t(
+ 'panel.dashboard.engine.diagnostics.rpc.available',
+ { port: report.rpc.port }
+ )
+ : t(
+ 'panel.dashboard.engine.diagnostics.rpc.occupied',
+ { port: report.rpc.port }
+ )
+ }
+ state={
+ report.rpc.available || report.rpc.expectedListener
+ ? 'pass'
+ : 'fail'
+ }
+ action={
+ !report.defaultRpc.isCurrent ? (
+ <TooltipProvider delay={300}>
+ <Tooltip>
+ <TooltipTrigger
+ render={
+ <span
+ className="inline-flex"
+ tabIndex={
+ recovering ||
+ !report.defaultRpc.canRestore
+ ? 0
+ : undefined
+ }
+ >
+ <Button
+ variant="outline"
+ size="icon-xs"
+ aria-label={t(
+ 'panel.dashboard.engine.diagnostics.fallback.restore',
+ { port: report.defaultRpc.port }
+ )}
+ disabled={
+ recovering ||
+ !report.defaultRpc.canRestore
+ }
+ onClick={() => {
+ if (
+ report.defaultRpc
+ .requiresTermination
+ ) {
+ setConfirmRestoreDefault(true)
+ } else {
+ void recover(
+ EngineRecoveryAction.RestoreDefaultPort
+ )
+ }
+ }}
+ >
+ {recovering ? (
+ <LoaderCircle className="animate-spin" />
+ ) : (
+ <RotateCcw />
+ )}
+ </Button>
+ </span>
}
+ />
+ <TooltipContent
+ side="left"
+ className="max-w-80"
>
- <Button
- variant="outline"
- size="icon-xs"
- aria-label={t(
- 'panel.dashboard.engine.diagnostics.fallback.restore',
- { port: report.defaultRpc.port }
- )}
- disabled={
- recovering ||
- !report.defaultRpc.canRestore
- }
- onClick={() => {
- if (
- report.defaultRpc.requiresTermination
- ) {
- setConfirmRestoreDefault(true)
- } else {
- void recover(
- EngineRecoveryAction.RestoreDefaultPort
- )
- }
- }}
- >
- {recovering ? (
- <LoaderCircle className="animate-spin" />
- ) : (
- <RotateCcw />
- )}
- </Button>
- </span>
- }
- />
- <TooltipContent side="left" className="max-w-80">
- {defaultPortTooltip}
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- ) : undefined
- }
- />
- <CheckRow
- label={t(
- 'panel.dashboard.engine.diagnostics.checks.process'
- )}
- value={processDescription(report, t)}
- state={processState}
- />
- <CheckRow
- label={t(
- 'panel.dashboard.engine.diagnostics.checks.communication'
- )}
- value={
- report.state === EngineState.Ready
- ? t(
- 'panel.dashboard.engine.diagnostics.communication.ready'
- )
- : t(
- `panel.dashboard.engine.diagnostics.reason.${report.failure?.reason ?? 'unknown'}`
- )
- }
- state={report.state === EngineState.Ready ? 'pass' : 'fail'}
- />
- </div>
+ {defaultPortTooltip}
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ ) : undefined
+ }
+ />
+ <CheckRow
+ label={t(
+ 'panel.dashboard.engine.diagnostics.checks.process'
+ )}
+ value={processDescription(report, t)}
+ state={processState}
+ />
+ <CheckRow
+ label={t(
+ 'panel.dashboard.engine.diagnostics.checks.communication'
+ )}
+ value={
+ report.state === EngineState.Ready
+ ? t(
+ 'panel.dashboard.engine.diagnostics.communication.ready'
+ )
+ : t(
+ `panel.dashboard.engine.diagnostics.reason.${report.failure?.reason ?? 'unknown'}`
+ )
+ }
+ state={
+ report.state === EngineState.Ready ? 'pass' : 'fail'
+ }
+ />
+ </div>
- {report.failure?.technicalMessage && (
- <details className="text-xs text-muted-foreground">
- <summary className="cursor-pointer select-none">
- {t('panel.dashboard.engine.diagnostics.technicalDetails')}
- </summary>
- <code className="mt-2 block break-all rounded bg-muted p-2">
- {report.failure.technicalMessage}
- </code>
- </details>
- )}
- </>
- ) : null}
- </div>
+ {report.failure?.technicalMessage && (
+ <details className="text-xs text-muted-foreground">
+ <summary className="cursor-pointer select-none">
+ {t(
+ 'panel.dashboard.engine.diagnostics.technicalDetails'
+ )}
+ </summary>
+ <code className="mt-2 block break-all rounded bg-muted p-2">
+ {report.failure.technicalMessage}
+ </code>
+ </details>
+ )}
+ </>
+ ) : null}
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ </ScrollArea>
<DialogFooter className="border-t px-5 py-4">
<DialogClose
diff --git a/src/renderer/routes/dashboard/components/kpi-number.test.tsx b/src/renderer/routes/dashboard/components/kpi-number.test.tsx
index 05ade346..a3c92e9a 100644
--- a/src/renderer/routes/dashboard/components/kpi-number.test.tsx
+++ b/src/renderer/routes/dashboard/components/kpi-number.test.tsx
@@ -5,11 +5,11 @@ import { describe, expect, it } from 'vitest'
import { KpiNumber } from './kpi-number'
describe('KpiNumber', () => {
- it('renders text content with tabular-nums and split unit sizing', () => {
+ it('renders text content with proportional-nums and split unit sizing', () => {
const { container } = render(<KpiNumber value="1.2 MB/s" />)
const el = container.firstElementChild as HTMLElement
expect(el).toHaveTextContent('1.2 MB/s')
- expect(el.className).toContain('tabular-nums')
+ expect(el.className).toContain('proportional-nums')
expect(screen.getByText('1.2').className).toContain('font-semibold')
expect(screen.getByText('MB/s').className).toContain('text-[12px]')
})
diff --git a/src/renderer/routes/dashboard/components/kpi-number.tsx b/src/renderer/routes/dashboard/components/kpi-number.tsx
index 50ede952..6398f999 100644
--- a/src/renderer/routes/dashboard/components/kpi-number.tsx
+++ b/src/renderer/routes/dashboard/components/kpi-number.tsx
@@ -38,7 +38,7 @@ export function KpiNumber({
<span
title={String(value)}
className={cn(
- 'inline-flex min-w-0 max-w-full items-baseline gap-1 font-semibold tabular-nums',
+ 'inline-flex min-w-0 max-w-full items-baseline gap-1 font-semibold proportional-nums',
SIZE[variant],
className,
// Keep the title-to-KPI rhythm stable. tailwind-merge treats an
diff --git a/src/renderer/routes/dashboard/components/tile-shell.tsx b/src/renderer/routes/dashboard/components/tile-shell.tsx
index 49785f33..346c7816 100644
--- a/src/renderer/routes/dashboard/components/tile-shell.tsx
+++ b/src/renderer/routes/dashboard/components/tile-shell.tsx
@@ -21,7 +21,7 @@ export function TileShell({
return (
<Card
className={cn(
- 'dashboard-tile flex min-h-0 flex-col overflow-hidden shadow-md/5 border-none',
+ 'dashboard-tile flex min-h-0 flex-col overflow-hidden shadow-md/5 border-none proportional-nums',
'gap-0',
'p-4',
className
diff --git a/src/renderer/routes/dashboard/tiles/active-tile.tsx b/src/renderer/routes/dashboard/tiles/active-tile.tsx
index 226f20d8..ca4cf807 100644
--- a/src/renderer/routes/dashboard/tiles/active-tile.tsx
+++ b/src/renderer/routes/dashboard/tiles/active-tile.tsx
@@ -100,7 +100,7 @@ export function ActiveTile({
key={key}
className="min-w-0 border-border/70 border-l px-3 first:border-l-0 first:pl-0 last:pr-0"
>
- <span className="mb-1 block text-[20px] leading-none text-foreground font-semibold tabular-nums">
+ <span className="mb-1 block text-[20px] leading-none text-foreground font-semibold">
{count}
</span>
<span className="block truncate text-[10px] uppercase leading-none">
diff --git a/src/renderer/routes/dashboard/tiles/engine-tile.tsx b/src/renderer/routes/dashboard/tiles/engine-tile.tsx
index 15f42939..e9d4dc25 100644
--- a/src/renderer/routes/dashboard/tiles/engine-tile.tsx
+++ b/src/renderer/routes/dashboard/tiles/engine-tile.tsx
@@ -148,7 +148,7 @@ export function EngineTile({
data-testid="engine-footer"
className="mt-auto flex items-center justify-between"
>
- <div className="flex shrink-0 items-center gap-3 text-muted-foreground tabular-nums text-[11px]">
+ <div className="flex shrink-0 items-center gap-3 text-muted-foreground text-[11px]">
{`aria2 v${shortVersion}`}
</div>
<StatusDot pulse={pulse} className={cn(DOT[status.state])} />
@@ -181,7 +181,7 @@ function Sub({
</span>
<span
title={value}
- className="mt-1 block truncate text-[15px] font-medium text-foreground tabular-nums"
+ className="mt-1 block truncate text-[15px] font-medium text-foreground"
>
{value}
</span>
diff --git a/src/renderer/routes/dashboard/tiles/nat-tile.tsx b/src/renderer/routes/dashboard/tiles/nat-tile.tsx
index 60c971a5..4cacc9cd 100644
--- a/src/renderer/routes/dashboard/tiles/nat-tile.tsx
+++ b/src/renderer/routes/dashboard/tiles/nat-tile.tsx
@@ -227,7 +227,7 @@ function ElectronNatTile({ viewport, className }: NatTileProps) {
{summary ? (
<dl
data-testid="nat-summary"
- className="mt-auto grid min-w-0 grid-cols-3 pt-3 tabular-nums"
+ className="mt-auto grid min-w-0 grid-cols-3 pt-3"
>
<Metric
label={t('panel.dashboard.nat.health')}
@@ -339,7 +339,7 @@ function Metric({
<dd
title={value}
className={cn(
- 'mt-1.5 block min-w-0 font-medium tracking-[-0.01em] text-foreground tabular-nums',
+ 'mt-1.5 block min-w-0 font-medium tracking-[-0.01em] text-foreground',
featured ? 'break-all' : 'break-words',
compact
? 'text-[14px]'
diff --git a/src/renderer/routes/dashboard/tiles/speed-limit-tile.tsx b/src/renderer/routes/dashboard/tiles/speed-limit-tile.tsx
index fc29ba42..fe48a3ff 100644
--- a/src/renderer/routes/dashboard/tiles/speed-limit-tile.tsx
+++ b/src/renderer/routes/dashboard/tiles/speed-limit-tile.tsx
@@ -127,7 +127,7 @@ export function SpeedLimitTile({
{!compact ? (
<div
data-testid="speed-limit-rates"
- className="flex shrink-0 items-center gap-3 text-[12px] text-muted-foreground tabular-nums"
+ className="flex shrink-0 items-center gap-3 text-[12px] text-muted-foreground"
>
<span className="flex gap-0.5 items-center">
<span className="mr-0.5 text-xs">↓</span>
diff --git a/src/renderer/routes/dashboard/tiles/speed-tile.tsx b/src/renderer/routes/dashboard/tiles/speed-tile.tsx
index 8fca188e..0ae58ae7 100644
--- a/src/renderer/routes/dashboard/tiles/speed-tile.tsx
+++ b/src/renderer/routes/dashboard/tiles/speed-tile.tsx
@@ -72,7 +72,7 @@ export function SpeedTile({
<div
data-testid="speed-scale"
className={cn(
- 'pointer-events-none absolute top-0 right-0 z-10 flex flex-col items-end justify-between text-right text-[11px] leading-none text-muted-foreground/45 tabular-nums',
+ 'pointer-events-none absolute top-0 right-0 z-10 flex flex-col items-end justify-between text-right text-[11px] leading-none text-muted-foreground/45',
showPeak ? 'bottom-10' : 'bottom-4'
)}
>
@@ -82,7 +82,7 @@ export function SpeedTile({
</div>
)}
{showPeak ? (
- <span className="pointer-events-none absolute right-0 bottom-3 z-10 text-[11px] leading-none text-muted-foreground/55 tabular-nums">
+ <span className="pointer-events-none absolute right-0 bottom-3 z-10 text-[11px] leading-none text-muted-foreground/55">
{t('panel.dashboard.speed.peak', { value: formatSpeed(peak) })}
</span>
) : null}
diff --git a/src/renderer/routes/dashboard/tiles/tasks-tile.tsx b/src/renderer/routes/dashboard/tiles/tasks-tile.tsx
index aae7f6d1..9046091d 100644
--- a/src/renderer/routes/dashboard/tiles/tasks-tile.tsx
+++ b/src/renderer/routes/dashboard/tiles/tasks-tile.tsx
@@ -338,7 +338,7 @@ function TaskRow({
<span className="min-w-0 flex-1 truncate font-medium">
{task.name}
</span>
- <span className="shrink-0 text-muted-foreground tabular-nums">
+ <span className="shrink-0 text-muted-foreground">
{presentation.primary}
</span>
</div>
@@ -355,7 +355,7 @@ function TaskRow({
<span className="min-w-0 truncate text-[12px] font-medium leading-[13px]">
{task.name}
</span>
- <span className="shrink-0 text-[11px] leading-[13px] text-muted-foreground tabular-nums">
+ <span className="shrink-0 text-[11px] leading-[13px] text-muted-foreground">
{presentation.primary}
</span>
<span className="col-span-2 min-w-0 truncate text-[10px] leading-[11px] text-muted-foreground">
diff --git a/src/renderer/routes/dashboard/tiles/transfer-tile.tsx b/src/renderer/routes/dashboard/tiles/transfer-tile.tsx
index 38fac235..184c0e8b 100644
--- a/src/renderer/routes/dashboard/tiles/transfer-tile.tsx
+++ b/src/renderer/routes/dashboard/tiles/transfer-tile.tsx
@@ -203,10 +203,10 @@ function DirectionBreakdown({
data-testid="transfer-direction-values"
className="flex w-full justify-between"
>
- <div className="text-left font-medium tabular-nums text-foreground text-sm">
+ <div className="text-left font-medium text-foreground text-sm">
<KpiNumber value={formatBytes(range.uploadBytes)} variant="compact" />
</div>
- <div className="text-right font-medium tabular-nums text-foreground text-sm">
+ <div className="text-right font-medium text-foreground text-sm">
<KpiNumber
value={formatBytes(range.downloadBytes)}
variant="compact"
diff --git a/src/renderer/routes/downloads/downloads-toolbar-button.tsx b/src/renderer/routes/downloads/downloads-toolbar-button.tsx
index 9e87102e..820c6a10 100644
--- a/src/renderer/routes/downloads/downloads-toolbar-button.tsx
+++ b/src/renderer/routes/downloads/downloads-toolbar-button.tsx
@@ -1,21 +1 @@
-import { Button } from '@renderer/components/ui/button'
-import { cn } from '@renderer/lib/utils'
-import type { ComponentProps } from 'react'
-
-/** Both densities reserve 2px padding and a border around each target. */
-export function DownloadsToolbarButton({
- className,
- ...props
-}: ComponentProps<typeof Button>) {
- return (
- <Button
- size="icon"
- variant="ghost"
- {...props}
- className={cn(
- 'app-no-drag relative size-[30px] compact-header:size-6 rounded-full text-foreground bg-transparent transition-colors hover:bg-accent active:bg-accent [&>svg]:size-[18px] compact-header:[&>svg]:size-4 [&>svg]:opacity-65 hover:[&>svg]:opacity-90 focus-visible:[&>svg]:opacity-90 focus-visible:ring-1 focus-visible:ring-[#7388a3] dark:focus-visible:ring-[#97aac4] aria-pressed:bg-accent data-popup-open:bg-accent',
- className
- )}
- />
- )
-}
+export { ToolbarButton as DownloadsToolbarButton } from '@renderer/components/desktop-kit/toolbar/toolbar-button'
diff --git a/src/renderer/routes/downloads/downloads-toolbar.tsx b/src/renderer/routes/downloads/downloads-toolbar.tsx
index 47311a1b..54fc50c2 100644
--- a/src/renderer/routes/downloads/downloads-toolbar.tsx
+++ b/src/renderer/routes/downloads/downloads-toolbar.tsx
@@ -1,9 +1,10 @@
import { useCompactHeader } from '@renderer/components/desktop-kit/hooks/use-compact-header'
import type { SelectionStore } from '@renderer/components/desktop-kit/selection/types'
-import { ToolbarGlass } from '@renderer/components/desktop-kit/toolbar-glass/toolbar-glass'
-import { useLiquidGlass } from '@renderer/hooks/use-liquid-glass'
+import { Toolbar } from '@renderer/components/desktop-kit/toolbar/toolbar'
+import { ToolbarGroup } from '@renderer/components/desktop-kit/toolbar/toolbar-group'
import type { DownloadTask } from '@shared/types/task'
import { useLayoutEffect, useRef, useState } from 'react'
+import { useTranslation } from 'react-i18next'
import {
FilterSearchCommand,
type FilterSearchCommandProps,
@@ -41,16 +42,13 @@ export function DownloadsToolbar({
selection,
onHideInspector,
...searchProps
-}: Omit<
- FilterSearchCommandProps,
- 'expanded' | 'onExpandedChange' | 'width' | 'glassEnabled'
-> & {
+}: Omit<FilterSearchCommandProps, 'expanded' | 'onExpandedChange' | 'width'> & {
tasks: readonly DownloadTask[]
selection: SelectionStore<DownloadTask>
onHideInspector: () => void
}) {
const compact = useCompactHeader()
- const glassEnabled = useLiquidGlass()
+ const { t } = useTranslation()
const rootRef = useRef<HTMLDivElement>(null)
const moreRef = useRef<HTMLButtonElement>(null)
const viewRef = useRef<HTMLButtonElement>(null)
@@ -94,18 +92,15 @@ export function DownloadsToolbar({
}, [width, expanded, count, compact, viewMenuOpen])
return (
- <div
+ <Toolbar
+ label={t('nav.downloads')}
ref={rootRef}
data-slot="downloads-toolbar"
data-density={compact ? 'compact' : 'standard'}
data-visible-actions={count}
className="flex min-w-0 flex-1 items-center justify-end gap-2"
>
- <div
- data-slot="downloads-action-group"
- className="app-no-drag toolbar-glass-surface flex h-9 shrink-0 items-center gap-1 rounded-full border border-border/70 bg-background/70 p-0.5 compact-header:h-[30px]"
- >
- <ToolbarGlass enabled={glassEnabled} />
+ <ToolbarGroup data-slot="downloads-action-group">
<TaskActionsMenu
tasks={tasks}
selection={selection}
@@ -118,10 +113,9 @@ export function DownloadsToolbar({
{count >= 2 && (
<InspectorToggle triggerRef={inspectorRef} onHide={onHideInspector} />
)}
- </div>
+ </ToolbarGroup>
<FilterSearchCommand
{...searchProps}
- glassEnabled={glassEnabled}
expanded={expanded}
onExpandedChange={setSearchRequested}
width={Math.max(
@@ -132,6 +126,6 @@ export function DownloadsToolbar({
)
)}
/>
- </div>
+ </Toolbar>
)
}
diff --git a/src/renderer/routes/downloads/filter-search-command.tsx b/src/renderer/routes/downloads/filter-search-command.tsx
index 07f7bf62..f26e3850 100644
--- a/src/renderer/routes/downloads/filter-search-command.tsx
+++ b/src/renderer/routes/downloads/filter-search-command.tsx
@@ -1,5 +1,4 @@
-import { useCompactHeader } from '@renderer/components/desktop-kit/hooks/use-compact-header'
-import { ToolbarGlass } from '@renderer/components/desktop-kit/toolbar-glass/toolbar-glass'
+import { ToolbarSearch } from '@renderer/components/desktop-kit/toolbar/toolbar-search'
import {
Popover,
PopoverContent,
@@ -12,8 +11,8 @@ import {
} from '@renderer/components/ui/tooltip'
import { TASK_TYPE_META, TASK_TYPE_ORDER } from '@renderer/lib/task-type-meta'
import { cn } from '@renderer/lib/utils'
-import { CircleX, ListFilter, Search } from 'lucide-react'
-import { useEffect, useId, useLayoutEffect, useRef, useState } from 'react'
+import { ListFilter } from 'lucide-react'
+import { useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { DownloadsToolbarButton } from './downloads-toolbar-button'
import {
@@ -27,7 +26,6 @@ export interface FilterSearchCommandProps extends FilterSearchPanelProps {
expanded: boolean
onExpandedChange: (expanded: boolean) => void
width: number
- glassEnabled?: boolean
}
export function FilterSearchCommand({
@@ -39,25 +37,13 @@ export function FilterSearchCommand({
expanded,
onExpandedChange,
width,
- glassEnabled = false,
}: FilterSearchCommandProps) {
- const compact = useCompactHeader()
const { t, i18n } = useTranslation()
const [open, setOpen] = useState(false)
const [popupPresent, setPopupPresent] = useState(false)
- const rootRef = useRef<HTMLDivElement>(null)
const popupRef = useRef<HTMLDivElement>(null)
- const inputRef = useRef<HTMLInputElement>(null)
- const searchRef = useRef<HTMLButtonElement>(null)
const filterRef = useRef<HTMLButtonElement>(null)
- const returnFocus = useRef(false)
- const focusOnExpand = useRef(false)
- const blurFrame = useRef<number | null>(null)
const active = Boolean(query.trim()) || types.length > 0
- const latest = useRef({ active, open })
- latest.current = { active, open }
- const inputId = useId()
- const label = t('panel.downloads.search.placeholder')
const descriptions = [
query.trim()
? t('panel.downloads.search.activeQuery', { query: query.trim() })
@@ -79,191 +65,95 @@ export function FilterSearchCommand({
t('panel.downloads.search.filters'),
...descriptions,
].join(' · ')
- const collapseIfIdle = () => {
- if (blurFrame.current !== null) cancelAnimationFrame(blurFrame.current)
- blurFrame.current = requestAnimationFrame(() => {
- const focused = document.activeElement
- if (
- !latest.current.active &&
- !latest.current.open &&
- !rootRef.current?.contains(focused) &&
- !popupRef.current?.contains(focused)
- )
- onExpandedChange(false)
- })
- }
- useEffect(
- () => () => {
- if (blurFrame.current !== null) cancelAnimationFrame(blurFrame.current)
- },
- []
- )
- useLayoutEffect(() => {
- if (expanded && focusOnExpand.current) {
- inputRef.current?.focus()
- focusOnExpand.current = false
- } else if (!expanded && returnFocus.current) {
- searchRef.current?.focus()
- returnFocus.current = false
- }
- }, [expanded])
return (
- <div
- ref={rootRef}
+ <ToolbarSearch
data-slot="downloads-search"
- data-expanded={expanded}
data-filter-active={active}
- onBlurCapture={(event) => {
- // Portal blur events bubble through React too. A closing popup hands
- // focus back to its trigger after its animation; let it finish.
- if (!open && rootRef.current?.contains(event.target)) collapseIfIdle()
- }}
- className={cn(
- 'app-no-drag toolbar-glass-surface flex h-9 shrink-0 items-center rounded-full border border-border/70 bg-background/70 p-0.5 transition-[width] duration-150 ease-out motion-reduce:transition-none compact-header:h-[30px]',
- expanded &&
- 'has-[input:focus]:border-[#7388a3] dark:has-[input:focus]:border-[#97aac4]'
- )}
- style={{ width: expanded ? width : compact ? 30 : 36 }}
- >
- <ToolbarGlass enabled={glassEnabled} />
- {expanded ? (
- <>
- <Popover
- open={open}
- onOpenChange={(next, details) => {
- setOpen(next)
- if (next) {
- setPopupPresent(true)
- onExpandedChange(true)
+ value={query}
+ onValueChange={onQueryChange}
+ label={t('panel.downloads.search.placeholder')}
+ clearLabel={t('common.clearSearch')}
+ expanded={expanded}
+ onExpandedChange={onExpandedChange}
+ keepExpanded={types.length > 0 || open}
+ onEmptyEscape={() => filterRef.current?.focus()}
+ width={width}
+ leading={({ anchorRef, collapseIfIdle }) => (
+ <Popover
+ open={open}
+ onOpenChange={(next, details) => {
+ setOpen(next)
+ if (next) {
+ setPopupPresent(true)
+ onExpandedChange(true)
+ }
+ if (
+ !next &&
+ (details.reason === 'outside-press' ||
+ details.reason === 'focus-out')
+ )
+ collapseIfIdle()
+ }}
+ onOpenChangeComplete={(next) => {
+ if (!next) setPopupPresent(false)
+ }}
+ >
+ <Tooltip disabled={open}>
+ <TooltipTrigger
+ delay={400}
+ render={
+ <PopoverTrigger
+ render={
+ <DownloadsToolbarButton
+ ref={filterRef}
+ aria-label={filterLabel}
+ className={
+ active
+ ? 'text-[#006bd6] dark:text-[#69aeff] [&>svg]:opacity-100 hover:text-[#006bd6] dark:hover:text-[#69aeff]'
+ : undefined
+ }
+ />
+ }
+ />
}
- if (
- !next &&
- (details.reason === 'outside-press' ||
- details.reason === 'focus-out')
- )
- collapseIfIdle()
- }}
- onOpenChangeComplete={(next) => {
- if (!next) setPopupPresent(false)
- }}
- >
- <Tooltip disabled={open}>
- <TooltipTrigger
- delay={400}
- render={
- <PopoverTrigger
- render={
- <DownloadsToolbarButton
- ref={filterRef}
- aria-label={filterLabel}
- className={
- active
- ? 'text-[#006bd6] dark:text-[#69aeff] [&>svg]:opacity-100 hover:text-[#006bd6] dark:hover:text-[#69aeff]'
- : undefined
- }
- />
- }
- />
- }
- >
- <ListFilter className="size-4" />
- </TooltipTrigger>
- <TooltipContent
- anchor={rootRef}
- side="bottom"
- align="start"
- sideOffset={8}
- className={cn(
- 'block max-w-(--anchor-width) [overflow-wrap:anywhere]',
- popupPresent && 'invisible'
- )}
- >
- <p>{t('panel.downloads.search.filters')}</p>
- {descriptions.map((description) => (
- <p key={description} className="mt-1 opacity-80">
- {description}
- </p>
- ))}
- </TooltipContent>
- </Tooltip>
- <PopoverContent
- ref={popupRef}
- anchor={rootRef}
- aria-label={t('panel.downloads.search.filters')}
+ >
+ <ListFilter className="size-4" />
+ </TooltipTrigger>
+ <TooltipContent
+ anchor={anchorRef}
+ side="bottom"
align="start"
sideOffset={8}
- className="app-no-drag w-(--anchor-width) max-w-[calc(100vw-24px)] p-0"
+ className={cn(
+ 'block max-w-(--anchor-width) [overflow-wrap:anywhere]',
+ popupPresent && 'invisible'
+ )}
>
- <FilterSearchPanel
- types={types}
- onTypesChange={onTypesChange}
- typeCounts={typeCounts}
- />
- </PopoverContent>
- </Popover>
- <input
- ref={inputRef}
- id={inputId}
- type="text"
- inputMode="search"
- aria-label={label}
- placeholder={label}
- autoComplete="off"
- spellCheck={false}
- value={query}
- onFocus={() => onExpandedChange(true)}
- onChange={(event) => onQueryChange(event.target.value)}
- onKeyDown={(event) => {
- if (event.key !== 'Escape' || event.nativeEvent.isComposing)
- return
- event.preventDefault()
- event.stopPropagation()
- if (query) onQueryChange('')
- else if (types.length === 0) {
- returnFocus.current = true
- onExpandedChange(false)
- } else filterRef.current?.focus()
- }}
- className="h-[30px] w-full min-w-0 border-0 bg-transparent px-1 text-[13px] outline-none placeholder:text-muted-foreground compact-header:h-6 compact-header:text-xs"
- />
- {query.length > 0 && (
- <DownloadsToolbarButton
- aria-label={t('panel.downloads.search.clearQuery')}
- title={t('panel.downloads.search.clearQuery')}
- onClick={() => {
- onQueryChange('')
- inputRef.current?.focus()
- }}
- >
- <CircleX className="size-3.5" />
- </DownloadsToolbarButton>
- )}
- </>
- ) : (
- <Tooltip>
- <TooltipTrigger
- delay={400}
- render={
- <DownloadsToolbarButton
- ref={searchRef}
- aria-label={label}
- aria-expanded={false}
- aria-controls={inputId}
- onClick={() => {
- focusOnExpand.current = true
- onExpandedChange(true)
- }}
- />
- }
+ <p>{t('panel.downloads.search.filters')}</p>
+ {descriptions.map((description) => (
+ <p key={description} className="mt-1 opacity-80">
+ {description}
+ </p>
+ ))}
+ </TooltipContent>
+ </Tooltip>
+ <PopoverContent
+ ref={popupRef}
+ anchor={anchorRef}
+ aria-label={t('panel.downloads.search.filters')}
+ align="start"
+ sideOffset={8}
+ className="app-no-drag w-(--anchor-width) max-w-[calc(100vw-24px)] p-0"
>
- <Search className="size-4" />
- </TooltipTrigger>
- <TooltipContent side="bottom" align="end" sideOffset={8}>
- {label}
- </TooltipContent>
- </Tooltip>
+ <FilterSearchPanel
+ types={types}
+ onTypesChange={onTypesChange}
+ typeCounts={typeCounts}
+ />
+ </PopoverContent>
+ </Popover>
)}
- </div>
+ />
)
}
diff --git a/src/renderer/routes/downloads/task-actions-menu.test.tsx b/src/renderer/routes/downloads/task-actions-menu.test.tsx
index c8669cb6..1ff8bd19 100644
--- a/src/renderer/routes/downloads/task-actions-menu.test.tsx
+++ b/src/renderer/routes/downloads/task-actions-menu.test.tsx
@@ -1,3 +1,4 @@
+import { Toolbar as ToolbarPrimitive } from '@base-ui/react/toolbar'
import { RemoveTasksDialogHost } from '@renderer/routes/downloads/inspector/remove-tasks-dialog-host'
import { useRemoveTasksStore } from '@renderer/routes/downloads/inspector/remove-tasks-store'
import { render as renderBase } from '@testing-library/react'
@@ -83,7 +84,7 @@ function setup(context = true, items = tasks) {
selection.getState().setItems(items)
if (items[0]) selection.getState().select(items[0].id)
if (items[1]) selection.getState().toggle(items[1].id)
- render(
+ const menu = (
<TaskActionsMenu tasks={items} selection={selection}>
{context ? (
<div data-testid="context-list">
@@ -96,6 +97,7 @@ function setup(context = true, items = tasks) {
) : undefined}
</TaskActionsMenu>
)
+ render(context ? menu : <ToolbarPrimitive.Root>{menu}</ToolbarPrimitive.Root>)
return selection
}
diff --git a/src/renderer/routes/notifications/notification-icon.tsx b/src/renderer/routes/notifications/notification-icon.tsx
new file mode 100644
index 00000000..45d7e63a
--- /dev/null
+++ b/src/renderer/routes/notifications/notification-icon.tsx
@@ -0,0 +1,36 @@
+import { cn } from '@renderer/lib/utils'
+import {
+ type AppNotification,
+ NotificationKinds,
+} from '@shared/types/notification'
+import { CircleCheck, CircleX, Info, TriangleAlert } from 'lucide-react'
+
+const severityIcons = {
+ info: { icon: Info, className: 'text-muted-foreground' },
+ warning: {
+ icon: TriangleAlert,
+ className: 'text-[#8b784d] dark:text-[#baa574]',
+ },
+ error: {
+ icon: CircleX,
+ className: 'text-[#a96360] dark:text-[#c98f89]',
+ },
+}
+
+export function NotificationIcon({ item }: { item: AppNotification }) {
+ const complete = item.kind === NotificationKinds.TaskComplete
+ const severity = severityIcons[item.severity] ?? severityIcons.info
+ const Icon = complete ? CircleCheck : severity.icon
+
+ return (
+ <span
+ aria-hidden="true"
+ className={cn(
+ 'flex h-5 w-4 shrink-0 items-center justify-center',
+ complete ? 'text-muted-foreground' : severity.className
+ )}
+ >
+ <Icon className="size-4" strokeWidth={1.5} />
+ </span>
+ )
+}
diff --git a/src/renderer/routes/notifications/notifications-list.css b/src/renderer/routes/notifications/notifications-list.css
new file mode 100644
index 00000000..305bad6a
--- /dev/null
+++ b/src/renderer/routes/notifications/notifications-list.css
@@ -0,0 +1,70 @@
+.notification-list {
+ container-type: inline-size;
+ --notification-focus: #7388a3;
+ --notification-pressed: #e4ebf3;
+}
+.dark .notification-list {
+ --notification-focus: #97aac4;
+ --notification-pressed: #303d50;
+}
+.notification-row {
+ border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
+}
+.notification-row:last-child {
+ border-bottom: 0;
+}
+.notification-row:nth-child(even) {
+ background: color-mix(in srgb, var(--muted) 20%, transparent);
+}
+.notification-row:hover,
+.notification-row:focus-within {
+ background: color-mix(in srgb, var(--muted) 60%, transparent);
+}
+.notification-row-content {
+ display: grid;
+ grid-template-columns: 6px 16px minmax(0, 1fr) auto;
+ align-content: start;
+ gap: 10px;
+ min-height: 68px;
+ padding: 12px 4px 12px 12px;
+}
+/* Include row padding in the target; the remove button stays above it. */
+.notification-row-button::after {
+ position: absolute;
+ inset: 0;
+ content: "";
+}
+.notification-row:has(.notification-row-button:enabled:active) {
+ background: var(--notification-pressed);
+}
+.notification-row-button:focus-visible::after,
+.notification-row-remove:focus-visible {
+ outline: 1px solid var(--notification-focus);
+ outline-offset: -2px;
+}
+@container (width < 420px) {
+ .notification-row-content {
+ grid-template-columns: 6px 16px minmax(0, 1fr);
+ row-gap: 2px;
+ }
+ .notification-row-meta {
+ grid-column: 3;
+ flex-direction: row;
+ align-items: center;
+ justify-content: space-between;
+ gap: 10px;
+ }
+}
+@media (hover: none), (pointer: coarse) {
+ .notification-row-remove {
+ opacity: 1;
+ }
+}
+@media (forced-colors: active) {
+ .notification-list {
+ --notification-focus: Highlight;
+ }
+ .notification-row {
+ border-color: CanvasText;
+ }
+}
diff --git a/src/renderer/routes/notifications/notifications-page.test.tsx b/src/renderer/routes/notifications/notifications-page.test.tsx
index 8cd5f7cf..0d5c0ab9 100644
--- a/src/renderer/routes/notifications/notifications-page.test.tsx
+++ b/src/renderer/routes/notifications/notifications-page.test.tsx
@@ -1,11 +1,14 @@
+import '@test-utils/dom-animations'
import '@testing-library/jest-dom/vitest'
import '@renderer/lib/i18n'
+import { __resetTaskListStoreForTests } from '@renderer/hooks/use-task-list'
import { i18n } from '@renderer/lib/i18n'
import { transport } from '@renderer/lib/transport'
import { Commands } from '@shared/protocol/commands'
import { Events } from '@shared/protocol/events'
import { Queries } from '@shared/protocol/queries'
import type { AppNotification } from '@shared/types/notification'
+import { TaskStatus } from '@shared/types/task'
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react'
import { MemoryRouter, useLocation } from 'react-router'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
@@ -36,14 +39,24 @@ function notification(
}
}
-function mockList(items: AppNotification[]) {
- vi.mocked(transport.invoke).mockImplementation(async (ch: string) => {
- if (ch === Queries.ListNotifications) return items
- if (ch === Queries.GetUnreadNotificationCount) {
- return items.filter((it) => it.readAt === null).length
+function mockList(
+ items: AppNotification[],
+ taskIds = items.flatMap((item) => (item.taskId ? [item.taskId] : [])),
+ status = TaskStatus.Completed
+) {
+ const tasks = taskIds.map((id) => ({ id, status }))
+ vi.mocked(transport.invoke).mockImplementation(
+ async (ch: string, id: unknown) => {
+ if (ch === Queries.ListTasks) return tasks
+ if (ch === Queries.GetTaskDetail)
+ return tasks.find((task) => task.id === id) ?? null
+ if (ch === Queries.ListNotifications) return items
+ if (ch === Queries.GetUnreadNotificationCount) {
+ return items.filter((it) => it.readAt === null).length
+ }
+ return undefined
}
- return undefined
- })
+ )
}
let location = ''
@@ -64,9 +77,11 @@ function renderPage() {
describe('<NotificationsPage>', () => {
beforeEach(() => {
+ __resetTaskListStoreForTests()
location = ''
})
afterEach(async () => {
+ __resetTaskListStoreForTests()
vi.clearAllMocks()
// Restore the default locale so a later test file sharing this i18n
// singleton doesn't inherit zh-CN from a language-switch test elsewhere.
@@ -119,7 +134,7 @@ describe('<NotificationsPage>', () => {
expect(list.children).toHaveLength(2)
})
- it('labels the open button with the unread suffix for unread rows and the plain title for read rows', async () => {
+ it('labels the row button with the unread suffix for unread rows and the plain title for read rows', async () => {
mockList([
notification({ id: 'n1', readAt: null }),
notification({
@@ -139,8 +154,12 @@ describe('<NotificationsPage>', () => {
).toBeInTheDocument()
})
- it('marks read and navigates to the task on row click', async () => {
- mockList([notification({ id: 'n1', taskId: 't1' })])
+ it('opens an existing failed task and marks read when the row is clicked', async () => {
+ mockList(
+ [notification({ id: 'n1', taskId: 't1' })],
+ ['t1'],
+ TaskStatus.Error
+ )
renderPage()
const row = await screen.findByText('file.zip failed')
fireEvent.click(row)
@@ -151,6 +170,31 @@ describe('<NotificationsPage>', () => {
)
)
await waitFor(() => expect(location).toBe('/downloads/all?task=t1'))
+ expect(transport.invoke).toHaveBeenCalledWith(Queries.GetTaskDetail, 't1')
+ })
+
+ it('opens a completed task from the row without a separate action button', async () => {
+ mockList([
+ notification({
+ kind: 'task-complete',
+ severity: 'info',
+ titleKey: 'notification.taskComplete.title',
+ }),
+ ])
+ renderPage()
+ await screen.findByText('file.zip finished downloading')
+ expect(screen.queryByText('View task')).not.toBeInTheDocument()
+ fireEvent.click(
+ await screen.findByRole('button', {
+ name: 'file.zip finished downloading (unread)',
+ })
+ )
+ await waitFor(() => expect(location).toBe('/downloads/all?task=t1'))
+ expect(transport.invoke).toHaveBeenCalledWith(Queries.GetTaskDetail, 't1')
+ expect(transport.invoke).toHaveBeenCalledWith(
+ Commands.MarkNotificationRead,
+ 'n1'
+ )
})
it('does not navigate when the notification has no taskId', async () => {
@@ -178,6 +222,224 @@ describe('<NotificationsPage>', () => {
'n1'
)
)
+ expect(transport.invoke).not.toHaveBeenCalledWith(
+ Commands.MarkNotificationRead,
+ 'n1'
+ )
+ expect(transport.invoke).not.toHaveBeenCalledWith(
+ Queries.GetTaskDetail,
+ 't1'
+ )
+ expect(location).toBe('/notifications')
+ })
+
+ it('disables mark-all-read when every notification is already read', async () => {
+ mockList([notification({ readAt: Date.now() })])
+ renderPage()
+ await screen.findByText('file.zip failed')
+ expect(
+ screen.getByRole('button', { name: /mark all read/i })
+ ).toBeDisabled()
+ expect(screen.getByRole('button', { name: /^clear$/i })).toBeEnabled()
+ })
+
+ it('opens an already-read task without another read write', async () => {
+ mockList([notification({ readAt: Date.now(), taskId: 'task&other=1' })])
+ renderPage()
+ fireEvent.click(
+ await screen.findByRole('button', { name: 'file.zip failed' })
+ )
+ await waitFor(() =>
+ expect(location).toBe('/downloads/all?task=task%26other%3D1')
+ )
+ expect(transport.invoke).not.toHaveBeenCalledWith(
+ Commands.MarkNotificationRead,
+ 'n1'
+ )
+ })
+
+ it('marks a deleted task notification read without querying or navigating', async () => {
+ mockList([notification()], [])
+ renderPage()
+ expect(await screen.findByText('Task removed')).toBeInTheDocument()
+ expect(
+ screen.getByRole('button', { name: /^file.zip failed/ })
+ ).toHaveAttribute('title', 'Task removed')
+ fireEvent.click(screen.getByText('file.zip failed'))
+ await waitFor(() =>
+ expect(transport.invoke).toHaveBeenCalledWith(
+ Commands.MarkNotificationRead,
+ 'n1'
+ )
+ )
+ expect(location).toBe('/notifications')
+ expect(transport.invoke).not.toHaveBeenCalledWith(
+ Queries.GetTaskDetail,
+ 't1'
+ )
+ expect(transport.invoke).not.toHaveBeenCalledWith(
+ Commands.DeleteNotification,
+ 'n1'
+ )
+ })
+
+ it('stops navigating when a task is removed while the page is open', async () => {
+ mockList([notification()])
+ renderPage()
+ await screen.findByRole('button', { name: /^file.zip failed/ })
+ const listener = vi
+ .mocked(transport.on)
+ .mock.calls.find(([channel]) => channel === Events.TaskUpdated)?.[1]
+ act(() => listener?.([{ id: 't1', status: TaskStatus.Removed }]))
+ expect(await screen.findByText('Task removed')).toBeInTheDocument()
+ expect(
+ screen.getByRole('button', { name: /^file.zip failed/ })
+ ).toHaveAttribute('title', 'Task removed')
+ fireEvent.click(screen.getByText('file.zip failed'))
+ await waitFor(() =>
+ expect(transport.invoke).toHaveBeenCalledWith(
+ Commands.MarkNotificationRead,
+ 'n1'
+ )
+ )
+ expect(transport.invoke).not.toHaveBeenCalledWith(
+ Queries.GetTaskDetail,
+ 't1'
+ )
+ expect(location).toBe('/notifications')
+ })
+
+ it.each([null, { id: 't1', status: TaskStatus.Removed }])(
+ 'does not navigate when the fresh task check returns %s',
+ async (task) => {
+ mockList([notification({ readAt: Date.now() })])
+ renderPage()
+ const button = await screen.findByRole('button', {
+ name: /^file.zip failed/,
+ })
+ vi.mocked(transport.invoke).mockResolvedValueOnce(task)
+ fireEvent.click(button)
+ expect(await screen.findByText('Task removed')).toBeInTheDocument()
+ expect(location).toBe('/notifications')
+ expect(
+ screen.getByRole('button', { name: /^file.zip failed/ })
+ ).toBeDisabled()
+ }
+ )
+
+ it('allows retry after a failed task check without claiming the task was deleted', async () => {
+ mockList([notification({ readAt: Date.now() })])
+ renderPage()
+ const button = await screen.findByRole('button', {
+ name: /^file.zip failed/,
+ })
+ vi.mocked(transport.invoke).mockRejectedValueOnce(new Error('Disconnected'))
+ fireEvent.click(button)
+ expect(await screen.findByRole('alert')).toHaveTextContent(
+ 'Couldn’t open the task. Try again.'
+ )
+ expect(location).toBe('/notifications')
+ expect(screen.queryByText('Task removed')).not.toBeInTheDocument()
+ fireEvent.click(button)
+ await waitFor(() => expect(location).toBe('/downloads/all?task=t1'))
+ })
+
+ it('does not follow a stale task response after a removal event', async () => {
+ mockList([notification({ readAt: Date.now() })])
+ renderPage()
+ const button = await screen.findByRole('button', {
+ name: /^file.zip failed/,
+ })
+ let resolveTask!: (task: unknown) => void
+ vi.mocked(transport.invoke).mockReturnValueOnce(
+ new Promise((resolve) => {
+ resolveTask = resolve
+ })
+ )
+ fireEvent.click(button)
+ fireEvent.click(button)
+ const listener = vi
+ .mocked(transport.on)
+ .mock.calls.find(([channel]) => channel === Events.TaskUpdated)?.[1]
+ act(() => listener?.([]))
+ await act(async () =>
+ resolveTask({ id: 't1', status: TaskStatus.Completed })
+ )
+ expect(location).toBe('/notifications')
+ expect(screen.getByText('Task removed')).toBeInTheDocument()
+ expect(
+ vi
+ .mocked(transport.invoke)
+ .mock.calls.filter(([channel]) => channel === Queries.GetTaskDetail)
+ ).toHaveLength(1)
+ })
+
+ it('checks the task on row click if the task list could not be loaded', async () => {
+ mockList([notification({ readAt: Date.now() })])
+ const invoke = vi.mocked(transport.invoke).getMockImplementation()!
+ vi.mocked(transport.invoke).mockImplementation((channel, ...args) =>
+ channel === Queries.ListTasks
+ ? Promise.reject(new Error('Disconnected'))
+ : invoke(channel, ...args)
+ )
+ renderPage()
+ const button = await screen.findByRole('button', {
+ name: /^file.zip failed/,
+ })
+ expect(screen.queryByText('Task removed')).not.toBeInTheDocument()
+ fireEvent.click(button)
+ await waitFor(() => expect(location).toBe('/downloads/all?task=t1'))
+ })
+
+ it('does not navigate after leaving the notification page during a task check', async () => {
+ mockList([notification({ readAt: Date.now() })])
+ const view = renderPage()
+ const button = await screen.findByRole('button', {
+ name: /^file.zip failed/,
+ })
+ let resolveTask!: (task: unknown) => void
+ vi.mocked(transport.invoke).mockReturnValueOnce(
+ new Promise((resolve) => {
+ resolveTask = resolve
+ })
+ )
+ fireEvent.click(button)
+ view.rerender(
+ <MemoryRouter initialEntries={['/notifications']}>
+ <LocationSpy />
+ </MemoryRouter>
+ )
+ await act(async () =>
+ resolveTask({ id: 't1', status: TaskStatus.Completed })
+ )
+ expect(location).toBe('/notifications')
+ })
+
+ it('keeps a failed deletion visible and allows retrying it', async () => {
+ mockList([notification()])
+ renderPage()
+ await screen.findByText('file.zip failed')
+ vi.mocked(transport.invoke).mockRejectedValueOnce(new Error('Disconnected'))
+ fireEvent.click(
+ screen.getByRole('button', { name: 'Remove file.zip failed' })
+ )
+ expect(await screen.findByRole('alert')).toHaveTextContent(
+ 'Couldn’t update notifications. Try again.'
+ )
+ expect(screen.getByText('file.zip failed')).toBeInTheDocument()
+ fireEvent.click(
+ screen.getByRole('button', { name: 'Remove file.zip failed' })
+ )
+ await waitFor(() =>
+ expect(screen.queryByRole('alert')).not.toBeInTheDocument()
+ )
+ expect(
+ vi
+ .mocked(transport.invoke)
+ .mock.calls.filter(
+ ([channel]) => channel === Commands.DeleteNotification
+ )
+ ).toHaveLength(2)
})
it('mark-all-read and clear invoke their commands', async () => {
diff --git a/src/renderer/routes/notifications/notifications-page.tsx b/src/renderer/routes/notifications/notifications-page.tsx
index 5e29bcdf..9ba77954 100644
--- a/src/renderer/routes/notifications/notifications-page.tsx
+++ b/src/renderer/routes/notifications/notifications-page.tsx
@@ -1,6 +1,15 @@
+import {
+ ScrollArea,
+ ScrollAreaContent,
+ ScrollAreaViewport,
+ ScrollBar,
+} from '@renderer/components/ui/scroll-area'
+import './notifications-list.css'
import { PanelShell } from '@renderer/components/desktop-kit/panel/panel-shell'
+import { Toolbar } from '@renderer/components/desktop-kit/toolbar/toolbar'
+import { ToolbarButton } from '@renderer/components/desktop-kit/toolbar/toolbar-button'
+import { ToolbarGroup } from '@renderer/components/desktop-kit/toolbar/toolbar-group'
import { useNotifications } from '@renderer/components/notification-center/use-notifications'
-import { Button } from '@renderer/components/ui/button'
import {
Empty,
EmptyDescription,
@@ -8,35 +17,41 @@ import {
EmptyMedia,
EmptyTitle,
} from '@renderer/components/ui/empty'
-import { SEVERITY_ICONS } from '@renderer/components/ui/severity-icons'
import { useMinuteClock } from '@renderer/hooks/use-minute-clock'
+import { getTaskListSnapshot, useTaskList } from '@renderer/hooks/use-task-list'
import { resolveNotificationText } from '@renderer/lib/notification-text'
import { formatRelativeTime } from '@renderer/lib/relative-time'
+import { transport } from '@renderer/lib/transport'
import { cn } from '@renderer/lib/utils'
+import { Queries } from '@shared/protocol/queries'
import type { AppNotification } from '@shared/types/notification'
-import { BellOff, Trash2 } from 'lucide-react'
+import { type DownloadTask, TaskStatus } from '@shared/types/task'
+import { Bell, CheckCheck, Trash2 } from 'lucide-react'
+import { useEffect, useId, useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useNavigate } from 'react-router'
+import { NotificationIcon } from './notification-icon'
function NotificationRow({
item,
now,
+ onRead,
onOpen,
onDelete,
+ busy,
+ taskMissing,
}: {
item: AppNotification
now: number
+ onRead: () => void
onOpen: () => void
onDelete: () => void
+ busy: boolean
+ taskMissing: boolean
}) {
const { t, i18n } = useTranslation()
- // item.severity is DB-sourced and the store cast is unchecked (see
- // resolveNotificationText's docstring in `@renderer/lib/notification-text`
- // for the sibling gap on titleKey/bodyKey) — a tampered row with an
- // out-of-set severity must fall back rather than crash the whole
- // renderer (no page ErrorBoundary wraps this list).
- const meta = SEVERITY_ICONS[item.severity] ?? SEVERITY_ICONS.info
- const Icon = meta.icon
+ const descriptionId = useId()
+ const statusId = useId()
const title = resolveNotificationText(
item.titleKey,
item.titleParams,
@@ -48,143 +63,263 @@ function NotificationRow({
? resolveNotificationText(item.bodyKey, item.bodyParams, t, i18n.exists)
: null
const unread = item.readAt === null
+ const canOpen = item.taskId != null && !taskMissing
+ const validDate =
+ Number.isFinite(item.createdAt) &&
+ item.createdAt > 0 &&
+ item.createdAt <= 8.64e15
+ const date = validDate ? new Date(item.createdAt) : null
return (
- // biome-ignore lint/a11y/useSemanticElements: pairs with the role="list" container in NotificationsPage, which can't be a native <ul> because it also renders the non-list <Empty> state.
- <div
- role="listitem"
- className="group relative flex w-full border-b border-border last:border-b-0 hover:bg-accent"
- >
+ <li className="notification-row group relative isolate flex w-full items-start">
<button
type="button"
aria-label={
unread ? t('notification.center.rowUnreadAria', { title }) : title
}
- onClick={onOpen}
- className="flex min-w-0 flex-1 items-start gap-2 px-3 py-2 text-left"
+ aria-describedby={
+ [body ? descriptionId : null, taskMissing ? statusId : null]
+ .filter(Boolean)
+ .join(' ') || undefined
+ }
+ title={
+ canOpen
+ ? t('notification.center.viewTask')
+ : taskMissing
+ ? t('notification.center.taskRemoved')
+ : unread
+ ? t('notification.center.markRead')
+ : undefined
+ }
+ disabled={busy || (!canOpen && !unread)}
+ onClick={canOpen ? onOpen : onRead}
+ className="notification-row-button notification-row-content min-w-0 flex-1 text-left outline-none"
>
- <Icon className={cn('mt-0.5 size-4 shrink-0', meta.iconClassName)} />
- <div className="flex min-w-0 flex-1 flex-col gap-0.5">
- <div className="flex items-center gap-1.5">
- {unread && (
- <span
- aria-hidden="true"
- className="size-1.5 shrink-0 rounded-full bg-primary"
- />
+ <span
+ aria-hidden="true"
+ className={cn(
+ 'mt-[7px] size-1.5 rounded-full',
+ unread && 'bg-sky-600 dark:bg-sky-400'
+ )}
+ />
+ <NotificationIcon item={item} />
+ <span className="flex min-w-0 flex-col gap-1">
+ <span
+ className={cn(
+ 'text-[13px]/5 text-foreground [overflow-wrap:anywhere]',
+ unread ? 'font-semibold' : 'font-normal'
)}
- <span className="truncate text-sm font-medium text-foreground">
- {title}
- </span>
- </div>
+ >
+ {title}
+ </span>
{body && (
- <span className="truncate text-xs text-muted-foreground">
+ <span
+ id={descriptionId}
+ className="whitespace-pre-wrap text-xs/5 text-muted-foreground [overflow-wrap:anywhere]"
+ >
{body}
</span>
)}
- <span className="text-[11px] text-muted-foreground">
+ </span>
+ <span className="notification-row-meta flex flex-col items-end gap-1">
+ <time
+ dateTime={date?.toISOString()}
+ title={date?.toLocaleString(i18n.language)}
+ className="whitespace-nowrap text-[11px]/5 tabular-nums text-muted-foreground"
+ >
{formatRelativeTime(item.createdAt, now, i18n.language)}
- </span>
- </div>
- </button>
- <button
- type="button"
- aria-label={t('common.remove')}
- onClick={onDelete}
- className="absolute top-2 right-2 shrink-0 rounded-md p-1 text-muted-foreground opacity-0 hover:bg-accent hover:text-foreground group-hover:opacity-100 group-focus-within:opacity-100"
- >
- <Trash2 className="size-3.5" />
+ </time>
+ {taskMissing && (
+ <span
+ id={statusId}
+ className="whitespace-nowrap text-[11px]/5 text-muted-foreground"
+ >
+ {t('notification.center.taskRemoved')}
+ </span>
+ )}
+ </span>
</button>
- </div>
+ <div className="flex w-9 shrink-0 justify-center pt-2">
+ <button
+ type="button"
+ aria-label={t('notification.center.removeAria', { title })}
+ title={t('common.remove')}
+ disabled={busy}
+ onClick={onDelete}
+ className="notification-row-remove relative z-10 flex size-7 items-center justify-center rounded-md text-muted-foreground opacity-0 outline-none hover:bg-accent hover:text-destructive group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100"
+ >
+ <Trash2 aria-hidden="true" className="size-3.5" />
+ </button>
+ </div>
+ </li>
)
}
-/**
- * Dedicated notification center page (Task 17R rework, 2026-08-04 —
- * supersedes the Task 17 Popover design per user decision). Mirrors
- * `TrackersPage`/`PluginsPage`'s `PanelShell` skeleton: header actions are
- * mark-all-read + clear, content is a single `overflow-auto` region per
- * `panel-layout.md` (no `max-h-80` — the page fills the inset). Rows are
- * ported verbatim from the retired `NotificationPanel`. Runs its own
- * `useNotifications()` instance, independent of the sidebar's badge — the
- * page only mounts when routed, so there is no double-fetch while it's
- * off-screen. `useMinuteClock()` (shared with `TasksTile`) ticks each row's
- * relative timestamp forward once a minute instead of freezing at the value
- * read when the row first mounted.
- */
export function NotificationsPage() {
const { t } = useTranslation()
const navigate = useNavigate()
- const { items, markRead, markAllRead, remove, clear } = useNotifications()
+ const { items, unreadCount, markRead, markAllRead, remove, clear } =
+ useNotifications()
const now = useMinuteClock()
+ const { tasks, status: taskListStatus } = useTaskList()
+ const availableTaskIds = useMemo(
+ () =>
+ new Set(
+ tasks
+ .filter((task) => task.status !== TaskStatus.Removed)
+ .map((task) => task.id)
+ ),
+ [tasks]
+ )
+ const [missingTaskIds, setMissingTaskIds] = useState(new Set<string>())
const hasItems = items.length > 0
+ const pending = useRef(false)
+ const [busy, setBusy] = useState(false)
+ const [failureKey, setFailureKey] = useState<string | null>(null)
+ const mounted = useRef(true)
+
+ useEffect(() => {
+ mounted.current = true
+ return () => {
+ mounted.current = false
+ }
+ }, [])
+
+ const runAction = async (
+ action: () => Promise<void>,
+ errorKey = 'notification.center.actionFailed'
+ ) => {
+ if (pending.current) return
+ pending.current = true
+ setBusy(true)
+ setFailureKey(null)
+ try {
+ await action()
+ } catch {
+ if (mounted.current) setFailureKey(errorKey)
+ } finally {
+ pending.current = false
+ if (mounted.current) setBusy(false)
+ }
+ }
+
+ const openTask = (item: AppNotification) =>
+ runAction(async () => {
+ const taskId = item.taskId
+ if (taskId == null) return
+ if (item.readAt === null) await markRead(item.id)
+ if (!mounted.current) return
+ const revision = getTaskListSnapshot().revision
+ const task = (await transport.invoke(
+ Queries.GetTaskDetail,
+ taskId
+ )) as DownloadTask | null
+ if (!mounted.current) return
+ const latest = getTaskListSnapshot()
+ const removedDuringCheck =
+ latest.revision !== revision &&
+ latest.status === 'ready' &&
+ !latest.tasks.some(
+ (candidate) =>
+ candidate.id === taskId && candidate.status !== TaskStatus.Removed
+ )
+ if (
+ task == null ||
+ task.status === TaskStatus.Removed ||
+ removedDuringCheck
+ ) {
+ setMissingTaskIds((ids) => new Set(ids).add(taskId))
+ return
+ }
+ navigate(`/downloads/all?task=${encodeURIComponent(taskId)}`)
+ }, 'notification.center.openTaskFailed')
return (
<PanelShell
title={t('notification.center.title')}
actions={
- <div className="flex gap-1">
- <Button
- type="button"
- variant="ghost"
- size="sm"
- disabled={!hasItems}
- onClick={() => void markAllRead()}
- >
- {t('notification.center.markAllRead')}
- </Button>
- <Button
- type="button"
- variant="ghost"
- size="sm"
- disabled={!hasItems}
- onClick={() => void clear()}
- >
- {t('notification.center.clearAll')}
- </Button>
- </div>
+ <Toolbar
+ label={t('notification.center.title')}
+ data-slot="notifications-toolbar"
+ >
+ <ToolbarGroup>
+ <ToolbarButton
+ label={t('notification.center.markAllRead')}
+ disabled={unreadCount === 0 || busy}
+ onClick={() => void runAction(markAllRead)}
+ >
+ <CheckCheck aria-hidden="true" />
+ </ToolbarButton>
+ <ToolbarButton
+ label={t('notification.center.clearAll')}
+ disabled={!hasItems || busy}
+ onClick={() => void runAction(clear)}
+ >
+ <Trash2 aria-hidden="true" />
+ </ToolbarButton>
+ </ToolbarGroup>
+ </Toolbar>
}
contentClassName="px-6 pb-6"
>
- {/* This is the single scroll region from panel-layout.md's
- height-chain pattern; it renders the non-list <Empty> state when
- there are no notifications, so `role` only claims "list" once
- there's actually a list to announce — it can't be a native <ul>
- either way. */}
- <div
- role={hasItems ? 'list' : undefined}
- className="flex min-h-0 flex-1 flex-col overflow-auto rounded-md border border-border"
- >
- {hasItems ? (
- items.map((item) => (
- <NotificationRow
- key={item.id}
- item={item}
- now={now}
- onOpen={() => {
- void markRead(item.id)
- if (item.taskId != null) {
- navigate(`/downloads/all?task=${item.taskId}`)
- }
- }}
- onDelete={() => void remove(item.id)}
- />
- ))
- ) : (
- <Empty className="gap-1 px-4 py-8">
- <EmptyHeader className="gap-1">
- <EmptyMedia className="mb-1 text-muted-foreground [&_svg]:size-8">
- <BellOff />
- </EmptyMedia>
- <EmptyTitle className="font-sans text-sm font-medium tracking-normal">
- {t('notification.center.empty')}
- </EmptyTitle>
- <EmptyDescription className="text-xs/normal">
- {t('notification.center.emptyDesc')}
- </EmptyDescription>
- </EmptyHeader>
- </Empty>
+ {failureKey && (
+ <p role="alert" className="shrink-0 pb-3 text-xs text-destructive">
+ {t(failureKey)}
+ </p>
+ )}
+ <ScrollArea
+ className={cn(
+ 'notification-list min-h-0 flex-1 flex min-w-0 flex-col rounded-md',
+ hasItems && 'border border-border'
)}
- </div>
+ >
+ <ScrollAreaViewport className="min-h-0 flex-1 overscroll-contain">
+ <ScrollAreaContent
+ className="flex min-h-full flex-col"
+ style={{ minWidth: '100%' }}
+ >
+ {hasItems ? (
+ <ul aria-label={t('notification.center.title')}>
+ {items.map((item) => (
+ <NotificationRow
+ key={item.id}
+ item={item}
+ now={now}
+ busy={busy}
+ taskMissing={
+ item.taskId != null &&
+ (missingTaskIds.has(item.taskId) ||
+ (taskListStatus === 'ready' &&
+ !availableTaskIds.has(item.taskId)))
+ }
+ onRead={() => {
+ if (item.readAt === null)
+ void runAction(() => markRead(item.id))
+ }}
+ onOpen={() => void openTask(item)}
+ onDelete={() => void runAction(() => remove(item.id))}
+ />
+ ))}
+ </ul>
+ ) : (
+ <Empty className="flex-1 gap-1 px-4 py-8">
+ <EmptyHeader className="gap-1">
+ <EmptyMedia className="mb-2 size-12 rounded-2xl bg-black/5 text-muted-foreground dark:bg-white/8 [&_svg]:size-6">
+ <Bell strokeWidth={1.5} />
+ </EmptyMedia>
+ <EmptyTitle className="font-sans text-sm font-medium tracking-normal">
+ {t('notification.center.empty')}
+ </EmptyTitle>
+ <EmptyDescription className="text-xs/normal">
+ {t('notification.center.emptyDesc')}
+ </EmptyDescription>
+ </EmptyHeader>
+ </Empty>
+ )}
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ </ScrollArea>
</PanelShell>
)
}
diff --git a/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-inspector.test.tsx b/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-inspector.test.tsx
index 5ad53d0d..3091ed79 100644
--- a/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-inspector.test.tsx
+++ b/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-inspector.test.tsx
@@ -1,3 +1,4 @@
+import '@test-utils/dom-animations'
import '@testing-library/jest-dom/vitest'
import { cleanup, render, screen, within } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
@@ -521,8 +522,10 @@ describe('PluginCallGraphInspector', () => {
name: strings.inspectorLabel,
})
- expect(inspector).toHaveClass('min-h-0', 'overflow-auto')
- expect(container.querySelectorAll('.overflow-auto')).toHaveLength(1)
+ expect(inspector).toHaveClass('min-h-0')
+ expect(
+ container.querySelectorAll('[data-slot="scroll-area-viewport"]')
+ ).toHaveLength(1)
expect(inspector.className).not.toContain('360')
})
})
diff --git a/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-inspector.tsx b/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-inspector.tsx
index f62a702a..aa9ae084 100644
--- a/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-inspector.tsx
+++ b/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-inspector.tsx
@@ -1,4 +1,10 @@
import { Button } from '@renderer/components/ui/button'
+import {
+ ScrollArea,
+ ScrollAreaContent,
+ ScrollAreaViewport,
+ ScrollBar,
+} from '@renderer/components/ui/scroll-area'
import { useNavigate } from 'react-router'
import type {
CallGraphModel,
@@ -131,160 +137,169 @@ export function PluginCallGraphInspector({
: []
return (
- <aside
+ <ScrollArea
+ className="flex min-h-0 min-w-0 flex-1 flex-col rounded-md border border-border bg-card"
+ render={<aside />}
+ role="complementary"
aria-label={strings.inspectorLabel}
- className="min-h-0 overflow-auto rounded-md border border-border bg-card p-4"
>
- {!currentSelection && (
- <div className="space-y-2">
- <h2 className="text-sm font-semibold">{strings.scopeTitle}</h2>
- <p className="text-xs leading-relaxed text-muted-foreground">
- {strings.neutralScope}
- </p>
- </div>
- )}
-
- {currentSelection?.type === 'node' && (
- <div className="space-y-4">
- <div className="space-y-1">
- <h2 className="text-sm font-semibold">
- {currentSelection.node.name}
- </h2>
- </div>
-
- <dl className="space-y-2">
- <div className="flex items-baseline justify-between gap-4">
- <dt className="text-xs text-muted-foreground">
- {strings.pluginId}
- </dt>
- <dd>
- <Identifier value={currentSelection.node.id} />
- </dd>
- </div>
- <div className="flex items-baseline justify-between gap-4">
- <dt className="text-xs text-muted-foreground">
- {strings.status}
- </dt>
- <dd className="text-sm">
- {strings.statuses[currentSelection.node.status]}
- </dd>
+ <ScrollAreaViewport className="min-h-0 flex-1 overscroll-contain">
+ <ScrollAreaContent className="p-4" style={{ minWidth: '100%' }}>
+ {!currentSelection && (
+ <div className="space-y-2">
+ <h2 className="text-sm font-semibold">{strings.scopeTitle}</h2>
+ <p className="text-xs leading-relaxed text-muted-foreground">
+ {strings.neutralScope}
+ </p>
</div>
- <Metric
- label={strings.incomingCalls}
- value={currentSelection.node.incomingCalls}
- />
- <Metric
- label={strings.outgoingCalls}
- value={currentSelection.node.outgoingCalls}
- />
- </dl>
+ )}
- <div className="space-y-2">
- <h3 className="text-xs font-medium text-muted-foreground">
- {strings.connections}
- </h3>
- {connections.length === 0 ? (
- <p className="text-xs text-muted-foreground">
- {strings.noConnections}
- </p>
- ) : (
- <ul aria-label={strings.connections} className="space-y-2">
- {connections.map((connection) => (
- <li
- key={connection.id}
- className="flex items-start justify-between gap-3 text-xs"
- >
- <span className="min-w-0">
- <span className="block font-medium">
- {connection.name}
- </span>
- <Identifier value={connection.id} />
- </span>
- <span className="shrink-0 text-right tabular-nums text-muted-foreground">
- {strings.callsLabel(connection.calls)}
- </span>
- </li>
- ))}
- </ul>
- )}
- </div>
+ {currentSelection?.type === 'node' && (
+ <div className="space-y-4">
+ <div className="space-y-1">
+ <h2 className="text-sm font-semibold">
+ {currentSelection.node.name}
+ </h2>
+ </div>
- {currentSelection.node.installed && (
- <Button
- type="button"
- size="sm"
- onClick={() =>
- navigate(
- `/plugins/${encodeURIComponent(currentSelection.node.id)}`
- )
- }
- >
- {strings.openPlugin}
- </Button>
- )}
- </div>
- )}
+ <dl className="space-y-2">
+ <div className="flex items-baseline justify-between gap-4">
+ <dt className="text-xs text-muted-foreground">
+ {strings.pluginId}
+ </dt>
+ <dd>
+ <Identifier value={currentSelection.node.id} />
+ </dd>
+ </div>
+ <div className="flex items-baseline justify-between gap-4">
+ <dt className="text-xs text-muted-foreground">
+ {strings.status}
+ </dt>
+ <dd className="text-sm">
+ {strings.statuses[currentSelection.node.status]}
+ </dd>
+ </div>
+ <Metric
+ label={strings.incomingCalls}
+ value={currentSelection.node.incomingCalls}
+ />
+ <Metric
+ label={strings.outgoingCalls}
+ value={currentSelection.node.outgoingCalls}
+ />
+ </dl>
- {currentSelection?.type === 'edge' && (
- <div className="space-y-4">
- <h2 className="text-sm font-semibold">{strings.edgeTitle}</h2>
- <dl className="space-y-2">
- <div className="flex items-baseline justify-between gap-4">
- <dt className="text-xs text-muted-foreground">
- {strings.caller}
- </dt>
- <dd>
- <Identifier value={currentSelection.edge.source} />
- </dd>
- </div>
- <div className="flex items-baseline justify-between gap-4">
- <dt className="text-xs text-muted-foreground">
- {strings.callee}
- </dt>
- <dd>
- <Identifier value={currentSelection.edge.target} />
- </dd>
- </div>
- <Metric
- label={strings.totalCalls}
- value={currentSelection.edge.totalCalls}
- />
- <div className="flex items-baseline justify-between gap-4">
- <dt className="text-xs text-muted-foreground">
- {strings.lastCall}
- </dt>
- <dd className="text-right text-xs">
- <time
- dateTime={new Date(
- currentSelection.edge.lastCalledAt
- ).toISOString()}
+ <div className="space-y-2">
+ <h3 className="text-xs font-medium text-muted-foreground">
+ {strings.connections}
+ </h3>
+ {connections.length === 0 ? (
+ <p className="text-xs text-muted-foreground">
+ {strings.noConnections}
+ </p>
+ ) : (
+ <ul aria-label={strings.connections} className="space-y-2">
+ {connections.map((connection) => (
+ <li
+ key={connection.id}
+ className="flex items-start justify-between gap-3 text-xs"
+ >
+ <span className="min-w-0">
+ <span className="block font-medium">
+ {connection.name}
+ </span>
+ <Identifier value={connection.id} />
+ </span>
+ <span className="shrink-0 text-right tabular-nums text-muted-foreground">
+ {strings.callsLabel(connection.calls)}
+ </span>
+ </li>
+ ))}
+ </ul>
+ )}
+ </div>
+
+ {currentSelection.node.installed && (
+ <Button
+ type="button"
+ size="sm"
+ onClick={() =>
+ navigate(
+ `/plugins/${encodeURIComponent(currentSelection.node.id)}`
+ )
+ }
>
- {strings.formatLastCall(currentSelection.edge.lastCalledAt)}
- </time>
- </dd>
+ {strings.openPlugin}
+ </Button>
+ )}
</div>
- </dl>
+ )}
- <div className="space-y-2">
- <h3 className="text-xs font-medium text-muted-foreground">
- {strings.commands}
- </h3>
- <ul aria-label={strings.commands} className="space-y-2">
- {currentSelection.edge.commands.map((command) => (
- <li
- key={command.commandId}
- className="flex items-start justify-between gap-3 text-xs"
- >
- <Identifier value={command.commandId} />
- <span className="shrink-0 text-right tabular-nums text-muted-foreground">
- {strings.callsLabel(command.calls)}
- </span>
- </li>
- ))}
- </ul>
- </div>
- </div>
- )}
- </aside>
+ {currentSelection?.type === 'edge' && (
+ <div className="space-y-4">
+ <h2 className="text-sm font-semibold">{strings.edgeTitle}</h2>
+ <dl className="space-y-2">
+ <div className="flex items-baseline justify-between gap-4">
+ <dt className="text-xs text-muted-foreground">
+ {strings.caller}
+ </dt>
+ <dd>
+ <Identifier value={currentSelection.edge.source} />
+ </dd>
+ </div>
+ <div className="flex items-baseline justify-between gap-4">
+ <dt className="text-xs text-muted-foreground">
+ {strings.callee}
+ </dt>
+ <dd>
+ <Identifier value={currentSelection.edge.target} />
+ </dd>
+ </div>
+ <Metric
+ label={strings.totalCalls}
+ value={currentSelection.edge.totalCalls}
+ />
+ <div className="flex items-baseline justify-between gap-4">
+ <dt className="text-xs text-muted-foreground">
+ {strings.lastCall}
+ </dt>
+ <dd className="text-right text-xs">
+ <time
+ dateTime={new Date(
+ currentSelection.edge.lastCalledAt
+ ).toISOString()}
+ >
+ {strings.formatLastCall(
+ currentSelection.edge.lastCalledAt
+ )}
+ </time>
+ </dd>
+ </div>
+ </dl>
+
+ <div className="space-y-2">
+ <h3 className="text-xs font-medium text-muted-foreground">
+ {strings.commands}
+ </h3>
+ <ul aria-label={strings.commands} className="space-y-2">
+ {currentSelection.edge.commands.map((command) => (
+ <li
+ key={command.commandId}
+ className="flex items-start justify-between gap-3 text-xs"
+ >
+ <Identifier value={command.commandId} />
+ <span className="shrink-0 text-right tabular-nums text-muted-foreground">
+ {strings.callsLabel(command.calls)}
+ </span>
+ </li>
+ ))}
+ </ul>
+ </div>
+ </div>
+ )}
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ </ScrollArea>
)
}
diff --git a/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-table.test.tsx b/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-table.test.tsx
index 36a8c8ea..73a0b0fa 100644
--- a/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-table.test.tsx
+++ b/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-table.test.tsx
@@ -1,3 +1,4 @@
+import '@test-utils/dom-animations'
import '@testing-library/jest-dom/vitest'
import { cleanup, render, screen, within } from '@testing-library/react'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
@@ -142,8 +143,10 @@ describe('PluginCallGraphTable', () => {
const region = screen.getByRole('region', {
name: strings.tableRegionLabel,
})
- expect(region).toHaveClass('min-h-0', 'flex-1', 'overflow-auto')
- expect(container.querySelectorAll('.overflow-auto')).toHaveLength(1)
+ expect(region).toHaveClass('min-h-0', 'flex-1')
+ expect(
+ container.querySelectorAll('[data-slot="scroll-area-viewport"]')
+ ).toHaveLength(1)
expect(region.querySelector('thead')).toHaveClass(
'sticky',
'top-0',
diff --git a/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-table.tsx b/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-table.tsx
index 8847ca32..51ab521e 100644
--- a/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-table.tsx
+++ b/src/renderer/routes/plugins/components/call-graph/plugin-call-graph-table.tsx
@@ -1,3 +1,9 @@
+import {
+ ScrollArea,
+ ScrollAreaContent,
+ ScrollAreaViewport,
+ ScrollBar,
+} from '@renderer/components/ui/scroll-area'
import type { CallGraphTableRow } from '../../lib/call-graph-model'
export interface PluginCallGraphTableStrings {
@@ -39,94 +45,102 @@ export function PluginCallGraphTable({
strings,
}: PluginCallGraphTableProps) {
return (
- <section
+ <ScrollArea
+ className="flex min-h-0 min-w-0 flex-1 flex-col rounded-md border border-border"
+ render={<section />}
+ role="region"
aria-label={strings.tableRegionLabel}
- className="flex min-h-0 flex-1 overflow-auto rounded-md border border-border"
>
- <table className="min-w-full border-separate border-spacing-0 text-left">
- <caption className="sr-only">{strings.tableLabel}</caption>
- <thead className="sticky top-0 z-10 bg-background">
- <tr>
- <th
- scope="col"
- className="border-b border-border px-3 py-2 text-xs font-medium text-muted-foreground"
- >
- {strings.caller}
- </th>
- <th
- scope="col"
- className="border-b border-border px-3 py-2 text-xs font-medium text-muted-foreground"
- >
- {strings.command}
- </th>
- <th
- scope="col"
- className="border-b border-border px-3 py-2 text-xs font-medium text-muted-foreground"
- >
- {strings.callee}
- </th>
- <th
- scope="col"
- className="border-b border-border px-3 py-2 text-right text-xs font-medium text-muted-foreground"
- >
- {strings.calls}
- </th>
- <th
- scope="col"
- className="border-b border-border px-3 py-2 text-right text-xs font-medium text-muted-foreground"
- >
- {strings.lastCall}
- </th>
- </tr>
- </thead>
- <tbody>
- {rows.length === 0 ? (
- <tr>
- <td
- colSpan={5}
- className="px-3 py-8 text-center text-sm text-muted-foreground"
- >
- {strings.filteredEmpty}
- </td>
- </tr>
- ) : (
- rows.map((row) => (
- <tr
- key={JSON.stringify([
- row.sourcePluginId,
- row.targetPluginId,
- row.commandId,
- ])}
- className="align-top"
- >
- <td className="border-b border-border px-3 py-2.5">
- <PluginIdentity
- name={row.sourcePluginName}
- id={row.sourcePluginId}
- />
- </td>
- <td className="border-b border-border px-3 py-2.5">
- <Identifier value={row.commandId} />
- </td>
- <td className="border-b border-border px-3 py-2.5">
- <PluginIdentity
- name={row.targetPluginName}
- id={row.targetPluginId}
- />
- </td>
- <td className="border-b border-border px-3 py-2.5 text-right text-sm tabular-nums">
- {row.calls}
- </td>
- <td className="border-b border-border px-3 py-2.5 text-right text-xs whitespace-nowrap tabular-nums text-muted-foreground">
- <time dateTime={new Date(row.lastCalledAt).toISOString()}>
- {strings.formatLastCall(row.lastCalledAt)}
- </time>
- </td>
+ <ScrollAreaViewport className="min-h-0 flex-1 overscroll-contain">
+ <ScrollAreaContent style={{ minWidth: '100%' }}>
+ <table className="min-w-full border-separate border-spacing-0 text-left">
+ <caption className="sr-only">{strings.tableLabel}</caption>
+ <thead className="sticky top-0 z-10 bg-background">
+ <tr>
+ <th
+ scope="col"
+ className="border-b border-border px-3 py-2 text-xs font-medium text-muted-foreground"
+ >
+ {strings.caller}
+ </th>
+ <th
+ scope="col"
+ className="border-b border-border px-3 py-2 text-xs font-medium text-muted-foreground"
+ >
+ {strings.command}
+ </th>
+ <th
+ scope="col"
+ className="border-b border-border px-3 py-2 text-xs font-medium text-muted-foreground"
+ >
+ {strings.callee}
+ </th>
+ <th
+ scope="col"
+ className="border-b border-border px-3 py-2 text-right text-xs font-medium text-muted-foreground"
+ >
+ {strings.calls}
+ </th>
+ <th
+ scope="col"
+ className="border-b border-border px-3 py-2 text-right text-xs font-medium text-muted-foreground"
+ >
+ {strings.lastCall}
+ </th>
</tr>
- ))
- )}
- </tbody>
- </table>
- </section>
+ </thead>
+ <tbody>
+ {rows.length === 0 ? (
+ <tr>
+ <td
+ colSpan={5}
+ className="px-3 py-8 text-center text-sm text-muted-foreground"
+ >
+ {strings.filteredEmpty}
+ </td>
+ </tr>
+ ) : (
+ rows.map((row) => (
+ <tr
+ key={JSON.stringify([
+ row.sourcePluginId,
+ row.targetPluginId,
+ row.commandId,
+ ])}
+ className="align-top"
+ >
+ <td className="border-b border-border px-3 py-2.5">
+ <PluginIdentity
+ name={row.sourcePluginName}
+ id={row.sourcePluginId}
+ />
+ </td>
+ <td className="border-b border-border px-3 py-2.5">
+ <Identifier value={row.commandId} />
+ </td>
+ <td className="border-b border-border px-3 py-2.5">
+ <PluginIdentity
+ name={row.targetPluginName}
+ id={row.targetPluginId}
+ />
+ </td>
+ <td className="border-b border-border px-3 py-2.5 text-right text-sm tabular-nums">
+ {row.calls}
+ </td>
+ <td className="border-b border-border px-3 py-2.5 text-right text-xs whitespace-nowrap tabular-nums text-muted-foreground">
+ <time dateTime={new Date(row.lastCalledAt).toISOString()}>
+ {strings.formatLastCall(row.lastCalledAt)}
+ </time>
+ </td>
+ </tr>
+ ))
+ )}
+ </tbody>
+ </table>
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ <ScrollBar orientation="horizontal" />
+ </ScrollArea>
)
}
diff --git a/src/renderer/routes/plugins/components/plugin-log-tab.tsx b/src/renderer/routes/plugins/components/plugin-log-tab.tsx
index 8e81a61a..f193b3f2 100644
--- a/src/renderer/routes/plugins/components/plugin-log-tab.tsx
+++ b/src/renderer/routes/plugins/components/plugin-log-tab.tsx
@@ -1,5 +1,11 @@
import { CopyButton } from '@renderer/components/desktop-kit/copy-button'
import { Button } from '@renderer/components/ui/button'
+import {
+ ScrollArea,
+ ScrollAreaContent,
+ ScrollAreaViewport,
+ ScrollBar,
+} from '@renderer/components/ui/scroll-area'
import {
Select,
SelectContent,
@@ -146,29 +152,38 @@ export function PluginLogTab({ pluginId }: { pluginId: string }) {
</span>
</div>
- <div className="min-h-0 flex-1 overflow-auto">
- {filtered.length === 0 ? (
- <div className="flex min-h-full flex-col items-center justify-center gap-2 px-6 py-12 text-center">
- <div className="mb-1 flex size-10 items-center justify-center rounded-xl border border-border/60 bg-background/80 shadow-xs">
- <TerminalSquare className="size-4.5 text-muted-foreground" />
- </div>
- <p className="text-sm font-medium tracking-tight text-foreground">
- {entries.length === 0
- ? t('plugins.logs.empty')
- : t('plugins.logs.emptyFiltered')}
- </p>
- {entries.length === 0 && (
- <p className="max-w-sm text-xs leading-relaxed text-muted-foreground">
- {t('plugins.logs.emptyHint')}
- </p>
+ <ScrollArea className="flex min-h-0 min-w-0 flex-1 flex-col">
+ <ScrollAreaViewport className="min-h-0 flex-1 overscroll-contain">
+ <ScrollAreaContent
+ className="flex min-h-full flex-col"
+ style={{ minWidth: '100%' }}
+ >
+ {filtered.length === 0 ? (
+ <div className="flex flex-1 flex-col items-center justify-center gap-2 px-6 py-12 text-center">
+ <div className="mb-1 flex size-10 items-center justify-center rounded-xl border border-border/60 bg-background/80 shadow-xs">
+ <TerminalSquare className="size-4.5 text-muted-foreground" />
+ </div>
+ <p className="text-sm font-medium tracking-tight text-foreground">
+ {entries.length === 0
+ ? t('plugins.logs.empty')
+ : t('plugins.logs.emptyFiltered')}
+ </p>
+ {entries.length === 0 && (
+ <p className="max-w-sm text-xs leading-relaxed text-muted-foreground">
+ {t('plugins.logs.emptyHint')}
+ </p>
+ )}
+ </div>
+ ) : (
+ filtered.map((e) => (
+ <PluginLogRow key={`${e.ts}-${e.level}-${e.msg}`} entry={e} />
+ ))
)}
- </div>
- ) : (
- filtered.map((e) => (
- <PluginLogRow key={`${e.ts}-${e.level}-${e.msg}`} entry={e} />
- ))
- )}
- </div>
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ <ScrollBar orientation="horizontal" />
+ </ScrollArea>
</div>
</div>
)
diff --git a/src/renderer/routes/plugins/components/registry-detail-panel.test.tsx b/src/renderer/routes/plugins/components/registry-detail-panel.test.tsx
index fb9c8de3..1ad48395 100644
--- a/src/renderer/routes/plugins/components/registry-detail-panel.test.tsx
+++ b/src/renderer/routes/plugins/components/registry-detail-panel.test.tsx
@@ -1,3 +1,4 @@
+import '@test-utils/dom-animations'
import '@testing-library/jest-dom/vitest'
import { i18n } from '@renderer/lib/i18n'
import {
diff --git a/src/renderer/routes/plugins/components/registry-detail-panel.tsx b/src/renderer/routes/plugins/components/registry-detail-panel.tsx
index 1e03d2cb..14d69786 100644
--- a/src/renderer/routes/plugins/components/registry-detail-panel.tsx
+++ b/src/renderer/routes/plugins/components/registry-detail-panel.tsx
@@ -5,6 +5,12 @@ import {
import { Badge } from '@renderer/components/ui/badge'
import { Button } from '@renderer/components/ui/button'
import { Card } from '@renderer/components/ui/card'
+import {
+ ScrollArea,
+ ScrollAreaContent,
+ ScrollAreaViewport,
+ ScrollBar,
+} from '@renderer/components/ui/scroll-area'
import { usePlatformServices } from '@renderer/platform/services'
import { EXTERNAL_URLS } from '@shared/external-urls'
import type { RegistryPluginDTO } from '@shared/schemas/registry'
@@ -58,91 +64,98 @@ export function RegistryDetailPanel({ entry }: Props) {
}
contentClassName="min-h-0 px-6 pb-6"
>
- <div className="min-h-0 flex-1 overflow-auto">
- <div className="mx-auto flex w-full flex-col gap-4 pb-6">
- <Card className="flex flex-col gap-4 p-4">
- <div className="flex items-start gap-3">
- <PluginAvatar
- plugin={{ id: entry.id, name, icon: entry.icon }}
- size={56}
- />
- <div className="min-w-0 flex-1">
- <p className="text-sm text-muted-foreground">
- {t('plugins.registry.byAuthor', { name: entry.author.name })}
- {' · '}v{entry.version}
- {' · '}
- {t('plugins.registry.updated', { date: entry.updatedAt })}
- </p>
- <p className="mt-1 text-sm">{description}</p>
- </div>
- </div>
- <div className="flex flex-wrap items-center gap-2">
- {!entry.compatible && (
- <Badge variant="outline" className="text-muted-foreground">
- {t('plugins.registry.requires', {
- range: entry.engines.motrix,
- })}
- </Badge>
- )}
- <Button
- size="sm"
- disabled={!entry.compatible}
- onClick={() => setInstallOpen(true)}
- data-testid="registry-install-btn"
- >
- <Download className="size-3.5" />
- {t('plugins.registry.install')}
- </Button>
- <Button
- variant="outline"
- size="sm"
- onClick={() =>
- services.openExternal(
- `${EXTERNAL_URLS.motrix.plugins}?plugin=${encodeURIComponent(entry.id)}`
- )
- }
- >
- <ExternalLink className="size-3.5" />
- {t('plugins.registry.viewOnWebsite')}
- </Button>
- </div>
- </Card>
+ <ScrollArea className="flex min-h-0 min-w-0 flex-1 flex-col">
+ <ScrollAreaViewport className="min-h-0 flex-1 overscroll-contain">
+ <ScrollAreaContent style={{ minWidth: '100%' }}>
+ <div className="mx-auto flex w-full flex-col gap-4 pb-6">
+ <Card className="flex flex-col gap-4 p-4">
+ <div className="flex items-start gap-3">
+ <PluginAvatar
+ plugin={{ id: entry.id, name, icon: entry.icon }}
+ size={56}
+ />
+ <div className="min-w-0 flex-1">
+ <p className="text-sm text-muted-foreground">
+ {t('plugins.registry.byAuthor', {
+ name: entry.author.name,
+ })}
+ {' · '}v{entry.version}
+ {' · '}
+ {t('plugins.registry.updated', { date: entry.updatedAt })}
+ </p>
+ <p className="mt-1 text-sm">{description}</p>
+ </div>
+ </div>
+ <div className="flex flex-wrap items-center gap-2">
+ {!entry.compatible && (
+ <Badge variant="outline" className="text-muted-foreground">
+ {t('plugins.registry.requires', {
+ range: entry.engines.motrix,
+ })}
+ </Badge>
+ )}
+ <Button
+ size="sm"
+ disabled={!entry.compatible}
+ onClick={() => setInstallOpen(true)}
+ data-testid="registry-install-btn"
+ >
+ <Download className="size-3.5" />
+ {t('plugins.registry.install')}
+ </Button>
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() =>
+ services.openExternal(
+ `${EXTERNAL_URLS.motrix.plugins}?plugin=${encodeURIComponent(entry.id)}`
+ )
+ }
+ >
+ <ExternalLink className="size-3.5" />
+ {t('plugins.registry.viewOnWebsite')}
+ </Button>
+ </div>
+ </Card>
- {features.length > 0 && (
- <Card className="flex flex-col gap-2 p-4">
- <h3 className="text-sm font-semibold tracking-tight">
- {t('plugins.registry.featuresTitle')}
- </h3>
- <ul className="list-disc space-y-1 pl-5 text-sm text-muted-foreground">
- {features.map((feature) => (
- <li key={feature}>{feature}</li>
- ))}
- </ul>
- </Card>
- )}
+ {features.length > 0 && (
+ <Card className="flex flex-col gap-2 p-4">
+ <h3 className="text-sm font-semibold tracking-tight">
+ {t('plugins.registry.featuresTitle')}
+ </h3>
+ <ul className="list-disc space-y-1 pl-5 text-sm text-muted-foreground">
+ {features.map((feature) => (
+ <li key={feature}>{feature}</li>
+ ))}
+ </ul>
+ </Card>
+ )}
- {permissionChips.length > 0 && (
- <Card className="flex flex-col gap-2 p-4">
- <h3 className="text-sm font-semibold tracking-tight">
- {t('plugins.registry.permissionsTitle')}
- </h3>
- <p className="text-xs text-muted-foreground">
- {t('plugins.registry.permissionsPreviewNote')}
- </p>
- <div className="flex flex-wrap gap-1.5">
- {permissionChips.map((chip) => (
- <span
- key={chip.key}
- className="rounded-full border px-2.5 py-0.5 font-mono text-xs text-muted-foreground"
- >
- {chip.label}
- </span>
- ))}
- </div>
- </Card>
- )}
- </div>
- </div>
+ {permissionChips.length > 0 && (
+ <Card className="flex flex-col gap-2 p-4">
+ <h3 className="text-sm font-semibold tracking-tight">
+ {t('plugins.registry.permissionsTitle')}
+ </h3>
+ <p className="text-xs text-muted-foreground">
+ {t('plugins.registry.permissionsPreviewNote')}
+ </p>
+ <div className="flex flex-wrap gap-1.5">
+ {permissionChips.map((chip) => (
+ <span
+ key={chip.key}
+ className="rounded-full border px-2.5 py-0.5 font-mono text-xs text-muted-foreground"
+ >
+ {chip.label}
+ </span>
+ ))}
+ </div>
+ </Card>
+ )}
+ </div>
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ </ScrollArea>
<PluginInstallDialog
open={installOpen}
diff --git a/src/renderer/routes/plugins/plugin-detail-page.test.tsx b/src/renderer/routes/plugins/plugin-detail-page.test.tsx
index ec1f0277..ec8d984e 100644
--- a/src/renderer/routes/plugins/plugin-detail-page.test.tsx
+++ b/src/renderer/routes/plugins/plugin-detail-page.test.tsx
@@ -1,3 +1,4 @@
+import '@test-utils/dom-animations'
import '@testing-library/jest-dom/vitest'
import '@renderer/lib/i18n'
import { TooltipProvider } from '@renderer/components/ui/tooltip'
diff --git a/src/renderer/routes/plugins/plugin-detail-page.tsx b/src/renderer/routes/plugins/plugin-detail-page.tsx
index f8cc4bc0..604e11e5 100644
--- a/src/renderer/routes/plugins/plugin-detail-page.tsx
+++ b/src/renderer/routes/plugins/plugin-detail-page.tsx
@@ -3,6 +3,12 @@ import {
PanelShell,
} from '@renderer/components/desktop-kit/panel/panel-shell'
import { Button } from '@renderer/components/ui/button'
+import {
+ ScrollArea,
+ ScrollAreaContent,
+ ScrollAreaViewport,
+ ScrollBar,
+} from '@renderer/components/ui/scroll-area'
import { Switch } from '@renderer/components/ui/switch'
import {
Tabs,
@@ -305,63 +311,102 @@ export function PluginDetailPage() {
<TabsContent
value="overview"
- className="m-0 min-h-0 flex-1 overflow-auto pb-6"
+ className="m-0 flex min-h-0 flex-1 flex-col"
>
- <div className="mx-auto flex w-full flex-col gap-4">
- <OverviewSection
- plugin={listEntry}
- manifest={manifest}
- onJumpToLogs={() => setTab('logs')}
- />
- </div>
+ <ScrollArea className="flex min-h-0 min-w-0 flex-1 flex-col">
+ <ScrollAreaViewport
+ tabIndex={-1}
+ className="min-h-0 flex-1 overscroll-contain"
+ >
+ <ScrollAreaContent
+ className="pb-6"
+ style={{ minWidth: '100%' }}
+ >
+ <div className="mx-auto flex w-full flex-col gap-4">
+ <OverviewSection
+ plugin={listEntry}
+ manifest={manifest}
+ onJumpToLogs={() => setTab('logs')}
+ />
+ </div>
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ </ScrollArea>
</TabsContent>
{schema && (
<TabsContent
value="settings"
- className="m-0 min-h-0 flex-1 overflow-auto pb-6"
+ className="m-0 flex min-h-0 flex-1 flex-col"
>
- <div className="mx-auto flex w-full flex-col gap-4">
- <PluginSettingsForm
- pluginId={id}
- schema={schema}
- initialValues={detail.config}
- />
- </div>
+ <ScrollArea className="flex min-h-0 min-w-0 flex-1 flex-col">
+ <ScrollAreaViewport
+ tabIndex={-1}
+ className="min-h-0 flex-1 overscroll-contain"
+ >
+ <ScrollAreaContent
+ className="pb-6"
+ style={{ minWidth: '100%' }}
+ >
+ <div className="mx-auto flex w-full flex-col gap-4">
+ <PluginSettingsForm
+ pluginId={id}
+ schema={schema}
+ initialValues={detail.config}
+ />
+ </div>
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ </ScrollArea>
</TabsContent>
)}
<TabsContent
value="access"
- className="m-0 min-h-0 flex-1 overflow-auto pb-6"
+ className="m-0 flex min-h-0 flex-1 flex-col"
>
- <div className="mx-auto flex w-full flex-col gap-4">
- <AccessSection
- manifest={manifest}
- grants={detail.grants}
- // Builtin / dev plugins are trusted: the host auto-grants all
- // declared permissions and rejects grant mutations
- // (updateGrants → plugin.grants.not_supported). Render their
- // optional permissions read-only so the toggle never fires that
- // rejected command (which surfaced as an uncaught promise error).
- trusted={
- listEntry.source?.type === 'builtin' ||
- listEntry.source?.type === 'dev'
- }
- onToggleGrant={async (permission) => {
- const next =
- detail.grants[permission] === 'granted'
- ? 'denied'
- : 'granted'
- await transport.invoke(Commands.UpdatePluginGrants, {
- pluginId: id,
- patch: { [permission]: next },
- })
- // usePluginDetail re-fetches via PluginGrantsChanged event;
- // no local mutation needed.
- }}
- />
- </div>
+ <ScrollArea className="flex min-h-0 min-w-0 flex-1 flex-col">
+ <ScrollAreaViewport
+ tabIndex={-1}
+ className="min-h-0 flex-1 overscroll-contain"
+ >
+ <ScrollAreaContent
+ className="pb-6"
+ style={{ minWidth: '100%' }}
+ >
+ <div className="mx-auto flex w-full flex-col gap-4">
+ <AccessSection
+ manifest={manifest}
+ grants={detail.grants}
+ // Builtin / dev plugins are trusted: the host auto-grants all
+ // declared permissions and rejects grant mutations
+ // (updateGrants → plugin.grants.not_supported). Render their
+ // optional permissions read-only so the toggle never fires that
+ // rejected command (which surfaced as an uncaught promise error).
+ trusted={
+ listEntry.source?.type === 'builtin' ||
+ listEntry.source?.type === 'dev'
+ }
+ onToggleGrant={async (permission) => {
+ const next =
+ detail.grants[permission] === 'granted'
+ ? 'denied'
+ : 'granted'
+ await transport.invoke(Commands.UpdatePluginGrants, {
+ pluginId: id,
+ patch: { [permission]: next },
+ })
+ // usePluginDetail re-fetches via PluginGrantsChanged event;
+ // no local mutation needed.
+ }}
+ />
+ </div>
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ </ScrollArea>
</TabsContent>
<TabsContent value="logs" className="m-0 flex min-h-0 flex-1">
diff --git a/src/renderer/routes/plugins/plugin-diagnostics-page.test.tsx b/src/renderer/routes/plugins/plugin-diagnostics-page.test.tsx
index e69e10ae..f5c4ba86 100644
--- a/src/renderer/routes/plugins/plugin-diagnostics-page.test.tsx
+++ b/src/renderer/routes/plugins/plugin-diagnostics-page.test.tsx
@@ -1,3 +1,4 @@
+import '@test-utils/dom-animations'
import '@testing-library/jest-dom/vitest'
import { TooltipProvider } from '@renderer/components/ui/tooltip'
import { i18n } from '@renderer/lib/i18n'
@@ -963,19 +964,23 @@ describe('PluginDiagnosticsPage', () => {
expect(root).not.toHaveClass('overflow-hidden')
expect(activePanel('Graph')).toHaveClass('overflow-hidden')
expect(root.innerHTML).not.toMatch(/(?:min-h|h)-\[360px\]/)
- expect(root.querySelectorAll('[class~="overflow-auto"]')).toHaveLength(1)
+ expect(
+ root.querySelectorAll('[data-slot="scroll-area-viewport"]')
+ ).toHaveLength(1)
expect(
screen.getByRole('complementary', {
name: 'Call graph selection details',
})
- ).toHaveClass('overflow-auto')
+ ).toContainElement(root.querySelector('[data-slot="scroll-area-viewport"]'))
await user.click(screen.getByRole('tab', { name: 'Table' }))
expect(activePanel('Table')).toHaveClass('overflow-hidden')
- expect(root.querySelectorAll('[class~="overflow-auto"]')).toHaveLength(1)
+ expect(
+ root.querySelectorAll('[data-slot="scroll-area-viewport"]')
+ ).toHaveLength(1)
expect(screen.queryByRole('complementary')).not.toBeInTheDocument()
expect(
screen.getByRole('region', { name: 'Scrollable command relationships' })
- ).toHaveClass('overflow-auto')
+ ).toContainElement(root.querySelector('[data-slot="scroll-area-viewport"]'))
})
})
diff --git a/src/renderer/routes/plugins/plugin-install-dialog.registry.test.tsx b/src/renderer/routes/plugins/plugin-install-dialog.registry.test.tsx
index 0536920d..d001fe38 100644
--- a/src/renderer/routes/plugins/plugin-install-dialog.registry.test.tsx
+++ b/src/renderer/routes/plugins/plugin-install-dialog.registry.test.tsx
@@ -1,3 +1,4 @@
+import '@test-utils/dom-animations'
import '@testing-library/jest-dom/vitest'
import '@renderer/lib/i18n'
import { Commands } from '@shared/protocol/commands'
diff --git a/src/renderer/routes/plugins/plugin-install-dialog.test.tsx b/src/renderer/routes/plugins/plugin-install-dialog.test.tsx
index f9183576..de069df2 100644
--- a/src/renderer/routes/plugins/plugin-install-dialog.test.tsx
+++ b/src/renderer/routes/plugins/plugin-install-dialog.test.tsx
@@ -1,3 +1,4 @@
+import '@test-utils/dom-animations'
import '@renderer/lib/i18n'
import '@testing-library/jest-dom/vitest'
import type {
diff --git a/src/renderer/routes/plugins/plugin-install-dialog.tsx b/src/renderer/routes/plugins/plugin-install-dialog.tsx
index a3d2c3f8..2cac2661 100644
--- a/src/renderer/routes/plugins/plugin-install-dialog.tsx
+++ b/src/renderer/routes/plugins/plugin-install-dialog.tsx
@@ -8,6 +8,12 @@ import {
DialogHeader,
DialogTitle,
} from '@renderer/components/ui/dialog'
+import {
+ ScrollArea,
+ ScrollAreaContent,
+ ScrollAreaViewport,
+ ScrollBar,
+} from '@renderer/components/ui/scroll-area'
import { cn } from '@renderer/lib/utils'
import type { ConsentPayloadFfmpegRuntime } from '@shared/types/plugin-install'
import { useEffect, useRef, useState } from 'react'
@@ -143,28 +149,45 @@ export function PluginInstallDialog({
</DialogDescription>
</DialogHeader>
- <div className="min-h-0 flex-1 overflow-y-auto px-4 pb-4 space-y-4">
- {install.error && (
- <Alert variant="destructive" className="mb-4 shadow-none border">
- <span className="text-xs">{install.error}</span>
- </Alert>
- )}
+ <ScrollArea className="flex min-h-0 min-w-0 flex-1 flex-col">
+ <ScrollAreaViewport
+ tabIndex={-1}
+ className="min-h-0 flex-1 overscroll-contain"
+ >
+ <ScrollAreaContent
+ className="space-y-4 px-4 pb-4"
+ style={{ minWidth: '100%' }}
+ >
+ {install.error && (
+ <Alert
+ variant="destructive"
+ className="mb-4 shadow-none border"
+ >
+ <span className="text-xs">{install.error}</span>
+ </Alert>
+ )}
- {!fixedSource && (
- <PluginInputGroup onCheck={onCheck} checking={install.pending} />
- )}
+ {!fixedSource && (
+ <PluginInputGroup
+ onCheck={onCheck}
+ checking={install.pending}
+ />
+ )}
- {install.consent && (
- <>
- <FfmpegRuntimeBlock rt={install.consent.ffmpegRuntime} />
- <InlineConsentPanel
- consent={install.consent}
- grants={grants}
- onGrantsChange={setGrants}
- />
- </>
- )}
- </div>
+ {install.consent && (
+ <>
+ <FfmpegRuntimeBlock rt={install.consent.ffmpegRuntime} />
+ <InlineConsentPanel
+ consent={install.consent}
+ grants={grants}
+ onGrantsChange={setGrants}
+ />
+ </>
+ )}
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ </ScrollArea>
<DialogFooter className="shrink-0 border-t bg-background px-4 py-3">
<Button variant="outline" size="sm" onClick={onCancel}>
diff --git a/src/renderer/routes/plugins/plugins-page.test.tsx b/src/renderer/routes/plugins/plugins-page.test.tsx
index a96aae3f..242de385 100644
--- a/src/renderer/routes/plugins/plugins-page.test.tsx
+++ b/src/renderer/routes/plugins/plugins-page.test.tsx
@@ -1,3 +1,4 @@
+import '@test-utils/dom-animations'
import '@testing-library/jest-dom/vitest'
import { TooltipProvider } from '@renderer/components/ui/tooltip'
import { i18n } from '@renderer/lib/i18n'
@@ -8,7 +9,8 @@ import {
import { Queries } from '@shared/protocol/queries'
import type { RegistryPluginDTO } from '@shared/schemas/registry'
import type { PluginListDTO } from '@shared/types/plugin'
-import { act, fireEvent, render, screen } from '@testing-library/react'
+import { act, fireEvent, render, screen, within } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
import { MemoryRouter } from 'react-router'
import { beforeEach, describe, expect, it, vi } from 'vitest'
@@ -19,6 +21,8 @@ vi.mock('@renderer/lib/transport', () => ({
transport: { invoke: mockInvoke, on: vi.fn(), off: vi.fn() },
}))
+const mockRefresh = vi.fn()
+let mockRefreshing = false
let mockList: PluginListDTO[] = []
let mockRegistry: RegistryPluginDTO[] = []
vi.mock('./hooks/use-plugins', () => ({
@@ -26,7 +30,10 @@ vi.mock('./hooks/use-plugins', () => ({
}))
vi.mock('./hooks/use-registry', () => ({
useRegistryPlugins: () => mockRegistry,
- useRegistryUpdates: () => ({ refreshing: false, refresh: vi.fn() }),
+ useRegistryUpdates: () => ({
+ refreshing: mockRefreshing,
+ refresh: mockRefresh,
+ }),
}))
import { PluginsPage } from './plugins-page'
@@ -55,6 +62,13 @@ function renderPage(kind: 'electron' | 'web' = 'electron') {
)
}
+function expandSearch() {
+ if (!screen.queryByRole('textbox', { name: 'Find a plugin' })) {
+ fireEvent.click(screen.getByRole('button', { name: 'Find a plugin' }))
+ }
+ return screen.getByRole('textbox', { name: 'Find a plugin' })
+}
+
function plugin(over: Partial<PluginListDTO> = {}): PluginListDTO {
return {
id: 'test.id',
@@ -109,6 +123,8 @@ function registryPlugin(
describe('PluginsPage', () => {
beforeEach(async () => {
+ mockRefreshing = false
+ mockRefresh.mockClear()
mockList = []
mockRegistry = []
mockInvoke.mockClear()
@@ -121,7 +137,7 @@ describe('PluginsPage', () => {
renderPage()
const scrollRegion = screen.getByTestId('plugins-scroll-region')
- const search = screen.getByPlaceholderText('Find a plugin')
+ const search = screen.getByRole('button', { name: 'Find a plugin' })
const diagnostics = screen.getByRole('link', {
name: 'Diagnostics',
})
@@ -192,12 +208,12 @@ describe('PluginsPage', () => {
renderPage()
const scrollRegion = screen.getByTestId('plugins-scroll-region')
- const search = screen.getByPlaceholderText('Find a plugin')
+ const search = screen.getByRole('button', { name: 'Find a plugin' })
const diagnostics = screen.getByRole('link', {
name: 'Diagnostics',
})
- expect(scrollRegion).toHaveClass('overflow-y-auto')
+ expect(screen.getByRole('region', { name: 'Plugins' })).toBe(scrollRegion)
expect(scrollRegion).not.toContainElement(search)
expect(scrollRegion).not.toContainElement(diagnostics)
expect(scrollRegion).toContainElement(screen.getByText('Test Plugin'))
@@ -214,14 +230,42 @@ describe('PluginsPage', () => {
)
})
- it('inherits the shared Input focus ring', () => {
+ it('expands and focuses search from the shared header toolbar', async () => {
+ const user = userEvent.setup()
renderPage()
- const input = screen.getByPlaceholderText('Find a plugin')
+ const toolbar = screen.getByRole('toolbar', { name: 'Plugins' })
+ expect(within(toolbar).queryByRole('textbox')).toBeNull()
+ await user.click(
+ within(toolbar).getByRole('button', { name: 'Find a plugin' })
+ )
+ expect(
+ within(toolbar).getByRole('textbox', { name: 'Find a plugin' })
+ ).toHaveFocus()
+ await user.keyboard('{Escape}')
+ expect(
+ within(toolbar).getByRole('button', { name: 'Find a plugin' })
+ ).toHaveFocus()
+ })
- expect(input).toHaveClass('focus-visible:border-ring')
- expect(input).toHaveClass('focus-visible:ring-[3px]')
- expect(input).toHaveClass('focus-visible:ring-ring/50')
- expect(input).not.toHaveClass('focus-visible:ring-0')
+ it('runs update checks from the toolbar and disables the busy action', () => {
+ const { rerender } = renderPage()
+ fireEvent.click(screen.getByTestId('registry-refresh-btn'))
+ expect(mockRefresh).toHaveBeenCalledOnce()
+ mockRefreshing = true
+ rerender(
+ <PlatformServicesProvider services={services('electron')}>
+ <TooltipProvider>
+ <MemoryRouter>
+ <PluginsPage />
+ </MemoryRouter>
+ </TooltipProvider>
+ </PlatformServicesProvider>
+ )
+ expect(screen.getByTestId('registry-refresh-btn')).toBeDisabled()
+ expect(screen.getByTestId('registry-refresh-btn')).toHaveAttribute(
+ 'aria-busy',
+ 'true'
+ )
})
it('filters cards by search query', () => {
@@ -231,7 +275,7 @@ describe('PluginsPage', () => {
]
renderPage()
- fireEvent.change(screen.getByPlaceholderText('Find a plugin'), {
+ fireEvent.change(expandSearch(), {
target: { value: 'beta' },
})
@@ -243,12 +287,16 @@ describe('PluginsPage', () => {
mockList = [plugin()]
renderPage()
- fireEvent.change(screen.getByPlaceholderText('Find a plugin'), {
+ fireEvent.change(expandSearch(), {
target: { value: 'zzz' },
})
expect(screen.getByText(/No plugins match “zzz”/)).toBeInTheDocument()
- fireEvent.click(screen.getByRole('button', { name: 'Clear search' }))
+ fireEvent.click(
+ within(screen.getByTestId('plugins-scroll-region')).getByRole('button', {
+ name: 'Clear search',
+ })
+ )
expect(screen.getByText('Test Plugin')).toBeInTheDocument()
})
@@ -277,14 +325,14 @@ describe('PluginsPage', () => {
mockRegistry = [registryPlugin()]
renderPage()
- fireEvent.change(screen.getByPlaceholderText('Find a plugin'), {
+ fireEvent.change(expandSearch(), {
target: { value: 'archive' },
})
expect(
screen.getByTestId('registry-card-example.archive-unpacker')
).toBeInTheDocument()
- fireEvent.change(screen.getByPlaceholderText('Find a plugin'), {
+ fireEvent.change(expandSearch(), {
target: { value: 'アーカイブ' },
})
expect(
@@ -295,7 +343,7 @@ describe('PluginsPage', () => {
it('recomputes a non-empty registry search on live language change without refetch', async () => {
mockRegistry = [registryPlugin()]
renderPage()
- fireEvent.change(screen.getByPlaceholderText('Find a plugin'), {
+ fireEvent.change(expandSearch(), {
target: { value: '压缩包' },
})
expect(
diff --git a/src/renderer/routes/plugins/plugins-page.tsx b/src/renderer/routes/plugins/plugins-page.tsx
index 952ad4a5..51b4077a 100644
--- a/src/renderer/routes/plugins/plugins-page.tsx
+++ b/src/renderer/routes/plugins/plugins-page.tsx
@@ -1,14 +1,20 @@
-import { HeaderActionButton } from '@renderer/components/desktop-kit/panel/header-action-button'
import { PanelShell } from '@renderer/components/desktop-kit/panel/panel-shell'
+import { Toolbar } from '@renderer/components/desktop-kit/toolbar/toolbar'
+import {
+ ToolbarButton,
+ ToolbarLink,
+} from '@renderer/components/desktop-kit/toolbar/toolbar-button'
+import { ToolbarGroup } from '@renderer/components/desktop-kit/toolbar/toolbar-group'
+import { ToolbarSearch } from '@renderer/components/desktop-kit/toolbar/toolbar-search'
import { Button } from '@renderer/components/ui/button'
-import { Input } from '@renderer/components/ui/input'
-import { Skeleton } from '@renderer/components/ui/skeleton'
import {
- Tooltip,
- TooltipContent,
- TooltipTrigger,
-} from '@renderer/components/ui/tooltip'
-import { ListFilter, Plus, RefreshCw, Workflow } from 'lucide-react'
+ ScrollArea,
+ ScrollAreaContent,
+ ScrollAreaViewport,
+ ScrollBar,
+} from '@renderer/components/ui/scroll-area'
+import { Skeleton } from '@renderer/components/ui/skeleton'
+import { Plus, RefreshCw, Workflow } from 'lucide-react'
import { useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { Link } from 'react-router'
@@ -63,141 +69,121 @@ export function PluginsPage() {
<PanelShell
title={t('plugins.title')}
actions={
- <HeaderActionButton
- label={t('plugins.install.title')}
- onClick={() => setInstallOpen(true)}
- >
- <Plus aria-hidden />
- </HeaderActionButton>
- }
- contentClassName="min-h-0 px-6 pb-6"
- >
- <div
- data-testid="plugins-tool-row"
- className="flex shrink-0 items-center gap-2 pb-3"
- >
- <div className="relative min-w-0 flex-1">
- <ListFilter
- aria-hidden
- className="pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"
- />
- <Input
- placeholder={t('plugins.search')}
- value={searchQuery}
- onChange={(event) => setSearchQuery(event.target.value)}
- className="h-9 rounded-lg bg-background pl-9 text-sm"
- />
- </div>
-
- <Tooltip>
- <TooltipTrigger
- render={
- <Button
- render={
- <Link
- to="/plugins/diagnostics"
- role="link"
- aria-label={diagnosticsLabel}
- />
+ <Toolbar label={t('plugins.title')} data-testid="plugins-tool-row">
+ <ToolbarGroup>
+ <ToolbarButton
+ label={t('plugins.install.title')}
+ onClick={() => setInstallOpen(true)}
+ >
+ <Plus aria-hidden="true" />
+ </ToolbarButton>
+ <ToolbarLink
+ label={diagnosticsLabel}
+ render={<Link to="/plugins/diagnostics" />}
+ >
+ <Workflow aria-hidden="true" />
+ </ToolbarLink>
+ <ToolbarButton
+ label={refreshLabel}
+ onClick={() => void refresh()}
+ disabled={refreshing}
+ aria-busy={refreshing}
+ data-testid="registry-refresh-btn"
+ >
+ <RefreshCw
+ aria-hidden="true"
+ className={
+ refreshing
+ ? 'animate-spin motion-reduce:animate-none'
+ : undefined
}
- nativeButton={false}
- variant="outline"
- size="icon"
- >
- <Workflow aria-hidden />
- </Button>
- }
- />
- <TooltipContent side="bottom">{diagnosticsLabel}</TooltipContent>
- </Tooltip>
-
- <Tooltip>
- <TooltipTrigger
- render={
- <Button
- variant="outline"
- size="icon"
- onClick={() => void refresh()}
- disabled={refreshing}
- aria-label={refreshLabel}
- data-testid="registry-refresh-btn"
- >
- <RefreshCw
- aria-hidden
- className={refreshing ? 'animate-spin' : undefined}
- />
- </Button>
- }
+ />
+ </ToolbarButton>
+ </ToolbarGroup>
+ <ToolbarSearch
+ value={searchQuery}
+ onValueChange={setSearchQuery}
+ label={t('plugins.search')}
+ clearLabel={t('common.clearSearch')}
/>
- <TooltipContent side="bottom">{refreshLabel}</TooltipContent>
- </Tooltip>
- </div>
-
- <div
- data-testid="plugins-scroll-region"
- aria-busy={!pluginsLoaded}
- className="min-h-0 flex-1 overflow-y-auto pr-1"
- >
- {!pluginsLoaded ? (
- <div
- aria-hidden="true"
- className="grid grid-cols-1 gap-2.5 pb-6 lg:grid-cols-2"
- >
- {['primary', 'secondary'].map((placeholder) => (
+ </Toolbar>
+ }
+ actionsDraggable
+ actionsClassName="min-w-0 flex-1"
+ contentClassName="min-h-0 min-w-0"
+ >
+ <ScrollArea className="min-h-0 min-w-0 flex-1">
+ <ScrollAreaViewport
+ data-testid="plugins-scroll-region"
+ role="region"
+ aria-label={t('plugins.title')}
+ aria-busy={!pluginsLoaded}
+ className="overscroll-contain"
+ >
+ <ScrollAreaContent className="px-6 pb-6" style={{ minWidth: '100%' }}>
+ {!pluginsLoaded ? (
<div
- key={placeholder}
- className="space-y-3 rounded-lg border p-4"
+ aria-hidden="true"
+ className="grid grid-cols-1 gap-2.5 lg:grid-cols-2"
>
- <Skeleton className="h-5 w-2/5" />
- <Skeleton className="h-4 w-4/5" />
- <Skeleton className="h-4 w-3/5" />
- </div>
- ))}
- </div>
- ) : (
- <div className="flex w-full flex-col gap-4 pb-6">
- <PluginGuidance hasUserManagedPlugin={hasUserManagedPlugin} />
-
- {plugins.length === 0 ? null : filtered.length === 0 ? (
- <div className="flex min-h-56 flex-col items-center justify-center gap-3 rounded-xl border border-dashed bg-muted/20 px-6 py-12 text-center">
- <p className="text-sm text-muted-foreground">
- {t('plugins.searchNoMatch', { query: searchQuery })}
- </p>
- <Button
- variant="outline"
- size="sm"
- onClick={() => setSearchQuery('')}
- >
- {t('plugins.clearSearch')}
- </Button>
- </div>
- ) : (
- <div className="grid grid-cols-1 gap-2.5 lg:grid-cols-2">
- {filtered.map((plugin) => (
- <PluginCard
- key={plugin.id}
- plugin={plugin}
- hasSchema={false}
- />
+ {['primary', 'secondary'].map((placeholder) => (
+ <div
+ key={placeholder}
+ className="space-y-3 rounded-lg border p-4"
+ >
+ <Skeleton className="h-5 w-2/5" />
+ <Skeleton className="h-4 w-4/5" />
+ <Skeleton className="h-4 w-3/5" />
+ </div>
))}
</div>
- )}
+ ) : (
+ <div className="flex w-full flex-col gap-4">
+ <PluginGuidance hasUserManagedPlugin={hasUserManagedPlugin} />
+
+ {plugins.length === 0 ? null : filtered.length === 0 ? (
+ <div className="flex min-h-56 flex-col items-center justify-center gap-3 rounded-xl border border-dashed bg-muted/20 px-6 py-12 text-center">
+ <p className="text-sm text-muted-foreground">
+ {t('plugins.searchNoMatch', { query: searchQuery })}
+ </p>
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => setSearchQuery('')}
+ >
+ {t('plugins.clearSearch')}
+ </Button>
+ </div>
+ ) : (
+ <div className="grid grid-cols-1 gap-2.5 lg:grid-cols-2">
+ {filtered.map((plugin) => (
+ <PluginCard
+ key={plugin.id}
+ plugin={plugin}
+ hasSchema={false}
+ />
+ ))}
+ </div>
+ )}
- {available.length > 0 && (
- <div className="flex flex-col gap-2.5">
- <h3 className="text-sm font-semibold tracking-tight">
- {t('plugins.registry.availableTitle')}
- </h3>
- <div className="grid grid-cols-1 gap-2.5 lg:grid-cols-2">
- {available.map((entry) => (
- <RegistryPluginCard key={entry.id} entry={entry} />
- ))}
- </div>
+ {available.length > 0 && (
+ <div className="flex flex-col gap-2.5">
+ <h3 className="text-sm font-semibold tracking-tight">
+ {t('plugins.registry.availableTitle')}
+ </h3>
+ <div className="grid grid-cols-1 gap-2.5 lg:grid-cols-2">
+ {available.map((entry) => (
+ <RegistryPluginCard key={entry.id} entry={entry} />
+ ))}
+ </div>
+ </div>
+ )}
</div>
)}
- </div>
- )}
- </div>
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ </ScrollArea>
<PluginInstallDialog open={installOpen} onOpenChange={setInstallOpen} />
</PanelShell>
diff --git a/src/renderer/routes/settings/cards/about-dialog.test.tsx b/src/renderer/routes/settings/cards/about-dialog.test.tsx
index 98135a7c..84f2da48 100644
--- a/src/renderer/routes/settings/cards/about-dialog.test.tsx
+++ b/src/renderer/routes/settings/cards/about-dialog.test.tsx
@@ -1,3 +1,4 @@
+import '@test-utils/dom-animations'
import '@renderer/lib/i18n'
import '@testing-library/jest-dom/vitest'
import { transport } from '@renderer/lib/transport'
@@ -460,10 +461,9 @@ describe('<AboutDialog>', () => {
'max-h-[calc(100svh-2rem)]',
'overflow-hidden'
)
- expect(screen.getByTestId('about-dialog-scroll')).toHaveClass(
- 'min-h-0',
- 'flex-1',
- 'overflow-y-auto'
+ expect(screen.getByTestId('about-dialog-scroll')).toHaveAttribute(
+ 'data-slot',
+ 'scroll-area-viewport'
)
})
diff --git a/src/renderer/routes/settings/cards/about-dialog.tsx b/src/renderer/routes/settings/cards/about-dialog.tsx
index 0e4f105f..6ad4092b 100644
--- a/src/renderer/routes/settings/cards/about-dialog.tsx
+++ b/src/renderer/routes/settings/cards/about-dialog.tsx
@@ -7,6 +7,12 @@ import {
DialogHeader,
DialogTitle,
} from '@renderer/components/ui/dialog'
+import {
+ ScrollArea,
+ ScrollAreaContent,
+ ScrollAreaViewport,
+ ScrollBar,
+} from '@renderer/components/ui/scroll-area'
import { EXTERNAL_URLS } from '@shared/external-urls'
import { useRef } from 'react'
import { useTranslation } from 'react-i18next'
@@ -143,18 +149,24 @@ export function AboutDialog({
</nav>
</section>
- <div
- data-testid="about-dialog-scroll"
- className="min-h-0 flex-1 overflow-y-auto overscroll-contain scrollbar-gutter-stable"
- >
- {showUpdates ? (
- <AppUpdateSection />
- ) : (
- <p className="px-6 py-5 text-xs text-muted-foreground">
- {t('settings.about.webVersionNote')}
- </p>
- )}
- </div>
+ <ScrollArea className="flex min-h-0 min-w-0 flex-1 flex-col">
+ <ScrollAreaViewport
+ data-testid="about-dialog-scroll"
+ tabIndex={-1}
+ className="min-h-0 flex-1 overscroll-contain"
+ >
+ <ScrollAreaContent style={{ minWidth: '100%' }}>
+ {showUpdates ? (
+ <AppUpdateSection />
+ ) : (
+ <p className="px-6 py-5 text-xs text-muted-foreground">
+ {t('settings.about.webVersionNote')}
+ </p>
+ )}
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ </ScrollArea>
<DialogFooter className="shrink-0 flex-row items-center justify-between gap-4 border-t border-border/70 bg-background/85 px-6 py-3.5 backdrop-blur-xl sm:justify-between">
{showUpdates ? <AutomaticUpdateSetting /> : <span />}
diff --git a/src/renderer/routes/settings/cards/advanced-dialog.test.tsx b/src/renderer/routes/settings/cards/advanced-dialog.test.tsx
index eed92b8a..969e1190 100644
--- a/src/renderer/routes/settings/cards/advanced-dialog.test.tsx
+++ b/src/renderer/routes/settings/cards/advanced-dialog.test.tsx
@@ -1,3 +1,4 @@
+import '@test-utils/dom-animations'
import '@renderer/lib/i18n'
import '@testing-library/jest-dom/vitest'
import { Commands } from '@shared/protocol/commands'
diff --git a/src/renderer/routes/settings/cards/advanced-dialog.tsx b/src/renderer/routes/settings/cards/advanced-dialog.tsx
index d9fe8217..315ea7cd 100644
--- a/src/renderer/routes/settings/cards/advanced-dialog.tsx
+++ b/src/renderer/routes/settings/cards/advanced-dialog.tsx
@@ -23,6 +23,12 @@ import {
} from '@renderer/components/ui/form'
import { Input } from '@renderer/components/ui/input'
import { PasswordInput } from '@renderer/components/ui/password-input'
+import {
+ ScrollArea,
+ ScrollAreaContent,
+ ScrollAreaViewport,
+ ScrollBar,
+} from '@renderer/components/ui/scroll-area'
import { Separator } from '@renderer/components/ui/separator'
import { Switch } from '@renderer/components/ui/switch'
import { pickDirty } from '@renderer/lib/form-utils'
@@ -114,175 +120,201 @@ export function AdvancedDialog({
<DialogDescription>{t(descKey)}</DialogDescription>
</DialogHeader>
- <div className="min-h-0 flex-1 overflow-y-auto px-6 py-4">
- <Form {...form}>
- <form className="space-y-4" noValidate onSubmit={onSubmit}>
- <h3 className="text-sm font-semibold text-foreground">
- {t('settings.advanced.rpc.title')}
- </h3>
+ <ScrollArea className="flex min-h-0 min-w-0 flex-1 flex-col">
+ <ScrollAreaViewport
+ tabIndex={-1}
+ className="min-h-0 flex-1 overscroll-contain"
+ >
+ <ScrollAreaContent
+ className="px-6 py-4"
+ style={{ minWidth: '100%' }}
+ >
+ <Form {...form}>
+ <form className="space-y-4" noValidate onSubmit={onSubmit}>
+ <h3 className="text-sm font-semibold text-foreground">
+ {t('settings.advanced.rpc.title')}
+ </h3>
- <FormField
- control={form.control}
- name="rpcPort"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>{t('settings.advanced.rpc.port')}</FormLabel>
- <FormDescription className="text-xs">
- {t('settings.advanced.rpc.portDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Input
- {...field}
- type="number"
- min={1024}
- max={65535}
- className="w-30 h-8"
- value={Number.isFinite(field.value) ? field.value : ''}
- onChange={(event) =>
- field.onChange(event.target.valueAsNumber)
- }
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ <FormField
+ control={form.control}
+ name="rpcPort"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.advanced.rpc.port')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.advanced.rpc.portDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Input
+ {...field}
+ type="number"
+ min={1024}
+ max={65535}
+ className="w-30 h-8"
+ value={
+ Number.isFinite(field.value) ? field.value : ''
+ }
+ onChange={(event) =>
+ field.onChange(event.target.valueAsNumber)
+ }
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- <FormField
- control={form.control}
- name="rpcSecret"
- render={({ field }) => (
- <FormItem className="space-y-2">
- <div className="space-y-1">
- <FormLabel>{t('settings.advanced.rpc.secret')}</FormLabel>
- <FormDescription className="text-xs">
- {t('settings.advanced.rpc.secretDesc')}
- </FormDescription>
- </div>
- <div className="flex gap-2">
- <FormControl>
- <PasswordInput
- {...field}
- value={field.value}
- onChange={field.onChange}
- onBlur={field.onBlur}
- showPasswordLabel={t('settings.common.showSecret')}
- hidePasswordLabel={t('settings.common.hideSecret')}
- className="flex-1"
- />
- </FormControl>
- <Button
- type="button"
- variant="outline"
- size="sm"
- aria-label={t('settings.common.generate')}
- onClick={() => field.onChange(generateRpcSecret())}
- >
- <Dices className="h-3 w-3" />
- </Button>
- </div>
- <FormMessage className="basis-full text-xs" />
- </FormItem>
- )}
- />
+ <FormField
+ control={form.control}
+ name="rpcSecret"
+ render={({ field }) => (
+ <FormItem className="space-y-2">
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.advanced.rpc.secret')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.advanced.rpc.secretDesc')}
+ </FormDescription>
+ </div>
+ <div className="flex gap-2">
+ <FormControl>
+ <PasswordInput
+ {...field}
+ value={field.value}
+ onChange={field.onChange}
+ onBlur={field.onBlur}
+ showPasswordLabel={t(
+ 'settings.common.showSecret'
+ )}
+ hidePasswordLabel={t(
+ 'settings.common.hideSecret'
+ )}
+ className="flex-1"
+ />
+ </FormControl>
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ aria-label={t('settings.common.generate')}
+ onClick={() => field.onChange(generateRpcSecret())}
+ >
+ <Dices className="h-3 w-3" />
+ </Button>
+ </div>
+ <FormMessage className="basis-full text-xs" />
+ </FormItem>
+ )}
+ />
- <Separator className="my-4" />
+ <Separator className="my-4" />
- <h3 className="text-sm font-semibold text-foreground">
- {t('settings.advanced.persistence.title')}
- </h3>
+ <h3 className="text-sm font-semibold text-foreground">
+ {t('settings.advanced.persistence.title')}
+ </h3>
- <FormField
- control={form.control}
- name="sqlite3Persistence"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.advanced.persistence.enable')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.advanced.persistence.enableDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ <FormField
+ control={form.control}
+ name="sqlite3Persistence"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.advanced.persistence.enable')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.advanced.persistence.enableDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- <FormField
- control={form.control}
- name="sqlite3DbPath"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.advanced.persistence.dbPath')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.advanced.persistence.dbPathDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Input
- {...field}
- className="w-56 h-8"
- placeholder={t(
- 'settings.advanced.persistence.dbPathPlaceholder'
- )}
- disabled={
- !persistenceOn && !form.formState.errors.sqlite3DbPath
- }
- value={field.value}
- onChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ <FormField
+ control={form.control}
+ name="sqlite3DbPath"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.advanced.persistence.dbPath')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.advanced.persistence.dbPathDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Input
+ {...field}
+ className="w-56 h-8"
+ placeholder={t(
+ 'settings.advanced.persistence.dbPathPlaceholder'
+ )}
+ disabled={
+ !persistenceOn &&
+ !form.formState.errors.sqlite3DbPath
+ }
+ value={field.value}
+ onChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- <FormField
- control={form.control}
- name="sqlite3HistoryLimit"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.advanced.persistence.historyLimit')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.advanced.persistence.historyLimitDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Input
- {...field}
- type="number"
- min={-1}
- max={1000000}
- className="w-30 h-8"
- disabled={
- !persistenceOn &&
- !form.formState.errors.sqlite3HistoryLimit
- }
- value={Number.isFinite(field.value) ? field.value : ''}
- onChange={(event) =>
- field.onChange(event.target.valueAsNumber)
- }
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
- </form>
- </Form>
- </div>
+ <FormField
+ control={form.control}
+ name="sqlite3HistoryLimit"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.advanced.persistence.historyLimit')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t(
+ 'settings.advanced.persistence.historyLimitDesc'
+ )}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Input
+ {...field}
+ type="number"
+ min={-1}
+ max={1000000}
+ className="w-30 h-8"
+ disabled={
+ !persistenceOn &&
+ !form.formState.errors.sqlite3HistoryLimit
+ }
+ value={
+ Number.isFinite(field.value) ? field.value : ''
+ }
+ onChange={(event) =>
+ field.onChange(event.target.valueAsNumber)
+ }
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
+ </form>
+ </Form>
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ </ScrollArea>
<DialogFooter className="shrink-0 border-t border-border px-6 py-4">
{form.formState.errors.root?.save && (
diff --git a/src/renderer/routes/settings/cards/appearance-dialog.test.tsx b/src/renderer/routes/settings/cards/appearance-dialog.test.tsx
index f64e38e3..a8d3a4b8 100644
--- a/src/renderer/routes/settings/cards/appearance-dialog.test.tsx
+++ b/src/renderer/routes/settings/cards/appearance-dialog.test.tsx
@@ -1,3 +1,4 @@
+import '@test-utils/dom-animations'
import '@testing-library/jest-dom/vitest'
import { i18n } from '@renderer/lib/i18n'
import { Commands } from '@shared/protocol/commands'
diff --git a/src/renderer/routes/settings/cards/appearance-dialog.tsx b/src/renderer/routes/settings/cards/appearance-dialog.tsx
index 3c1865d6..cd7b4379 100644
--- a/src/renderer/routes/settings/cards/appearance-dialog.tsx
+++ b/src/renderer/routes/settings/cards/appearance-dialog.tsx
@@ -20,6 +20,12 @@ import {
FormField,
FormLabel,
} from '@renderer/components/ui/form'
+import {
+ ScrollArea,
+ ScrollAreaContent,
+ ScrollAreaViewport,
+ ScrollBar,
+} from '@renderer/components/ui/scroll-area'
import {
Select,
SelectContent,
@@ -206,273 +212,287 @@ export function AppearanceDialog({
<DialogDescription>{t(descKey)}</DialogDescription>
</DialogHeader>
- <div className="min-h-0 flex-1 overflow-y-auto px-6 py-4">
- <Form {...form}>
- <form className="space-y-4" noValidate onSubmit={onSubmit}>
- <FormField
- control={form.control}
- name="theme"
- render={({ field }) => (
- <SettingsFormRow>
- <FormLabel>{t('settings.appearance.theme')}</FormLabel>
- <FormControl>
- <Select
- items={themeOptions}
- value={field.value}
- onValueChange={(value) => {
- if (value !== null) field.onChange(value)
- }}
- >
- <SettingsSelectTrigger>
- <SelectValue />
- </SettingsSelectTrigger>
- <SelectContent>
- <SelectGroup>
- {themeOptions.map((option) => (
- <SelectItem
- key={option.value}
- value={option.value}
- >
- {option.label}
- </SelectItem>
- ))}
- </SelectGroup>
- </SelectContent>
- </Select>
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ <ScrollArea className="flex min-h-0 min-w-0 flex-1 flex-col">
+ <ScrollAreaViewport
+ tabIndex={-1}
+ className="min-h-0 flex-1 overscroll-contain"
+ >
+ <ScrollAreaContent
+ className="px-6 py-4"
+ style={{ minWidth: '100%' }}
+ >
+ <Form {...form}>
+ <form className="space-y-4" noValidate onSubmit={onSubmit}>
+ <FormField
+ control={form.control}
+ name="theme"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <FormLabel>{t('settings.appearance.theme')}</FormLabel>
+ <FormControl>
+ <Select
+ items={themeOptions}
+ value={field.value}
+ onValueChange={(value) => {
+ if (value !== null) field.onChange(value)
+ }}
+ >
+ <SettingsSelectTrigger>
+ <SelectValue />
+ </SettingsSelectTrigger>
+ <SelectContent>
+ <SelectGroup>
+ {themeOptions.map((option) => (
+ <SelectItem
+ key={option.value}
+ value={option.value}
+ >
+ {option.label}
+ </SelectItem>
+ ))}
+ </SelectGroup>
+ </SelectContent>
+ </Select>
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- <FormField
- control={form.control}
- name="language"
- render={({ field }) => (
- <SettingsFormRow>
- <FormLabel>{t('settings.appearance.language')}</FormLabel>
- <FormControl>
- <Select
- items={LANGUAGE_OPTIONS}
- value={field.value}
- onValueChange={(value) => {
- if (isSupportedLocale(value)) field.onChange(value)
- }}
- >
- <SettingsSelectTrigger>
- <SelectValue />
- </SettingsSelectTrigger>
- <SelectContent>
- <SelectGroup>
- {LANGUAGE_OPTIONS.map((option) => (
- <SelectItem
- key={option.value}
- value={option.value}
- >
- {option.label}
- </SelectItem>
- ))}
- </SelectGroup>
- </SelectContent>
- </Select>
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ <FormField
+ control={form.control}
+ name="language"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <FormLabel>
+ {t('settings.appearance.language')}
+ </FormLabel>
+ <FormControl>
+ <Select
+ items={LANGUAGE_OPTIONS}
+ value={field.value}
+ onValueChange={(value) => {
+ if (isSupportedLocale(value))
+ field.onChange(value)
+ }}
+ >
+ <SettingsSelectTrigger>
+ <SelectValue />
+ </SettingsSelectTrigger>
+ <SelectContent>
+ <SelectGroup>
+ {LANGUAGE_OPTIONS.map((option) => (
+ <SelectItem
+ key={option.value}
+ value={option.value}
+ >
+ {option.label}
+ </SelectItem>
+ ))}
+ </SelectGroup>
+ </SelectContent>
+ </Select>
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- <FormField
- control={form.control}
- name="byteUnitSystem"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.appearance.byteUnitSystem')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.appearance.byteUnitSystemDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Select
- items={byteUnitOptions}
- value={field.value}
- onValueChange={(value) => {
- if (value !== null) field.onChange(value)
- }}
- >
- <SettingsSelectTrigger>
- <SelectValue />
- </SettingsSelectTrigger>
- <SelectContent>
- <SelectGroup>
- {byteUnitOptions.map((option) => (
- <SelectItem
- key={option.value}
- value={option.value}
- >
- {option.label}
- </SelectItem>
- ))}
- </SelectGroup>
- </SelectContent>
- </Select>
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ <FormField
+ control={form.control}
+ name="byteUnitSystem"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.appearance.byteUnitSystem')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.appearance.byteUnitSystemDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Select
+ items={byteUnitOptions}
+ value={field.value}
+ onValueChange={(value) => {
+ if (value !== null) field.onChange(value)
+ }}
+ >
+ <SettingsSelectTrigger>
+ <SelectValue />
+ </SettingsSelectTrigger>
+ <SelectContent>
+ <SelectGroup>
+ {byteUnitOptions.map((option) => (
+ <SelectItem
+ key={option.value}
+ value={option.value}
+ >
+ {option.label}
+ </SelectItem>
+ ))}
+ </SelectGroup>
+ </SelectContent>
+ </Select>
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- <FormField
- control={form.control}
- name="reduceMotion"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.appearance.reduceMotion')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.appearance.reduceMotionDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ <FormField
+ control={form.control}
+ name="reduceMotion"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.appearance.reduceMotion')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.appearance.reduceMotionDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- {isMac && (
- <FormField
- control={form.control}
- name="traySpeedometer"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.appearance.traySpeedometer')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.appearance.traySpeedometerDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
+ {isMac && (
+ <FormField
+ control={form.control}
+ name="traySpeedometer"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.appearance.traySpeedometer')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.appearance.traySpeedometerDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
)}
- />
- )}
- <FormField
- control={form.control}
- name="liquidGlassEffect"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.appearance.liquidGlassEffect')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.appearance.liquidGlassEffectDesc')}
- {isMac &&
- ` ${t('settings.appearance.liquidGlassEffectMacDesc')}`}
- </FormDescription>
- </div>
- <FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
-
- {showRunMode && (
- <FormField
- control={form.control}
- name="runMode"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t(
- isMac
- ? 'settings.appearance.runMode'
- : 'settings.appearance.runModeLaunch'
- )}
- </FormLabel>
- {isLinux && (
+ <FormField
+ control={form.control}
+ name="liquidGlassEffect"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.appearance.liquidGlassEffect')}
+ </FormLabel>
<FormDescription className="text-xs">
- {t('settings.appearance.runModeLinuxDesc')}
+ {t('settings.appearance.liquidGlassEffectDesc')}
+ {isMac &&
+ ` ${t('settings.appearance.liquidGlassEffectMacDesc')}`}
</FormDescription>
- )}
- </div>
- <FormControl>
- <Select
- items={runModeOptions}
- value={String(field.value)}
- onValueChange={(value) => {
- if (value !== null) {
- field.onChange(Number(value))
- }
- }}
- >
- <SettingsSelectTrigger className="min-w-48">
- <SelectValue />
- </SettingsSelectTrigger>
- <SelectContent>
- <SelectGroup>
- {runModeOptions.map((option) => (
- <SelectItem
- key={option.value}
- value={option.value}
- >
- {option.label}
- </SelectItem>
- ))}
- </SelectGroup>
- </SelectContent>
- </Select>
- </FormControl>
- </SettingsFormRow>
+ </div>
+ <FormControl>
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
+
+ {showRunMode && (
+ <FormField
+ control={form.control}
+ name="runMode"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t(
+ isMac
+ ? 'settings.appearance.runMode'
+ : 'settings.appearance.runModeLaunch'
+ )}
+ </FormLabel>
+ {isLinux && (
+ <FormDescription className="text-xs">
+ {t('settings.appearance.runModeLinuxDesc')}
+ </FormDescription>
+ )}
+ </div>
+ <FormControl>
+ <Select
+ items={runModeOptions}
+ value={String(field.value)}
+ onValueChange={(value) => {
+ if (value !== null) {
+ field.onChange(Number(value))
+ }
+ }}
+ >
+ <SettingsSelectTrigger className="min-w-48">
+ <SelectValue />
+ </SettingsSelectTrigger>
+ <SelectContent>
+ <SelectGroup>
+ {runModeOptions.map((option) => (
+ <SelectItem
+ key={option.value}
+ value={option.value}
+ >
+ {option.label}
+ </SelectItem>
+ ))}
+ </SelectGroup>
+ </SelectContent>
+ </Select>
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
)}
- />
- )}
- {transport.platform !== 'web' && (
- <FormField
- control={form.control}
- name="lightweightMode"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.appearance.lightweightMode')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.appearance.lightweightModeDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
+ {transport.platform !== 'web' && (
+ <FormField
+ control={form.control}
+ name="lightweightMode"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.appearance.lightweightMode')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.appearance.lightweightModeDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
)}
- />
- )}
- </form>
- </Form>
- </div>
+ </form>
+ </Form>
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ </ScrollArea>
<DialogFooter className="shrink-0 border-t border-border px-6 py-4">
{form.formState.errors.root?.save && (
diff --git a/src/renderer/routes/settings/cards/bit-torrent-dialog.test.tsx b/src/renderer/routes/settings/cards/bit-torrent-dialog.test.tsx
index 5bea0bb2..4d624d75 100644
--- a/src/renderer/routes/settings/cards/bit-torrent-dialog.test.tsx
+++ b/src/renderer/routes/settings/cards/bit-torrent-dialog.test.tsx
@@ -1,3 +1,4 @@
+import '@test-utils/dom-animations'
// src/renderer/routes/settings/cards/bit-torrent-dialog.test.tsx
import '@testing-library/jest-dom/vitest'
diff --git a/src/renderer/routes/settings/cards/bit-torrent-dialog.tsx b/src/renderer/routes/settings/cards/bit-torrent-dialog.tsx
index 9a2330cc..13612a33 100644
--- a/src/renderer/routes/settings/cards/bit-torrent-dialog.tsx
+++ b/src/renderer/routes/settings/cards/bit-torrent-dialog.tsx
@@ -1,4 +1,10 @@
import { SettingsFormRow } from '@renderer/components/settings-kit/settings-form-row'
+import {
+ ScrollArea,
+ ScrollAreaContent,
+ ScrollAreaViewport,
+ ScrollBar,
+} from '@renderer/components/ui/scroll-area'
// src/renderer/routes/settings/cards/bit-torrent-dialog.tsx
import { PresetChips } from '@renderer/components/settings-kit/preset-chips'
@@ -182,590 +188,625 @@ export function BitTorrentDialog({
<DialogDescription>{t(descKey)}</DialogDescription>
</DialogHeader>
- <div className="min-h-0 flex-1 overflow-y-auto px-6 py-4">
- <Form {...form}>
- <form className="space-y-4" noValidate onSubmit={onSubmit}>
- {/* Listen */}
- <h3 className="text-sm font-semibold text-foreground">
- {t('settings.bittorrent.listen.title')}
- </h3>
- <FormField
- control={form.control}
- name="engine.listenPort"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.bittorrent.listen.listenPort')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.bittorrent.listen.listenPortDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Input
- {...field}
- type="number"
- min={1024}
- max={65535}
- className="w-30 h-8"
- value={Number.isFinite(field.value) ? field.value : ''}
- onChange={(event) =>
- field.onChange(event.target.valueAsNumber)
- }
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
- <FormField
- control={form.control}
- name="engine.dhtListenPort"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.bittorrent.listen.dhtListenPort')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.bittorrent.listen.dhtListenPortDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Input
- {...field}
- type="number"
- min={1024}
- max={65535}
- className="w-30 h-8"
- value={Number.isFinite(field.value) ? field.value : ''}
- onChange={(event) =>
- field.onChange(event.target.valueAsNumber)
- }
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
- <FormField
- control={form.control}
- name="engine.dhtEnabled"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.bittorrent.listen.dhtEnabled')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.bittorrent.listen.dhtEnabledDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ <ScrollArea className="flex min-h-0 min-w-0 flex-1 flex-col">
+ <ScrollAreaViewport
+ tabIndex={-1}
+ className="min-h-0 flex-1 overscroll-contain"
+ >
+ <ScrollAreaContent
+ className="px-6 py-4"
+ style={{ minWidth: '100%' }}
+ >
+ <Form {...form}>
+ <form className="space-y-4" noValidate onSubmit={onSubmit}>
+ {/* Listen */}
+ <h3 className="text-sm font-semibold text-foreground">
+ {t('settings.bittorrent.listen.title')}
+ </h3>
+ <FormField
+ control={form.control}
+ name="engine.listenPort"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.bittorrent.listen.listenPort')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.bittorrent.listen.listenPortDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Input
+ {...field}
+ type="number"
+ min={1024}
+ max={65535}
+ className="w-30 h-8"
+ value={
+ Number.isFinite(field.value) ? field.value : ''
+ }
+ onChange={(event) =>
+ field.onChange(event.target.valueAsNumber)
+ }
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="engine.dhtListenPort"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.bittorrent.listen.dhtListenPort')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.bittorrent.listen.dhtListenPortDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Input
+ {...field}
+ type="number"
+ min={1024}
+ max={65535}
+ className="w-30 h-8"
+ value={
+ Number.isFinite(field.value) ? field.value : ''
+ }
+ onChange={(event) =>
+ field.onChange(event.target.valueAsNumber)
+ }
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="engine.dhtEnabled"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.bittorrent.listen.dhtEnabled')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.bittorrent.listen.dhtEnabledDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- <Separator className="my-4" />
+ <Separator className="my-4" />
- {/* Peers */}
- <h3 className="text-sm font-semibold text-foreground">
- {t('settings.bittorrent.peers.title')}
- </h3>
- <FormField
- control={form.control}
- name="engine.btMaxPeers"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.bittorrent.peers.btMaxPeers')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.bittorrent.peers.btMaxPeersDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Input
- {...field}
- type="number"
- min={1}
- max={1000}
- className="w-30 h-8"
- value={Number.isFinite(field.value) ? field.value : ''}
- onChange={(event) =>
- field.onChange(event.target.valueAsNumber)
- }
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
- <FormField
- control={form.control}
- name="engine.btEnableLpd"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.bittorrent.peers.btEnableLpd')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.bittorrent.peers.btEnableLpdDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
- <FormField
- control={form.control}
- name="app.magnetFileSelection"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.bittorrent.peers.magnetFileSelection')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.bittorrent.peers.magnetFileSelectionDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ {/* Peers */}
+ <h3 className="text-sm font-semibold text-foreground">
+ {t('settings.bittorrent.peers.title')}
+ </h3>
+ <FormField
+ control={form.control}
+ name="engine.btMaxPeers"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.bittorrent.peers.btMaxPeers')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.bittorrent.peers.btMaxPeersDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Input
+ {...field}
+ type="number"
+ min={1}
+ max={1000}
+ className="w-30 h-8"
+ value={
+ Number.isFinite(field.value) ? field.value : ''
+ }
+ onChange={(event) =>
+ field.onChange(event.target.valueAsNumber)
+ }
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="engine.btEnableLpd"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.bittorrent.peers.btEnableLpd')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.bittorrent.peers.btEnableLpdDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="app.magnetFileSelection"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.bittorrent.peers.magnetFileSelection')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t(
+ 'settings.bittorrent.peers.magnetFileSelectionDesc'
+ )}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- <FormField
- control={form.control}
- name="app.magnetFileSelectionAutoDownload"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t(
- 'settings.bittorrent.peers.magnetFileSelectionAutoDownload'
- )}
- </FormLabel>
- <FormDescription className="text-xs">
- {t(
- 'settings.bittorrent.peers.magnetFileSelectionAutoDownloadDesc'
- )}
- </FormDescription>
- </div>
- <FormControl>
- <Switch
- checked={field.value}
- disabled={!fileSelectionEnabled}
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
- {(autoDownloadEnabled ||
- form.formState.errors.app
- ?.magnetFileSelectionTimeoutSeconds) && (
- <FormField
- control={form.control}
- name="app.magnetFileSelectionTimeoutSeconds"
- render={({ field }) => (
- <FormItem className="flex items-start justify-between gap-4">
- <div className="space-y-1">
- <FormLabel>
- {t(
- 'settings.bittorrent.peers.magnetFileSelectionTimeoutSeconds'
- )}
- </FormLabel>
- <FormDescription className="text-xs">
- {t(
- 'settings.bittorrent.peers.magnetFileSelectionTimeoutSecondsDesc'
- )}
- </FormDescription>
- <FormMessage />
- </div>
- <FormControl>
- <Input
- {...field}
- type="number"
- min={MAGNET_FILE_SELECTION_TIMEOUT_MIN_SECONDS}
- max={MAGNET_FILE_SELECTION_TIMEOUT_MAX_SECONDS}
- step={1}
- className="w-30 h-8"
- disabled={
- !fileSelectionEnabled &&
- !form.formState.errors.app
- ?.magnetFileSelectionTimeoutSeconds
- }
- value={
- Number.isFinite(field.value) ? field.value : ''
- }
- onChange={(event) =>
- field.onChange(event.target.valueAsNumber)
- }
- />
- </FormControl>
- </FormItem>
+ <FormField
+ control={form.control}
+ name="app.magnetFileSelectionAutoDownload"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t(
+ 'settings.bittorrent.peers.magnetFileSelectionAutoDownload'
+ )}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t(
+ 'settings.bittorrent.peers.magnetFileSelectionAutoDownloadDesc'
+ )}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Switch
+ checked={field.value}
+ disabled={!fileSelectionEnabled}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
+ {(autoDownloadEnabled ||
+ form.formState.errors.app
+ ?.magnetFileSelectionTimeoutSeconds) && (
+ <FormField
+ control={form.control}
+ name="app.magnetFileSelectionTimeoutSeconds"
+ render={({ field }) => (
+ <FormItem className="flex items-start justify-between gap-4">
+ <div className="space-y-1">
+ <FormLabel>
+ {t(
+ 'settings.bittorrent.peers.magnetFileSelectionTimeoutSeconds'
+ )}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t(
+ 'settings.bittorrent.peers.magnetFileSelectionTimeoutSecondsDesc'
+ )}
+ </FormDescription>
+ <FormMessage />
+ </div>
+ <FormControl>
+ <Input
+ {...field}
+ type="number"
+ min={MAGNET_FILE_SELECTION_TIMEOUT_MIN_SECONDS}
+ max={MAGNET_FILE_SELECTION_TIMEOUT_MAX_SECONDS}
+ step={1}
+ className="w-30 h-8"
+ disabled={
+ !fileSelectionEnabled &&
+ !form.formState.errors.app
+ ?.magnetFileSelectionTimeoutSeconds
+ }
+ value={
+ Number.isFinite(field.value) ? field.value : ''
+ }
+ onChange={(event) =>
+ field.onChange(event.target.valueAsNumber)
+ }
+ />
+ </FormControl>
+ </FormItem>
+ )}
+ />
)}
- />
- )}
- <Separator className="my-4" />
+ <Separator className="my-4" />
- {/* Seeding */}
- <h3 className="text-sm font-semibold text-foreground">
- {t('settings.bittorrent.seeding.title')}
- </h3>
- <FormField
- control={form.control}
- name="engine.seedRatio"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.bittorrent.seeding.seedRatio')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.bittorrent.seeding.seedRatioDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Input
- {...field}
- type="number"
- min={0}
- max={100}
- step={0.1}
- className="w-30 h-8"
- value={Number.isFinite(field.value) ? field.value : ''}
- onChange={(event) =>
- field.onChange(event.target.valueAsNumber)
- }
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
- <FormField
- control={form.control}
- name="engine.seedTime"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.bittorrent.seeding.seedTime')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.bittorrent.seeding.seedTimeDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Input
- {...field}
- type="number"
- min={0}
- max={525600}
- className="w-30 h-8"
- value={Number.isFinite(field.value) ? field.value : ''}
- onChange={(event) =>
- field.onChange(event.target.valueAsNumber)
- }
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ {/* Seeding */}
+ <h3 className="text-sm font-semibold text-foreground">
+ {t('settings.bittorrent.seeding.title')}
+ </h3>
+ <FormField
+ control={form.control}
+ name="engine.seedRatio"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.bittorrent.seeding.seedRatio')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.bittorrent.seeding.seedRatioDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Input
+ {...field}
+ type="number"
+ min={0}
+ max={100}
+ step={0.1}
+ className="w-30 h-8"
+ value={
+ Number.isFinite(field.value) ? field.value : ''
+ }
+ onChange={(event) =>
+ field.onChange(event.target.valueAsNumber)
+ }
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="engine.seedTime"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.bittorrent.seeding.seedTime')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.bittorrent.seeding.seedTimeDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Input
+ {...field}
+ type="number"
+ min={0}
+ max={525600}
+ className="w-30 h-8"
+ value={
+ Number.isFinite(field.value) ? field.value : ''
+ }
+ onChange={(event) =>
+ field.onChange(event.target.valueAsNumber)
+ }
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- <Separator className="my-4" />
+ <Separator className="my-4" />
- {/* Trackers (config) */}
- <h3 className="text-sm font-semibold text-foreground">
- {t('settings.bittorrent.trackers.title')}
- </h3>
- <p className="text-xs text-muted-foreground">
- {t('settings.bittorrent.trackers.manageSourcesHint')}
- </p>
+ {/* Trackers (config) */}
+ <h3 className="text-sm font-semibold text-foreground">
+ {t('settings.bittorrent.trackers.title')}
+ </h3>
+ <p className="text-xs text-muted-foreground">
+ {t('settings.bittorrent.trackers.manageSourcesHint')}
+ </p>
- <FormField
- control={form.control}
- name="tracker.autoSync"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.bittorrent.trackers.autoSync')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.bittorrent.trackers.autoSyncDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ <FormField
+ control={form.control}
+ name="tracker.autoSync"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.bittorrent.trackers.autoSync')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.bittorrent.trackers.autoSyncDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- <FormField
- control={form.control}
- name="tracker.syncIntervalHours"
- render={({ field }) => (
- <FormItem className="space-y-2">
- <div className="flex items-start justify-between gap-4">
- <div className="space-y-1">
- <FormLabel>
- {t('settings.bittorrent.trackers.syncInterval')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.bittorrent.trackers.syncIntervalDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Input
- {...field}
- type="number"
- min={1}
- max={168}
- className="w-30 h-8"
- value={
- Number.isFinite(field.value) ? field.value : ''
- }
- onChange={(event) =>
- field.onChange(event.target.valueAsNumber)
- }
+ <FormField
+ control={form.control}
+ name="tracker.syncIntervalHours"
+ render={({ field }) => (
+ <FormItem className="space-y-2">
+ <div className="flex items-start justify-between gap-4">
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.bittorrent.trackers.syncInterval')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t(
+ 'settings.bittorrent.trackers.syncIntervalDesc'
+ )}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Input
+ {...field}
+ type="number"
+ min={1}
+ max={168}
+ className="w-30 h-8"
+ value={
+ Number.isFinite(field.value) ? field.value : ''
+ }
+ onChange={(event) =>
+ field.onChange(event.target.valueAsNumber)
+ }
+ />
+ </FormControl>
+ </div>
+ <PresetChips
+ name="tracker.syncIntervalHours"
+ options={[
+ { label: '6h', value: 6 },
+ { label: '12h', value: 12 },
+ { label: '24h', value: 24 },
+ ]}
/>
- </FormControl>
- </div>
- <PresetChips
- name="tracker.syncIntervalHours"
- options={[
- { label: '6h', value: 6 },
- { label: '12h', value: 12 },
- { label: '24h', value: 24 },
- ]}
- />
- <FormMessage className="basis-full text-xs" />
- </FormItem>
- )}
- />
+ <FormMessage className="basis-full text-xs" />
+ </FormItem>
+ )}
+ />
- <FormField
- control={form.control}
- name="tracker.probeEnabled"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.bittorrent.trackers.enableProbe')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.bittorrent.trackers.enableProbeDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ <FormField
+ control={form.control}
+ name="tracker.probeEnabled"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.bittorrent.trackers.enableProbe')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.bittorrent.trackers.enableProbeDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- <FormField
- control={form.control}
- name="tracker.probeTimeoutMs"
- render={({ field }) => (
- <FormItem className="space-y-2">
- <div className="flex items-start justify-between gap-4">
- <div className="space-y-1">
- <FormLabel>
- {t('settings.bittorrent.trackers.probeTimeout')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.bittorrent.trackers.probeTimeoutDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Input
- {...field}
- type="number"
- min={1000}
- max={30000}
- step={500}
- className="w-30 h-8"
- value={
- Number.isFinite(field.value) ? field.value : ''
- }
- onChange={(event) =>
- field.onChange(event.target.valueAsNumber)
- }
+ <FormField
+ control={form.control}
+ name="tracker.probeTimeoutMs"
+ render={({ field }) => (
+ <FormItem className="space-y-2">
+ <div className="flex items-start justify-between gap-4">
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.bittorrent.trackers.probeTimeout')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t(
+ 'settings.bittorrent.trackers.probeTimeoutDesc'
+ )}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Input
+ {...field}
+ type="number"
+ min={1000}
+ max={30000}
+ step={500}
+ className="w-30 h-8"
+ value={
+ Number.isFinite(field.value) ? field.value : ''
+ }
+ onChange={(event) =>
+ field.onChange(event.target.valueAsNumber)
+ }
+ />
+ </FormControl>
+ </div>
+ <PresetChips
+ name="tracker.probeTimeoutMs"
+ options={[
+ { label: '3s', value: 3000 },
+ { label: '5s', value: 5000 },
+ { label: '10s', value: 10000 },
+ ]}
/>
- </FormControl>
- </div>
- <PresetChips
- name="tracker.probeTimeoutMs"
- options={[
- { label: '3s', value: 3000 },
- { label: '5s', value: 5000 },
- { label: '10s', value: 10000 },
- ]}
- />
- <FormMessage className="basis-full text-xs" />
- </FormItem>
- )}
- />
+ <FormMessage className="basis-full text-xs" />
+ </FormItem>
+ )}
+ />
- <FormField
- control={form.control}
- name="tracker.healthyThresholdMs"
- render={({ field }) => (
- <FormItem className="space-y-2">
- <div className="flex items-start justify-between gap-4">
- <div className="space-y-1">
- <FormLabel>
- {t('settings.bittorrent.trackers.healthyThreshold')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t(
- 'settings.bittorrent.trackers.healthyThresholdDesc'
- )}
- </FormDescription>
- </div>
- <FormControl>
- <Input
- {...field}
- type="number"
- min={500}
- max={10000}
- step={100}
- className="w-30 h-8"
- value={
- Number.isFinite(field.value) ? field.value : ''
- }
- onChange={(event) =>
- field.onChange(event.target.valueAsNumber)
- }
+ <FormField
+ control={form.control}
+ name="tracker.healthyThresholdMs"
+ render={({ field }) => (
+ <FormItem className="space-y-2">
+ <div className="flex items-start justify-between gap-4">
+ <div className="space-y-1">
+ <FormLabel>
+ {t(
+ 'settings.bittorrent.trackers.healthyThreshold'
+ )}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t(
+ 'settings.bittorrent.trackers.healthyThresholdDesc'
+ )}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Input
+ {...field}
+ type="number"
+ min={500}
+ max={10000}
+ step={100}
+ className="w-30 h-8"
+ value={
+ Number.isFinite(field.value) ? field.value : ''
+ }
+ onChange={(event) =>
+ field.onChange(event.target.valueAsNumber)
+ }
+ />
+ </FormControl>
+ </div>
+ <PresetChips
+ name="tracker.healthyThresholdMs"
+ options={[
+ { label: '1s', value: 1000 },
+ { label: '2s', value: 2000 },
+ { label: '5s', value: 5000 },
+ ]}
/>
- </FormControl>
- </div>
- <PresetChips
- name="tracker.healthyThresholdMs"
- options={[
- { label: '1s', value: 1000 },
- { label: '2s', value: 2000 },
- { label: '5s', value: 5000 },
- ]}
- />
- <FormMessage className="basis-full text-xs" />
- </FormItem>
- )}
- />
+ <FormMessage className="basis-full text-xs" />
+ </FormItem>
+ )}
+ />
- <FormField
- control={form.control}
- name="tracker.minSuccessRate"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.bittorrent.trackers.minSuccessRate')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.bittorrent.trackers.minSuccessRateDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Input
- {...field}
- type="number"
- min={0}
- max={1}
- step={0.05}
- className="w-30 h-8"
- value={Number.isFinite(field.value) ? field.value : ''}
- onChange={(event) =>
- field.onChange(event.target.valueAsNumber)
- }
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ <FormField
+ control={form.control}
+ name="tracker.minSuccessRate"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.bittorrent.trackers.minSuccessRate')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t(
+ 'settings.bittorrent.trackers.minSuccessRateDesc'
+ )}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Input
+ {...field}
+ type="number"
+ min={0}
+ max={1}
+ step={0.05}
+ className="w-30 h-8"
+ value={
+ Number.isFinite(field.value) ? field.value : ''
+ }
+ onChange={(event) =>
+ field.onChange(event.target.valueAsNumber)
+ }
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- <FormField
- control={form.control}
- name="tracker.maxTrackerCount"
- render={({ field }) => (
- <FormItem className="space-y-2">
- <div className="flex items-start justify-between gap-4">
- <div className="space-y-1">
- <FormLabel>
- {t('settings.bittorrent.trackers.maxTrackerCount')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t(
- 'settings.bittorrent.trackers.maxTrackerCountDesc'
- )}
- </FormDescription>
- </div>
- <FormControl>
- <Input
- {...field}
- type="number"
- min={5}
- max={200}
- className="w-30 h-8"
- value={
- Number.isFinite(field.value) ? field.value : ''
- }
- onChange={(event) =>
- field.onChange(event.target.valueAsNumber)
- }
+ <FormField
+ control={form.control}
+ name="tracker.maxTrackerCount"
+ render={({ field }) => (
+ <FormItem className="space-y-2">
+ <div className="flex items-start justify-between gap-4">
+ <div className="space-y-1">
+ <FormLabel>
+ {t(
+ 'settings.bittorrent.trackers.maxTrackerCount'
+ )}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t(
+ 'settings.bittorrent.trackers.maxTrackerCountDesc'
+ )}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Input
+ {...field}
+ type="number"
+ min={5}
+ max={200}
+ className="w-30 h-8"
+ value={
+ Number.isFinite(field.value) ? field.value : ''
+ }
+ onChange={(event) =>
+ field.onChange(event.target.valueAsNumber)
+ }
+ />
+ </FormControl>
+ </div>
+ <PresetChips
+ name="tracker.maxTrackerCount"
+ options={[
+ { label: '20', value: 20 },
+ { label: '50', value: 50 },
+ { label: '100', value: 100 },
+ ]}
/>
- </FormControl>
- </div>
- <PresetChips
- name="tracker.maxTrackerCount"
- options={[
- { label: '20', value: 20 },
- { label: '50', value: 50 },
- { label: '100', value: 100 },
- ]}
- />
- <FormMessage className="basis-full text-xs" />
- </FormItem>
- )}
- />
+ <FormMessage className="basis-full text-xs" />
+ </FormItem>
+ )}
+ />
- <p className="text-xs text-muted-foreground">
- {t('settings.bittorrent.trackers.blacklistMovedInfo')}
- </p>
- </form>
- </Form>
+ <p className="text-xs text-muted-foreground">
+ {t('settings.bittorrent.trackers.blacklistMovedInfo')}
+ </p>
+ </form>
+ </Form>
- {/* Peer geo — self-contained form; rendered outside BT form to avoid nested <form> */}
- <div className="mt-4 border-t border-border pt-4">
- <BtPeerGeoSection ref={geoipRef} />
- </div>
- </div>
+ {/* Peer geo — self-contained form; rendered outside BT form to avoid nested <form> */}
+ <div className="mt-4 border-t border-border pt-4">
+ <BtPeerGeoSection ref={geoipRef} />
+ </div>
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ </ScrollArea>
<DialogFooter className="shrink-0 border-t border-border px-6 py-4">
{form.formState.errors.root?.save && (
diff --git a/src/renderer/routes/settings/cards/downloads-dialog.test.tsx b/src/renderer/routes/settings/cards/downloads-dialog.test.tsx
index a22b7fe3..086d08e7 100644
--- a/src/renderer/routes/settings/cards/downloads-dialog.test.tsx
+++ b/src/renderer/routes/settings/cards/downloads-dialog.test.tsx
@@ -1,3 +1,4 @@
+import '@test-utils/dom-animations'
import { setByteUnitSystem } from '@renderer/hooks/use-byte-format'
import '@testing-library/jest-dom/vitest'
import { i18n } from '@renderer/lib/i18n'
diff --git a/src/renderer/routes/settings/cards/downloads-dialog.tsx b/src/renderer/routes/settings/cards/downloads-dialog.tsx
index cc082452..3f4d0a74 100644
--- a/src/renderer/routes/settings/cards/downloads-dialog.tsx
+++ b/src/renderer/routes/settings/cards/downloads-dialog.tsx
@@ -10,6 +10,12 @@ import {
DialogTitle,
} from '@renderer/components/ui/dialog'
import { Form } from '@renderer/components/ui/form'
+import {
+ ScrollArea,
+ ScrollAreaContent,
+ ScrollAreaViewport,
+ ScrollBar,
+} from '@renderer/components/ui/scroll-area'
import { Separator } from '@renderer/components/ui/separator'
import { useByteFormat } from '@renderer/hooks/use-byte-format'
import { pickDirty } from '@renderer/lib/form-utils'
@@ -110,17 +116,28 @@ export function DownloadsDialog({
<DialogDescription>{t(descKey)}</DialogDescription>
</DialogHeader>
- <div className="min-h-0 flex-1 overflow-y-auto px-6 py-4">
- <Form {...form}>
- <form className="space-y-4" noValidate onSubmit={onSubmit}>
- <PerformanceSection form={form} />
- <Separator className="my-4" />
- <SpeedLimitSection form={form} />
- <Separator className="my-4" />
- <EngineTuningSection form={form} />
- </form>
- </Form>
- </div>
+ <ScrollArea className="flex min-h-0 min-w-0 flex-1 flex-col">
+ <ScrollAreaViewport
+ tabIndex={-1}
+ className="min-h-0 flex-1 overscroll-contain"
+ >
+ <ScrollAreaContent
+ className="px-6 py-4"
+ style={{ minWidth: '100%' }}
+ >
+ <Form {...form}>
+ <form className="space-y-4" noValidate onSubmit={onSubmit}>
+ <PerformanceSection form={form} />
+ <Separator className="my-4" />
+ <SpeedLimitSection form={form} />
+ <Separator className="my-4" />
+ <EngineTuningSection form={form} />
+ </form>
+ </Form>
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ </ScrollArea>
<DialogFooter className="shrink-0 border-t border-border px-6 py-4">
{form.formState.errors.root?.save && (
diff --git a/src/renderer/routes/settings/cards/general-dialog.test.tsx b/src/renderer/routes/settings/cards/general-dialog.test.tsx
index 1bf91cbc..ac29a55b 100644
--- a/src/renderer/routes/settings/cards/general-dialog.test.tsx
+++ b/src/renderer/routes/settings/cards/general-dialog.test.tsx
@@ -1,3 +1,4 @@
+import '@test-utils/dom-animations'
import type { SaveGeneralSettingsRequest } from '@shared/schemas/general-settings'
import {
generalSettingsSnapshot,
diff --git a/src/renderer/routes/settings/cards/general-dialog.tsx b/src/renderer/routes/settings/cards/general-dialog.tsx
index 95c64dfe..ae99ddb8 100644
--- a/src/renderer/routes/settings/cards/general-dialog.tsx
+++ b/src/renderer/routes/settings/cards/general-dialog.tsx
@@ -23,6 +23,12 @@ import {
FormMessage,
useFormField,
} from '@renderer/components/ui/form'
+import {
+ ScrollArea,
+ ScrollAreaContent,
+ ScrollAreaViewport,
+ ScrollBar,
+} from '@renderer/components/ui/scroll-area'
import { Switch } from '@renderer/components/ui/switch'
import {
DirectoryPreferencesSection,
@@ -110,222 +116,242 @@ export function GeneralDialog({
<DialogDescription>{t(descKey)}</DialogDescription>
</DialogHeader>
- <div
- ref={contentRef}
- tabIndex={-1}
- className="min-h-0 flex-1 overflow-y-auto px-6 py-4 outline-none"
- >
- <DirectoryPreferencesStatus
- loading={directories.loading}
- error={directories.error}
- disabled={busy}
- onRetry={() => {
- contentRef.current?.focus({ preventScroll: true })
- void directories.refresh()
- }}
- />
+ <ScrollArea className="flex min-h-0 min-w-0 flex-1 flex-col">
+ <ScrollAreaViewport
+ ref={contentRef}
+ tabIndex={-1}
+ className="min-h-0 flex-1 overscroll-contain"
+ >
+ <ScrollAreaContent
+ className="px-6 py-4"
+ style={{ minWidth: '100%' }}
+ >
+ <DirectoryPreferencesStatus
+ loading={directories.loading}
+ error={directories.error}
+ disabled={busy}
+ onRetry={() => {
+ contentRef.current?.focus({ preventScroll: true })
+ void directories.refresh()
+ }}
+ />
- <Form {...form}>
- <form noValidate onSubmit={onSubmit}>
- <fieldset className="min-w-0 space-y-4" disabled={fieldsDisabled}>
- {!isWeb && (
- <FormField
- control={form.control}
- name="launchAtStartup"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.general.launchAtStartup')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.general.launchAtStartupDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Switch
- disabled={fieldsDisabled}
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
+ <Form {...form}>
+ <form noValidate onSubmit={onSubmit}>
+ <fieldset
+ className="min-w-0 space-y-4"
+ disabled={fieldsDisabled}
+ >
+ {!isWeb && (
+ <FormField
+ control={form.control}
+ name="launchAtStartup"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.general.launchAtStartup')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.general.launchAtStartupDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Switch
+ disabled={fieldsDisabled}
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
)}
- />
- )}
- {!isWeb && (
- <FormField
- control={form.control}
- name="showMainWindowAtLogin"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.general.showMainWindowAtLogin')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.general.showMainWindowAtLoginDesc', {
- mode: t(
- transport.platform === 'darwin'
- ? 'settings.appearance.runModeTray'
- : 'settings.appearance.runModeTrayDesktop'
- ),
- })}
- </FormDescription>
- </div>
- <FormControl>
- <Switch
- disabled={
- fieldsDisabled || !form.watch('launchAtStartup')
- }
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
+ {!isWeb && (
+ <FormField
+ control={form.control}
+ name="showMainWindowAtLogin"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.general.showMainWindowAtLogin')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t(
+ 'settings.general.showMainWindowAtLoginDesc',
+ {
+ mode: t(
+ transport.platform === 'darwin'
+ ? 'settings.appearance.runModeTray'
+ : 'settings.appearance.runModeTrayDesktop'
+ ),
+ }
+ )}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Switch
+ disabled={
+ fieldsDisabled ||
+ !form.watch('launchAtStartup')
+ }
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
)}
- />
- )}
- <FormField
- control={form.control}
- name="defaultSaveDir"
- render={({ field }) => (
- <FormItem className="space-y-2">
- <div className="space-y-1">
- <FormLabel>
- {t('settings.general.defaultSaveDir')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.general.defaultSaveDirDesc')}
- </FormDescription>
- </div>
- <SettingsDirectoryPicker
- inputProps={{ ref: field.ref, onBlur: field.onBlur }}
- recordRecent={false}
- allowFavoriteEditing={false}
- disabled={directories.saving || favoritePicking}
- onPickingChange={setDefaultPicking}
- />
- <FormMessage className="basis-full text-xs" />
- </FormItem>
- )}
- />
+ <FormField
+ control={form.control}
+ name="defaultSaveDir"
+ render={({ field }) => (
+ <FormItem className="space-y-2">
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.general.defaultSaveDir')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.general.defaultSaveDirDesc')}
+ </FormDescription>
+ </div>
+ <SettingsDirectoryPicker
+ inputProps={{
+ ref: field.ref,
+ onBlur: field.onBlur,
+ }}
+ recordRecent={false}
+ allowFavoriteEditing={false}
+ disabled={directories.saving || favoritePicking}
+ onPickingChange={setDefaultPicking}
+ />
+ <FormMessage className="basis-full text-xs" />
+ </FormItem>
+ )}
+ />
- <div className="space-y-3 border-b pb-4">
- <p className="text-xs text-muted-foreground">
- {t('directoryPreferences.sectionDescription')}
- </p>
- <DirectoryPreferencesSection
- preferences={directories.preferences}
- onChange={directories.setPreferences}
- disabled={busy || directories.loading || !directories.ready}
- onPickingChange={setFavoritePicking}
- />
- </div>
+ <div className="space-y-3 border-b pb-4">
+ <p className="text-xs text-muted-foreground">
+ {t('directoryPreferences.sectionDescription')}
+ </p>
+ <DirectoryPreferencesSection
+ preferences={directories.preferences}
+ onChange={directories.setPreferences}
+ disabled={
+ busy || directories.loading || !directories.ready
+ }
+ onPickingChange={setFavoritePicking}
+ />
+ </div>
- <FormField
- control={form.control}
- name="autofillClipboardLinks"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.general.autofillClipboardLinks')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.general.autofillClipboardLinksDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Switch
- disabled={fieldsDisabled}
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ <FormField
+ control={form.control}
+ name="autofillClipboardLinks"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.general.autofillClipboardLinks')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.general.autofillClipboardLinksDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Switch
+ disabled={fieldsDisabled}
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- <FormField
- control={form.control}
- name="notifyOnComplete"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.general.notifyOnComplete')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.general.notifyOnCompleteDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Switch
- disabled={fieldsDisabled}
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ <FormField
+ control={form.control}
+ name="notifyOnComplete"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.general.notifyOnComplete')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.general.notifyOnCompleteDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Switch
+ disabled={fieldsDisabled}
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- <FormField
- control={form.control}
- name="notifyOnError"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.general.notifyOnError')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.general.notifyOnErrorDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Switch
- disabled={fieldsDisabled}
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ <FormField
+ control={form.control}
+ name="notifyOnError"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.general.notifyOnError')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.general.notifyOnErrorDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Switch
+ disabled={fieldsDisabled}
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- {!isWeb && (
- <FormField
- control={form.control}
- name="warnBeforeQuit"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>
- {t('settings.general.warnBeforeQuit')}
- </FormLabel>
- <FormDescription className="text-xs">
- {t('settings.general.warnBeforeQuitDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Switch
- disabled={fieldsDisabled}
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
+ {!isWeb && (
+ <FormField
+ control={form.control}
+ name="warnBeforeQuit"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.general.warnBeforeQuit')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.general.warnBeforeQuitDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Switch
+ disabled={fieldsDisabled}
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
)}
- />
- )}
- </fieldset>
- </form>
- </Form>
- </div>
+ </fieldset>
+ </form>
+ </Form>
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ </ScrollArea>
<DialogFooter className="shrink-0 border-t border-border px-6 py-4">
{form.formState.errors.root?.save && (
diff --git a/src/renderer/routes/settings/cards/integration/integration-dialog.test.tsx b/src/renderer/routes/settings/cards/integration/integration-dialog.test.tsx
index e0e2ab72..1b941f61 100644
--- a/src/renderer/routes/settings/cards/integration/integration-dialog.test.tsx
+++ b/src/renderer/routes/settings/cards/integration/integration-dialog.test.tsx
@@ -1,3 +1,4 @@
+import '@test-utils/dom-animations'
import '@renderer/lib/i18n'
import '@testing-library/jest-dom/vitest'
import {
diff --git a/src/renderer/routes/settings/cards/integration/integration-dialog.tsx b/src/renderer/routes/settings/cards/integration/integration-dialog.tsx
index 0ff4a5c5..e239b8f5 100644
--- a/src/renderer/routes/settings/cards/integration/integration-dialog.tsx
+++ b/src/renderer/routes/settings/cards/integration/integration-dialog.tsx
@@ -12,6 +12,12 @@ import {
DialogHeader,
DialogTitle,
} from '@renderer/components/ui/dialog'
+import {
+ ScrollArea,
+ ScrollAreaContent,
+ ScrollAreaViewport,
+ ScrollBar,
+} from '@renderer/components/ui/scroll-area'
import { Separator } from '@renderer/components/ui/separator'
import { pickDirty } from '@renderer/lib/form-utils'
import { transport } from '@renderer/lib/transport'
@@ -119,84 +125,95 @@ export function IntegrationDialog({
<DialogDescription>{t(descKey)}</DialogDescription>
</DialogHeader>
- <div className="min-h-0 flex-1 overflow-y-auto px-6 py-4">
- <FormProvider {...form}>
- <div className="flex flex-col gap-6">
- {!isWeb && (
- <>
+ <ScrollArea className="flex min-h-0 min-w-0 flex-1 flex-col">
+ <ScrollAreaViewport
+ tabIndex={-1}
+ className="min-h-0 flex-1 overscroll-contain"
+ >
+ <ScrollAreaContent
+ className="px-6 py-4"
+ style={{ minWidth: '100%' }}
+ >
+ <FormProvider {...form}>
+ <div className="flex flex-col gap-6">
+ {!isWeb && (
+ <>
+ <section
+ aria-labelledby="integration-system"
+ className="flex flex-col gap-3"
+ >
+ <h3
+ id="integration-system"
+ className="text-sm font-semibold text-foreground"
+ >
+ {t('settings.integration.system.title')}
+ </h3>
+ <SystemProtocolsSection
+ refreshRevision={protocolRevision}
+ />
+ <AppImageIntegrationSection
+ onIntegrationChange={() =>
+ setProtocolRevision((revision) => revision + 1)
+ }
+ />
+ </section>
+
+ <Separator />
+ </>
+ )}
+
<section
- aria-labelledby="integration-system"
+ aria-labelledby="integration-browser"
className="flex flex-col gap-3"
>
<h3
- id="integration-system"
+ id="integration-browser"
className="text-sm font-semibold text-foreground"
>
- {t('settings.integration.system.title')}
+ {t('settings.integration.browser.title')}
</h3>
- <SystemProtocolsSection
- refreshRevision={protocolRevision}
- />
- <AppImageIntegrationSection
- onIntegrationChange={() =>
- setProtocolRevision((revision) => revision + 1)
- }
- />
+ <BrowserExtensionsSection />
+ {!isWeb && <AppImageNativeHostSection />}
</section>
<Separator />
- </>
- )}
-
- <section
- aria-labelledby="integration-browser"
- className="flex flex-col gap-3"
- >
- <h3
- id="integration-browser"
- className="text-sm font-semibold text-foreground"
- >
- {t('settings.integration.browser.title')}
- </h3>
- <BrowserExtensionsSection />
- {!isWeb && <AppImageNativeHostSection />}
- </section>
-
- <Separator />
- <section
- aria-labelledby="integration-cli"
- className="flex flex-col gap-4"
- >
- <h3
- id="integration-cli"
- className="text-sm font-semibold text-foreground"
- >
- {t('settings.integration.cli.title')}
- </h3>
- <CliToolSection />
- <Separator />
- <CLIClientsSection />
- <PendingApprovalsSection />
- </section>
+ <section
+ aria-labelledby="integration-cli"
+ className="flex flex-col gap-4"
+ >
+ <h3
+ id="integration-cli"
+ className="text-sm font-semibold text-foreground"
+ >
+ {t('settings.integration.cli.title')}
+ </h3>
+ <CliToolSection />
+ <Separator />
+ <CLIClientsSection />
+ <PendingApprovalsSection />
+ </section>
- <Separator />
+ <Separator />
- <section
- aria-labelledby="integration-media"
- className="flex flex-col gap-3"
- >
- <h3
- id="integration-media"
- className="text-sm font-semibold text-foreground"
- >
- {t('settings.integration.media.title')}
- </h3>
- <MediaToolsSection />
- </section>
- </div>
- </FormProvider>
- </div>
+ <section
+ aria-labelledby="integration-media"
+ className="flex flex-col gap-3"
+ >
+ <h3
+ id="integration-media"
+ className="text-sm font-semibold text-foreground"
+ >
+ {t('settings.integration.media.title')}
+ </h3>
+ <MediaToolsSection />
+ </section>
+ </div>
+ </FormProvider>
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ </ScrollArea>
<DialogFooter className="shrink-0 border-t border-border px-6 py-4">
{form.formState.errors.root?.save && (
diff --git a/src/renderer/routes/settings/cards/network-dialog.test.tsx b/src/renderer/routes/settings/cards/network-dialog.test.tsx
index 6a02ad96..b5fc6a3c 100644
--- a/src/renderer/routes/settings/cards/network-dialog.test.tsx
+++ b/src/renderer/routes/settings/cards/network-dialog.test.tsx
@@ -1,3 +1,4 @@
+import '@test-utils/dom-animations'
import '@testing-library/jest-dom/vitest'
import { i18n } from '@renderer/lib/i18n'
import { Commands } from '@shared/protocol/commands'
diff --git a/src/renderer/routes/settings/cards/network-dialog.tsx b/src/renderer/routes/settings/cards/network-dialog.tsx
index bf02932f..30cc6457 100644
--- a/src/renderer/routes/settings/cards/network-dialog.tsx
+++ b/src/renderer/routes/settings/cards/network-dialog.tsx
@@ -24,6 +24,12 @@ import {
FormMessage,
} from '@renderer/components/ui/form'
import { Input } from '@renderer/components/ui/input'
+import {
+ ScrollArea,
+ ScrollAreaContent,
+ ScrollAreaViewport,
+ ScrollBar,
+} from '@renderer/components/ui/scroll-area'
import {
Select,
SelectContent,
@@ -148,298 +154,322 @@ export function NetworkDialog({
<DialogDescription>{t(descKey)}</DialogDescription>
</DialogHeader>
- <div className="min-h-0 flex-1 overflow-y-auto px-6 py-4">
- <Form {...form}>
- <form className="space-y-4" noValidate onSubmit={onSubmit}>
- <ProxySection form={form} />
+ <ScrollArea className="flex min-h-0 min-w-0 flex-1 flex-col">
+ <ScrollAreaViewport
+ tabIndex={-1}
+ className="min-h-0 flex-1 overscroll-contain"
+ >
+ <ScrollAreaContent
+ className="px-6 py-4"
+ style={{ minWidth: '100%' }}
+ >
+ <Form {...form}>
+ <form className="space-y-4" noValidate onSubmit={onSubmit}>
+ <ProxySection form={form} />
- <Separator className="my-4" />
+ <Separator className="my-4" />
- {/* DNS resolution */}
- <h3 className="text-sm font-semibold text-foreground">
- {t('settings.network.dns.title')}
- </h3>
- <FormField
- control={form.control}
- name="engine.dnsMode"
- render={({ field }) => (
- <SettingsFormRow className="flex flex-col items-stretch gap-2 sm:flex-row sm:items-start sm:justify-between sm:gap-4">
- <div className="min-w-0 flex-1 space-y-1">
- <FormLabel>{t('settings.network.dns.mode')}</FormLabel>
- <FormDescription className="text-xs">
- {t('settings.network.dns.modeDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Select
- items={dnsModeOptions}
- value={field.value}
- onValueChange={(value) => {
- if (value !== null) field.onChange(value)
- }}
- >
- <SettingsSelectTrigger>
- <SelectValue />
- </SettingsSelectTrigger>
- <SelectContent>
- <SelectGroup>
- {dnsModeOptions.map(({ label, value }) => (
- <SelectItem key={value} value={value}>
- {label}
- </SelectItem>
- ))}
- </SelectGroup>
- </SelectContent>
- </Select>
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ {/* DNS resolution */}
+ <h3 className="text-sm font-semibold text-foreground">
+ {t('settings.network.dns.title')}
+ </h3>
+ <FormField
+ control={form.control}
+ name="engine.dnsMode"
+ render={({ field }) => (
+ <SettingsFormRow className="flex flex-col items-stretch gap-2 sm:flex-row sm:items-start sm:justify-between sm:gap-4">
+ <div className="min-w-0 flex-1 space-y-1">
+ <FormLabel>
+ {t('settings.network.dns.mode')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.network.dns.modeDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Select
+ items={dnsModeOptions}
+ value={field.value}
+ onValueChange={(value) => {
+ if (value !== null) field.onChange(value)
+ }}
+ >
+ <SettingsSelectTrigger>
+ <SelectValue />
+ </SettingsSelectTrigger>
+ <SelectContent>
+ <SelectGroup>
+ {dnsModeOptions.map(({ label, value }) => (
+ <SelectItem key={value} value={value}>
+ {label}
+ </SelectItem>
+ ))}
+ </SelectGroup>
+ </SelectContent>
+ </Select>
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- <Separator className="my-4" />
+ <Separator className="my-4" />
- {/* NAT mapping */}
- <h3 className="text-sm font-semibold text-foreground">
- {t('settings.network.nat.title')}
- </h3>
+ {/* NAT mapping */}
+ <h3 className="text-sm font-semibold text-foreground">
+ {t('settings.network.nat.title')}
+ </h3>
- <FormField
- control={form.control}
- name="nat.enabled"
- render={({ field }) => (
- <SettingsFormRow>
- <div className="space-y-1">
- <FormLabel>{t('settings.network.nat.enable')}</FormLabel>
- <FormDescription className="text-xs">
- {t('settings.network.nat.enableDesc')}
- </FormDescription>
- </div>
- <FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ <FormField
+ control={form.control}
+ name="nat.enabled"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <div className="space-y-1">
+ <FormLabel>
+ {t('settings.network.nat.enable')}
+ </FormLabel>
+ <FormDescription className="text-xs">
+ {t('settings.network.nat.enableDesc')}
+ </FormDescription>
+ </div>
+ <FormControl>
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- <FormField
- control={form.control}
- name="nat.preferredProtocol"
- render={({ field }) => (
- <SettingsFormRow>
- <FormLabel>
- {t('settings.network.nat.preferredProtocol')}
- </FormLabel>
- <FormControl>
- <Select
- items={NAT_PROTOCOL_OPTIONS}
- value={field.value}
- onValueChange={(value) => {
- if (value !== null) field.onChange(value)
- }}
- >
- <SelectTrigger className="w-30" size="sm">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- <SelectGroup>
- {NAT_PROTOCOL_OPTIONS.map((option) => (
- <SelectItem
- key={option.value}
- value={option.value}
- >
- {option.label}
- </SelectItem>
- ))}
- </SelectGroup>
- </SelectContent>
- </Select>
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ <FormField
+ control={form.control}
+ name="nat.preferredProtocol"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <FormLabel>
+ {t('settings.network.nat.preferredProtocol')}
+ </FormLabel>
+ <FormControl>
+ <Select
+ items={NAT_PROTOCOL_OPTIONS}
+ value={field.value}
+ onValueChange={(value) => {
+ if (value !== null) field.onChange(value)
+ }}
+ >
+ <SelectTrigger className="w-30" size="sm">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectGroup>
+ {NAT_PROTOCOL_OPTIONS.map((option) => (
+ <SelectItem
+ key={option.value}
+ value={option.value}
+ >
+ {option.label}
+ </SelectItem>
+ ))}
+ </SelectGroup>
+ </SelectContent>
+ </Select>
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- <FormField
- control={form.control}
- name="nat.mappingTtl"
- render={({ field }) => (
- <SettingsFormRow>
- <FormLabel>
- {t('settings.network.nat.mappingTtl')}
- </FormLabel>
- <FormControl>
- <Input
- {...field}
- type="number"
- min={1200}
- max={7200}
- className="w-30 h-8"
- value={Number.isFinite(field.value) ? field.value : ''}
- onChange={(event) =>
- field.onChange(event.target.valueAsNumber)
- }
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ <FormField
+ control={form.control}
+ name="nat.mappingTtl"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <FormLabel>
+ {t('settings.network.nat.mappingTtl')}
+ </FormLabel>
+ <FormControl>
+ <Input
+ {...field}
+ type="number"
+ min={1200}
+ max={7200}
+ className="w-30 h-8"
+ value={
+ Number.isFinite(field.value) ? field.value : ''
+ }
+ onChange={(event) =>
+ field.onChange(event.target.valueAsNumber)
+ }
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- <p className="text-xs text-muted-foreground">
- {t('settings.network.nat.btPortHint')}
- </p>
+ <p className="text-xs text-muted-foreground">
+ {t('settings.network.nat.btPortHint')}
+ </p>
- <Separator className="my-4" />
+ <Separator className="my-4" />
- {/* NAT type detection (STUN) */}
- <h3 className="text-sm font-semibold text-foreground">
- {t('settings.network.stun.title')}
- </h3>
- <p className="text-xs text-muted-foreground">
- {t('settings.network.stun.privacyHint')}
- </p>
+ {/* NAT type detection (STUN) */}
+ <h3 className="text-sm font-semibold text-foreground">
+ {t('settings.network.stun.title')}
+ </h3>
+ <p className="text-xs text-muted-foreground">
+ {t('settings.network.stun.privacyHint')}
+ </p>
- <FormField
- control={form.control}
- name="nat.natTypeDetectionEnabled"
- render={({ field }) => (
- <SettingsFormRow>
- <FormLabel>{t('settings.network.stun.enable')}</FormLabel>
- <FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ <FormField
+ control={form.control}
+ name="nat.natTypeDetectionEnabled"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <FormLabel>
+ {t('settings.network.stun.enable')}
+ </FormLabel>
+ <FormControl>
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- <FormField
- control={form.control}
- name="nat.stunServers"
- render={() => (
- <FormItem className="space-y-2">
- <FormLabel>{t('settings.network.stun.servers')}</FormLabel>
- <EndpointList
- name="nat.stunServers"
- maxItems={10}
- itemSchema={stunServerInputSchema}
- placeholder="stun.example.com:3478"
- i18nKeys={{
- addButton: 'settings.network.stun.addServer',
- empty: 'settings.network.stun.empty',
- }}
- />
- <FormMessage className="basis-full text-xs" />
- </FormItem>
- )}
- />
+ <FormField
+ control={form.control}
+ name="nat.stunServers"
+ render={() => (
+ <FormItem className="space-y-2">
+ <FormLabel>
+ {t('settings.network.stun.servers')}
+ </FormLabel>
+ <EndpointList
+ name="nat.stunServers"
+ maxItems={10}
+ itemSchema={stunServerInputSchema}
+ placeholder="stun.example.com:3478"
+ i18nKeys={{
+ addButton: 'settings.network.stun.addServer',
+ empty: 'settings.network.stun.empty',
+ }}
+ />
+ <FormMessage className="basis-full text-xs" />
+ </FormItem>
+ )}
+ />
- <Separator className="my-4" />
+ <Separator className="my-4" />
- {/* Port reachability */}
- <h3 className="text-sm font-semibold text-foreground">
- {t('settings.network.reachability.title')}
- </h3>
- <p className="text-xs text-muted-foreground">
- {t('settings.network.reachability.privacyHint')}
- </p>
+ {/* Port reachability */}
+ <h3 className="text-sm font-semibold text-foreground">
+ {t('settings.network.reachability.title')}
+ </h3>
+ <p className="text-xs text-muted-foreground">
+ {t('settings.network.reachability.privacyHint')}
+ </p>
- <FormField
- control={form.control}
- name="nat.portReachabilityCheckEnabled"
- render={({ field }) => (
- <SettingsFormRow>
- <FormLabel>
- {t('settings.network.reachability.enable')}
- </FormLabel>
- <FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ <FormField
+ control={form.control}
+ name="nat.portReachabilityCheckEnabled"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <FormLabel>
+ {t('settings.network.reachability.enable')}
+ </FormLabel>
+ <FormControl>
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- <FormField
- control={form.control}
- name="nat.portCheckerEndpoints"
- render={() => (
- <FormItem className="space-y-2">
- <FormLabel>
- {t('settings.network.reachability.endpoints')}
- </FormLabel>
- <EndpointList
- name="nat.portCheckerEndpoints"
- maxItems={5}
- itemSchema={portCheckerInputSchema}
- placeholder="https://example.com/check"
- i18nKeys={{
- addButton: 'settings.network.reachability.addEndpoint',
- empty: 'settings.network.reachability.empty',
- }}
- />
- <FormMessage className="basis-full text-xs" />
- </FormItem>
- )}
- />
+ <FormField
+ control={form.control}
+ name="nat.portCheckerEndpoints"
+ render={() => (
+ <FormItem className="space-y-2">
+ <FormLabel>
+ {t('settings.network.reachability.endpoints')}
+ </FormLabel>
+ <EndpointList
+ name="nat.portCheckerEndpoints"
+ maxItems={5}
+ itemSchema={portCheckerInputSchema}
+ placeholder="https://example.com/check"
+ i18nKeys={{
+ addButton:
+ 'settings.network.reachability.addEndpoint',
+ empty: 'settings.network.reachability.empty',
+ }}
+ />
+ <FormMessage className="basis-full text-xs" />
+ </FormItem>
+ )}
+ />
- <Separator className="my-4" />
+ <Separator className="my-4" />
- {/* Auto diagnostic */}
- <h3 className="text-sm font-semibold text-foreground">
- {t('settings.network.diagnostic.title')}
- </h3>
+ {/* Auto diagnostic */}
+ <h3 className="text-sm font-semibold text-foreground">
+ {t('settings.network.diagnostic.title')}
+ </h3>
- <FormField
- control={form.control}
- name="nat.autoDiagnostic"
- render={({ field }) => (
- <SettingsFormRow>
- <FormLabel>
- {t('settings.network.diagnostic.enable')}
- </FormLabel>
- <FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
+ <FormField
+ control={form.control}
+ name="nat.autoDiagnostic"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <FormLabel>
+ {t('settings.network.diagnostic.enable')}
+ </FormLabel>
+ <FormControl>
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
- <FormField
- control={form.control}
- name="nat.diagnosticIntervalSec"
- render={({ field }) => (
- <SettingsFormRow>
- <FormLabel>
- {t('settings.network.diagnostic.interval')}
- </FormLabel>
- <FormControl>
- <Input
- {...field}
- type="number"
- min={300}
- max={86400}
- className="w-30 h-8"
- value={Number.isFinite(field.value) ? field.value : ''}
- onChange={(event) =>
- field.onChange(event.target.valueAsNumber)
- }
- />
- </FormControl>
- </SettingsFormRow>
- )}
- />
- </form>
- </Form>
- </div>
+ <FormField
+ control={form.control}
+ name="nat.diagnosticIntervalSec"
+ render={({ field }) => (
+ <SettingsFormRow>
+ <FormLabel>
+ {t('settings.network.diagnostic.interval')}
+ </FormLabel>
+ <FormControl>
+ <Input
+ {...field}
+ type="number"
+ min={300}
+ max={86400}
+ className="w-30 h-8"
+ value={
+ Number.isFinite(field.value) ? field.value : ''
+ }
+ onChange={(event) =>
+ field.onChange(event.target.valueAsNumber)
+ }
+ />
+ </FormControl>
+ </SettingsFormRow>
+ )}
+ />
+ </form>
+ </Form>
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ </ScrollArea>
<DialogFooter className="shrink-0 border-t border-border px-6 py-4">
{form.formState.errors.root?.save && (
diff --git a/src/renderer/routes/trackers/components/blacklist-tracker-panel.tsx b/src/renderer/routes/trackers/components/blacklist-tracker-panel.tsx
index 831a4777..0addd836 100644
--- a/src/renderer/routes/trackers/components/blacklist-tracker-panel.tsx
+++ b/src/renderer/routes/trackers/components/blacklist-tracker-panel.tsx
@@ -1,3 +1,9 @@
+import {
+ ScrollArea,
+ ScrollAreaContent,
+ ScrollAreaViewport,
+ ScrollBar,
+} from '@renderer/components/ui/scroll-area'
import { Switch } from '@renderer/components/ui/switch'
import { useTrackerList } from '@renderer/hooks/use-tracker-list'
import { transport } from '@renderer/lib/transport'
@@ -90,37 +96,45 @@ export function BlacklistTrackerPanel({
{t('trackers.blacklist.disabled')}
</div>
) : (
- <div
- aria-busy={Boolean(syncMessage)}
- className="flex min-h-0 flex-1 flex-col overflow-auto rounded-lg border border-border"
- >
- <div className="sticky top-0 z-10 grid grid-cols-[1fr_140px] items-center gap-4 border-b border-border bg-background px-3 py-2 text-[11px] uppercase text-muted-foreground">
- <div>{t('trackers.blacklist.column.url')}</div>
- <div>{t('trackers.blacklist.column.source')}</div>
- </div>
- {list.blacklist.length === 0 ? (
- <div className="px-3 py-6 text-center text-sm text-muted-foreground">
- {syncMessage ?? t('trackers.blacklist.empty')}
- </div>
- ) : (
- visibleRows.map((row) => (
- <div
- key={row.url}
- className="grid grid-cols-[1fr_140px] items-center gap-4 border-b border-border px-3 py-2 text-sm last:border-b-0"
- >
- <span className="truncate text-xs" title={row.url}>
- {row.url}
- </span>
- <span
- className="truncate text-xs text-muted-foreground"
- title={row.sourceLabels}
- >
- {row.sourceLabels || '—'}
- </span>
+ <ScrollArea className="min-h-0 min-w-0 flex-1 rounded-lg border border-border">
+ <ScrollAreaViewport
+ role="region"
+ aria-label={t('panel.trackers.tab.blacklist')}
+ aria-busy={Boolean(syncMessage)}
+ className="overscroll-contain"
+ >
+ <ScrollAreaContent style={{ minWidth: '100%' }}>
+ <div className="sticky top-0 z-10 grid grid-cols-[1fr_140px] items-center gap-4 border-b border-border bg-background px-3 py-2 text-[11px] uppercase text-muted-foreground">
+ <div>{t('trackers.blacklist.column.url')}</div>
+ <div>{t('trackers.blacklist.column.source')}</div>
</div>
- ))
- )}
- </div>
+ {list.blacklist.length === 0 ? (
+ <div className="px-3 py-6 text-center text-sm text-muted-foreground">
+ {syncMessage ?? t('trackers.blacklist.empty')}
+ </div>
+ ) : (
+ visibleRows.map((row) => (
+ <div
+ key={row.url}
+ className="grid grid-cols-[1fr_140px] items-center gap-4 border-b border-border px-3 py-2 text-sm last:border-b-0"
+ >
+ <span className="truncate text-xs" title={row.url}>
+ {row.url}
+ </span>
+ <span
+ className="truncate text-xs text-muted-foreground"
+ title={row.sourceLabels}
+ >
+ {row.sourceLabels || '—'}
+ </span>
+ </div>
+ ))
+ )}
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ <ScrollBar orientation="horizontal" />
+ </ScrollArea>
)}
</div>
)
diff --git a/src/renderer/routes/trackers/components/effective-tracker-panel.tsx b/src/renderer/routes/trackers/components/effective-tracker-panel.tsx
index bfb570f6..2a9452ea 100644
--- a/src/renderer/routes/trackers/components/effective-tracker-panel.tsx
+++ b/src/renderer/routes/trackers/components/effective-tracker-panel.tsx
@@ -1,3 +1,9 @@
+import {
+ ScrollArea,
+ ScrollAreaContent,
+ ScrollAreaViewport,
+ ScrollBar,
+} from '@renderer/components/ui/scroll-area'
import { Switch } from '@renderer/components/ui/switch'
import { useTrackerList } from '@renderer/hooks/use-tracker-list'
import { transport } from '@renderer/lib/transport'
@@ -119,52 +125,60 @@ export function EffectiveTrackerPanel({
{t('trackers.effective.disabled')}
</div>
) : (
- <div
- aria-busy={Boolean(syncMessage)}
- className="flex min-h-0 flex-1 flex-col overflow-auto rounded-lg border border-border"
- >
- <div className="sticky top-0 z-10 grid grid-cols-[1fr_80px_140px_140px] items-center gap-4 border-b border-border bg-background px-3 py-2 text-[11px] uppercase text-muted-foreground">
- <div>{t('trackers.effective.column.url')}</div>
- <div className="text-right">
- {t('trackers.effective.column.health')}
- </div>
- <div className="text-right">
- {t('trackers.effective.column.lastProbedAt')}
- </div>
- <div>{t('trackers.effective.column.source')}</div>
- </div>
- {list.effective.length === 0 ? (
- <div className="px-3 py-6 text-center text-sm text-muted-foreground">
- {syncMessage ?? t('trackers.effective.empty')}
- </div>
- ) : (
- visibleRows.map((row) => (
- <div
- key={row.url}
- className="grid grid-cols-[1fr_80px_140px_140px] items-center gap-4 border-b border-border px-3 py-2 text-sm last:border-b-0"
- >
- <span className="truncate text-xs" title={row.url}>
- {row.url}
- </span>
- <span className="flex items-center justify-end gap-1.5">
- <span className="text-xs text-right">
- {row.responseTimeMs ? `${row.responseTimeMs} ms` : '—'}
- </span>
- <HealthDot status={row.health} />
- </span>
- <span className="text-xs text-right text-muted-foreground">
- {row.lastProbedAt ?? '—'}
- </span>
- <span
- className="truncate text-xs text-muted-foreground"
- title={row.sourceLabels}
- >
- {row.sourceLabels || '—'}
- </span>
+ <ScrollArea className="min-h-0 min-w-0 flex-1 rounded-lg border border-border">
+ <ScrollAreaViewport
+ role="region"
+ aria-label={t('panel.trackers.tab.effective')}
+ aria-busy={Boolean(syncMessage)}
+ className="overscroll-contain"
+ >
+ <ScrollAreaContent style={{ minWidth: '100%' }}>
+ <div className="sticky top-0 z-10 grid grid-cols-[1fr_80px_140px_140px] items-center gap-4 border-b border-border bg-background px-3 py-2 text-[11px] uppercase text-muted-foreground">
+ <div>{t('trackers.effective.column.url')}</div>
+ <div className="text-right">
+ {t('trackers.effective.column.health')}
+ </div>
+ <div className="text-right">
+ {t('trackers.effective.column.lastProbedAt')}
+ </div>
+ <div>{t('trackers.effective.column.source')}</div>
</div>
- ))
- )}
- </div>
+ {list.effective.length === 0 ? (
+ <div className="px-3 py-6 text-center text-sm text-muted-foreground">
+ {syncMessage ?? t('trackers.effective.empty')}
+ </div>
+ ) : (
+ visibleRows.map((row) => (
+ <div
+ key={row.url}
+ className="grid grid-cols-[1fr_80px_140px_140px] items-center gap-4 border-b border-border px-3 py-2 text-sm last:border-b-0"
+ >
+ <span className="truncate text-xs" title={row.url}>
+ {row.url}
+ </span>
+ <span className="flex items-center justify-end gap-1.5">
+ <span className="text-xs text-right">
+ {row.responseTimeMs ? `${row.responseTimeMs} ms` : '—'}
+ </span>
+ <HealthDot status={row.health} />
+ </span>
+ <span className="text-xs text-right text-muted-foreground">
+ {row.lastProbedAt ?? '—'}
+ </span>
+ <span
+ className="truncate text-xs text-muted-foreground"
+ title={row.sourceLabels}
+ >
+ {row.sourceLabels || '—'}
+ </span>
+ </div>
+ ))
+ )}
+ </ScrollAreaContent>
+ </ScrollAreaViewport>
+ <ScrollBar />
+ <ScrollBar orientation="horizontal" />
+ </ScrollArea>
)}
</div>
)
diff --git a/src/renderer/routes/trackers/trackers-page.test.tsx b/src/renderer/routes/trackers/trackers-page.test.tsx
index 39006b65..0478997a 100644
--- a/src/renderer/routes/trackers/trackers-page.test.tsx
+++ b/src/renderer/routes/trackers/trackers-page.test.tsx
@@ -46,6 +46,23 @@ beforeEach(() => {
})
describe('TrackersPage', () => {
+ it('expands the URL filter, keeps it across tabs and clears before collapsing', async () => {
+ const user = userEvent.setup()
+ render(<TrackersPage />)
+ expect(screen.queryByRole('textbox', { name: 'Filter by URL…' })).toBeNull()
+ await user.click(screen.getByRole('button', { name: 'Filter by URL…' }))
+ const input = screen.getByRole('textbox', { name: 'Filter by URL…' })
+ expect(input).toHaveFocus()
+ await user.type(input, 'tracker.example')
+ await user.click(screen.getByRole('tab', { name: /blacklist/i }))
+ expect(input).toHaveValue('tracker.example')
+ await user.click(input)
+ await user.keyboard('{Escape}')
+ expect(input).toHaveValue('')
+ await user.keyboard('{Escape}')
+ expect(screen.getByRole('button', { name: 'Filter by URL…' })).toHaveFocus()
+ })
+
it('renders panel title and the two tabs', () => {
render(<TrackersPage />)
expect(screen.getByText('Trackers')).toBeInTheDocument()
diff --git a/src/renderer/routes/trackers/trackers-page.tsx b/src/renderer/routes/trackers/trackers-page.tsx
index 0535bb7d..ef9a70af 100644
--- a/src/renderer/routes/trackers/trackers-page.tsx
+++ b/src/renderer/routes/trackers/trackers-page.tsx
@@ -1,4 +1,6 @@
import { PanelShell } from '@renderer/components/desktop-kit/panel/panel-shell'
+import { Toolbar } from '@renderer/components/desktop-kit/toolbar/toolbar'
+import { ToolbarSearch } from '@renderer/components/desktop-kit/toolbar/toolbar-search'
import { Button } from '@renderer/components/ui/button'
import {
Tabs,
@@ -30,11 +32,18 @@ export function TrackersPage() {
return (
<PanelShell
title={t('panel.trackers.title')}
- search={{
- value: search,
- onChange: setSearch,
- placeholder: t('panel.trackers.searchPlaceholder'),
- }}
+ actions={
+ <Toolbar label={t('panel.trackers.title')}>
+ <ToolbarSearch
+ value={search}
+ onValueChange={setSearch}
+ label={t('panel.trackers.searchPlaceholder')}
+ clearLabel={t('common.clearSearch')}
+ />
+ </Toolbar>
+ }
+ actionsDraggable
+ actionsClassName="min-w-0 flex-1"
footer={
<>
<div
diff --git a/src/renderer/styles/globals.css b/src/renderer/styles/globals.css
index ce5bbb90..7a346cd9 100644
--- a/src/renderer/styles/globals.css
+++ b/src/renderer/styles/globals.css
@@ -355,6 +355,29 @@
.dark.platform-darwin.window-main [data-slot="sidebar-wrapper"] {
background-color: oklch(0.205 0 0 / 0.55);
}
+
+/* A shallow etched groove stays quiet over both glass and vibrancy. */
+.platform-darwin.window-main
+ [data-slot="sidebar-inner"]
+ [data-sidebar="separator"] {
+ background-color: rgb(0 0 0 / 9%);
+ box-shadow: 0 1px 0 rgb(255 255 255 / 14%);
+}
+.platform-darwin.window-main:where(.dark)
+ [data-slot="sidebar-inner"]
+ [data-sidebar="separator"] {
+ background-color: rgb(0 0 0 / 16%);
+ box-shadow: 0 1px 0 rgb(255 255 255 / 4%);
+}
+
+@media (prefers-contrast: more), (forced-colors: active) {
+ .platform-darwin.window-main
+ [data-slot="sidebar-inner"]
+ [data-sidebar="separator"] {
+ background-color: var(--sidebar-border);
+ box-shadow: none;
+ }
+}
.platform-darwin.window-main [data-slot="sidebar-inner"] {
background-color: transparent;
}
diff --git a/src/shared/locales/en-US.json b/src/shared/locales/en-US.json
index 9207440d..68216209 100644
--- a/src/shared/locales/en-US.json
+++ b/src/shared/locales/en-US.json
@@ -58,6 +58,7 @@
}
},
"common": {
+ "clearSearch": "Clear search",
"download": "Download",
"cancel": "Cancel",
"save": "Save",
@@ -1074,7 +1075,7 @@
"runModeTrayDesktop": "Start in System Tray",
"runModeLinuxDesc": "System tray availability and activation behavior depend on your desktop environment.",
"lightweightMode": "Lightweight mode",
- "lightweightModeDesc": "Release interface memory after the main window closes. Background downloads continue; Windows and Linux keep a tray entry for reopening. Reopening takes a little longer and unsaved interface state is discarded.",
+ "lightweightModeDesc": "Save memory when the window is closed. Downloads continue, but reopening takes longer and clears unsaved input.",
"byteUnitSystem": "Size and speed units",
"byteUnitSystemDesc": "Applies to file sizes and transfer speeds.",
"byteUnitDecimal": "Decimal (MB, GB · 1000)",
@@ -2403,7 +2404,13 @@
"unreadBadgeAria_one": "{{count}} unread notification",
"unreadBadgeAria_other": "{{count}} unread notifications",
"rowUnreadAria": "{{title}} (unread)",
- "toastRegionAria": "Notifications"
+ "toastRegionAria": "Notifications",
+ "removeAria": "Remove {{title}}",
+ "actionFailed": "Couldn’t update notifications. Try again.",
+ "markRead": "Mark as read",
+ "viewTask": "View task",
+ "taskRemoved": "Task removed",
+ "openTaskFailed": "Couldn’t open the task. Try again."
}
},
"applicationMenu": {
diff --git a/src/shared/locales/zh-CN.json b/src/shared/locales/zh-CN.json
index dcd83db5..6b1a27a8 100644
--- a/src/shared/locales/zh-CN.json
+++ b/src/shared/locales/zh-CN.json
@@ -58,6 +58,7 @@
}
},
"common": {
+ "clearSearch": "清除搜索",
"download": "下载",
"cancel": "取消",
"save": "保存",
@@ -1061,7 +1062,7 @@
"runModeTrayDesktop": "在系统托盘中启动",
"runModeLinuxDesc": "系统托盘的可用性和激活方式取决于桌面环境。",
"lightweightMode": "轻量模式",
- "lightweightModeDesc": "关闭主窗口后释放界面内存,后台下载继续运行。Windows 和 Linux 会保留托盘入口;重新打开会稍慢,未保存的界面状态将被丢弃。",
+ "lightweightModeDesc": "关闭窗口后节省内存,下载不受影响。重新打开稍慢,未保存的输入会清除。",
"byteUnitSystem": "大小和速度单位",
"byteUnitSystemDesc": "用于文件大小与传输速度的显示。",
"byteUnitDecimal": "十进制(MB、GB · 1000)",
@@ -2382,7 +2383,13 @@
"emptyDesc": "下载活动和重要应用提醒会显示在这里",
"unreadBadgeAria_other": "{{count}} 条未读通知",
"rowUnreadAria": "{{title}}(未读)",
- "toastRegionAria": "通知"
+ "toastRegionAria": "通知",
+ "removeAria": "移除{{title}}",
+ "actionFailed": "未能更新通知,请重试。",
+ "markRead": "标为已读",
+ "viewTask": "查看任务",
+ "taskRemoved": "任务已移除",
+ "openTaskFailed": "未能打开任务,请重试。"
}
},
"applicationMenu": {
diff --git a/src/shared/locales/zh-TW.json b/src/shared/locales/zh-TW.json
index 188cb2b6..b3043f45 100644
--- a/src/shared/locales/zh-TW.json
+++ b/src/shared/locales/zh-TW.json
@@ -58,6 +58,7 @@
}
},
"common": {
+ "clearSearch": "清除搜尋",
"download": "下載",
"cancel": "取消",
"save": "儲存",
@@ -1061,7 +1062,7 @@
"runModeTrayDesktop": "在系統匣中啟動",
"runModeLinuxDesc": "系統匣的可用性和啟用方式取決於桌面環境。",
"lightweightMode": "輕量模式",
- "lightweightModeDesc": "關閉主視窗後釋放介面記憶體,背景下載會繼續運作。Windows 和 Linux 會保留系統匣入口;重新開啟會稍慢,未儲存的介面狀態將被捨棄。",
+ "lightweightModeDesc": "關閉視窗後節省記憶體,下載不受影響。重新開啟稍慢,未儲存的輸入會清除。",
"byteUnitSystem": "大小與速度單位",
"byteUnitSystemDesc": "用於檔案大小與傳輸速度的顯示。",
"byteUnitDecimal": "十進位(MB、GB · 1000)",
@@ -2004,7 +2005,13 @@
"emptyDesc": "下載活動和重要應用程式通知會顯示在這裡",
"unreadBadgeAria_other": "{{count}} 則未讀通知",
"rowUnreadAria": "{{title}} (未讀)",
- "toastRegionAria": "通知"
+ "toastRegionAria": "通知",
+ "removeAria": "移除{{title}}",
+ "actionFailed": "無法更新通知,請再試一次。",
+ "markRead": "標示為已讀",
+ "viewTask": "檢視任務",
+ "taskRemoved": "任務已移除",
+ "openTaskFailed": "無法開啟任務,請再試一次。"
}
},
"plugins": {
diff --git a/src/test-utils/dom-animations.ts b/src/test-utils/dom-animations.ts
new file mode 100644
index 00000000..3f47d775
--- /dev/null
+++ b/src/test-utils/dom-animations.ts
@@ -0,0 +1,5 @@
+// JSDOM has no Web Animations implementation. Base UI checks for active
+// animations when measuring scroll areas; there are none in this environment.
+if (typeof Element !== 'undefined' && !Element.prototype.getAnimations) {
+ Element.prototype.getAnimations = () => []
+}