diff --git a/packages/berlin/src/pages/Register.tsx b/packages/berlin/src/pages/Register.tsx index a6ae0ab2..74ccda5e 100644 --- a/packages/berlin/src/pages/Register.tsx +++ b/packages/berlin/src/pages/Register.tsx @@ -1,9 +1,10 @@ // React and third-party libraries -import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; -import { useMemo, useState } from 'react'; import { UseFormReturn, useForm } from 'react-hook-form'; -import toast from 'react-hot-toast'; +import { useMemo, useState } from 'react'; +import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; import { useNavigate, useParams } from 'react-router-dom'; +import { z } from 'zod'; +import toast from 'react-hot-toast'; // API import { @@ -23,21 +24,23 @@ import { type GetUserResponse, } from 'api'; +// Utils +import { dataSchema, fieldsSchema } from '@/utils/form-validation'; + // Hooks import useUser from '../hooks/useUser'; // Components -import { dataSchema, fieldsSchema } from '@/utils/form-validation'; -import { z } from 'zod'; -import Button from '../components/button'; import { Carousel } from '../components/carousel'; import { FlexColumn } from '../components/containers/FlexColumn.styled'; import { Form } from '../components/containers/Form.styled'; import { FormInput, FormSelectInput } from '../components/form-input'; -import Select from '../components/select'; -import Label from '../components/typography/Label'; -import { Subtitle } from '../components/typography/Subtitle.styled'; import { SafeArea } from '../layout/Layout.styled'; +import { Subtitle } from '../components/typography/Subtitle.styled'; +import Button from '../components/button'; +import Label from '../components/typography/Label'; +import Select from '../components/select'; +import Skeleton from '@/components/skeleton'; function Register() { const { user, isLoading } = useUser(); @@ -82,7 +85,7 @@ function Register() { } // if no fields exists then stay on group categories page - if (Object.values(fields).length === 0) { + if (Object.values(fields.data).length === 0) { return 0; } @@ -390,8 +393,18 @@ function EventGroupsForm({ } }; + if (!groupCategories) { + return ( +
+ + + +
+ ); + } + return ( - + {groupCategories ?.filter((groupCategory) => groupCategory.required) .map((groupCategory) => (