feat: light/dark theme system, ShortcutField i18n, dark-mode styling#8
Open
khatrihemang07 wants to merge 27 commits into
Open
feat: light/dark theme system, ShortcutField i18n, dark-mode styling#8khatrihemang07 wants to merge 27 commits into
khatrihemang07 wants to merge 27 commits into
Conversation
Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Use theme-aware colors instead of hardcoded hex values for background, border, text, and hover states. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
…ckbar styling - ShortcutField now uses react-i18next for all display text - Added shortcut translation keys to all locale files - Motion-board page gets its own ThemeProvider with system theme support - Snackbar alerts use filled variant throughout Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
…board - Main window starts hidden to prevent flash of wrong theme - Window shown once theme setting is resolved from store - Motion-board initializes locale on mount Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Window starts with visible: false so theme can be resolved before the user sees anything. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
… in other language READMEs; modify Tauri configuration for window title; adjust App component for conditional rendering; update visitor badge paths and GitHub links to new repository.
… width in constants
Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
…e off The useEffect cleanup was async fire-and-forget (unlistenPromise.then(...)), leaving stale key-press/key-release Tauri listeners alive during re-render. When echo was toggled off, the new effect cleared the keyboard panel, but a stale listener could fire in the gap and repopulate it. Timing differed per WebView window, causing one monitor to clear while the other hung onto stale key state. Replaced promise-based cleanup with synchronous listener tracking via a mutable array and cancellation flag. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
…p updates
Replaced ad-hoc signing ("-") with a persistent "Penio Dev" self-signed
certificate. macOS TCC now keys Accessibility/Input Monitoring grants to
the cert identity instead of the binary hash, so permissions survive DMG
updates without requiring the user to remove and re-grant them.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a complete light/dark theme system, i18n coverage for the ShortcutField component, dark-mode styling throughout the app, and theme support for the motion-board sub-page. 19 files changed, 312 additions, 68 deletions across 6 commits.
Theme System
Problem
The app previously used a single hardcoded MUI theme. All backgrounds were white (
#ffffff,#eeeeee), borders were gray (#e0e0e0), and text colors were hardcoded (#666). There was no way to switch to dark mode or follow the system preference.Solution
src/theme.ts— Split the single theme intolightThemeanddarkTheme, each with a propermodepalette:src/main.tsx— NewThemedAppwrapper component that:getSettings()prefers-color-schememedia query forautomodematchMedia.addEventListener)theme-updatedTauri eventsvisible: falseintauri.conf.json)src/pages/motion-board/main.tsx— SameThemedAppwrapper for the motion-board page, which renders in its own webview and was not getting theme context from the main window.Theme Switch in Settings
src/components/Settings.tsx— New dropdown in the General settings tab:lightdarkautoSelecting a theme calls
updateSettings({ theme }), which emits atheme-updatedTauri event broadcast to all windows.src/store/settings.ts—updateSettingsnow emitstheme-updatedwhen the theme field changes.Prevent Theme Flash on Startup
src-tauri/tauri.conf.json— Main window now starts with"visible": false. The window is only shown aftergetSettings()resolves inThemedApp, ensuring the user never sees the wrong theme.i18n — ShortcutField
Problem
The
ShortcutFieldcomponent had hardcoded Chinese strings:不支持使用 Win 键作为快捷键— Win key warning按下快捷键— placeholder text未设置— empty stateThis was broken for non-Chinese users since
react-i18nextis used everywhere else.Solution
src/components/ShortcutField.tsx— AddeduseTranslation()and replaced all hardcoded strings witht()calls:8 locale files — Added
shortcuttranslation keys tode-DE,en-US,es-ES,fr-FR,ja-JP,ko-KR,zh-CN,zh-TW:src/pages/motion-board/App.tsx— Draw mode snackbar message now uses i18n (i18n.t('drawing.messages.enterDrawMode')) instead of hardcoded Chinese. AddedinitLocale()on mount so the motion-board page respects the user's language preference.Dark Mode Styling
ShortcutField (
src/components/ShortcutField.tsx)border: '1px solid #e0e0e0'border: 1px solid ${theme.palette.divider}backgroundColor: '#f5f5f5'(disabled)theme.palette.action.disabledBackgroundbackgroundColor: '#e3f2fd'(recording)isDark ? 'rgba(144,202,249,0.16)' : '#e3f2fd'backgroundColor: '#fff'(default)theme.palette.background.papercolor: '#666'(text)color: 'text.secondary'backgroundColor: 'rgba(0,0,0,0.04)'(hover)backgroundColor: 'action.hover'Settings Page (
src/components/Settings.tsx)backgroundColor: '#ffffff'tobackgroundColor: 'background.paper'Tab Panel (
src/App.tsx)'#eeeeee'totheme.palette.background.defaultSnackbar Alerts
SnackbarContext.tsx:<Alert variant="filled">for better dark-mode visibilitymotion-board/App.tsx: Samevariant="filled"appliedCleanup
en-US.json— Removed duplicateprimaryColorUpdated/secondaryColorUpdatedkeyszh-CN.json— Same duplicate removalde-DE.json,es-ES.json,zh-TW.json— Fixed broken JSON formatting (commas/newlines mangled from previous edits)Testing