feat: explicit guest button

This commit is contained in:
Xyphyn committed 2023-10-13 14:08:07 -07:00
1 parent 4af32dc3f0
commit e35f6887e3
4 files changed
+26 -9

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "photon-lemmy",
"version": "1.19.3",
"version": "1.20.0",
"private": true,
"scripts": {
"dev": "vite dev",
@@ -10,6 +10,7 @@
export let index: number
let switching: boolean = false
export let guest: boolean = false
</script>
<SidebarButton
@@ -39,6 +40,7 @@
<ProfileAvatar
profile={prof}
{index}
{guest}
selected={$profile?.id == prof.id}
slot="prefix"
/>
@@ -47,8 +49,10 @@
slot="label"
>
{prof.username ?? prof.user?.local_user_view.person.name}
<span class="text-slate-500 dark:text-zinc-400 font-normal text-xs">
{prof.instance}
</span>
{#if !guest}
<span class="text-slate-500 dark:text-zinc-400 font-normal text-xs">
{prof.instance}
</span>
{/if}
</span>
</SidebarButton>
+14 -4
View File
@@ -18,6 +18,7 @@
import { flip } from 'svelte/animate'
import { expoOut } from 'svelte/easing'
import { Button } from 'mono-svelte'
import { DEFAULT_INSTANCE_URL } from '$lib/instance.js'
export let route = ''
</script>
@@ -53,22 +54,31 @@
<span slot="label">Communities</span>
</SidebarButton>
{#if $profileData.profiles.length >= 1}
<hr class="border-slate-300 dark:border-zinc-800 my-1" />
{#each $profileData.profiles as prof, index (prof.id)}
<hr class="border-slate-200 dark:border-zinc-800 my-1" />
{#each [...$profileData.profiles] as prof, index (prof.id)}
<div animate:flip={{ duration: 300, easing: expoOut }} class="w-full">
<ProfileButton {index} {prof} />
</div>
{/each}
<ProfileButton
index={0}
prof={{
id: -1,
instance: $profileData?.defaultInstance ?? DEFAULT_INSTANCE_URL,
username: 'Guest',
}}
guest
/>
<SidebarButton href="/accounts">
<Icon src={UserGroup} mini size="20" />
<span slot="label">Accounts</span>
</SidebarButton>
{/if}
<hr class="border-slate-300 dark:border-zinc-800 my-1" />
<hr class="border-slate-200 dark:border-zinc-800 my-1" />
{#if $profile?.user}
{#if $profile?.user.moderates.length > 0}
<CommunityList items={$profile.user.moderates.map((i) => i.community)} />
<hr class="border-slate-300 dark:border-zinc-800 my-1" />
<hr class="border-slate-200 dark:border-zinc-800 my-1" />
{/if}
<CommunityList items={$profile.user.follows.map((i) => i.community)} />
+4 -1
View File
@@ -6,6 +6,7 @@
export let selected: boolean = false
export let index: number = 0
export let size: number = 20
export let guest: boolean = false
</script>
{#if profile}
@@ -26,7 +27,9 @@
size={`${size}`}
title={profile.username}
class="text-blue-500 flex-shrink-0"
style={profile.color
style={guest
? `color: gray`
: profile.color
? `color: ${profile.color}`
: `filter: hue-rotate(${index * 50}deg)`}
/>