first commit

This commit is contained in:
Ilias Dzhabbarov
2024-09-07 11:27:38 +03:00
commit 76bbdbfb61
11 changed files with 7941 additions and 0 deletions

13
src/__data__/urls.ts Normal file
View File

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

15
src/app.tsx Normal file
View File

@@ -0,0 +1,15 @@
import React from 'react';
import { BrowserRouter } from 'react-router-dom';
import { Dashboard } from './dashboard';
const App = () => {
return(
<BrowserRouter>
<Dashboard />
</BrowserRouter>
)
}
export default App;

18
src/dashboard.tsx Normal file
View File

@@ -0,0 +1,18 @@
import React from 'react';
import { Routes, Route, Navigate } from 'react-router-dom';
import { URLs } from './__data__/urls';
const Hello = () => <h1>Hello</h1>;
export const Dashboard = () => {
return (
<Routes>
<Route
path={URLs.baseUrl}
element={<Navigate replace to={URLs.auth.url} />}
/>
<Route path={URLs.auth.url} element={<Hello />} />
</Routes>
);
};

23
src/index.tsx Normal file
View File

@@ -0,0 +1,23 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './app';
export default () => <App/>;
let rootElement: ReactDOM.Root
export const mount = (Сomponent, element = document.getElementById('app')) => {
const rootElement = ReactDOM.createRoot(element);
rootElement.render(<Сomponent/>);
if(module.hot) {
module.hot.accept('./app', ()=> {
rootElement.render(<Сomponent/>);
})
}
};
export const unmount = () => {
rootElement.unmount();
};