This commit is contained in:
Timothy Jaeryang Baek
2026-07-14 14:33:10 -04:00
parent 8dd862d338
commit 9f17c5960a
3 changed files with 48 additions and 94 deletions
+2 -11
View File
@@ -2,7 +2,7 @@
import { getContext } from 'svelte';
import { toast } from 'svelte-sonner';
import { mobile, showSettings, showSidebar, user } from '$lib/stores';
import { mobile, showSidebar, user } from '$lib/stores';
import { slide } from 'svelte/transition';
import { page } from '$app/stores';
@@ -196,16 +196,7 @@
{#if $user !== undefined}
<div>
<UserMenu
className="w-[240px]"
role={$user?.role}
help={true}
on:show={(e) => {
if (e.detail === 'archived-chat') {
showSettings.set('archived_chats');
}
}}
>
<UserMenu className="w-[240px]" role={$user?.role} help={true}>
<button
class="select-none flex rounded-xl p-1.5 w-full hover:bg-gray-50 dark:hover:bg-gray-850 transition"
aria-label="User Menu"
-11
View File
@@ -8,7 +8,6 @@
user,
chats,
settings,
showSettings,
chatId,
tags,
folders as _folders,
@@ -954,11 +953,6 @@
role={$user?.role}
profile={$config?.features?.enable_user_status ?? true}
showActiveUsers={false}
on:show={(e) => {
if (e.detail === 'archived-chat') {
showSettings.set('archived_chats');
}
}}
>
<button
type="button"
@@ -1577,11 +1571,6 @@
profile={$config?.features?.enable_user_status ?? true}
showActiveUsers={false}
className="w-[calc(var(--sidebar-width)-1rem)]"
on:show={(e) => {
if (e.detail === 'archived-chat') {
showSettings.set('archived_chats');
}
}}
>
<button
type="button"
@@ -1,5 +1,5 @@
<script lang="ts">
import { createEventDispatcher, getContext, onMount, tick } from 'svelte';
import { getContext, onMount, tick } from 'svelte';
import { goto } from '$app/navigation';
import { fade, slide } from 'svelte/transition';
@@ -22,7 +22,6 @@
import Dropdown from '$lib/components/common/Dropdown.svelte';
import DropdownMenu from '$lib/components/common/DropdownMenu.svelte';
import Tooltip from '$lib/components/common/Tooltip.svelte';
import ArchiveBox from '$lib/components/icons/ArchiveBox.svelte';
import QuestionMarkCircle from '$lib/components/icons/QuestionMarkCircle.svelte';
import Map from '$lib/components/icons/Map.svelte';
import Keyboard from '$lib/components/icons/Keyboard.svelte';
@@ -57,8 +56,6 @@
let showUserStatusModal = false;
let shiftKey = false;
const dispatch = createEventDispatcher();
const DEFAULT_PINNED_ITEMS = ['notes', 'workspace'];
$: pinnedItems = $settings?.pinnedMenuItems ?? DEFAULT_PINNED_ITEMS;
@@ -224,74 +221,6 @@
<hr class="border-gray-50/30 dark:border-gray-800/30 my-0.5 mx-1 p-0" />
{/if}
<button
class="flex h-[1.6875rem] items-center gap-2 rounded-xl px-2 text-[13px] w-full hover:bg-gray-50/40 dark:hover:bg-gray-800/40 transition cursor-pointer select-none"
type="button"
on:click={async () => {
show = false;
await showSettings.set(true);
if ($mobile) {
await tick();
showSidebar.set(false);
}
}}
>
<div class="self-center">
<Settings className="size-3.5" strokeWidth="1.5" />
</div>
<div class=" self-center truncate">{$i18n.t('Settings')}</div>
</button>
{#if role === 'admin'}
<a
href="/admin"
draggable="false"
class="flex h-[1.6875rem] items-center gap-2 rounded-xl px-2 text-[13px] w-full hover:bg-gray-50/40 dark:hover:bg-gray-800/40 transition cursor-pointer select-none"
on:click={async (e) => {
if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) {
return;
}
e.preventDefault();
show = false;
goto('/admin');
if ($mobile) {
await tick();
showSidebar.set(false);
}
}}
>
<div class="self-center">
<UserGroup className="size-3.5" strokeWidth="1.5" />
</div>
<div class=" self-center truncate">{$i18n.t('Admin Panel')}</div>
</a>
{/if}
<button
class="flex h-[1.6875rem] items-center gap-2 rounded-xl px-2 text-[13px] w-full hover:bg-gray-50/40 dark:hover:bg-gray-800/40 transition cursor-pointer select-none"
type="button"
on:click={async () => {
show = false;
dispatch('show', 'archived-chat');
if ($mobile) {
await tick();
showSidebar.set(false);
}
}}
>
<div class="self-center">
<ArchiveBox className="size-3.5" strokeWidth="1.5" />
</div>
<div class=" self-center truncate">{$i18n.t('Archived Chats')}</div>
</button>
<hr class="border-gray-50/30 dark:border-gray-800/30 my-0.5 mx-1 p-0" />
{#if $user?.role === 'admin' || $user?.permissions?.workspace?.models || $user?.permissions?.workspace?.knowledge || $user?.permissions?.workspace?.prompts || $user?.permissions?.workspace?.tools || $user?.permissions?.workspace?.skills}
<div class="flex items-center w-full">
<a
@@ -610,6 +539,51 @@
<hr class="border-gray-50/30 dark:border-gray-800/30 my-0.5 mx-1 p-0" />
{#if role === 'admin'}
<a
href="/admin"
draggable="false"
class="flex h-[1.6875rem] items-center gap-2 rounded-xl px-2 text-[13px] w-full hover:bg-gray-50/40 dark:hover:bg-gray-800/40 transition cursor-pointer select-none"
on:click={async (e) => {
if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) {
return;
}
e.preventDefault();
show = false;
goto('/admin');
if ($mobile) {
await tick();
showSidebar.set(false);
}
}}
>
<div class="self-center">
<UserGroup className="size-3.5" strokeWidth="1.5" />
</div>
<div class=" self-center truncate">{$i18n.t('Admin Panel')}</div>
</a>
{/if}
<button
class="flex h-[1.6875rem] items-center gap-2 rounded-xl px-2 text-[13px] w-full hover:bg-gray-50/40 dark:hover:bg-gray-800/40 transition cursor-pointer select-none"
type="button"
on:click={async () => {
show = false;
await showSettings.set(true);
if ($mobile) {
await tick();
showSidebar.set(false);
}
}}
>
<div class="self-center">
<Settings className="size-3.5" strokeWidth="1.5" />
</div>
<div class=" self-center truncate">{$i18n.t('Settings')}</div>
</button>
<button
class="flex h-[1.6875rem] items-center gap-2 rounded-xl px-2 text-[13px] w-full hover:bg-gray-50/40 dark:hover:bg-gray-800/40 transition cursor-pointer select-none"
type="button"