33 lines
1.1 KiB
PHP
33 lines
1.1 KiB
PHP
@php
|
|
$user = $user ?? null;
|
|
$name = data_get($user, 'name', 'Anonymous');
|
|
$avatar = data_get($user, 'profile.avatar_url') ?? \App\Support\AvatarUrl::forUser((int) data_get($user, 'id', 0));
|
|
$role = strtolower((string) data_get($user, 'role', 'member'));
|
|
|
|
$roleLabel = match ($role) {
|
|
'admin' => 'Admin',
|
|
'moderator' => 'Moderator',
|
|
default => 'Member',
|
|
};
|
|
|
|
$roleClasses = match ($role) {
|
|
'admin' => 'bg-red-500/15 text-red-300',
|
|
'moderator' => 'bg-amber-500/15 text-amber-300',
|
|
default => 'bg-sky-500/15 text-sky-300',
|
|
};
|
|
@endphp
|
|
|
|
<div class="flex items-center gap-3">
|
|
<img
|
|
src="{{ $avatar }}"
|
|
alt="{{ $name }} avatar"
|
|
loading="lazy"
|
|
decoding="async"
|
|
class="h-10 w-10 rounded-full border border-white/10 object-cover"
|
|
/>
|
|
<div class="min-w-0">
|
|
<div class="truncate text-sm font-semibold text-zinc-100">{{ $name }}</div>
|
|
<span class="inline-flex rounded-full px-2 py-0.5 text-[11px] font-medium {{ $roleClasses }}">{{ $roleLabel }}</span>
|
|
</div>
|
|
</div>
|