diff --git a/modules/customer-invoices/src/web/proformas/list/ui/components/proforma-status-segmented-filter.tsx b/modules/customer-invoices/src/web/proformas/list/ui/components/proforma-status-segmented-filter.tsx index 9d32f32f..d28b73d9 100644 --- a/modules/customer-invoices/src/web/proformas/list/ui/components/proforma-status-segmented-filter.tsx +++ b/modules/customer-invoices/src/web/proformas/list/ui/components/proforma-status-segmented-filter.tsx @@ -11,7 +11,8 @@ import { import type { ElementType } from "react"; import { useTranslation } from "../../../../i18n"; -import type { ProformaStatusCounts } from "../../../shared"; +import { getProformaStatusDisplayIcon } from "../../../change-status/helpers"; +import type { ProformaStatus, ProformaStatusCounts } from "../../../shared"; import type { ProformaListStatusFilter } from "../../types/proforma-list-filters"; export type ProformaStatusFilter = ProformaListStatusFilter; @@ -92,7 +93,9 @@ export const ProformaStatusSegmentedFilter = ({ }: ProformaStatusSegmentedFilterProps) => { const { t } = useTranslation(); - const handleValueChange = (nextValue: string) => { + const handleValueChange = (nextValues: string[]) => { + const nextValue = nextValues[0]; + if (!(nextValue && isProformaStatusFilter(nextValue)) || nextValue === value) { return; } @@ -103,47 +106,55 @@ export const ProformaStatusSegmentedFilter = ({ return ( - {PROFORMA_STATUS_FILTER_OPTIONS.map((option) => ( - { - if (option.value === value) { - event.preventDefault(); - } - }} - value={option.value} - > - - {option.icon ? : null} - {t(option.labelKey)} - - {counts[option.countKey]} - - - - ))} + {PROFORMA_STATUS_FILTER_OPTIONS.map((option) => { + const normalizedStatus = option.value.toLowerCase() as ProformaStatus; + const Icon = getProformaStatusDisplayIcon(normalizedStatus); + + const disabled = + "text-muted-foreground hover:border-border hover:bg-muted/60 hover:text-foreground"; + + return ( + { + if (option.value === value) { + event.preventDefault(); + } + }} + value={option.value} + > + + {option.icon ? : null} + {t(option.labelKey)} + + {counts[option.countKey]} + + + + ); + })} ); };