@@ -23,28 +23,29 @@ const Carpool = ({
2323 const tVoiture = useTranslations ( 'voiture' )
2424 const params = useParamContext ( )
2525 const [ slug ] = equivalent . slug . split ( '+' )
26- const carInfos = params . transport . carInfos [ carpoolValue ? `covoiturage${ slug . replace ( 'voiture' , '' ) } ` : slug ]
26+ const carpoolSlug = carpoolValue ? `covoiturage${ slug . replace ( 'voiture' , '' ) } ` : slug
27+ const carInfos = params . transport . carInfos [ carpoolSlug ]
2728
2829 return (
2930 < div className = { styles . carpool } >
3031 < div className = { styles . triangle } />
3132 { carInfos && (
3233 < >
3334 < div className = { styles . transport } >
34- < HiddenLabel htmlFor = { `text-select-car-size-${ slug } ` } > { t ( 'transportSizeSelect' ) } </ HiddenLabel >
35+ < HiddenLabel htmlFor = { `text-select-car-size-${ carpoolSlug } ` } > { t ( 'transportSizeSelect' ) } </ HiddenLabel >
3536 < Select
36- id = { `car-size-${ slug } ` }
37+ id = { `car-size-${ carpoolSlug } ` }
3738 className = { styles . select }
3839 value = { carInfos . size }
3940 onChange = { ( event ) => {
4041 track (
4142 `Transport ${ type === 'distance' ? 'distance' : 'itinéraire' } ` ,
42- `Car size ${ slug } ` ,
43+ `Car size ${ carpoolSlug } ` ,
4344 event . target . value
4445 )
4546 params . transport . setCarInfos ( {
4647 ...params . transport . carInfos ,
47- [ slug ] : { ...carInfos , size : event . target . value } ,
48+ [ carpoolSlug ] : { ...carInfos , size : event . target . value } ,
4849 } )
4950 } } >
5051 < option value = 'citadine' > { tVoiture ( 'citadine' ) } </ option >
@@ -53,31 +54,31 @@ const Carpool = ({
5354 < option value = 'grandeberline' > { tVoiture ( 'grandeberline' ) } </ option >
5455 </ Select >
5556 </ div >
56- { ! slug . endsWith ( 'electrique' ) && (
57+ { ! carpoolSlug . endsWith ( 'electrique' ) && (
5758 < div className = { styles . transport } >
58- < HiddenLabel htmlFor = { `text-select-car-engine-${ slug } ` } > { t ( 'transportEngineSelect' ) } </ HiddenLabel >
59+ < HiddenLabel htmlFor = { `text-select-car-engine-${ carpoolSlug } ` } > { t ( 'transportEngineSelect' ) } </ HiddenLabel >
5960 < Select
60- id = { `car-engine-${ slug } ` }
61+ id = { `car-engine-${ carpoolSlug } ` }
6162 className = { styles . select }
6263 value = { carInfos . engine }
6364 onChange = { ( event ) => {
6465 track (
6566 `Transport ${ type === 'distance' ? 'distance' : 'itinéraire' } ` ,
66- `Car engine ${ slug } ` ,
67+ `Car engine ${ carpoolSlug } ` ,
6768 event . target . value
6869 )
6970 params . transport . setCarInfos ( {
7071 ...params . transport . carInfos ,
71- [ slug ] : { ...carInfos , engine : event . target . value } ,
72+ [ carpoolSlug ] : { ...carInfos , engine : event . target . value } ,
7273 } )
7374 } } >
74- { slug . endsWith ( 'thermique' ) && (
75+ { carpoolSlug . endsWith ( 'thermique' ) && (
7576 < >
7677 < option value = 'diesel' > { tVoiture ( 'diesel' ) } </ option >
7778 < option value = 'essence' > { tVoiture ( 'essence' ) } </ option >
7879 </ >
7980 ) }
80- { slug . endsWith ( 'hybride' ) && (
81+ { carpoolSlug . endsWith ( 'hybride' ) && (
8182 < >
8283 < option value = 'hybride' > { tVoiture ( 'hybride' ) } </ option >
8384 < option value = 'hybriderechargeable' > { tVoiture ( 'hybriderechargeable' ) } </ option >
@@ -94,10 +95,10 @@ const Carpool = ({
9495 setValue = { ( value ) => {
9596 track (
9697 `Transport ${ type === 'distance' ? 'distance' : 'itinéraire' } ` ,
97- `Covoiturage ${ slug } ` ,
98+ `Covoiturage ${ carpoolSlug } ` ,
9899 value . toString ( )
99100 )
100- params [ type ] . setCarpool ( { ...params [ type ] . carpool , [ slug ] : value - 1 } )
101+ params [ type ] . setCarpool ( { ...params [ type ] . carpool , [ carpoolSlug ] : value - 1 } )
101102 } }
102103 min = { 2 }
103104 max = { 5 }
0 commit comments