added icon for flip
This commit is contained in:
1 parent
942867d646
commit
a3e9d19c45
6 files changed
+49
-9
No files matched your search
@@ -28,13 +28,9 @@
|
||||
.automation-editor--flow-wrapper--toolbar {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 0.25em;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.automation-editor--flow-wrapper.unchanged>.automation-editor--flow-wrapper--toolbar {
|
||||
height: 0;
|
||||
opacity: 0;
|
||||
overflow: hidden;
|
||||
margin-top: 0.25em;
|
||||
}
|
||||
|
||||
.automation-editor--flow-wrapper.changed>.automation-editor--flow-wrapper--toolbar * {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import "./index.css";
|
||||
import Icon from '@mui/material/Icon';
|
||||
import { ArrowIcon, CheckMarkIcon } from "components/Icons";
|
||||
import { FC, useState } from "react";
|
||||
import { FC, useEffect, useState } from "react";
|
||||
import { AutomationData } from "types/automations";
|
||||
import { AutoInfoBox } from "./AutoInfoBox";
|
||||
import { ButtonIcon } from "components/Icons/ButtonIcons";
|
||||
@@ -37,8 +38,15 @@ export const AutomationEditor: FC<Props> = ({
|
||||
save,
|
||||
saveAndUpdate,
|
||||
} = useAutomatioEditorState(propsAutos, propsOnUpdate);
|
||||
|
||||
const [closeInfo, setCloseInfo] = useState(false);
|
||||
const [flipped, setFlipped] = useState(dims.flipped);
|
||||
|
||||
// effect
|
||||
useEffect(() => {
|
||||
if (dims.flipped !== flipped) {
|
||||
setFlipped(dims.flipped)
|
||||
}
|
||||
}, [dims.flipped])
|
||||
|
||||
// render
|
||||
if (state.status === 'loading') {
|
||||
@@ -75,6 +83,13 @@ export const AutomationEditor: FC<Props> = ({
|
||||
|
||||
<div className={["automation-editor--flow-wrapper", state.status].join(" ")}>
|
||||
<div className="automation-editor--flow-wrapper--toolbar">
|
||||
{!dims.flipped && <Button
|
||||
className={"automation-editor--flow-wrapper--toolbar--flip-btn"}
|
||||
onClick={() => setFlipped(!flipped)}
|
||||
>
|
||||
<Icon>{flipped ? 'flip_to_front' : 'flip_to_back'}</Icon>
|
||||
Flip
|
||||
</Button>}
|
||||
<Button
|
||||
className={"automation-editor--flow-wrapper--toolbar--save-btn"}
|
||||
onClick={save}
|
||||
@@ -91,7 +106,10 @@ export const AutomationEditor: FC<Props> = ({
|
||||
onSequenceUpdate={updateSequence}
|
||||
onTriggerUpdate={updateTrigger}
|
||||
onConditionUpdate={updateCondition}
|
||||
dims={dims}
|
||||
dims={{
|
||||
...dims,
|
||||
flipped,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -67,4 +67,12 @@
|
||||
top: 0.75em;
|
||||
background-color: var(--green-opaque);
|
||||
z-index: 30;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.automation-list--root.mobile .automation-editor--flow-wrapper.unchanged>.automation-editor--flow-wrapper--toolbar {
|
||||
height: 0;
|
||||
opacity: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
@@ -140,6 +140,16 @@ export const DAGAutomationFlow: FC<DAGAutomationFlowProps> = ({
|
||||
namer,
|
||||
makeSequenceUpdater(sequence, onSequenceUpdate, setModalState),
|
||||
);
|
||||
// this fixes some strange edge drawing issue
|
||||
flowData.edges = flowData.edges.map(e => ({
|
||||
...e,
|
||||
"source": `${e.source}-${dims.flipped}`,
|
||||
"target": `${e.target}-${dims.flipped}`,
|
||||
}))
|
||||
flowData.nodes = flowData.nodes.map(n => ({
|
||||
...n,
|
||||
id: `${n.id}-${dims.flipped}`
|
||||
}))
|
||||
// render
|
||||
return <>
|
||||
<Modal open={!!modalState}>
|
||||
|
||||
Reference in new issue
Block a user