Skip to content

refactor: promote BrowserPanelView computed vars to standalone subviews#68

Merged
arzafran merged 1 commit into
mainfrom
refactor/wp6-browser-panel-view-subviews
Jul 8, 2026
Merged

refactor: promote BrowserPanelView computed vars to standalone subviews#68
arzafran merged 1 commit into
mainfrom
refactor/wp6-browser-panel-view-subviews

Conversation

@arzafran

@arzafran arzafran commented Jul 8, 2026

Copy link
Copy Markdown
Member

What this does

BrowserPanelView.swift had one giant ~1900-line SwiftUI view struct with
dozens of private computed properties strung together — hard to scan, and
every small change re-typechecked the whole thing. This splits out the four
largest, most self-contained chunks (navigation buttons, the profile menu,
the theme-mode menu, and the browser-import hint content) into their own
small view types in the same file. Nothing about how the browser panel looks
or behaves changes — this is purely moving code around for readability.

Summary

Addresses nuclear-review finding WP6 (lowest severity). Extracted 4 cohesive
computed-var groups from BrowserPanelView into standalone private struct
View types, all within Sources/Panels/BrowserPanelView.swift (no new
files, no pbxproj changes):

  • BrowserNavigationButtonsView — back/forward/reload/stop buttons + the
    download-in-progress indicator. 1 param (panel).
  • BrowserProfileMenuView — profile toolbar button + its popover (profile
    list, new/import/rename actions). 6 params (panel, iconColor,
    isPresented binding, popoverPadding, onSelectProfile, onAction).
  • BrowserThemeModeMenuView — theme-mode toolbar button + its popover.
    4 params (currentMode, iconColor, isPresented binding,
    onSelectMode).
  • BrowserImportHintContentView — the browser-data import hint shared by
    the blank-tab floating-card overlay, the blank-tab inline strip, and the
    toolbar-chip popover (all three render the same hint body/buttons).
    4 params (summary, onImport, onOpenSettings, onDismiss).

Body content for each group moved verbatim; only the property plumbing
changed (state that used to be read implicitly from BrowserPanelView is
now passed in explicitly as let/@Binding). No new @State, no timing
changes, no .id() changes, OmnibarState untouched.

Left in place, per the conservative scope of this pass: omnibarField,
webView, and the top-level addressBar composition — extracting those
cleanly would need well over 8 parameters (omnibar callbacks, focus state,
search overlay wiring), so a smaller clean extraction was preferred over a
maximal one.

BrowserPanelView's own body shrinks from ~1913 to ~1604 lines (-16%).

Test Plan

  • PROGRAMA_SKIP_ZIG_BUILD=1 xcodebuild -project GhosttyTabs.xcodeproj -scheme programa -configuration Debug -destination 'platform=macOS' buildBUILD SUCCEEDED, no new warnings introduced
  • ui-regressions CI (browser panel toolbar, profile switching, theme switching, import hint) — arbiter for behavioral parity

Nuclear-review finding WP6 (lowest severity): BrowserPanelView was a single
~1900-line View struct decomposed only via private computed vars, making it
hard to scan and hard for the type checker to isolate errors.

Promotes the 4 largest cohesive computed-var groups into standalone private
struct View types in the same file, taking explicit `let`/`@Binding` params
instead of implicitly reading the parent's state:

- BrowserNavigationButtonsView (back/forward/reload/stop + download
  indicator) - 1 param (panel)
- BrowserProfileMenuView (profile toolbar button + popover) - 6 params
- BrowserThemeModeMenuView (theme toolbar button + popover) - 4 params
- BrowserImportHintContentView (blank-tab card/inline-strip overlays +
  toolbar-chip popover, which all share the same hint body) - 4 params

Body content moved verbatim; behavior, timing, and state ownership are
unchanged. Groups that would need more than ~8 parameters to extract
cleanly (omnibarField, webView, and the top-level addressBar composition)
were left in place per the conservative scope of this pass.

BrowserPanelView's own body shrinks from ~1913 to ~1604 lines.
@arzafran arzafran merged commit d8ba461 into main Jul 8, 2026
8 checks passed
@arzafran arzafran deleted the refactor/wp6-browser-panel-view-subviews branch July 10, 2026 16:05
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