Skip to content

feat(toast): redesign with grouping, undo, and smooth enter-exit animations (#388) - #467

Merged
devJaja merged 2 commits into
Epta-Node:mainfrom
MarcusDavidG:feat/toast-redesign-388
Aug 31, 2026
Merged

feat(toast): redesign with grouping, undo, and smooth enter-exit animations (#388)#467
devJaja merged 2 commits into
Epta-Node:mainfrom
MarcusDavidG:feat/toast-redesign-388

Conversation

@MarcusDavidG

Copy link
Copy Markdown
Contributor

Summary

Resolves #388

Changes

  • Reuse ToastContext (frontend/src/context/ToastContext.tsx:1): add ToastAction (label+onClick), count grouping, progress auto-dismiss with pause-on-hover, stacking (max 6) and timer cleanup; showToast(message, type, duration|{duration, action}) dedupes same message+type by incrementing count, resetting timer and moving to top; keeps backward compat (showToast(msg, type, 3000) still works)
  • Rewrite Toast component (frontend/src/components/common/Toast.tsx:1): AnimatePresence + motion.div spring (stiffness 420, damping 30) for smooth enter (opacity 0→1, x 20→0, scale 0.96→1) and exit, icons per type (lucide-react), count badge ×N, action pill (Undo/Retry) and bottom progress bar (animationDuration=duration, pauses on hover)
  • Update Toast.css (frontend/src/components/common/Toast.css:1): top-right stacked container, glass/blur, variant colors, count pill, action pill, progress shrink keyframes, responsive bottom dock on <480px; retains legacy class support
  • Undo flows (acceptance: at least one flow exposes an undo action):
    • TaskSubmissionForm.tsx:93 — success toast Task submitted successfully. Redirecting... with Undo (clears pending 300ms navigation, resets preview, shows Task creation undone info, duration 6000); network error shows Retry that re-invokes submit
    • SendXLMForm.tsx:96 — success toast Payment sent successfully! with Undo (clears successTx, shows demo info, duration 8000); failure shows Retry
  • Fixes to keep build green (pre-existing corrupted merges): restore App.tsx to clean b1717ca structure (ThemeProvider→WalletProvider→ToastProvider→Router→NotificationProvider); deduplicate useToast imports in RecentTasksTable.tsx and dashboard.tsx; add fallback no-op in hooks/useToast.ts + context/ToastContext.tsx so isolated tests without provider stay green
  • i18n (en.json:28, zh.json:30): add common.undo, common.undone, common.view translations

Verification & Testing

  • cd frontend && ./node_modules/.bin/vitest run src/components/agents/TaskSubmissionForm.test.tsx — 4/4 passed (success redirect, validation, toast dismiss)
  • cd frontend && ./node_modules/.bin/vitest run src/pages/WalletPage.test.tsx — 13/13 passed (SendXLMForm validation, QR, balance)
  • cd frontend && ./node_modules/.bin/vitest run --reporter=basic — 28/32 files passed, 241/245 tests passed; 4 pre-existing failures (Hero.tsx motion tag mismatch, AgentsPage modal, AgentReputationRadar) unrelated to toast (ignored per instructions)
  • Manual: spam same toast twice → count ×2 instead of new stack; hover → progress pauses; click Undo → action fires then dismisses; progress auto-dismisses after duration

Contributor Checklist

  • PR title follows Conventional Commits (feat(toast): ... (#388))
  • No secrets or credentials committed
  • Reuses existing ToastContext architecture

…ations (Epta-Node#388)

- Reuse ToastContext: add ToastAction, count grouping, progress auto-dismiss with pause-on-hover, stacking (max 6) and flake-safe timers; showToast now supports number or {duration, action} overload and dedupes same message+type
- Rewrite Toast component with framer-motion AnimatePresence, spring enter/exit, icons per type, count badge (×N), action button (Undo/Retry) and progress bar that pauses on hover
- Update Toast.css: glass backdrop, stacked layout, variant colors, count pill, action pill, progress shrink animation, responsive bottom-dock on mobile
- Add undo flows: TaskSubmissionForm shows success toast with Undo (cancels pending 300ms navigation, resets preview, shows undone info) and Retry on network error; SendXLMForm shows success toast with Undo (clears success state) and Retry on failure
- Fix App.tsx (remove duplicate ProtectedRoute import, restore clean ThemeProvider/NotificationProvider structure from b1717ca) and RecentTasksTable/dashboard duplicate useToast handling to keep build green; add common.undo translations to en/zh
- Keeps backward compat: showToast(message, type, duration) still works; grouping ensures duplicate toasts animate as count increment not new stack

Resolves Epta-Node#388
@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Jaja's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@MarcusDavidG 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

@devJaja
devJaja merged commit decb1b6 into Epta-Node:main Aug 31, 2026
3 of 6 checks passed
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.

Add toast redesign with grouping, undo, and smooth enter-exit animations

2 participants