design: change weird profile overlap to a list
This commit is contained in:
1 parent
6c6a3e3e72
commit
1834b90375
5 files changed
+85
-46
No files matched your search
@@ -22,6 +22,8 @@
|
|||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import Expandable from '../ui/Expandable.svelte'
|
import Expandable from '../ui/Expandable.svelte'
|
||||||
import LabelStat from '../ui/LabelStat.svelte'
|
import LabelStat from '../ui/LabelStat.svelte'
|
||||||
|
import ItemList from './generic/ItemList.svelte'
|
||||||
|
import { userLink } from '$lib/lemmy/generic'
|
||||||
|
|
||||||
export let site: SiteView
|
export let site: SiteView
|
||||||
export let taglines: Tagline[] | undefined = undefined
|
export let taglines: Tagline[] | undefined = undefined
|
||||||
@@ -111,28 +113,15 @@
|
|||||||
<svelte:fragment slot="title">
|
<svelte:fragment slot="title">
|
||||||
<Icon src={UserGroup} size="15" mini /> Admins
|
<Icon src={UserGroup} size="15" mini /> Admins
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
<div
|
<ItemList
|
||||||
class="flex items-center flex-wrap group transition-all
|
items={admins.map((a) => ({
|
||||||
cursor-pointer"
|
id: a.person.id,
|
||||||
>
|
name: a.person.name,
|
||||||
{#each admins as admin}
|
url: userLink(a.person),
|
||||||
<Popover openOnHover placement="top">
|
avatar: a.person.avatar,
|
||||||
<a
|
instance: new URL(a.person.actor_id).hostname,
|
||||||
class="block ring rounded-full ring-slate-50 dark:ring-zinc-950 transition-all -mx-0.5 group-hover:mx-0.5"
|
}))}
|
||||||
href="/u/{admin.person.name}@{new URL(admin.person.actor_id)
|
|
||||||
.hostname}"
|
|
||||||
slot="target"
|
|
||||||
>
|
|
||||||
<Avatar
|
|
||||||
width={28}
|
|
||||||
url={admin.person.avatar}
|
|
||||||
alt={admin.person.name}
|
|
||||||
/>
|
/>
|
||||||
</a>
|
|
||||||
<span class="font-bold">{admin.person.name}</span>
|
|
||||||
</Popover>
|
|
||||||
{/each}
|
|
||||||
</div>
|
|
||||||
</Expandable>
|
</Expandable>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||||
|
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
|
||||||
|
import { Button } from 'mono-svelte'
|
||||||
|
import { flip } from 'svelte/animate'
|
||||||
|
import { expoOut } from 'svelte/easing'
|
||||||
|
|
||||||
|
export let items: {
|
||||||
|
avatar?: string
|
||||||
|
name: string
|
||||||
|
instance?: string
|
||||||
|
id: number
|
||||||
|
url: string
|
||||||
|
}[]
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#each items.sort((a, b) => a.name.localeCompare(b.name)) as item (item.id)}
|
||||||
|
<div
|
||||||
|
class="inline-flex w-full"
|
||||||
|
animate:flip={{ duration: 500, easing: expoOut }}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
class="font-normal w-full h-max"
|
||||||
|
color="tertiary"
|
||||||
|
alignment="left"
|
||||||
|
href={item.url}
|
||||||
|
>
|
||||||
|
<div class="flex-none">
|
||||||
|
<Avatar
|
||||||
|
url={item.avatar}
|
||||||
|
alt={item.name}
|
||||||
|
title={item.name}
|
||||||
|
width={24}
|
||||||
|
slot="prefix"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col max-w-full break-words">
|
||||||
|
<span>{item.name}</span>
|
||||||
|
{#if item.instance}
|
||||||
|
<span class="text-xs text-slate-600 dark:text-zinc-400">
|
||||||
|
{item.instance}
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
url={follow.icon}
|
url={follow.icon}
|
||||||
alt={follow.name}
|
alt={follow.name}
|
||||||
title={follow.title}
|
title={follow.title}
|
||||||
width={20}
|
width={24}
|
||||||
slot="prefix"
|
slot="prefix"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import { fullCommunityName } from "$lib/util";
|
||||||
|
import type { Community, Person } from "lemmy-js-client";
|
||||||
|
|
||||||
|
export const communityLink = (community: Community, prefix: string = '') =>
|
||||||
|
`${prefix}/c/${fullCommunityName(community.name, community.actor_id)}`
|
||||||
|
|
||||||
|
export const userLink = (person: Person, prefix: string = '') =>
|
||||||
|
`${prefix}/c/${person.name}@${new URL(person.actor_id).hostname}`
|
||||||
@@ -41,6 +41,9 @@
|
|||||||
import PrivateMessageModal from '$lib/components/lemmy/modal/PrivateMessageModal.svelte'
|
import PrivateMessageModal from '$lib/components/lemmy/modal/PrivateMessageModal.svelte'
|
||||||
import LabelStat from '$lib/components/ui/LabelStat.svelte'
|
import LabelStat from '$lib/components/ui/LabelStat.svelte'
|
||||||
import PostBody from '$lib/components/lemmy/post/PostBody.svelte'
|
import PostBody from '$lib/components/lemmy/post/PostBody.svelte'
|
||||||
|
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||||
|
import { communityLink } from '$lib/lemmy/generic.js'
|
||||||
|
import ItemList from '$lib/components/lemmy/generic/ItemList.svelte'
|
||||||
|
|
||||||
export let data
|
export let data
|
||||||
|
|
||||||
@@ -243,32 +246,24 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{#if (data.moderates ?? []).length > 0}
|
{#if (data.moderates ?? []).length > 0}
|
||||||
<div class="flex flex-col gap-2 max-w-full">
|
<Expandable
|
||||||
<span class="font-bold">Moderates</span>
|
class="border-y w-full py-3
|
||||||
<div
|
dark:border-zinc-800 text-slate-700 dark:text-zinc-300 transition-colors"
|
||||||
class="flex items-center -space-x-1 flex-wrap hover:space-x-1 transition-all
|
|
||||||
cursor-pointer"
|
|
||||||
>
|
>
|
||||||
{#each data.moderates as moderator}
|
<span slot="title" class="flex items-center gap-1">
|
||||||
<Popover openOnHover placement="top" class="transition-all">
|
<ShieldIcon width={14} filled />
|
||||||
<a
|
Moderates
|
||||||
class="block ring rounded-full ring-slate-50 dark:ring-zinc-950 transition-all"
|
</span>
|
||||||
href="/c/{moderator.community.name}@{new URL(
|
<ItemList
|
||||||
moderator.community.actor_id
|
items={data.moderates.map((m) => ({
|
||||||
).hostname}"
|
id: m.community.id,
|
||||||
slot="target"
|
name: m.community.title,
|
||||||
>
|
url: communityLink(m.community),
|
||||||
<Avatar
|
avatar: m.community.icon,
|
||||||
width={28}
|
instance: new URL(m.community.actor_id).hostname,
|
||||||
url={moderator.community.icon}
|
}))}
|
||||||
alt={moderator.community.title}
|
|
||||||
/>
|
/>
|
||||||
</a>
|
</Expandable>
|
||||||
<span class="font-bold">{moderator.community.title}</span>
|
|
||||||
</Popover>
|
|
||||||
{/each}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
{#if $profile?.user && $profile.jwt && data.person_view.person.id != $profile.user.local_user_view.person.id}
|
{#if $profile?.user && $profile.jwt && data.person_view.person.id != $profile.user.local_user_view.person.id}
|
||||||
<div class="flex items-center gap-2 w-full">
|
<div class="flex items-center gap-2 w-full">
|
||||||
|
|||||||
Reference in new issue
Block a user