@@ -7,6 +7,7 @@ import { Select } from '../components/Select';
77import { ToggleButtons } from '../components/TobbleButtons' ;
88import { IAuctionAttributes } from '../requests/types' ;
99import { attributes , itemsWithAttributes } from '../resources/attributes' ;
10+ import { useLanguage } from '../resources/lang/LanguageContext' ;
1011
1112import { auctionTypes } from './consts' ;
1213import { GridItems } from './GridItems' ;
@@ -16,10 +17,16 @@ export interface IAuctionAttributesContainerProps {
1617}
1718
1819export const AuctionsAttributesContainer : FC < IAuctionAttributesContainerProps > = ( { auctions } ) => {
20+ const { ui } = useLanguage ( ) ;
1921 const [ filterItem , setFilterItem ] = useState < string > ( ) ;
2022 const [ filterAttribute , setFilterAttribute ] = useState < string [ ] > ( ) ;
2123 const [ filterLevels , setFilterLevels ] = useState < [ number , number ] > ( [ 1 , 10 ] ) ;
22- const [ filterType , setFilterType ] = useState ( '' ) ;
24+ const [ filterType , setFilterType ] = useState ( 'BIN' ) ;
25+
26+ const auctionTypesLocalized = useMemo (
27+ ( ) => auctionTypes . map ( ( type ) => ( { text : ui [ type . text ] , value : type . value } ) as { text : string ; value : string } ) ,
28+ [ ui ]
29+ ) ;
2330
2431 const handleFilterLevelsChange = ( newValue : number | number [ ] ) => {
2532 const newNumbers = newValue as [ number , number ] ;
@@ -63,21 +70,12 @@ export const AuctionsAttributesContainer: FC<IAuctionAttributesContainerProps> =
6370 padding : 1
6471 } }
6572 >
66- < Select label = "Items" onChange = { setFilterItem } values = { itemsWithAttributes } />
67- < MultiSelect label = "Attributes" maxItems = { 2 } onChange = { setFilterAttribute } values = { attributes } />
73+ < Select label = { ui . items } onChange = { setFilterItem } values = { itemsWithAttributes } />
74+ < MultiSelect label = { ui . attributes } maxItems = { 2 } onChange = { setFilterAttribute } values = { attributes } />
6875
69- < RangeSlider label = "Levels" max = { 10 } min = { 1 } onChange = { handleFilterLevelsChange } />
70- < ToggleButtons label = "Auction Type" onChange = { setFilterType } options = { auctionTypes } />
76+ < RangeSlider label = { ui . levels } max = { 10 } min = { 1 } onChange = { handleFilterLevelsChange } />
77+ < ToggleButtons defaultOption = { filterType } label = { ui . type } onChange = { setFilterType } options = { auctionTypesLocalized } />
7178 </ Box >
72- { /*<Box
73- sx={{
74- width: "100%",
75- display: "grid",
76- gridTemplateColumns:
77- "repeat(auto-fill, minmax(min(200px, 100%), 1fr))",
78- gap: 2,
79- }}
80- >*/ }
8179 < GridItems items = { filteredAuctions } />
8280 </ >
8381 ) ;
0 commit comments