diff --git a/webapp/src/components/DAGSvgs/DAGCircle.tsx b/webapp/src/components/DAGSvgs/DAGCircle.tsx
index 50f5b99..7c4d11d 100644
--- a/webapp/src/components/DAGSvgs/DAGCircle.tsx
+++ b/webapp/src/components/DAGSvgs/DAGCircle.tsx
@@ -21,7 +21,8 @@ export const DAGCircle = ({
}: AddProps) => {
const { classes } = useCircleStyles({
size: size * 0.9,
- hasOnFunction: !!onEdit || !!onAdd
+ hasOnFunction: !!onEdit || !!onAdd,
+ hasRemoveFunction: !!onRemove,
});
return <>
@@ -38,7 +39,7 @@ export const DAGCircle = ({
onClick={onAdd}
/>
: "else"}
- {onRemove ? : <>>}
+ {onRemove ? : <>>}
>
diff --git a/webapp/src/components/DAGSvgs/styles.ts b/webapp/src/components/DAGSvgs/styles.ts
index 65b89b0..ddfcaf1 100644
--- a/webapp/src/components/DAGSvgs/styles.ts
+++ b/webapp/src/components/DAGSvgs/styles.ts
@@ -152,15 +152,16 @@ export const useNodeStyles = createAppUseStyles<{
export const useCircleStyles = createAppUseStyles<{
size: number,
hasOnFunction: boolean,
+ hasRemoveFunction: boolean,
}>(theme => ({
- root: ({size, hasOnFunction}) => ({
+ root: ({size, hasOnFunction, hasRemoveFunction}) => ({
backgroundColor: Color(theme.primary).set('rgb.g', 100).hex(),
- borderRadius: 500,
+ borderRadius: hasRemoveFunction ? 10 : 500,
height: size,
width: size,
cursor: hasOnFunction ? "pointer" : 'default',
"&:hover": {
- backgroundColor: hasOnFunction ?
+ backgroundColor: (hasOnFunction && !hasRemoveFunction) ?
Color(theme.primary).set('rgb.g', 150).hex() :
Color(theme.primary).set('rgb.g', 100).hex(),
},
@@ -170,14 +171,16 @@ export const useCircleStyles = createAppUseStyles<{
alignItems: 'center',
}),
icon: {
- padding: "15%",
+ "&:hover": {
+ borderRadius: 500,
+ background: Color(theme.primary).set('rgb.g', 150).hex(),
+ }
},
trashIcon: {
- position: 'absolute',
- top: 0,
- left: 0,
+ padding: 1,
"&:hover": {
- fill: theme.secondary,
+ borderRadius: 500,
+ background: Color(theme.primary).set('rgb.g', 150).hex(),
cursor: 'pointer',
}
}
diff --git a/webapp/src/components/SequenceNodes/positions.ts b/webapp/src/components/SequenceNodes/positions.ts
index ca06ddf..9e714f1 100644
--- a/webapp/src/components/SequenceNodes/positions.ts
+++ b/webapp/src/components/SequenceNodes/positions.ts
@@ -45,6 +45,7 @@ function* dealWithNested(
sequence: AutomationSequenceNode[],
openModal: UpdateModalState,
onEdit?: () => void,
+ onRemove?: () => void,
): Generator {
const np = offsetPoint(innerStartLoc, [0.5, 0]);
yield {
@@ -53,18 +54,21 @@ function* dealWithNested(
p2: innerStartLoc,
direction: '1->2',
}
+ console.log(onRemove)
if (onEdit) {
yield {
type: 'circle',
loc: innerStartLoc,
icon: 'edit',
onEdit,
+ onRemove,
}
} else {
yield {
type: 'circle',
loc: innerStartLoc,
icon: 'blank',
+ onRemove,
}
}
yield {
@@ -109,6 +113,7 @@ function* dealWithChoose(
node.action_data,
updateData,
),
+ createOnRemoveForChooseNode(node.action_data, updateData, j)
)) {
yield elm
if (elm.type === 'node') {
@@ -238,3 +243,15 @@ export const onModalOpenForConditions = (
]
}),
})
+
+const createOnRemoveForChooseNode = (
+ data: ChooseAction['action_data'],
+ updateData: (data: ChooseAction['action_data']) => void,
+ j: number
+) => () => updateData({
+ ...data,
+ choose: [
+ ...data.choose.slice(0, j),
+ ...data.choose.slice(j+1),
+ ]
+})