Skip to content

refactor(theme): centralize Windows checks with isWindowsTheme()#1007

Draft
ryokun6 wants to merge 1 commit intomainfrom
cursor/codebase-simplification-areas-4e05
Draft

refactor(theme): centralize Windows checks with isWindowsTheme()#1007
ryokun6 wants to merge 1 commit intomainfrom
cursor/codebase-simplification-areas-4e05

Conversation

@ryokun6
Copy link
Copy Markdown
Owner

@ryokun6 ryokun6 commented Mar 18, 2026

Summary

  • Replaces inline currentTheme === "xp" || currentTheme === "win98" with isWindowsTheme() from @/themes (backed by theme metadata) across ~80 call sites: apps, MenuBar, dialogs, Radix menu primitives, widgets, etc.
  • Resolves import/name shadowing in App.tsx, menubar.tsx, BootScreen, PipPlayer via windowsTheme locals or direct isWindowsTheme(currentTheme) calls.
  • EditorToolbar: currentTheme prop typed as OsThemeId; removed unreachable ternary branch after narrowing.
  • useThemeFlags: short JSDoc pointing to isWindowsTheme / avoiding raw string OR checks.
  • apps/base/types.ts comment example updated to show isWindowsTheme import.

Testing

  • bun run build
  • bun run test:unit

Notes

  • XP-only vs 98-only styling still uses currentTheme === "xp" / "win98" where themes diverge; only the combined “Windows” discriminator was unified.
Open in Web Open in Cursor 

- 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>
@ryos-deploy
Copy link
Copy Markdown

ryos-deploy bot commented Mar 18, 2026

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants