This commit is contained in:
Nikolai Petukhov 2024-09-14 09:38:49 +03:00
parent 76bbdbfb61
commit 098e0fe1da
7 changed files with 43 additions and 11 deletions

View File

@ -8,8 +8,9 @@ module.exports = {
} }
}, },
navigations: { navigations: {
'undefined.main': '/undefined', 'enter.main': '/enter',
'link.undefined.auth': '/auth' 'link.enter.auth': '/auth',
'link.enter.account': '/account',
}, },
features: { features: {
'undefined': { 'undefined': {

View File

@ -15,5 +15,6 @@
"build": "npm run clean && ijl-cli build --dev", "build": "npm run clean && ijl-cli build --dev",
"build:prod": "npm run clean && ijl-cli build", "build:prod": "npm run clean && ijl-cli build",
"clean": "rimraf dist" "clean": "rimraf dist"
} },
"name": "enter"
} }

View File

@ -1,13 +1,16 @@
import { getNavigations, getNavigationsValue } from '@ijl/cli'; import { getNavigations, getNavigationsValue } from '@ijl/cli';
import pkg from '../../package.json'; import pkg from '../../package.json';
const baseUrl = getNavigationsValue(`${pkg.name}.main`); const baseUrl = getNavigationsValue(`${(pkg as any).name}.main`);
const navs = getNavigations(); const navs = getNavigations();
const makeUrl = url => baseUrl + url; const makeUrl = url => baseUrl + url;
export const URLs = { export const URLs = {
baseUrl, baseUrl,
auth: { auth: {
url: makeUrl(navs[`link.${pkg.name}.auth`]), url: makeUrl(navs[`link.${(pkg as any).name}.auth`]),
}, },
account: {
url: makeUrl(navs[`link.${(pkg as any).name}.account`]),
}
}; };

View File

@ -3,16 +3,16 @@ import { Routes, Route, Navigate } from 'react-router-dom';
import { URLs } from './__data__/urls'; import { URLs } from './__data__/urls';
const Hello = () => <h1>Hello</h1>; import HomePage from './pages/HomePage.jsx'
import Hello from './pages/Hello.jsx'
import Account from './pages/Account.jsx'
export const Dashboard = () => { export const Dashboard = () => {
return ( return (
<Routes> <Routes>
<Route <Route path={URLs.baseUrl} element={<HomePage/>}/>
path={URLs.baseUrl} <Route path={URLs.auth.url} element={<Hello/>} />
element={<Navigate replace to={URLs.auth.url} />} <Route path={URLs.account.url} element={<Account/>}/>
/>
<Route path={URLs.auth.url} element={<Hello />} />
</Routes> </Routes>
); );
}; };

9
src/pages/Account.jsx Normal file
View File

@ -0,0 +1,9 @@
import React from "react";
const Account = () => {
return (
<h1>Account</h1>
)
}
export default Account;

9
src/pages/Hello.jsx Normal file
View File

@ -0,0 +1,9 @@
import React from "react";
const Hello = () => {
return (
<h1>Hello!</h1>
)
}
export default Hello;

9
src/pages/HomePage.jsx Normal file
View File

@ -0,0 +1,9 @@
import React from "react";
const HomePage = () => {
return (
<h1>Home</h1>
)
}
export default HomePage