fix: fix guest instance not working
This commit is contained in:
1 parent
7e7197a676
commit
4fb4d2b7b8
6 files changed
+78
-57
No files matched your search
@@ -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}
|
||||
+24
-41
@@ -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>
|
||||
Reference in new issue
Block a user