diff options
author | crupest <crupest@outlook.com> | 2020-06-11 17:27:15 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-06-11 17:27:15 +0800 |
commit | 93ce8560fa19c3a91de99643fdbbe4f895a47b84 (patch) | |
tree | 66a9e6f1bbbbd5a0a25c13a0e51e7a7c1225871c /Timeline/ClientApp/src/App.tsx | |
parent | 6893a1c1e43b8fc17eaaba72db90494d946b5091 (diff) | |
download | timeline-93ce8560fa19c3a91de99643fdbbe4f895a47b84.tar.gz timeline-93ce8560fa19c3a91de99643fdbbe4f895a47b84.tar.bz2 timeline-93ce8560fa19c3a91de99643fdbbe4f895a47b84.zip |
feat(front): Service worker is coming!
Diffstat (limited to 'Timeline/ClientApp/src/App.tsx')
-rw-r--r-- | Timeline/ClientApp/src/App.tsx | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/Timeline/ClientApp/src/App.tsx b/Timeline/ClientApp/src/App.tsx deleted file mode 100644 index befa2a9c..00000000 --- a/Timeline/ClientApp/src/App.tsx +++ /dev/null @@ -1,84 +0,0 @@ -import React from 'react'; -import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; -import { hot } from 'react-hot-loader/root'; - -import AppBar from './common/AppBar'; -import LoadingPage from './common/LoadingPage'; -import Home from './home/Home'; -import Login from './user/Login'; -import Settings from './settings/Settings'; -import About from './about/About'; -import User from './user/User'; -import TimelinePage from './timeline/TimelinePage'; -import AlertHost from './common/AlertHost'; - -import { checkUserLoginState, useOptionalUser } from './data/user'; - -const NoMatch: React.FC = () => { - return ( - <> - <AppBar /> - <div style={{ height: 56 }} /> - <div>Ah-oh, 404!</div> - </> - ); -}; - -const LazyAdmin = React.lazy(() => - import(/* webpackChunkName: "admin" */ './admin/Admin') -); - -const App: React.FC = () => { - const user = useOptionalUser(); - - React.useEffect(() => { - void checkUserLoginState(); - }, []); - - let body; - if (user === undefined) { - body = <LoadingPage />; - } else { - body = ( - <React.Suspense fallback={<LoadingPage />}> - <Switch> - <Route exact path="/"> - <Home /> - </Route> - <Route exact path="/login"> - <Login /> - </Route> - <Route path="/settings"> - <Settings /> - </Route> - <Route path="/about"> - <About /> - </Route> - <Route path="/timelines/:name"> - <TimelinePage /> - </Route> - <Route path="/users/:username"> - <User /> - </Route> - {user && user.administrator && ( - <Route path="/admin"> - <LazyAdmin user={user} /> - </Route> - )} - <Route> - <NoMatch /> - </Route> - </Switch> - </React.Suspense> - ); - } - - return ( - <> - <Router>{body}</Router> - <AlertHost /> - </> - ); -}; - -export default hot(App); |