import React, { Component } from "react"; import { Button, Header, Modal, Icon, Responsive } from "semantic-ui-react"; import { connect } from "react-redux"; import { RemoteService } from "../remote"; import { appActions } from "../storeActions"; //import { update } from "immutability-helper"; class AutomationModal extends Component { constructor(props) { super(props); this.state = this.initialState; this.setInitialState(); this.addAutomationModal = this.addAutomationModal.bind(this); this.modifyAutomationModal = this.modifyAutomationModal.bind(this); this.deleteAutomation = this.deleteAutomation.bind(this); } get initialState() { return { //INITIAL STATE HERE }; } setInitialState() { this.setState(this.initialState); } get type() { return !this.props.id ? "new" : "modify"; } addAutomationModal = (e) => { /*let data = { // DATA HERE };*/ // TODO CALL TO REMOTE SERVER TO ADD SCENE /*this.props .saveRoom(data, null) .then(() => { this.setInitialState(); this.closeModal(); }) .catch((err) => console.error("error in creating room", err));*/ }; modifyAutomationModal = (e) => { /* let data = { // DATA HERE };*/ // TODO CALL TO REMOTE SERVER TO MODIFY SCENE /*this.props .saveRoom(data, this.props.id) .then(() => { this.setInitialState(); this.closeModal(); }) .catch((err) => console.error("error in updating room", err));*/ }; deleteAutomation = (e) => { // TODO CALL TO REMOTE SERVER TO DELETE SCENE /* this.props .deleteRoom(this.props.id) .then(() => this.closeModal()) .catch((err) => console.error("error in deleting room", err));*/ }; changeSomething = (event) => { let nam = event.target.name; let val = event.target.value; this.setState({ [nam]: val }); }; closeModal = (e) => { this.setState({ openModal: false }); }; openModal = (e) => { this.setState({ openModal: true }); }; render() { return (