@@ -11,6 +11,7 @@ import ListIcon from "svgs/icons/list.svg";
1111
1212import { useIsList } from "context/IsListProvider" ;
1313import useIsDesktop from "hooks/useIsDesktop" ;
14+ import type { SelectItem } from "utils/uiComponentsTypes" ;
1415import { decodeURIFilter , encodeURIFilter , useRootPath } from "utils/uri" ;
1516
1617import { hoverShortTransitionTiming } from "styles/commonStyles" ;
@@ -59,15 +60,15 @@ const Filters: React.FC = () => {
5960 const location = useRootPath ( ) ;
6061 const [ searchParams ] = useSearchParams ( ) ;
6162
62- const handleStatusChange = ( value : string | number ) => {
63- const parsedValue = JSON . parse ( value as string ) ;
63+ const handleStatusChange = ( item : SelectItem ) => {
64+ const parsedValue = JSON . parse ( item . itemValue as string ) ;
6465 const encodedFilter = encodeURIFilter ( { ...filterObject , ...parsedValue } ) ;
6566 navigate ( `${ location } /1/${ order } /${ encodedFilter } ?${ searchParams . toString ( ) } ` ) ;
6667 } ;
6768
68- const handleOrderChange = ( value : string | number ) => {
69+ const handleOrderChange = ( item : SelectItem ) => {
6970 const encodedFilter = encodeURIFilter ( { ruled, period, ...filterObject } ) ;
70- navigate ( `${ location } /1/${ value } /${ encodedFilter } ?${ searchParams . toString ( ) } ` ) ;
71+ navigate ( `${ location } /1/${ item . itemValue } /${ encodedFilter } ?${ searchParams . toString ( ) } ` ) ;
7172 } ;
7273
7374 const { isList, setIsList } = useIsList ( ) ;
@@ -79,10 +80,30 @@ const Filters: React.FC = () => {
7980 smallButton
8081 simpleButton
8182 items = { [
82- { value : JSON . stringify ( { } ) , text : t ( "filters.all_cases" ) , dot : theme . primaryText } ,
83- { value : JSON . stringify ( { ruled : false } ) , text : t ( "filters.in_progress" ) , dot : theme . primaryBlue } ,
84- { value : JSON . stringify ( { period : "appeal" } ) , text : t ( "filters.appeal" ) , dot : theme . tint } ,
85- { value : JSON . stringify ( { ruled : true } ) , text : t ( "filters.closed" ) , dot : theme . primaryPurple } ,
83+ {
84+ id : JSON . stringify ( { } ) ,
85+ itemValue : JSON . stringify ( { } ) ,
86+ text : t ( "filters.all_cases" ) ,
87+ dot : theme . primaryText ,
88+ } ,
89+ {
90+ id : JSON . stringify ( { ruled : false } ) ,
91+ itemValue : JSON . stringify ( { ruled : false } ) ,
92+ text : t ( "filters.in_progress" ) ,
93+ dot : theme . primaryBlue ,
94+ } ,
95+ {
96+ id : JSON . stringify ( { period : "appeal" } ) ,
97+ itemValue : JSON . stringify ( { period : "appeal" } ) ,
98+ text : t ( "filters.appeal" ) ,
99+ dot : theme . tint ,
100+ } ,
101+ {
102+ id : JSON . stringify ( { ruled : true } ) ,
103+ itemValue : JSON . stringify ( { ruled : true } ) ,
104+ text : t ( "filters.closed" ) ,
105+ dot : theme . primaryPurple ,
106+ } ,
86107 ] }
87108 defaultValue = { JSON . stringify ( { ruled, period } ) }
88109 callback = { handleStatusChange }
@@ -91,8 +112,8 @@ const Filters: React.FC = () => {
91112 smallButton
92113 simpleButton
93114 items = { [
94- { value : "desc" , text : t ( "filters.newest" ) } ,
95- { value : "asc" , text : t ( "filters.oldest" ) } ,
115+ { id : "desc" , itemValue : "desc" , text : t ( "filters.newest" ) } ,
116+ { id : "asc" , itemValue : "asc" , text : t ( "filters.oldest" ) } ,
96117 ] }
97118 defaultValue = { order }
98119 callback = { handleOrderChange }
0 commit comments