Clarify session memory save state

This commit is contained in:
Flatlogic Bot 2026-06-09 16:31:47 +00:00
parent 1a1c1a02ce
commit 058b824a5c

View File

@ -151,6 +151,9 @@ const SessionMemory = () => {
const [isTranscribing, setIsTranscribing] = React.useState(false); const [isTranscribing, setIsTranscribing] = React.useState(false);
const [isSaving, setIsSaving] = React.useState(false); const [isSaving, setIsSaving] = React.useState(false);
const [notice, setNotice] = React.useState(''); const [notice, setNotice] = React.useState('');
const [lastSavedSession, setLastSavedSession] = React.useState<Session | null>(
null,
);
async function loadData() { async function loadData() {
const [clientsResponse, sessionsResponse] = await Promise.all([ const [clientsResponse, sessionsResponse] = await Promise.all([
@ -177,6 +180,7 @@ const SessionMemory = () => {
}; };
}); });
setNotice(''); setNotice('');
setLastSavedSession(null);
} }
async function generateMemory() { async function generateMemory() {
@ -192,6 +196,7 @@ const SessionMemory = () => {
...response.data, ...response.data,
}); });
setNotice('Draft generated. Review and edit before saving.'); setNotice('Draft generated. Review and edit before saving.');
setLastSavedSession(null);
} catch (error) { } catch (error) {
setNotice(requestErrorMessage(error, 'Memory generation failed.')); setNotice(requestErrorMessage(error, 'Memory generation failed.'));
} finally { } finally {
@ -236,6 +241,7 @@ const SessionMemory = () => {
}); });
setSessions((current) => [response.data, ...current]); setSessions((current) => [response.data, ...current]);
setLastSavedSession(response.data);
setDraft(emptyDraft); setDraft(emptyDraft);
setTranscript(''); setTranscript('');
setNotice( setNotice(
@ -274,6 +280,7 @@ const SessionMemory = () => {
draft.follow_up_email || draft.follow_up_email ||
draft.shared_client_notes, draft.shared_client_notes,
); );
const selectedClient = clients.find((client) => client.id === clientId);
return ( return (
<> <>
@ -394,9 +401,14 @@ const SessionMemory = () => {
Edit the final memory Edit the final memory
</h2> </h2>
</div> </div>
<span className='rounded-full bg-[#fbf8f1] px-3 py-1 text-xs font-semibold text-[#b17a1e]'> {hasDraft && (
Not shared until approved <span className='rounded-full bg-[#fbf8f1] px-3 py-1 text-xs font-semibold text-[#b17a1e]'>
</span> Draft not shared yet
</span>
)}
{!hasDraft && lastSavedSession && (
<StatusPill status={lastSavedSession.status} />
)}
</div> </div>
{hasDraft ? ( {hasDraft ? (
@ -488,6 +500,33 @@ const SessionMemory = () => {
</button> </button>
</div> </div>
</div> </div>
) : lastSavedSession ? (
<div className='mt-4 rounded-lg border border-[#35b7a5]/20 bg-[#f3fbf8] p-4'>
<BaseIcon
path={
lastSavedSession.status === 'shared'
? mdiSendOutline
: mdiCheckCircleOutline
}
size={22}
className='text-[#257f73]'
/>
<p className='mt-4 font-semibold text-[#19192d]'>
{lastSavedSession.status === 'shared'
? 'Shared with client'
: 'Saved as coach draft'}
</p>
<p className='mt-2 leading-6 text-[#72798a]'>
{lastSavedSession.title} was saved for{' '}
{lastSavedSession.client?.name ||
selectedClient?.name ||
'the selected client'}
.
</p>
<p className='mt-3 text-sm font-semibold text-[#257f73]'>
You can find it in Recent memories below.
</p>
</div>
) : ( ) : (
<div className='mt-4 rounded-lg border border-dashed border-[#19192d]/10 bg-[#fffdf9] p-4'> <div className='mt-4 rounded-lg border border-dashed border-[#19192d]/10 bg-[#fffdf9] p-4'>
<BaseIcon <BaseIcon