feat: add inbox to sidebar

This commit is contained in:
Xylight committed 2024-03-16 16:09:07 -07:00
1 parent 7411e9f778
commit bb5f4c2162
1 file changed
+22 -5
+22 -5
View File
@@ -7,6 +7,7 @@
Home, Home,
Icon, Icon,
Identification, Identification,
Inbox,
MagnifyingGlass, MagnifyingGlass,
ServerStack, ServerStack,
UserGroup, UserGroup,
@@ -18,7 +19,7 @@
import ProfileButton from '$lib/components/ui/sidebar/ProfileButton.svelte' import ProfileButton from '$lib/components/ui/sidebar/ProfileButton.svelte'
import { flip } from 'svelte/animate' import { flip } from 'svelte/animate'
import { expoOut } from 'svelte/easing' import { expoOut } from 'svelte/easing'
import { Button } from 'mono-svelte' import { Badge, Button } from 'mono-svelte'
import { DEFAULT_INSTANCE_URL, LINKED_INSTANCE_URL } from '$lib/instance.js' import { DEFAULT_INSTANCE_URL, LINKED_INSTANCE_URL } from '$lib/instance.js'
import Expandable from '$lib/components/ui/Expandable.svelte' import Expandable from '$lib/components/ui/Expandable.svelte'
import EndPlaceholder from '../EndPlaceholder.svelte' import EndPlaceholder from '../EndPlaceholder.svelte'
@@ -40,26 +41,42 @@
<Icon src={ChevronDoubleRight} size="16" mini /> <Icon src={ChevronDoubleRight} size="16" mini />
</Button> </Button>
<SidebarButton href="/" selected={route == '/'}> <SidebarButton href="/" selected={route == '/'}>
<Icon src={Home} mini={route == '/'} size="20" title="Frontpage" /> <Icon src={Home} solid={route == '/'} size="20" title="Frontpage" />
<span slot="label">Frontpage</span> <span slot="label">Frontpage</span>
</SidebarButton> </SidebarButton>
<SidebarButton href="/settings" selected={route == '/settings'}> <SidebarButton href="/settings" selected={route == '/settings'}>
<Icon <Icon
src={Cog6Tooth} src={Cog6Tooth}
mini={route == '/settings'} solid={route == '/settings'}
size="20" size="20"
title="Settings" title="Settings"
/> />
<span slot="label">Settings</span> <span slot="label">Settings</span>
</SidebarButton> </SidebarButton>
<SidebarButton href="/search" selected={route == '/search'}> <SidebarButton href="/search" selected={route == '/search'}>
<Icon mini={route == '/search'} src={MagnifyingGlass} size="20" /> <Icon solid={route == '/search'} src={MagnifyingGlass} size="20" />
<span slot="label">Search</span> <span slot="label">Search</span>
</SidebarButton> </SidebarButton>
<SidebarButton href="/communities" selected={route == '/communities'}> <SidebarButton href="/communities" selected={route == '/communities'}>
<Icon mini={route == '/communities'} src={GlobeAlt} size="20" /> <Icon solid={route == '/communities'} src={GlobeAlt} size="20" />
<span slot="label">Communities</span> <span slot="label">Communities</span>
</SidebarButton> </SidebarButton>
{#if $profile?.jwt}
<SidebarButton href="/inbox" selected={route == '/inbox'}>
<Icon solid={route == '/inbox'} src={Inbox} size="20" />
<span slot="label" class="inline-flex items-center flex-1">
<span class="flex-shrink-0 flex-1">Inbox</span>
{#if ($profile?.user?.notifications.inbox ?? 0) > 0}
<Badge
color="red-subtle"
class="w-5 h-5 !p-0 grid place-items-center"
>
{$profile?.user?.notifications.inbox}
</Badge>
{/if}
</span>
</SidebarButton>
{/if}
{#if $profileData.profiles.length >= 1} {#if $profileData.profiles.length >= 1}
<hr class="border-slate-200 dark:border-zinc-900 my-1" /> <hr class="border-slate-200 dark:border-zinc-900 my-1" />
{#each [...$profileData.profiles] as prof, index (prof.id)} {#each [...$profileData.profiles] as prof, index (prof.id)}