import React, { FC } from 'react'; import { useTranslation } from 'react-i18next'; import { Container, Heading, VStack } from '@chakra-ui/react'; import { Player as LottiePlayer } from '@lottiefiles/react-lottie-player'; import { withLandingThemeProvider } from '../../containers'; import { OrderForm, OrderFormProps } from '../../components/order-form'; import { landingApi } from '../../__data__/service/landing.api'; import { OrderCreationAnimation } from '../../assets/animation'; import { formatFormValues, useHandleCreateOrderMutationResponse, } from './helper'; const Page: FC = () => { const { t } = useTranslation('~', { keyPrefix: 'dry-wash.order-create', }); const [createOrder, createOrderMutation] = landingApi.useCreateOrderMutation(); useHandleCreateOrderMutationResponse(createOrderMutation); const onOrderFormSubmit: OrderFormProps['onSubmit'] = (values) => { createOrder({ body: formatFormValues(values) }); }; return ( {createOrderMutation.isUninitialized ? ( <> {t('title')} ) : ( <> {t('order-creation-title')} )} ); }; export default withLandingThemeProvider(Page);