From 78e93ab726a7752869288fbdcbfae301a44782b5 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Fri, 24 Nov 2023 21:49:00 -0800 Subject: [PATCH] feat: chat delete confirmation --- src/lib/components/layout/Sidebar.svelte | 117 ++++++++++++++--------- 1 file changed, 74 insertions(+), 43 deletions(-) diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/Sidebar.svelte index 73b6e8b3b..de1ca16a8 100644 --- a/src/lib/components/layout/Sidebar.svelte +++ b/src/lib/components/layout/Sidebar.svelte @@ -17,7 +17,9 @@ let title: string = 'Ollama Web UI'; let search = ''; - let chatTitleEditIdx = null; + let chatDeleteId = null; + + let chatTitleEditId = null; let chatTitle = ''; let showDropdown = false; @@ -118,25 +120,25 @@
- +
@@ -169,34 +171,24 @@ placeholder="Search" bind:value={search} /> -
- + --> +
@@ -221,8 +213,8 @@ : ''} transition whitespace-nowrap text-ellipsis" on:click={() => { // goto(`/c/${chat.id}`); - if (chat.id !== chatTitleEditIdx) { - chatTitleEditIdx = null; + if (chat.id !== chatTitleEditId) { + chatTitleEditId = null; chatTitle = ''; } @@ -253,7 +245,7 @@ ? 'w-[120px]' : 'w-[180px]'} " > - {#if chatTitleEditIdx === chat.id} + {#if chatTitleEditId === chat.id} {:else} {chat.title} @@ -264,13 +256,13 @@ {#if chat.id === $chatId}
- {#if chatTitleEditIdx === chat.id} + {#if chatTitleEditId === chat.id}
+ {:else if chatDeleteId === chat.id} +
+ + +
{:else}