fix: user menu buttons

This commit is contained in:
Timothy Jaeryang Baek 2025-07-29 16:15:23 +04:00
parent cd6eb9a9e2
commit 1cbbdf7771
1 changed files with 19 additions and 17 deletions

View File

@ -71,7 +71,7 @@
transition={(e) => fade(e, { duration: 100 })} transition={(e) => fade(e, { duration: 100 })}
> >
<DropdownMenu.Item <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 cursor-pointer"
on:click={async () => { on:click={async () => {
await showSettings.set(true); await showSettings.set(true);
show = false; show = false;
@ -88,7 +88,7 @@
</DropdownMenu.Item> </DropdownMenu.Item>
<DropdownMenu.Item <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 cursor-pointer"
on:click={() => { on:click={() => {
dispatch('show', 'archived-chat'); dispatch('show', 'archived-chat');
show = false; show = false;
@ -105,70 +105,72 @@
</DropdownMenu.Item> </DropdownMenu.Item>
{#if role === 'admin'} {#if role === 'admin'}
<DropdownMenu.Item <a
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"
href="/playground"
on:click={() => { on:click={() => {
show = false; show = false;
if ($mobile) { if ($mobile) {
showSidebar.set(false); showSidebar.set(false);
} }
goto('/playground');
}} }}
> >
<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>
</DropdownMenu.Item> </a>
<DropdownMenu.Item <a
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"
href="/admin"
on:click={() => { on:click={() => {
show = false; show = false;
if ($mobile) { if ($mobile) {
showSidebar.set(false); showSidebar.set(false);
} }
goto('/admin');
}} }}
> >
<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>
</DropdownMenu.Item> </a>
{/if} {/if}
{#if help} {#if help}
<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" />
<!-- {$i18n.t('Help')} --> <!-- {$i18n.t('Help')} -->
<DropdownMenu.Item <a
class="flex gap-2 items-center py-1.5 px-3 text-sm select-none w-full cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md transition" class="flex gap-2 items-center py-1.5 px-3 text-sm select-none w-full cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md transition"
id="chat-share-button" id="chat-share-button"
href="https://docs.openwebui.com"
target="_blank"
on:click={() => { on:click={() => {
window.open('https://docs.openwebui.com', '_blank');
show = false; show = false;
}} }}
> >
<QuestionMarkCircle className="size-5" /> <QuestionMarkCircle className="size-5" />
<div class="flex items-center">{$i18n.t('Documentation')}</div> <div class="flex items-center">{$i18n.t('Documentation')}</div>
</DropdownMenu.Item> </a>
<!-- Releases --> <!-- Releases -->
<DropdownMenu.Item <a
class="flex gap-2 items-center py-1.5 px-3 text-sm select-none w-full cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md transition" class="flex gap-2 items-center py-1.5 px-3 text-sm select-none w-full cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md transition"
id="menu-item-releases" id="menu-item-releases"
href="https://github.com/open-webui/open-webui/releases"
target="_blank"
on:click={() => { on:click={() => {
window.open('https://github.com/open-webui/open-webui/releases', '_blank');
show = false; show = false;
}} }}
> >
<Map className="size-5" /> <Map className="size-5" />
<div class="flex items-center">{$i18n.t('Releases')}</div> <div class="flex items-center">{$i18n.t('Releases')}</div>
</DropdownMenu.Item> </a>
<DropdownMenu.Item <DropdownMenu.Item
class="flex gap-2 items-center py-1.5 px-3 text-sm select-none w-full cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md transition" class="flex gap-2 items-center py-1.5 px-3 text-sm select-none w-full cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md transition cursor-pointer"
id="chat-share-button" id="chat-share-button"
on:click={() => { on:click={() => {
showShortcuts.set(!$showShortcuts); showShortcuts.set(!$showShortcuts);
@ -182,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" />
<DropdownMenu.Item <button
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();
@ -197,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>
</DropdownMenu.Item> </button>
{#if usage} {#if usage}
{#if usage?.user_ids?.length > 0} {#if usage?.user_ids?.length > 0}