Skip to content
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

Merged
merged 18 commits into from
Oct 16, 2024

Conversation

LetItRock
Copy link
Contributor

What changed? Why was the change needed?

Workflow Editor Canvas:

  • step nodes and edges
  • add step popover menu
  • badge component refactor
  • step status circle refactor

Screenshots

Screenshot 2024-10-15 at 17 25 16

Screenshot 2024-10-15 at 17 25 23

Screen.Recording.2024-10-15.at.17.25.34.mov

Copy link

linear bot commented Oct 15, 2024

Copy link

netlify bot commented Oct 15, 2024

Deploy Preview for novu-stg-vite-dashboard-poc ready!

Name Link
🔨 Latest commit 206416b
🔍 Latest deploy log https://app.netlify.com/sites/novu-stg-vite-dashboard-poc/deploys/670f6f62d6f0640008874afb
😎 Deploy Preview https://deploy-preview-6694--novu-stg-vite-dashboard-poc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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>
Copy link
Contributor Author

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",
Copy link
Contributor Author

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">
Copy link
Contributor Author

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">
Copy link
Contributor Author

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)]'
Copy link
Contributor Author

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

Comment on lines 120 to 130
useEffect(() => {
window.addEventListener('resize', positionCanvas);

return () => {
window.removeEventListener('resize', positionCanvas);
};
}, [positionCanvas]);

useLayoutEffect(() => {
positionCanvas();
}, [positionCanvas]);
Copy link
Contributor Author

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(() => {
Copy link
Contributor Author

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];
Copy link
Contributor Author

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

Comment on lines +140 to +141
maxZoom={1}
minZoom={1}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no zoom for now

Comment on lines +14 to +22
[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] },
Copy link
Contributor Author

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

@rgozdzialski
Copy link

Niiiiicceeeeee! 🔥

Copy link
Contributor

@SokratisVidros SokratisVidros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎨

apps/dashboard/src/components/icons/sms.tsx Outdated Show resolved Hide resolved
Comment on lines 32 to 39
<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>
Copy link
Contributor

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' };
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link

pkg-pr-new bot commented Oct 15, 2024

Open in Stackblitz

novu

pnpm add https://pkg.pr.new/novuhq/novu@6694

@novu/client

pnpm add https://pkg.pr.new/novuhq/novu/@novu/client@6694

@novu/framework

pnpm add https://pkg.pr.new/novuhq/novu/@novu/framework@6694

@novu/headless

pnpm add https://pkg.pr.new/novuhq/novu/@novu/headless@6694

@novu/nest

pnpm add https://pkg.pr.new/novuhq/novu/@novu/nest@6694

@novu/nextjs

pnpm add https://pkg.pr.new/novuhq/novu/@novu/nextjs@6694

@novu/node

pnpm add https://pkg.pr.new/novuhq/novu/@novu/node@6694

@novu/notification-center

pnpm add https://pkg.pr.new/novuhq/novu/@novu/notification-center@6694

@novu/providers

pnpm add https://pkg.pr.new/novuhq/novu/@novu/providers@6694

@novu/react

pnpm add https://pkg.pr.new/novuhq/novu/@novu/react@6694

@novu/react-native

pnpm add https://pkg.pr.new/novuhq/novu/@novu/react-native@6694

@novu/shared

pnpm add https://pkg.pr.new/novuhq/novu/@novu/shared@6694

@novu/stateless

pnpm add https://pkg.pr.new/novuhq/novu/@novu/stateless@6694

@novu/js

pnpm add https://pkg.pr.new/novuhq/novu/@novu/js@6694

commit: 206416b

Base automatically changed from nv-4477-workflow-editor-route-and-layout to next October 16, 2024 07:22
@LetItRock LetItRock merged commit 508c746 into next Oct 16, 2024
40 checks passed
@LetItRock LetItRock deleted the nv-4478-workflow-editor-canvas branch October 16, 2024 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants