@@ -46,6 +46,7 @@ function FilterLeft({
46
46
const [ filteredCountries , setFilteredCountries ] = useState ( response ) ;
47
47
const { project, setProject } = useContext ( DataContext ) ;
48
48
const [ compProject , setCompProject ] = useState ( '' ) ;
49
+ const [ majorCrops , setMajorCrops ] = useState ( [ ] ) ;
49
50
const bolderCountries = response . filter ( ( country ) =>
50
51
config . BOLDER_COUNTRIES . includes ( country . name )
51
52
) ;
@@ -60,9 +61,10 @@ function FilterLeft({
60
61
) ;
61
62
62
63
setShowLandraceGroups ( project === "lga" ) ;
64
+ setMajorCrops ( [ ] ) ;
63
65
} ;
64
66
65
- const [ majorCrops , setMajorCrops ] = useState ( [ ] ) ;
67
+
66
68
useEffect ( ( ) => {
67
69
if ( compProject ) {
68
70
if ( config . PROJECT_CROPS [ compProject ] ) {
@@ -122,6 +124,11 @@ function FilterLeft({
122
124
) ;
123
125
setCountryIso ( selectedCountry . iso_2 ) ;
124
126
setIso ( selectedCountry . iso_2 ) ;
127
+
128
+ if ( compProject === "bolder" && selectedCountry ) {
129
+ const countryCrops = config . BOLDER_CROPS [ selectedCountry . name ] || [ ] ;
130
+ setMajorCrops ( countryCrops ) ;
131
+ }
125
132
//console.log(selectedCountry.iso_2)
126
133
setTimeout ( ( ) => {
127
134
setIndexStep ( 1 ) ;
@@ -326,7 +333,7 @@ const overlayInfo = "Info: your CSV file must have the following columns: 'id',
326
333
</ Col >
327
334
</ Row >
328
335
329
- { majorCrops && (
336
+ { majorCrops . length > 0 ? (
330
337
< CheckFilter
331
338
title = "Major Crops"
332
339
toolTipTitle = "Step 3"
@@ -337,7 +344,19 @@ const overlayInfo = "Info: your CSV file must have the following columns: 'id',
337
344
idOnboarding = "select-majorCrop"
338
345
indexStep = { indexStep }
339
346
setIndexStep = { setIndexStep }
340
- > </ CheckFilter >
347
+ />
348
+ ) : (
349
+ < CheckFilter
350
+ title = "Major Crops"
351
+ toolTipTitle = "Step 3"
352
+ toolTipDescription = "No crops available"
353
+ onDataChange = { handleDataMajorCropChange }
354
+ onChange = { shouldReset }
355
+ crop = { [ ] }
356
+ idOnboarding = "select-majorCrop"
357
+ indexStep = { indexStep }
358
+ setIndexStep = { setIndexStep }
359
+ />
341
360
) }
342
361
343
362
{ showLandraceGroups && carouselMajorItemsNow && carouselMajorItemsNow . length == 1 && (
0 commit comments