fix landing route names (#8)

This commit is contained in:
RustamRu 2024-12-08 09:54:17 +03:00
parent 6705e74ece
commit 440e87ef76
5 changed files with 13 additions and 11 deletions

View File

@ -12,8 +12,8 @@ module.exports = {
/* use https://admin.bro-js.ru/ to create config, navigations and features */ /* use https://admin.bro-js.ru/ to create config, navigations and features */
navigations: { navigations: {
'dry-wash.main': '/dry-wash', 'dry-wash.main': '/dry-wash',
'dry-wash.create': '/order', 'dry-wash.order.create': '/order',
'dry-wash.view.order': '/order/:orderId', 'dry-wash.order.view': '/order/:orderId',
'dry-wash.arm.master': 'master', 'dry-wash.arm.master': 'master',
'dry-wash.arm.order': 'order', 'dry-wash.arm.order': 'order',
'dry-wash.arm': '/arm/*', 'dry-wash.arm': '/arm/*',

View File

@ -1,7 +1,7 @@
import { generatePath } from 'react-router-dom'; import { generatePath } from 'react-router-dom';
import { getNavigationValue } from '@brojs/cli'; import { getNavigationValue } from '@brojs/cli';
import { Order } from '../models'; import { Order } from '../models/landing';
const getFullUrls = (url: string) => const getFullUrls = (url: string) =>
`${getNavigationValue('dry-wash.main')}${url}`; `${getNavigationValue('dry-wash.main')}${url}`;
@ -13,14 +13,14 @@ export const URLs = {
return this.url; return this.url;
}, },
}, },
orderForm: { orderCreate: {
url: getNavigationValue('dry-wash.create'), url: getFullUrls(getNavigationValue('dry-wash.order.create')),
getUrl() { getUrl() {
return this.url; return this.url;
}, },
}, },
orderView: { orderView: {
url: getNavigationValue('dry-wash.view.order'), url: getFullUrls(getNavigationValue('dry-wash.order.view')),
getUrl(orderId: Order.Id) { getUrl(orderId: Order.Id) {
return generatePath(this.url, { orderId }); return generatePath(this.url, { orderId });
}, },

View File

@ -11,7 +11,7 @@ export const CtaButton: FC<ButtonProps> = (props) => {
return ( return (
<Button <Button
as={RouterLink} as={RouterLink}
to={URLs.orderForm.getUrl()} to={URLs.orderCreate.getUrl()}
colorScheme='primary' colorScheme='primary'
{...props} {...props}
> >

View File

@ -7,16 +7,18 @@ import { URLs } from './__data__/urls';
import NotFound from './pages/notFound/notFound'; import NotFound from './pages/notFound/notFound';
const Landing = lazy(() => import('./pages/landing')); const Landing = lazy(() => import('./pages/landing'));
const OrderForm = lazy(() => import('./pages/order-form')); const OrderCreate = lazy(() => import('./pages/order-create'));
const OrderView = lazy(() => import('./pages/order-view')); const OrderView = lazy(() => import('./pages/order-view'));
const Routers = () => { const Routers = () => {
return ( return (
<Suspense fallback={<PageSpinner />}> <Suspense fallback={<PageSpinner />}>
<Routes> <Routes>
<Route path={URLs.landing.url} element={<Landing />} /> <Route path={URLs.landing.url}>
<Route path={URLs.orderForm.url} element={<OrderForm />} /> <Route index element={<Landing />} />
<Route path={URLs.orderView.url} element={<OrderView />} /> <Route path={URLs.orderCreate.url} element={<OrderCreate />} />
<Route path={URLs.orderView.url} element={<OrderView />} />
</Route>
{URLs.armBase.isOn && ( {URLs.armBase.isOn && (
<Route path={URLs.armBase.url} element={<Arm />}></Route> <Route path={URLs.armBase.url} element={<Arm />}></Route>
)} )}