pi-remote-ios/Sources/UI/Sessions/SessionRow.swift

41 lines
910 B
Swift

// Sources/UI/Sessions/SessionRow.swift
// T-2.6: Row view for a single session in the SessionSwitcher list.
import SwiftUI
struct SessionRow: View {
let session: SessionInfo
var body: some View {
HStack {
Text(session.name)
.font(.body)
Spacer()
stateBadge
}
}
@ViewBuilder
private var stateBadge: some View {
HStack(spacing: 4) {
Circle()
.fill(badgeColor)
.frame(width: 8, height: 8)
Text(session.state)
.font(.caption)
.foregroundStyle(badgeColor)
}
}
private var badgeColor: Color {
switch session.state.lowercased() {
case "running", "active":
return .green
case "idle":
return .yellow
default:
return .secondary
}
}
}