feat: restructure app.html to support custom icon svg
This commit is contained in:
10 files changed
+148
-135
No files matched your search
@@ -1,6 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
import { notifications, profile } from '$lib/auth.svelte.js'
|
||||
import ItemList from '$lib/components/lemmy/generic/ItemList.svelte'
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
@@ -8,28 +6,26 @@
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { communityLink } from '$lib/lemmy/generic'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { Badge, Button, Menu, MenuButton, Option, Select } from 'mono-svelte'
|
||||
import { theme } from '$lib/ui/colors.svelte'
|
||||
import { Badge, Option, Select } from 'mono-svelte'
|
||||
import {
|
||||
ArrowLeftOnRectangle,
|
||||
Bookmark,
|
||||
CheckCircle,
|
||||
ChevronUpDown,
|
||||
Cog6Tooth,
|
||||
ComputerDesktop,
|
||||
Icon,
|
||||
Identification,
|
||||
Inbox,
|
||||
Moon,
|
||||
QuestionMarkCircle,
|
||||
Sun,
|
||||
Swatch,
|
||||
UserCircle,
|
||||
UserGroup,
|
||||
} from 'svelte-hero-icons'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
import Avatar from '../Avatar.svelte'
|
||||
import EndPlaceholder from '../EndPlaceholder.svelte'
|
||||
import { theme } from '$lib/ui/colors.svelte'
|
||||
import ProfileSelection from './ProfileSelection.svelte'
|
||||
import Logo from '../Logo.svelte'
|
||||
import { PUBLIC_XYLIGHT_MODE } from '$env/static/public'
|
||||
|
||||
interface Props {
|
||||
style?: string
|
||||
@@ -40,78 +36,7 @@
|
||||
</script>
|
||||
|
||||
<nav class={['flex flex-col overflow-auto gap-1', clazz]} {style}>
|
||||
<Menu placement="bottom">
|
||||
{#snippet target()}
|
||||
<Button
|
||||
color="tertiary"
|
||||
alignment="left"
|
||||
size="md"
|
||||
class="flex flex-row gap-2 items-center"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Avatar
|
||||
url={profile.current.avatar}
|
||||
alt={profile.current.username}
|
||||
width={24}
|
||||
/>
|
||||
{/snippet}
|
||||
<div class="flex-1">
|
||||
<div class="font-medium">{profile.current.username}</div>
|
||||
<div class="text-xs text-slate-500 dark:text-zinc-500">
|
||||
{profile.current.instance}
|
||||
</div>
|
||||
</div>
|
||||
{#snippet suffix()}
|
||||
<Icon
|
||||
src={ChevronUpDown}
|
||||
size="16"
|
||||
micro
|
||||
class="block justify-self-end"
|
||||
/>
|
||||
{/snippet}
|
||||
</Button>
|
||||
{/snippet}
|
||||
{#each profile.meta.profiles as p}
|
||||
<MenuButton
|
||||
onclick={() => {
|
||||
profile.meta.profile = p.id
|
||||
|
||||
goto(page.url, {
|
||||
invalidateAll: true,
|
||||
})
|
||||
}}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Avatar url={p.avatar} alt={p.username} width={24} />
|
||||
{/snippet}
|
||||
<div>
|
||||
<div class="font-medium text-sm">{p.username}</div>
|
||||
<div class="text-xs text-slate-500 dark:text-zinc-500">
|
||||
{p.instance}
|
||||
</div>
|
||||
</div>
|
||||
{#if profile.meta.profile == p.id}
|
||||
<Icon
|
||||
src={CheckCircle}
|
||||
class="text-primary-900 dark:text-primary-100 ml-auto"
|
||||
size="16"
|
||||
micro
|
||||
/>
|
||||
{/if}
|
||||
{#if !p.jwt}
|
||||
<Badge color="gray-subtle" class="ml-auto p-1!">
|
||||
<Icon src={QuestionMarkCircle} size="16" micro />
|
||||
</Badge>
|
||||
{/if}
|
||||
</MenuButton>
|
||||
{/each}
|
||||
<MenuButton href="/accounts">
|
||||
{#snippet prefix()}
|
||||
<Icon src={UserGroup} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('account.accounts')}
|
||||
</MenuButton>
|
||||
</Menu>
|
||||
<ProfileSelection />
|
||||
<EndPlaceholder size="xs">{$t('profile.profile')}</EndPlaceholder>
|
||||
{#if profile.current?.jwt}
|
||||
<SidebarButton
|
||||
@@ -143,7 +68,7 @@
|
||||
/>
|
||||
<SidebarButton
|
||||
href="/accounts"
|
||||
title={$t('accounts.accounts')}
|
||||
label={$t('account.accounts')}
|
||||
icon={UserGroup}
|
||||
/>
|
||||
{/if}
|
||||
@@ -235,4 +160,29 @@
|
||||
{/if}
|
||||
|
||||
<div class="flex-1 h-full mt-auto"></div>
|
||||
|
||||
<footer
|
||||
class="flex gap-6 flex-col xl:flex-row text-sm text-slate-600 dark:text-zinc-300"
|
||||
>
|
||||
<div class="flex items-center gap-2">
|
||||
<Logo width={16} />
|
||||
<span class="font-medium">
|
||||
{__VERSION__}
|
||||
</span>
|
||||
</div>
|
||||
{#if PUBLIC_XYLIGHT_MODE.toLowerCase() == 'true'}
|
||||
<a
|
||||
href="https://github.com/xyphyn/photon"
|
||||
class="text-blue-600 dark:text-blue-400/60 hover:underline"
|
||||
>
|
||||
{$t('nav.menu.source')}
|
||||
</a>
|
||||
<a
|
||||
href="https://buymeacoffee.com/xylight"
|
||||
class="text-blue-600 dark:text-blue-400/60 hover:underline"
|
||||
>
|
||||
{$t('nav.menu.donate')}
|
||||
</a>
|
||||
{/if}
|
||||
</footer>
|
||||
</nav>
|
||||
Reference in new issue
Block a user