impr: use gradients for placeholder avatars
This commit is contained in:
7 files changed
+71
-38
No files matched your search
@@ -20,7 +20,7 @@
|
||||
Flag,
|
||||
Icon,
|
||||
PencilSquare,
|
||||
Square2Stack,
|
||||
Share,
|
||||
Trash,
|
||||
} from 'svelte-hero-icons'
|
||||
|
||||
@@ -87,14 +87,18 @@
|
||||
else navigator.clipboard.writeText(comment.comment.ap_id)
|
||||
}}
|
||||
>
|
||||
<Icon src={Square2Stack} mini size="16" />
|
||||
<div>{$t('post.actions.more.share')}</div>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Share} mini size="16" />
|
||||
{/snippet}
|
||||
{$t('post.actions.more.share')}
|
||||
</MenuButton>
|
||||
{#if profile.current?.jwt}
|
||||
{#if comment.creator.id == profile.current.user?.local_user_view.person.id}
|
||||
<MenuButton onclick={() => onedit?.(comment)}>
|
||||
<Icon src={PencilSquare} mini size="16" />
|
||||
<span>{$t('post.actions.more.edit')}</span>
|
||||
{#snippet prefix()}
|
||||
<Icon src={PencilSquare} mini size="16" />
|
||||
{/snippet}
|
||||
{$t('post.actions.more.edit')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
<MenuButton
|
||||
@@ -103,10 +107,10 @@
|
||||
comment.saved = await save(comment, !comment.saved)
|
||||
}}
|
||||
>
|
||||
<Icon src={comment.saved ? BookmarkSlash : Bookmark} mini size="16" />
|
||||
<span>
|
||||
{comment.saved ? $t('post.actions.unsave') : $t('post.actions.save')}
|
||||
</span>
|
||||
{#snippet prefix()}
|
||||
<Icon src={comment.saved ? BookmarkSlash : Bookmark} mini size="16" />
|
||||
{/snippet}
|
||||
{comment.saved ? $t('post.actions.unsave') : $t('post.actions.save')}
|
||||
</MenuButton>
|
||||
{#if profile.current?.user && profile.current.jwt && profile.current.user.local_user_view.person.id == comment.creator.id}
|
||||
<MenuButton
|
||||
@@ -119,18 +123,20 @@
|
||||
)
|
||||
}}
|
||||
>
|
||||
<Icon src={Trash} mini size="16" />
|
||||
<span>
|
||||
{comment.comment.deleted
|
||||
? $t('post.actions.more.restore')
|
||||
: $t('post.actions.more.delete')}
|
||||
</span>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Trash} mini size="16" />
|
||||
{/snippet}
|
||||
{comment.comment.deleted
|
||||
? $t('post.actions.more.restore')
|
||||
: $t('post.actions.more.delete')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if profile.current.jwt && profile.current.user?.local_user_view.person.id != comment.creator.id}
|
||||
<MenuButton onclick={() => report(comment)} color="danger-subtle">
|
||||
<Icon src={Flag} mini size="16" />
|
||||
<span>{$t('moderation.report')}</span>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Flag} mini size="16" />
|
||||
{/snippet}
|
||||
{$t('moderation.report')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
@@ -83,6 +83,34 @@
|
||||
>
|
||||
{@html createAvatar(initials, {
|
||||
seed: alt,
|
||||
backgroundType: ['gradientLinear'],
|
||||
fontWeight: 800,
|
||||
randomizeIds: true,
|
||||
chars: 1,
|
||||
scale: 125,
|
||||
textColor: ['fff', '000'],
|
||||
backgroundColor: [
|
||||
'7B68EE',
|
||||
'FF6347',
|
||||
'20B2AA',
|
||||
'DDA0DD',
|
||||
'F0E68C',
|
||||
'FF1493',
|
||||
'4682B4',
|
||||
'32CD32',
|
||||
'FFB6C1',
|
||||
'8B4513',
|
||||
'00CED1',
|
||||
'9370DB',
|
||||
'FFA500',
|
||||
'2E8B57',
|
||||
'DC143C',
|
||||
'BA55D3',
|
||||
'708090',
|
||||
'ADFF2F',
|
||||
'CD853F',
|
||||
'48D1CC',
|
||||
],
|
||||
}).toString()}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
rounding="none"
|
||||
{href}
|
||||
title={label}
|
||||
style="transition-property: background-color, filter;"
|
||||
style="transition-property: background-color, filter, transform, scale;"
|
||||
aria-selected={isSelected}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
|
||||
@@ -141,7 +141,7 @@ items-center px-2 w-max top-6 lg:top-22"
|
||||
</div>
|
||||
</Header>
|
||||
|
||||
<div class="h-4 sm:h-6"></div>
|
||||
<div class="h-3 sm:h-6"></div>
|
||||
|
||||
{#if !data.inbox?.value || (data.inbox.value?.length ?? 0) == 0}
|
||||
<Placeholder
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import UserAutocomplete from '$lib/components/lemmy/user/UserAutocomplete.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import Skeleton from '$lib/components/ui/generic/Skeleton.svelte'
|
||||
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
@@ -120,23 +121,21 @@
|
||||
{@const conversations = res.private_messages}
|
||||
{@const previews = conversationPreviews(conversations)}
|
||||
|
||||
<ul
|
||||
class="flex flex-col divide-y divide-slate-200 dark:divide-zinc-800 w-full mt-6 h-full"
|
||||
>
|
||||
{#if previews.length == 0}
|
||||
<Placeholder
|
||||
title={$t('routes.inbox.messages.empty.title')}
|
||||
icon={Inbox}
|
||||
class="my-auto"
|
||||
>
|
||||
{@render startChat?.()}
|
||||
</Placeholder>
|
||||
{/if}
|
||||
{#each previews as preview, index (preview)}
|
||||
{#if previews.length == 0}
|
||||
<Placeholder
|
||||
title={$t('routes.inbox.messages.empty.title')}
|
||||
icon={Inbox}
|
||||
class="my-auto"
|
||||
>
|
||||
{@render startChat?.()}
|
||||
</Placeholder>
|
||||
{/if}
|
||||
<div class="h-3 sm:h-6"></div>
|
||||
<CommonList items={previews}>
|
||||
{#snippet item(preview, index)}
|
||||
<a
|
||||
href="/inbox/messages/{preview.user.id}"
|
||||
class="flex flex-row gap-2 py-3 -mx-3 sm:-mx-6 px-3 sm:px-6 min-w-0
|
||||
hover:bg-slate-100 dark:hover:bg-zinc-900 transition-colors"
|
||||
class="flex flex-row gap-2"
|
||||
in:fly|global={{
|
||||
duration: 1000,
|
||||
easing: expoOut,
|
||||
@@ -165,8 +164,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
{/each}
|
||||
</ul>
|
||||
{/snippet}
|
||||
</CommonList>
|
||||
|
||||
{#if res.private_messages.length == 50 || data.page != 1}
|
||||
<div class="mt-auto pb-4">
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
})
|
||||
|
||||
onMount(() => {
|
||||
if (browser && page.url.hash)
|
||||
if (browser && !isNaN(Number(page.url.hash)))
|
||||
// hack because virtual list needs to calc heights
|
||||
setTimeout(() => {
|
||||
document
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
{/snippet}
|
||||
</Header>
|
||||
|
||||
<div class="h-4 sm:h-6"></div>
|
||||
<div class="h-3 sm:h-6"></div>
|
||||
|
||||
{#if !data.data || (data.data?.length ?? 0) == 0}
|
||||
<Placeholder
|
||||
|
||||
Reference in new issue
Block a user