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 <[email protected]>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user