misc: EntityHeader actions
This commit is contained in:
1 parent
32b0253ca2
commit
008f224055
2 files changed
+65
-54
No files matched your search
@@ -14,26 +14,27 @@
|
||||
}[] = []
|
||||
</script>
|
||||
|
||||
<Material class="flex flex-col gap-4" color="transparent" padding="none">
|
||||
<Material color="transparent" padding="none" rounding="xl">
|
||||
{#if banner}
|
||||
<div class="max-h-32 overflow-visible">
|
||||
<div class="max-h-36 overflow-visible">
|
||||
<img
|
||||
src={banner}
|
||||
class="w-full object-cover h-max max-h-48 rounded-lg rounded-b-none"
|
||||
class="w-full object-cover h-48 rounded-xl 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">
|
||||
<div class="p-4 flex flex-row gap-4">
|
||||
<div class="space-y-3 flex-1">
|
||||
<Avatar
|
||||
width={64}
|
||||
url={avatar}
|
||||
alt={name}
|
||||
class="ring-4 ring-slate-25 dark:ring-zinc-925"
|
||||
circle={false}
|
||||
class="ring-4 rounded-3xl ring-slate-25 dark:ring-zinc-925"
|
||||
/>
|
||||
<div class="space-y-1">
|
||||
<div>
|
||||
<span class="text-lg font-semibold">
|
||||
{name}
|
||||
</span>
|
||||
@@ -55,7 +56,14 @@
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
<slot />
|
||||
</div>
|
||||
{#if $$slots.actions}
|
||||
<div class="space-y-3 flex flex-col" class:pt-12={banner != undefined}>
|
||||
<slot name="actions" />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="space-y-3 p-4 pt-0">
|
||||
<slot />
|
||||
</div>
|
||||
</Material>
|
||||
@@ -209,64 +209,67 @@
|
||||
/>
|
||||
</Expandable>
|
||||
{/if}
|
||||
{#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">
|
||||
<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}
|
||||
<svelte:fragment slot="actions">
|
||||
{#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">
|
||||
<Button
|
||||
size="square-md"
|
||||
color="secondary"
|
||||
href="https://matrix.to/#/{data.person_view.person.matrix_user_id}"
|
||||
title="Matrix User"
|
||||
on:click={() => (messaging = true)}
|
||||
title="Message"
|
||||
>
|
||||
<Icon slot="prefix" solid size="16" src={AtSymbol} />
|
||||
<Icon slot="prefix" solid size="16" src={Envelope} />
|
||||
</Button>
|
||||
{/if}
|
||||
{#if isAdmin($profile?.user)}
|
||||
<Menu class="ml-auto" placement="bottom-start">
|
||||
{#if data.person_view.person.matrix_user_id}
|
||||
<Button
|
||||
size="square-md"
|
||||
color="secondary"
|
||||
href="https://matrix.to/#/{data.person_view.person
|
||||
.matrix_user_id}"
|
||||
title="Matrix User"
|
||||
>
|
||||
<Icon slot="prefix" solid size="16" src={AtSymbol} />
|
||||
</Button>
|
||||
{/if}
|
||||
{#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">
|
||||
<ShieldIcon width={16} filled />
|
||||
<Icon src={EllipsisHorizontal} slot="prefix" size="16" mini />
|
||||
</Button>
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
on:click={() =>
|
||||
ban(data.person_view.person.banned, data.person_view.person)}
|
||||
on:click={() => blockUser(data.person_view.person.id)}
|
||||
>
|
||||
<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
|
||||
<Icon slot="prefix" mini size="16" src={NoSymbol} />
|
||||
{isBlocked($profile.user, data.person_view.person.id)
|
||||
? 'Unblock'
|
||||
: 'Block'}
|
||||
</MenuButton>
|
||||
</Menu>
|
||||
{/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>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
</EntityHeader>
|
||||
|
||||
<div class="flex flex-col gap-4 max-w-full w-full min-w-0">
|
||||
|
||||
Reference in new issue
Block a user