diff --git a/frontend/src/pages/session-memory.tsx b/frontend/src/pages/session-memory.tsx index 560761d..da555dc 100644 --- a/frontend/src/pages/session-memory.tsx +++ b/frontend/src/pages/session-memory.tsx @@ -151,6 +151,9 @@ const SessionMemory = () => { const [isTranscribing, setIsTranscribing] = React.useState(false); const [isSaving, setIsSaving] = React.useState(false); const [notice, setNotice] = React.useState(''); + const [lastSavedSession, setLastSavedSession] = React.useState( + null, + ); async function loadData() { const [clientsResponse, sessionsResponse] = await Promise.all([ @@ -177,6 +180,7 @@ const SessionMemory = () => { }; }); setNotice(''); + setLastSavedSession(null); } async function generateMemory() { @@ -192,6 +196,7 @@ const SessionMemory = () => { ...response.data, }); setNotice('Draft generated. Review and edit before saving.'); + setLastSavedSession(null); } catch (error) { setNotice(requestErrorMessage(error, 'Memory generation failed.')); } finally { @@ -236,6 +241,7 @@ const SessionMemory = () => { }); setSessions((current) => [response.data, ...current]); + setLastSavedSession(response.data); setDraft(emptyDraft); setTranscript(''); setNotice( @@ -274,6 +280,7 @@ const SessionMemory = () => { draft.follow_up_email || draft.shared_client_notes, ); + const selectedClient = clients.find((client) => client.id === clientId); return ( <> @@ -394,9 +401,14 @@ const SessionMemory = () => { Edit the final memory - - Not shared until approved - + {hasDraft && ( + + Draft not shared yet + + )} + {!hasDraft && lastSavedSession && ( + + )} {hasDraft ? ( @@ -488,6 +500,33 @@ const SessionMemory = () => { + ) : lastSavedSession ? ( +
+ +

+ {lastSavedSession.status === 'shared' + ? 'Shared with client' + : 'Saved as coach draft'} +

+

+ {lastSavedSession.title} was saved for{' '} + {lastSavedSession.client?.name || + selectedClient?.name || + 'the selected client'} + . +

+

+ You can find it in Recent memories below. +

+
) : (