clean up styling
This commit is contained in:
1 parent
0aff219645
commit
9d8cc9ed3e
14 files changed
+156
-80
No files matched your search
@@ -101,3 +101,23 @@ Simple.args = {
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export const EmptyStart = Template.bind({})
|
||||
EmptyStart.args = {
|
||||
...EmptyStart.args,
|
||||
automation: {
|
||||
metadata: {
|
||||
id: "random",
|
||||
alias: "Random",
|
||||
description: "Example Metadata",
|
||||
trigger_variables: {
|
||||
'wowo': '!'
|
||||
},
|
||||
mode: 'single',
|
||||
},
|
||||
trigger: [
|
||||
],
|
||||
sequence: []
|
||||
}
|
||||
}
|
||||
@@ -82,6 +82,19 @@ export const AutomationEditor: FC<Props> = ({
|
||||
automation.trigger,
|
||||
[1.5, 0.5],
|
||||
updateTriggers,
|
||||
() => {
|
||||
setModalState({
|
||||
trigger: {
|
||||
$smType: "trigger",
|
||||
platform: "device",
|
||||
device_id: "",
|
||||
domain: "",
|
||||
type: "",
|
||||
subtype: ""
|
||||
},
|
||||
onSave: (t) => updateTriggers([...automation.trigger, t])
|
||||
});
|
||||
},
|
||||
(trigger, onSave) => setModalState({
|
||||
trigger,
|
||||
onSave,
|
||||
|
||||
@@ -9,6 +9,7 @@ export function* computeTriggerPos(
|
||||
triggers: AutomationTrigger[],
|
||||
toPath: Point,
|
||||
onUpdate: (ts: AutomationTrigger[]) => void,
|
||||
onAdd: () => void,
|
||||
onEdit: (nt: AutomationTrigger, onSave: (ts: AutomationTrigger) => void) => void,
|
||||
): Generator<DAGElement> {
|
||||
// functions
|
||||
@@ -40,15 +41,21 @@ export function* computeTriggerPos(
|
||||
direction: "1->2",
|
||||
}
|
||||
}
|
||||
// if we had nothing to loop on
|
||||
if (triggers.length === 0) {
|
||||
yield {
|
||||
type: "edge",
|
||||
p1: [startPoint[0] - 0.25, startPoint[1] + triggers.length],
|
||||
p2: toPath,
|
||||
direction: "1->2",
|
||||
}
|
||||
}
|
||||
// add circle
|
||||
yield {
|
||||
type: 'circle',
|
||||
icon: 'add',
|
||||
loc: [startPoint[0] + 0.25, startPoint[1] + triggers.length],
|
||||
onAdd: () => onUpdate(triggers.concat({
|
||||
$smType: 'trigger',
|
||||
platform: 'state',
|
||||
entity_id: "",
|
||||
}))
|
||||
onAdd
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user