-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(dashboard): workflow editor canvas - base step nodes and edges #6694
Conversation
✅ Deploy Preview for novu-stg-vite-dashboard-poc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -17,7 +17,7 @@ | |||
/> | |||
</head> | |||
<body> | |||
<div id="root"></div> | |||
<div id="root" class="h-full"></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the app layout issue that the height was 15px less than the full height. Like it was 15px less then should be.
@@ -37,6 +37,7 @@ | |||
"@radix-ui/react-tooltip": "^1.1.3", | |||
"@segment/analytics-next": "^1.73.0", | |||
"@tanstack/react-query": "^5.59.6", | |||
"@xyflow/react": "^12.3.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
react flow package
@@ -15,12 +15,12 @@ export const DashboardLayout = ({ | |||
}) => { | |||
return ( | |||
<IntercomProvider appId={INTERCOM_APP_ID}> | |||
<div className="relative flex w-full"> | |||
<div className="relative flex h-full w-full"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
layout
@@ -14,11 +14,11 @@ export const EditWorkflowLayout = ({ | |||
}) => { | |||
return ( | |||
<IntercomProvider appId={INTERCOM_APP_ID}> | |||
<div className="relative flex w-full"> | |||
<div className="relative flex h-full w-full"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
layout
@@ -65,7 +65,7 @@ export const EditBridgeUrlButton = () => { | |||
'relative size-1.5 animate-[pulse-shadow_1s_ease-in-out_infinite] rounded-full', | |||
status === ConnectionStatus.DISCONNECTED || status === ConnectionStatus.LOADING | |||
? 'bg-destructive [--pulse-color:var(--destructive)]' | |||
: 'bg-success [--pulse-color:var(--destructive)]' | |||
: 'bg-success [--pulse-color:var(--success)]' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local studio pulsing dot fix
useEffect(() => { | ||
window.addEventListener('resize', positionCanvas); | ||
|
||
return () => { | ||
window.removeEventListener('resize', positionCanvas); | ||
}; | ||
}, [positionCanvas]); | ||
|
||
useLayoutEffect(() => { | ||
positionCanvas(); | ||
}, [positionCanvas]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
position the canvas top center
const reactFlowWrapper = useRef<HTMLDivElement>(null); | ||
const reactFlowInstance = useReactFlow(); | ||
|
||
const nodes = useMemo(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the workflow editor canvas will be a controlled component based on the react-form state and workflow data returned from the API
type: 'add', | ||
}; | ||
|
||
return [triggerNode, ...createdNodes, addNode]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the API doesn't return the trigger node and the workflow tree always ends with the add node
maxZoom={1} | ||
minZoom={1} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no zoom for now
[StepTypeEnum.CHAT]: { variant: 'feature', icon: STEP_TYPE_TO_ICON[StepTypeEnum.CHAT] }, | ||
[StepTypeEnum.CUSTOM]: { variant: 'alert', icon: STEP_TYPE_TO_ICON[StepTypeEnum.CUSTOM] }, | ||
[StepTypeEnum.DELAY]: { variant: 'warning', icon: STEP_TYPE_TO_ICON[StepTypeEnum.DELAY] }, | ||
[StepTypeEnum.DIGEST]: { variant: 'highlighted', icon: STEP_TYPE_TO_ICON[StepTypeEnum.DIGEST] }, | ||
[StepTypeEnum.EMAIL]: { variant: 'information', icon: STEP_TYPE_TO_ICON[StepTypeEnum.EMAIL] }, | ||
[StepTypeEnum.IN_APP]: { variant: 'stable', icon: STEP_TYPE_TO_ICON[StepTypeEnum.IN_APP] }, | ||
[StepTypeEnum.PUSH]: { variant: 'verified', icon: STEP_TYPE_TO_ICON[StepTypeEnum.PUSH] }, | ||
[StepTypeEnum.SMS]: { variant: 'destructive', icon: STEP_TYPE_TO_ICON[StepTypeEnum.SMS] }, | ||
[StepTypeEnum.TRIGGER]: { variant: 'neutral', icon: STEP_TYPE_TO_ICON[StepTypeEnum.TRIGGER] }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed workflow list steps colors and icons
Niiiiicceeeeee! 🔥 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎨
<Node> | ||
<NodeHeader type={StepTypeEnum.EMAIL}> | ||
<NodeIcon variant={STEP_TYPE_TO_COLOR[StepTypeEnum.EMAIL]}> | ||
<Icon /> | ||
</NodeIcon> | ||
<NodeName>Email step</NodeName> | ||
</NodeHeader> | ||
<NodeBody>You have been invited to the Novu party on "commentSnippet"</NodeBody> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update this according to latest figma designs
const reactFlowInstance = useReactFlow(); | ||
|
||
const nodes = useMemo(() => { | ||
const triggerNode = { id: '0', position: { x: 0, y: 0 }, data: {}, type: 'trigger' }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit-picky comment, you can define this node outside of the function since it's a constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as far as I remember, react-flow mutates this object, so we would need to do the clone deep or smth, that's why I decided to keep it like this
novu
@novu/client
@novu/framework
@novu/headless
@novu/nest
@novu/nextjs
@novu/node
@novu/notification-center
@novu/providers
@novu/react
@novu/react-native
@novu/shared
@novu/stateless
@novu/js
commit: |
What changed? Why was the change needed?
Workflow Editor Canvas:
Screenshots
Screen.Recording.2024-10-15.at.17.25.34.mov