nvrsion: Add “To-do” count stat card to iOS app.

Nucleic-Promote: 1
Co-authored-by: Nucleic <[email protected]>
This commit is contained in:
2026-07-02 19:37:45 -07:00
co-authored by Nucleic
parent 4493c03de0
commit 1bf1f4e658
@@ -14,6 +14,9 @@ struct HomeView: View {
private var running: [WireSessionSummary] {
store.liveSessions.filter { $0.status == .running }.sorted { $0.updatedAt > $1.updatedAt }
}
/// Outstanding to-dos — everything not yet done (open + dispatched), matching the count the
/// To-dos tab lists. The Mac surfaces this elsewhere on its home; the phone gets a stat card.
private var openTodoCount: Int { store.dashboard.todos.filter { $0.status != .done }.count }
private var activityByDay: [Date: Int] {
Dictionary(store.dashboard.activity.map { (Calendar.current.startOfDay(for: $0.day), $0.count) },
uniquingKeysWith: +)
@@ -99,13 +102,14 @@ struct HomeView: View {
}
private var statCards: some View {
// Flow the cards into two rows (3 + 2) so each gets ~a third of the width rather than a
// fifth — enough room for labels like "In progress" and full token counts to render cleanly
// Flow the cards into two rows of three so each gets ~a third of the width rather than a
// sixth — enough room for labels like "In progress" and full token counts to render cleanly
// instead of wrapping or truncating.
LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: 12), count: 3), 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: openTodoCount, label: "To-dos", icon: "checklist")
StatCard(value: counts.messages, label: "Messages", icon: "paperplane")
StatCard(values: TokenCount.adaptiveCandidates(counts.tokens), label: "Tokens", icon: "text.word.spacing")
}