From 24b5edba9f9169a0d9de34366b8071d2b779a4e2 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Mon, 4 Aug 2025 22:14:16 +0200 Subject: [PATCH] Remove age slider --- app/profiles/ProfileFilters.tsx | 57 +++++++++++++++++---------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/app/profiles/ProfileFilters.tsx b/app/profiles/ProfileFilters.tsx index 650c946..c5ce4a3 100644 --- a/app/profiles/ProfileFilters.tsx +++ b/app/profiles/ProfileFilters.tsx @@ -221,7 +221,7 @@ export function ProfileFilters({filters, onFilterChange, onShowFilters, onToggle Object.fromEntries(rangeConfig.map(({id}) => [id, undefined])) ); - function getSlider({id, name, min, max}: Range) { + function getSlider({id, name, min, max}: Range, showSlider: boolean = true) { const minStr = 'min' + capitalize(id); const maxStr = 'max' + capitalize(id); const minVal = minRange[id]; @@ -231,32 +231,33 @@ export function ProfileFilters({filters, onFilterChange, onShowFilters, onToggle return (
-
- - { - let [_min, _max] = value; - setMinVal((_min || min) > min ? _min : undefined); - setMaxVal((_max || max) < max ? _max : undefined); - }} - onChangeCommitted={(e, value) => { - let [_min, _max] = value; - onFilterChange(minStr, (_min || min) > min ? _min : undefined); - onFilterChange(maxStr, (_max || max) < max ? _max : undefined); - }} - valueLabelDisplay="auto" - min={min} - max={max} - sx={{ - color: '#3B82F6', - '& .MuiSlider-valueLabel': { - backgroundColor: '#3B82F6', - color: '#fff', - }, - }} - /> -
+ {showSlider && +
+ + { + let [_min, _max] = value; + setMinVal((_min || min) > min ? _min : undefined); + setMaxVal((_max || max) < max ? _max : undefined); + }} + onChangeCommitted={(e, value) => { + let [_min, _max] = value; + onFilterChange(minStr, (_min || min) > min ? _min : undefined); + onFilterChange(maxStr, (_max || max) < max ? _max : undefined); + }} + valueLabelDisplay="auto" + min={min} + max={max} + sx={{ + color: '#3B82F6', + '& .MuiSlider-valueLabel': { + backgroundColor: '#3B82F6', + color: '#fff', + }, + }} + /> +
}
{/**/} @@ -337,7 +338,7 @@ export function ProfileFilters({filters, onFilterChange, onShowFilters, onToggle
- {getSlider(rangeConfig[0])} + {getSlider(rangeConfig[0], false)} {dropdownConfig.map(({id, name}) => getDrowDown(id, name))} {getSlider(rangeConfig[1])}