Skip to content

Comments

Fix toast styling#1893

Merged
MrgSub merged 3 commits intoMail-0:stagingfrom
brandonmcconnell:fix/toast-styling
Aug 3, 2025
Merged

Fix toast styling#1893
MrgSub merged 3 commits intoMail-0:stagingfrom
brandonmcconnell:fix/toast-styling

Conversation

@brandonmcconnell
Copy link
Contributor

@brandonmcconnell brandonmcconnell commented Aug 3, 2025

Description

Please provide a clear description of your changes.

  • Update sonner
  • Add unstyled: true to opt into custom styling without requiring !important

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)

Areas Affected

Please check all that apply:

  • User Interface/Experience

Testing Done

Describe the tests you've done:

  • Manual testing performed
  • Cross-browser testing (if UI changes)
  • Mobile responsiveness verified (if UI changes)

Security Considerations

  • No sensitive data is exposed
  • Authentication checks are in place
  • Input validation is implemented
  • Rate limiting is considered (if applicable)

Checklist

  • I have read the CONTRIBUTING document
  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • My changes generate no new warnings
  • All tests pass locally
  • Any dependent changes are merged and published

Additional Notes

This change was needed due to upgrading Tailwind to v4 and subsequently updating Sonner. Notes on unstyled: true can be found here:
https://sonner.emilkowal.ski/styling#styling-specific-elements

Screenshots/Recordings


By submitting this pull request, I confirm that my contribution is made under the terms of the project's license.


Summary by cubic

Updated the toast component to use custom styles by upgrading Sonner and enabling the unstyled option.

  • Dependencies
    • Upgraded Sonner from 1.7.4 to 2.0.6.

Summary by CodeRabbit

  • Style

    • Updated toast notifications to use custom styling instead of default styles.
  • Chores

    • Upgraded the toast notification library to the latest version.

@jazzberry-ai
Copy link

jazzberry-ai bot commented Aug 3, 2025

Bug Report

Name Severity Example test case Description
Inflexible Toast Styling due to !important Flag Medium Try to override the toast title color from a parent component using CSS. The override will fail due to the !important flag in toast.tsx. The toast.tsx file uses the !important flag in the classNames for the sonner toast component. This makes it difficult to override the styles from a parent component or theme, reducing flexibility and reusability. The !important flag should be removed to allow for easier customization.

Comments? Email us.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 3, 2025

Walkthrough

This change updates the toast notification system in the mail application by setting the unstyled: true property in the toast component, allowing for full custom styling. Additionally, the "sonner" dependency is upgraded from version 1.7.4 to 2.0.6 in the package configuration.

Changes

Cohort / File(s) Change Summary
Toast Component Styling
apps/mail/components/ui/toast.tsx
Adds unstyled: true to the toast options, disabling default styles and enabling custom class control.
Dependency Update
apps/mail/package.json
Updates the "sonner" dependency from version 1.7.4 to 2.0.6.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant SonnerToaster

    User->>App: Triggers toast notification
    App->>SonnerToaster: Passes toastOptions {unstyled: true, classNames}
    SonnerToaster-->>App: Renders toast with only custom styles
Loading

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • toast design #1314: Both PRs modify the toast component, focusing on its styling and behavior, with this PR disabling default styles and the related PR updating toast layout and icons.

Suggested labels

design

Poem

🚀 Toasts unstyled, a canvas anew,
Sonner upgraded, version two-point-six through.
Custom classNames now rule the display,
Default looks gone, in a stylish new way.
With every pop-up, the future feels bright—
To infinity, and toasts done right!

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e1e7624 and 7097124.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • apps/mail/components/ui/toast.tsx (1 hunks)
  • apps/mail/package.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (AGENT.md)

**/*.{js,jsx,ts,tsx}: Use 2-space indentation
Use single quotes
Limit lines to 100 characters in width
Semicolons are required

Files:

  • apps/mail/components/ui/toast.tsx
**/*.{js,jsx,ts,tsx,css}

