feat: hero card layout in all pills, cache-while-loading, logo splash screen
Some checks failed
CI / Build · macos-14 · Debug (push) Has been cancelled
CI / Build · macos-15 · Debug (push) Has been cancelled
CI / Build · macos-14 · Release (push) Has been cancelled
CI / Build · macos-15 · Release (push) Has been cancelled

- Every pill (F1, Tech, AI, Cloud, HomeLab…) now shows the same hero card
  layout as "All" — first story is the big featured card, rest follow as rows
- "All" retains its full multi-section front page (US / Tech / AI / Sport…)
- Topic pill headers use the pill name instead of "TOP STORIES"
- filteredStories now falls back to cached SwiftData rows while loading, so
  switching to F1 or Tech shows cached cards instantly instead of a blank list
- Logo splash screen (3 pill bars + jarvis wordmark) shows on launch and fades
  out after setup completes; minimum 1.3 s so it's always readable
- JarvisWordmark moved to Theme.swift so SplashView and feed can share it

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Robin Kutesa
2026-06-21 02:15:23 +03:00
parent 760e6a121c
commit 207b1827c7
3 changed files with 81 additions and 52 deletions

View File

@@ -5,6 +5,38 @@ import SwiftData
import UIKit import UIKit
import BackgroundTasks import BackgroundTasks
// MARK: - Logo + splash
/// The three-bar logo that mirrors the app icon.
struct JarvisLogoMark: View {
var width: CGFloat = 180
var body: some View {
VStack(alignment: .center, spacing: 8) {
// Orange (short) · White (longest) · Grey (medium) same ratios as icon
Capsule().fill(Palette.orange)
.frame(width: width * 0.48, height: width * 0.075)
.shadow(color: Palette.orange.opacity(0.55), radius: 10, y: 2)
Capsule().fill(Color.white)
.frame(width: width, height: width * 0.075)
Capsule().fill(Color(hex: "888888"))
.frame(width: width * 0.74, height: width * 0.075)
}
}
}
struct SplashView: View {
var body: some View {
ZStack {
Color(hex: "0A0A0A").ignoresSafeArea()
VStack(spacing: 28) {
JarvisLogoMark(width: 180)
JarvisWordmark(size: 34)
}
}
}
}
final class AppDelegate: NSObject, UIApplicationDelegate { final class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication, func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
@@ -37,6 +69,7 @@ struct JarvisApp: App {
@StateObject private var connectivity = ConnectivitySettings.shared @StateObject private var connectivity = ConnectivitySettings.shared
@StateObject private var connManager = ConnectivityManager.shared @StateObject private var connManager = ConnectivityManager.shared
@StateObject private var notifications = NotificationManager.shared @StateObject private var notifications = NotificationManager.shared
@State private var showSplash = true
// Single ModelContainer instance shared with BackgroundRefreshManager. // Single ModelContainer instance shared with BackgroundRefreshManager.
private let container: ModelContainer = { private let container: ModelContainer = {
@@ -47,6 +80,11 @@ struct JarvisApp: App {
var body: some Scene { var body: some Scene {
WindowGroup { WindowGroup {
ZStack {
if showSplash {
SplashView()
.transition(.opacity)
} else {
Group { Group {
if settings.isConfigured { if settings.isConfigured {
RootTabView() RootTabView()
@@ -54,6 +92,10 @@ struct JarvisApp: App {
OnboardingView() OnboardingView()
} }
} }
.transition(.opacity)
}
}
.animation(.easeOut(duration: 0.5), value: showSplash)
.preferredColorScheme(appearanceMode.colorScheme) .preferredColorScheme(appearanceMode.colorScheme)
.environmentObject(settings) .environmentObject(settings)
.environmentObject(store) .environmentObject(store)
@@ -62,13 +104,14 @@ struct JarvisApp: App {
.environmentObject(connManager) .environmentObject(connManager)
.environmentObject(notifications) .environmentObject(notifications)
.task { .task {
// Wire the shared container before scheduling BG work.
BackgroundRefreshManager.container = container BackgroundRefreshManager.container = container
BackgroundRefreshManager.scheduleFeedRefresh() BackgroundRefreshManager.scheduleFeedRefresh()
connManager.start() connManager.start()
await connManager.resolveAndActivate() await connManager.resolveAndActivate()
await notifications.bootstrap() await notifications.bootstrap()
// Hold splash until setup is done, minimum 1.3 s for legibility.
try? await Task.sleep(nanoseconds: 1_300_000_000)
showSplash = false
} }
} }
.modelContainer(container) .modelContainer(container)

View File

@@ -5,21 +5,6 @@
import SwiftUI import SwiftUI
import SwiftData import SwiftData
// Reusable wordmark: typewriter font, lowercase j in orange, orange dot on i.
struct JarvisWordmark: View {
var size: CGFloat = 30
private var font: Font { .custom("Courier New", size: size).bold() }
var body: some View {
HStack(spacing: 0) {
Text("j").font(font).foregroundStyle(Palette.orange)
Text("arv").font(font).foregroundStyle(.white)
Text("is").font(font).foregroundStyle(.white)
}
}
}
struct SignalFeedView: View { struct SignalFeedView: View {
@EnvironmentObject var store: StoryStore @EnvironmentObject var store: StoryStore
@EnvironmentObject var ws: WebSocketManager @EnvironmentObject var ws: WebSocketManager
@@ -46,16 +31,14 @@ struct SignalFeedView: View {
private var readStoryIds: Set<String> { Set(readStories.map(\.id)) } private var readStoryIds: Set<String> { Set(readStories.map(\.id)) }
private var savedStoryIds: Set<String> { Set(savedStories.map(\.id)) } private var savedStoryIds: Set<String> { Set(savedStories.map(\.id)) }
/// Live stories when online; cached fallback when offline. Filtered by the /// Live stories when connected; cached fallback while loading or offline so
/// selected pill via backend tags no headline keyword matching. /// switching to Tech / AI / F1 shows cached cards instantly.
private var filteredStories: [StorySummary] { private var filteredStories: [StorySummary] {
let base: [StorySummary] let base: [StorySummary]
if !store.stories.isEmpty { if !store.stories.isEmpty {
base = store.stories.sorted(by: StorySummary.feedOrder) base = store.stories.sorted(by: StorySummary.feedOrder)
} else if !ws.connectionState.isLive {
base = cachedStories.map(StorySummary.init(cached:)).sorted(by: StorySummary.feedOrder)
} else { } else {
base = [] base = cachedStories.map(StorySummary.init(cached:)).sorted(by: StorySummary.feedOrder)
} }
return base.filter { $0.matches(selectedPill) } return base.filter { $0.matches(selectedPill) }
} }
@@ -73,8 +56,8 @@ struct SignalFeedView: View {
filteredStories.filter { readStoryIds.contains($0.id) } filteredStories.filter { readStoryIds.contains($0.id) }
} }
/// "All" shows a sectioned front page; specific pills show a flat list. /// Every pill shows the card layout sections are scoped to "All".
private var isDigest: Bool { selectedPill == .all } private var isDigest: Bool { true }
/// Front-page digest: Top Stories + up to 3 per category section, deduped. /// Front-page digest: Top Stories + up to 3 per category section, deduped.
private var digest: (top: [StorySummary], sections: [(NewsSection, [StorySummary])]) { private var digest: (top: [StorySummary], sections: [(NewsSection, [StorySummary])]) {
@@ -125,7 +108,6 @@ struct SignalFeedView: View {
header header
syncBar syncBar
topicPills topicPills
if !isDigest { columnHeaders } // sections carry their own headers
Divider().overlay(Palette.hairline) Divider().overlay(Palette.hairline)
feedList feedList
} }
@@ -260,13 +242,7 @@ struct SignalFeedView: View {
private var feedList: some View { private var feedList: some View {
List { List {
if mainStories.isEmpty && readItems.isEmpty {
emptyState.plainBlackRow()
} else if isDigest {
digestContent digestContent
} else {
flatContent
}
} }
.listStyle(.plain) .listStyle(.plain)
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
@@ -283,29 +259,26 @@ struct SignalFeedView: View {
} }
} }
/// Flat list for a specific pill. /// Card layout for every pill. "All" gets full multi-section front page;
@ViewBuilder private var flatContent: some View { /// topic pills get a hero card + flat list within that topic.
ForEach(mainStories) { mainRow($0) }
if mainStories.isEmpty { caughtUpRow.plainBlackRow() }
if store.isLoadingMore {
ProgressView().tint(Palette.orange)
.frame(maxWidth: .infinity).padding(.vertical, 20).plainBlackRow()
}
readShelf
}
/// Sectioned front page for "All".
@ViewBuilder private var digestContent: some View { @ViewBuilder private var digestContent: some View {
let d = digest let d = digest
sectionHeader("TOP STORIES", pill: nil) let headerLabel = selectedPill == .all
? "TOP STORIES"
: selectedPill.label.uppercased()
sectionHeader(headerLabel, pill: nil)
if let lead = d.top.first { if let lead = d.top.first {
mainRow(lead, hero: true) mainRow(lead, hero: true)
ForEach(d.top.dropFirst()) { mainRow($0) } ForEach(d.top.dropFirst()) { mainRow($0) }
} else {
emptyState.plainBlackRow()
} }
if selectedPill == .all {
ForEach(d.sections, id: \.0.id) { section, stories in ForEach(d.sections, id: \.0.id) { section, stories in
sectionHeader(section.label.uppercased(), pill: section.pill) sectionHeader(section.label.uppercased(), pill: section.pill)
ForEach(stories) { mainRow($0) } ForEach(stories) { mainRow($0) }
} }
}
readShelf readShelf
} }

View File

@@ -264,6 +264,19 @@ extension StorySummary {
} }
} }
// MARK: - Wordmark
struct JarvisWordmark: View {
var size: CGFloat = 30
private var font: Font { .custom("Courier New", size: size).bold() }
var body: some View {
HStack(spacing: 0) {
Text("j").font(font).foregroundStyle(Palette.orange)
Text("arvis").font(font).foregroundStyle(.white)
}
}
}
// MARK: - News sections (the "All" front page) // MARK: - News sections (the "All" front page)
// //
// Groups the firehose into Apple/Google-News-style sections. A story lands in // Groups the firehose into Apple/Google-News-style sections. A story lands in