refactor(settings): split 73-line god file into 5 sections + auto-save preferences + guard Restore
The previous SettingsPane.tsx hid 8 unrelated concerns behind 73 "lines"
of JSX where each line ran 400-2000 chars. Reading the file was
infeasible; editing it meant scrolling horizontally through a single
statement spanning every button, modal, and table row.
Split by concern into `settings-sections/`:
SettingsPane.tsx 62 LOC orchestrator
GeneralSection.tsx 94 LOC theme / language / auto-update
ExecutionModeSection.tsx 105 LOC AI CEO ↔ AI Co-Founder toggle
ShortcutsSection.tsx 40 LOC keyboard reference (read-only)
DataSection.tsx 123 LOC update check / backup / restore /
secret backend
SecretsSection.tsx 102 LOC per-company secret bindings
Every file now reads top-to-bottom with normal indentation.
Behavioral changes bundled (they belong with the restructure, not a
separate pass):
- Preferences save model unified: theme already auto-saved on change;
language and auto-update checkbox now do the same. The global
"Save settings" button is gone — there is no longer a state where
a toggled language sits unpersisted waiting for a second click.
- Execution mode card gained a subheader line that names the current
company ("Applies to current company: X"). Multi-company users can
no longer confuse which company they just flipped.
- Auto-updater checkbox gained an inline hint: "Check for application
updates at launch" — the previous naked checkbox never explained
what happens when it is off.
- Restore profile moved into DataSection's backup/restore group,
given `tone="danger"`, and gated behind a `window.confirm` with
copy warning about running work being lost. Backup stays neutral.
The previous layout put Restore in the same 2-col grid as Save +
Check Updates + Backup, making a profile-replacing operation look
as routine as saving a theme preference.
- Secret backend display promoted from a naked text line to a
bordered card so it matches the surrounding section rhythm.
Added i18n keys (zh + en):
settings.updaterHint / settings.modeScope / settings.backupRestore /
settings.restoreConfirm / settings.restoreHint.
Covers J-S1 / J-S6 / S-S1 / S-S2 / S-S3 / S-S4 from the settings audit.
Remaining work (tab sidebar, Providers IA reordering, copy sweep)
lands in follow-up commits.
This commit is contained in:
1 parent
fd6471988a
commit
16e45b6a8d
8 files changed
+530
-67
No files matched your search
@@ -1276,6 +1276,11 @@ export const en: Record<string, string> = {
|
||||
"org.statusAria": "Status: {status}",
|
||||
|
||||
// ── Settings pane ──
|
||||
"settings.updaterHint": "Check for application updates at launch",
|
||||
"settings.modeScope": "Applies to current company: {company}",
|
||||
"settings.backupRestore": "Backup & restore",
|
||||
"settings.restoreConfirm": "Restore will overwrite the current profile. Running work may be lost. Continue?",
|
||||
"settings.restoreHint": "Restore is not reversible — it replaces the active profile on disk with the backup.",
|
||||
"settings.keyboardShortcuts": "Keyboard Shortcuts",
|
||||
"settings.shortcut.commandPalette": "Open command palette",
|
||||
"settings.shortcut.sendMessage": "Send message",
|
||||
|
||||
@@ -1276,6 +1276,11 @@ export const zh: Record<string, string> = {
|
||||
"org.statusAria": "状态:{status}",
|
||||
|
||||
// ── 设置面板 ──
|
||||
"settings.updaterHint": "启动时自动检查应用更新",
|
||||
"settings.modeScope": "应用于当前公司:{company}",
|
||||
"settings.backupRestore": "备份与恢复",
|
||||
"settings.restoreConfirm": "恢复备份会覆盖当前配置,运行中的任务可能丢失。确定继续?",
|
||||
"settings.restoreHint": "恢复操作不可撤销,会用备份覆盖磁盘上的活动配置。",
|
||||
"settings.keyboardShortcuts": "键盘快捷键",
|
||||
"settings.shortcut.commandPalette": "打开命令面板",
|
||||
"settings.shortcut.sendMessage": "发送消息",
|
||||
|
||||
Reference in new issue
Block a user