@@ -186,7 +350,9 @@ class App extends React.Component { {this.state.allUsers - .filter(u => u.nick !== this.state.user.nick) + .filter( + u => u.socketId !== this.socket.id && u.offline !== true + ) .map(u => ( - {this.state.namespaces + {this.state.allNamespaces .filter(n => n.namespace[0] === '#') .map(r => (
Chats
- {this.state.namespaces - .filter( - r => - r.sockets && - r.sockets.includes(this.state.user.socketId) && - r.namespace !== this.state.user.socketId - ) - .map(r => ( - - ))} + ) : null} + {/* user count for channels */} + {c[0] === '#' && + this.state.allNamespaces && + this.state.allNamespaces.find(n => n.namespace === c) ? ( +
+ { + this.state.allNamespaces.find(n => n.namespace === c) + .sockets.length + } +
+ ) : null} + + ))} {/*Main Section*/} @@ -278,23 +443,32 @@ class App extends React.Component { {/*Main Section Header*/}

- {title}: {this.state.namespace} + {title} {this.state.namespace}

{/*Main Section Content*/}
{this.state.messages - .filter(m => m.namespace === this.state.namespace) + .filter( + m => + (m.to[0] === '#' && m.to === this.state.namespace) || + (m.to[0] !== '#' && m.from === this.state.namespace) || + (m.from === this.state.user.socketId && + m.to === this.state.namespace) + ) .map(m => ( -
-
{m.date}
-
{m.from}
+
+
{m.date}
+
{m.nick}
{m.text}
))}
-
+ - submit as {this.state.nick} + submit as {this.state.user.nick}