clusev/resources/views/components/sidebar.blade.php

71 lines
4.6 KiB
PHP

@php
// Global "update available" cue for the Version nav item — a cache read only (no network).
$updateAvailable = app(\App\Services\ReleaseChecker::class)->updateAvailable();
@endphp
{{-- Fixed on desktop, off-canvas drawer on mobile/tablet (toggled by `nav` in the layout). --}}
<aside class="fixed inset-y-0 left-0 z-40 flex w-[272px] -translate-x-full flex-col border-r border-line bg-surface transition-transform duration-200 lg:translate-x-0"
:class="{ '!translate-x-0': nav }"
x-bind:inert="! nav && ! desktop"
aria-label="{{ __('shell.nav_aria') }}">
{{-- Brand --}}
<div class="flex h-14 shrink-0 items-center gap-2.5 border-b border-line px-4">
<span class="grid h-8 w-8 place-items-center rounded-md border border-accent/25 bg-accent/10 text-accent shadow-[0_0_18px_-2px_var(--color-accent)]">
<x-icon name="server" class="h-4 w-4" />
</span>
<span class="font-display text-lg font-semibold tracking-wide text-ink">Clus<span class="text-accent">e</span>v</span>
<button type="button" @click="nav = false"
class="ml-auto grid min-h-11 min-w-11 place-items-center rounded-md text-ink-3 hover:bg-raised hover:text-ink lg:hidden"
aria-label="{{ __('shell.menu_close') }}">
<x-icon name="x" class="h-5 w-5" />
</button>
</div>
{{-- Server switcher --}}
<div class="shrink-0 border-b border-line p-3">
<livewire:server-switcher />
</div>
{{-- Nav --}}
<nav class="flex-1 space-y-1 overflow-y-auto p-3">
<p class="px-3 pb-1 pt-2 font-mono text-[10px] uppercase tracking-widest text-ink-4">{{ __('shell.group_fleet') }}</p>
<x-nav-item icon="dashboard" href="/" :active="request()->is('/')">{{ __('shell.nav_dashboard') }}</x-nav-item>
<x-nav-item icon="server" href="/servers" :active="request()->is('servers*')">{{ __('shell.nav_servers') }}</x-nav-item>
<x-nav-item icon="cpu" href="/services" :active="request()->is('services*')">{{ __('shell.nav_services') }}</x-nav-item>
<x-nav-item icon="folder" href="/files" :active="request()->is('files*')">{{ __('shell.nav_files') }}</x-nav-item>
<x-nav-item icon="audit" href="/audit" :active="request()->is('audit*')">{{ __('shell.nav_audit') }}</x-nav-item>
<x-nav-item icon="lock" href="/wireguard" :active="request()->is('wireguard*')">{{ __('shell.nav_wireguard') }}</x-nav-item>
<x-nav-item icon="terminal" href="/terminal" :active="request()->is('terminal*')">{{ __('shell.nav_terminal') }}</x-nav-item>
<p class="px-3 pb-1 pt-3 font-mono text-[10px] uppercase tracking-widest text-ink-4">{{ __('shell.group_account') }}</p>
<x-nav-item icon="settings" href="/settings" :active="request()->is('settings*')">{{ __('shell.nav_settings') }}</x-nav-item>
<x-nav-item icon="shield" href="/system" :active="request()->is('system*')">{{ __('shell.nav_system') }}</x-nav-item>
<x-nav-item icon="tag" href="/versions" :active="request()->is('versions*')" :badge="$updateAvailable ? '1' : null">{{ __('shell.nav_versions') }}</x-nav-item>
@if (config('clusev.release_controls'))
<x-nav-item icon="tag" href="/release" :active="request()->is('release*')">
{{ __('release.nav') }}
</x-nav-item>
@endif
<x-nav-item icon="help-circle" href="/help" :active="request()->is('help*')">{{ __('shell.nav_help') }}</x-nav-item>
</nav>
{{-- User --}}
@php($u = auth()->user())
<div class="shrink-0 border-t border-line p-3">
<div class="flex items-center gap-1">
<a href="{{ route('settings') }}" wire:navigate class="flex min-w-0 flex-1 items-center gap-2.5 rounded-md px-2 py-1.5 transition-colors hover:bg-raised">
<span class="grid h-8 w-8 shrink-0 place-items-center rounded-full bg-raised font-mono text-xs text-ink-2">{{ strtoupper(substr($u?->name ?? 'U', 0, 2)) }}</span>
<span class="min-w-0 flex-1">
<span class="block truncate text-sm text-ink">{{ $u?->name ?? '—' }}</span>
<x-two-factor-badge :enabled="$u?->hasTwoFactorEnabled() ?? false" />
</span>
</a>
<form method="POST" action="{{ route('logout') }}" class="shrink-0">
@csrf
<button type="submit" class="grid min-h-11 min-w-11 place-items-center rounded-md text-ink-3 hover:bg-raised hover:text-ink" aria-label="{{ __('shell.logout') }}">
<x-icon name="logout" class="h-[18px] w-[18px]" />
</button>
</form>
</div>
</div>
</aside>