Update ManageModal.svelte

no confirmation when no memories exist
This commit is contained in:
Silentoplayz 2025-02-25 18:00:59 -05:00
parent 7cfbf6489a
commit 8097b6a3ff

View File

@ -35,7 +35,7 @@
return null; return null;
}); });
if (res) { if (res && memories.length > 0) {
toast.success($i18n.t('Memory cleared successfully')); toast.success($i18n.t('Memory cleared successfully'));
memories = []; memories = [];
} }
@ -192,7 +192,11 @@
<button <button
class=" px-3.5 py-1.5 font-medium text-red-500 hover:bg-black/5 dark:hover:bg-white/5 outline outline-1 outline-red-300 dark:outline-red-800 rounded-3xl" class=" px-3.5 py-1.5 font-medium text-red-500 hover:bg-black/5 dark:hover:bg-white/5 outline outline-1 outline-red-300 dark:outline-red-800 rounded-3xl"
on:click={() => { on:click={() => {
if (memories.length > 0) {
showClearConfirmDialog = true; showClearConfirmDialog = true;
} else {
toast.error($i18n.t('No memories to clear'));
}
}}>{$i18n.t('Clear memory')}</button }}>{$i18n.t('Clear memory')}</button
> >
</div> </div>