misc: make account page more compact
This commit is contained in:
3 files changed
+92
-76
No files matched your search
@@ -9,6 +9,7 @@
|
||||
setUserID,
|
||||
} from '$lib/auth.svelte.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import TextProps from '$lib/components/ui/text/TextProps.svelte'
|
||||
import DebugObject from '$lib/components/util/debug/DebugObject.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte.js'
|
||||
@@ -24,6 +25,7 @@
|
||||
EllipsisHorizontal,
|
||||
Icon,
|
||||
Plus,
|
||||
QuestionMarkCircle,
|
||||
} from 'svelte-hero-icons'
|
||||
|
||||
let debugging = $state(false)
|
||||
@@ -53,7 +55,7 @@
|
||||
|
||||
{#if debugging}
|
||||
<DebugObject
|
||||
object={debugProfile?.id == profile.data?.id ? profile : debugProfile}
|
||||
object={debugProfile?.id == profile.data?.id ? profile.data : debugProfile}
|
||||
bind:open={debugging}
|
||||
>
|
||||
{#snippet title()}
|
||||
@@ -144,8 +146,9 @@
|
||||
<Material
|
||||
rounding="2xl"
|
||||
color="uniform"
|
||||
padding="none"
|
||||
class={[
|
||||
'flex flex-col gap-2 py-3 transition-all duration-75 cursor-pointer',
|
||||
'flex flex-row items-center px-3 py-3 gap-2 transition-all duration-75 cursor-pointer relative',
|
||||
'peer-checked:ring-2',
|
||||
switching == profile.id && 'ring-slate-400 dark:ring-zinc-600',
|
||||
]}
|
||||
@@ -156,82 +159,87 @@
|
||||
selected={currentProfile?.data.id == profile.id}
|
||||
size={40}
|
||||
/>
|
||||
<div class="flex flex-row justify-between">
|
||||
<div class="flex flex-col">
|
||||
<span class="font-medium text-base">
|
||||
{profile.username}
|
||||
{#if !profile.jwt}
|
||||
<Badge class="inline">{$t('account.guest')}</Badge>
|
||||
{/if}
|
||||
</span>
|
||||
<span class="text-sm text-slate-600 dark:text-zinc-400">
|
||||
{profile.instance}
|
||||
</span>
|
||||
</div>
|
||||
<Menu placement="bottom-end">
|
||||
{#snippet target()}
|
||||
<Button rounding="pill" size="custom" class="self-end h-8 w-8">
|
||||
{#snippet prefix()}
|
||||
<Icon src={EllipsisHorizontal} mini size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
{/snippet}
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<div
|
||||
class="px-4 py-2 flex items-center gap-2"
|
||||
onclick={e => e.stopPropagation()}
|
||||
>
|
||||
<Button
|
||||
size="square-md"
|
||||
color="secondary"
|
||||
title={$t('account.moveUp')}
|
||||
onclick={() => moveProfile(profile.id, true)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ChevronUp} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Button
|
||||
size="square-md"
|
||||
color="secondary"
|
||||
title={$t('account.moveDown')}
|
||||
onclick={() => moveProfile(profile.id, false)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ChevronDown} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
{#if settings.debugInfo}
|
||||
<MenuButton
|
||||
onclick={() => {
|
||||
debugProfile = profile
|
||||
debugging = !debugging
|
||||
}}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={BugAnt} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('common.debug')}
|
||||
</MenuButton>
|
||||
<div class="flex flex-col overflow-hidden">
|
||||
<span class="break-words font-medium text-base">
|
||||
{profile.username}
|
||||
{#if !profile.jwt}
|
||||
<Badge class="inline-grid w-6 h-6 p-0! place-items-center">
|
||||
<Icon src={QuestionMarkCircle} size="16" micro />
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if !LINKED_INSTANCE_URL || profile.user}
|
||||
<MenuButton
|
||||
onclick={() => {
|
||||
removing.account = profile
|
||||
removing.shown = !removing.shown
|
||||
}}
|
||||
color="danger-subtle"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowRightOnRectangle} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('account.logout')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
</Menu>
|
||||
</span>
|
||||
<span class="text-sm text-slate-600 dark:text-zinc-400">
|
||||
{profile.instance}
|
||||
</span>
|
||||
</div>
|
||||
<Menu placement="bottom-end">
|
||||
{#snippet target()}
|
||||
<Button
|
||||
size="custom"
|
||||
class="absolute top-0 right-0 w-6 h-6 m-1"
|
||||
color="tertiary"
|
||||
aria-label={$t('post.actions.more')}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={EllipsisHorizontal} mini size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
{/snippet}
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<div
|
||||
class="px-4 py-2 flex items-center gap-2"
|
||||
onclick={e => e.stopPropagation()}
|
||||
>
|
||||
<Button
|
||||
size="square-md"
|
||||
color="secondary"
|
||||
title={$t('account.moveUp')}
|
||||
onclick={() => moveProfile(profile.id, true)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ChevronUp} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Button
|
||||
size="square-md"
|
||||
color="secondary"
|
||||
title={$t('account.moveDown')}
|
||||
onclick={() => moveProfile(profile.id, false)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ChevronDown} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
{#if settings.debugInfo}
|
||||
<MenuButton
|
||||
onclick={() => {
|
||||
debugProfile = profile
|
||||
debugging = !debugging
|
||||
}}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={BugAnt} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('common.debug')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if !LINKED_INSTANCE_URL || profile.user}
|
||||
<MenuButton
|
||||
onclick={() => {
|
||||
removing.account = profile
|
||||
removing.shown = !removing.shown
|
||||
}}
|
||||
color="danger-subtle"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowRightOnRectangle} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('account.logout')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
</Menu>
|
||||
</Material>
|
||||
</label>
|
||||
{/each}
|
||||
|
||||
Reference in new issue
Block a user