Filter Count

A count of the number of filters currently applied is now displayed.
This commit is contained in:
Refringe 2024-08-15 23:05:48 -04:00
parent 6b889d1d01
commit 41714f337f
Signed by: Refringe
SSH Key Fingerprint: SHA256:t865XsQpfTeqPRBMN2G6+N8wlDjkgUCZF3WGW6O9N/k
2 changed files with 18 additions and 2 deletions

View File

@ -87,8 +87,24 @@ class Index extends Component
public function resetFilters(): void
{
$this->query = '';
$this->order = 'created';
$this->sptVersion = $this->getLatestMinorVersions()->pluck('version')->toArray();
$this->featured = 'include';
}
/**
* Compute the count of active filters.
*/
public function getFilterCountProperty(): int
{
$count = 0;
if ($this->query !== '') {
$count++;
}
if ($this->featured !== 'include') {
$count++;
}
$count += count($this->sptVersion);
return $count;
}
}

View File

@ -15,7 +15,7 @@
<svg class="mr-2 h-5 w-5 flex-none text-gray-400 group-hover:text-gray-500 dark:text-gray-600" aria-hidden="true" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M2.628 1.601C5.028 1.206 7.49 1 10 1s4.973.206 7.372.601a.75.75 0 01.628.74v2.288a2.25 2.25 0 01-.659 1.59l-4.682 4.683a2.25 2.25 0 00-.659 1.59v3.037c0 .684-.31 1.33-.844 1.757l-1.937 1.55A.75.75 0 018 18.25v-5.757a2.25 2.25 0 00-.659-1.591L2.659 6.22A2.25 2.25 0 012 4.629V2.34a.75.75 0 01.628-.74z" clip-rule="evenodd" />
</svg>
{{ __('Filters') }} {{-- // TODO: Ideally, we should have a count of the number of filters here: "5 Filters" --}}
{{ $this->filterCount }} {{ __('Filters') }}
</button>
<search class="relative group pl-6">