first commit
This commit is contained in:
38
src/components/App.js
Normal file
38
src/components/App.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import { h } from 'preact';
|
||||
import { Router } from 'preact-router';
|
||||
import ContextsProviders from '../Contexts';
|
||||
import Header from './Header';
|
||||
|
||||
|
||||
// Code-splitting is automated for `routes` directory
|
||||
import Home from '../routes/Home';
|
||||
import Plant from '../routes/Plant';
|
||||
import Profile from '../routes/Profile';
|
||||
import {useEffect} from "preact/hooks";
|
||||
|
||||
const App = () => {
|
||||
|
||||
useEffect(() => {
|
||||
if (!Notification) {
|
||||
alert('Le navigateur ne supporte pas les notifications.');
|
||||
} else if (Notification.permission !== 'granted') {
|
||||
Notification.requestPermission();
|
||||
}
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div id="app" class="h-screen overflow-auto flex flex-col">
|
||||
<ContextsProviders>
|
||||
<Header />
|
||||
<main className="flex-1 dark:bg-gray-800 dark:text-white">
|
||||
<Router>
|
||||
<Home path="/" />
|
||||
<Plant path="plant/:id" />
|
||||
<Profile path="/profile" />
|
||||
</Router>
|
||||
</main>
|
||||
</ContextsProviders>
|
||||
</div>
|
||||
)}
|
||||
|
||||
export default App;
|
||||
Reference in New Issue
Block a user