11import { useState , useEffect } from 'react' ;
22import { useStats , useTags } from '../hooks/useStats' ;
33import type { MemoryFilters } from '../types' ;
4+ import { useLanguage } from '../i18n/LanguageContext' ;
45
56interface FilterPanelProps {
67 filters : MemoryFilters ;
78 onApply : ( filters : MemoryFilters ) => void ;
89}
910
1011export function FilterPanel ( { filters, onApply } : FilterPanelProps ) {
12+ const { t } = useLanguage ( ) ;
1113 const [ isOpen , setIsOpen ] = useState ( false ) ;
1214 const [ localFilters , setLocalFilters ] = useState < MemoryFilters > ( filters ) ;
1315
@@ -150,14 +152,14 @@ export function FilterPanel({ filters, onApply }: FilterPanelProps) {
150152 return (
151153 < div >
152154 < button onClick = { ( ) => setIsOpen ( ! isOpen ) } style = { toggleBtnStyle } >
153- Filtres
155+ { t ( 'filter_button' ) }
154156 </ button >
155157
156158 { isOpen && (
157159 < div style = { panelStyle } >
158160 < div style = { fieldStyle } >
159161 < label htmlFor = "filter-type" style = { labelStyle } >
160- Type
162+ { t ( 'type' ) }
161163 </ label >
162164 < select
163165 id = "filter-type"
@@ -166,7 +168,7 @@ export function FilterPanel({ filters, onApply }: FilterPanelProps) {
166168 aria-label = "Type"
167169 style = { inputStyle }
168170 >
169- < option value = "" > Tous les types </ option >
171+ < option value = "" > { t ( 'filter_all_types' ) } </ option >
170172 { types . map ( type => (
171173 < option key = { type } value = { type } >
172174 { type }
@@ -177,7 +179,7 @@ export function FilterPanel({ filters, onApply }: FilterPanelProps) {
177179
178180 < div style = { fieldStyle } >
179181 < label style = { labelStyle } aria-label = "Tags" >
180- Tags
182+ { t ( 'tags' ) }
181183 </ label >
182184 < div style = { checkboxContainerStyle } >
183185 { availableTags . map ( tag => {
@@ -207,7 +209,7 @@ export function FilterPanel({ filters, onApply }: FilterPanelProps) {
207209 < div style = { { display : 'grid' , gridTemplateColumns : '1fr 1fr' , gap : '12px' , marginBottom : '12px' } } >
208210 < div >
209211 < label htmlFor = "filter-from" style = { labelStyle } >
210- Date debut
212+ { t ( 'filter_date_from' ) }
211213 </ label >
212214 < input
213215 id = "filter-from"
@@ -219,7 +221,7 @@ export function FilterPanel({ filters, onApply }: FilterPanelProps) {
219221 </ div >
220222 < div >
221223 < label htmlFor = "filter-to" style = { labelStyle } >
222- Date fin
224+ { t ( 'filter_date_to' ) }
223225 </ label >
224226 < input
225227 id = "filter-to"
@@ -234,7 +236,7 @@ export function FilterPanel({ filters, onApply }: FilterPanelProps) {
234236 < div style = { { display : 'grid' , gridTemplateColumns : '1fr 1fr' , gap : '12px' , marginBottom : '16px' } } >
235237 < div >
236238 < label htmlFor = "filter-quality-min" style = { labelStyle } >
237- Qualite min ( { localFilters . quality_min ?? 0 } )
239+ { t ( 'filter_quality_min' ) . replace ( '{value}' , String ( localFilters . quality_min ?? 0 ) ) }
238240 </ label >
239241 < input
240242 id = "filter-quality-min"
@@ -249,7 +251,7 @@ export function FilterPanel({ filters, onApply }: FilterPanelProps) {
249251 </ div >
250252 < div >
251253 < label htmlFor = "filter-quality-max" style = { labelStyle } >
252- Qualite max ( { localFilters . quality_max ?? 1 } )
254+ { t ( 'filter_quality_max' ) . replace ( '{value}' , String ( localFilters . quality_max ?? 1 ) ) }
253255 </ label >
254256 < input
255257 id = "filter-quality-max"
@@ -266,10 +268,10 @@ export function FilterPanel({ filters, onApply }: FilterPanelProps) {
266268
267269 < div style = { { display : 'flex' , gap : '8px' } } >
268270 < button onClick = { handleApply } style = { applyBtnStyle } >
269- Appliquer
271+ { t ( 'filter_apply' ) }
270272 </ button >
271273 < button onClick = { handleReset } style = { resetBtnStyle } >
272- Reinitialiser
274+ { t ( 'filter_reset' ) }
273275 </ button >
274276 </ div >
275277 </ div >
0 commit comments