diff --git a/NucleicRemote/NucleicRemote/Views/HomeView.swift b/NucleicRemote/NucleicRemote/Views/HomeView.swift index 9f0e813..8c169f4 100644 --- a/NucleicRemote/NucleicRemote/Views/HomeView.swift +++ b/NucleicRemote/NucleicRemote/Views/HomeView.swift @@ -11,6 +11,13 @@ struct HomeView: View { private var counts: DashboardCounts { store.dashboard.counts } + /// Sessions blocking on a human โ€” the dashboard's "which session needs me?" answer (the Mac + /// home ยง2). Uses turn disposition so a finished-the-work chat doesn't count; archived hidden. + private var needsAttention: [WireSessionSummary] { + store.liveSessions + .filter { $0.status.needsYou($0.disposition) } + .sorted { $0.updatedAt > $1.updatedAt } + } /// 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] { @@ -66,6 +73,10 @@ struct HomeView: View { } } + // "Which session needs me?" โ€” pinned above everything when a chat is blocking + // on you (an approval or your next prompt), so it leads the dashboard. + if !needsAttention.isEmpty { NeedsAttentionSection(sessions: needsAttention) } + statCards // The Mac's usage gauges (5-hour / weekly windows); hidden when the host @@ -121,6 +132,39 @@ struct HomeView: View { } } +/// The dashboard's attention list: chats blocking on you (an approval or your next prompt), +/// pinned at the very top. Tapping a row drops into that session. Header tinted in the attention +/// colour so it reads as urgent, matching the Mac home's "Needs attention" lead. +private struct NeedsAttentionSection: View { + let sessions: [WireSessionSummary] + + var body: some View { + VStack(alignment: .leading, spacing: 10) { + HStack { + Label("Needs you", systemImage: "exclamationmark.triangle.fill") + .font(.headline).foregroundStyle(Palette.attention) + Spacer() + Text("\(sessions.count)") + .font(.subheadline.weight(.semibold)).foregroundStyle(Palette.attention) + } + ForEach(sessions.prefix(6), id: \.sessionID) { summary in + NavigationLink { + SessionDetailView(sessionID: summary.sessionID) + } label: { + SessionRow(summary: summary) + } + .buttonStyle(.plain) + .hoverEffect(.highlight) + } + } + .frame(maxWidth: .infinity, alignment: .leading) + .card() + .overlay( + RoundedRectangle(cornerRadius: 14) + .strokeBorder(Palette.attention.opacity(0.35), lineWidth: 1)) + } +} + /// 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 {