Skip to content

feat(frontend): add global toast notification system - #221

Open
jeorgei wants to merge 1 commit into
arflexx:mainfrom
jeorgei:main
Open

feat(frontend): add global toast notification system#221
jeorgei wants to merge 1 commit into
arflexx:mainfrom
jeorgei:main

Conversation

@jeorgei

@jeorgei jeorgei commented Aug 28, 2026

Copy link
Copy Markdown

Summary

Adds a general-purpose, imperative toast notification system: ToastProvider +
useToast(), so any client component can call toast.success(...) /
toast.error(...) / toast.info(...) / toast.warning(...) directly, for feedback
like trade submitted, withdrawal failed, or OTP sent.

Closes

Closes #133
Closes #135
Closes #136
Closes #104

Scope notes

  • Reuses the existing components/ui/Toast.tsx for rendering — it already has the
    exact colour-coded icon treatment (✓ green / ✕ red / ℹ blue / ⚠ amber) the acceptance
    criteria describe. This PR adds the missing piece: the provider/hook plumbing that lets
    any component trigger one imperatively, stacked, with auto-dismiss.
  • Does not touch NotificationTray ([frontend] - Implement Real-Time Trade Status Notifications #24) — that's a separate, SSE-driven system for
    trade status specifically. This is a general "call it from anywhere" surface. A future
    migration of NotificationTray onto this generic provider is a reasonable follow-up,
    not bundled into this PR.
  • Adds a Providers wrapper (app/components/Providers.tsx) — the issue's last
    acceptance criterion assumes <Providers> already exists in the root layout; it didn't,
    only a direct <AuthProvider>. This PR introduces it as the single client-boundary
    composition point going forward.
  • useToast.ts lives in a new top-level frontend/hooks/ per the issue's specified
    location, while existing hooks (useAuth, useTradeNotifications) live under
    app/hooks/. Flagging this structural split rather than silently picking one — worth a
    follow-up decision on where hooks should live going forward.

What Changed

  • components/ToastProvider.tsx (new) — context, portal rendering, stacking, Tailwind-only
    enter/exit transitions (no animation library)
  • hooks/useToast.ts (new)
  • app/components/Providers.tsx (new) — composes AuthProvider + ToastProvider
  • app/layout.tsx — now uses <Providers> instead of <AuthProvider> directly
  • Tests: ToastProvider.test.tsx, useToast.test.tsx, Providers.test.tsx

Testing

  • npm test — new tests pass, existing suite unaffected
  • npm run build
  • npm run lint
  • Manual: verified stacking, auto-dismiss (default 4s / custom / persistent via
    duration=0), and manual dismiss via the ✕ button in npm run dev

Adds ToastProvider + useToast() for imperative, ad hoc feedback from
any client component (trade submitted, withdrawal failed, OTP sent),
distinct from the existing NotificationTray's SSE-driven trade-status
toasts. Renders through the existing components/ui/Toast.tsx rather
than duplicating its styling. Introduces a Providers wrapper in
app/layout.tsx since ToastProvider needs to sit alongside AuthProvider
and no such composition component existed yet.
@jeorgei
jeorgei requested a review from dark-sarge as a code owner August 28, 2026 22:45
@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@jeorgei Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant