From 098e0fe1da7cf1f4a6de7b7369b5b62ea9e154a3 Mon Sep 17 00:00:00 2001 From: Nikolai Petukhov Date: Sat, 14 Sep 2024 09:38:49 +0300 Subject: [PATCH] routing --- ijl.config.js | 5 +++-- package.json | 3 ++- src/__data__/urls.ts | 7 +++++-- src/dashboard.tsx | 12 ++++++------ src/pages/Account.jsx | 9 +++++++++ src/pages/Hello.jsx | 9 +++++++++ src/pages/HomePage.jsx | 9 +++++++++ 7 files changed, 43 insertions(+), 11 deletions(-) create mode 100644 src/pages/Account.jsx create mode 100644 src/pages/Hello.jsx create mode 100644 src/pages/HomePage.jsx diff --git a/ijl.config.js b/ijl.config.js index 4579778..b769662 100644 --- a/ijl.config.js +++ b/ijl.config.js @@ -8,8 +8,9 @@ module.exports = { } }, navigations: { - 'undefined.main': '/undefined', - 'link.undefined.auth': '/auth' + 'enter.main': '/enter', + 'link.enter.auth': '/auth', + 'link.enter.account': '/account', }, features: { 'undefined': { diff --git a/package.json b/package.json index 6c7db62..43fd9ba 100644 --- a/package.json +++ b/package.json @@ -15,5 +15,6 @@ "build": "npm run clean && ijl-cli build --dev", "build:prod": "npm run clean && ijl-cli build", "clean": "rimraf dist" - } + }, + "name": "enter" } diff --git a/src/__data__/urls.ts b/src/__data__/urls.ts index 7c65b3a..8f419f3 100644 --- a/src/__data__/urls.ts +++ b/src/__data__/urls.ts @@ -1,13 +1,16 @@ import { getNavigations, getNavigationsValue } from '@ijl/cli'; import pkg from '../../package.json'; -const baseUrl = getNavigationsValue(`${pkg.name}.main`); +const baseUrl = getNavigationsValue(`${(pkg as any).name}.main`); const navs = getNavigations(); const makeUrl = url => baseUrl + url; export const URLs = { baseUrl, 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`]), + } }; diff --git a/src/dashboard.tsx b/src/dashboard.tsx index 073773f..f52fb3f 100644 --- a/src/dashboard.tsx +++ b/src/dashboard.tsx @@ -3,16 +3,16 @@ import { Routes, Route, Navigate } from 'react-router-dom'; import { URLs } from './__data__/urls'; -const Hello = () =>

Hello

; +import HomePage from './pages/HomePage.jsx' +import Hello from './pages/Hello.jsx' +import Account from './pages/Account.jsx' export const Dashboard = () => { return ( - } - /> - } /> + }/> + } /> + }/> ); }; diff --git a/src/pages/Account.jsx b/src/pages/Account.jsx new file mode 100644 index 0000000..6f366ae --- /dev/null +++ b/src/pages/Account.jsx @@ -0,0 +1,9 @@ +import React from "react"; + +const Account = () => { + return ( +

Account

+ ) +} + +export default Account; \ No newline at end of file diff --git a/src/pages/Hello.jsx b/src/pages/Hello.jsx new file mode 100644 index 0000000..4633c3c --- /dev/null +++ b/src/pages/Hello.jsx @@ -0,0 +1,9 @@ +import React from "react"; + +const Hello = () => { + return ( +

Hello!

+ ) +} + +export default Hello; \ No newline at end of file diff --git a/src/pages/HomePage.jsx b/src/pages/HomePage.jsx new file mode 100644 index 0000000..7882196 --- /dev/null +++ b/src/pages/HomePage.jsx @@ -0,0 +1,9 @@ +import React from "react"; + +const HomePage = () => { + return ( +

Home

+ ) +} + +export default HomePage \ No newline at end of file