- Don't blank the feed on refresh: keep current stories until new data arrives, and ignore benign URLError.cancelled (-999) so a network blip no longer wipes the list. Coalesce WebSocket story.created bursts into a single debounced refresh. - Empty state now distinguishes polling, couldn't-reach-server (with the error + host + Retry), offline, and genuinely-empty. - Track read stories in SwiftData (ReadStory); mark a story read when opened and drop/dim its signal stripe across the feed and Latest/Saved/Search. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
34 lines
872 B
Swift
34 lines
872 B
Swift
// 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
|
|
/// Read stories drop the colored stripe for a neutral one.
|
|
var muted: Bool = false
|
|
|
|
var body: some View {
|
|
Rectangle()
|
|
.fill(muted ? Palette.hairline : Signal.stripeColor(score))
|
|
.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()
|
|
.background(Color.black)
|
|
}
|