update version tab info

This commit is contained in:
IsWaffle 2024-07-22 10:16:53 -04:00
parent 75a7e15184
commit b429300b7b
2 changed files with 32 additions and 7 deletions

View File

@ -6,6 +6,7 @@ use App\Http\Requests\ModRequest;
use App\Http\Resources\ModResource; use App\Http\Resources\ModResource;
use App\Models\Mod; use App\Models\Mod;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Support\Facades\Log;
class ModController extends Controller class ModController extends Controller
{ {
@ -29,7 +30,12 @@ class ModController extends Controller
{ {
$mod = Mod::select() $mod = Mod::select()
->withTotalDownloads() ->withTotalDownloads()
->with(['latestSptVersion', 'users:id,name']) ->with([
'versions' => fn($query) => $query->orderByDesc('version'),
'latestSptVersion',
'users:id,name',
'license:id,name,link'
])
->with('license:id,name,link') ->with('license:id,name,link')
->find($modId); ->find($modId);

View File

@ -78,21 +78,40 @@
</div> </div>
{{-- tab panels --}} {{-- tab panels --}}
{{-- Description --}}
<div x-show="selectedTab === 'description'" <div x-show="selectedTab === 'description'"
class="user-markdown p-4 sm:p-6 bg-white dark:bg-gray-950 rounded-xl shadow-md dark:shadow-gray-950 drop-shadow-2xl"> class="user-markdown p-4 sm:p-6 bg-white dark:bg-gray-950 rounded-xl shadow-md dark:shadow-gray-950 drop-shadow-2xl">
{{-- The description below is safe to write directly because it has been run though HTMLPurifier during the import process. --}} {{-- The description below is safe to write directly because it has been run though HTMLPurifier during the import process. --}}
<p>{!! Str::markdown($mod->description) !!}</p> <p>{!! Str::markdown($mod->description) !!}</p>
</div> </div>
{{-- Versions --}}
<div x-show="selectedTab === 'versions'" <div x-show="selectedTab === 'versions'"
class="user-markdown p-4 sm:p-6 bg-white dark:bg-gray-950 rounded-xl shadow-md dark:shadow-gray-950 drop-shadow-2xl"> class="user-markdown p-4 sm:p-6 bg-white dark:bg-gray-950 rounded-xl shadow-md dark:shadow-gray-950 drop-shadow-2xl">
@for($i = 0;$i < $mod->versions->count(); $i++) @foreach($mod->versions as $version)
<div class="bg-gray-700"> @if(!$version->disabled)
<p>{{$mod->versions[$i]->id}}</p> <div class="bg-gray-800 rounded-xl mb-2">
<p>{{$mod->versions[$i]->version}}</p> <div class="border-b-2 border-gray-700">
<p>{{$mod->versions[$i]->description}}</p> <div class="p-4">
<div class="flex items-center justify-between">
<a class="text-2xl" href="{{ $version->link }}">
Version {{$version->version}}
</a>
<p class="text-gray-700">{{ Number::forhumans($version->downloads) }} Downloads</p>
</div> </div>
@endfor <div class="flex items-center justify-between text-gray-400">
<span>Created {{ \Carbon\Carbon::parse($version->created_at)->format("M d, h:m a") }}</span>
<span>Last Updated {{ \Carbon\Carbon::parse($version->updated_at)->format("M d, h:m a") }}</span>
</div> </div>
</div>
</div>
<div class="p-4">
<p>{{$version->description}}</p>
</div>
</div>
@endif
@endforeach
</div>
{{-- Comments --}}
<div x-show="selectedTab === 'comments'" <div x-show="selectedTab === 'comments'"
class="user-markdown p-4 sm:p-6 bg-white dark:bg-gray-950 rounded-xl shadow-md dark:shadow-gray-950 drop-shadow-2xl"> class="user-markdown p-4 sm:p-6 bg-white dark:bg-gray-950 rounded-xl shadow-md dark:shadow-gray-950 drop-shadow-2xl">
<p>The comments go here</p> <p>The comments go here</p>