Merge remote-tracking branch 'upstream/develop' into user-profile-info

This commit is contained in:
IsWaffle 2024-09-11 14:52:24 -04:00
commit 2179da3c4d
6 changed files with 37 additions and 31 deletions

View File

@ -8,7 +8,6 @@ use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Facades\Cache;
use Livewire\Attributes\Computed;
use Livewire\Attributes\Session;
use Livewire\Attributes\Url;
use Livewire\Component;
use Livewire\WithPagination;
@ -21,28 +20,24 @@ class Index extends Component
* The search query value.
*/
#[Url]
#[Session]
public string $query = '';
/**
* The sort order value.
*/
#[Url]
#[Session]
public string $order = 'created';
/**
* The SPT versions filter value.
*/
#[Url]
#[Session]
public array $sptVersions = [];
/**
* The featured filter value.
*/
#[Url]
#[Session]
public string $featured = 'include';
/**
@ -102,9 +97,6 @@ class Index extends Component
$this->query = '';
$this->sptVersions = $this->getLatestMinorVersions()->pluck('version')->toArray();
$this->featured = 'include';
// Clear local storage
$this->dispatch('clear-filters');
}
/**

View File

@ -88,16 +88,19 @@ class ModListSection extends Component
'title' => __('Featured Mods'),
'mods' => $this->modsFeatured,
'versionScope' => 'latestVersion',
'link' => '/mods?featured=only',
],
[
'title' => __('Newest Mods'),
'mods' => $this->modsLatest,
'versionScope' => 'latestVersion',
'link' => '/mods',
],
[
'title' => __('Recently Updated Mods'),
'mods' => $this->modsUpdated,
'versionScope' => 'lastUpdatedVersion',
'link' => '/mods?order=updated',
],
];
}

View File

@ -23,7 +23,7 @@ class DatabaseSeeder extends Seeder
// how many of each "thing" to make during seeding
$userCount = 100;
$modCount = 300;
$modVersionCount = 500;
$modVersionCount = 3000;
// Create a few SPT versions.
$spt_versions = SptVersion::factory(30)->create();

View File

@ -1,10 +1,6 @@
@props(['mods', 'versionScope', 'title'])
@props(['mods', 'versionScope', 'title', 'link'])
<div class="mx-auto max-w-7xl px-4 pt-16 sm:px-6 lg:px-8">
{{--
TODO: The button-link should be dynamic based on the versionScope. Eg. Featured `View All` button should take
the user to the mods page with the `featured` query parameter set.
--}}
<x-page-content-title :title="$title" button-text="View All" button-link="/mods" />
<x-page-content-title :title="$title" button-text="View All" :button-link="$link" />
<x-mod-list :mods="$mods" :versionScope="$versionScope" />
</div>

View File

@ -3,5 +3,6 @@
'title' => $section['title'],
'mods' => $section['mods'],
'versionScope' => $section['versionScope'],
'link' => $section['link']
])
@endforeach

View File

@ -1,18 +1,32 @@
<p {{ $attributes->class(['text-slate-700 dark:text-gray-300 text-sm']) }}>
<span title="{{ __('Exactly') }} {{ $mod->downloads }}">{{ Number::downloads($mod->downloads) }} downloads</span>
@if(!is_null($mod->created_at))
<span>
&mdash; Created
<time datetime="{{ $mod->created_at->format('c') }}">
{{ Carbon::dynamicFormat($mod->created_at) }}
</time>
</span>
@elseif(!is_null($modVersion->updated_at))
<span>
&mdash; Updated
<time datetime="{{ $modVersion->updated_at->format('c') }}">
{{ Carbon::dynamicFormat($modVersion->updated_at) }}
</time>
</span>
@endif
<div class="flex items-end w-full text-sm">
<div class="flex items-end w-full">
<div class="flex items-center gap-1">
<svg width="20" height="20" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M21 8.5v9.25A3.25 3.25 0 0 1 17.75 21H6.25A3.25 3.25 0 0 1 3 17.75V8.5h18ZM7.25 15a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5ZM12 15a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5Zm-4.75-4.5a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5Zm4.75 0a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5Zm4.75 0a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5Zm1-7.5A3.25 3.25 0 0 1 21 6.25V7H3v-.75A3.25 3.25 0 0 1 6.25 3h11.5Z"/>
</svg>
<span>
@if(!is_null($mod->updated_at))
<time datetime="{{ $modVersion->updated_at->format('c') }}">
{{ Carbon::dynamicFormat($modVersion->updated_at) }}
</time>
@elseif(!is_null($mod->created_at))
<time datetime="{{ $modVersion->created_at->format('c') }}">
{{ Carbon::dynamicFormat($modVersion->created_at) }}
</time>
@else
N/A
@endif
</span>
</div>
</div>
<div class="flex justify-end items-center gap-1">
<span title="{{ __('Exactly') }} {{ $mod->downloads }}">
{{ Number::downloads($mod->downloads) }}
</span>
<svg width="20" height="20" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M5.25 20.5h13.498a.75.75 0 0 1 .101 1.493l-.101.007H5.25a.75.75 0 0 1-.102-1.494l.102-.006h13.498H5.25Zm6.633-18.498L12 1.995a1 1 0 0 1 .993.883l.007.117v12.59l3.294-3.293a1 1 0 0 1 1.32-.083l.094.084a1 1 0 0 1 .083 1.32l-.083.094-4.997 4.996a1 1 0 0 1-1.32.084l-.094-.083-5.004-4.997a1 1 0 0 1 1.32-1.498l.094.083L11 15.58V2.995a1 1 0 0 1 .883-.993L12 1.995l-.117.007Z"/>
</svg>
</div>
</div>
</p>