diff --git a/web/src/components/filter/FilterSwitch.tsx b/web/src/components/filter/FilterSwitch.tsx index 8af6d6ce3..288e3f64a 100644 --- a/web/src/components/filter/FilterSwitch.tsx +++ b/web/src/components/filter/FilterSwitch.tsx @@ -3,24 +3,27 @@ import { Label } from "../ui/label"; type FilterSwitchProps = { label: string; + disabled?: boolean; isChecked: boolean; onCheckedChange: (checked: boolean) => void; }; export default function FilterSwitch({ label, + disabled = false, isChecked, onCheckedChange, }: FilterSwitchProps) { return (
diff --git a/web/src/components/filter/ReviewFilterGroup.tsx b/web/src/components/filter/ReviewFilterGroup.tsx index 0b0283a91..ab597c85a 100644 --- a/web/src/components/filter/ReviewFilterGroup.tsx +++ b/web/src/components/filter/ReviewFilterGroup.tsx @@ -10,7 +10,7 @@ import { DropdownMenuSeparator, DropdownMenuTrigger, } from "../ui/dropdown-menu"; -import { ReviewFilter, ReviewSummary } from "@/types/review"; +import { ReviewFilter, ReviewSeverity, ReviewSummary } from "@/types/review"; import { getEndOfDayTimestamp } from "@/utils/dateUtil"; import { useFormattedTimestamp } from "@/hooks/use-date-utils"; import { @@ -49,19 +49,21 @@ const DEFAULT_REVIEW_FILTERS: ReviewFilters[] = [ type ReviewFilterGroupProps = { filters?: ReviewFilters[]; + currentSeverity?: ReviewSeverity; reviewSummary?: ReviewSummary; filter?: ReviewFilter; - onUpdateFilter: (filter: ReviewFilter) => void; motionOnly: boolean; + onUpdateFilter: (filter: ReviewFilter) => void; setMotionOnly: React.Dispatch>; }; export default function ReviewFilterGroup({ filters = DEFAULT_REVIEW_FILTERS, + currentSeverity, reviewSummary, filter, - onUpdateFilter, motionOnly, + onUpdateFilter, setMotionOnly, }: ReviewFilterGroupProps) { const { data: config } = useSWR("config"); @@ -179,6 +181,11 @@ export default function ReviewFilterGroup({ { + onUpdateFilter({ ...filter, showAll }); + }} updateLabelFilter={(newLabels) => { onUpdateFilter({ ...filter, labels: newLabels }); }} @@ -188,6 +195,7 @@ export default function ReviewFilterGroup({ void; updateLabelFilter: (labels: string[] | undefined) => void; }; function GeneralFilterButton({ allLabels, selectedLabels, + currentSeverity, + showAll, + setShowAll, updateLabelFilter, }: GeneralFilterButtonProps) { const [open, setOpen] = useState(false); @@ -510,6 +524,9 @@ function GeneralFilterButton({ allLabels={allLabels} selectedLabels={selectedLabels} currentLabels={currentLabels} + currentSeverity={currentSeverity} + showAll={showAll} + setShowAll={setShowAll} updateLabelFilter={updateLabelFilter} setCurrentLabels={setCurrentLabels} onClose={() => setOpen(false)} @@ -557,6 +574,9 @@ type GeneralFilterContentProps = { allLabels: string[]; selectedLabels: string[] | undefined; currentLabels: string[] | undefined; + currentSeverity?: ReviewSeverity; + showAll?: boolean; + setShowAll?: (showAll: boolean) => void; updateLabelFilter: (labels: string[] | undefined) => void; setCurrentLabels: (labels: string[] | undefined) => void; onClose: () => void; @@ -565,6 +585,9 @@ export function GeneralFilterContent({ allLabels, selectedLabels, currentLabels, + currentSeverity, + showAll, + setShowAll, updateLabelFilter, setCurrentLabels, onClose, @@ -572,6 +595,25 @@ export function GeneralFilterContent({ return ( <>
+ {currentSeverity && setShowAll && ( +
+ + + +
+ )}