client/src/components/Navbar.js
changeset 81 a6bd1aaddc34
parent 65 14989b339e5d
child 104 d48a74232d22
equal deleted inserted replaced
80:b3a02ea6d097 81:a6bd1aaddc34
    35   return (
    35   return (
    36     <NavItem onClick={onClickLogin} href="/login">Login</NavItem>
    36     <NavItem onClick={onClickLogin} href="/login">Login</NavItem>
    37   );
    37   );
    38 }
    38 }
    39 
    39 
       
    40 const Online = ({ offline }) => {
       
    41   return (
       
    42     <NavItem>
       
    43       <span className="material-icons" style={{ color: offline.online ? '#2ECC71' : '#E74C3C' }}>signal_wifi_4_bar</span>
       
    44     </NavItem>
       
    45   )
       
    46 }
       
    47 
    40 class AppNavbar extends Component {
    48 class AppNavbar extends Component {
    41 
    49 
    42   onClickHome = (e) => {
    50   onClickHome = (e) => {
    43     e.preventDefault();
    51     e.preventDefault();
    44     this.props.history.push('/');
    52     this.props.history.push('/');
    61         <Navbar.Collapse>
    69         <Navbar.Collapse>
    62           <Nav>
    70           <Nav>
    63             <NavItem onClick={this.onClickSessions} href="/sessions">Sessions</NavItem>
    71             <NavItem onClick={this.onClickSessions} href="/sessions">Sessions</NavItem>
    64           </Nav>
    72           </Nav>
    65           <Nav pullRight>
    73           <Nav pullRight>
    66             <LoginNav {...this.props}/>
    74             <Online {...this.props} />
       
    75             <LoginNav {...this.props} />
    67           </Nav>
    76           </Nav>
    68         </Navbar.Collapse>
    77         </Navbar.Collapse>
    69       </Navbar>
    78       </Navbar>
    70     );
    79     );
    71   }
    80   }
    77 
    86 
    78 function mapStateToProps(state, props) {
    87 function mapStateToProps(state, props) {
    79   return {
    88   return {
    80     isAuthenticated: state['isAuthenticated'],
    89     isAuthenticated: state['isAuthenticated'],
    81     currentUser: state['currentUser'],
    90     currentUser: state['currentUser'],
       
    91     offline: state['offline']
    82   };
    92   };
    83 }
    93 }
    84 
    94 
    85 function mapDispatchToProps(dispatch) {
    95 function mapDispatchToProps(dispatch) {
    86   return {
    96   return {