misc: EntityHeader actions

This commit is contained in:
Xylight committed 2024-07-18 19:21:11 -07:00
1 parent 32b0253ca2
commit 008f224055
2 files changed
+22 -11

No files matched your search

+16 -8
View File
@@ -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}
</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 /> <slot />
</div> </div>
</div>
</Material> </Material>
+6 -3
View File
@@ -209,6 +209,7 @@
/> />
</Expandable> </Expandable>
{/if} {/if}
<svelte:fragment slot="actions">
{#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">
<Button <Button
@@ -223,14 +224,15 @@
<Button <Button
size="square-md" size="square-md"
color="secondary" 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" title="Matrix User"
> >
<Icon slot="prefix" solid size="16" src={AtSymbol} /> <Icon slot="prefix" solid size="16" src={AtSymbol} />
</Button> </Button>
{/if} {/if}
{#if isAdmin($profile?.user)} {#if isAdmin($profile?.user)}
<Menu class="ml-auto" placement="bottom-start"> <Menu class="ml-auto" placement="bottom-end">
<Button size="square-md" slot="target"> <Button size="square-md" slot="target">
<ShieldIcon width={16} filled /> <ShieldIcon width={16} filled />
</Button> </Button>
@@ -251,7 +253,7 @@
</MenuButton> </MenuButton>
</Menu> </Menu>
{/if} {/if}
<Menu placement="bottom-start"> <Menu placement="bottom-end">
<Button size="square-md" slot="target"> <Button size="square-md" slot="target">
<Icon src={EllipsisHorizontal} slot="prefix" size="16" mini /> <Icon src={EllipsisHorizontal} slot="prefix" size="16" mini />
</Button> </Button>
@@ -267,6 +269,7 @@
</Menu> </Menu>
</div> </div>
{/if} {/if}
</svelte:fragment>
</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">