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
$character = auth()->user()->character;
@endphp
@php $character = auth()->user()->character; @endphp
<div class="flex items-center space-x-3 text-sm">
{{-- 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 Bar -->
<div class="flex items-center space-x-2">
{{-- Energy --}}
<div class="flex items-center space-x-1 bg-syndicate-800 border border-syndicate-700 rounded px-2 py-1">
<span class="text-yellow-400">⚡</span>
<div class="w-20 bg-gray-600 rounded-full h-2">
<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>
<span class="text-gray-300">{{ $character->energy }}<span class="text-gray-600">/{{ $character->max_energy }}</span></span>
</div>
<!-- Health Bar -->
<div class="flex items-center space-x-2">
<span class="text-red-400">❤️</span>
<div class="w-20 bg-gray-600 rounded-full h-2">
<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>
{{-- Cash --}}
<div class="flex items-center space-x-1 bg-syndicate-800 border border-syndicate-700 rounded px-2 py-1">
<span class="text-gold-400">$</span>
<span class="text-gray-300">{{ number_format($character->money) }}</span>
</div>
<!-- Money -->
<div class="flex items-center space-x-1">
<span class="text-green-400">💰</span>
<span>${{ number_format($character->money) }}</span>
{{-- Level --}}
<div class="bg-syndicate-700 text-gray-300 rounded px-2 py-1 text-xs font-medium">
Lv.{{ $character->level }}
</div>
<!-- Level -->
<div class="flex items-center space-x-1">
<span class="text-blue-400">📈</span>
<span>Lv. {{ $character->level }}</span>
</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)) }}
{{-- Non-active status badge --}}
@if($character->status !== \App\Enums\CharacterStatus::ACTIVE)
<span class="px-2 py-1 text-xs rounded {{ $character->status->color() }}">
{{ $character->status->label() }}
</span>
@endif
</div>
+63 -47
View File
@@ -3,60 +3,76 @@
@section('title', config('game.name', 'The Crime Syndicate') . ' - ' . ($title ?? 'Game'))
@section('content')
<!-- Game Header -->
<header class="bg-gray-800 text-white shadow">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between items-center h-16">
<!-- Logo -->
<div class="flex-shrink-0 flex items-center">
<a href="{{ route('game.dashboard') }}" class="text-xl font-bold">
{{ config('game.name', 'The Crime Syndicate') }}
<div class="flex flex-col min-h-screen">
{{-- TOP BAR --}}
<header class="bg-syndicate-900 border-b border-syndicate-700 h-14 flex items-center px-6 flex-shrink-0 z-10">
{{-- Logo --}}
<a href="{{ route('game.dashboard') }}" class="font-display font-bold text-xl text-crime-400 uppercase tracking-widest mr-8 flex-shrink-0">
{{ 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>
</div>
<!-- Character Stats -->
<div class="flex items-center space-x-4">
@if(auth()->check() && auth()->user()->character)
@include('game.partials.stats-bar')
@endif
</div>
<!-- User Menu -->
<div class="flex items-center">
@include('layouts.navigation')
<form method="POST" action="{{ route('logout') }}">
@csrf
<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">
Log Out
</button>
</form>
</div>
</div>
</div>
</header>
<!-- Flash Messages -->
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4">
@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'))
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4" role="alert">
<strong class="font-bold">Error!</strong>
<span class="block sm:inline">{{ session('error') }}</span>
</div>
@endif
{{-- BODY: sidebar + content --}}
<div class="flex flex-1">
{{-- SIDEBAR --}}
@include('layouts.navigation')
{{-- CONTENT --}}
<main class="flex-1 bg-syndicate-950 p-6 overflow-auto">
{{-- 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>
<!-- Main Content -->
<main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
@yield('game-content')
</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 class="bg-syndicate-900 border-t border-syndicate-700 py-3 text-center text-xs text-gray-600">
&copy; {{ date('Y') }} {{ config('game.name', 'The Crime Syndicate') }} &mdash; v{{ config('game.version', '1.0.0') }}
</footer>
</div>
@endsection
+59 -97
View File
@@ -1,100 +1,62 @@
<nav x-data="{ open: false }" class="bg-white border-b border-gray-100">
<!-- Primary Navigation Menu -->
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<div class="flex">
<!-- Logo -->
<div class="shrink-0 flex items-center">
<a href="{{ route('dashboard') }}">
<x-application-logo class="block h-9 w-auto fill-current text-gray-800" />
</a>
</div>
<aside class="bg-syndicate-900 border-r border-syndicate-700 w-56 flex-shrink-0 flex flex-col">
<nav class="flex-1 py-4">
<ul class="space-y-1 px-2">
<li>
<a href="{{ route('game.dashboard') }}"
class="flex items-center space-x-3 px-3 py-2 rounded-lg text-sm transition
{{ 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' }}">
<span class="text-base">🏠</span>
<span>Dashboard</span>
</a>
</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 -->
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
<x-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
{{ __('Dashboard') }}
</x-nav-link>
</div>
</div>
@if(auth()->check() && auth()->user()->character)
@php $charStatus = auth()->user()->character->status; @endphp
<!-- Settings Dropdown -->
<div class="hidden sm:flex sm:items-center sm:ms-6">
<x-dropdown align="right" width="48">
<x-slot name="trigger">
<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">
<div>{{ Auth::user()->name }}</div>
@if($charStatus === \App\Enums\CharacterStatus::IN_HOSPITAL)
<li class="pt-2 border-t border-syndicate-700 mt-2">
<a href="{{ route('game.hospital') }}"
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]">
<span class="text-base">🏥</span>
<span>Hospital</span>
</a>
</li>
@endif
<div class="ms-1">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
<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" />
</svg>
</div>
</button>
</x-slot>
<x-slot name="content">
<x-dropdown-link :href="route('profile.edit')">
{{ __('Profile') }}
</x-dropdown-link>
<!-- 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>
@if($charStatus === \App\Enums\CharacterStatus::IN_JAIL)
<li class="pt-2 border-t border-syndicate-700 mt-2">
<a href="{{ route('game.jail') }}"
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]">
<span class="text-base">🚔</span>
<span>Jail</span>
</a>
</li>
@endif
@endif
</ul>
</nav>
</aside>