misc: move to EntityHeader
This commit is contained in:
1 parent
cc0a7e2869
commit
32b0253ca2
2 files changed
+84
-51
No files matched your search
@@ -0,0 +1,61 @@
|
||||
<script lang="ts">
|
||||
import { Material } from 'mono-svelte'
|
||||
import Avatar from './Avatar.svelte'
|
||||
import PostBody from '../lemmy/post/PostBody.svelte'
|
||||
import LabelStat from './LabelStat.svelte'
|
||||
|
||||
export let avatar: string | undefined = undefined
|
||||
export let name: string
|
||||
export let bio: string | undefined = undefined
|
||||
export let banner: string | undefined = undefined
|
||||
export let stats: {
|
||||
name: string
|
||||
value: string
|
||||
}[] = []
|
||||
</script>
|
||||
|
||||
<Material class="flex flex-col gap-4" color="transparent" padding="none">
|
||||
{#if banner}
|
||||
<div class="max-h-32 overflow-visible">
|
||||
<img
|
||||
src={banner}
|
||||
class="w-full object-cover h-max max-h-48 rounded-lg rounded-b-none"
|
||||
height="192"
|
||||
alt="User banner"
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="p-4 flex flex-row gap-3">
|
||||
<div class="gap-3 flex flex-col flex-1">
|
||||
<Avatar
|
||||
width={64}
|
||||
url={avatar}
|
||||
alt={name}
|
||||
class="ring-4 ring-slate-25 dark:ring-zinc-925"
|
||||
/>
|
||||
<div class="space-y-1">
|
||||
<span class="text-lg font-semibold">
|
||||
{name}
|
||||
</span>
|
||||
<span
|
||||
class="flex items-center gap-0 text-sm text-slate-600 dark:text-zinc-400"
|
||||
>
|
||||
<slot name="nameDetail" />
|
||||
</span>
|
||||
</div>
|
||||
<div class="relative">
|
||||
{#if bio}
|
||||
<PostBody class="text-sm" view="list" body={bio} clickThrough />
|
||||
{/if}
|
||||
</div>
|
||||
{#if stats.length > 0}
|
||||
<div class="text-sm flex flex-row flex-wrap gap-3">
|
||||
{#each stats as stat}
|
||||
<LabelStat content={stat.value} formatted label={stat.name} />
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
<slot />
|
||||
</div>
|
||||
</div>
|
||||
</Material>
|
||||
@@ -51,7 +51,8 @@
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
import { communityLink } from '$lib/lemmy/generic.js'
|
||||
import ItemList from '$lib/components/lemmy/generic/ItemList.svelte'
|
||||
import { t } from '$lib/translations.js'
|
||||
import { locale, t } from '$lib/translations.js'
|
||||
import EntityHeader from '$lib/components/ui/EntityHeader.svelte'
|
||||
|
||||
export let data
|
||||
|
||||
@@ -160,61 +161,34 @@
|
||||
{/if}
|
||||
|
||||
<div class="flex flex-col gap-4 max-w-full w-full">
|
||||
<Material class="flex flex-col gap-4" color="transparent" padding="none">
|
||||
{#if data.person_view.person.banner}
|
||||
<div class="max-h-32 overflow-visible">
|
||||
<img
|
||||
src={data.person_view.person.banner}
|
||||
class="w-full object-cover h-max max-h-48 rounded-lg"
|
||||
height="192"
|
||||
alt="User banner"
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="p-4 flex flex-col gap-3">
|
||||
<Avatar
|
||||
width={64}
|
||||
url={data.person_view.person.avatar}
|
||||
alt={data.person_view.person.name}
|
||||
class="ring-4 ring-slate-25 dark:ring-zinc-925"
|
||||
/>
|
||||
<div class="space-y-1">
|
||||
<span class="text-lg font-semibold">
|
||||
{data.person_view.person.display_name || data.person_view.person.name}
|
||||
</span>
|
||||
<EntityHeader
|
||||
avatar={data.person_view.person.avatar}
|
||||
name={data.person_view.person.display_name || data.person_view.person.name}
|
||||
banner={data.person_view.person.banner}
|
||||
bio={data.person_view.person.bio}
|
||||
stats={[
|
||||
{
|
||||
name: $t('content.posts'),
|
||||
value: data.person_view.counts.post_count.toString(),
|
||||
},
|
||||
{
|
||||
name: $t('content.comments'),
|
||||
value: data.person_view.counts.comment_count.toString(),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<span
|
||||
class="flex items-center gap-0 text-sm text-slate-600 dark:text-zinc-400"
|
||||
class="text-sm text-slate-600 dark:text-zinc-400 flex gap-0 items-center"
|
||||
slot="nameDetail"
|
||||
>
|
||||
@
|
||||
<UserLink
|
||||
showInstance
|
||||
user={data.person_view.person}
|
||||
displayName={false}
|
||||
class="font-normal"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
<div class="relative">
|
||||
{#if data.person_view.person.bio}
|
||||
<PostBody
|
||||
class="text-sm"
|
||||
view="list"
|
||||
body={data.person_view.person.bio}
|
||||
clickThrough
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="text-sm flex flex-row flex-wrap gap-3">
|
||||
<LabelStat
|
||||
content={data.person_view.counts.post_count.toString()}
|
||||
formatted
|
||||
label={$t('content.posts')}
|
||||
/>
|
||||
<LabelStat
|
||||
content={data.person_view.counts.comment_count.toString()}
|
||||
formatted
|
||||
label={$t('content.comments')}
|
||||
/>
|
||||
</div>
|
||||
{#if (data.moderates ?? []).length > 0}
|
||||
<Expandable
|
||||
class="border-y w-full py-3
|
||||
@@ -249,8 +223,7 @@
|
||||
<Button
|
||||
size="square-md"
|
||||
color="secondary"
|
||||
href="https://matrix.to/#/{data.person_view.person
|
||||
.matrix_user_id}"
|
||||
href="https://matrix.to/#/{data.person_view.person.matrix_user_id}"
|
||||
title="Matrix User"
|
||||
>
|
||||
<Icon slot="prefix" solid size="16" src={AtSymbol} />
|
||||
@@ -294,8 +267,7 @@
|
||||
</Menu>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</Material>
|
||||
</EntityHeader>
|
||||
|
||||
<div class="flex flex-col gap-4 max-w-full w-full min-w-0">
|
||||
<div class="flex flex-row gap-4 flex-wrap">
|
||||
|
||||
Reference in new issue
Block a user