Skip to content

Commit

Permalink
change dropdown values to be upper case
Browse files Browse the repository at this point in the history
  • Loading branch information
kylezryr committed Nov 4, 2024
1 parent 11f0c11 commit 5815bf0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
5 changes: 4 additions & 1 deletion components/FilterDropdownMultiple.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export default function FilterDropdownMultiple({
}: FilterDropdownProps) {
return (
<MultiSelect
options={options.map(option => ({ label: option, value: option }))}
options={options.map(option => ({
label: option,
value: option.toLocaleUpperCase(),
}))}
value={value}
onChange={setStateAction}
labelledBy={placeholder}
Expand Down
2 changes: 1 addition & 1 deletion components/FilterDropdownSingle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function FilterDropdownSingle({
{placeholder}
</option>
{options.map((option, index) => (
<option key={index} value={option}>
<option key={index} value={option.toLocaleUpperCase()}>
{option}
</option>
))}
Expand Down
2 changes: 1 addition & 1 deletion components/PlantList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const PlantList = ({
useEffect(() => {
const fetchPlantSeasonality = async () => {
const plantList = await getAllPlants();
const us_state = usStateFilterValue.toLocaleUpperCase();
const us_state = usStateFilterValue;
const filteredPlantList = plantList.filter(
plant => plant.us_state === us_state,
);
Expand Down
18 changes: 8 additions & 10 deletions utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ export function checkGrowingSeason(
plant: Plant,
) {
const growingSeasonToIndex = new Map<string, number[]>([
['Spring', [2, 3, 4]],
['Summer', [5, 6, 7]],
['Fall', [8, 9, 10]],
['Winter', [11, 0, 1]],
['SPRING', [2, 3, 4]],
['SUMMER', [5, 6, 7]],
['FALL', [8, 9, 10]],
['WINTER', [11, 0, 1]],
]);

const monthToIndex = new Map<string, number>([
Expand Down Expand Up @@ -105,9 +105,7 @@ export function checkHarvestSeason(
// If it does, add true to harvestSeasonBoolean
const harvestSeasonBoolean: boolean[] = [];
for (const harvestSeason of harvestSeasonFilterValue) {
harvestSeasonBoolean.push(
plant.harvest_season === harvestSeason.value.toLocaleUpperCase(),
);
harvestSeasonBoolean.push(plant.harvest_season === harvestSeason.value);
}

// Return true if any of the harvestSeasonBooleans are true
Expand All @@ -128,11 +126,11 @@ export function checkPlantingType(
// If it is not null, add true to plantingTypeBoolean
const plantingTypeBoolean: boolean[] = [];
for (const plantingType of plantingTypeFilterValue) {
if (plantingType.value === 'Start Seeds Indoors') {
if (plantingType.value === 'START SEEDS INDOORS') {
plantingTypeBoolean.push(plant.indoors_start !== null);
} else if (plantingType.value === 'Start Seeds Outdoors') {
} else if (plantingType.value === 'START SEEDS OUTDOORS') {
plantingTypeBoolean.push(plant.outdoors_start !== null);
} else if (plantingType.value === 'Plant Seedlings/Transplant Outdoors') {
} else if (plantingType.value === 'PLANT SEEDLINGS/TRANSPLANT OUTDOORS') {
plantingTypeBoolean.push(plant.transplant_start !== null);
}
}
Expand Down

0 comments on commit 5815bf0

Please sign in to comment.