32 lines
1.3 KiB
PHP
32 lines
1.3 KiB
PHP
@php
|
|
$user = auth()->user();
|
|
$name = $user?->name ?? 'Gast';
|
|
$meta = $user?->email ?? '';
|
|
$initials = collect(explode(' ', $name))
|
|
->map(fn($p) => mb_strtoupper(mb_substr($p, 0, 1)))
|
|
->take(2)
|
|
->implode('');
|
|
@endphp
|
|
|
|
<div class="flex items-center gap-2 p-2 bg-bg-soft rounded-lg border border-line">
|
|
<div class="w-8 h-8 rounded-full bg-primary text-white grid place-items-center font-bold text-xs shrink-0">
|
|
{{ $initials }}
|
|
</div>
|
|
<div class="min-w-0 flex-1">
|
|
<div class="font-semibold text-sm text-ink-1 truncate">{{ $name }}</div>
|
|
<div class="text-xs text-ink-3 truncate">{{ $meta }}</div>
|
|
</div>
|
|
<form method="POST" action="{{ route('logout') }}" class="shrink-0">
|
|
@csrf
|
|
<button
|
|
type="submit"
|
|
class="w-8 h-8 grid place-items-center rounded-lg text-ink-3 hover:text-danger hover:bg-bg-tint transition-all cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-danger focus-visible:ring-offset-1 focus-visible:ring-offset-bg-soft"
|
|
aria-label="Abmelden"
|
|
title="Abmelden"
|
|
data-testid="sidebar-logout"
|
|
>
|
|
<x-heroicon-o-arrow-right-on-rectangle class="w-4 h-4" />
|
|
</button>
|
|
</form>
|
|
</div>
|