mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-25 11:51:14 -05:00
Refactor: Convert park filters to multi-select
This commit is contained in:
@@ -18,9 +18,9 @@ import { FilterState, SortState } from './Parks';
|
||||
|
||||
const initialFilters: FilterState = {
|
||||
search: '',
|
||||
parkType: 'all',
|
||||
status: 'all',
|
||||
country: 'all',
|
||||
parkType: [],
|
||||
status: [],
|
||||
country: [],
|
||||
minRating: 0,
|
||||
maxRating: 5,
|
||||
minRides: 0,
|
||||
@@ -98,9 +98,9 @@ export default function OperatorParks() {
|
||||
park.location?.country?.toLowerCase().includes(searchTerm);
|
||||
if (!matchesSearch) return false;
|
||||
}
|
||||
if (filters.parkType !== 'all' && park.park_type !== filters.parkType) return false;
|
||||
if (filters.status !== 'all' && park.status !== filters.status) return false;
|
||||
if (filters.country !== 'all' && park.location?.country !== filters.country) return false;
|
||||
if (filters.parkType.length > 0 && !filters.parkType.includes(park.park_type)) return false;
|
||||
if (filters.status.length > 0 && !filters.status.includes(park.status)) return false;
|
||||
if (filters.country.length > 0 && !filters.country.includes(park.location?.country || '')) return false;
|
||||
|
||||
const rating = park.average_rating || 0;
|
||||
if (rating < filters.minRating || rating > filters.maxRating) return false;
|
||||
|
||||
Reference in New Issue
Block a user