Implement availability filters in Content and ProductList components to enhance product filtering functionality. Active filters for "auf Lager", "Neu", and "Bald verfügbar" are now dynamically displayed based on product availability, improving user experience and filtering accuracy.
This commit is contained in:
@@ -192,6 +192,34 @@ class ProductList extends Component {
|
||||
order: { xs: 2, sm: 1 },
|
||||
px: { xs: 1, sm: 0 }
|
||||
}}>
|
||||
{this.props.activeAvailabilityFilters && this.props.activeAvailabilityFilters.map((filter,index) => (
|
||||
<Chip
|
||||
size="medium"
|
||||
key={`availability-${index}`}
|
||||
label={filter.name}
|
||||
onClick={() => {
|
||||
if (filter.id === '1') {
|
||||
// Add "auf Lager" filter by setting the sessionStorage item to '1'
|
||||
sessionStorage.setItem('filter_availability', '1');
|
||||
} else {
|
||||
// Remove "Neu" or "Bald verfügbar" filters
|
||||
removeSessionSetting(`filter_availability_${filter.id}`);
|
||||
}
|
||||
this.props.onFilterChange();
|
||||
}}
|
||||
onDelete={() => {
|
||||
if (filter.id === '1') {
|
||||
// Add "auf Lager" filter by setting the sessionStorage item to '1'
|
||||
sessionStorage.setItem('filter_availability', '1');
|
||||
} else {
|
||||
// Remove "Neu" or "Bald verfügbar" filters
|
||||
removeSessionSetting(`filter_availability_${filter.id}`);
|
||||
}
|
||||
this.props.onFilterChange();
|
||||
}}
|
||||
clickable
|
||||
/>
|
||||
))}
|
||||
{this.props.activeAttributeFilters.map((filter,index) => (
|
||||
<Chip
|
||||
size="medium"
|
||||
@@ -224,6 +252,7 @@ class ProductList extends Component {
|
||||
clickable
|
||||
/>
|
||||
))}
|
||||
|
||||
</Box>
|
||||
|
||||
<Box sx={{
|
||||
|
||||
Reference in New Issue
Block a user