From 22bb909af8210b00c23cc671d350b5d023e45733 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Tue, 9 Jun 2026 14:19:59 +0000 Subject: [PATCH] Add coach next-session prep views --- backend/src/routes/coaching.js | 7 +++ frontend/src/pages/clients.tsx | 93 ++++++++++++++++++++++++++++++++ frontend/src/pages/dashboard.tsx | 85 ++++++++++++++++++++++++++--- 3 files changed, 178 insertions(+), 7 deletions(-) diff --git a/backend/src/routes/coaching.js b/backend/src/routes/coaching.js index d2c6dcb..47decde 100644 --- a/backend/src/routes/coaching.js +++ b/backend/src/routes/coaching.js @@ -48,6 +48,12 @@ router.get( order: [["next_session_at", "ASC"]], include: [{ model: db.packages, as: "package" }], }); + const upcomingPrepBriefs = await db.prep_briefs.findAll({ + limit: 4, + order: [["next_session_at", "ASC"]], + where: { status: "ready" }, + include: [{ model: db.clients, as: "client" }], + }); res.status(200).send({ counts: { @@ -59,6 +65,7 @@ router.get( }, nextSessions, activeClients, + upcomingPrepBriefs, }); }), ); diff --git a/frontend/src/pages/clients.tsx b/frontend/src/pages/clients.tsx index 01a0d6c..0d800c1 100644 --- a/frontend/src/pages/clients.tsx +++ b/frontend/src/pages/clients.tsx @@ -23,6 +23,10 @@ type ActionItem = { type PrepBrief = { id: string; + previous_summary?: string; + open_commitments?: string; + suggested_questions?: string; + sensitive_topics?: string; client_reflection?: string; client_reflection_at?: string; }; @@ -77,6 +81,26 @@ function EmptyState({ label }: { label: string }) { ); } +function PrepText({ value }: { value?: string }) { + if (!value) { + return ; + } + + return ( +
+ {value + .split(/\n|;/) + .map((item) => item.trim()) + .filter(Boolean) + .map((item) => ( +

+ {item} +

+ ))} +
+ ); +} + const Clients = () => { const router = useRouter(); const [clients, setClients] = React.useState([]); @@ -108,6 +132,7 @@ const Clients = () => { const latestReflection = selectedClient?.prep_briefs?.find((brief) => { return Boolean(brief.client_reflection); }); + const latestPrepBrief = selectedClient?.prep_briefs?.[0]; function selectClient(clientId: string) { setSelectedClientId(clientId); @@ -243,6 +268,74 @@ const Clients = () => { + +
+
+
+

+ Next-session prep +

+

+ Coach prep brief +

+
+ + Ready + +
+
+ {latestPrepBrief ? ( +
+
+

+ Client reflection +

+
+ +
+
+
+

+ Open commitments +

+
+ +
+
+
+

+ Suggested questions +

+
+ +
+
+
+

+ Watch points +

+
+ +
+
+
+

+ Previous summary +

+
+ +
+
+
+ ) : ( +
+ +
+ )} +
+
diff --git a/frontend/src/pages/dashboard.tsx b/frontend/src/pages/dashboard.tsx index 9b14709..3c51b69 100644 --- a/frontend/src/pages/dashboard.tsx +++ b/frontend/src/pages/dashboard.tsx @@ -35,6 +35,17 @@ type Session = { client?: Client; }; +type PrepBrief = { + id: string; + next_session_at?: string; + previous_summary?: string; + open_commitments?: string; + suggested_questions?: string; + sensitive_topics?: string; + client_reflection?: string; + client?: Client; +}; + type Summary = { counts: { clients: number; @@ -45,6 +56,7 @@ type Summary = { }; activeClients: Client[]; nextSessions: Session[]; + upcomingPrepBriefs: PrepBrief[]; }; const emptySummary: Summary = { @@ -57,6 +69,7 @@ const emptySummary: Summary = { }, activeClients: [], nextSessions: [], + upcomingPrepBriefs: [], }; function ShellCard({ @@ -89,7 +102,7 @@ const Dashboard = () => { loadSummary(); }, []); - const nextSession = summary.nextSessions[0]; + const nextPrepBrief = summary.upcomingPrepBriefs[0]; const stats = [ { href: '/clients', @@ -160,22 +173,24 @@ const Dashboard = () => {

Next session prep

- {nextSession ? ( + {nextPrepBrief ? (

- {nextSession.client?.name || 'Client session'} + {nextPrepBrief.client?.name || 'Client session'}

- {nextSession.title} + {nextPrepBrief.client?.role_title} ·{' '} + {nextPrepBrief.client?.company}

- {nextSession.ai_summary} + {nextPrepBrief.suggested_questions || + nextPrepBrief.previous_summary}

- Review memory + Open prep
@@ -292,6 +307,62 @@ const Dashboard = () => {
+ + +
+
+
+

+ Next-session prep +

+

+ Ready prep briefs +

+
+ + Open clients + +
+
+
+ {summary.upcomingPrepBriefs.map((brief) => ( + +
+
+

+ {brief.client?.name} +

+

+ {brief.client?.role_title} · {brief.client?.company} +

+
+ + Ready + +
+

+ {brief.client_reflection || + brief.suggested_questions || + brief.previous_summary} +

+ + ))} + {summary.upcomingPrepBriefs.length === 0 && ( +

+ {loading + ? 'Loading prep briefs...' + : 'No prep briefs ready yet.'} +

+ )} +
+