2026-06-18 18:04:59 +03:00
|
|
|
// SignalStripe.swift
|
|
|
|
|
// Jarvis — the 3pt left-edge stripe whose color is tied to the signal score.
|
|
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
|
|
struct SignalStripe: View {
|
|
|
|
|
let score: Int
|
|
|
|
|
var width: CGFloat = 3
|
2026-06-18 23:22:56 +03:00
|
|
|
/// Read stories drop the colored stripe for a neutral one.
|
|
|
|
|
var muted: Bool = false
|
2026-06-18 18:04:59 +03:00
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
|
Rectangle()
|
2026-06-18 23:22:56 +03:00
|
|
|
.fill(muted ? Palette.hairline : Signal.stripeColor(score))
|
2026-06-18 18:04:59 +03:00
|
|
|
.frame(width: width)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#Preview {
|
|
|
|
|
HStack(spacing: 24) {
|
|
|
|
|
ForEach([97, 78, 55, 35, 12, 0], id: \.self) { s in
|
|
|
|
|
VStack {
|
|
|
|
|
SignalStripe(score: s)
|
|
|
|
|
.frame(height: 60)
|
|
|
|
|
Text("\(s)")
|
|
|
|
|
.font(.system(size: 11, design: .monospaced))
|
|
|
|
|
.foregroundStyle(Signal.scoreColor(s))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.padding()
|
2026-06-22 02:33:33 +03:00
|
|
|
.background(Palette.background)
|
2026-06-18 18:04:59 +03:00
|
|
|
}
|