aboutsummaryrefslogtreecommitdiff
path: root/vnext
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-07-01 00:30:47 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:53 +0300
commit55759d99c1916000d065193f1535f65703d446c0 (patch)
tree73c57f8df7d22371a2fbf1e76112f05c27a6172a /vnext
parent61523ca4d0eb3a718e9b029bd3e121f3b539b3b1 (diff)
Unread badge
Diffstat (limited to 'vnext')
-rw-r--r--vnext/src/index.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/vnext/src/index.js b/vnext/src/index.js
index 1eb01eae..fda85fed 100644
--- a/vnext/src/index.js
+++ b/vnext/src/index.js
@@ -58,6 +58,12 @@ class App extends React.Component {
try {
var jsonMsg = JSON.parse(msg.data);
console.log('data: ' + msg.data);
+ // refresh server visitor state (unread counters)
+ me().then(visitor => {
+ this.setState({
+ visitor: visitor
+ })
+ });
if (jsonMsg.service) {
return;
}
@@ -84,7 +90,7 @@ class App extends React.Component {
componentDidMount() {
const { hash, uid } = this.state.visitor;
this.initWS();
- if (uid === 0 && hash) {
+ if (hash) {
me().then(visitor => this.auth(visitor))
}
}
@@ -111,7 +117,15 @@ class App extends React.Component {
<nav id="global">
<ul>
{user.uid > 0 ?
- <li><Link to={{ pathname: '/discussions' }}><Icon name="ei-comment" size="s" />Discuss</Link></li>
+ <li>
+ <Link to={{ pathname: '/discussions' }}>
+ <Icon name="ei-comment" size="s" /><span>Discuss</span>
+ {
+ user.unreadCount &&
+ <span className="badge">{user.unreadCount}</span>
+ }
+ </Link>
+ </li>
:
<li><Link to='/?media=1' rel="nofollow"><Icon name="ei-camera" size="s" />Photos</Link></li>
}