Skip to content

refactor(layout): share device and breakpoint decisions - #28

Merged
PixPMusic merged 2 commits into
mainfrom
refactor/shared-layout-decisions
Nov 9, 2026
Merged

PixPMusic merged 2 commits into
mainfrom
refactor/shared-layout-decisions

Conversation

@PixPMusic

Copy link
Copy Markdown
Owner

What changed and why

Layout decisions were scattered: nine raw userInterfaceIdiom checks, the Duo flag named after one of its effects (usesSwipeSidebar), and width cutoffs inlined as 700, 520, and 850. Some decisions depend on hardware and some on available width, and the code didn't make clear which was which.

This PR keeps behavior and values the same and puts each kind of decision in one place:

  • Device.isPhone / Device.isPad (Slipstream/Features/Layout.swift): the hardware family, used for platform conventions (navigation style, safe areas, system chrome). It never stands in for available space, since an iPad window can be narrower than an iPhone.
  • AppModel.isDuo: renamed from usesSwipeSidebar. Duo is phone hardware recognized from its first hinge update, so it stays observable state on the model. SwipeSidebarToolbar is renamed DuoSidebarToolbar to match DuoSidebarLayout.
  • Breakpoint.compactFeed / .inlinePostActions / .sideBySideLive: the width rules, measured from the pane rather than the screen. FeedView derives compact once and passes it to search and card titles; Mac search width now derives from compact inside FeedSearch.
  • ReadingEdge: a single modifier replacing ReadingScrollEdge + ReadingContentClip, which were always applied together with the same value.
  • ContentView.usesStack(_:): names the existing rule "iPhone and Duo use a stack when compact; iPad keeps one split view".

Routes were already shared: both navigation hierarchies use LibrarySidebar and LibraryDestination with the same selection values. The separate iPhone/Duo NavigationStack and iPad NavigationSplitView are intentionally kept, because merging them would change navigation behavior.

Stacked on #27 (fix/ipad-compact-search). Merge #27 first; this PR's diff is only the refactor commit.

Verification

  • swift test: all 22 tests passed.
  • ./scripts/build.sh ios and ./scripts/build.sh macos --ad-hoc: both succeeded with no warnings in changed files.
  • git diff --check: clean.
  • iPad Pro 13-inch (M5), iOS 27.2 Simulator, landscape, dark, existing signed-in account (not reset). I installed the fix(search): minimize search in narrow iPad feeds #27 head build and this branch's build in turn and captured the same surfaces at the same window sizes.
    • Narrow window Library (compact search button) and full-screen Library: pixel-identical apart from the status-bar clock (a Swift pixel diff found differing pixels only in the clock digits).
    • Full-screen Linus Tech Tips channel (banner chrome, toolbar search field): pixel-identical apart from the clock.
    • Full-screen post page (inline player, metadata row): same layout. The video frame differs because it autoplays.
  • Not checked: narrow-window channel/post (the runner can't send input to windowed iPad apps), iPhone, Duo, older iPadOS, and Mac runtime. For those paths, the evidence is the builds plus a diff where each new helper evaluates exactly the expression it replaces.

Before / after evidence

Narrow iPad window, Library:

Before After
Before: narrow iPad Library with minimized search button After: identical narrow iPad Library

Full-screen iPad, Library:

Before After
Before: full-screen Library with sidebar and search field After: identical full-screen Library

Full-screen iPad, channel banner:

Before After
Before: Linus Tech Tips channel banner with search field After: identical channel banner

Full-screen iPad, post page (cropped above comments; video frame differs due to autoplay):

Before After
Before: post page with inline player After: same post page layout

Model: Claude Opus 5.5 | Harness: Claude Code in T3 Code

@PixPMusic
PixPMusic added this pull request to stack #29 November 7, 2026 18:38
Base automatically changed from fix/ipad-compact-search to main November 9, 2026 02:58
Route iPhone/iPad checks through Device, Duo through AppModel.isDuo,
and width rules through Breakpoint. Merge the reading scroll edge and
top clip into one modifier. Values and behavior are unchanged.
Drop the iPhone and folded-Duo NavigationStack. The split view already
collapses into push and Back, so every device shares one hierarchy and
one set of routes. Push posts through a value path so Back returns to
the feed in collapsed layouts.
@PixPMusic
PixPMusic force-pushed the refactor/shared-layout-decisions branch from a84d4bb to 379f21a Compare November 9, 2026 02:58
@PixPMusic
PixPMusic merged commit 01960bd into main Nov 9, 2026
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