Skip to content

refactor(settings): split Settings.tsx + simplify Advanced labels#416

Merged
appergb merged 1 commit into
betafrom
refactor/settings-split-and-advanced-labels
May 12, 2026
Merged

refactor(settings): split Settings.tsx + simplify Advanced labels#416
appergb merged 1 commit into
betafrom
refactor/settings-split-and-advanced-labels

Conversation

@appergb
Copy link
Copy Markdown
Collaborator

@appergb appergb commented May 12, 2026

User description

Summary

  • Modularization (no behavior change). Settings.tsx ballooned to 2835 lines — well past the 800-line hard-split trigger in CLAUDE.md. This PR moves each tab (Advanced / Shortcuts / Permissions / Language / About) into its own file under src/pages/settings/, plus a shared.tsx for the SettingRow / Toggle / inputStyle atoms used cross-section. Settings.tsx drops to ~2150 lines and re-exports the public symbols (Toggle, AboutUpdateControl, SettingsSectionId, NAVIGATE_LOCAL_ASR_EVENT) so SettingsModal / FloatingShell keep working unchanged. RecordingSection and ProvidersSection stay in Settings.tsx for now (their helper tangle — HotkeyRecorder, MicrophonePickerDialog, ProviderTools, CredentialField, LocalAsrProviderHint, LLM_PRESETS / ASR_PRESETS — is large; follow-up PR).
  • Shortened Advanced-tab labels. Per direct user feedback: 启用流式输入 → 流式输入, 同步写入剪贴板 → 同步到剪贴板, plus trimmed streamingInsertDesc and per-OS hint blocks across all five locales (zh-CN / zh-TW / en / ja / ko). The Toggle next to the label already conveys enable/disable; the prefix was redundant. Long technical detail stays in the description / hint text.

Why this is safe

  • Pure file-split + i18n-text edits. Zero functional change.
  • All extracted React components are imported back into Settings.tsx via the new directory; the public surface (export { Toggle, AboutUpdateControl, SettingsSectionId, NAVIGATE_LOCAL_ASR_EVENT }) is preserved by re-export.
  • No Rust backend changes — the dictation / QA / hotkey / insertion pipelines on macOS + Windows are untouched.
  • AsrPresetId was lifted out of the as const derivation in Settings.tsx into shared.tsx so AdvancedSection can depend on it without importing back from Settings.tsx (one-way deps).

Test plan

  • npm run build — tsc clean, vite build green.
  • cargo check --manifest-path src-tauri/Cargo.toml — green (83 pre-existing warnings, unchanged).
  • cargo test --manifest-path src-tauri/Cargo.toml --lib222 passed; 0 failed.
  • npx tsx src/lib/providerSetup.test.ts — passes silently (assertion script throws on failure).
  • Manual smoke: open Settings modal → Advanced tab → toggle "流式输入" / "同步到剪贴板"; verify each other tab (Recording / Providers / Shortcuts / Permissions / Language) still renders identically pixel-wise.

PR Type

Enhancement


Description

  • Split Settings.tsx into per-section modules: Advanced, Shortcuts, Permissions, Language, AboutUpdateControl, shared

  • Shorten Advanced labels and hints across all five locales (zh-CN, zh-TW, en, ja, ko)

  • Preserve public exports for backward compatibility; zero functional change


File Walkthrough

Relevant files
Enhancement
5 files
en.ts
Shorten Advanced labels and hints for streaming insert/clipboard
+7/-7     
ja.ts
Shorten Advanced labels and hints in Japanese                       
+7/-7     
ko.ts
Shorten Advanced labels and hints in Korean                           
+7/-7     
zh-CN.ts
Shorten Advanced labels and hints in Simplified Chinese   
+7/-7     
zh-TW.ts
Shorten Advanced labels and hints in Traditional Chinese 
+7/-7     
Refactoring
7 files
Settings.tsx
Decompose into per-section modules and re-export shared components
+13/-696
AboutUpdateControl.tsx
Extract about update control component                                     
+38/-0   
AdvancedSection.tsx
Extract Advanced settings tab (streaming insert, local ASR)
+252/-0 
LanguageSection.tsx
Extract language selection panel                                                 
+60/-0   
PermissionsSection.tsx
Extract permissions and connectivity status panel               
+206/-0 
ShortcutsSection.tsx
Extract shortcut configuration panel                                         
+122/-0 
shared.tsx
Extract shared utilities (Toggle, SettingRow, inputStyle, AsrPresetId)
+67/-0   

…plify Advanced labels

Settings.tsx (2835 → ~2150 lines) split by logical responsibility: each tab
now lives in src/pages/settings/. Pure mechanical extraction — no behavior change.

- settings/shared.tsx     — SettingRow, Toggle, inputStyle, AsrPresetId
- settings/AdvancedSection.tsx
- settings/ShortcutsSection.tsx
- settings/PermissionsSection.tsx (incl. PermissionPill / HotkeyStatusPill / WindowsImeStatusPill)
- settings/LanguageSection.tsx
- settings/AboutUpdateControl.tsx
- Settings.tsx keeps RecordingSection + ProvidersSection (their helper tangle
  is large; follow-up PR), re-exports Toggle / AboutUpdateControl so
  SettingsModal's existing imports keep working.

Advanced settings labels: shortened verbose copy across zh-CN / zh-TW / en /
ja / ko. "启用流式输入" → "流式输入", "同步写入剪贴板" → "同步到剪贴板",
desc / hint blocks trimmed; the toggle already conveys enable/disable so the
verb prefix was redundant.

Verified: tsc clean, vite build green, cargo check green, cargo test --lib
222/222 passing.
@github-actions
Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ No major issues detected

@appergb appergb merged commit 6baca19 into beta May 12, 2026
4 checks passed
@appergb appergb deleted the refactor/settings-split-and-advanced-labels branch May 12, 2026 04:48
appergb pushed a commit that referenced this pull request May 12, 2026
First beta after Stable 1.3.0. Carries the Settings modularization refactor
(PR #416). Tagged as v1.3.1-1-beta-tauri to trigger the release-tauri.yml
Beta-channel build (prerelease=true, manifest filenames carry -beta suffix
so the Stable in-app updater endpoint cannot pick this up).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant