change interactive elements in dropdownmenu to dropdownitems

This commit is contained in:
Sine Jespersen 2025-07-02 11:14:12 +02:00
parent 7e49c8733b
commit b7255854d2

View file

@ -72,7 +72,7 @@
align="start" align="start"
transition={(e) => fade(e, { duration: 100 })} transition={(e) => fade(e, { duration: 100 })}
> >
<button <DropdownMenu.Item
class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition" class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition"
on:click={async () => { on:click={async () => {
await showSettings.set(true); await showSettings.set(true);
@ -87,9 +87,9 @@
<Settings className="w-5 h-5" strokeWidth="1.5" /> <Settings className="w-5 h-5" strokeWidth="1.5" />
</div> </div>
<div class=" self-center truncate">{$i18n.t('Settings')}</div> <div class=" self-center truncate">{$i18n.t('Settings')}</div>
</button> </DropdownMenu.Item>
<button <DropdownMenu.Item
class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition" class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition"
on:click={() => { on:click={() => {
dispatch('show', 'archived-chat'); dispatch('show', 'archived-chat');
@ -104,44 +104,40 @@
<ArchiveBox className="size-5" strokeWidth="1.5" /> <ArchiveBox className="size-5" strokeWidth="1.5" />
</div> </div>
<div class=" self-center truncate">{$i18n.t('Archived Chats')}</div> <div class=" self-center truncate">{$i18n.t('Archived Chats')}</div>
</button> </DropdownMenu.Item>
{#if role === 'admin'} {#if role === 'admin'}
<a <DropdownMenu.Item
href="/playground"
class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition select-none" class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition select-none"
on:click={() => { on:click={() => {
show = false; show = false;
if ($mobile) { if ($mobile) {
showSidebar.set(false); showSidebar.set(false);
} }
goto('/playground');
}} }}
rel="noopener noreferrer"
draggable="false"
> >
<div class=" self-center mr-3"> <div class=" self-center mr-3">
<Code className="size-5" strokeWidth="1.5" /> <Code className="size-5" strokeWidth="1.5" />
</div> </div>
<div class=" self-center truncate">{$i18n.t('Playground')}</div> <div class=" self-center truncate">{$i18n.t('Playground')}</div>
</a> </DropdownMenu.Item>
<a <DropdownMenu.Item
href="/admin"
class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition select-none" class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition select-none"
on:click={() => { on:click={() => {
show = false; show = false;
if ($mobile) { if ($mobile) {
showSidebar.set(false); showSidebar.set(false);
} }
goto('/admin');
}} }}
rel="noopener noreferrer"
draggable="false"
> >
<div class=" self-center mr-3"> <div class=" self-center mr-3">
<UserGroup className="w-5 h-5" strokeWidth="1.5" /> <UserGroup className="w-5 h-5" strokeWidth="1.5" />
</div> </div>
<div class=" self-center truncate">{$i18n.t('Admin Panel')}</div> <div class=" self-center truncate">{$i18n.t('Admin Panel')}</div>
</a> </DropdownMenu.Item>
{/if} {/if}
{#if help} {#if help}
@ -188,7 +184,7 @@
<hr class=" border-gray-100 dark:border-gray-800 my-1 p-0" /> <hr class=" border-gray-100 dark:border-gray-800 my-1 p-0" />
<button <DropdownMenu.Item
class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition" class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition"
on:click={async () => { on:click={async () => {
const res = await userSignOut(); const res = await userSignOut();
@ -203,7 +199,7 @@
<SignOut className="w-5 h-5" strokeWidth="1.5" /> <SignOut className="w-5 h-5" strokeWidth="1.5" />
</div> </div>
<div class=" self-center truncate">{$i18n.t('Sign Out')}</div> <div class=" self-center truncate">{$i18n.t('Sign Out')}</div>
</button> </DropdownMenu.Item>
{#if usage} {#if usage}
{#if usage?.user_ids?.length > 0} {#if usage?.user_ids?.length > 0}