impr: use gradients for placeholder avatars

This commit is contained in:
James Xylight committed 2025-07-25 21:21:42 -07:00
1 parent 1f078bd6e1
commit 12d7b70571
7 files changed
+71 -38

No files matched your search

@@ -20,7 +20,7 @@
Flag, Flag,
Icon, Icon,
PencilSquare, PencilSquare,
Square2Stack, Share,
Trash, Trash,
} from 'svelte-hero-icons' } from 'svelte-hero-icons'
@@ -87,14 +87,18 @@
else navigator.clipboard.writeText(comment.comment.ap_id) else navigator.clipboard.writeText(comment.comment.ap_id)
}} }}
> >
<Icon src={Square2Stack} mini size="16" /> {#snippet prefix()}
<div>{$t('post.actions.more.share')}</div> <Icon src={Share} mini size="16" />
{/snippet}
{$t('post.actions.more.share')}
</MenuButton> </MenuButton>
{#if profile.current?.jwt} {#if profile.current?.jwt}
{#if comment.creator.id == profile.current.user?.local_user_view.person.id} {#if comment.creator.id == profile.current.user?.local_user_view.person.id}
<MenuButton onclick={() => onedit?.(comment)}> <MenuButton onclick={() => onedit?.(comment)}>
<Icon src={PencilSquare} mini size="16" /> {#snippet prefix()}
<span>{$t('post.actions.more.edit')}</span> <Icon src={PencilSquare} mini size="16" />
{/snippet}
{$t('post.actions.more.edit')}
</MenuButton> </MenuButton>
{/if} {/if}
<MenuButton <MenuButton
@@ -103,10 +107,10 @@
comment.saved = await save(comment, !comment.saved) comment.saved = await save(comment, !comment.saved)
}} }}
> >
<Icon src={comment.saved ? BookmarkSlash : Bookmark} mini size="16" /> {#snippet prefix()}
<span> <Icon src={comment.saved ? BookmarkSlash : Bookmark} mini size="16" />
{comment.saved ? $t('post.actions.unsave') : $t('post.actions.save')} {/snippet}
</span> {comment.saved ? $t('post.actions.unsave') : $t('post.actions.save')}
</MenuButton> </MenuButton>
{#if profile.current?.user && profile.current.jwt && profile.current.user.local_user_view.person.id == comment.creator.id} {#if profile.current?.user && profile.current.jwt && profile.current.user.local_user_view.person.id == comment.creator.id}
<MenuButton <MenuButton
@@ -119,18 +123,20 @@
) )
}} }}
> >
<Icon src={Trash} mini size="16" /> {#snippet prefix()}
<span> <Icon src={Trash} mini size="16" />
{comment.comment.deleted {/snippet}
? $t('post.actions.more.restore') {comment.comment.deleted
: $t('post.actions.more.delete')} ? $t('post.actions.more.restore')
</span> : $t('post.actions.more.delete')}
</MenuButton> </MenuButton>
{/if} {/if}
{#if profile.current.jwt && profile.current.user?.local_user_view.person.id != comment.creator.id} {#if profile.current.jwt && profile.current.user?.local_user_view.person.id != comment.creator.id}
<MenuButton onclick={() => report(comment)} color="danger-subtle"> <MenuButton onclick={() => report(comment)} color="danger-subtle">
<Icon src={Flag} mini size="16" /> {#snippet prefix()}
<span>{$t('moderation.report')}</span> <Icon src={Flag} mini size="16" />
{/snippet}
{$t('moderation.report')}
</MenuButton> </MenuButton>
{/if} {/if}
{/if} {/if}
+28
View File
@@ -83,6 +83,34 @@
> >
{@html createAvatar(initials, { {@html createAvatar(initials, {
seed: alt, 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()} }).toString()}
</div> </div>
{/if} {/if}
@@ -48,7 +48,7 @@
rounding="none" rounding="none"
{href} {href}
title={label} title={label}
style="transition-property: background-color, filter;" style="transition-property: background-color, filter, transform, scale;"
aria-selected={isSelected} aria-selected={isSelected}
> >
{#snippet prefix()} {#snippet prefix()}
+1 -1
View File
@@ -141,7 +141,7 @@ items-center px-2 w-max top-6 lg:top-22"
</div> </div>
</Header> </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} {#if !data.inbox?.value || (data.inbox.value?.length ?? 0) == 0}
<Placeholder <Placeholder
+16 -17
View File
@@ -5,6 +5,7 @@
import UserAutocomplete from '$lib/components/lemmy/user/UserAutocomplete.svelte' import UserAutocomplete from '$lib/components/lemmy/user/UserAutocomplete.svelte'
import Avatar from '$lib/components/ui/Avatar.svelte' import Avatar from '$lib/components/ui/Avatar.svelte'
import Skeleton from '$lib/components/ui/generic/Skeleton.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 Header from '$lib/components/ui/layout/pages/Header.svelte'
import Pageination from '$lib/components/ui/Pageination.svelte' import Pageination from '$lib/components/ui/Pageination.svelte'
import Placeholder from '$lib/components/ui/Placeholder.svelte' import Placeholder from '$lib/components/ui/Placeholder.svelte'
@@ -120,23 +121,21 @@
{@const conversations = res.private_messages} {@const conversations = res.private_messages}
{@const previews = conversationPreviews(conversations)} {@const previews = conversationPreviews(conversations)}
<ul {#if previews.length == 0}
class="flex flex-col divide-y divide-slate-200 dark:divide-zinc-800 w-full mt-6 h-full" <Placeholder
> title={$t('routes.inbox.messages.empty.title')}
{#if previews.length == 0} icon={Inbox}
<Placeholder class="my-auto"
title={$t('routes.inbox.messages.empty.title')} >
icon={Inbox} {@render startChat?.()}
class="my-auto" </Placeholder>
> {/if}
{@render startChat?.()} <div class="h-3 sm:h-6"></div>
</Placeholder> <CommonList items={previews}>
{/if} {#snippet item(preview, index)}
{#each previews as preview, index (preview)}
<a <a
href="/inbox/messages/{preview.user.id}" 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 class="flex flex-row gap-2"
hover:bg-slate-100 dark:hover:bg-zinc-900 transition-colors"
in:fly|global={{ in:fly|global={{
duration: 1000, duration: 1000,
easing: expoOut, easing: expoOut,
@@ -165,8 +164,8 @@
</div> </div>
</div> </div>
</a> </a>
{/each} {/snippet}
</ul> </CommonList>
{#if res.private_messages.length == 50 || data.page != 1} {#if res.private_messages.length == 50 || data.page != 1}
<div class="mt-auto pb-4"> <div class="mt-auto pb-4">
@@ -52,7 +52,7 @@
}) })
onMount(() => { onMount(() => {
if (browser && page.url.hash) if (browser && !isNaN(Number(page.url.hash)))
// hack because virtual list needs to calc heights // hack because virtual list needs to calc heights
setTimeout(() => { setTimeout(() => {
document document
+1 -1
View File
@@ -62,7 +62,7 @@
{/snippet} {/snippet}
</Header> </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} {#if !data.data || (data.data?.length ?? 0) == 0}
<Placeholder <Placeholder