fix: do not display the move button when no folders (#19705)

This commit is contained in:
Shirasawa 2025-12-04 06:16:38 +08:00 committed by GitHub
parent 964333ed65
commit b560775713
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -437,6 +437,7 @@
{#if !$temporaryChatEnabled && chat?.id}
<hr class="border-gray-50/30 dark:border-gray-800/30 my-1" />
{#if $folders.length > 0}
<DropdownMenu.Sub>
<DropdownMenu.SubTrigger
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl select-none w-full"
@ -451,19 +452,22 @@
sideOffset={8}
>
{#each $folders.sort((a, b) => b.updated_at - a.updated_at) as folder}
{#if folder?.id}
<DropdownMenu.Item
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl"
on:click={() => {
moveChatHandler(chat?.id, folder?.id);
moveChatHandler(chat.id, folder.id);
}}
>
<Folder strokeWidth="1.5" />
<div class="flex items-center">{folder?.name ?? 'Folder'}</div>
<div class="flex items-center">{folder.name ?? 'Folder'}</div>
</DropdownMenu.Item>
{/if}
{/each}
</DropdownMenu.SubContent>
</DropdownMenu.Sub>
{/if}
<DropdownMenu.Item
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl"