2020-04-24 14:54:50 +00:00
|
|
|
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 HostModal extends Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
this.state = this.initialState;
|
|
|
|
|
2020-05-02 14:40:29 +00:00
|
|
|
this.saveGuestSettings = this.saveGuestSettings.bind(this);
|
2020-04-24 14:54:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
get initialState() {
|
|
|
|
return {
|
|
|
|
//INITIAL STATE HERE
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
setInitialState() {
|
|
|
|
this.setState(this.initialState);
|
|
|
|
}
|
|
|
|
|
|
|
|
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 });
|
|
|
|
};
|
|
|
|
|
2020-05-02 14:40:29 +00:00
|
|
|
saveGuestSettings() {}
|
|
|
|
|
2020-04-24 14:54:50 +00:00
|
|
|
render() {
|
|
|
|
return (
|
2020-05-02 14:40:29 +00:00
|
|
|
<React.Fragment>
|
|
|
|
<Responsive minWidth={768}>
|
|
|
|
<Button icon labelPosition="left" inverted onClick={this.openModal}>
|
|
|
|
<Icon name="plus" size="small" />
|
|
|
|
Invitation settings
|
|
|
|
</Button>
|
|
|
|
</Responsive>
|
|
|
|
<Responsive maxWidth={768}>
|
|
|
|
{this.type === "new" ? (
|
|
|
|
<Button icon fluid labelPosition="left" onClick={this.openModal}>
|
|
|
|
<Icon name="plus" size="small" />
|
|
|
|
Invitation settings
|
|
|
|
</Button>
|
|
|
|
) : (
|
|
|
|
<Button icon fluid labelPosition="left" onClick={this.openModal}>
|
|
|
|
<Icon name="pencil" size="small" />
|
|
|
|
EDIT AUTOMATION
|
|
|
|
</Button>
|
|
|
|
)}
|
|
|
|
</Responsive>
|
2020-04-24 14:54:50 +00:00
|
|
|
|
|
|
|
<Modal closeIcon onClose={this.closeModal} open={this.state.openModal}>
|
2020-05-02 14:40:29 +00:00
|
|
|
<Header>Select guests</Header>
|
2020-04-24 14:54:50 +00:00
|
|
|
<Modal.Content>
|
2020-05-02 14:40:29 +00:00
|
|
|
<marquee scrollamount="50">
|
|
|
|
<h1>Spaghetti!</h1>
|
|
|
|
</marquee>
|
2020-04-24 14:54:50 +00:00
|
|
|
</Modal.Content>
|
|
|
|
<Modal.Actions>
|
|
|
|
<Button color="red" onClick={this.closeModal}>
|
2020-05-02 14:40:29 +00:00
|
|
|
<Icon name="remove" /> Discard changes
|
2020-04-24 14:54:50 +00:00
|
|
|
</Button>
|
|
|
|
|
2020-05-02 14:40:29 +00:00
|
|
|
<Button color="green" onClick={this.saveGuestSettings}>
|
|
|
|
<Icon name="checkmark" /> Save changes
|
2020-04-24 14:54:50 +00:00
|
|
|
</Button>
|
|
|
|
</Modal.Actions>
|
|
|
|
</Modal>
|
2020-05-02 14:40:29 +00:00
|
|
|
</React.Fragment>
|
2020-04-24 14:54:50 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const setActiveHost = (activeHost) => {
|
2020-05-02 14:40:29 +00:00
|
|
|
return (dispatch) => dispatch(appActions.setActiveHost(activeHost));
|
2020-04-24 14:54:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const mapStateToProps = (state, ownProps) => ({
|
|
|
|
hostss: ownProps.id ? state.hostss[ownProps.id] : null,
|
|
|
|
});
|
|
|
|
const HostModalContainer = connect(
|
|
|
|
mapStateToProps,
|
|
|
|
{ ...RemoteService, setActiveHost },
|
|
|
|
null,
|
|
|
|
{ forwardRef: true }
|
|
|
|
)(HostModal);
|
|
|
|
export default HostModalContainer;
|