design: redesign user page
This commit is contained in:
1 parent
573842fa4b
commit
cb21ab02c5
3 files changed
+83
-84
No files matched your search
@@ -20,12 +20,12 @@
|
|||||||
|
|
||||||
<div
|
<div
|
||||||
style={$$props.style ?? ''}
|
style={$$props.style ?? ''}
|
||||||
class={!expanded
|
class="{!expanded
|
||||||
? `text-sm overflow-hidden
|
? `text-sm overflow-hidden
|
||||||
bg-gradient-to-b text-transparent from-slate-600 via-slate-600
|
bg-gradient-to-b text-transparent from-slate-600 via-slate-600
|
||||||
dark:from-zinc-400 dark:via-zinc-400 bg-clip-text z-0
|
dark:from-zinc-400 dark:via-zinc-400 bg-clip-text z-0
|
||||||
${view == 'list' ? `max-h-24` : 'max-h-48'}`
|
${view == 'list' ? `max-h-24` : 'max-h-48'}`
|
||||||
: 'text-slate-600 dark:text-zinc-400 max-h-full'}
|
: 'text-slate-600 dark:text-zinc-400 max-h-full'} {$$props.class ?? ''}"
|
||||||
use:isOverflown
|
use:isOverflown
|
||||||
>
|
>
|
||||||
<Markdown inline={!expanded} source={body} />
|
<Markdown inline={!expanded} source={body} />
|
||||||
|
|||||||
@@ -16,18 +16,22 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<a
|
<a
|
||||||
class="items-center inline-flex flex-row gap-1 hover:underline"
|
class="items-center inline-flex flex-row gap-1 hover:underline {$$props.class ??
|
||||||
|
''}"
|
||||||
href="/u/{user.name}@{new URL(user.actor_id).hostname}"
|
href="/u/{user.name}@{new URL(user.actor_id).hostname}"
|
||||||
>
|
>
|
||||||
{#if avatar}
|
{#if avatar}
|
||||||
<Avatar url={user.avatar} alt={user.name} width={avatarSize} />
|
<Avatar url={user.avatar} alt={user.name} width={avatarSize} />
|
||||||
{/if}
|
{/if}
|
||||||
<span class="flex flex-wrap gap-0" class:ml-0.5={avatar}>
|
<span class="flex flex-wrap gap-0 items-center" class:ml-0.5={avatar}>
|
||||||
<span class:font-medium={showInstance}>
|
<span class:font-medium={showInstance}>
|
||||||
{$userSettings.displayNames ? (user.display_name || user.name) : user.name}
|
{$userSettings.displayNames ? user.display_name || user.name : user.name}
|
||||||
</span>
|
</span>
|
||||||
{#if showInstance}
|
{#if showInstance}
|
||||||
<span class="text-slate-500 dark:text-zinc-500 font-normal">
|
<span
|
||||||
|
class="text-slate-500 dark:text-zinc-500 font-normal {$$props.instanceClass ??
|
||||||
|
''}"
|
||||||
|
>
|
||||||
@{new URL(user.actor_id).hostname}
|
@{new URL(user.actor_id).hostname}
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||||
import {
|
import {
|
||||||
AdjustmentsHorizontal,
|
AdjustmentsHorizontal,
|
||||||
|
AtSymbol,
|
||||||
Bars3BottomRight,
|
Bars3BottomRight,
|
||||||
Calendar,
|
Calendar,
|
||||||
ChartBar,
|
ChartBar,
|
||||||
@@ -38,6 +39,8 @@
|
|||||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||||
import { publishedToDate } from '$lib/components/util/date.js'
|
import { publishedToDate } from '$lib/components/util/date.js'
|
||||||
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 PostBody from '$lib/components/lemmy/post/PostBody.svelte'
|
||||||
|
|
||||||
export let data
|
export let data
|
||||||
|
|
||||||
@@ -205,29 +208,37 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<StickyCard class="px-0 !static">
|
<div class="flex flex-col gap-4">
|
||||||
<Avatar
|
<Avatar
|
||||||
width={64}
|
width={64}
|
||||||
url={data.person_view.person.avatar}
|
url={data.person_view.person.avatar}
|
||||||
alt={data.person_view.person.name}
|
alt={data.person_view.person.name}
|
||||||
/>
|
/>
|
||||||
<span class="flex flex-row items-center gap-1 text-sm">
|
<UserLink
|
||||||
<Icon src={Calendar} width={16} height={16} mini />
|
badges
|
||||||
<span class="capitalize">
|
user={data.person_view.person}
|
||||||
<RelativeDate
|
showInstance
|
||||||
date={publishedToDate(data.person_view.person.published)}
|
class="text-base"
|
||||||
/>
|
instanceClass="text-sm"
|
||||||
</span>
|
/>
|
||||||
</span>
|
{#if data.person_view.person.bio}
|
||||||
|
<PostBody
|
||||||
|
class="text-sm"
|
||||||
|
view="list"
|
||||||
|
body={data.person_view.person.bio}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
<div class="text-sm flex flex-row flex-wrap gap-3">
|
<div class="text-sm flex flex-row flex-wrap gap-3">
|
||||||
<span class="flex flex-row items-center gap-1">
|
<LabelStat
|
||||||
<Icon src={PencilSquare} width={16} height={16} mini />
|
content={data.person_view.counts.post_count.toString()}
|
||||||
<FormattedNumber number={data.person_view.counts.post_count} />
|
formatted
|
||||||
</span>
|
label="Posts"
|
||||||
<span class="flex flex-row items-center gap-1">
|
/>
|
||||||
<Icon src={ChatBubbleOvalLeftEllipsis} width={16} height={16} mini />
|
<LabelStat
|
||||||
<FormattedNumber number={data.person_view.counts.comment_count} />
|
content={data.person_view.counts.comment_count.toString()}
|
||||||
</span>
|
formatted
|
||||||
|
label="Comments"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
{#if (data.moderates ?? []).length > 0}
|
{#if (data.moderates ?? []).length > 0}
|
||||||
<div class="flex flex-col gap-2 max-w-full">
|
<div class="flex flex-col gap-2 max-w-full">
|
||||||
@@ -258,78 +269,62 @@
|
|||||||
</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 flex-col gap-2">
|
<div class="flex items-center gap-2 w-full">
|
||||||
<div class="flex items-center gap-2 w-full">
|
<Button
|
||||||
|
size="square-md"
|
||||||
|
color="secondary"
|
||||||
|
on:click={() => (messaging = true)}
|
||||||
|
title="Message"
|
||||||
|
>
|
||||||
|
<Icon slot="prefix" solid size="16" src={Envelope} />
|
||||||
|
</Button>
|
||||||
|
{#if data.person_view.person.matrix_user_id}
|
||||||
<Button
|
<Button
|
||||||
size="lg"
|
size="square-md"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
on:click={() => (messaging = true)}
|
href="https://matrix.to/#/{data.person_view.person.matrix_user_id}"
|
||||||
class="flex-1"
|
title="Matrix User"
|
||||||
>
|
>
|
||||||
<Icon slot="prefix" solid size="16" src={Envelope} />
|
<Icon slot="prefix" solid size="16" src={AtSymbol} />
|
||||||
Message
|
|
||||||
</Button>
|
</Button>
|
||||||
{#if data.person_view.person.matrix_user_id}
|
{/if}
|
||||||
<Button
|
{#if isAdmin($profile?.user)}
|
||||||
size="lg"
|
<Menu class="ml-auto" placement="bottom-start">
|
||||||
color="secondary"
|
|
||||||
href="https://matrix.to/#/{data.person_view.person
|
|
||||||
.matrix_user_id}"
|
|
||||||
class="flex-1"
|
|
||||||
>
|
|
||||||
<Icon slot="prefix" solid size="16" src={ShieldCheck} />
|
|
||||||
Matrix User
|
|
||||||
</Button>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-row gap-2 ml-auto">
|
|
||||||
{#if isAdmin($profile?.user)}
|
|
||||||
<Menu class="ml-auto" placement="bottom-end">
|
|
||||||
<Button size="square-md" slot="target">
|
|
||||||
<ShieldIcon width={16} filled />
|
|
||||||
</Button>
|
|
||||||
<MenuButton
|
|
||||||
color="danger-subtle"
|
|
||||||
on:click={() =>
|
|
||||||
ban(data.person_view.person.banned, data.person_view.person)}
|
|
||||||
>
|
|
||||||
<Icon slot="prefix" mini size="16" src={ShieldExclamation} />
|
|
||||||
{data.person_view.person.banned ? 'Unban' : 'Ban'}
|
|
||||||
</MenuButton>
|
|
||||||
<MenuButton
|
|
||||||
color="danger-subtle"
|
|
||||||
on:click={() => (purgingUser = !purgingUser)}
|
|
||||||
>
|
|
||||||
<Icon slot="prefix" mini size="16" src={Fire} />
|
|
||||||
Purge
|
|
||||||
</MenuButton>
|
|
||||||
</Menu>
|
|
||||||
{/if}
|
|
||||||
<Menu placement="bottom-end">
|
|
||||||
<Button size="square-md" slot="target">
|
<Button size="square-md" slot="target">
|
||||||
<Icon src={EllipsisHorizontal} slot="prefix" size="16" mini />
|
<ShieldIcon width={16} filled />
|
||||||
</Button>
|
</Button>
|
||||||
<MenuButton
|
<MenuButton
|
||||||
color="danger-subtle"
|
color="danger-subtle"
|
||||||
on:click={() => blockUser(data.person_view.person.id)}
|
on:click={() =>
|
||||||
|
ban(data.person_view.person.banned, data.person_view.person)}
|
||||||
>
|
>
|
||||||
<Icon slot="prefix" mini size="16" src={NoSymbol} />
|
<Icon slot="prefix" mini size="16" src={ShieldExclamation} />
|
||||||
{isBlocked($profile.user, data.person_view.person.id)
|
{data.person_view.person.banned ? 'Unban' : 'Ban'}
|
||||||
? 'Unblock'
|
</MenuButton>
|
||||||
: 'Block'}
|
<MenuButton
|
||||||
|
color="danger-subtle"
|
||||||
|
on:click={() => (purgingUser = !purgingUser)}
|
||||||
|
>
|
||||||
|
<Icon slot="prefix" mini size="16" src={Fire} />
|
||||||
|
Purge
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
</Menu>
|
</Menu>
|
||||||
</div>
|
{/if}
|
||||||
|
<Menu placement="bottom-start">
|
||||||
|
<Button size="square-md" slot="target">
|
||||||
|
<Icon src={EllipsisHorizontal} slot="prefix" size="16" mini />
|
||||||
|
</Button>
|
||||||
|
<MenuButton
|
||||||
|
color="danger-subtle"
|
||||||
|
on:click={() => blockUser(data.person_view.person.id)}
|
||||||
|
>
|
||||||
|
<Icon slot="prefix" mini size="16" src={NoSymbol} />
|
||||||
|
{isBlocked($profile.user, data.person_view.person.id)
|
||||||
|
? 'Unblock'
|
||||||
|
: 'Block'}
|
||||||
|
</MenuButton>
|
||||||
|
</Menu>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div>
|
</div>
|
||||||
<h1 class="font-bold text-lg">
|
|
||||||
<UserLink badges user={data.person_view.person} />
|
|
||||||
</h1>
|
|
||||||
<span>{new URL(data.person_view.person.actor_id).hostname}</span>
|
|
||||||
</div>
|
|
||||||
{#if data.person_view.person.bio}
|
|
||||||
<Markdown source={data.person_view.person.bio} />
|
|
||||||
{/if}
|
|
||||||
</StickyCard>
|
|
||||||
</div>
|
</div>
|
||||||
Reference in new issue
Block a user