@props([ 'sidebar' => false, ]) @php $user = auth()->user(); $userName = $user?->name ?? 'Account'; $userEmail = $user?->email ?? ''; $userInitial = strtoupper(mb_substr($user?->name ?: ($user?->email ?: 'A'), 0, 1)); @endphp
$sidebar]) x-data="{ open: false, appearanceOpen: false, theme: localStorage.getItem('theme') === 'purple' ? 'custom' : (localStorage.getItem('theme') || 'dark'), pageWidth: localStorage.getItem('pageWidth') || 'full', themeColor: localStorage.getItem('themeColor') || '#6b16ed', themeColorFrame: null, avatarUrl: @js($user?->avatar_path ? route('profile.avatar', ['v' => $user->updated_at->timestamp]) : null), setTheme(type, closeMenu = true) { this.theme = type; localStorage.setItem('theme', type); if (closeMenu) { this.appearanceOpen = false; this.open = false; } const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches; const isDark = type === 'dark' || type === 'custom' || (type === 'system' && prefersDark); document.documentElement.classList.toggle('dark', isDark); document.documentElement.dataset.theme = type === 'custom' ? 'custom' : (isDark ? 'dark' : 'light'); document.documentElement.style.setProperty('--theme-base-color', localStorage.themeColor || '#6b16ed'); document.documentElement.style.setProperty('--theme-accent-foreground', window.themeAccentForeground(this.themeColor)); document.querySelector('meta[name=theme-color]')?.setAttribute('content', isDark ? '#101010' : '#ffffff'); }, setWidth(width) { this.pageWidth = width; localStorage.setItem('pageWidth', width); window.dispatchEvent(new CustomEvent('page-width-changed', { detail: width })); }, previewThemeColor(color) { this.themeColor = color; if (this.theme !== 'custom') { this.theme = 'custom'; document.documentElement.classList.add('dark'); document.documentElement.dataset.theme = 'custom'; } if (this.themeColorFrame) { return; } this.themeColorFrame = requestAnimationFrame(() => { document.documentElement.style.setProperty('--theme-base-color', this.themeColor); document.documentElement.style.setProperty('--theme-accent-foreground', window.themeAccentForeground(this.themeColor)); this.themeColorFrame = null; }); }, saveThemeColor(color) { this.previewThemeColor(color); localStorage.setItem('themeColor', color); localStorage.setItem('theme', 'custom'); }, }" @avatar-updated.window="avatarUrl = $event.detail.url" @keydown.escape.window="open = false; appearanceOpen = false" @click.outside="open = false; appearanceOpen = false">
! $sidebar, 'bottom-full! left-0! right-auto! top-auto! mb-1!' => $sidebar, 'origin-bottom-left' => $sidebar, 'origin-top-right' => ! $sidebar, ])>
{{ $userName }}
{{ $userEmail }}
Profile
@foreach ([ ['value' => 'light', 'label' => 'Light'], ['value' => 'system', 'label' => 'System'], ['value' => 'dark', 'label' => 'Dark'], ['value' => 'custom', 'label' => 'Custom'], ] as $option) @if ($option['value'] === 'custom')
Custom
@else @endif @endforeach
Page width
@foreach ([ ['value' => 'full', 'label' => 'Full width'], ['value' => 'centered', 'label' => 'Centered'], ] as $option) @endforeach
Documentation
Feedback
@if (isSubscribed() || !isCloud()) Sponsor us @endif
@csrf