diff --git a/apps/desktop/scripts/fixtures/group-review-layout/ui-page.mjs b/apps/desktop/scripts/fixtures/group-review-layout/ui-page.mjs index 6cd2e1432a1..c3592a4473f 100644 --- a/apps/desktop/scripts/fixtures/group-review-layout/ui-page.mjs +++ b/apps/desktop/scripts/fixtures/group-review-layout/ui-page.mjs @@ -78,7 +78,8 @@ export default { await message.hover(); await message.getByRole('button', { name: await ui.t('chat.messageActionBar.moreActions'), exact: true }).click(); await page.getByRole('menuitem', { name: await ui.t('chat.shareImage.entry'), exact: true }).click(); - const bar = page.getByRole('checkbox', { name: await ui.t('chat.shareImage.selectAll'), exact: true }).locator('..'); + // The select-all box sits in a label inside the bar; measure the bar itself. + const bar = page.getByRole('checkbox', { name: await ui.t('chat.shareImage.selectAll'), exact: true }).locator('xpath=ancestor::div[1]'); const during = await bounds(bar); await ui.capture('sharing'); assert.deepEqual(during, before, 'image sharing stays aligned with the composer'); diff --git a/apps/desktop/src/renderer/cindy-brain/PluginUiContributions.tsx b/apps/desktop/src/renderer/cindy-brain/PluginUiContributions.tsx index d20e7d52254..8844fc4eeba 100644 --- a/apps/desktop/src/renderer/cindy-brain/PluginUiContributions.tsx +++ b/apps/desktop/src/renderer/cindy-brain/PluginUiContributions.tsx @@ -293,7 +293,7 @@ function EntryControl({ entry, sessionId, clientId, active, appearance }: { entr ; if (action.kind === 'status') return {title}; if (action.kind === 'select') return ({ value: `${entry.instanceId}:${entry.contribution.id}`, label: `${entry.contribution.title} · ${entry.ghost.manifest.name}`, }))]} onValueChange={setSelected} /> diff --git a/apps/desktop/src/renderer/components/chat/ShareMessageCheckbox.tsx b/apps/desktop/src/renderer/components/chat/ShareMessageCheckbox.tsx index 3e985999083..e498fb68fdb 100644 --- a/apps/desktop/src/renderer/components/chat/ShareMessageCheckbox.tsx +++ b/apps/desktop/src/renderer/components/chat/ShareMessageCheckbox.tsx @@ -7,14 +7,13 @@ * 只订阅自己那一条的选中态(useIsMessageSelected):勾选是高频动作,细粒度订阅让 * 一次点击只重渲染这一个按钮,而不是整条消息流(见 shareSelectionStore 文件头)。 * - * 圆形不违反§5 三档圆角 —— 它是 pill 档(9999px)。自带 `data-share-exclude`, + * 用共享 Checkbox(DESIGN.md §4,B-10),外包一层 20px 点击区。自带 `data-share-exclude`, * 光栅化时会被清洗掉,不会出现在产物图片里。 */ -import { Check } from 'lucide-react'; import { useTranslation } from 'react-i18next'; -import { cn } from '@/lib/utils'; +import { Checkbox } from '@/components/ui/checkbox'; import { SHARE_EXCLUDE_ATTR } from '@/lib/shareConversationImage'; import { shareSelectionStore, useIsMessageSelected } from './shareSelectionStore'; @@ -23,31 +22,18 @@ export function ShareMessageCheckbox({ clientId }: { clientId: string }) { const selected = useIsMessageSelected(clientId); return ( - + shareSelectionStore.toggle(clientId)} + /> + ); } diff --git a/apps/desktop/src/renderer/components/chat/ShareSelectionBar.tsx b/apps/desktop/src/renderer/components/chat/ShareSelectionBar.tsx index b43434ea61b..33133352f86 100644 --- a/apps/desktop/src/renderer/components/chat/ShareSelectionBar.tsx +++ b/apps/desktop/src/renderer/components/chat/ShareSelectionBar.tsx @@ -22,7 +22,6 @@ import { useState, type CSSProperties, } from 'react'; -import { Check } from 'lucide-react'; import { useTranslation } from 'react-i18next'; import { blobToDataUrl } from '@/lib/annotationBurnIn'; @@ -41,6 +40,7 @@ import { cn } from '@/lib/utils'; import { useBrandLogo } from '@/hooks/useBrandLogo'; import shareCharacterSrc from '@/assets/cindy-share-character.jpg'; import { shareSelectionStore, useShareSelectionCount } from './shareSelectionStore'; +import { Checkbox } from '@/components/ui/checkbox'; const log = createLogger('ShareSelectionBar'); @@ -193,6 +193,7 @@ export function ShareSelectionBar({ }, [busy, toggleAll]); const disabled = count === 0 || busy !== null; + const selectAllDisabled = busy !== null || shareableMessageIds.length === 0; return (
{/* 部分勾选不等于全选:按钮仍显示未选中,点击后临时补齐全部;只有当前 可选项全部勾上时才显示选中态,再次点击恢复全选前的用户选择。 */} - +
diff --git a/apps/desktop/src/renderer/components/chat/useDeleteMessage.ts b/apps/desktop/src/renderer/components/chat/useDeleteMessage.ts index f0d39c58b3e..db4cc18a4a3 100644 --- a/apps/desktop/src/renderer/components/chat/useDeleteMessage.ts +++ b/apps/desktop/src/renderer/components/chat/useDeleteMessage.ts @@ -47,6 +47,7 @@ export function useDeleteMessage({ description: t('chat.messageActionBar.deleteConfirmDescription'), confirmText: t('chat.messageActionBar.deleteConfirm'), cancelText: t('chat.messageActionBar.deleteCancel'), + confirmVariant: 'destructive', }); if (!ok) return; diff --git a/apps/desktop/src/renderer/components/cindy-make/CindyMakeContribution.tsx b/apps/desktop/src/renderer/components/cindy-make/CindyMakeContribution.tsx index 5af86123224..423c170713b 100644 --- a/apps/desktop/src/renderer/components/cindy-make/CindyMakeContribution.tsx +++ b/apps/desktop/src/renderer/components/cindy-make/CindyMakeContribution.tsx @@ -21,6 +21,7 @@ import { type CindyMakeContributionError, type CindyMakeContributionView, } from '../../../shared/cindyMakeContribution'; +import { Checkbox } from '@/components/ui/checkbox'; const key = 'cindyMake.contribution'; @@ -355,12 +356,11 @@ export function CindyMakeContributionDialog({ {draft.touchesUi &&
  • {t(`${key}.dialog.uiNote`)}
  • } diff --git a/apps/desktop/src/renderer/components/cindy-make/CindyMakeHistoryPanel.tsx b/apps/desktop/src/renderer/components/cindy-make/CindyMakeHistoryPanel.tsx index c35291e5336..69d80e9b314 100644 --- a/apps/desktop/src/renderer/components/cindy-make/CindyMakeHistoryPanel.tsx +++ b/apps/desktop/src/renderer/components/cindy-make/CindyMakeHistoryPanel.tsx @@ -34,6 +34,7 @@ import { contributionActionKey, useCindyMakeContributions, } from './CindyMakeContribution'; +import { Checkbox } from '@/components/ui/checkbox'; type Filter = 'all' | 'pending' | 'integrated' | 'ended'; /** Historical facts and allowed actions come from Main; an old button cannot authorize a write. */ @@ -603,7 +604,8 @@ export function CindyMakeHistoryPanel({ setCheckedIds([]); }} disabled={!!pending} - className="h-8 w-[168px]" + size="compact" + width="sm" />
    } /> diff --git a/apps/desktop/src/renderer/components/settings/DefaultOverrideControls.tsx b/apps/desktop/src/renderer/components/settings/DefaultOverrideControls.tsx index 9a4c346443a..205fa21faf3 100644 --- a/apps/desktop/src/renderer/components/settings/DefaultOverrideControls.tsx +++ b/apps/desktop/src/renderer/components/settings/DefaultOverrideControls.tsx @@ -1,8 +1,6 @@ -import { RotateCcw } from 'lucide-react'; import { useTranslation } from 'react-i18next'; -import { Button } from '@/components/ui/button'; -import { Tip } from '@/components/ui/tooltip'; +import { RestoreDefaultButton } from '@/components/ui/reset-buttons'; export function DefaultOverrideControls({ isCustomized, @@ -31,21 +29,12 @@ export function DefaultOverrideControls({ {t('settings.defaults.customizedBadge')} ) : null} - {/* Per-setting reset (CONTROLS decision 3): 28px quiet pill icon button on the shared Button. */} - - - + {/* Per-setting reset (CONTROLS decision 3): shared 28px quiet icon button. */} +
    ); } diff --git a/apps/desktop/src/renderer/components/settings/KeyboardShortcutsSection.tsx b/apps/desktop/src/renderer/components/settings/KeyboardShortcutsSection.tsx index 7658cbd37b6..7baec051078 100644 --- a/apps/desktop/src/renderer/components/settings/KeyboardShortcutsSection.tsx +++ b/apps/desktop/src/renderer/components/settings/KeyboardShortcutsSection.tsx @@ -69,6 +69,7 @@ import { type GamepadFamily, } from '../../../shared/xboxGamepad'; import { XboxGamepadEntry, XboxGamepadSettings } from './XboxGamepadSettings'; +import { RestoreDefaultButton } from '@/components/ui/reset-buttons'; const log = createLogger('settings:keyboard-shortcuts'); @@ -498,19 +499,11 @@ export function KeyboardShortcutsSection() { {/* 单项恢复默认在控件左侧 (CONTROLS decision 3), 仅已自定义时出现 */} {customized && !isRecording && ( - - - + handleResetOne(def.id)} + /> )} {/* 组合键展示位: 录制中显示提示, 无绑定显示"未设置" */} diff --git a/apps/desktop/src/renderer/components/settings/LocalProviderImportButton.tsx b/apps/desktop/src/renderer/components/settings/LocalProviderImportButton.tsx index 142709727da..18726976b23 100644 --- a/apps/desktop/src/renderer/components/settings/LocalProviderImportButton.tsx +++ b/apps/desktop/src/renderer/components/settings/LocalProviderImportButton.tsx @@ -12,6 +12,7 @@ import type { LocalProviderImportItem, LocalProviderImportScan, } from '../../../shared/localProviderImport'; +import { Checkbox } from '@/components/ui/checkbox'; const SOURCE_NAMES = { alma: 'Alma', @@ -210,10 +211,8 @@ export function LocalProviderImportButton({ onImported }: { onImported: (ids: st
  • {(ctxInvalid || ctx.error || ctx.mixed) && ( diff --git a/apps/desktop/src/renderer/components/settings/ModelGroupRouteExceptions.tsx b/apps/desktop/src/renderer/components/settings/ModelGroupRouteExceptions.tsx index 678ed95dfba..51f1d763150 100644 --- a/apps/desktop/src/renderer/components/settings/ModelGroupRouteExceptions.tsx +++ b/apps/desktop/src/renderer/components/settings/ModelGroupRouteExceptions.tsx @@ -154,7 +154,7 @@ export function ModelGroupRouteExceptions({ value={String(draft.from)} options={hourOptions} size="compact" - className="w-[104px]" + width="xs" onValueChange={(value) => setDraft({ ...draft, from: Number(value) })} /> @@ -166,7 +166,7 @@ export function ModelGroupRouteExceptions({ value={String(draft.to)} options={hourOptions} size="compact" - className="w-[104px]" + width="xs" onValueChange={(value) => setDraft({ ...draft, to: Number(value) })} /> @@ -179,7 +179,7 @@ export function ModelGroupRouteExceptions({ options={others.map((item) => ({ value: item.id, label: item.name }))} size="compact" truncateOptions - className="w-[180px]" + width="sm" onValueChange={(routeId) => setDraft({ ...draft, routeId })} /> diff --git a/apps/desktop/src/renderer/components/settings/ModelGroupsSection.tsx b/apps/desktop/src/renderer/components/settings/ModelGroupsSection.tsx index 3accd2da61a..ca16ef4c5fd 100644 --- a/apps/desktop/src/renderer/components/settings/ModelGroupsSection.tsx +++ b/apps/desktop/src/renderer/components/settings/ModelGroupsSection.tsx @@ -207,6 +207,7 @@ export function ModelGroupsSection() { description: t('modelGroups.settings.deleteRouteConfirmDescription'), confirmText: t('modelGroups.settings.delete'), cancelText: t('modelGroups.settings.cancel'), + confirmVariant: 'destructive', })) return; if (await save((latest) => ({ ...latest, routes: latest.routes.filter((item) => item.id !== route.id) }))) back(); }; diff --git a/apps/desktop/src/renderer/components/settings/PluginSettingsSection.tsx b/apps/desktop/src/renderer/components/settings/PluginSettingsSection.tsx index 4a4e573b1ef..eecc46b4eaf 100644 --- a/apps/desktop/src/renderer/components/settings/PluginSettingsSection.tsx +++ b/apps/desktop/src/renderer/components/settings/PluginSettingsSection.tsx @@ -4,7 +4,7 @@ import { isGhostHostUiSettingValue, type GhostHostUiSetting } from '@cindy/plugi import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Select } from '@/components/ui/select'; -import { Switch } from '@/components/ui/switch'; +import { Checkbox } from '@/components/ui/checkbox'; import { SettingsCard, SettingsPageHeader, SettingsRow } from '@/components/ui/settings-rows'; import { useAppSettingsRevision } from '@/hooks/useAppSettingsRevision'; import { toast } from '@/lib/toast'; @@ -76,8 +76,9 @@ export function PluginSettingsFields({ instanceId, title, fields }: { options={field.options.map((option, index) => ({ label: option.label, value: String(index) }))} disabled={busy} onValueChange={index => setDraft(value => ({ ...value, [field.id]: field.options![Number(index)].value }))} /> : field.type === 'boolean' - ? setDraft(value => ({ ...value, [field.id]: checked }))} /> + // Draft field applied by Save: Checkbox, not Switch (DESIGN.md §4 Desktop settings controls). + ? { const checked = event.currentTarget.checked; setDraft(value => ({ ...value, [field.id]: checked })); }} /> : void; }) { const { t } = useTranslation(); - const label = value === 'all' ? t('settings.sessionImport.allSources') : IMPORT_SOURCE_NAMES[value]; + // A single-value field is the shared Select, not a menu (DESIGN.md §4 Desktop settings controls). + const count = (n: number) => ( + {n} + ); return ( - - - - - - onChange('all')} className="gap-2.5"> - {value === 'all' && } - {t('settings.sessionImport.allSources')} - {total} - - {counts.length > 0 && } - {counts.map(([id, n]) => ( - onChange(id)} className="gap-2.5"> - {value === id && } - - {IMPORT_SOURCE_NAMES[id]} - {n} - - ))} - - + setUseWorktree(e.target.checked)} disabled={busy} - className="mt-[3px] size-3.5 cursor-pointer accent-[var(--confirm-btn-primary-bg)]" + className="mt-0.5" /> diff --git a/apps/desktop/src/renderer/components/settings/SshKeySetupDialog.tsx b/apps/desktop/src/renderer/components/settings/SshKeySetupDialog.tsx index 6444683b108..d5ee191ed4e 100644 --- a/apps/desktop/src/renderer/components/settings/SshKeySetupDialog.tsx +++ b/apps/desktop/src/renderer/components/settings/SshKeySetupDialog.tsx @@ -23,6 +23,7 @@ import { X, Copy, Key, KeyRound, Lock, Plus, Server, CheckCircle2, Circle, Unloc import { toast } from '@/lib/toast'; import { Spinner } from '@/components/ui/spinner'; import { mapIpcErrorToI18nKey } from '@/utils/ipcError'; +import { Checkbox } from '@/components/ui/checkbox'; /** ssh-add failure reasons mirrored from the main-side classification. Kept in * sync with `AgentFailureReason` in vite-env.d.ts / ssh-keys.ts. */ @@ -531,12 +532,12 @@ function GenerateForm({ generating, onSubmit, onCancel }: GenerateFormProps) { - setBackupEnabled(checked)} + onChange={(event) => setBackupEnabled(event.currentTarget.checked)} aria-label={t('settings.about.storage.dbSlimmingBackupLabel')} /> diff --git a/apps/desktop/src/renderer/components/settings/TaskManagementSection.tsx b/apps/desktop/src/renderer/components/settings/TaskManagementSection.tsx index 3b64fa213b5..55527372399 100644 --- a/apps/desktop/src/renderer/components/settings/TaskManagementSection.tsx +++ b/apps/desktop/src/renderer/components/settings/TaskManagementSection.tsx @@ -1,7 +1,6 @@ import { useEffect, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useAuth } from '@/contexts/AuthContext'; -import { Button } from '@/components/ui/button'; import { Switch } from '@/components/ui/switch'; import { Select } from '@/components/ui/select'; import { Input } from '@/components/ui/input'; @@ -17,6 +16,7 @@ import { toast } from '@/lib/toast'; import type { TaskArchiveSettings } from '../../../shared/taskManagement'; import { taskManagementSettings } from './TaskManagement.settings-search'; import { useSettingDefinition } from './useSettingDefinition'; +import { ResetGroupButton } from '@/components/ui/reset-buttons'; export function TaskManagementSection() { const { t } = useTranslation(); @@ -96,16 +96,12 @@ export function TaskManagementSection() { title={t(taskManagementSettings.page.titleKey)} description={t(taskManagementSettings.page.descriptionKey)} action={ - + label={t('taskManagement.reset')} + /> } > {error && } diff --git a/apps/desktop/src/renderer/components/settings/TerminalShellSection.tsx b/apps/desktop/src/renderer/components/settings/TerminalShellSection.tsx index 1377de1c12f..365b20da77c 100644 --- a/apps/desktop/src/renderer/components/settings/TerminalShellSection.tsx +++ b/apps/desktop/src/renderer/components/settings/TerminalShellSection.tsx @@ -18,12 +18,10 @@ import { personalizationDetailsSettings } from './PersonalizationDetails.setting */ import { useCallback, useEffect, useMemo, useState } from 'react'; -import { SelectParts as Select } from '@/components/ui/select'; +import { Select } from '@/components/ui/select'; import { SettingsCard, SettingsField, SettingsSection } from '@/components/ui/settings-rows'; -import { Check, ChevronDown, ChevronUp } from 'lucide-react'; import { useTranslation } from 'react-i18next'; -import { cn } from '@/lib/utils'; import { toast } from '@/lib/toast'; import type { AvailableShell, ShellId } from '../../../shared/terminal-bridge'; import { DefaultOverrideControls } from './DefaultOverrideControls'; @@ -118,91 +116,24 @@ export function TerminalShellSection() { )} > - onChange(value as ShellId)} disabled={resetting} - > - - - - - - - - - - - - - - - - {shells.map((shell) => ( - - ))} - {/* 用户上次选的 shell 当前不可用(卸了)时,仍要显示让用户可以切回 auto */} - {unavailablePref ? ( - - ) : null} - - - - - - - + width="full" + options={[ + { value: 'auto', label: autoLabel }, + ...shells.map((shell) => ({ value: shell.id, label: shell.displayName })), + // 用户上次选的 shell 当前不可用(卸了)时,仍要显示让用户可以切回 auto + ...(unavailablePref + ? [{ value: unavailablePref, label: t('settings.terminalShell.unavailable', { shell: unavailablePref }) }] + : []), + ]} + /> ); } - -/** Radix shell option row;统一键盘高亮、选中指示、失效提示和主题 token。 */ -function ShellOption({ - value, - label, - unavailable = false, -}: { - value: ShellId; - label: string; - unavailable?: boolean; -}) { - return ( - - {label} - - - - - ); -} diff --git a/apps/desktop/src/renderer/components/settings/WechatBotSection.tsx b/apps/desktop/src/renderer/components/settings/WechatBotSection.tsx index bccfff8af35..a12b341bd2b 100644 --- a/apps/desktop/src/renderer/components/settings/WechatBotSection.tsx +++ b/apps/desktop/src/renderer/components/settings/WechatBotSection.tsx @@ -9,6 +9,7 @@ import { useWechatBot } from '@/hooks/useWechatBot'; import { cn } from '@/lib/utils'; import { ImChannelSettingsCard, useImChannelSettingsSummary } from './ImChannelSettingsCard'; import { ImDefaultSettingsSection } from './ImDefaultSettingsSection'; +import { ResetGroupButton } from '@/components/ui/reset-buttons'; const STATUS_KEYS: Record = { disconnected: 'settings.wechatBot.status.disconnected', @@ -120,6 +121,8 @@ export function WechatBotSection({ description: t('settings.wechatBot.unbind.description'), confirmText: t('settings.wechatBot.unbind.confirm'), cancelText: t('settings.wechatBot.unbind.cancel'), + // 解绑会删除本机微信凭证并清理未完成的执行,不可撤回(DESIGN.md §4 Destructive actions)。 + confirmVariant: 'destructive', }); if (accepted) await unbind(); }, [confirm, t, unbind]); @@ -345,16 +348,12 @@ function WechatWorkingDirectory({ {configured && ( - + label={t('settings.wechatBot.workingDir.reset')} + /> )}
  • {settings && !settings.workingDirAvailable && ( diff --git a/apps/desktop/src/renderer/components/settings/WorkLouderCodexSettings.tsx b/apps/desktop/src/renderer/components/settings/WorkLouderCodexSettings.tsx index 0bb224ee7b0..d81e1431b90 100644 --- a/apps/desktop/src/renderer/components/settings/WorkLouderCodexSettings.tsx +++ b/apps/desktop/src/renderer/components/settings/WorkLouderCodexSettings.tsx @@ -14,13 +14,11 @@ import { BatteryCharging, ChevronRight, Keyboard, - RotateCcw, Usb, } from 'lucide-react'; import { useTranslation } from 'react-i18next'; import { Select, type SelectProps } from '@/components/ui/select'; -import { Tip } from '@/components/ui/tooltip'; import { SETTINGS_ROW_LABEL_CLASS, SettingsCard, SettingsPageHeader, SettingsPageScope, SettingsRow, SettingsSection } from '@/components/ui/settings-rows'; import { Switch } from '@/components/ui/switch'; import { useCodexMicroGuard } from '@/hooks/useCodexMicroGuard'; @@ -91,6 +89,7 @@ import { type WorkLouderCodexState, type WorkLouderModel, } from '../../../shared/workLouderCodex'; +import { ResetGroupButton } from '@/components/ui/reset-buttons'; function workLouderCopyKey(model: WorkLouderModel, suffix: string): string { return model === 'creator-micro-2' @@ -530,7 +529,8 @@ export function WorkLouderCodexSettings({ onBack={onBack} backLabel={t('settings.shortcuts.workLouderCodex.back')} action={ - void resetSettings()} @@ -609,9 +609,10 @@ export function WorkLouderCodexSettings({ {t('settings.shortcuts.workLouderCodex.layout.keyboard.description')}

    - void setSettings({ @@ -1242,40 +1243,6 @@ function ActionSelect({ ); } -/** - * Restore control for this device page. - * Always a compact icon+label button at the top-right of the unit it resets - * (page title or section header). Never a text link, never a standalone card. - */ -function SettingsResetButton({ - label, - title, - disabled, - onClick, -}: { - label: string; - title?: string; - disabled?: boolean; - onClick: () => void; -}) { - // Page/section reset (CONTROLS decision 3): sm secondary Button, icon + text; extra context in a Tip. - return ( - - - - ); -} - function CreatorKeyRoleChoice({ isTask, disabled, diff --git a/apps/desktop/src/renderer/components/settings/__tests__/PluginSettingsSection.test.tsx b/apps/desktop/src/renderer/components/settings/__tests__/PluginSettingsSection.test.tsx index 73267b46e79..b502017066a 100644 --- a/apps/desktop/src/renderer/components/settings/__tests__/PluginSettingsSection.test.tsx +++ b/apps/desktop/src/renderer/components/settings/__tests__/PluginSettingsSection.test.tsx @@ -30,7 +30,7 @@ it('edits declared fields, preserves invalid input locally and restores defaults expect(screen.getByRole('button', { name: 'pluginUi.save' }).hasAttribute('disabled')).toBe(true); expect(invoke).toHaveBeenCalledTimes(1); fireEvent.change(size, { target: { value: '18' } }); - fireEvent.click(screen.getByRole('switch', { name: 'Enabled' })); + fireEvent.click(screen.getByRole('checkbox', { name: 'Enabled' })); fireEvent.click(screen.getByRole('button', { name: 'pluginUi.save' })); await waitFor(() => expect(invoke).toHaveBeenCalledWith(null, { op: 'plugin-settings', instanceId: 'local__demo', operation: 'update', patch: { size: 18, enabled: false } })); await waitFor(() => expect(screen.getByRole('button', { name: 'settings.defaults.restore' }).hasAttribute('disabled')).toBe(false)); diff --git a/apps/desktop/src/renderer/components/settings/__tests__/StorageManagementCard.test.tsx b/apps/desktop/src/renderer/components/settings/__tests__/StorageManagementCard.test.tsx index 31ffae04a3e..5806b7ea3c5 100644 --- a/apps/desktop/src/renderer/components/settings/__tests__/StorageManagementCard.test.tsx +++ b/apps/desktop/src/renderer/components/settings/__tests__/StorageManagementCard.test.tsx @@ -753,16 +753,16 @@ describe('StorageManagementCard database cleanup', () => { ]); fireEvent.click(options[0]!); expect( - screen - .getByRole('switch', { name: 'settings.about.storage.dbSlimmingBackupLabel' }) - .getAttribute('aria-checked'), - ).toBe('true'); + (screen.getByRole('checkbox', { + name: 'settings.about.storage.dbSlimmingBackupLabel', + }) as HTMLInputElement).checked, + ).toBe(true); fireEvent.click(screen.getByText('settings.about.storage.dbSlimmingBackupLabel')); expect( - screen - .getByRole('switch', { name: 'settings.about.storage.dbSlimmingBackupLabel' }) - .getAttribute('aria-checked'), - ).toBe('false'); + (screen.getByRole('checkbox', { + name: 'settings.about.storage.dbSlimmingBackupLabel', + }) as HTMLInputElement).checked, + ).toBe(false); fireEvent.click(screen.getByText('settings.about.storage.dbSlimmingBackupLabel')); const scanButton = screen.getByRole('button', { name: 'settings.about.storage.dbSlimmingScanButton', diff --git a/apps/desktop/src/renderer/components/sidebar/SidebarNavigationCustomize.tsx b/apps/desktop/src/renderer/components/sidebar/SidebarNavigationCustomize.tsx index cc3398676e4..64e9431186f 100644 --- a/apps/desktop/src/renderer/components/sidebar/SidebarNavigationCustomize.tsx +++ b/apps/desktop/src/renderer/components/sidebar/SidebarNavigationCustomize.tsx @@ -1,5 +1,5 @@ import { useState } from 'react'; -import { Check, GripVertical, Puzzle } from 'lucide-react'; +import { GripVertical, Puzzle } from 'lucide-react'; import { useTranslation } from 'react-i18next'; import { useGhostMainViews } from '@/cindy-brain/ghostMainViews'; @@ -7,7 +7,6 @@ import { useAuth } from '@/contexts/AuthContext'; import { useReducedMotion } from '@/hooks/useReducedMotion'; import { Button } from '@/components/ui/button'; import { Tip } from '@/components/ui/tooltip'; -import { cn } from '@/lib/utils'; import { MAIN_VIEW_ICONS } from './GhostMainViewNavEntries'; import { @@ -27,6 +26,8 @@ import { useSidebarNavigationPrefs, } from './sidebarNavigationPrefs'; import { SortableList } from './SortableList'; +import { Checkbox } from '@/components/ui/checkbox'; +import { ResetGroupButton } from '@/components/ui/reset-buttons'; interface SidebarNavigationCustomizeProps { onDone: () => void; @@ -186,34 +187,26 @@ export function SidebarNavigationCustomize({ onDone }: SidebarNavigationCustomiz } reducedMotion={reducedMotion} // Rows drag from their label or handle; only the checkbox stays a plain click. - filter="[role='checkbox']" + filter="input[type='checkbox']" className="flex flex-col gap-0.5" renderItem={(id) => { const visible = isChecked(id); const Icon = iconFor(id); return ( - // The whole row toggles; the checkbox stays the focusable control, and its - // keyboard activation bubbles here as the same click. + // The whole row toggles; the shared Checkbox (DESIGN.md §4, B-10) stays the + // focusable control and handles its own click and Space, so it stops the bubble.
    toggle(id)} className="group/nav-entry flex h-9 cursor-pointer items-center gap-2 rounded-lg px-1 hover:bg-sidebar-item-hover" > - + + event.stopPropagation()} + onChange={() => toggle(id)} + /> +
    ); } diff --git a/apps/desktop/src/renderer/components/sidebar/__tests__/SidebarNavigationCustomize.test.tsx b/apps/desktop/src/renderer/components/sidebar/__tests__/SidebarNavigationCustomize.test.tsx index 5c7e3e0333f..c18ad91840e 100644 --- a/apps/desktop/src/renderer/components/sidebar/__tests__/SidebarNavigationCustomize.test.tsx +++ b/apps/desktop/src/renderer/components/sidebar/__tests__/SidebarNavigationCustomize.test.tsx @@ -99,7 +99,7 @@ describe('sidebar navigation customization', () => { it('applies a finished drag and saves only explicit overrides', () => { render( {}} />); // Rows drag from anywhere except the checkbox, which stays a plain toggle. - expect(sortableMock.props?.filter).toBe("[role='checkbox']"); + expect(sortableMock.props?.filter).toBe("input[type='checkbox']"); act(() => sortableMock.props!.onReorder(['plugins', 'search', 'automations'])); expect(order()).toEqual([ 'sidebar.navigation.items.plugins', @@ -216,9 +216,9 @@ describe('sidebar navigation customization', () => { '站点', ]); const sites = screen.getByRole('checkbox', { name: '站点' }); - expect(sites.getAttribute('aria-checked')).toBe('true'); + expect((sites as HTMLInputElement).checked).toBe(true); fireEvent.click(sites); - expect(sites.getAttribute('aria-checked')).toBe('false'); + expect((sites as HTMLInputElement).checked).toBe(false); fireEvent.keyDown( screen.getByRole('button', { name: 'sidebar.navigation.customize.reorder: 站点' }), { key: 'ArrowUp' }, @@ -239,9 +239,7 @@ describe('sidebar navigation customization', () => { mainViewsMock.routeCapable = [SITES]; mainViewsMock.sidebarVisible = [SITES]; render( {}} />); - expect(screen.getByRole('checkbox', { name: '站点' }).getAttribute('aria-checked')).toBe( - 'false', - ); + expect((screen.getByRole('checkbox', { name: '站点' }) as HTMLInputElement).checked).toBe(false); }); it.each([ { label: 'short', namespace: 'acme' }, @@ -256,8 +254,8 @@ describe('sidebar navigation customization', () => { setSidebarNavigationPrefs(OWNER, { order: [...savedOrder], visible: [...defaults().visible], appsAtTop: ['app:_root__xd-sites'] }); render( {}} />); - expect(screen.getByRole('checkbox', { name: 'Root sites' }).getAttribute('aria-checked')).toBe('true'); - expect(screen.getByRole('checkbox', { name: 'Enterprise sites' }).getAttribute('aria-checked')).toBe('false'); + expect((screen.getByRole('checkbox', { name: 'Root sites' }) as HTMLInputElement).checked).toBe(true); + expect((screen.getByRole('checkbox', { name: 'Enterprise sites' }) as HTMLInputElement).checked).toBe(false); fireEvent.click(screen.getByRole('checkbox', { name: 'Root sites' })); fireEvent.click(screen.getByRole('checkbox', { name: 'Enterprise sites' })); fireEvent.click(screen.getByRole('button', { name: 'sidebar.navigation.customize.done' })); @@ -290,13 +288,9 @@ describe('sidebar navigation customization', () => { appsAtTop: ['app:xd-sites', 'app:off'], }); render( {}} />); - expect(screen.getByRole('checkbox', { name: '站点' }).getAttribute('aria-checked')).toBe( - 'true', - ); + expect((screen.getByRole('checkbox', { name: '站点' }) as HTMLInputElement).checked).toBe(true); fireEvent.click(screen.getByRole('button', { name: 'sidebar.navigation.customize.reset' })); - expect(screen.getByRole('checkbox', { name: '站点' }).getAttribute('aria-checked')).toBe( - 'false', - ); + expect((screen.getByRole('checkbox', { name: '站点' }) as HTMLInputElement).checked).toBe(false); fireEvent.click(screen.getByRole('button', { name: 'sidebar.navigation.customize.done' })); expect(getSidebarNavigationPrefs(OWNER)).toEqual({ order: ['automations', 'plugins', 'search'], @@ -320,25 +314,25 @@ describe('sidebar navigation customization', () => { it('toggles from anywhere in the row except the drag handle', () => { render( {}} />); const plugins = screen.getByRole('checkbox', { name: 'sidebar.navigation.items.plugins' }); - expect(plugins.getAttribute('aria-checked')).toBe('true'); + expect((plugins as HTMLInputElement).checked).toBe(true); fireEvent.click(screen.getByText('sidebar.navigation.items.plugins')); - expect(plugins.getAttribute('aria-checked')).toBe('false'); + expect((plugins as HTMLInputElement).checked).toBe(false); fireEvent.click(plugins.parentElement!); - expect(plugins.getAttribute('aria-checked')).toBe('true'); + expect((plugins as HTMLInputElement).checked).toBe(true); fireEvent.click(plugins); - expect(plugins.getAttribute('aria-checked')).toBe('false'); + expect((plugins as HTMLInputElement).checked).toBe(false); fireEvent.click( screen.getByRole('button', { name: 'sidebar.navigation.customize.reorder: sidebar.navigation.items.plugins', }), ); - expect(plugins.getAttribute('aria-checked')).toBe('false'); + expect((plugins as HTMLInputElement).checked).toBe(false); }); it('shows each entry with the icon it uses in the sidebar', () => { mainViewsMock.routeCapable = [SITES]; mainViewsMock.sidebarVisible = [SITES]; render( {}} />); - const rowOf = (name: string) => screen.getByRole('checkbox', { name }).parentElement!; + const rowOf = (name: string) => screen.getByRole('checkbox', { name }).closest('div')!; expect( rowOf('sidebar.navigation.items.automations').querySelector('.lucide-timer'), ).not.toBeNull(); diff --git a/apps/desktop/src/renderer/components/sidebar/__tests__/SidebarTopNav.test.tsx b/apps/desktop/src/renderer/components/sidebar/__tests__/SidebarTopNav.test.tsx index ce2588e8901..16e60f6725f 100644 --- a/apps/desktop/src/renderer/components/sidebar/__tests__/SidebarTopNav.test.tsx +++ b/apps/desktop/src/renderer/components/sidebar/__tests__/SidebarTopNav.test.tsx @@ -747,8 +747,8 @@ describe('Plugins joining the sidebar', () => { , ); - expect(screen.getByRole('checkbox', { name: 'sidebar.navigation.items.search' }).getAttribute('aria-checked')) - .toBe('false'); + expect((screen.getByRole('checkbox', { name: 'sidebar.navigation.items.search' }) as HTMLInputElement).checked) + .toBe(false); fireEvent.click(screen.getByRole('button', { name: 'sidebar.navigation.customize.done' })); expect(getSidebarNavigationPrefs('owner-2').visible).toEqual(['automations']); expect(getSidebarNavigationPrefs(OWNER).visible).toEqual(['automations', 'plugins', 'search']); diff --git a/apps/desktop/src/renderer/components/status/CodexResetAutoUseControl.tsx b/apps/desktop/src/renderer/components/status/CodexResetAutoUseControl.tsx index b34a04d1354..8a0dbd579d0 100644 --- a/apps/desktop/src/renderer/components/status/CodexResetAutoUseControl.tsx +++ b/apps/desktop/src/renderer/components/status/CodexResetAutoUseControl.tsx @@ -6,6 +6,7 @@ import { Button } from '@/components/ui/button'; import { Switch } from '@/components/ui/switch'; import { Select } from '@/components/ui/select'; import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'; +import { Checkbox } from '@/components/ui/checkbox'; /** The closed state occupies one small row; rules stay in a popover. */ export function CodexResetAutoUseControl({ state, providerId, onChanged }: { @@ -57,13 +58,13 @@ export function CodexResetAutoUseControl({ state, providerId, onChanged }: {
    {label('rules')}
    {label('resetDistance')}
    condition('expiring', e.target.checked)} /> + condition('expiring', e.target.checked)} /> {label('expiring')} -
    ({ value: String(n), label: label(n === 30 ? 'minutes' : 'hours', { count: n === 30 ? 30 : n / 60 }) }))} onValueChange={value => void save({ expiryMinutes: Number(value) })} />
    diff --git a/apps/desktop/src/renderer/components/ui/dropdown-menu.tsx b/apps/desktop/src/renderer/components/ui/dropdown-menu.tsx index 4ddd019e8f7..56f85d287ae 100644 --- a/apps/desktop/src/renderer/components/ui/dropdown-menu.tsx +++ b/apps/desktop/src/renderer/components/ui/dropdown-menu.tsx @@ -177,17 +177,25 @@ DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName; const DropdownMenuCheckboxItem = React.forwardRef< React.ComponentRef, - React.ComponentPropsWithoutRef ->(({ className, children, checked, ...props }, ref) => { + React.ComponentPropsWithoutRef & { + /** + * `start` (default): the shared leading check column. `none`: the row keeps the + * checkbox semantics (menuitemcheckbox + aria-checked) while the caller draws its + * own checked mark, e.g. an approved trailing slot (DESIGN.md §4 Select & Dropdown). + */ + indicator?: 'start' | 'none'; + } +>(({ className, children, checked, indicator = 'start', ...props }, ref) => { const row = useRowHighlight(className); return ( + {indicator === 'start' && ( + )} {withMenuLabels(children)} ); diff --git a/apps/desktop/src/renderer/components/ui/reset-buttons.tsx b/apps/desktop/src/renderer/components/ui/reset-buttons.tsx new file mode 100644 index 00000000000..4bed9a0bfb4 --- /dev/null +++ b/apps/desktop/src/renderer/components/ui/reset-buttons.tsx @@ -0,0 +1,70 @@ +/** + * Restore-default actions (DESIGN.md §4 Desktop settings controls, "Restore default"). + * + * - RestoreDefaultButton: one setting. 28px frameless square icon button with a `Tip`, + * placed to the left of the control and only while the value differs from its default + * (DefaultOverrideControls adds the "customized" badge in front of it). + * - ResetGroupButton: a whole page or section. `secondary` `sm` Button with the RotateCcw + * icon and a text label, on the right of the page or section title. An optional `tip` + * explains what is reset; `loading` keeps the label width and accessible name. + * + * Both forward the remaining Button props (data-settings-search-action, data-setting-id, + * disabled, loading, className for layout) so callers keep their settings-search contract. + */ + +import * as React from 'react'; +import { RotateCcw } from 'lucide-react'; +import { useTranslation } from 'react-i18next'; + +import { cn } from '@/lib/utils'; +import { Button, type ButtonProps } from './button'; +import { Tip } from './tooltip'; + +type ResetButtonBaseProps = Omit; + +export interface RestoreDefaultButtonProps extends ResetButtonBaseProps { + /** Tooltip and accessible name; defaults to "Restore default". */ + label?: string; +} + +export const RestoreDefaultButton = React.forwardRef( + function RestoreDefaultButton({ label, className, ...props }, ref) { + const { t } = useTranslation(); + const text = label ?? t('settings.defaults.restore'); + return ( + + + + ); + }, +); + +export interface ResetGroupButtonProps extends ResetButtonBaseProps { + /** Visible label, e.g. "Restore defaults". */ + label: string; + /** Optional extra context shown in a Tip (what exactly is reset). */ + tip?: string; +} + +export const ResetGroupButton = React.forwardRef( + function ResetGroupButton({ label, tip, ...props }, ref) { + return ( + + + + ); + }, +); diff --git a/apps/desktop/src/renderer/components/ui/select.tsx b/apps/desktop/src/renderer/components/ui/select.tsx index 212cec7b90c..4ffbc870686 100644 --- a/apps/desktop/src/renderer/components/ui/select.tsx +++ b/apps/desktop/src/renderer/components/ui/select.tsx @@ -10,6 +10,8 @@ export interface SelectOption { label: string; disabled?: boolean; title?: string; + /** Secondary line under the label in the open list; the trigger shows the label only. */ + description?: string; endAdornment?: ReactNode; } @@ -33,8 +35,12 @@ export interface SelectProps { className?: string; /** Size a compact trigger's menu independently; ordinary fields keep equal width. */ contentClassName?: string; - /** Trigger height: default 36px; compact 32px for narrow drawers and dense lists. */ - size?: 'default' | 'compact'; + /** + * Trigger height: default 36px; compact 32px for narrow drawers and dense lists; inline + * 24px, frameless and in the surrounding text colour, for a value that sits inside a line + * of text (plugin UI slots, provider run location, Cindy device picker). DESIGN.md §4. + */ + size?: 'default' | 'compact' | 'inline'; /** * Trigger width preset: 220px / 320px, full width for stacked fields, or 120px (`xs`) for a * short value paired inline with another control (DESIGN.md §4 Desktop settings controls). @@ -50,6 +56,18 @@ export interface SelectProps { /** Width presets, also for SelectParts triggers that compose their own rows. */ export const SELECT_WIDTHS = { xs: 'w-[120px]', sm: 'w-[220px]', md: 'w-[320px]', full: 'w-full' } as const; +const SELECT_BUTTON_SIZES = { default: 'lg', compact: 'md', inline: 'xs' } as const; + +/** Inline trigger: fits its value, no frame or fill at rest, surrounding text colour; + * the secondary hover/pressed fill and focus ring still mark it as a control. */ +const SELECT_INLINE_TRIGGER = + 'w-fit gap-1 px-1.5 text-inherit [--button-face-bg:transparent] [--button-face-border:transparent]'; + +/** An inline trigger is only as wide as its value, so its list fits the options instead: + * at least the trigger width, at most 18rem and the space available. */ +const SELECT_INLINE_CONTENT = + 'w-max min-w-[var(--radix-select-trigger-width)] max-w-[min(18rem,var(--radix-select-content-available-width))]'; + /** Desktop single-value field (DESIGN.md §4): standard secondary Button, * equal-width Radix panel, 12px container / 8px rows and semantic theme colors. * Use with FormField for a visible label; className sizes the trigger only. @@ -86,7 +104,14 @@ export function Select({ title={option.title ?? (truncateOptions ? option.label : undefined)} className="relative flex min-h-8 cursor-pointer select-none items-center rounded-lg py-1 pl-2 pr-6 outline-none [overflow-wrap:anywhere] data-[disabled]:opacity-60" > - {truncateOptions ? ( + {option.description ? ( + + + {option.label} + + {option.description} + + ) : truncateOptions ? ( {option.label} @@ -113,7 +138,7 @@ export function Select({ data-setting-id={settingId} data-settings-search-action={searchAction} variant="secondary" - size={size === 'compact' ? 'md' : 'lg'} + size={SELECT_BUTTON_SIZES[size]} aria-label={label} aria-describedby={describedBy} aria-invalid={error ? true : invalid} @@ -121,6 +146,7 @@ export function Select({ title={selected?.title ?? selected?.label} className={cn( 'min-w-0 max-w-full justify-between gap-2 px-3 font-normal [-webkit-app-region:no-drag]', + size === 'inline' && SELECT_INLINE_TRIGGER, width && SELECT_WIDTHS[width], className, (error || (invalid !== undefined && invalid !== false && invalid !== 'false')) && @@ -132,7 +158,7 @@ export function Select({ {triggerAdornment} - @@ -145,6 +171,7 @@ export function Select({ collisionPadding={8} className={cn( 'z-dropdown w-[var(--radix-select-trigger-width)] max-h-[var(--radix-select-content-available-height)] overflow-hidden rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] p-1.5 text-13 text-[var(--text-primary)] [-webkit-app-region:no-drag]', + size === 'inline' && SELECT_INLINE_CONTENT, contentClassName, )} > diff --git a/apps/desktop/src/renderer/features/bots/BotGroupCreateDialog.tsx b/apps/desktop/src/renderer/features/bots/BotGroupCreateDialog.tsx index e81d11913d8..dce3b9cbe05 100644 --- a/apps/desktop/src/renderer/features/bots/BotGroupCreateDialog.tsx +++ b/apps/desktop/src/renderer/features/bots/BotGroupCreateDialog.tsx @@ -7,7 +7,6 @@ */ import { useEffect, useMemo, useRef, useState, type FormEvent } from 'react'; import * as Dialog from '@radix-ui/react-dialog'; -import { Check } from 'lucide-react'; import { useTranslation } from 'react-i18next'; import { Button } from '@/components/ui/button'; @@ -20,6 +19,7 @@ import { BotAvatar } from './BotAvatar'; import { botGroupApi, refreshBotGroups } from './botGroupStore'; import { BOT_GROUP_MAX_MEMBERS, BOT_GROUP_MIN_MEMBERS, botGroupErrorKey } from './botGroupPresentation'; import { useBotProfiles, type BotProfile } from './botStore'; +import { Checkbox } from '@/components/ui/checkbox'; function pickableBots(bots: readonly BotProfile[]): BotProfile[] { return bots @@ -87,7 +87,7 @@ export function BotGroupCreateDialog({ const [busy, setBusy] = useState(false); const busyRef = useRef(false); const nameInputRef = useRef(null); - const firstMemberRef = useRef(null); + const firstMemberRef = useRef(null); // Speaking order follows the picker's order, not the click order. const orderedSelection = privateChatBotId ? [privateChatBotId] : candidates @@ -241,18 +241,11 @@ export function BotGroupCreateDialog({ const selectable = isSelectable(bot); const disabled = busy || !selectable || (!checked && atLimit); return ( - + {/* Shared Checkbox (DESIGN.md §4, B-10); the row label toggles it. */} + toggle(bot.id)} + /> + ); })}
    diff --git a/apps/desktop/src/renderer/features/bots/BotGroupLiveStatus.tsx b/apps/desktop/src/renderer/features/bots/BotGroupLiveStatus.tsx index f490403ff8b..4f7ca52fa4e 100644 --- a/apps/desktop/src/renderer/features/bots/BotGroupLiveStatus.tsx +++ b/apps/desktop/src/renderer/features/bots/BotGroupLiveStatus.tsx @@ -227,12 +227,11 @@ function BotGroupSingleProgressStrip({ - + {/* Irreversible: shared Button danger tone (DESIGN.md §4 Destructive actions, C-07). */} +

    {t('bots.groupChat.settings.deleteNote')}

    diff --git a/apps/desktop/src/renderer/features/bots/BotImportForm.tsx b/apps/desktop/src/renderer/features/bots/BotImportForm.tsx index a91fafc6846..58597452a87 100644 --- a/apps/desktop/src/renderer/features/bots/BotImportForm.tsx +++ b/apps/desktop/src/renderer/features/bots/BotImportForm.tsx @@ -6,6 +6,7 @@ import { normalizeBotName } from '../../../shared/botCreation'; import { BOT_PORTRAIT_COUNT, BotPortraitPicker, galleryPortrait } from './BotPortraitPicker'; import { useBotProfiles } from './botStore'; import { extractIpcError } from '../../utils/ipcError'; +import { Checkbox } from '@/components/ui/checkbox'; /** Import only adds a selection step. Identity and all later settings use the normal teammate UI. */ export function BotImportForm({ api = window.electronAPI.companionImport, onBack, onCreated, onBusy }: { @@ -97,9 +98,8 @@ export function BotImportForm({ api = window.electronAPI.companionImport, onBack const categoryEntries = preview?.entries.filter(entry => entry.category === category) ?? []; const filtered = categoryEntries.filter(entry => `${entryLabel(entry)} ${entry.description ?? ''}`.toLocaleLowerCase().includes(query.toLocaleLowerCase())); const openCategory = (next: CompanionImportCategory) => { setCategory(next); setQuery(''); setPage(0); }; - const checkbox = (ids: string[], checked: boolean, label: string, partial = false) => { if (node) node.indeterminate = partial; }} onChange={event => toggle(ids, event.target.checked)} - className="h-4 w-4 shrink-0 accent-[var(--text-primary)]" />; + const checkbox = (ids: string[], checked: boolean, label: string, partial = false) => toggle(ids, event.target.checked)} />; if (enterChat) return null; return
    @@ -168,7 +168,7 @@ export function BotImportForm({ api = window.electronAPI.companionImport, onBack
    ; })}
    - {preview.entries.some(entry => entry.category === 'automations' && selectedSet.has(entry.id)) ? : null} + {preview.entries.some(entry => entry.category === 'automations' && selectedSet.has(entry.id)) ? : null} } {(error || duplicate) ?

    {duplicate ? t('bots.guided.duplicateName') : tr(companionImportReasonKey(error))}

    : null} diff --git a/apps/desktop/src/renderer/features/bots/BotModelChainEditor.tsx b/apps/desktop/src/renderer/features/bots/BotModelChainEditor.tsx index fa617468387..654c07a9091 100644 --- a/apps/desktop/src/renderer/features/bots/BotModelChainEditor.tsx +++ b/apps/desktop/src/renderer/features/bots/BotModelChainEditor.tsx @@ -1,4 +1,5 @@ import { Button } from '@/components/ui/button'; +import { Tip } from '@/components/ui/tooltip'; import { Fragment, useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react'; import { ArrowDown, ArrowUp, Plus, Trash2 } from 'lucide-react'; import { isSharedTaskPeer } from '@cindy/device-link'; @@ -39,6 +40,7 @@ import { MODEL_GROUPS_DEFAULTS, type ModelGroupSelection, type ModelGroupsConfig import { isPluginEngineEffort } from '../../../shared/pluginEngines'; import { isProviderShareAgentDeviceId } from '../../../shared/providerShare'; import { useBotTranslation } from './botPronounContext'; +import { ResetGroupButton } from '@/components/ui/reset-buttons'; function vendorFor(harness: BotHarness): 'cc' | 'codex' | 'pi' { return harness === 'claude' ? 'cc' : harness === 'acp' ? 'pi' : harness; @@ -464,15 +466,19 @@ export function BotModelChainEditor({ {routes.length > 1 ? ( - + + + ) : null} @@ -591,19 +597,13 @@ export function BotModelChainEditor({ {t('bots.modelChain.add')} {onRestoreDefault ? ( - + label={t('bots.model.restoreDefault')} + /> ) : null} diff --git a/apps/desktop/src/renderer/features/bots/ChatGroupNotificationSettings.tsx b/apps/desktop/src/renderer/features/bots/ChatGroupNotificationSettings.tsx index b1ea9415fcf..c91e69cf336 100644 --- a/apps/desktop/src/renderer/features/bots/ChatGroupNotificationSettings.tsx +++ b/apps/desktop/src/renderer/features/bots/ChatGroupNotificationSettings.tsx @@ -37,7 +37,7 @@ export function ChatGroupNotificationSettings({ groupId, mode, disabled }: { } return <> {t(key('saving'))} : undefined} options={modes.map(value => ({ value, label: t(key(value)) }))} onValueChange={value => void change(value)} />} /> {error &&

    {t(key('saveFailed'))}

    } diff --git a/apps/desktop/src/renderer/features/bots/ChatGroupSettings.tsx b/apps/desktop/src/renderer/features/bots/ChatGroupSettings.tsx index a0cc8468640..9a62742b6bd 100644 --- a/apps/desktop/src/renderer/features/bots/ChatGroupSettings.tsx +++ b/apps/desktop/src/renderer/features/bots/ChatGroupSettings.tsx @@ -286,7 +286,7 @@ export function ChatGroupSettings({ group }: { group: BotGroupSummary }) { }} />} />} ({ value, label: t(value === 'all' && assistantAnswers ? key('replyModeAssistant') : REPLY_MODE_LABELS[value]) }))} onValueChange={value => void saveRules({ replyMode: value as typeof replyMode })} />} /> @@ -298,7 +298,7 @@ export function ChatGroupSettings({ group }: { group: BotGroupSummary }) { {/* Single-speaker servers always answer one teammate at a time, so there is no speaking mode. */} {!group.singleSpeaker && ({ value, label: t(SPEAKING_MODE_LABELS[value]) }))} onValueChange={value => void saveRules({ speakingMode: value as typeof speakingMode })} />} />} diff --git a/apps/desktop/src/renderer/features/bots/ChatInviteDialog.tsx b/apps/desktop/src/renderer/features/bots/ChatInviteDialog.tsx index 84bc8068388..382d5ad10f1 100644 --- a/apps/desktop/src/renderer/features/bots/ChatInviteDialog.tsx +++ b/apps/desktop/src/renderer/features/bots/ChatInviteDialog.tsx @@ -3,7 +3,7 @@ import * as Dialog from '@radix-ui/react-dialog'; import { useTranslation } from 'react-i18next'; import { Plus } from 'lucide-react'; import { Button } from '@/components/ui/button'; -import { Switch } from '@/components/ui/switch'; +import { Checkbox } from '@/components/ui/checkbox'; import { Input } from '@/components/ui/input'; import { ConfirmDialog } from '@/components/ui/confirm-dialog'; import { getDataOwnerGeneration, isDataOwnerGenerationCurrent } from '@/contexts/dataOwnerGeneration'; @@ -181,8 +181,10 @@ export function ChatInviteDialog({ groupId, initialLink = '', malformedLink = fa {!fromLink && (!groupId || link) && { setLink(value); setPreview(null); setError(''); operation.current = crypto.randomUUID(); }} />} - {!groupId && preview && maskSupported &&