Skip to content

feat: enhance Snackbar action with dismiss button in Journeys Admin app#8889

Open
jianwei1 wants to merge 5 commits intomainfrom
jianweichong/nes-1466-snackbar-behaviour-observations-questions
Open

feat: enhance Snackbar action with dismiss button in Journeys Admin app#8889
jianwei1 wants to merge 5 commits intomainfrom
jianweichong/nes-1466-snackbar-behaviour-observations-questions

Conversation

@jianwei1
Copy link
Contributor

@jianwei1 jianwei1 commented Mar 20, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Notifications now include a visible dismiss button so users can manually close popups immediately; auto-dismiss timing and per-notification behavior remain unchanged, preventing mobile snackbars from blocking interaction.
  • Documentation
    • Added a plan and solution note describing the dismissal UX change, accessibility checks, acceptance criteria, testing guidance, and follow-up suggestions for mobile and desktop.

@linear
Copy link

linear bot commented Mar 20, 2026

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 20, 2026

Walkthrough

Adds a provider-level dismiss action to the journeys-admin SnackbarProvider that renders a per-snackbar dismiss IconButton wired to closeSnackbar(snackbarKey); adds a plan and a solution doc describing the change, rationale, and acceptance criteria.

Changes

Cohort / File(s) Summary
Snackbar dismiss action
apps/journeys-admin/pages/_app.tsx
Added a module-scope snackbarAction(snackbarKey) passed to SnackbarProvider that returns a small IconButton with aria-label="dismiss notification" which calls closeSnackbar(snackbarKey) on click; added/used imports for IconButton, closeSnackbar, SnackbarProvider, and SnackbarKey.
Documentation: plan & solution
docs/plans/2026-03-20-001-fix-snackbar-mobile-blocking-autodismiss-plan.md, docs/solutions/ui-bugs/mobile-snackbar-blocking-ui-no-dismiss-button.md
Added a new implementation plan and a solution write-up documenting the provider-level action approach, expected notistack behavior (per-snackbar override, unchanged autoHideDuration), accessibility label and icon choice, and acceptance criteria for UX and tests.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a dismiss button to the Snackbar action in the Journeys Admin app, which directly matches the implementation shown in the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jianweichong/nes-1466-snackbar-behaviour-observations-questions
📝 Coding Plan
  • Generate coding plan for human review comments

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link

nx-cloud bot commented Mar 20, 2026

View your CI Pipeline Execution ↗ for commit 153f520

Command Status Duration Result
nx run journeys-admin-e2e:e2e ✅ Succeeded 55s View ↗
nx run-many --target=vercel-alias --projects=jo... ✅ Succeeded 2s View ↗
nx run-many --target=upload-sourcemaps --projec... ✅ Succeeded 12s View ↗
nx run-many --target=deploy --projects=journeys... ✅ Succeeded 2m 55s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-22 22:08:06 UTC

@github-actions github-actions bot requested a deployment to Preview - journeys-admin March 20, 2026 03:56 Pending
@jianwei1 jianwei1 self-assigned this Mar 20, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
docs/plans/2026-03-20-001-fix-snackbar-mobile-blocking-autodismiss-plan.md (1)

94-94: Bundle impact statement references unused icon.

This line mentions @mui/icons-material/Close but the implementation actually uses XCircleContainedIcon from @core/shared/ui/icons/XCircleContained (as correctly noted on line 163). Consider updating this statement for accuracy.

📝 Suggested fix
-- **Zero bundle impact**: `@mui/icons-material/Close` and `@mui/material/IconButton` are already in the dependency graph from other components.
+- **Zero bundle impact**: `@mui/material/IconButton` and `@core/shared/ui/icons/XCircleContained` are already in the dependency graph from other components.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/plans/2026-03-20-001-fix-snackbar-mobile-blocking-autodismiss-plan.md`
at line 94, The bundle impact statement incorrectly references the unused icon
package `@mui/icons-material/Close`; update the sentence to reference the actual
icon used (`XCircleContainedIcon` from `@core/shared/ui/icons/XCircleContained`)
and adjust the dependency claim to reflect that the implementation relies on the
shared `XCircleContainedIcon` (and any other real imports like
`@mui/material/IconButton` if used elsewhere) so the zero bundle impact
assertion is accurate.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/plans/2026-03-20-001-fix-snackbar-mobile-blocking-autodismiss-plan.md`:
- Around line 114-116: The import from 'notistack' used by snackbarAction is
missing the SnackbarKey type; update the existing import line that currently
brings in closeSnackbar and SnackbarProvider to also export SnackbarKey so the
snackbarAction function signature can reference it (ensure the file's imports
now include SnackbarKey, closeSnackbar, SnackbarProvider to match the "Full
corrected import order" example and keep IconButton import positioned after
GlobalStyles).

