diff --git a/src/components/client/campaign-application/CampaignApplicationForm.tsx b/src/components/client/campaign-application/CampaignApplicationForm.tsx index 7389f3a71..c1dbfbfd9 100644 --- a/src/components/client/campaign-application/CampaignApplicationForm.tsx +++ b/src/components/client/campaign-application/CampaignApplicationForm.tsx @@ -1,6 +1,6 @@ import { useCallback, useState } from 'react' - import { Grid, StepLabel } from '@mui/material' +import { Person } from 'gql/person' import { CampaignApplicationFormData, @@ -25,17 +25,6 @@ import { StyledStepConnector, } from './helpers/campaignApplication.styled' -const initialValues: CampaignApplicationFormData = { - organizer: { - name: '', - phone: '', - email: '', - acceptTermsAndConditions: false, - transparencyTermsAccepted: false, - personalInformationProcessingAccepted: false, - }, -} - const steps: StepType[] = [ { title: 'campaign-application:steps.organizer.title', @@ -51,9 +40,24 @@ const steps: StepType[] = [ }, ] -export default function CampaignApplicationForm() { +type Props = { + person?: Person +} + +export default function CampaignApplicationForm({ person }: Props) { const [activeStep, setActiveStep] = useState(Steps.ORGANIZER) + const initialValues: CampaignApplicationFormData = { + organizer: { + name: `${person?.firstName} ${person?.lastName}` ?? '', + phone: person?.phone ?? '', + email: person?.email ?? '', + acceptTermsAndConditions: false, + transparencyTermsAccepted: false, + personalInformationProcessingAccepted: false, + }, + } + const handleSubmit = () => { stepsHandler({ activeStep, setActiveStep }) } diff --git a/src/components/client/campaign-application/CampaignApplicationPage.tsx b/src/components/client/campaign-application/CampaignApplicationPage.tsx index 6a70d1b95..6f8cfcefe 100644 --- a/src/components/client/campaign-application/CampaignApplicationPage.tsx +++ b/src/components/client/campaign-application/CampaignApplicationPage.tsx @@ -1,10 +1,23 @@ +import { CircularProgress, Grid } from '@mui/material' +import { useCurrentPerson } from 'common/util/useCurrentPerson' import Layout from '../layout/Layout' import CampaignApplicationForm from './CampaignApplicationForm' export default function CampaignApplicationPage() { + const { data: userData, isLoading } = useCurrentPerson() + const person = userData?.user || undefined + + if (isLoading) { + return ( + + + + ) + } + return ( - + ) }