diff options
-rw-r--r-- | vnext/src/App.js | 138 | ||||
-rw-r--r-- | vnext/src/index.js | 5 |
2 files changed, 72 insertions, 71 deletions
diff --git a/vnext/src/App.js b/vnext/src/App.js index f06d482f..765697ab 100644 --- a/vnext/src/App.js +++ b/vnext/src/App.js @@ -1,5 +1,5 @@ import React, { useState, useEffect, useRef } from 'react'; -import { BrowserRouter as Router, Route, Link, Switch } from 'react-router-dom'; +import { Route, Link, Switch } from 'react-router-dom'; import { useScroll, useRafState } from 'react-use'; import qs from 'qs'; @@ -146,74 +146,72 @@ export default function App() { }); }; return ( - <Router> - <> - <Header visitor={visitor} className={scrollState.hidden ? elClassHidden : ''} /> - <section id="content" ref={contentRef} className={scrollState.top ? elClassTop : ''}> - <Switch> - <Route exact path="/"> - <Discussions visitor={visitor} /> - </Route> - <Route exact path="/home"> - <Home visitor={visitor} /> - </Route> - <Route exact path="/discover"> - <Discover visitor={visitor} /> - </Route> - <Route exact path="/settings"> - <Settings visitor={visitor} onChange={auth} /> - </Route> - <Route exact path="/login"> - <Login visitor={visitor} onAuth={auth} /> - </Route> - <Route exact path="/post"> - <Post visitor={visitor} /> - </Route> - <Route exact path="/pm"> - <Contacts visitor={visitor} /> - </Route> - <Route exact path="/pm/:user"> - <Chat connection={eventSource} visitor={visitor} /> - </Route> - <Route exact path="/:user/friends"> - <Friends /> - </Route> - <Route exact path="/:user/readers"> - <Readers /> - </Route> - <Route exact path="/:user"> - <Blog visitor={visitor} /> - </Route> - <Route exact path="/tag/:tag"> - <Tag visitor={visitor} /> - </Route> - <Route exact path="/:user/:mid"> - <Thread connection={eventSource} visitor={visitor} /> - </Route> - </Switch> - </section> - { - visitor.uid > 0 && - <aside id="sidebar"> - <Link to="/?show=my"> - <Icon name="ei-clock" size="s" /> - <span className="desktop">My feed</span> - </Link> - <Link to="/pm"> - <Icon name="ei-envelope" size="s" /> - <span className="desktop">Messages</span> - </Link> - <Link to="/?show=discuss"> - <Icon name="ei-bell" size="s" /> - <span className="desktop">Discussions</span> - </Link> - <Link to="/settings" rel="nofollow"> - <Icon name="ei-gear" size="s" /> - <span className="desktop">Settings</span> - </Link> - </aside> - } - </> - </Router> + <> + <Header visitor={visitor} className={scrollState.hidden ? elClassHidden : ''} /> + <section id="content" ref={contentRef} className={scrollState.top ? elClassTop : ''}> + <Switch> + <Route exact path="/"> + <Discussions visitor={visitor} /> + </Route> + <Route exact path="/home"> + <Home visitor={visitor} /> + </Route> + <Route exact path="/discover"> + <Discover visitor={visitor} /> + </Route> + <Route exact path="/settings"> + <Settings visitor={visitor} onChange={auth} /> + </Route> + <Route exact path="/login"> + <Login visitor={visitor} onAuth={auth} /> + </Route> + <Route exact path="/post"> + <Post visitor={visitor} /> + </Route> + <Route exact path="/pm"> + <Contacts visitor={visitor} /> + </Route> + <Route exact path="/pm/:user"> + <Chat connection={eventSource} visitor={visitor} /> + </Route> + <Route exact path="/:user/friends"> + <Friends /> + </Route> + <Route exact path="/:user/readers"> + <Readers /> + </Route> + <Route exact path="/:user"> + <Blog visitor={visitor} /> + </Route> + <Route exact path="/tag/:tag"> + <Tag visitor={visitor} /> + </Route> + <Route exact path="/:user/:mid"> + <Thread connection={eventSource} visitor={visitor} /> + </Route> + </Switch> + </section> + { + visitor.uid > 0 && + <aside id="sidebar"> + <Link to="/?show=my"> + <Icon name="ei-clock" size="s" /> + <span className="desktop">My feed</span> + </Link> + <Link to="/pm"> + <Icon name="ei-envelope" size="s" /> + <span className="desktop">Messages</span> + </Link> + <Link to="/?show=discuss"> + <Icon name="ei-bell" size="s" /> + <span className="desktop">Discussions</span> + </Link> + <Link to="/settings" rel="nofollow"> + <Icon name="ei-gear" size="s" /> + <span className="desktop">Settings</span> + </Link> + </aside> + } + </> ); } diff --git a/vnext/src/index.js b/vnext/src/index.js index 5f45ecc2..6cbb3c44 100644 --- a/vnext/src/index.js +++ b/vnext/src/index.js @@ -1,5 +1,6 @@ import React, { lazy, Suspense } from 'react'; import ReactDOM from 'react-dom'; +import { BrowserRouter } from 'react-router-dom'; import './index.css'; @@ -16,7 +17,9 @@ const Juick = lazy(() => import('./App')); const JuickApp = () => ( <React.StrictMode> <Suspense fallback={LoadingView()}> - <Juick /> + <BrowserRouter> + <Juick /> + </BrowserRouter> </Suspense> </React.StrictMode> ); |