import React, { Component } from "react"; import { Menu, Grid, Icon, Responsive, Dropdown } from "semantic-ui-react"; import { editButtonStyle } from "../components/dashboard/devices/styleComponents"; import ModalWindow from "../components/modalform"; class Navbar extends Component { constructor(props) { super(props); this.state = { activeItemName: "Home", activeItem: -1, edited: "", editMode: false, room: "", }; } componentDidMount() { this.setState({ activeItem: this.props.activeItem, }); } editModeController = (e) => this.setState((prevState) => ({ editMode: !prevState.editMode })); 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); }; render() { return (
HOME {this.props.rooms ? this.props.rooms.map((e, i) => { return ( {e.name} {this.state.editMode ? ( ) : null} ); }) : null} Home {this.props.rooms ? this.props.rooms.map((e, i) => { return ( {e.name} ); }) : null} {this.state.activeItem !== -1 ? ( { console.log("MALUSA", this.activeRoom); return this.activeRoom; }} updateRoom={this.props.updateRoom} deleteRoom={this.props.deleteRoom} /> ) : null}
); } } export default Navbar;