2021-01-09 18:26:46 +01:00
|
|
|
import { h } from 'preact';
|
2021-01-30 17:52:37 +01:00
|
|
|
import ActivityIndicator from './components/ActivityIndicator';
|
2021-01-09 18:26:46 +01:00
|
|
|
import Camera from './Camera';
|
|
|
|
import CameraMap from './CameraMap';
|
|
|
|
import Cameras from './Cameras';
|
|
|
|
import Debug from './Debug';
|
|
|
|
import Event from './Event';
|
|
|
|
import Events from './Events';
|
|
|
|
import { Router } from 'preact-router';
|
|
|
|
import Sidebar from './Sidebar';
|
2021-01-30 17:52:37 +01:00
|
|
|
import Api, { FetchStatus, useConfig } from './api';
|
2021-01-09 18:26:46 +01:00
|
|
|
|
|
|
|
export default function App() {
|
2021-01-26 16:04:03 +01:00
|
|
|
const { data, status } = useConfig();
|
2021-01-30 17:52:37 +01:00
|
|
|
return status !== FetchStatus.LOADED ? (
|
|
|
|
<div className="flex flex-grow-1 min-h-screen justify-center items-center">
|
|
|
|
<ActivityIndicator />
|
|
|
|
</div>
|
2021-01-09 18:26:46 +01:00
|
|
|
) : (
|
2021-01-26 16:04:03 +01:00
|
|
|
<div className="md:flex flex-col md:flex-row md:min-h-screen w-full bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-white">
|
|
|
|
<Sidebar />
|
|
|
|
<div className="flex-auto p-2 md:p-4 lg:pl-8 lg:pr-8 min-w-0">
|
|
|
|
<Router>
|
|
|
|
<CameraMap path="/cameras/:camera/editor" />
|
|
|
|
<Camera path="/cameras/:camera" />
|
|
|
|
<Event path="/events/:eventId" />
|
|
|
|
<Events path="/events" />
|
|
|
|
<Debug path="/debug" />
|
|
|
|
<Cameras default path="/" />
|
|
|
|
</Router>
|
2021-01-09 18:26:46 +01:00
|
|
|
</div>
|
2021-01-26 16:04:03 +01:00
|
|
|
</div>
|
2021-01-09 18:26:46 +01:00
|
|
|
);
|
|
|
|
}
|