import React, { Component, useState, useEffect } from "react"; import { connect } from "react-redux"; import { RemoteService } from "../../remote"; import "./Automations.css"; import { Segment, Grid, Header, Button, List, Divider, Menu, } from "semantic-ui-react"; import CreateAutomation, { operands } from "./AutomationCreationModal"; const Automation = ({ automation, devices, scenes, removeAutomation }) => { const { triggers } = automation; const scenePriorities = automation.scenes; const getOperator = (operand) => operands.filter((o) => o.key === operand)[0].text; return (
{automation.name}
)} {this.props.automations.map((automation, i) => { console.log(23, automation, i, this.props.automations); return ( ); })} ); } } const mapStateToProps = (state, _) => ({ activeRoom: state.active.activeRoom, activeTab: state.active.activeTab, get scenes() { return Object.values(state.scenes); }, get devices() { return Object.values(state.devices); }, get automations() { console.log(state.automations); return Object.values(state.automations); }, }); const AutomationsPanelContainer = connect( mapStateToProps, RemoteService )(AutomationsPanel); export default AutomationsPanelContainer;