Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
a57a01a5
Commit
a57a01a5
authored
May 14, 2024
by
Timothy J. Baek
Browse files
refac: navbar styling
parent
170361c2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
32 deletions
+76
-32
src/lib/components/layout/Navbar.svelte
src/lib/components/layout/Navbar.svelte
+34
-1
src/lib/components/layout/Sidebar.svelte
src/lib/components/layout/Sidebar.svelte
+41
-30
src/lib/components/layout/Sidebar/UserMenu.svelte
src/lib/components/layout/Sidebar/UserMenu.svelte
+1
-1
No files found.
src/lib/components/layout/Navbar.svelte
View file @
a57a01a5
...
@@ -2,7 +2,16 @@
...
@@ -2,7 +2,16 @@
import { getContext } from 'svelte';
import { getContext } from 'svelte';
import { toast } from 'svelte-sonner';
import { toast } from 'svelte-sonner';
import { WEBUI_NAME, chatId, modelfiles, settings, showSettings, showSidebar } from '$lib/stores';
import {
WEBUI_NAME,
chatId,
mobile,
modelfiles,
settings,
showSettings,
showSidebar,
user
} from '$lib/stores';
import { slide } from 'svelte/transition';
import { slide } from 'svelte/transition';
import ShareChatModal from '../chat/ShareChatModal.svelte';
import ShareChatModal from '../chat/ShareChatModal.svelte';
...
@@ -10,6 +19,7 @@
...
@@ -10,6 +19,7 @@
import Tooltip from '../common/Tooltip.svelte';
import Tooltip from '../common/Tooltip.svelte';
import Menu from './Navbar/Menu.svelte';
import Menu from './Navbar/Menu.svelte';
import { page } from '$app/stores';
import { page } from '$app/stores';
import UserMenu from './Sidebar/UserMenu.svelte';
const i18n = getContext('i18n');
const i18n = getContext('i18n');
...
@@ -155,6 +165,29 @@
...
@@ -155,6 +165,29 @@
</div>
</div>
</button>
</button>
</Tooltip>
</Tooltip>
{#if !$mobile && $user !== undefined}
<UserMenu
role={$user.role}
on:show={(e) => {
if (e.detail === 'archived-chat') {
// showArchivedChatsModal = true;
}
}}
>
<button
class=" flex rounded-xl p-1.5 w-full hover:bg-gray-100 dark:hover:bg-gray-850 transition"
>
<div class=" self-center">
<img
src={$user.profile_image_url}
class=" size-6 object-cover rounded-full"
alt="User profile"
/>
</div>
</button>
</UserMenu>
{/if}
</div>
</div>
</div>
</div>
</div>
</div>
...
...
src/lib/components/layout/Sidebar.svelte
View file @
a57a01a5
<script lang="ts">
<script lang="ts">
import { goto } from '$app/navigation';
import { goto } from '$app/navigation';
import { user, chats, settings, showSettings, chatId, tags, showSidebar } from '$lib/stores';
import {
user,
chats,
settings,
showSettings,
chatId,
tags,
showSidebar,
mobile
} from '$lib/stores';
import { onMount, getContext } from 'svelte';
import { onMount, getContext } from 'svelte';
const i18n = getContext('i18n');
const i18n = getContext('i18n');
...
@@ -703,38 +712,40 @@
...
@@ -703,38 +712,40 @@
</div>
</div>
</div>
</div>
<div class="px-2.5">
{#if $mobile}
<!-- <hr class=" border-gray-900 mb-1 w-full" /> -->
<div class="px-2.5">
<!-- <hr class=" border-gray-900 mb-1 w-full" /> -->
<div class="flex flex-col">
{#if $user !== undefined}
<div class="flex flex-col">
<UserMenu
{#if $user !== undefined}
role={$user.role}
<UserMenu
on:show={(e) => {
role={$user.role}
if (e.detail === 'archived-chat') {
on:show={(e) => {
showArchivedChatsModal = true;
if (e.detail === 'archived-chat') {
}
showArchivedChatsModal = true;
}}
}
>
<button
class=" flex rounded-xl py-3 px-3.5 w-full hover:bg-gray-100 dark:hover:bg-gray-900 transition"
on:click={() => {
showDropdown = !showDropdown;
}}
}}
>
>
<div class=" self-center mr-3">
<button
<img
class=" flex rounded-xl py-3 px-3.5 w-full hover:bg-gray-100 dark:hover:bg-gray-900 transition"
src={$user.profile_image_url}
on:click={() => {
class=" max-w-[30px] object-cover rounded-full"
showDropdown = !showDropdown;
alt="User profile"
}}
/>
>
</div>
<div class=" self-center mr-3">
<div class=" self-center font-semibold">{$user.name}</div>
<img
</button>
src={$user.profile_image_url}
</UserMenu>
class=" max-w-[30px] object-cover rounded-full"
{/if}
alt="User profile"
/>
</div>
<div class=" self-center font-semibold">{$user.name}</div>
</button>
</UserMenu>
{/if}
</div>
</div>
</div>
</div>
{/if}
</div>
</div>
<div
<div
...
...
src/lib/components/layout/Sidebar/UserMenu.svelte
View file @
a57a01a5
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
<slot name="content">
<slot name="content">
<DropdownMenu.Content
<DropdownMenu.Content
class="w-full max-w-[240px] rounded-lg p-1 py-1 border border-gray-
8
50 z-50 bg-gray-850 text-white text-sm"
class="w-full max-w-[240px] rounded-lg p-1 py-1 border border-gray-
300/30 dark:border-gray-700/
50 z-50 bg-gray-850 text-white text-sm"
sideOffset={8}
sideOffset={8}
side="bottom"
side="bottom"
align="start"
align="start"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment