feat: show number of unread messages in inbox
This commit is contained in:
1 parent
c1abaa386a
commit
5c3ba8e298
2 files changed
+22
-30
No files matched your search
@@ -214,14 +214,15 @@
|
|||||||
<Icon src={UserCircle} mini width={16} /> Profile
|
<Icon src={UserCircle} mini width={16} /> Profile
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
<MenuButton link href="/inbox">
|
<MenuButton link href="/inbox">
|
||||||
<div class="relative">
|
<Icon src={Inbox} mini width={16} />
|
||||||
{#if $profile.user.unreads > 0}
|
|
||||||
<div
|
|
||||||
class="rounded-full w-2 h-2 bg-red-500 absolute -top-1 -left-1"
|
|
||||||
/>
|
|
||||||
{/if}<Icon src={Inbox} mini width={16} />
|
|
||||||
</div>
|
|
||||||
Inbox
|
Inbox
|
||||||
|
{#if $profile.user.unreads > 0}
|
||||||
|
<div
|
||||||
|
class="rounded-full w-auto flex items-center px-2 h-5 justify-center font-bold bg-red-500 ml-auto"
|
||||||
|
>
|
||||||
|
{$profile.user.unreads}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
<MenuButton link href="/saved">
|
<MenuButton link href="/saved">
|
||||||
<Icon src={Bookmark} mini width={16} /> Saved
|
<Icon src={Bookmark} mini width={16} /> Saved
|
||||||
|
|||||||
@@ -6,20 +6,13 @@
|
|||||||
GlobeAlt,
|
GlobeAlt,
|
||||||
Home,
|
Home,
|
||||||
Icon,
|
Icon,
|
||||||
Plus,
|
|
||||||
UserCircle,
|
|
||||||
UserGroup,
|
UserGroup,
|
||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import Button from '../../input/Button.svelte'
|
import Button from '../../input/Button.svelte'
|
||||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
import { profile, profileData } from '$lib/auth.js'
|
||||||
import { profile, profileData, setUserID } from '$lib/auth.js'
|
|
||||||
import { userSettings } from '$lib/settings.js'
|
import { userSettings } from '$lib/settings.js'
|
||||||
import { goto } from '$app/navigation'
|
|
||||||
import { page } from '$app/stores'
|
|
||||||
import { slide } from 'svelte/transition'
|
|
||||||
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
|
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
|
||||||
import CommunityList from '$lib/components/ui/sidebar/CommunityList.svelte'
|
import CommunityList from '$lib/components/ui/sidebar/CommunityList.svelte'
|
||||||
import ProfileAvatar from '$lib/lemmy/ProfileAvatar.svelte'
|
|
||||||
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'
|
||||||
@@ -49,11 +42,11 @@
|
|||||||
/>
|
/>
|
||||||
</Button>
|
</Button>
|
||||||
<SidebarButton href="/" expanded={$userSettings.expandSidebar}>
|
<SidebarButton href="/" expanded={$userSettings.expandSidebar}>
|
||||||
<Icon src={Home} solid size="20" title="Frontpage" />
|
<Icon src={Home} mini size="18" title="Frontpage" />
|
||||||
<span class:hidden={!$userSettings.expandSidebar}>Frontpage</span>
|
<span class:hidden={!$userSettings.expandSidebar}>Frontpage</span>
|
||||||
</SidebarButton>
|
</SidebarButton>
|
||||||
<SidebarButton href="/settings" expanded={$userSettings.expandSidebar}>
|
<SidebarButton href="/settings" expanded={$userSettings.expandSidebar}>
|
||||||
<Icon src={Cog6Tooth} solid size="20" title="Settings" />
|
<Icon src={Cog6Tooth} mini size="18" title="Settings" />
|
||||||
<span class:hidden={!$userSettings.expandSidebar}>Settings</span>
|
<span class:hidden={!$userSettings.expandSidebar}>Settings</span>
|
||||||
</SidebarButton>
|
</SidebarButton>
|
||||||
{#if $profileData.profiles.length >= 1}
|
{#if $profileData.profiles.length >= 1}
|
||||||
@@ -64,7 +57,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
<SidebarButton href="/accounts" expanded={$userSettings.expandSidebar}>
|
<SidebarButton href="/accounts" expanded={$userSettings.expandSidebar}>
|
||||||
<Icon src={UserGroup} mini size="20" />
|
<Icon src={UserGroup} mini size="18" />
|
||||||
<span class:hidden={!$userSettings.expandSidebar}>Accounts</span>
|
<span class:hidden={!$userSettings.expandSidebar}>Accounts</span>
|
||||||
</SidebarButton>
|
</SidebarButton>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -82,17 +75,15 @@
|
|||||||
expanded={$userSettings.expandSidebar}
|
expanded={$userSettings.expandSidebar}
|
||||||
items={$profile.user.follows.map((i) => i.community)}
|
items={$profile.user.follows.map((i) => i.community)}
|
||||||
/>
|
/>
|
||||||
{#if $profile.user.follows.length == 0}
|
<Button
|
||||||
<Button
|
class="hover:bg-slate-200 {$userSettings.expandSidebar ? '' : '!p-1.5'}"
|
||||||
class="hover:bg-slate-200 {$userSettings.expandSidebar ? '' : '!p-1.5'}"
|
href="/communities"
|
||||||
href="/communities"
|
color="tertiary"
|
||||||
color="tertiary"
|
alignment="left"
|
||||||
alignment="left"
|
>
|
||||||
>
|
<Icon mini src={GlobeAlt} size="18" />
|
||||||
<Icon src={GlobeAlt} size="20" />
|
<span class:hidden={!$userSettings.expandSidebar}>Communities</span>
|
||||||
<span class:hidden={!$userSettings.expandSidebar}>Communities</span>
|
</Button>
|
||||||
</Button>
|
|
||||||
{/if}
|
|
||||||
{:else}
|
{:else}
|
||||||
<Button
|
<Button
|
||||||
class="hover:bg-slate-200 {$userSettings.expandSidebar ? '' : '!p-1.5'}"
|
class="hover:bg-slate-200 {$userSettings.expandSidebar ? '' : '!p-1.5'}"
|
||||||
@@ -100,7 +91,7 @@
|
|||||||
color="tertiary"
|
color="tertiary"
|
||||||
alignment="left"
|
alignment="left"
|
||||||
>
|
>
|
||||||
<Icon src={ArrowLeftOnRectangle} solid size="20" />
|
<Icon mini src={ArrowLeftOnRectangle} size="18" />
|
||||||
<span class:hidden={!$userSettings.expandSidebar}>Log in</span>
|
<span class:hidden={!$userSettings.expandSidebar}>Log in</span>
|
||||||
</Button>
|
</Button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Reference in new issue
Block a user