Skip to content

feat(ui): global offline pill at top of RootView#100

Closed
variablefate wants to merge 2 commits intomainfrom
claude/connectivity-pill
Closed

feat(ui): global offline pill at top of RootView#100
variablefate wants to merge 2 commits intomainfrom
claude/connectivity-pill

Conversation

@variablefate
Copy link
Copy Markdown
Owner

Summary

  • New ConnectivityPill view at the top of RootView, above the onboarding publish-failure banner from feat(onboarding): publish-failure banner with retry #95. Renders only when appState.isRelayConnected() returns false AND authState != .loading (avoids a flash on cold launch before the relay manager is configured).
  • Tapping the pill presents the existing ConnectivitySheet for diagnostics + manual reconnect — same modal the per-tab toolbar buttons already open. The pill is global so users do not have to be on a specific tab to spot connectivity issues.
  • Polls isRelayConnected() every 5s (matches ConnectivitySheet's own self-refresh cadence). Polling lives in the view's .task modifier, so it auto-cancels with view lifetime.
  • Per-tab inline offline UI in DriversTab/HistoryTab/RideTab is intentionally retained — the pill communicates global state, the per-tab UI communicates per-tab consequences (empty states, etc).

Closes Issue #97 item 3.

Test plan

  • xcodebuild ... test passes.
  • Manual on-device verification: airplane mode → expect pill to appear within ~5s, tap pill → ConnectivitySheet opens, toggle airplane mode off → pill auto-dismisses within ~5s.
  • Manual: confirm pill stacks above publish-failure banner when both are showing during onboarding.
  • Manual: confirm no pill flash on cold launch (gated by authState != .loading).

🤖 Generated with Claude Code

Per-tab views (DriversTab, HistoryTab, RideTab) check `isRelayConnected()`
independently and render their own inline offline UI, but there was no
global "you're offline" indicator. Users had to navigate to a specific tab
to spot connectivity issues, and the publish-failure banner from #95
lacked context — "couldn't reach the relay" reads differently when the
user can also see at a glance that they're offline.

Add `ConnectivityPill` at the top of RootView, above the publish-failure
banner. The pill renders only when `isRelayConnected()` returns false and
the auth state is past `.loading`. Tap presents the existing
`ConnectivitySheet` for diagnostics + manual reconnect.

Per-tab inline offline UI is intentionally retained — the pill
communicates global state, the per-tab UI communicates per-tab
consequences.

Closes #97 item 3.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@variablefate
Copy link
Copy Markdown
Owner Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

…rrectly

Two follow-ups from code review on PR #100:

1. Poll cadence 5s -> 10s: per-tab views (RideTab, DriversTab, HistoryTab)
   all use 10s as the persistent connection-monitoring cadence.
   ConnectivitySheet polls at 5s because it's a modal the user is actively
   looking at. The pill is a background indicator, so the per-tab cadence
   is the correct match.

2. Animate visibility on a computed `shouldShow` rather than `isOffline`
   alone. On the cold-start offline path, `isOffline` flips to `true` while
   `authState == .loading`; later `authState` exits `.loading` while
   `isOffline` is unchanged. Keying the animation on `isOffline` skipped
   the slide-in transition because the animation key didn't change at the
   visible-transition moment.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@variablefate
Copy link
Copy Markdown
Owner Author

Closing without merging per user feedback during on-device verification — the existing per-tab connectivity icons are sufficient signal, and the persistent top-of-screen pill was felt to be redundant and noisy.

The actual offline-detection bug surfaced during this PR's verification (relay state lying for ~2 minutes after airplane-mode toggle) is being fixed in #101 instead. With #101, the existing red connectivity icon updates correctly — no separate pill needed.

@variablefate variablefate deleted the claude/connectivity-pill branch May 7, 2026 02:45
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