---

Nitpick comments:
In `@docs/plans/2026-03-20-001-fix-snackbar-mobile-blocking-autodismiss-plan.md`:
- Line 94: The bundle impact statement incorrectly references the unused icon
package `@mui/icons-material/Close`; update the sentence to reference the actual
icon used (`XCircleContainedIcon` from `@core/shared/ui/icons/XCircleContained`)
and adjust the dependency claim to reflect that the implementation relies on the
shared `XCircleContainedIcon` (and any other real imports like
`@mui/material/IconButton` if used elsewhere) so the zero bundle impact
assertion is accurate.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5642bd9b-a981-4f27-b3d9-14683b0009c4

📥 Commits

Reviewing files that changed from the base of the PR and between 62a84a1 and 98a6fdf.

📒 Files selected for processing (2)
  • apps/journeys-admin/pages/_app.tsx
  • docs/plans/2026-03-20-001-fix-snackbar-mobile-blocking-autodismiss-plan.md

Comment on lines +114 to +116
// New imports:
import IconButton from '@mui/material/IconButton' // after GlobalStyles (alphabetical)
import { closeSnackbar, SnackbarProvider } from 'notistack' // add closeSnackbar to existing import
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Incomplete import statement in code example.

The import statement on line 116 is missing SnackbarKey, which is required for the snackbarAction function signature. The "Full corrected import order" section at line 155 shows the correct import.

📝 Suggested fix
 // New imports:
 import IconButton from '@mui/material/IconButton'       // after GlobalStyles (alphabetical)
-import { closeSnackbar, SnackbarProvider } from 'notistack'  // add closeSnackbar to existing import
+import { closeSnackbar, SnackbarKey, SnackbarProvider } from 'notistack'  // add closeSnackbar and SnackbarKey to existing import
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/plans/2026-03-20-001-fix-snackbar-mobile-blocking-autodismiss-plan.md`
around lines 114 - 116, The import from 'notistack' used by snackbarAction is
missing the SnackbarKey type; update the existing import line that currently
brings in closeSnackbar and SnackbarProvider to also export SnackbarKey so the
snackbarAction function signature can reference it (ensure the file's imports
now include SnackbarKey, closeSnackbar, SnackbarProvider to match the "Full
corrected import order" example and keep IconButton import positioned after
GlobalStyles).

@github-actions github-actions bot requested a deployment to Preview - journeys-admin March 20, 2026 04:01 Pending
@github-actions github-actions bot requested a deployment to Preview - journeys-admin March 20, 2026 04:05 Pending
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
docs/solutions/ui-bugs/mobile-snackbar-blocking-ui-no-dismiss-button.md (2)

123-123: Clarify cleanup scope to preserve intentional snackbar UX exceptions.

“Remove redundant action and autoHideDuration” could be read as blanket removal. Please explicitly note exceptions where per-callsite behavior is intentional (e.g., long-running video upload UX), to avoid regressions during follow-up cleanup.

Based on learnings, in apps/journeys-admin, success snackbars for video uploads should be retained because video uploads have different UX requirements due to longer processing times.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/solutions/ui-bugs/mobile-snackbar-blocking-ui-no-dismiss-button.md` at
line 123, Clarify the cleanup note: when updating createShowSnackbar, do not
globally strip per-call overrides for action and autoHideDuration—keep per-call
handling where UX requires it (e.g., video upload success snackbars used by the
video upload flow); update the comment in the createShowSnackbar utility to say
remove redundant action/autoHideDuration only for calls that truly inherit
provider defaults, and explicitly list exceptions (video upload success
snackbars / long-running upload flows) so reviewers know to preserve per-call
action/autoHideDuration behavior.

32-32: Replace internal notistack.esm.js line references with official documentation links.

