Skip to content

feat(ui): move more Toast logic #7973

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

Merged
merged 1 commit into from
Jul 12, 2025
Merged

Conversation

avivkeller
Copy link
Member

@avivkeller avivkeller commented Jul 10, 2025

I realized that, now that we store NotificationProvider in ui-components (#7967), we can actually move the styling to ui-components as well.

@Copilot Copilot AI review requested due to automatic review settings July 10, 2025 18:17
@avivkeller avivkeller requested a review from a team as a code owner July 10, 2025 18:17
Copy link

vercel bot commented Jul 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Jul 10, 2025 9:43pm

@avivkeller avivkeller marked this pull request as draft July 10, 2025 18:19
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR centralizes Toast logic into the ui-components package via a new NotificationProvider, and renames BaseCodeBox to a full-feature CodeBox, updating all related imports and stories.

  • Move Toast.Provider and Toast.Viewport into NotificationProvider, removing its viewportClassName prop.
  • Rename BaseCodeBox to CodeBox, add a required notificationText prop, and hook into useNotification.
  • Update Storybook previews, component stories, and site code to use the new NotificationProvider and CodeBox API.

Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/ui-components/src/Providers/NotificationProvider.tsx Hard-coded Toast.Viewport class, removed viewportClassName prop
packages/ui-components/src/Common/CodeBox/index.tsx Renamed BaseCodeBoxCodeBox, added notificationText & useNotification
packages/ui-components/src/Common/CodeTabs/index.stories.tsx Switched import from BaseCodeBoxCodeBox
packages/ui-components/src/Common/CodeBox/index.stories.tsx Updated story types/default export to use CodeBox
packages/ui-components/.storybook/preview.tsx Replaced direct Toast.Provider with NotificationProvider
apps/site/layouts/Base.tsx Removed now-obsolete viewportClassName prop usage
apps/site/components/MDX/CodeBox/index.tsx Updated import to use wrapper BaseCodeBox from ui-components
apps/site/components/Downloads/Release/ReleaseCodeBox.tsx Updated import to use wrapper BaseCodeBox from ui-components
apps/site/components/Common/CodeBox.tsx Refactored wrapper to drop its own notification logic, use BaseCodeBox from ui-components
Comments suppressed due to low confidence (2)

apps/site/components/MDX/CodeBox/index.tsx:4

  • [nitpick] Aliasing the imported component as BaseCodeBox may be misleading since it’s now a full-featured component. Consider renaming the alias to CodeBox for clarity.
import BaseCodeBox from '#site/components/Common/CodeBox';

packages/ui-components/src/Common/CodeBox/index.tsx:3

  • The DocumentDuplicateIcon import is no longer used in this file; consider removing it to clean up unused imports.
import {

Copy link

codecov bot commented Jul 10, 2025

Codecov Report

Attention: Patch coverage is 40.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 73.15%. Comparing base (cc36077) to head (150c7a8).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...nents/src/Providers/NotificationProvider/index.tsx 40.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7973      +/-   ##
==========================================
+ Coverage   73.07%   73.15%   +0.07%     
==========================================
  Files          95       95              
  Lines        8358     8355       -3     
  Branches      218      218              
==========================================
+ Hits         6108     6112       +4     
+ Misses       2249     2242       -7     
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

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

LGTM! Have you checked it all works nicely?

@avivkeller
Copy link
Member Author

Yes. I've verified that it renders properly on:

  • Desktop
  • Mobile
  • Storybook

@avivkeller avivkeller force-pushed the feat/ui/codebox-and-notifications branch from 8afb1d1 to 150c7a8 Compare July 10, 2025 21:42
@avivkeller avivkeller requested a review from ovflowd July 10, 2025 21:42
@avivkeller avivkeller added the github_actions:pull-request Trigger Pull Request Checks label Jul 12, 2025
@avivkeller avivkeller enabled auto-merge July 12, 2025 13:59
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Jul 12, 2025
@avivkeller avivkeller added this pull request to the merge queue Jul 12, 2025
Merged via the queue into main with commit 8d8aeae Jul 12, 2025
15 of 17 checks passed
@avivkeller avivkeller deleted the feat/ui/codebox-and-notifications branch July 12, 2025 14:06
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.

2 participants