From f5902e359d9bfa61cf1708fd33a7877c9b38cf59 Mon Sep 17 00:00:00 2001 From: Andrew Blakeslee Moore Date: Sat, 13 Jun 2026 23:16:13 -0700 Subject: [PATCH] Add In-progress stat card and live list to mobile Home Surface actively-running sessions on the phone home dashboard: a fourth "In progress" stat card and a list pinned above the to-dos. Both share one definition (live sessions with status .running), and list rows link into the session transcript. Co-Authored-By: Claude Opus 4.8 --- .../NucleicRemote/Views/HomeView.swift | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/NucleicRemote/NucleicRemote/Views/HomeView.swift b/NucleicRemote/NucleicRemote/Views/HomeView.swift index f42395d..0059944 100644 --- a/NucleicRemote/NucleicRemote/Views/HomeView.swift +++ b/NucleicRemote/NucleicRemote/Views/HomeView.swift @@ -8,6 +8,12 @@ struct HomeView: View { @EnvironmentObject var store: RemoteStore private var counts: DashboardCounts { store.dashboard.counts } + + /// Sessions actively working a turn — drives both the "In progress" stat card and the + /// live list pinned above the to-dos. + private var running: [WireSessionSummary] { + store.liveSessions.filter { $0.status == .running }.sorted { $0.updatedAt > $1.updatedAt } + } private var activityByDay: [Date: Int] { Dictionary(store.dashboard.activity.map { (Calendar.current.startOfDay(for: $0.day), $0.count) }, uniquingKeysWith: +) @@ -56,6 +62,8 @@ struct HomeView: View { .frame(maxWidth: .infinity, alignment: .leading) .card() + if !running.isEmpty { InProgressSessions(sessions: running) } + QuickTodos() StartChatComposer() @@ -78,12 +86,39 @@ struct HomeView: View { private var statCards: some View { HStack(spacing: 12) { StatCard(value: counts.projects, label: "Projects", icon: "folder") + StatCard(value: running.count, label: "In progress", icon: "circle.lefthalf.filled") StatCard(value: counts.activeChats, label: "Active", icon: "bolt") StatCard(value: counts.messages, label: "Messages", icon: "paperplane") } } } +/// Live peek at sessions actively running a turn, pinned above the to-do list on Home. Tapping +/// a row drops into the session transcript. +private struct InProgressSessions: View { + let sessions: [WireSessionSummary] + + var body: some View { + VStack(alignment: .leading, spacing: 10) { + HStack { + Text("In progress").font(.headline) + Spacer() + Text("\(sessions.count)").foregroundStyle(.secondary) + } + ForEach(sessions.prefix(4), id: \.sessionID) { summary in + NavigationLink { + SessionDetailView(sessionID: summary.sessionID) + } label: { + SessionRow(summary: summary) + } + .buttonStyle(.plain) + } + } + .frame(maxWidth: .infinity, alignment: .leading) + .card() + } +} + private struct StatCard: View { let value: Int let label: String