From 440e87ef768aca697be949ef9515b1b66ccaba8b Mon Sep 17 00:00:00 2001 From: RustamRu Date: Sun, 8 Dec 2024 09:54:17 +0300 Subject: [PATCH 1/7] fix landing route names (#8) --- bro.config.js | 4 ++-- src/__data__/urls.ts | 8 ++++---- src/components/landing/CtaButton/CtaButton.tsx | 2 +- src/pages/{order-form => order-create}/index.tsx | 0 src/routes.tsx | 10 ++++++---- 5 files changed, 13 insertions(+), 11 deletions(-) rename src/pages/{order-form => order-create}/index.tsx (100%) diff --git a/bro.config.js b/bro.config.js index f12638a..d2a8385 100644 --- a/bro.config.js +++ b/bro.config.js @@ -12,8 +12,8 @@ module.exports = { /* use https://admin.bro-js.ru/ to create config, navigations and features */ navigations: { 'dry-wash.main': '/dry-wash', - 'dry-wash.create': '/order', - 'dry-wash.view.order': '/order/:orderId', + 'dry-wash.order.create': '/order', + 'dry-wash.order.view': '/order/:orderId', 'dry-wash.arm.master': 'master', 'dry-wash.arm.order': 'order', 'dry-wash.arm': '/arm/*', diff --git a/src/__data__/urls.ts b/src/__data__/urls.ts index abb1331..74cd068 100644 --- a/src/__data__/urls.ts +++ b/src/__data__/urls.ts @@ -1,7 +1,7 @@ import { generatePath } from 'react-router-dom'; import { getNavigationValue } from '@brojs/cli'; -import { Order } from '../models'; +import { Order } from '../models/landing'; const getFullUrls = (url: string) => `${getNavigationValue('dry-wash.main')}${url}`; @@ -13,14 +13,14 @@ export const URLs = { return this.url; }, }, - orderForm: { - url: getNavigationValue('dry-wash.create'), + orderCreate: { + url: getFullUrls(getNavigationValue('dry-wash.order.create')), getUrl() { return this.url; }, }, orderView: { - url: getNavigationValue('dry-wash.view.order'), + url: getFullUrls(getNavigationValue('dry-wash.order.view')), getUrl(orderId: Order.Id) { return generatePath(this.url, { orderId }); }, diff --git a/src/components/landing/CtaButton/CtaButton.tsx b/src/components/landing/CtaButton/CtaButton.tsx index d4769e7..332a641 100644 --- a/src/components/landing/CtaButton/CtaButton.tsx +++ b/src/components/landing/CtaButton/CtaButton.tsx @@ -11,7 +11,7 @@ export const CtaButton: FC = (props) => { return ( + ); +}; diff --git a/src/components/order-form/form/types.ts b/src/components/order-form/form/types.ts new file mode 100644 index 0000000..9746d54 --- /dev/null +++ b/src/components/order-form/form/types.ts @@ -0,0 +1,9 @@ +export type OrderFormValues = { + phone: string; + carNumber: string; + carColor: string; + carBody: string; + carLocation: string; + availableDatetimeBegin: string; + availableDatetimeEnd: string; +}; \ No newline at end of file diff --git a/src/components/order-form/index.ts b/src/components/order-form/index.ts new file mode 100644 index 0000000..b8a36bf --- /dev/null +++ b/src/components/order-form/index.ts @@ -0,0 +1 @@ +export * from './form'; \ No newline at end of file -- 2.45.2 From 77ea7d301ecce42a31110fa29b26d513cc4e91ba Mon Sep 17 00:00:00 2001 From: RustamRu Date: Sun, 8 Dec 2024 09:57:46 +0300 Subject: [PATCH 7/7] feat: order form page (#8) --- src/pages/order-create/index.tsx | 41 ++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/src/pages/order-create/index.tsx b/src/pages/order-create/index.tsx index a6f19cb..e4dd2ad 100644 --- a/src/pages/order-create/index.tsx +++ b/src/pages/order-create/index.tsx @@ -1,21 +1,32 @@ -import React from 'react'; -import { Link as RouterLink } from 'react-router-dom'; -import { Button } from '@chakra-ui/react'; +import React, { FC } from 'react'; +import { useTranslation } from 'react-i18next'; +import { Container, Heading, VStack } from '@chakra-ui/react'; -import { URLs } from '../../__data__/urls'; -import { mockOrder } from '../../mocks/landing'; +import { LandingThemeProvider } from '../../containers'; +import { OrderForm } from '../../components/order-form'; + +const Page: FC = () => { + const { t } = useTranslation('~', { + keyPrefix: 'dry-wash.order-create', + }); -const Page = () => { return ( - <> -

Order form

- {mockOrder.orders.map(({ id }) => ( - - ))} - + + + + {t('title')} + + + + ); }; -export default Page; +export default Page; \ No newline at end of file -- 2.45.2