added icon for flip

This commit is contained in:
ari committed 2022-06-09 17:13:34 -04:00
1 parent 942867d646
commit a3e9d19c45
6 files changed
+49 -9

No files matched your search

+1
View File
@@ -6,6 +6,7 @@
"dependencies": {
"@emotion/react": "^11.9.0",
"@emotion/styled": "^11.8.1",
"@mui/icons-material": "^5.8.3",
"@mui/material": "^5.8.0",
"@mui/styles": "^5.8.0",
"@types/jest": "^27.5.1",
@@ -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;
}
+10
View File
@@ -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}>
+7
View File
@@ -2028,6 +2028,13 @@
prop-types "^15.8.1"
react-is "^17.0.2"
"@mui/icons-material@^5.8.3":
version "5.8.3"
resolved "https://registry.yarnpkg.com/@mui/icons-material/-/icons-material-5.8.3.tgz#75c8bde42e6ba71e3871439a2b751be987343493"
integrity sha512-dAdhimSLKOV0Q8FR7AYGEaCrTUh9OV7zU4Ueo5REoUt4cC3Vy+UBKDjZk66x5ezaYb63AFgQIFwtnZj3B/QDbQ==
dependencies:
"@babel/runtime" "^7.17.2"
"@mui/material@^5.8.0":
version "5.8.2"
resolved "https://registry.yarnpkg.com/@mui/material/-/material-5.8.2.tgz#13547df6bb6991e064f42ee71ce17c30629e263a"