📄 CodeRabbit Inference Engine (AGENT.md)

Use Prettier with sort-imports and Tailwind plugins

Files:

  • apps/mail/components/ui/toast.tsx
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (AGENT.md)

Enable TypeScript strict mode

Files:

  • apps/mail/components/ui/toast.tsx
**/package.json

📄 CodeRabbit Inference Engine (AGENT.md)

Workspace packages use catalog versioning for shared dependencies

Files:

  • apps/mail/package.json
🧠 Learnings (4)
📓 Common learnings
Learnt from: AnjanyKumarJaiswal
PR: Mail-0/Zero#1732
File: apps/mail/components/create/email-composer.tsx:634-657
Timestamp: 2025-07-15T03:31:14.991Z
Learning: In draft deletion operations, using setTimeout with a delay (like 500ms) before showing success toast notifications improves UX by allowing UI state changes (like closing composers and clearing IDs) to complete before displaying the toast, preventing jarring immediate toast appearances that could disappear quickly during interface transitions.
Learnt from: danteissaias
PR: Mail-0/Zero#902
File: apps/mail/components/connection/add.tsx:77-77
Timestamp: 2025-05-07T16:55:46.513Z
Learning: For the "Upgrade" link in AddConnectionDialog, using a proper <button> element instead of a <span> with onClick is recognized as an accessibility improvement but was deferred as out of scope in PR #902 (CSS variables PR).
📚 Learning: in draft deletion operations, using settimeout with a delay (like 500ms) before showing success toas...
Learnt from: AnjanyKumarJaiswal
PR: Mail-0/Zero#1732
File: apps/mail/components/create/email-composer.tsx:634-657
Timestamp: 2025-07-15T03:31:14.991Z
Learning: In draft deletion operations, using setTimeout with a delay (like 500ms) before showing success toast notifications improves UX by allowing UI state changes (like closing composers and clearing IDs) to complete before displaying the toast, preventing jarring immediate toast appearances that could disappear quickly during interface transitions.

Applied to files:

  • apps/mail/components/ui/toast.tsx
📚 Learning: applies to **/package.json : workspace packages use catalog versioning for shared dependencies...
Learnt from: CR
PR: Mail-0/Zero#0
File: AGENT.md:0-0
Timestamp: 2025-07-21T20:24:46.841Z
Learning: Applies to **/package.json : Workspace packages use catalog versioning for shared dependencies

Applied to files:

  • apps/mail/package.json
📚 Learning: applies to **/*.{js,jsx,ts,tsx,css} : use prettier with sort-imports and tailwind plugins...
Learnt from: CR
PR: Mail-0/Zero#0
File: AGENT.md:0-0
Timestamp: 2025-07-21T20:24:46.841Z
Learning: Applies to **/*.{js,jsx,ts,tsx,css} : Use Prettier with sort-imports and Tailwind plugins

Applied to files:

  • apps/mail/package.json
🔇 Additional comments (2)
apps/mail/package.json (1)

110-110: Safe Sonner 2.0 upgrade – no deprecated prop usage found

Mission-wide grep complete: zero references to durationMs, dismissible, or richColors. All toast imports remain intact.

• Scanned apps/mail/**/*.tsx & .ts
• Deprecated props: 0 occurrences

Clear for launch.

apps/mail/components/ui/toast.tsx (1)

22-22: Nice touch – unstyled: true gives us full Tailwind sovereignty

This single flag liberates the component from Sonner’s default CSS, letting our Tailwind classes win without sprinkling !important. Clean and future-proof.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@brandonmcconnell brandonmcconnell marked this pull request as ready for review August 3, 2025 12:51
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

cubic analysis

No issues found across 2 files. Review in cubic

@coderabbitai coderabbitai bot added the design Improvements & changes to design & UX label Aug 3, 2025
@MrgSub MrgSub merged commit 838057d into Mail-0:staging Aug 3, 2025
5 checks passed
khardikk pushed a commit to khardikk/Zero that referenced this pull request Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

design Improvements & changes to design & UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants