Merge branch '30-fix-updated-dashboard-and-routes' into 'dev'

fix and updated Dashboard and Routes

Closes #30

See merge request sa4-2020/the-sanmarinoes/frontend!22
This commit is contained in:
Claudio Maggioni 2020-03-13 15:22:29 +01:00
commit d666b50d57

View file

@ -1,11 +1,13 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import DevicePanel from "../components/dashboard/DevicePanel"; import DevicePanel from "../components/dashboard/DevicePanel";
import NavbarTest from './NavbarTest'
import MyHeader from '../components/HeaderController'
import { call } from '../client_server'; import { call } from '../client_server';
import {Button} from 'semantic-ui-react'; import {Button} from 'semantic-ui-react';
import { Menu } from 'semantic-ui-react' import { Menu } from 'semantic-ui-react'
import { Grid, Image, Icon } from 'semantic-ui-react' import { Grid, Image, Icon } from 'semantic-ui-react'
import NavbarTest from './NavbarTest'
export default class Dashboard extends Component{ export default class Dashboard extends Component{
constructor(props) { constructor(props) {
@ -19,7 +21,7 @@ export default class Dashboard extends Component{
this.handleItemClick = this.handleItemClick.bind(this); this.handleItemClick = this.handleItemClick.bind(this);
} }
UNSAFE_componentWillMount() { componentDidMount() {
call.getAllRooms(this.props.token) call.getAllRooms(this.props.token)
.then(res => { .then(res => {
res.data.forEach((e) => { res.data.forEach((e) => {
@ -60,19 +62,17 @@ export default class Dashboard extends Component{
render () { render () {
return( return(
<div style={{height : "110vh"}}> <div style={{height : "110vh", background: '#1b1c1d'}}>
<Button color='blue' fluid size='large' onClick={this.addRoom}> <MyHeader />
Add Room <Grid >
</Button> <Grid.Row color='black'>
<Grid>
<Grid.Row>
<Grid.Column width={3}> <Grid.Column width={3}>
<NavbarTest rooms={this.state.rooms} handleItemClick={this.handleItemClick}/> <NavbarTest addRoom={this.addRoom} rooms={this.state.rooms} handleItemClick={this.handleItemClick}/>
</Grid.Column> </Grid.Column>
<Grid.Column width={13}> <Grid.Column width={13}>
<DevicePanel /> <DevicePanel />
</Grid.Column> </Grid.Column>
</Grid.Row> </Grid.Row>
</Grid> </Grid>
</div> </div>