design: use commonlist for accounts page
This commit is contained in:
2 files changed
+114
-109
No files matched your search
@@ -10,12 +10,12 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ul class="divide-y-3 divide-slate-25 dark:divide-zinc-925">
|
<ul class="divide-y-3 divide-slate-25 dark:divide-zinc-925">
|
||||||
{#each items as item, index}
|
{#each items as item, index (item)}
|
||||||
<li
|
<li
|
||||||
class={[
|
class={[
|
||||||
'py-2 px-3 sm:py-3 sm:px-4',
|
'py-2 px-3 sm:py-3 sm:px-4',
|
||||||
'hover:bg-slate-100 dark:hover:bg-zinc-900/25 transition-colors @container',
|
'hover:bg-slate-100 dark:hover:bg-zinc-900/25 transition-colors @container',
|
||||||
'bg-slate-50 dark:bg-zinc-950 first:rounded-t-2xl last:rounded-b-2xl',
|
'bg-slate-50 dark:bg-zinc-950 first:rounded-t-2xl last:rounded-b-2xl group/li',
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
{@render itemSnippet(item, index)}
|
{@render itemSnippet(item, index)}
|
||||||
|
|||||||
+112
-107
@@ -1,12 +1,13 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { profile, type ProfileInfo } from '$lib/auth.svelte.js'
|
import { profile, type ProfileInfo } from '$lib/auth.svelte.js'
|
||||||
|
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
import DebugObject from '$lib/components/util/debug/DebugObject.svelte'
|
import DebugObject from '$lib/components/util/debug/DebugObject.svelte'
|
||||||
import { t } from '$lib/i18n/translations'
|
import { t } from '$lib/i18n/translations'
|
||||||
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte.js'
|
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte.js'
|
||||||
import ProfileAvatar from '$lib/lemmy/ProfileAvatar.svelte'
|
import ProfileAvatar from '$lib/lemmy/ProfileAvatar.svelte'
|
||||||
import { settings } from '$lib/settings.svelte.js'
|
import { settings } from '$lib/settings.svelte.js'
|
||||||
import { Badge, Button, Material, Menu, MenuButton, Modal } from 'mono-svelte'
|
import { Badge, Button, Menu, MenuButton, Modal } from 'mono-svelte'
|
||||||
import {
|
import {
|
||||||
ArrowLeftOnRectangle,
|
ArrowLeftOnRectangle,
|
||||||
ArrowRightOnRectangle,
|
ArrowRightOnRectangle,
|
||||||
@@ -133,116 +134,120 @@
|
|||||||
{/snippet}
|
{/snippet}
|
||||||
</Header>
|
</Header>
|
||||||
<form class="accounts-grid mt-4 sm:mt-6 gap-4">
|
<form class="accounts-grid mt-4 sm:mt-6 gap-4">
|
||||||
{#each profile.meta.profiles as p, index (p.id)}
|
<CommonList items={profile.meta.profiles}>
|
||||||
<label>
|
{#snippet item(p, index)}
|
||||||
<input
|
<label class="relative">
|
||||||
type="radio"
|
<input
|
||||||
id={p.id.toString()}
|
type="radio"
|
||||||
name="profile"
|
id={p.id.toString()}
|
||||||
value={p.id}
|
name="profile"
|
||||||
class="hidden peer"
|
value={p.id}
|
||||||
bind:group={radioSelected}
|
class="hidden peer"
|
||||||
/>
|
bind:group={radioSelected}
|
||||||
<Material
|
|
||||||
rounding="2xl"
|
|
||||||
color="uniform"
|
|
||||||
padding="none"
|
|
||||||
class={[
|
|
||||||
'flex flex-row items-center px-3 py-3 gap-2 transition-all duration-75 cursor-pointer relative',
|
|
||||||
'peer-checked:ring-2',
|
|
||||||
switching == p.id && 'ring-slate-400 dark:ring-zinc-600',
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<ProfileAvatar
|
|
||||||
profile={p}
|
|
||||||
{index}
|
|
||||||
selected={profile?.current.id == p.id}
|
|
||||||
size={40}
|
|
||||||
/>
|
/>
|
||||||
<div class="flex flex-col overflow-hidden">
|
<div
|
||||||
<span class="break-words font-medium text-base">
|
class={[
|
||||||
{p.username}
|
'flex flex-row items-center gap-2 transition-all duration-75',
|
||||||
{#if !p.jwt}
|
'cursor-pointer relative ring-transparent',
|
||||||
<Badge class="inline-grid w-6 h-6 p-0! place-items-center">
|
switching == p.id
|
||||||
<Icon src={QuestionMarkCircle} size="16" micro />
|
? 'ring-slate-500 dark:ring-zinc-500'
|
||||||
</Badge>
|
: 'peer-checked:ring-primary-900 peer-checked:dark:ring-primary-100',
|
||||||
{/if}
|
]}
|
||||||
</span>
|
>
|
||||||
<span class="text-sm text-slate-600 dark:text-zinc-400">
|
|
||||||
{p.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.label')}
|
|
||||||
>
|
|
||||||
{#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
|
<div
|
||||||
class="px-4 py-2 flex items-center gap-2"
|
class="absolute -inset-2 -inset-x-3 sm:-inset-y-3 sm:-inset-x-4 group-first/li:rounded-t-2xl group-last/li:rounded-b-2xl rounded-md ring-2 ring-inherit"
|
||||||
onclick={e => e.stopPropagation()}
|
></div>
|
||||||
>
|
<ProfileAvatar
|
||||||
<Button
|
profile={p}
|
||||||
size="square-md"
|
{index}
|
||||||
color="secondary"
|
selected={profile?.current.id == p.id}
|
||||||
title={$t('account.moveUp')}
|
size={32}
|
||||||
onclick={() => profile.move(p.id, true)}
|
/>
|
||||||
>
|
<div class="flex flex-col overflow-hidden">
|
||||||
{#snippet prefix()}
|
<span class="break-words font-medium text-base">
|
||||||
<Icon src={ChevronUp} size="16" mini />
|
{p.username}
|
||||||
{/snippet}
|
{#if !p.jwt}
|
||||||
</Button>
|
<Badge class="inline-grid w-6 h-6 p-0! place-items-center">
|
||||||
<Button
|
<Icon src={QuestionMarkCircle} size="16" micro />
|
||||||
size="square-md"
|
</Badge>
|
||||||
color="secondary"
|
{/if}
|
||||||
title={$t('account.moveDown')}
|
</span>
|
||||||
onclick={() => profile.move(p.id, false)}
|
<span class="text-sm text-slate-600 dark:text-zinc-400">
|
||||||
>
|
{p.instance}
|
||||||
{#snippet prefix()}
|
</span>
|
||||||
<Icon src={ChevronDown} size="16" mini />
|
|
||||||
{/snippet}
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
{#if settings.debugInfo}
|
<Menu placement="bottom-end">
|
||||||
<MenuButton
|
{#snippet target()}
|
||||||
onclick={() => {
|
<Button
|
||||||
debugProfile = p
|
size="square-md"
|
||||||
debugging = !debugging
|
color="tertiary"
|
||||||
}}
|
class="justify-self-end ml-auto z-50"
|
||||||
|
aria-label={$t('post.actions.more.label')}
|
||||||
|
>
|
||||||
|
{#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()}
|
||||||
>
|
>
|
||||||
{#snippet prefix()}
|
<Button
|
||||||
<Icon src={BugAnt} size="16" mini />
|
size="square-md"
|
||||||
{/snippet}
|
color="secondary"
|
||||||
{$t('common.debug')}
|
title={$t('account.moveUp')}
|
||||||
</MenuButton>
|
onclick={() => profile.move(p.id, true)}
|
||||||
{/if}
|
>
|
||||||
{#if !LINKED_INSTANCE_URL || p.user}
|
{#snippet prefix()}
|
||||||
<MenuButton
|
<Icon src={ChevronUp} size="16" mini />
|
||||||
onclick={() => {
|
{/snippet}
|
||||||
removing.account = p
|
</Button>
|
||||||
removing.shown = !removing.shown
|
<Button
|
||||||
}}
|
size="square-md"
|
||||||
color="danger-subtle"
|
color="secondary"
|
||||||
>
|
title={$t('account.moveDown')}
|
||||||
{#snippet prefix()}
|
onclick={() => profile.move(p.id, false)}
|
||||||
<Icon src={ArrowRightOnRectangle} size="16" mini />
|
>
|
||||||
{/snippet}
|
{#snippet prefix()}
|
||||||
{$t('account.logout')}
|
<Icon src={ChevronDown} size="16" mini />
|
||||||
</MenuButton>
|
{/snippet}
|
||||||
{/if}
|
</Button>
|
||||||
</Menu>
|
</div>
|
||||||
</Material>
|
{#if settings.debugInfo}
|
||||||
</label>
|
<MenuButton
|
||||||
{/each}
|
onclick={() => {
|
||||||
|
debugProfile = p
|
||||||
|
debugging = !debugging
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{#snippet prefix()}
|
||||||
|
<Icon src={BugAnt} size="16" mini />
|
||||||
|
{/snippet}
|
||||||
|
{$t('common.debug')}
|
||||||
|
</MenuButton>
|
||||||
|
{/if}
|
||||||
|
{#if !LINKED_INSTANCE_URL || p.user}
|
||||||
|
<MenuButton
|
||||||
|
onclick={() => {
|
||||||
|
removing.account = p
|
||||||
|
removing.shown = !removing.shown
|
||||||
|
}}
|
||||||
|
color="danger-subtle"
|
||||||
|
>
|
||||||
|
{#snippet prefix()}
|
||||||
|
<Icon src={ArrowRightOnRectangle} size="16" mini />
|
||||||
|
{/snippet}
|
||||||
|
{$t('account.logout')}
|
||||||
|
</MenuButton>
|
||||||
|
{/if}
|
||||||
|
</Menu>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
{/snippet}
|
||||||
|
</CommonList>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
Reference in new issue
Block a user