refactor(theme): centralize Windows checks with isWindowsTheme()#1007
Draft
refactor(theme): centralize Windows checks with isWindowsTheme()#1007
Conversation
- Replace currentTheme === "xp" || currentTheme === "win98" with isWindowsTheme() from @/themes across apps, layout, dialogs, and UI primitives - Fix shadowing in App/menubar/BootScreen/PipPlayer (use windowsTheme local or direct call) - Type EditorToolbar currentTheme as OsThemeId; simplify dead ternary branch - Document useThemeFlags as preferred React entry point alongside isWindowsTheme() Co-authored-by: Ryo Lu <me@ryo.lu>
|
The preview deployment for ryos-dev is ready. 🟢 Open Preview | Open Build Logs | Open Application Logs Last updated at: 2026-03-18 06:11:18 CET |
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
currentTheme === "xp" || currentTheme === "win98"withisWindowsTheme()from@/themes(backed by theme metadata) across ~80 call sites: apps,MenuBar, dialogs, Radix menu primitives, widgets, etc.App.tsx,menubar.tsx,BootScreen,PipPlayerviawindowsThemelocals or directisWindowsTheme(currentTheme)calls.EditorToolbar:currentThemeprop typed asOsThemeId; removed unreachable ternary branch after narrowing.useThemeFlags: short JSDoc pointing toisWindowsTheme/ avoiding raw string OR checks.apps/base/types.tscomment example updated to showisWindowsThemeimport.Testing
bun run buildbun run test:unitNotes
currentTheme === "xp"/"win98"where themes diverge; only the combined “Windows” discriminator was unified.