Referencing notistack.esm.js:759 is brittle across package updates. The 5000ms default is correct and documented officially (https://notistack.com/api-reference), but internal line numbers shift with each version. Reference the official API documentation instead so this remains accurate when notistack is upgraded.

Also applies to: 116-116

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/solutions/ui-bugs/mobile-snackbar-blocking-ui-no-dismiss-button.md` at
line 32, Replace the brittle internal reference to notistack.esm.js:759 with the
official notistack API docs link (https://notistack.com/api-reference) wherever
the diff mentions the 5000ms default for autoHideDuration (references around the
notistack default/autoHideDuration text and the other occurrence noted at 116);
update the text to cite the official API as the source for the 5000ms default
and remove any direct file/line references to node_modules to avoid breakage on
upgrades.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@docs/solutions/ui-bugs/mobile-snackbar-blocking-ui-no-dismiss-button.md`:
- Line 123: Clarify the cleanup note: when updating createShowSnackbar, do not
globally strip per-call overrides for action and autoHideDuration—keep per-call
handling where UX requires it (e.g., video upload success snackbars used by the
video upload flow); update the comment in the createShowSnackbar utility to say
remove redundant action/autoHideDuration only for calls that truly inherit
provider defaults, and explicitly list exceptions (video upload success
snackbars / long-running upload flows) so reviewers know to preserve per-call
action/autoHideDuration behavior.
- Line 32: Replace the brittle internal reference to notistack.esm.js:759 with
the official notistack API docs link (https://notistack.com/api-reference)
wherever the diff mentions the 5000ms default for autoHideDuration (references
around the notistack default/autoHideDuration text and the other occurrence
noted at 116); update the text to cite the official API as the source for the
5000ms default and remove any direct file/line references to node_modules to
avoid breakage on upgrades.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 27144ba9-a29b-4940-9a67-c53a6059b408

📥 Commits

Reviewing files that changed from the base of the PR and between 51dcdab and 455ede2.

📒 Files selected for processing (1)
  • docs/solutions/ui-bugs/mobile-snackbar-blocking-ui-no-dismiss-button.md

@github-actions github-actions bot temporarily deployed to Preview - journeys-admin March 20, 2026 04:07 Inactive
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/solutions/ui-bugs/mobile-snackbar-blocking-ui-no-dismiss-button.md`:
- Around line 64-79: The example is missing the React type import used by the
snackbarAction return type; add an import for ReactElement from 'react' (e.g.,
import type { ReactElement } from 'react') at the top so the
snackbarAction(snackbarKey: SnackbarKey): ReactElement signature compiles
without TypeScript errors, and keep existing imports (IconButton, SnackbarKey,
SnackbarProvider, closeSnackbar, XCircleContainedIcon) unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d96a16a0-178e-4b5a-9578-e1e63d3eb1ca

📥 Commits

Reviewing files that changed from the base of the PR and between 455ede2 and 66ab26e.

📒 Files selected for processing (1)
  • docs/solutions/ui-bugs/mobile-snackbar-blocking-ui-no-dismiss-button.md

Comment on lines +64 to +79
```tsx
import IconButton from '@mui/material/IconButton'
import { SnackbarKey, SnackbarProvider, closeSnackbar } from 'notistack'
import XCircleContainedIcon from '@core/shared/ui/icons/XCircleContained'

// Module-scope for stable reference (no re-creation on render)
const snackbarAction = (snackbarKey: SnackbarKey): ReactElement => (
<IconButton
size="small"
aria-label="dismiss notification"
color="inherit"
onClick={() => closeSnackbar(snackbarKey)}
>
<XCircleContainedIcon />
</IconButton>
)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add missing React import in code example.

The code example uses ReactElement as a return type (line 70) but doesn't import it from React. This would cause a TypeScript error if developers copy this code directly.

📝 Proposed fix to complete the imports
+import { type ReactElement } from 'react'
 import IconButton from '@mui/material/IconButton'
 import { SnackbarKey, SnackbarProvider, closeSnackbar } from 'notistack'
 import XCircleContainedIcon from '@core/shared/ui/icons/XCircleContained'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/solutions/ui-bugs/mobile-snackbar-blocking-ui-no-dismiss-button.md`
around lines 64 - 79, The example is missing the React type import used by the
snackbarAction return type; add an import for ReactElement from 'react' (e.g.,
import type { ReactElement } from 'react') at the top so the
snackbarAction(snackbarKey: SnackbarKey): ReactElement signature compiles
without TypeScript errors, and keep existing imports (IconButton, SnackbarKey,
SnackbarProvider, closeSnackbar, XCircleContainedIcon) unchanged.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 20, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys-admin ✅ Ready journeys-admin preview Mon Mar 23 11:03:59 NZDT 2026

@github-actions github-actions bot temporarily deployed to Preview - journeys-admin March 22, 2026 21:59 Inactive
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.

1 participant