Skip to content

Commit e31d484

Browse files
committed
ui: fine tune connected state by adding gray state
1 parent b85d9de commit e31d484

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

BDKSwiftExampleWallet/View/Home/ActivityHomeHeaderView.swift

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,23 @@ struct ActivityHomeHeaderView: View {
176176

177177
@ViewBuilder
178178
private func networkConnectionIndicator() -> some View {
179-
if isKyotoConnected {
179+
// Tri-state indicator for Kyoto peer connectivity
180+
// - Green: actively connected OR showing sync activity
181+
// - Gray (secondary): synced but not currently connected
182+
// - Red: not synced, no activity, and not connected
183+
let isFullySynced = walletSyncState == .synced
184+
let hasSyncActivity = (progress > 0) || (currentBlockHeight > 0)
185+
186+
if isFullySynced {
180187
AnyView(
181188
Image(systemName: "network")
182-
.foregroundStyle(.green)
189+
.foregroundStyle(isKyotoConnected ? .green : .secondary)
183190
)
184191
} else {
192+
let ok = isKyotoConnected || hasSyncActivity
185193
AnyView(
186-
Image(systemName: "network.slash")
187-
.foregroundStyle(.red)
194+
Image(systemName: ok ? "network" : "network.slash")
195+
.foregroundStyle(ok ? .green : .red)
188196
)
189197
}
190198
}

0 commit comments

Comments
 (0)