Files
Kecalek_python/ios_client 0.8.5/Kecalek/Views/Components/ConnectionIndicator.swift
2026-03-14 12:43:56 +01:00

37 lines
908 B
Swift

import SwiftUI
struct ConnectionIndicator: View {
let status: ConnectionStatus
var body: some View {
HStack(spacing: 4) {
Circle()
.fill(statusColor)
.frame(width: 8, height: 8)
if status != .connected {
Text(statusText)
.font(.caption2)
.foregroundStyle(.secondary)
}
}
}
private var statusColor: Color {
switch status {
case .connected: return .green
case .connecting, .reconnecting: return .orange
case .disconnected: return .red
}
}
private var statusText: String {
switch status {
case .connected: return ""
case .connecting: return "Connecting..."
case .reconnecting: return "Reconnecting..."
case .disconnected: return "Disconnected"
}
}
}