diff --git a/src/views/Chores/components/CustomFilterChips.jsx b/src/views/Chores/components/CustomFilterChips.jsx index 2024507..75911ba 100644 --- a/src/views/Chores/components/CustomFilterChips.jsx +++ b/src/views/Chores/components/CustomFilterChips.jsx @@ -5,7 +5,6 @@ import { Settings, Star, StarBorder, - Warning, } from '@mui/icons-material' import { Box, Chip, Menu, MenuItem, Tooltip, Typography } from '@mui/joy' import { useState } from 'react' @@ -79,122 +78,118 @@ const CustomFilterChips = ({ msOverflowStyle: 'none', // IE and Edge }} > - {sortedFilters.map(filter => { - const isActive = activeFilterId === filter.id - const hasWarning = !filter.isValid - const hasCustomColor = !!filter.color && !hasWarning - const textColor = hasCustomColor - ? getTextColorFromBackgroundColor(filter.color) - : undefined + {sortedFilters + .filter(f => f.isPinned) + .map(filter => { + const isActive = activeFilterId === filter.id + const hasWarning = !filter.isValid + const hasCustomColor = !!filter.color && !hasWarning + const textColor = hasCustomColor + ? getTextColorFromBackgroundColor(filter.color) + : undefined - return ( - 0 ? ` (${filter.overdueCount} overdue)` : ''}` - } - placement='bottom' - > -
!hasWarning && onFilterClick(filter.id)}> - handleContextMenu(e, filter)} - sx={{ - cursor: hasWarning ? 'not-allowed' : 'pointer', - transition: 'all 0.2s ease', - px: 1.5, - py: 0.5, - opacity: hasWarning ? 0.7 : isActive ? 1 : 0.85, - ...(hasCustomColor && { - backgroundColor: `${filter.color} !important`, - color: `${textColor} !important`, - '&:hover': { - backgroundColor: `${filter.color} !important`, - filter: 'brightness(0.95)', - opacity: 1, - }, - }), - }} - startDecorator={ - - {filter.isPinned && ( - - )} - {isActive ? ( - - ) : ( - - {filter.count} - - )} - - } - endDecorator={ - - {hasWarning && } - {!hasWarning && filter.overdueCount > 0 && ( - - {filter.overdueCount} - - )} - - } - > - 0 ? ` (${filter.overdueCount} overdue)` : ''}` + } + placement='bottom' + > +
!hasWarning && onFilterClick(filter.id)}> + handleContextMenu(e, filter)} sx={{ - whiteSpace: 'nowrap', - maxWidth: 200, - overflow: 'hidden', - textOverflow: 'ellipsis', + cursor: hasWarning ? 'not-allowed' : 'pointer', + transition: 'all 0.2s ease', + px: 1.0, + + opacity: hasWarning ? 0.7 : isActive ? 1 : 0.85, ...(hasCustomColor && { - color: textColor, + backgroundColor: `${filter.color} !important`, + color: `${textColor} !important`, + '&:hover': { + backgroundColor: `${filter.color} !important`, + filter: 'brightness(0.95)', + opacity: 1, + }, }), }} + startDecorator={ + + {isActive ? ( + + ) : ( + + {filter.count} + + )} + + } + // endDecorator={ + // + // {hasWarning && } + // {!hasWarning && filter.overdueCount > 0 && ( + // + // {filter.overdueCount} + // + // )} + // + // } > - {filter.name} - - -
- - ) - })} + + {filter.name} + +
+
+
+ ) + })}