import "./index.css"; import "./index.mobile.css"; import { FC } from "react"; import Switch from "@mui/material/Switch"; import Alert from "@mui/material/Alert"; import DeleteForeverIcon from "@mui/icons-material/DeleteForever"; import SelectIcon from "@mui/icons-material/HighlightAltSharp"; import RunIcon from "@mui/icons-material/RunCircleOutlined"; import { InputTextView } from "components/Inputs/InputTextView"; import { ButtonIcon } from "components/Icons/ButtonIcons"; import { AutomationManagerAuto } from "../types"; import { Tags } from "./Tags"; import { TagDB } from "../TagDB"; export type MetadataBoxProps = AutomationManagerAuto & { onDelete: () => void; onSelect: () => void; onRun: () => void; onStateUpdate: (s: "on" | "off") => void; onTitleUpdate: (t: string) => void; onDescriptionUpdate: (t: string) => void; tagsDB: TagDB; isSelected: boolean; }; export const MetadataBox: FC = (props) => { const isValidState = ["on", "off"].includes(props.state); return (
props.onStateUpdate(props.state === "on" ? "off" : "on") } disabled={!isValidState} color={!isValidState ? "error" : "info"} /> {!isValidState && `Invalid state: '${props.state}'`}
{!props.isNew && } {props.issue ? ( {props.issue} ) : ( <> )}
} onClick={props.onSelect} /> } onClick={props.onRun} /> } onClick={props.onDelete} />
); };