Skip to content

Add floatingCardToolBarItems: card-attached floating views with alignment#29

Merged
nighthawk merged 1 commit into
mainfrom
feature/floating-card-toolbar
Jun 18, 2026
Merged

Add floatingCardToolBarItems: card-attached floating views with alignment#29
nighthawk merged 1 commit into
mainfrom
feature/floating-card-toolbar

Conversation

@nighthawk

Copy link
Copy Markdown
Member

What

Adds a card-attached floating-views affordance to TGCardViewController.

  • TGCard.floatingCardToolBarItems: [UIView]? — views floated at the bottom of the card itself (not over the map, unlike top/bottomMapToolBarItems). They're hosted in a stack added to the controller's view, pinned to the bottom of the card's visible area at .defaultHigh priority but clamped to the safe area as a required constraint — so they prefer the card's bottom edge yet never drop below the screen when the card is collapsed/peeking and its content extends past the bottom.
  • TGCard.floatingCardToolBarAlignment (.leading / .center / .trailing / .fill, default .center) — horizontal placement within the card. .center suits a status pill; .leading/.trailing a FAB-style primary action; .fill a full-width button. The leading/trailing inequality clamps stay active for every alignment, so a wide row never overflows the card.

Why

There was no way to float a control that stays attached to the card and remains visible regardless of the card's drag position — top/bottomMapToolBarItems overlay the map. The immediate consumer is TripGo's agenda "recalculating…" status pill, which needs to stay visible at any card position; the alignment option also opens the door to a trailing FAB-style primary action.

Notes for reviewers

  • didBuild timing: card-attached items are also (re)populated right after didBuild, not only during the push/pop floating-view refresh. Cards commonly configure their toolbar items in didBuild, which runs after that refresh, so items set there would otherwise be silently dropped. Population is idempotent (populateFloatingView cleans up first), and the items are persistent views owned by the card, so they survive a re-populate.
  • Scope: purely additive — no change to existing public API or to top/bottomMapToolBarItems. Covered presentation paths: initial/root present, push, pop. TGPageCard children setting these in didBuild aren't forwarded (separate flow) — out of scope.
  • Builds clean standalone (iOS Simulator).

🤖 Generated with Claude Code

`topMapToolBarItems` / `bottomMapToolBarItems` overlay the *map*. There was
no way to float a control that stays attached to the *card* and remains
visible regardless of the card's drag position.

`floatingCardToolBarItems` fills that gap: items are hosted in a stack added
to the controller's view, pinned to the bottom of the card's visible area at
`.defaultHigh` priority but clamped to the safe area as a required
constraint. So they prefer to sit at the card's bottom edge, yet never drop
below the screen when the card is collapsed or peeking and its content
extends past the bottom.

`floatingCardToolBarAlignment` controls horizontal placement — `.center`
(default, e.g. a status pill), `.leading` / `.trailing` (e.g. a FAB-style
primary action), or `.fill` (a full-width button). The leading/trailing
inequality clamps stay active for every alignment, so a wide row never
overflows the card.

The card-attached items are also (re)populated right after `didBuild`, not
just during the push/pop floating-view refresh. Cards commonly configure
their toolbar items in `didBuild`, which runs *after* that refresh, so items
set there would otherwise be silently dropped. Refresh is idempotent
(`populateFloatingView` cleans up first), so the persistent view survives.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@nighthawk

Copy link
Copy Markdown
Member Author

Suggested squash-merge commit message:

feat: add floatingCardToolBarItems — card-attached floating views with alignment

Float controls attached to the card (not the map) that stay visible at any
card drag position: pinned to the card's bottom edge but clamped to the safe
area. `floatingCardToolBarAlignment` (.leading/.center/.trailing/.fill,
default .center) controls horizontal placement — a centred status pill, a
trailing FAB-style action, or a full-width button. Card-attached items are
(re)populated after `didBuild` too, so items configured there aren't dropped.
Purely additive — no change to existing public API.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

After merge: tag a new version in [2.4.4, 3.0.0) (current TripGo pin is 2.4.3) so TripGo can bump its package pin and consume floatingCardToolBarItems.

@nighthawk nighthawk merged commit 5cfc937 into main Jun 18, 2026
3 checks passed
@nighthawk nighthawk deleted the feature/floating-card-toolbar branch June 18, 2026 11:16
@nighthawk nighthawk added the enhancement New feature or request label Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant