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>
|
</script>
|
||||||
|
|
||||||
<Material class="flex flex-col gap-4" color="transparent" padding="none">
|
<Material color="transparent" padding="none" rounding="xl">
|
||||||
{#if banner}
|
{#if banner}
|
||||||
<div class="max-h-32 overflow-visible">
|
<div class="max-h-36 overflow-visible">
|
||||||
<img
|
<img
|
||||||
src={banner}
|
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"
|
height="192"
|
||||||
alt="User banner"
|
alt="User banner"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="p-4 flex flex-row gap-3">
|
<div class="p-4 flex flex-row gap-4">
|
||||||
<div class="gap-3 flex flex-col flex-1">
|
<div class="space-y-3 flex-1">
|
||||||
<Avatar
|
<Avatar
|
||||||
width={64}
|
width={64}
|
||||||
url={avatar}
|
url={avatar}
|
||||||
alt={name}
|
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">
|
<span class="text-lg font-semibold">
|
||||||
{name}
|
{name}
|
||||||
</span>
|
</span>
|
||||||
@@ -55,7 +56,14 @@
|
|||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<slot />
|
|
||||||
</div>
|
</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>
|
</div>
|
||||||
</Material>
|
</Material>
|
||||||
@@ -209,64 +209,67 @@
|
|||||||
/>
|
/>
|
||||||
</Expandable>
|
</Expandable>
|
||||||
{/if}
|
{/if}
|
||||||
{#if $profile?.user && $profile.jwt && data.person_view.person.id != $profile.user.local_user_view.person.id}
|
<svelte:fragment slot="actions">
|
||||||
<div class="flex items-center gap-2 w-full">
|
{#if $profile?.user && $profile.jwt && data.person_view.person.id != $profile.user.local_user_view.person.id}
|
||||||
<Button
|
<div class="flex items-center gap-2 w-full">
|
||||||
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="square-md"
|
size="square-md"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
href="https://matrix.to/#/{data.person_view.person.matrix_user_id}"
|
on:click={() => (messaging = true)}
|
||||||
title="Matrix User"
|
title="Message"
|
||||||
>
|
>
|
||||||
<Icon slot="prefix" solid size="16" src={AtSymbol} />
|
<Icon slot="prefix" solid size="16" src={Envelope} />
|
||||||
</Button>
|
</Button>
|
||||||
{/if}
|
{#if data.person_view.person.matrix_user_id}
|
||||||
{#if isAdmin($profile?.user)}
|
<Button
|
||||||
<Menu class="ml-auto" placement="bottom-start">
|
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">
|
<Button size="square-md" slot="target">
|
||||||
<ShieldIcon width={16} filled />
|
<Icon src={EllipsisHorizontal} slot="prefix" size="16" mini />
|
||||||
</Button>
|
</Button>
|
||||||
<MenuButton
|
<MenuButton
|
||||||
color="danger-subtle"
|
color="danger-subtle"
|
||||||
on:click={() =>
|
on:click={() => blockUser(data.person_view.person.id)}
|
||||||
ban(data.person_view.person.banned, data.person_view.person)}
|
|
||||||
>
|
>
|
||||||
<Icon slot="prefix" mini size="16" src={ShieldExclamation} />
|
<Icon slot="prefix" mini size="16" src={NoSymbol} />
|
||||||
{data.person_view.person.banned ? 'Unban' : 'Ban'}
|
{isBlocked($profile.user, data.person_view.person.id)
|
||||||
</MenuButton>
|
? 'Unblock'
|
||||||
<MenuButton
|
: 'Block'}
|
||||||
color="danger-subtle"
|
|
||||||
on:click={() => (purgingUser = !purgingUser)}
|
|
||||||
>
|
|
||||||
<Icon slot="prefix" mini size="16" src={Fire} />
|
|
||||||
Purge
|
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
</Menu>
|
</Menu>
|
||||||
{/if}
|
</div>
|
||||||
<Menu placement="bottom-start">
|
{/if}
|
||||||
<Button size="square-md" slot="target">
|
</svelte:fragment>
|
||||||
<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}
|
|
||||||
</EntityHeader>
|
</EntityHeader>
|
||||||
|
|
||||||
<div class="flex flex-col gap-4 max-w-full w-full min-w-0">
|
<div class="flex flex-col gap-4 max-w-full w-full min-w-0">
|
||||||
|
|||||||
Reference in new issue
Block a user