import { h, Component } from 'preact'; import Trigger from './trigger'; import Script from './script'; export default class Automation extends Component { constructor() { super(); this.onChange = this.onChange.bind(this); this.triggerChanged = this.triggerChanged.bind(this); this.actionChanged = this.actionChanged.bind(this); } onChange(ev) { this.props.onChange({ ...this.props.automation, [ev.target.name]: ev.target.value, }); } triggerChanged(trigger) { this.props.onChange({ ...this.props.automation, trigger, }); } actionChanged(action) { this.props.onChange({ ...this.props.automation, action, }); } render({ automation, isWide }) { const { alias, trigger, condition, action } = automation; return (
{JSON.stringify(condition, null, 2)}