diff --git a/smart-hut/src/components/modalform.js b/smart-hut/src/components/modalform.js index 960ff2a..87835a3 100644 --- a/smart-hut/src/components/modalform.js +++ b/smart-hut/src/components/modalform.js @@ -102,32 +102,50 @@ export default class ModalWindow extends Component { padding: "10px 10px", margin: "10px 0px", }; - console.log(this.state, this.idRoom); return (
- - {this.props.type === "new" ? ( - - ) : ( - - )} - - - {this.props.type === "new" ? ( - - ) : ( - - )} - + {!this.props.nicolaStop ? ( +
+ + {this.props.type === "new" ? ( + + ) : ( + + )} + + + {this.props.type === "new" ? ( + + ) : ( + + )} + +
+ ) : null}
diff --git a/smart-hut/src/views/Navbar.js b/smart-hut/src/views/Navbar.js index 9e0f1f9..37b45e1 100644 --- a/smart-hut/src/views/Navbar.js +++ b/smart-hut/src/views/Navbar.js @@ -1,5 +1,12 @@ import React, { Component } from "react"; -import { Menu, Grid, Icon, Responsive, Dropdown } from "semantic-ui-react"; +import { + Menu, + Button, + Grid, + Icon, + Responsive, + Dropdown, +} from "semantic-ui-react"; import { editButtonStyle } from "../components/dashboard/devices/styleComponents"; import ModalWindow from "../components/modalform"; @@ -13,6 +20,11 @@ class Navbar extends Component { editMode: false, room: "", }; + + this.roomRefs = {}; + this.props.rooms.forEach((e) => { + this.roomRefs[e.id] = React.createRef(); + }); } componentDidMount() { @@ -26,13 +38,10 @@ class Navbar extends Component { handleClick = (e, { id, name }) => { const room = this.props.rooms.filter((d) => d.id === id)[0]; - console.log(room); this.setState({ activeItem: id, activeItemName: name, }); - this.activeRoom = room; - console.log(this.activeRoom); this.forceUpdate(); this.props.handleItemClick(id); }; @@ -137,6 +146,8 @@ class Navbar extends Component { {this.props.rooms ? this.props.rooms.map((e, i) => { + if (!this.roomRefs[e.id]) + this.roomRefs[e.id] = React.createRef(); return ( {e.name} + ); }) @@ -167,15 +186,17 @@ class Navbar extends Component { {this.state.activeItem !== -1 ? ( - { - console.log("MALUSA", this.activeRoom); - return this.activeRoom; - }} - updateRoom={this.props.updateRoom} - deleteRoom={this.props.deleteRoom} - /> + ) : null}