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,33 +437,37 @@
{#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" />
<DropdownMenu.Sub> {#if $folders.length > 0}
<DropdownMenu.SubTrigger <DropdownMenu.Sub>
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" <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"
<Folder strokeWidth="1.5" /> >
<Folder strokeWidth="1.5" />
<div class="flex items-center">{$i18n.t('Move')}</div> <div class="flex items-center">{$i18n.t('Move')}</div>
</DropdownMenu.SubTrigger> </DropdownMenu.SubTrigger>
<DropdownMenu.SubContent <DropdownMenu.SubContent
class="w-full rounded-2xl p-1 z-50 bg-white dark:bg-gray-850 dark:text-white border border-gray-100 dark:border-gray-800 shadow-lg max-h-52 overflow-y-auto scrollbar-hidden" class="w-full rounded-2xl p-1 z-50 bg-white dark:bg-gray-850 dark:text-white border border-gray-100 dark:border-gray-800 shadow-lg max-h-52 overflow-y-auto scrollbar-hidden"
transition={flyAndScale} transition={flyAndScale}
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}
<DropdownMenu.Item {#if folder?.id}
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" <DropdownMenu.Item
on:click={() => { 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"
moveChatHandler(chat?.id, folder?.id); on:click={() => {
}} 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>
{/each} {/if}
</DropdownMenu.SubContent> {/each}
</DropdownMenu.Sub> </DropdownMenu.SubContent>
</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"