feat: add HatGlasses icon for anonymous users in Paste component

This commit is contained in:
2026-03-27 20:20:42 -04:00
parent 8eede40000
commit b7ce54d5a0
2 changed files with 17 additions and 11 deletions
@@ -1,10 +1,5 @@
<script lang="ts"> <script lang="ts">
import { import { tooltip, dateToRelativeString, formatNumber, formatBytes } from '$lib/utils/misc';
tooltip,
dateToRelativeString,
formatNumber,
formatBytes
} from '$lib/utils/misc';
import { resolve } from '$app/paths'; import { resolve } from '$app/paths';
import { import {
Eye, Eye,
@@ -16,7 +11,8 @@
Timer, Timer,
Lock, Lock,
EyeOff, EyeOff,
Globe Globe,
HatGlasses
} from '@lucide/svelte'; } from '@lucide/svelte';
import { syntaxes } from '$lib/consts'; import { syntaxes } from '$lib/consts';
import type { Paste } from '$lib/types/paste'; import type { Paste } from '$lib/types/paste';
@@ -62,7 +58,11 @@
<div> <div>
{#if showUser} {#if showUser}
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
{#if paste.author}
<User class="h-4 w-4" /> <User class="h-4 w-4" />
{:else}
<HatGlasses class="h-4 w-4" />
{/if}
{paste.author?.username ?? 'Anonymous'} {paste.author?.username ?? 'Anonymous'}
</div> </div>
{:else} {:else}
@@ -154,7 +154,11 @@
{/if} {/if}
{#if showUser} {#if showUser}
<div class="mt-1 flex items-center gap-2 text-sm text-neutral-400"> <div class="mt-1 flex items-center gap-2 text-sm text-neutral-400">
{#if paste.author}
<User class="h-4 w-4" /> <User class="h-4 w-4" />
{:else}
<HatGlasses class="h-4 w-4" />
{/if}
<span>{paste.author?.username ?? 'Anonymous'}</span> <span>{paste.author?.username ?? 'Anonymous'}</span>
</div> </div>
{/if} {/if}
@@ -23,7 +23,8 @@
Check, Check,
CalendarCog, CalendarCog,
Flag, Flag,
ArrowUp ArrowUp,
HatGlasses
} from '@lucide/svelte/icons/index'; } from '@lucide/svelte/icons/index';
import { import {
formatBytes, formatBytes,
@@ -564,14 +565,15 @@
{/if} {/if}
</h1> </h1>
<div class="flex items-center justify-center gap-2 text-sm text-neutral-400"> <div class="flex items-center justify-center gap-2 text-sm text-neutral-400">
<User class="inline-block h-4 w-4 text-neutral-400" />
{#if data.paste.author} {#if data.paste.author}
<User class="inline-block h-4 w-4 text-neutral-400" />
<a <a
href={resolve(`/user/${data.paste.author.username}`)} href={resolve(`/user/${data.paste.author.username}`)}
class="text-neutral-400 transition-colors duration-300 hover:text-neutral-500" class="text-neutral-400 transition-colors duration-300 hover:text-neutral-500"
>{data.paste.author.username}</a >{data.paste.author.username}</a
> >
{:else} {:else}
<HatGlasses class="inline-block h-4 w-4 text-neutral-400" />
<span class="text-neutral-400">Anonymous</span> <span class="text-neutral-400">Anonymous</span>
{/if} {/if}
</div> </div>