diff -r 6f3078f7fd47 -r be36eed5e6e0 client/src/components/Navbar.js --- a/client/src/components/Navbar.js Thu Aug 03 09:44:37 2017 +0200 +++ b/client/src/components/Navbar.js Thu Aug 03 17:33:00 2017 +0200 @@ -7,7 +7,9 @@ import { Navbar, Nav, NavItem, NavDropdown, MenuItem, Modal, Button } from 'react-bootstrap'; import * as authActions from '../actions/authActions'; import { forceSync } from '../actions/networkActions'; -import { ActionEnum } from '../constants'; +import { groupSetCurrent } from '../actions/groupActions'; +import { isAuthenticated, getCurrentUser, getOnline, getCurrentGroup, getGroups } from '../selectors/authSelectors'; +import { isSynchronizing, isSynchronized } from '../selectors/syncSelectors'; import './Navbar.css'; const LoginNav = ({isAuthenticated, currentUser, history, authActions, onLogout}) => { @@ -63,6 +65,27 @@ ) } +const GroupStatus = ({currentGroup, groups, onSelect}) => { + + if(currentGroup) { + const currentGroupName = currentGroup.get('name'); + return ( + + { groups && groups.map((group, key) => { + const groupName = group.get('name'); + const className = (groupName === currentGroupName)?'active':null; + return { groupName } + } + )} + Créer un groupe... + + ) + } else { + return null; + } + +} + class AppNavbar extends Component { state = { @@ -116,6 +139,14 @@ this.props.networkActions.forceSync(); } + onGroupSelect = (groupName) => { + if(groupName === "__create_group__") { + this.props.history.push('/create-group'); + } else { + this.props.groupActions.groupSetCurrent(groupName); + } + } + render() { return ( @@ -130,6 +161,7 @@ Sessions