feat(ui): tri-state connection indicator (red/orange/green)#628
Conversation
Replace the binary connected/disconnected indicator with a three-state model: Disconnected (red), Syncing (orange), and Synced (green). This provides consistent status terminology between the top-bar circle and the Networks tab, resolving confusion when Dash Core is connected but still syncing blocks. Closes #333 Closes #62 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace get_live_address() (returns Option, max 1) with get_live_addresses() (returns Vec of all non-banned endpoints) now that the pinned platform SDK revision supports it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughIntroduce a three-state OverallConnectionState enum (Disconnected, Syncing, Synced) to replace binary connection status. Refactor ConnectionStatus to use the new state, rename refresh_overall() to refresh_state() with updated logic, and update UI components to display consistent status terminology and visual indicators across connection states. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/ui/components/top_panel.rs (1)
114-124: Consider replacingunreachable!()with a safe fallback.Line 122: The
Disconnectedarm is correctly unreachable given theifguard on line 115, butunreachable!()will panic if a future refactor alters the guard. A defensive_ => 1.0would be equally correct and future-proof.Suggested change
match overall { OverallConnectionState::Synced => 1.0 + 0.2 * (time * 2.0).sin(), OverallConnectionState::Syncing => 1.0 + 0.15 * (time * 1.2).sin(), - OverallConnectionState::Disconnected => unreachable!(), + OverallConnectionState::Disconnected => 1.0, }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/ui/components/top_panel.rs` around lines 114 - 124, The match on OverallConnectionState inside the pulse_scale calculation uses unreachable!() for the Disconnected arm, which could panic if the surrounding if-guard is later changed; modify the match in the pulse_scale computation (the match on overall in the pulse_scale block) to return a safe fallback (e.g., use a wildcard or the Disconnected arm to return 1.0) instead of calling unreachable!(), so the UI pulse defaults to 1.0 rather than panicking.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/ui/components/top_panel.rs`:
- Around line 114-124: The match on OverallConnectionState inside the
pulse_scale calculation uses unreachable!() for the Disconnected arm, which
could panic if the surrounding if-guard is later changed; modify the match in
the pulse_scale computation (the match on overall in the pulse_scale block) to
return a safe fallback (e.g., use a wildcard or the Disconnected arm to return
1.0) instead of calling unreachable!(), so the UI pulse defaults to 1.0 rather
than panicking.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/context/connection_status.rssrc/context/wallet_lifecycle.rssrc/ui/components/top_panel.rssrc/ui/network_chooser_screen.rs
|
Reviewed CodeRabbit feedback. The nitpick about |
Issue being fixed or feature implemented
User Story
Imagine you're a Dash Evo Tool user who just connected your wallet. The top-bar circle turns green and says "Connected," but the Networks tab says "Offline." You wonder if something is broken — but actually, your wallet is just syncing blocks. With this change, you'll see an orange circle with "Syncing" status while blocks sync, green "Synced" when everything is ready, and red "Disconnected" only when truly offline. The same terminology appears everywhere, so there's no more confusion.
Details
Closes #333
Closes #62
What was done?
Replaced the binary connected/disconnected connection indicator with a three-state model:
Changes by file
src/context/connection_status.rsOverallConnectionStateenum (#[repr(u8)]), replacedAtomicBoolwithAtomicU8, renamedoverall_connected()→overall_state()andrefresh_overall()→refresh_state()src/context/wallet_lifecycle.rssrc/ui/components/top_panel.rs!status.rpc_online()guard on click-to-launchsrc/ui/network_chooser_screen.rsDesign decisions
DisconnectedorSynced(no syncing state tracked yet) — tooltip has a forward-compat comment for the unreachableSyncingarmSpvStatus::Stoppingmaps toSyncing(orange) so the "Disconnecting..." spinner remains visible during shutdownHow has this been tested?
cargo clippy --all-features --all-targets -- -D warnings— cleancargo +nightly fmt --all— cleancargo test --all-features --workspace— 42 passed, 0 failedBreaking Changes
None. Internal API renames (
overall_connected→overall_state) are fully contained.Checklist
Summary by CodeRabbit
🤖 Co-authored by Claudius the Magnificent AI Agent