Skip to content

Commit

Permalink
update personal info fields
Browse files Browse the repository at this point in the history
  • Loading branch information
GwonHyeok committed Feb 21, 2025
1 parent 97ec0a8 commit c36c973
Showing 1 changed file with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions src/components/source/source-add-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {HealthDataParserVisionModelListResponse} from "@/app/api/health-data-par
import {HealthDataParserDocumentModelListResponse} from "@/app/api/health-data-parser/documents/[id]/models/route";
import {ConditionalDeploymentEnv} from "@/components/common/deployment-env";
import {useTranslations} from "next-intl";
import {countries} from "@/lib/countries";

const Select = dynamic(() => import('react-select'), {ssr: false});

Expand Down Expand Up @@ -92,9 +93,18 @@ const HealthDataType = {
}
};

const personalInfoFields = (t: any): Field[] => {
const personalInfoFields = (t: any, top: any): Field[] => {
return [
{key: 'name', label: t('name'), type: 'text'},
{
key: 'gender',
label: top('gender.label'),
type: 'select',
options: [
{value: 'male', label: top('gender.male')},
{value: 'female', label: top('gender.female')}
]
},
{key: 'birthDate', label: t('birthdate'), type: 'date'},
{
key: 'height',
Expand Down Expand Up @@ -130,6 +140,31 @@ const personalInfoFields = (t: any): Field[] => {
}
]
},
{
key: 'ethnicity',
label: top('ethnicity.label'),
type: 'select',
options: [
{value: 'east_asian', label: top('ethnicity.options.east_asian')},
{value: 'southeast_asian', label: top('ethnicity.options.southeast_asian')},
{value: 'south_asian', label: top('ethnicity.options.south_asian')},
{value: 'european', label: top('ethnicity.options.european')},
{value: 'middle_eastern', label: top('ethnicity.options.middle_eastern')},
{value: 'african', label: top('ethnicity.options.african')},
{value: 'african_american', label: top('ethnicity.options.african_american')},
{value: 'pacific_islander', label: top('ethnicity.options.pacific_islander')},
{value: 'native_american', label: top('ethnicity.options.native_american')},
{value: 'hispanic', label: top('ethnicity.options.hispanic')},
{value: 'mixed', label: top('ethnicity.options.mixed')},
{value: 'other', label: top('ethnicity.options.other')}
],
},
{
key: 'country',
label: top('country.label'),
type: 'select',
options: countries.map(({code: value, name: label}) => ({value, label})),
},
{
key: 'bloodType',
label: t('bloodType'),
Expand Down Expand Up @@ -161,6 +196,7 @@ const AddSourceDialog: React.FC<AddSourceDialogProps> = ({
onAddSymptoms
}) => {
const t = useTranslations('SourceManagement')

const [open, setOpen] = useState(false);
const [showSettingsAlert, setShowSettingsAlert] = useState(false);
const [uploadStatus, setUploadStatus] = useState<string>('');
Expand Down Expand Up @@ -343,6 +379,7 @@ ${isSelected

const HealthDataPreview = ({healthData, formData, setFormData, setHealthData}: HealthDataPreviewProps) => {
const t = useTranslations('SourceManagement')
const top = useTranslations('Onboarding.personalInfo');

const [loading, setLoading] = useState<boolean>(false);
const [numPages, setNumPages] = useState(0);
Expand Down Expand Up @@ -469,7 +506,7 @@ const HealthDataPreview = ({healthData, formData, setFormData, setHealthData}: H
const getFields = (): Field[] => {
switch (healthData.type) {
case HealthDataType.PERSONAL_INFO.id:
return personalInfoFields(t);
return personalInfoFields(t, top);
case HealthDataType.SYMPTOMS.id:
return symptomsFields(t);
default:
Expand Down

0 comments on commit c36c973

Please sign in to comment.