Add public community lists browse page

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mark
2026-05-31 23:43:45 +03:00
co-authored by Claude Sonnet 4.6
parent a583a13da1
commit 0eab3e8dbf
4 changed files with 81 additions and 0 deletions
+12
View File
@@ -10,6 +10,18 @@ use Illuminate\Support\Str;
class ListController extends Controller
{
public function community()
{
$lists = UserList::where('is_public', true)
->with('user')
->withCount('listGames')
->latest()
->paginate(24);
return view('lists.community', compact('lists'));
}
public function index()
{
$lists = auth()->user()->lists()->withCount('listGames')->latest()->get();
+2
View File
@@ -45,6 +45,7 @@
<a href="{{ route('games.index') }}" class="text-sm text-slate-400 hover:text-slate-200 transition-colors">Browse</a>
<a href="{{ route('games.top-rated') }}" class="text-sm text-slate-400 hover:text-slate-200 transition-colors">Top Rated</a>
<a href="{{ route('games.new-releases') }}" class="text-sm text-slate-400 hover:text-slate-200 transition-colors">New Releases</a>
<a href="{{ route('lists.community') }}" class="text-sm text-slate-400 hover:text-slate-200 transition-colors">Lists</a>
@auth
<a href="{{ route('activity.index') }}" class="text-sm text-slate-400 hover:text-slate-200 transition-colors">Activity</a>
@endauth
@@ -187,6 +188,7 @@
<a href="{{ route('games.index') }}" class="hover:text-slate-300 transition-colors">Browse</a>
<a href="{{ route('games.top-rated') }}" class="hover:text-slate-300 transition-colors">Top Rated</a>
<a href="{{ route('games.new-releases') }}" class="hover:text-slate-300 transition-colors">New Releases</a>
<a href="{{ route('lists.community') }}" class="hover:text-slate-300 transition-colors">Lists</a>
<a href="{{ route('api.docs') }}" class="hover:text-slate-300 transition-colors">Developers</a>
</div>
</div>
+66
View File
@@ -0,0 +1,66 @@
@extends('layouts.app')
@php use Illuminate\Support\Str; @endphp
@section('title', 'Community Lists — GameLog')
@section('description', 'Browse public game lists created by the GameLog community.')
@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">Community Lists</h1>
<p class="text-sm text-slate-500 mt-1">Public game lists from GameLog members</p>
</div>
@auth
<a href="{{ route('lists.index') }}"
class="px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white text-sm font-semibold rounded-lg transition-colors">
My Lists
</a>
@endauth
</div>
@if($lists->isEmpty())
<div class="text-center py-20">
<svg class="mx-auto w-12 h-12 text-slate-700 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"/>
</svg>
<p class="text-slate-500 mb-2">No public lists yet.</p>
@guest
<p class="text-slate-600 text-sm"><a href="{{ route('register') }}" class="text-purple-400 hover:text-purple-300 transition-colors">Sign up</a> and create the first one!</p>
@endguest
</div>
@else
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
@foreach($lists as $list)
<a href="{{ route('lists.show', $list) }}"
class="group block bg-[#16161d] border border-white/5 rounded-lg p-5 hover:border-purple-500/50 transition-all">
<h2 class="font-semibold text-white group-hover:text-purple-300 transition-colors line-clamp-1 mb-1">
{{ $list->title }}
</h2>
@if($list->description)
<p class="text-sm text-slate-500 line-clamp-2 mb-3">{{ $list->description }}</p>
@else
<div class="mb-3"></div>
@endif
<div class="flex items-center justify-between mt-auto">
<span class="text-xs text-slate-600">
{{ $list->list_games_count }} {{ Str::plural('game', $list->list_games_count) }}
</span>
@if($list->user)
<span class="text-xs text-purple-400 truncate max-w-[8rem]">
{{ $list->user->username }}
</span>
@endif
</div>
</a>
@endforeach
</div>
<div class="mt-8">
{{ $lists->links() }}
</div>
@endif
</div>
@endsection
+1
View File
@@ -49,6 +49,7 @@ Route::middleware('auth')->group(function () {
});
// Lists
Route::get('/community/lists', [\App\Http\Controllers\ListController::class, 'community'])->name('lists.community');
Route::get('/lists', [\App\Http\Controllers\ListController::class, 'index'])->name('lists.index')->middleware('auth');
Route::post('/lists', [\App\Http\Controllers\ListController::class, 'store'])->name('lists.store')->middleware('auth');
Route::get('/lists/{list:slug}', [\App\Http\Controllers\ListController::class, 'show'])->name('lists.show');