aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/App.js
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2020-05-05 10:40:16 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:55 +0300
commit6ffdba946c8db14d09c95bb3d61d7095571d39b4 (patch)
tree52b910290085233bd667bdc15026d0c9d4b04083 /vnext/src/App.js
parent937539a35aac4cb0fb3541947d7256d650fa7b85 (diff)
Prepare to SSR
Diffstat (limited to 'vnext/src/App.js')
-rw-r--r--vnext/src/App.js138
1 files changed, 68 insertions, 70 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>
+ }
+ </>
);
}