Skip to content

feat: add toast alert system #210

Open
cheryl7114 wants to merge 8 commits into
serverlessworkflow:mainfrom
cheryl7114:toast-185
Open

feat: add toast alert system #210
cheryl7114 wants to merge 8 commits into
serverlessworkflow:mainfrom
cheryl7114:toast-185

Conversation

@cheryl7114

@cheryl7114 cheryl7114 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

closes #185

Summary

This PR introduces a toast notification system with 4 different types of variants: Success, Error, Warning, and Info (default). Toasts are anchored to the top left of the screen.

Preview:
Screenshot 2026-06-29 at 2 25 46 p m
Screenshot 2026-06-29 at 2 26 41 p m

Cheryl Kong added 4 commits June 30, 2026 10:13
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Copilot AI review requested due to automatic review settings June 30, 2026 09:32
@netlify

netlify Bot commented Jun 30, 2026

Copy link
Copy Markdown

Deploy Preview for swf-editor ready!

Name Link
🔨 Latest commit e7f87eb
🔍 Latest deploy log https://app.netlify.com/projects/swf-editor/deploys/6a463829cf043e00084d7650
😎 Deploy Preview https://deploy-preview-210--swf-editor.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 project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a toast notification system to surface operational failures (e.g., clipboard and download actions) and wires it into the diagram editor UI.

Changes:

  • Introduces a global toast store (useToast) and UI renderer (Toaster) based on Radix Toast primitives.
  • Updates Mermaid export actions to show success/error toasts and expands unit tests to cover those cases.
  • Adds a minimap toggle control button in the React Flow controls (currently duplicated—see review comments).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/serverless-workflow-diagram-editor/tests/side-panel/MermaidActions.test.tsx Adds toast-related assertions for copy/download success & failure flows.
packages/serverless-workflow-diagram-editor/src/side-panel/MermaidActions.tsx Emits toast notifications for clipboard and download outcomes.
packages/serverless-workflow-diagram-editor/src/react-flow/diagram/Diagram.tsx Adds an additional minimap toggle control button (currently duplicates existing one).
packages/serverless-workflow-diagram-editor/src/i18n/locales/en.ts Adds toast-related translation strings.
packages/serverless-workflow-diagram-editor/src/hooks/useToast.ts Implements a lightweight global toast store + helper function.
packages/serverless-workflow-diagram-editor/src/diagram-editor/DiagramEditor.tsx Mounts the toast provider + toaster at the editor level.
packages/serverless-workflow-diagram-editor/src/components/ui/toast.tsx Implements toast rendering (variants, icons, viewport positioning).
.changeset/toast-alerts.md Declares a minor version bump for the toast feature.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/diagram/Diagram.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/components/ui/toast.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/components/ui/toast.tsx Outdated
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>

@fantonangeli fantonangeli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@lornakelly

Copy link
Copy Markdown
Contributor

@cheryl7114 Thanks for the PR, I think the toast notification is very big against canvas, can we try reducing it a bit, less padding etc

Screenshot 2026-07-01 at 09 31 25

@lornakelly

lornakelly commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

@cheryl7114 Did you add the shadcn component using the following pnpm command?
https://github.com/serverlessworkflow/editor/blob/main/packages/serverless-workflow-diagram-editor/README.md#adding-a-new-shadcn-component

pnpm dlx shadcn@latest add <component>

Just double checking as usually it adds an extra dependency, might not in this case but just want to check, thanks
And is this the component you added?
https://ui.shadcn.com/docs/components/radix/sonner

@cheryl7114

Copy link
Copy Markdown
Contributor Author

@cheryl7114 Did you add the shadcn component using the following pnpm command?#202 Just double checking as usually it adds an extra dependency, might not in this case but just want to check, thanks And is this the component you added? https://ui.shadcn.com/docs/components/radix/sonner

https://www.radix-ui.com/primitives/docs/components/toast I added this one, because I saw the rest of the components using radix ui primitives as well so I wasn't too sure about using Sonner; and yeah it would've added a dependency if I'd used Sonner

@cheryl7114

cheryl7114 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@lornakelly how does this look? Should I make it slightly smaller? I haven't committed yet, wanted to ask if it looks okay first
image

@lornakelly

Copy link
Copy Markdown
Contributor

@cheryl7114 Did you add the shadcn component using the following pnpm command?#202 Just double checking as usually it adds an extra dependency, might not in this case but just want to check, thanks And is this the component you added? https://ui.shadcn.com/docs/components/radix/sonner

https://www.radix-ui.com/primitives/docs/components/toast I added this one, because I saw the rest of the components using radix ui primitives as well so I wasn't too sure about using Sonner; and yeah it would've added a dependency if I'd used Sonner

Although I totally understand why you went with that approach, especially as it doesnt add an extra dependency and shadcn is radix under the hood anyway, consistency is important here. We have established a pattern to add any ui components using shadcn (approved by community) and important to follow that convention so future contributors dont get confused on the pattern to follow. It can also make things drift and make maintainability and future updates harder, for example, if we wanted to bulk update shadcn components etc this could cause issues

It looks like sonner doesnt need a custom hook as well which is handy so less custom code- can you please use shadcns recommended approach instead, apologies for the confusion

@lornakelly

Copy link
Copy Markdown
Contributor

@lornakelly how does this look? Should I make it slightly smaller? I haven't committed yet, wanted to ask if it looks okay first image

Yes that style looks great!

@cheryl7114

Copy link
Copy Markdown
Contributor Author

@cheryl7114 Did you add the shadcn component using the following pnpm command?#202 Just double checking as usually it adds an extra dependency, might not in this case but just want to check, thanks And is this the component you added? https://ui.shadcn.com/docs/components/radix/sonner

https://www.radix-ui.com/primitives/docs/components/toast I added this one, because I saw the rest of the components using radix ui primitives as well so I wasn't too sure about using Sonner; and yeah it would've added a dependency if I'd used Sonner

Although I totally understand why you went with that approach, especially as it doesnt add an extra dependency and shadcn is radix under the hood anyway, consistency is important here. We have established a pattern to add any ui components using shadcn (approved by community) and important to follow that convention so future contributors dont get confused on the pattern to follow. It can also make things drift and make maintainability and future updates harder, for example, if we wanted to bulk update shadcn components etc this could cause issues

It looks like sonner doesnt need a custom hook as well which is handy so less custom code- can you please use shadcns recommended approach instead, apologies for the confusion

Okay, Sonner's actually easier to set up as well so no worries!

Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Copilot AI review requested due to automatic review settings July 2, 2026 09:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

Comment thread packages/serverless-workflow-diagram-editor/src/components/ui/sonner.css Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/components/ui/sonner.css Outdated
Comment thread packages/serverless-workflow-diagram-editor/package.json
Comment thread pnpm-workspace.yaml Outdated
Cheryl Kong added 2 commits July 2, 2026 11:03
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Signed-off-by: Cheryl Kong <cherylkong50@gmail.com>
Copilot AI review requested due to automatic review settings July 2, 2026 10:06
@cheryl7114

Copy link
Copy Markdown
Contributor Author

@lornakelly this is ready for review. Thank you!

@cheryl7114 cheryl7114 removed the request for review from Copilot July 2, 2026 10:07
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.

feat: Add reusable error toast for failure feedback

5 participants