feat: add UI scale setting (Normal / Small / Compact)#301
feat: add UI scale setting (Normal / Small / Compact)#301arifszn wants to merge 4 commits intorobinebers:mainfrom
Conversation
Adds a Compact Mode toggle to the Settings panel that reduces font size and spacing across the entire UI for users who prefer a denser layout. - Persist compact mode preference via Tauri LazyStore (settings.json) - Apply/remove `compact` class on <html> via useSettingsCompact hook - Scale all rem-based font sizes and spacing down with a single CSS rule - Wire setting through store, bootstrap, display actions, and settings page
There was a problem hiding this comment.
No issues found across 9 files
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
|
Thanks @arifszn , great idea! For me it seems like half-compact mode, as the difference is not that large. Maybe we can reduce spacing/font sizes even more, so that difference would be more obvious? What do you think? |
Thanks for the feedback, @davidarny! Totally agree, the current difference is subtle. Two ideas to make it more flexible — either a slider for fine-grained control, or three fixed options: Normal, Small, and Compact. The slider is more flexible, but the three-option approach feels cleaner and more intentional for a settings UI. What do you prefer? Happy to update the PR accordingly! |
|
@arifszn three options way makes more sense for me. Much less complexity in the code and will fit for most of users. Slider though is good too, but IMHO a bit like overkill for an app 😅 |
Replaces the single compact mode checkbox with three UI scale options (Normal, Small, Compact) using the same radio button pattern as other settings. Font sizes: Small = 14px, Compact = 11px.
There was a problem hiding this comment.
1 issue found across 9 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/lib/settings.ts">
<violation number="1" location="src/lib/settings.ts:316">
P2: Legacy persisted `compactMode` values are not migrated/read, causing existing users to lose their compact UI preference after upgrade.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
@davidarny done. |
|
@codex review |
There was a problem hiding this comment.
Pull request overview
Adds a persisted UI Scale preference (Normal / Small / Compact) that globally scales the app UI by changing the root html font size and wiring the setting through the existing settings state/actions flow.
Changes:
- Introduces
UIScalesetting model + persistence helpers (loadUIScale/saveUIScale) and addsuiScaleto the app preferences store. - Loads UI scale on startup and applies it by toggling
small/compactclasses on the<html>element. - Adds a new “UI Scale” radio-button section in Settings and wires it to analytics + persistence.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/settings.ts | Adds UIScale type, options, defaults, and load/save functions backed by LazyStore. |
| src/stores/app-preferences-store.ts | Stores uiScale in zustand and exposes setUIScale. |
| src/hooks/app/use-settings-bootstrap.ts | Loads uiScale on startup and applies to preferences state. |
| src/hooks/app/use-settings-display-actions.ts | Adds handleUIScaleChange to track + persist changes. |
| src/hooks/app/use-settings-compact.ts | Applies the UI scale by toggling small/compact classes on <html>. |
| src/index.css | Adds html.small / html.compact root font-size overrides. |
| src/pages/settings.tsx | Adds Settings UI section for UI Scale selection. |
| src/components/app/app-content.tsx | Plumbs uiScale and onUIScaleChange into SettingsPage. |
| src/App.tsx | Wires bootstrap + actions + HTML class application for UI scale. |
Comments suppressed due to low confidence (1)
src/hooks/app/use-settings-bootstrap.ts:56
useSettingsBootstrapnow depends onDEFAULT_UI_SCALE,loadUIScale, and a requiredsetUIScaleargument, but the existing unit testsrc/hooks/app/use-settings-bootstrap.test.tscurrently omitssetUIScaleincreateArgs()and its@/lib/settingsmock does not provideDEFAULT_UI_SCALE/loadUIScale. This will break the test suite. Update the test args + mocks and add coverage for loading/fallback behavior of the UI scale setting.
type UseSettingsBootstrapArgs = {
setPluginSettings: (value: PluginSettings | null) => void
setPluginsMeta: (value: PluginMeta[]) => void
setAutoUpdateInterval: (value: AutoUpdateIntervalMinutes) => void
setThemeMode: (value: ThemeMode) => void
setDisplayMode: (value: DisplayMode) => void
setResetTimerDisplayMode: (value: ResetTimerDisplayMode) => void
setGlobalShortcut: (value: GlobalShortcut) => void
setStartOnLogin: (value: boolean) => void
setMenubarIconStyle: (value: MenubarIconStyle) => void
setUIScale: (value: UIScale) => void
setLoadingForPlugins: (ids: string[]) => void
setErrorForPlugins: (ids: string[], error: string) => void
startBatch: (pluginIds?: string[]) => Promise<string[] | undefined>
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| /* UI scale: reduce font size and spacing globally */ | ||
| html.small { | ||
| font-size: 14px; | ||
| } | ||
| html.compact { | ||
| font-size: 11px; | ||
| } |
|
Codex Review: Didn't find any major issues. 🎉 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
- Add isUIScale() type-guard to settings.ts (consistent with other guards) - Rename useSettingsCompact → useSettingsUIScale for clarity - Add saveUIScale mock and handleUIScaleChange test to display-actions tests
@davidarny done. |
Summary
Adds a UI Scale setting with three options — Normal, Small, and Compact — that adjusts font size and spacing across the entire UI.
LazyStorerem-based font sizes and spacing proportionally via a single CSS rule:Screenshots
Implementation
src/lib/settings.ts—UIScaletype,UI_SCALE_OPTIONS,loadUIScale/saveUIScalesrc/stores/app-preferences-store.ts—uiScalestate +setUIScalesrc/hooks/app/use-settings-compact.ts— appliessmallorcompactclass on<html>src/hooks/app/use-settings-bootstrap.ts— loads setting on startupsrc/hooks/app/use-settings-display-actions.ts—handleUIScaleChangesrc/index.css—html.small { font-size: 14px },html.compact { font-size: 11px }src/pages/settings.tsx— UI Scale section with Normal / Small / Compact radio buttonsTest plan