diff options
author | Vitaly Takmazov | 2018-06-21 11:43:03 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-13 10:37:53 +0300 |
commit | 2c433fec318f67efed0633bdb209243162503299 (patch) | |
tree | 790be94781c3f340525c2ec52efd433d2dfac2bf /vnext/src/index.js | |
parent | d2b8ee34e4142886222568a3f6913c318c031457 (diff) |
cleanup user column
Diffstat (limited to 'vnext/src/index.js')
-rw-r--r-- | vnext/src/index.js | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/vnext/src/index.js b/vnext/src/index.js index 492b569e..88e44465 100644 --- a/vnext/src/index.js +++ b/vnext/src/index.js @@ -85,14 +85,15 @@ class App extends React.Component { }; }; render() { + const user = this.state.visitor; return ( <Router> <React.Fragment> <header className={this.state.headerClassName}> <div id="header_wrapper"> - {this.state.visitor.uid > 0 ? + {user.uid > 0 ? <div id="ctitle"> - {this.state.visitor.uname ? <Avatar user={this.state.visitor} /> : <Icon name="ei-spinner" size="m" />} + {user.uname ? <Avatar user={user} /> : <Icon name="ei-spinner" size="m" />} </div> : <div id="logo"><Link to="/">Juick</Link></div> @@ -105,14 +106,14 @@ class App extends React.Component { </div> <nav id="global"> <ul> - {this.state.visitor.uid > 0 ? + {user.uid > 0 ? <li><Link to={{ pathname: '/discussions' }}><Icon name="ei-comment" size="s" />Discuss</Link></li> : <li><Link to='/?media=1' rel="nofollow"><Icon name="ei-camera" size="s" />Photos</Link></li> } <li><Link to={{ pathname: '/' }} rel="nofollow"><Icon name="ei-search" size="s" />Discover</Link></li> <li> - {this.state.visitor.uid > 0 ? + {user.uid > 0 ? <Link to={{ pathname: '/post' }}><Icon name="ei-pencil" size="s" />Post</Link> : <LoginButton title="Login" onAuth={this.auth.bind(this)} /> @@ -125,23 +126,23 @@ class App extends React.Component { <div id="wrapper"> <section id="content"> <Switch> - <Route exact path="/" render={(props) => <Discover visitor={this.state.visitor} {...props} />} /> - <Route exact path="/home" render={(props) => <Home visitor={this.state.visitor} {...props} />} /> + <Route exact path="/" render={(props) => <Discover visitor={user} {...props} />} /> + <Route exact path="/home" render={(props) => <Home visitor={user} {...props} />} /> <Route exact path="/discussions" render={(props) => - <Discussions visitor={this.state.visitor} {...props} /> + <Discussions visitor={user} {...props} /> } /> <Route exact path="/settings" render={(props) => - <Settings visitor={this.state.visitor} {...props} /> + <Settings visitor={user} {...props} /> } /> - <Route exact path="/post" render={(props) => <Post visitor={this.state.visitor} {...props} />} /> - <Route exact path="/:user" render={(props) => <Blog visitor={this.state.visitor} {...props} />} /> - <Route exact path="/tag/:tag" render={(props) => <Tag visitor={this.state.visitor} {...props} />} /> - <Route exact path="/:user/:mid" render={(props) => <Thread visitor={this.state.visitor} {...props} />} /> + <Route exact path="/post" render={(props) => <Post visitor={user} {...props} />} /> + <Route exact path="/:user" render={(props) => <Blog visitor={user} {...props} />} /> + <Route exact path="/tag/:tag" render={(props) => <Tag visitor={user} {...props} />} /> + <Route exact path="/:user/:mid" render={(props) => <Thread visitor={user} {...props} />} /> </Switch> </section> <aside id="column"> { - this.state.visitor.uid > 0 && + user.uid > 0 && <React.Fragment> <ul> <li> @@ -155,12 +156,12 @@ class App extends React.Component { </Link> </li> <li> - <Link to="/{{ user.name }}/?show=recomm" rel="nofollow"> + <Link to={`/${user.uname}/?show=recomm`} rel="nofollow"> <Icon name="ei-heart" size="s" />Recommendations </Link> </li> <li> - <Link to="/{{ user.name }}/?show=photos" rel="nofollow"> + <Link to={`/${user.uname}/?show=photos`} rel="nofollow"> <Icon name="ei-camera" size="s" />Photos </Link> </li> @@ -171,26 +172,26 @@ class App extends React.Component { </li> </ul> <hr /> - <form action="/{{ user.name }}/"> + <form> <p><input type="text" name="search" className="inp" placeholder="Search..." /></p> </form> <hr /> <div id="ustats"> <ul> - <li><a href="/{{ user.name }}/friends">I read: {this.state.visitor.statsIRead}</a></li> - <li><a href="/{{ user.name }}/readers">My readers: {this.state.visitor.statsMyReaders}</a></li> + <li><Link to={`/${user.uname}/friends`}>I read: {user.statsIRead}</Link></li> + <li><Link to={`/${user.uname}/readers`}>My readers: {user.statsMyReaders}</Link></li> { - this.state.visitor.statsMyBL && - <li><a href="/{{ user.name }}/bl">My blacklist: {this.state.visitor.statsMyBL}</a></li> + user.statsMyBL && + <li><Link to={`/${user.uname}/bl`}>My blacklist: {user.statsMyBL}</Link></li> } - <li>Messages: {this.state.visitor.statsMessages}</li> - <li>Comments: {this.state.visitor.statsReplies}</li> + <li>Messages: {user.statsMessages}</li> + <li>Comments: {user.statsReplies}</li> </ul> { - this.state.visitor.iread && + user.iread && <div className="iread"> { - this.state.visitor.iread.map(u => <Avatar user={u} />) + user.iread.map(u => <Avatar user={u} />) } </div> } |