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 [isSaving, setIsSaving] = React.useState(false);
const [notice, setNotice] = React.useState('');
const [lastSavedSession, setLastSavedSession] = React.useState<Session | null>(
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
</h2>
</div>
<span className='rounded-full bg-[#fbf8f1] px-3 py-1 text-xs font-semibold text-[#b17a1e]'>
Not shared until approved
</span>
{hasDraft && (
<span className='rounded-full bg-[#fbf8f1] px-3 py-1 text-xs font-semibold text-[#b17a1e]'>
Draft not shared yet
</span>
)}
{!hasDraft && lastSavedSession && (
<StatusPill status={lastSavedSession.status} />
)}
</div>
{hasDraft ? (
@ -488,6 +500,33 @@ const SessionMemory = () => {
</button>
</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'>
<BaseIcon