Skip to content

Commit

Permalink
move all filter options in onboarding to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
ccatherinetan committed Dec 23, 2024
1 parent 057b35d commit 16e7ec9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
13 changes: 5 additions & 8 deletions app/onboarding/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import { Flex } from '@/styles/containers';
import { H3, P1, P3 } from '@/styles/text';
import { DropdownOption, Profile, UserTypeEnum } from '@/types/schema';
import { useAuth } from '@/utils/AuthProvider';
import { gardenTypeOptions, usStateOptions } from '@/utils/dropdownOptions';
import {
gardenTypeOptions,
plotOptions,
usStateOptions,
} from '@/utils/dropdownOptions';
import { useProfile } from '@/utils/ProfileProvider';
import {
ButtonDiv,
Expand All @@ -22,13 +26,6 @@ import {
QuestionDiv,
} from './styles';

// Define the possible options for each question
// usStateOptions, gardenTypeOptions imported from elsewhere
const plotOptions: DropdownOption<boolean>[] = [
{ label: 'Yes, I own a plot', value: true },
{ label: "No, I don't own a plot", value: false },
];

interface ReviewPageProps {
userId: UUID;
selectedState: string;
Expand Down
8 changes: 7 additions & 1 deletion utils/dropdownOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,16 @@ export const usStateOptions: DropdownOption[] = [
{ label: 'Missouri', value: 'MISSOURI' },
];

// Turn plantingTypeLabels into dropdown options
// ONBOARDING QUESTIONS
// Turn userTypeLabels into dropdown options
export const gardenTypeOptions: DropdownOption<UserTypeEnum>[] = Object.entries(
userTypeLabels,
).map(([key, label]) => ({
value: key as UserTypeEnum,
label,
}));

export const plotOptions: DropdownOption<boolean>[] = [
{ label: 'Yes, I own a plot', value: true },
{ label: "No, I don't own a plot", value: false },
];

0 comments on commit 16e7ec9

Please sign in to comment.