Skip to content

Commit 5640b38

Browse files
committed
fix: title edit issue
1 parent 32361dc commit 5640b38

1 file changed

Lines changed: 26 additions & 22 deletions

File tree

src/lib/components/layout/Sidebar.svelte

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -366,28 +366,34 @@
366366
}
367367
}) as chat, i}
368368
<div class=" w-full pr-2 relative">
369-
<a
370-
class=" w-full flex justify-between rounded-xl px-3 py-2 hover:bg-gray-900 {chat.id ===
371-
$chatId
372-
? 'bg-gray-900'
373-
: ''} transition whitespace-nowrap text-ellipsis"
374-
href="/c/{chat.id}"
375-
draggable={isEditing ? 'false' : 'true'}
376-
>
377-
<div class=" flex self-center flex-1 w-full">
378-
<div
379-
class=" text-left self-center overflow-hidden {chat.id === $chatId
380-
? 'w-[160px]'
381-
: 'w-full'} "
382-
>
383-
{#if chatTitleEditId === chat.id}
384-
<input bind:value={chatTitle} class=" bg-transparent w-full" />
385-
{:else}
369+
{#if chatTitleEditId === chat.id}
370+
<div
371+
class=" w-full flex justify-between rounded-xl px-3 py-2 hover:bg-gray-900 {chat.id ===
372+
$chatId
373+
? 'bg-gray-900'
374+
: ''} transition whitespace-nowrap text-ellipsis"
375+
>
376+
<input bind:value={chatTitle} class=" bg-transparent w-full outline-none mr-10" />
377+
</div>
378+
{:else}
379+
<a
380+
class=" w-full flex justify-between rounded-xl px-3 py-2 hover:bg-gray-900 {chat.id ===
381+
$chatId
382+
? 'bg-gray-900'
383+
: ''} transition whitespace-nowrap text-ellipsis"
384+
href="/c/{chat.id}"
385+
>
386+
<div class=" flex self-center flex-1 w-full">
387+
<div
388+
class=" text-left self-center overflow-hidden {chat.id === $chatId
389+
? 'w-[160px]'
390+
: 'w-full'} "
391+
>
386392
{chat.title}
387-
{/if}
393+
</div>
388394
</div>
389-
</div>
390-
</a>
395+
</a>
396+
{/if}
391397

392398
{#if chat.id === $chatId}
393399
<div class=" absolute right-[22px] top-[10px]">
@@ -399,7 +405,6 @@
399405
editChatTitle(chat.id, chatTitle);
400406
chatTitleEditId = null;
401407
chatTitle = '';
402-
isEditing = false;
403408
}}
404409
>
405410
<svg
@@ -487,7 +492,6 @@
487492
on:click={() => {
488493
chatTitle = chat.title;
489494
chatTitleEditId = chat.id;
490-
isEditing = true;
491495
}}
492496
>
493497
<svg

0 commit comments

Comments
 (0)