Core implementation: controllers, views, routes, models, import command

This commit is contained in:
Mark
2026-05-29 09:37:07 +03:00
parent 8e1fe4a2f5
commit 5813bc779a
24 changed files with 1361 additions and 37 deletions
+48
View File
@@ -0,0 +1,48 @@
@extends('layouts.app')
@section('title', ($user->username ?? $user->name) . "'s Library — GameLog")
@section('content')
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-10">
<div class="flex items-center justify-between mb-8">
<div>
<h1 class="text-2xl font-bold text-white">
<a href="{{ route('users.show', $user->username) }}" class="hover:text-purple-400 transition-colors">
{{ $user->username ?? $user->name }}
</a>'s Library
</h1>
</div>
</div>
{{-- Status Tabs --}}
<div class="flex flex-wrap gap-2 mb-8 border-b border-white/5 pb-4">
@php
$tabs = ['' => 'All', 'playing' => 'Playing', 'played' => 'Played', 'want_to_play' => 'Want to Play', 'on_hold' => 'On Hold', 'dropped' => 'Dropped'];
@endphp
@foreach($tabs as $tabStatus => $tabLabel)
<a href="{{ route('users.library', ['user' => $user->username, 'status' => $tabStatus ?: null]) }}"
class="px-4 py-2 rounded-lg text-sm font-medium transition-colors
{{ $status === $tabStatus || (!$status && !$tabStatus)
? 'bg-purple-600 text-white'
: 'text-slate-400 hover:text-slate-200 hover:bg-white/5' }}">
{{ $tabLabel }}
</a>
@endforeach
</div>
@if($entries->isEmpty())
<div class="text-center py-24 text-slate-500">
<p class="text-lg">No games here yet.</p>
</div>
@else
<div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-4">
@foreach($entries as $entry)
<x-game-card :game="$entry->game" />
@endforeach
</div>
<div class="mt-8">{{ $entries->links() }}</div>
@endif
</div>
@endsection
+71
View File
@@ -0,0 +1,71 @@
@extends('layouts.app')
@section('title', ($user->username ?? $user->name) . ' — GameLog')
@section('content')
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-10">
{{-- Profile Header --}}
<div class="flex items-start gap-6 mb-10">
@if($user->avatar)
<img src="{{ $user->avatar }}" class="w-20 h-20 rounded-full object-cover border-2 border-white/10" alt="">
@else
<div class="w-20 h-20 rounded-full bg-purple-700 flex items-center justify-center text-2xl font-bold text-white flex-shrink-0">
{{ strtoupper(substr($user->name, 0, 1)) }}
</div>
@endif
<div class="flex-1">
<h1 class="text-2xl font-bold text-white">{{ $user->username ?? $user->name }}</h1>
@if($user->username && $user->name !== $user->username)
<p class="text-slate-500 text-sm">{{ $user->name }}</p>
@endif
@if($user->bio)
<p class="text-slate-400 mt-2 max-w-xl">{{ $user->bio }}</p>
@endif
{{-- Stats --}}
<div class="flex flex-wrap gap-6 mt-4">
<div class="text-center">
<div class="text-xl font-bold text-white">{{ number_format($stats['total']) }}</div>
<div class="text-xs text-slate-500 uppercase tracking-wide">Games</div>
</div>
<div class="text-center">
<div class="text-xl font-bold text-white">{{ number_format($stats['played']) }}</div>
<div class="text-xs text-slate-500 uppercase tracking-wide">Played</div>
</div>
<div class="text-center">
<div class="text-xl font-bold text-white">{{ number_format($stats['playing']) }}</div>
<div class="text-xs text-slate-500 uppercase tracking-wide">Playing</div>
</div>
<div class="text-center">
<div class="text-xl font-bold text-white">{{ number_format($stats['want_to_play']) }}</div>
<div class="text-xs text-slate-500 uppercase tracking-wide">Want to Play</div>
</div>
</div>
</div>
<div class="flex gap-2">
<a href="{{ route('users.library', $user->username) }}"
class="px-4 py-2 border border-white/10 hover:border-white/20 text-slate-300 hover:text-white text-sm font-medium rounded-lg transition-colors">
View Library
</a>
</div>
</div>
{{-- Recently Played --}}
@if($recentlyPlayed->isNotEmpty())
<div>
<h2 class="text-lg font-semibold text-white mb-4">Recently Played</h2>
<div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-4">
@foreach($recentlyPlayed as $entry)
<x-game-card :game="$entry->game" />
@endforeach
</div>
</div>
@else
<p class="text-slate-500">No games tracked yet.</p>
@endif
</div>
@endsection