fix: fix guest instance not working

This commit is contained in:
Xyphyn committed 2023-08-03 10:40:12 -07:00
1 parent 7e7197a676
commit 4fb4d2b7b8
6 files changed
+78 -57

No files matched your search

@@ -10,6 +10,7 @@
viewBox="0 0 20 22"
fill="none"
xmlns="http://www.w3.org/2000/svg"
class="inline"
>
<path
d="M10.516 1.17C10.3767 1.03791 10.192 0.964283 10 0.964283C9.80801 0.964283 9.62333 1.03791 9.484 1.17C7.36127 3.18588 4.53412 4.29133 1.607 4.25C1.44753 4.24793 1.29156 4.29674 1.16172 4.38935C1.03189 4.48196 0.934957 4.61355 0.885 4.765C0.462973 6.05116 0.248618 7.39637 0.25 8.75C0.25 14.692 4.314 19.683 9.813 21.098C9.93566 21.1296 10.0643 21.1296 10.187 21.098C15.686 19.683 19.75 14.692 19.75 8.75C19.75 7.36 19.527 6.02 19.115 4.765C19.0652 4.61336 18.9684 4.48156 18.8385 4.38875C18.7087 4.29595 18.5526 4.247 18.393 4.249L18.25 4.25C15.254 4.25 12.533 3.08 10.516 1.17Z"
@@ -23,6 +24,7 @@
viewBox="0 0 20 22"
fill="none"
xmlns="http://www.w3.org/2000/svg"
class="inline"
>
<path
fill-rule="evenodd"
@@ -0,0 +1,28 @@
<script lang="ts">
import Button from '$lib/components/input/Button.svelte'
import Avatar from '$lib/components/ui/Avatar.svelte'
import type { Community } from 'lemmy-js-client'
export let items: Community[]
export let expanded: boolean
</script>
{#each items.sort((a, b) => a.title.localeCompare(b.title)) as follow}
<Button
class="hover:bg-slate-200 {expanded ? '' : '!p-1.5'}"
color="tertiary"
alignment="left"
href="/c/{follow.name}@{new URL(follow.actor_id).hostname}"
>
<Avatar
url={follow.icon}
alt={follow.name}
title={follow.title}
width={20}
slot="icon"
/>
<span class:hidden={!expanded}>
{follow.title}
</span>
</Button>
{/each}
@@ -8,12 +8,14 @@
Plus,
UserCircle,
} 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, setUserID } from '$lib/auth.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 CommunityList from '$lib/components/ui/sidebar/CommunityList.svelte'
let expanded = true
</script>
@@ -37,36 +39,24 @@
title="Toggle expanded"
/>
</Button>
<Button
class="hover:bg-slate-200 {expanded ? '' : '!p-1.5'}"
href="/"
color="tertiary"
alignment="left"
>
<SidebarButton href="/" {expanded}>
<Icon src={Home} solid size="20" title="Frontpage" />
<span class:hidden={!expanded}>Frontpage</span>
</Button>
<Button
class="hover:bg-slate-200 {expanded ? '' : '!p-1.5'}"
href="/settings"
color="tertiary"
alignment="left"
>
</SidebarButton>
<SidebarButton href="/settings" {expanded}>
<Icon src={Cog6Tooth} solid size="20" title="Settings" />
<span class:hidden={!expanded}>Settings</span>
</Button>
</SidebarButton>
{#if $profileData.profiles.length >= 1}
<hr class="border-slate-300 dark:border-zinc-800 my-1" />
{#each $profileData.profiles as prof, index}
<Button
class="hover:bg-slate-200 {expanded ? '' : '!p-1.5'} {$profile?.id ==
prof.id
<SidebarButton
class={$profile?.id == prof.id
? expanded
? 'font-bold'
: 'text-sky-500'
: ''}"
color="tertiary"
alignment="left"
: ''}
{expanded}
on:click={() => {
setUserID(prof.id)
goto($page.url, {
@@ -88,30 +78,23 @@
{prof.instance}
</span>
</span>
</Button>
</SidebarButton>
{/each}
{/if}
<hr class="border-slate-300 dark:border-zinc-800 my-1" />
{#if $profile?.user}
{#each $profile.user.follows
.map((f) => f.community)
.sort((a, b) => a.title.localeCompare(b.title)) as follow}
<Button
class="hover:bg-slate-200 {expanded ? '' : '!p-1.5'}"
color="tertiary"
alignment="left"
href="/c/{follow.name}@{new URL(follow.actor_id).hostname}"
>
<Avatar
url={follow.icon}
alt={follow.name}
title={follow.title}
width={20}
slot="icon"
/>
<span class:hidden={!expanded}>{follow.title}</span>
</Button>
{/each}
{#if $profile?.user.moderates.length > 0}
<CommunityList
{expanded}
items={$profile.user.moderates.map((i) => i.community)}
/>
<hr class="border-slate-300 dark:border-zinc-800 my-1" />
{/if}
<CommunityList
{expanded}
items={$profile.user.follows.map((i) => i.community)}
/>
{#if $profile.user.follows.length == 0}
<Button
class="hover:bg-slate-200 {expanded ? '' : '!p-1.5'}"
@@ -0,0 +1,14 @@
<script lang="ts">
import Button from '$lib/components/input/Button.svelte'
export let expanded: boolean
</script>
<Button
class="hover:bg-slate-200 {expanded ? '' : '!p-1.5'}"
color="tertiary"
alignment="left"
{...$$restProps}
>
<slot />
</Button>