feat: sidebar + top bar game layout with dark crime theme

This commit is contained in:
Doar Mihai
2026-06-28 02:58:28 +03:00
parent 2a6c495d87
commit 195688da25
3 changed files with 143 additions and 181 deletions
@@ -1,48 +1,32 @@
@php @php $character = auth()->user()->character; @endphp
$character = auth()->user()->character; <div class="flex items-center space-x-3 text-sm">
@endphp {{-- HP --}}
<div class="flex items-center space-x-1 bg-syndicate-800 border border-syndicate-700 rounded px-2 py-1">
<span class="text-red-400">❤</span>
<span class="text-gray-300">{{ $character->health }}<span class="text-gray-600">/{{ $character->max_health }}</span></span>
</div>
<div class="flex items-center space-x-4 text-sm"> {{-- Energy --}}
<!-- Energy Bar --> <div class="flex items-center space-x-1 bg-syndicate-800 border border-syndicate-700 rounded px-2 py-1">
<div class="flex items-center space-x-2">
<span class="text-yellow-400">⚡</span> <span class="text-yellow-400">⚡</span>
<div class="w-20 bg-gray-600 rounded-full h-2"> <span class="text-gray-300">{{ $character->energy }}<span class="text-gray-600">/{{ $character->max_energy }}</span></span>
<div
class="bg-yellow-400 h-2 rounded-full transition-all duration-300"
style="width: {{ $character->energy_percentage }}%"
></div>
</div>
<span>{{ $character->energy }}/{{ $character->max_energy }}</span>
</div> </div>
<!-- Health Bar --> {{-- Cash --}}
<div class="flex items-center space-x-2"> <div class="flex items-center space-x-1 bg-syndicate-800 border border-syndicate-700 rounded px-2 py-1">
<span class="text-red-400">❤️</span> <span class="text-gold-400">$</span>
<div class="w-20 bg-gray-600 rounded-full h-2"> <span class="text-gray-300">{{ number_format($character->money) }}</span>
<div
class="bg-red-400 h-2 rounded-full transition-all duration-300"
style="width: {{ $character->health_percentage }}%"
></div>
</div>
<span>{{ $character->health }}/{{ $character->max_health }}</span>
</div> </div>
<!-- Money --> {{-- Level --}}
<div class="flex items-center space-x-1"> <div class="bg-syndicate-700 text-gray-300 rounded px-2 py-1 text-xs font-medium">
<span class="text-green-400">💰</span> Lv.{{ $character->level }}
<span>${{ number_format($character->money) }}</span>
</div> </div>
<!-- Level --> {{-- Non-active status badge --}}
<div class="flex items-center space-x-1"> @if($character->status !== \App\Enums\CharacterStatus::ACTIVE)
<span class="text-blue-400">📈</span> <span class="px-2 py-1 text-xs rounded {{ $character->status->color() }}">
<span>Lv. {{ $character->level }}</span> {{ $character->status->label() }}
</div>
<!-- Status -->
@if($character->status !== 'active')
<span class="px-2 py-1 text-xs rounded {{ $character->status === 'in_hospital' ? 'bg-red-500' : 'bg-yellow-500' }}">
{{ ucfirst(str_replace('_', ' ', $character->status)) }}
</span> </span>
@endif @endif
</div> </div>
+62 -46
View File
@@ -3,60 +3,76 @@
@section('title', config('game.name', 'The Crime Syndicate') . ' - ' . ($title ?? 'Game')) @section('title', config('game.name', 'The Crime Syndicate') . ' - ' . ($title ?? 'Game'))
@section('content') @section('content')
<!-- Game Header --> <div class="flex flex-col min-h-screen">
<header class="bg-gray-800 text-white shadow">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> {{-- TOP BAR --}}
<div class="flex justify-between items-center h-16"> <header class="bg-syndicate-900 border-b border-syndicate-700 h-14 flex items-center px-6 flex-shrink-0 z-10">
<!-- Logo --> {{-- Logo --}}
<div class="flex-shrink-0 flex items-center"> <a href="{{ route('game.dashboard') }}" class="font-display font-bold text-xl text-crime-400 uppercase tracking-widest mr-8 flex-shrink-0">
<a href="{{ route('game.dashboard') }}" class="text-xl font-bold"> {{ config('game.name', 'The Crime Syndicate') }}
{{ config('game.name', 'The Crime Syndicate') }} </a>
{{-- Stats bar --}}
<div class="flex-1 flex items-center justify-center space-x-4">
@if(auth()->check() && auth()->user()->character)
@include('game.partials.stats-bar')
@endif
</div>
{{-- User menu --}}
<div class="flex items-center space-x-3 flex-shrink-0">
<span class="text-sm text-gray-400">{{ auth()->user()->name ?? '' }}</span>
<div x-data="{ open: false }" class="relative">
<button @click="open = !open" class="flex items-center text-gray-400 hover:text-gray-100 transition">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" />
</svg>
</button>
<div x-show="open" @click.away="open = false"
class="absolute right-0 mt-2 w-48 bg-syndicate-800 border border-syndicate-700 rounded-lg shadow-xl z-50">
<a href="{{ route('profile.edit') }}" class="block px-4 py-2 text-sm text-gray-300 hover:bg-syndicate-700 hover:text-gray-100 rounded-t-lg transition">
Settings
</a> </a>
</div> <form method="POST" action="{{ route('logout') }}">
@csrf
<!-- Character Stats --> <button type="submit" class="w-full text-left px-4 py-2 text-sm text-gray-300 hover:bg-syndicate-700 hover:text-gray-100 rounded-b-lg transition">
<div class="flex items-center space-x-4"> Log Out
@if(auth()->check() && auth()->user()->character) </button>
@include('game.partials.stats-bar') </form>
@endif
</div>
<!-- User Menu -->
<div class="flex items-center">
@include('layouts.navigation')
</div> </div>
</div> </div>
</div> </div>
</header> </header>
<!-- Flash Messages --> {{-- BODY: sidebar + content --}}
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4"> <div class="flex flex-1">
@if(session('success'))
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded mb-4" role="alert">
<strong class="font-bold">Success!</strong>
<span class="block sm:inline">{{ session('success') }}</span>
</div>
@endif
@if(session('error')) {{-- SIDEBAR --}}
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4" role="alert"> @include('layouts.navigation')
<strong class="font-bold">Error!</strong>
<span class="block sm:inline">{{ session('error') }}</span> {{-- CONTENT --}}
</div> <main class="flex-1 bg-syndicate-950 p-6 overflow-auto">
@endif
{{-- Flash messages --}}
@if(session('success'))
<div class="mb-4 px-4 py-3 bg-green-900/40 border border-green-700 text-green-400 rounded-lg text-sm">
{{ session('success') }}
</div>
@endif
@if(session('error'))
<div class="mb-4 px-4 py-3 bg-red-900/40 border border-red-800 text-red-400 rounded-lg text-sm">
{{ session('error') }}
</div>
@endif
@yield('game-content')
</main>
</div> </div>
<!-- Main Content --> {{-- FOOTER --}}
<main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6"> <footer class="bg-syndicate-900 border-t border-syndicate-700 py-3 text-center text-xs text-gray-600">
@yield('game-content') &copy; {{ date('Y') }} {{ config('game.name', 'The Crime Syndicate') }} &mdash; v{{ config('game.version', '1.0.0') }}
</main>
<!-- Game Footer -->
<footer class="bg-gray-800 text-white mt-auto">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4">
<div class="text-center text-sm text-gray-400">
&copy; {{ date('Y') }} {{ config('game.name', 'The Crime Syndicate') }} - v{{ config('game.version', '1.0.0') }}
</div>
</div>
</footer> </footer>
</div>
@endsection @endsection
+59 -97
View File
@@ -1,100 +1,62 @@
<nav x-data="{ open: false }" class="bg-white border-b border-gray-100"> <aside class="bg-syndicate-900 border-r border-syndicate-700 w-56 flex-shrink-0 flex flex-col">
<!-- Primary Navigation Menu --> <nav class="flex-1 py-4">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> <ul class="space-y-1 px-2">
<div class="flex justify-between h-16"> <li>
<div class="flex"> <a href="{{ route('game.dashboard') }}"
<!-- Logo --> class="flex items-center space-x-3 px-3 py-2 rounded-lg text-sm transition
<div class="shrink-0 flex items-center"> {{ request()->routeIs('game.dashboard') ? 'border-l-2 border-crime-500 bg-syndicate-800 text-gray-100 pl-[10px]' : 'text-gray-400 hover:bg-syndicate-800 hover:text-gray-100' }}">
<a href="{{ route('dashboard') }}"> <span class="text-base">🏠</span>
<x-application-logo class="block h-9 w-auto fill-current text-gray-800" /> <span>Dashboard</span>
</a> </a>
</div> </li>
<li>
<a href="{{ route('game.crimes.index') }}"
class="flex items-center space-x-3 px-3 py-2 rounded-lg text-sm transition
{{ request()->routeIs('game.crimes.*') ? 'border-l-2 border-crime-500 bg-syndicate-800 text-gray-100 pl-[10px]' : 'text-gray-400 hover:bg-syndicate-800 hover:text-gray-100' }}">
<span class="text-base">🎯</span>
<span>Crimes</span>
</a>
</li>
<li>
<a href="{{ route('game.inventory.index') }}"
class="flex items-center space-x-3 px-3 py-2 rounded-lg text-sm transition
{{ request()->routeIs('game.inventory.*') ? 'border-l-2 border-crime-500 bg-syndicate-800 text-gray-100 pl-[10px]' : 'text-gray-400 hover:bg-syndicate-800 hover:text-gray-100' }}">
<span class="text-base">🎒</span>
<span>Inventory</span>
</a>
</li>
<li>
<a href="{{ route('game.character.show') }}"
class="flex items-center space-x-3 px-3 py-2 rounded-lg text-sm transition
{{ request()->routeIs('game.character.show') ? 'border-l-2 border-crime-500 bg-syndicate-800 text-gray-100 pl-[10px]' : 'text-gray-400 hover:bg-syndicate-800 hover:text-gray-100' }}">
<span class="text-base">👤</span>
<span>Profile</span>
</a>
</li>
<!-- Navigation Links --> @if(auth()->check() && auth()->user()->character)
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex"> @php $charStatus = auth()->user()->character->status; @endphp
<x-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
{{ __('Dashboard') }}
</x-nav-link>
</div>
</div>
<!-- Settings Dropdown --> @if($charStatus === \App\Enums\CharacterStatus::IN_HOSPITAL)
<div class="hidden sm:flex sm:items-center sm:ms-6"> <li class="pt-2 border-t border-syndicate-700 mt-2">
<x-dropdown align="right" width="48"> <a href="{{ route('game.hospital') }}"
<x-slot name="trigger"> class="flex items-center space-x-3 px-3 py-2 rounded-lg text-sm transition border-l-2 border-red-500 bg-syndicate-800 text-red-400 pl-[10px]">
<button class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 bg-white hover:text-gray-700 focus:outline-none transition ease-in-out duration-150"> <span class="text-base">🏥</span>
<div>{{ Auth::user()->name }}</div> <span>Hospital</span>
</a>
</li>
@endif
<div class="ms-1"> @if($charStatus === \App\Enums\CharacterStatus::IN_JAIL)
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> <li class="pt-2 border-t border-syndicate-700 mt-2">
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" /> <a href="{{ route('game.jail') }}"
</svg> class="flex items-center space-x-3 px-3 py-2 rounded-lg text-sm transition border-l-2 border-yellow-500 bg-syndicate-800 text-yellow-400 pl-[10px]">
</div> <span class="text-base">🚔</span>
</button> <span>Jail</span>
</x-slot> </a>
</li>
<x-slot name="content"> @endif
<x-dropdown-link :href="route('profile.edit')"> @endif
{{ __('Profile') }} </ul>
</x-dropdown-link> </nav>
</aside>
<!-- Authentication -->
<form method="POST" action="{{ route('logout') }}">
@csrf
<x-dropdown-link :href="route('logout')"
onclick="event.preventDefault();
this.closest('form').submit();">
{{ __('Log Out') }}
</x-dropdown-link>
</form>
</x-slot>
</x-dropdown>
</div>
<!-- Hamburger -->
<div class="-me-2 flex items-center sm:hidden">
<button @click="open = ! open" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 focus:text-gray-500 transition duration-150 ease-in-out">
<svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
<path :class="{'hidden': open, 'inline-flex': ! open }" class="inline-flex" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
<path :class="{'hidden': ! open, 'inline-flex': open }" class="hidden" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
</div>
</div>
<!-- Responsive Navigation Menu -->
<div :class="{'block': open, 'hidden': ! open}" class="hidden sm:hidden">
<div class="pt-2 pb-3 space-y-1">
<x-responsive-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
{{ __('Dashboard') }}
</x-responsive-nav-link>
</div>
<!-- Responsive Settings Options -->
<div class="pt-4 pb-1 border-t border-gray-200">
<div class="px-4">
<div class="font-medium text-base text-gray-800">{{ Auth::user()->name }}</div>
<div class="font-medium text-sm text-gray-500">{{ Auth::user()->email }}</div>
</div>
<div class="mt-3 space-y-1">
<x-responsive-nav-link :href="route('profile.edit')">
{{ __('Profile') }}
</x-responsive-nav-link>
<!-- Authentication -->
<form method="POST" action="{{ route('logout') }}">
@csrf
<x-responsive-nav-link :href="route('logout')"
onclick="event.preventDefault();
this.closest('form').submit();">
{{ __('Log Out') }}
</x-responsive-nav-link>
</form>
</div>
</div>
</div>
</nav>