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