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

View File

@@ -437,6 +437,7 @@
{#if !$temporaryChatEnabled && chat?.id} {#if !$temporaryChatEnabled && chat?.id}
<hr class="border-gray-50/30 dark:border-gray-800/30 my-1" /> <hr class="border-gray-50/30 dark:border-gray-800/30 my-1" />
{#if $folders.length > 0}
<DropdownMenu.Sub> <DropdownMenu.Sub>
<DropdownMenu.SubTrigger <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" 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} sideOffset={8}
> >
{#each $folders.sort((a, b) => b.updated_at - a.updated_at) as folder} {#each $folders.sort((a, b) => b.updated_at - a.updated_at) as folder}
{#if folder?.id}
<DropdownMenu.Item <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" 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={() => { on:click={() => {
moveChatHandler(chat?.id, folder?.id); moveChatHandler(chat.id, folder.id);
}} }}
> >
<Folder strokeWidth="1.5" /> <Folder strokeWidth="1.5" />
<div class="flex items-center">{folder?.name ?? 'Folder'}</div> <div class="flex items-center">{folder.name ?? 'Folder'}</div>
</DropdownMenu.Item> </DropdownMenu.Item>
{/if}
{/each} {/each}
</DropdownMenu.SubContent> </DropdownMenu.SubContent>
</DropdownMenu.Sub> </DropdownMenu.Sub>
{/if}
<DropdownMenu.Item <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" 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"