Files
timebank-cc-public/resources/views/components/active-profile-reminder.blade.php
T

49 lines
2.1 KiB
PHP

@php
\Log::info('REMINDER: component rendering started');
$hasMultipleProfiles = userHasMultipleProfiles();
\Log::info('REMINDER: userHasMultipleProfiles', ['result' => $hasMultipleProfiles]);
$activeProfileName = session('activeProfileName');
$activeProfilePhoto = session('activeProfilePhoto');
$activeProfileRoleLabel = session('activeProfileRoleLabel');
\Log::info('REMINDER: session data', [
'hasMultiple' => $hasMultipleProfiles,
'name' => $activeProfileName,
'photo' => $activeProfilePhoto,
'role' => $activeProfileRoleLabel,
]);
@endphp
@if($hasMultipleProfiles && $activeProfileName)
@php
$photoUrl = $activeProfilePhoto ? \Illuminate\Support\Facades\Storage::url($activeProfilePhoto) : null;
$translatedRole = $activeProfileRoleLabel ? __($activeProfileRoleLabel) : null;
\Log::info('REMINDER: rendering banner', ['name' => $activeProfileName, 'role' => $translatedRole]);
@endphp
<div class="bg-theme-surface border-b border-theme-border py-3 px-4 sm:px-6 lg:px-8">
<div class="max-w-7xl mx-auto flex items-center gap-3">
@if($photoUrl)
<img src="{{ $photoUrl }}" alt="{{ $activeProfileName }}" class="w-8 h-8 rounded-full object-cover flex-shrink-0">
@endif
<div class="flex-1">
<div class="text-sm text-theme-muted">{{ __('Active profile') }}</div>
<div class="flex items-center gap-2">
<span class="font-semibold text-theme-primary text-sm">{{ $activeProfileName }}</span>
@if($translatedRole)
<span class="text-xs text-theme-secondary bg-theme-background px-2 py-1 rounded">{{ $translatedRole }}</span>
@endif
</div>
</div>
</div>
</div>
@else
@php
\Log::info('REMINDER: not rendering - no multiple profiles or no name', [
'hasMultiple' => $hasMultipleProfiles,
'hasName' => !empty($activeProfileName),
]);
@endphp
@endif