mirror of
https://github.com/Since-3/Kuma.git
synced 2026-10-12 20:51:18 +00:00
added filtering for trainers
This commit is contained in:
parent
5c4d76a281
commit
dd9729dd55
2 changed files with 8 additions and 5 deletions
|
|
@ -51,7 +51,7 @@ interface CourseFilterProps {
|
|||
priceRangeMin: number;
|
||||
priceRangeMax: number;
|
||||
uniqueSports: string[];
|
||||
uniqueTrainers: string[];
|
||||
uniqueTrainers: { value: string; label: string }[];
|
||||
uniqueRooms: string[];
|
||||
|
||||
// callback when filters are applied
|
||||
|
|
@ -206,8 +206,8 @@ const CourseFilter: React.FC<CourseFilterProps> = ({
|
|||
>
|
||||
<option value="all">Alle</option>
|
||||
{uniqueTrainers.map((trainer) => (
|
||||
<option key={trainer} value={trainer}>
|
||||
{trainer}
|
||||
<option key={trainer.value} value={trainer.value}>
|
||||
{trainer.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -369,8 +369,11 @@ const CourseListView = ({ canCreate, canEdit, canDelete }: CourseListViewProps)
|
|||
// Get unique sports for filter
|
||||
const uniqueSports = Array.from(new Set(courses.flatMap((c) => c.sport)));
|
||||
|
||||
// Get unique trainers for filter (flatten trainers arrays)
|
||||
const uniqueTrainers = Array.from(new Set(courses.flatMap((c) => c.trainers)));
|
||||
// Get unique trainers for filter (flatten trainer UIDs, map to labels)
|
||||
const uniqueTrainers = Array.from(new Set(courses.flatMap((c) => c.trainers))).map((uid) => ({
|
||||
value: uid,
|
||||
label: trainersMap[uid]?.label ?? uid,
|
||||
}));
|
||||
|
||||
// Get unique rooms for filter (using room names from roomsMap)
|
||||
const uniqueRooms = Array.from(new Set(courses.map((c) => roomsMap[c.room] || c.room)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue