flipped trigger + condition

createMode for condition editor
This commit is contained in:
ari committed 2022-07-10 12:59:33 -04:00
1 parent f549993d3e
commit e7dec306df
10 files changed
+51 -30

No files matched your search

@@ -18,6 +18,7 @@ export type ConditionNodeBaseProps = {
onDelete?: () => void;
onUpdate: (data: AutomationCondition) => void;
disableDelete?: boolean;
initialViewMode?: ConditionNodeBaseViewMode;
};
export type ConditionNodeBaseViewMode = "edit" | "yaml" | "view";
export const ConditionNodeBase: FC<ConditionNodeBaseProps> = (props) => {
@@ -31,7 +32,9 @@ export const ConditionNodeBase: FC<ConditionNodeBaseProps> = (props) => {
isEdited: false,
condition: props.condition,
});
const [mode, setMode] = useState<ConditionNodeBaseViewMode>("view");
const [mode, setMode] = useState<ConditionNodeBaseViewMode>(
props.initialViewMode ?? "view"
);
// alias
const updateCondition = (data: any) =>
setCondition({