2020-04-20 11:14:46 +02:00
|
|
|
import { FunctionalComponent, h } from "preact";
|
|
|
|
import { Route, Router, RouterOnChangeArgs } from "preact-router";
|
|
|
|
|
|
|
|
import Home from "../routes/home";
|
|
|
|
import Project from "../routes/project";
|
|
|
|
import NotFoundPage from '../routes/notfound';
|
|
|
|
import Header from "./header";
|
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
|
|
if ((module as any).hot) {
|
|
|
|
// tslint:disable-next-line:no-var-requires
|
|
|
|
require("preact/debug");
|
|
|
|
}
|
|
|
|
|
|
|
|
const App: FunctionalComponent = () => {
|
|
|
|
let currentUrl: string;
|
|
|
|
const handleRoute = (e: RouterOnChangeArgs) => {
|
|
|
|
currentUrl = e.url;
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div id="app">
|
2020-04-21 14:10:50 +02:00
|
|
|
<Header class="noPrint" />
|
2020-04-20 11:14:46 +02:00
|
|
|
<Router onChange={handleRoute}>
|
|
|
|
<Route path="/" component={Home} />
|
2020-04-20 14:07:26 +02:00
|
|
|
<Route path="/p/:projectId" component={Project} />
|
2020-04-20 11:14:46 +02:00
|
|
|
<NotFoundPage default />
|
|
|
|
</Router>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default App;
|