Files
cleargame/resources/views/forum/index.blade.php
T
2026-02-22 20:02:34 +02:00

105 lines
5.1 KiB
PHP

@extends('layouts.app')
@section('title', 'Forum - ClearGame')
@section('content')
<div class="container">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h2 fw-bold gradient-text">Forum</h1>
@auth
@if(auth()->user()->hasRole('admin'))
<a href="{{ route('forum.categories.create') }}" class="btn btn-gradient">
<i class="fas fa-plus me-1"></i> New Category
</a>
@endif
@endauth
</div>
@if($categories->isEmpty())
<div class="card bg-dark text-white">
<div class="card-body text-center py-5">
<i class="fas fa-comments fa-3x text-muted mb-3"></i>
<h3 class="text-muted">No categories yet</h3>
<p class="text-muted">Check back later for forum discussions.</p>
</div>
</div>
@else
<div class="card bg-dark text-white mb-4">
<div class="card-header">
<h5 class="mb-0">Categories</h5>
</div>
<div class="list-group list-group-flush">
@foreach($categories as $category)
<div class="list-group-item bg-dark text-white border-secondary">
<div class="row align-items-center">
<div class="col-md-7">
<div class="d-flex align-items-center">
<div class="me-3">
<i class="fas fa-folder fa-2x text-primary"></i>
</div>
<div>
<h5 class="mb-1">
<a href="{{ route('forum.categories.show', $category) }}" class="text-white text-decoration-none">
{{ $category->name }}
</a>
</h5>
<p class="text-muted mb-0">{{ $category->description }}</p>
</div>
</div>
</div>
<div class="col-md-2 text-center">
<div class="text-muted">
<span class="d-block">{{ $category->threads->count() }}</span>
<small>Threads</small>
</div>
</div>
<div class="col-md-3">
@if($category->threads->count() > 0)
@php
$latestThread = $category->threads()->orderBy('last_activity_at', 'desc')->first();
@endphp
<div class="small">
<a href="{{ route('forum.threads.show', $latestThread) }}" class="text-white">
{{ Str::limit($latestThread->title, 30) }}
</a>
<div class="text-muted">
<small>
<i class="far fa-clock me-1"></i> {{ $latestThread->last_activity_at->diffForHumans() }}
</small>
</div>
</div>
@else
<div class="text-muted small">No threads yet</div>
@endif
</div>
</div>
</div>
@endforeach
</div>
</div>
@endif
<div class="card bg-dark text-white">
<div class="card-header">
<h5 class="mb-0">Forum Statistics</h5>
</div>
<div class="card-body">
<div class="row text-center">
<div class="col-md-4">
<h3 class="gradient-text">{{ \App\Models\ForumThread::count() }}</h3>
<p class="text-muted">Threads</p>
</div>
<div class="col-md-4">
<h3 class="gradient-text">{{ \App\Models\ForumTopic::count() }}</h3>
<p class="text-muted">Topics</p>
</div>
<div class="col-md-4">
<h3 class="gradient-text">{{ \App\Models\ForumPost::count() }}</h3>
<p class="text-muted">Posts</p>
</div>
</div>
</div>
</div>
</div>
@endsection