Skip to content

refactor: simplify title bar capabilities into isNativeApplication - #733

Merged
dcoutinho1328 merged 1 commit into
developmentfrom
refactor/simplify-title-bar-capabilities
Apr 17, 2026
Merged

refactor: simplify title bar capabilities into isNativeApplication#733
dcoutinho1328 merged 1 commit into
developmentfrom
refactor/simplify-title-bar-capabilities

Conversation

@dcoutinho1328

@dcoutinho1328 dcoutinho1328 commented Apr 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Replace three capability flags (hasNativeMenu, hasNativeTitleBar, hasNativeWindowControls) with a single isNativeApplication flag
  • Title bar rendering now uses isNativeApplication + OS detection from the store:
    • Web (any OS): menu bar only
    • Editor macOS: center slot only (drag region)
    • Editor Linux: no title bar
    • Editor Windows: full title bar (menu + drag region + window controls)
  • Remove hasNativeMenu: isMac override from editor-platform.ts

Test plan

  • Verify editor macOS shows only the drag region in center slot
  • Verify editor Windows shows full title bar with menu and window controls
  • Verify editor Linux hides title bar entirely
  • Verify window lifecycle accelerators still work
  • Verify save-changes modal quit behavior still works

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Consolidated platform capability detection to improve consistency across native and web application modes.
    • Enhanced platform-specific UI behavior for window controls and title bar rendering based on application context.

Simplify three capability flags (hasNativeMenu, hasNativeTitleBar,
hasNativeWindowControls) into a single isNativeApplication flag.
Title bar visibility is now determined by isNativeApplication + OS:
- Web (any OS): menu bar only
- Editor macOS: center slot only (drag region)
- Editor Linux: no title bar
- Editor Windows: full title bar (menu + drag + window controls)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 6873ce21-e538-44bc-b1aa-a210be6e8313

📥 Commits

Reviewing files that changed from the base of the PR and between 28d322f and 1ba2f5f.

📒 Files selected for processing (9)
  • src/frontend/components/_organisms/modals/save-changes-modal.tsx
  • src/frontend/components/_organisms/title-bar/slots/center-slot.tsx
  • src/frontend/components/_organisms/title-bar/slots/left-slot.tsx
  • src/frontend/components/_organisms/title-bar/slots/right-slot.tsx
  • src/frontend/components/_templates/accelerator-handler.tsx
  • src/frontend/components/_templates/app-layout.tsx
  • src/middleware/editor-platform.ts
  • src/middleware/shared/ports/platform-capabilities.ts
  • src/middleware/shared/providers/platform-context.tsx

Walkthrough

This PR consolidates three separate platform capability flags (hasNativeWindowControls, hasNativeMenu, hasNativeTitleBar) into a single unified isNativeApplication flag. All components depending on these flags are updated to use the new flag, with some adding OS-specific gating conditions to preserve existing behavior. Platform capabilities middleware and type definitions are updated accordingly.

Changes

Cohort / File(s) Summary
Platform Capability Architecture
src/middleware/shared/ports/platform-capabilities.ts, src/middleware/shared/providers/platform-context.tsx
Removed three native UI capability flags from PlatformCapabilities interface and replaced with single isNativeApplication boolean. Updated EDITOR_CAPABILITIES (true) and WEB_CAPABILITIES (false) constants. Updated documentation example.
Platform Middleware Implementation
src/middleware/editor-platform.ts
Removed macOS detection logic and hasNativeMenu capability. Capabilities object now only includes EDITOR_CAPABILITIES merged with isDevMode flag.
Title Bar Slot Components
src/frontend/components/_organisms/title-bar/slots/center-slot.tsx, src/frontend/components/_organisms/title-bar/slots/left-slot.tsx, src/frontend/components/_organisms/title-bar/slots/right-slot.tsx
Updated conditional rendering to use isNativeApplication instead of removed capability flags. Left and right slots now include OS-specific gating using workspace.systemConfigs.OS.
Modal & Application Layout
src/frontend/components/_organisms/modals/save-changes-modal.tsx, src/frontend/components/_templates/app-layout.tsx, src/frontend/components/_templates/accelerator-handler.tsx
Replaced hasNativeWindowControls with isNativeApplication in close-app validation, title bar visibility logic, and multiple useEffect hooks managing window lifecycle events.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • DanielBorgesDev

Poem

🐰 Three flags danced as one, hooray!
isNativeApplication saves the day,
From scattered checks to clarity true,
The platform knows just what to do! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main refactoring change: replacing three capability flags with a single isNativeApplication flag for title bar logic.
Description check ✅ Passed The description covers the key changes and provides a clear test plan, but lacks explicit mapping to the template's required sections like issue references, Jira links, and DOD checklist.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/simplify-title-bar-capabilities

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dcoutinho1328
dcoutinho1328 merged commit 556bc85 into development Apr 17, 2026
14 checks passed
@dcoutinho1328
dcoutinho1328 deleted the refactor/simplify-title-bar-capabilities branch April 17, 2026 01:38
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.

1 participant