feat(#3): integrate Toast notifications into auth, enrollment, and reward flows#6
Conversation
…enrollment, and reward flows - connect/page.tsx: show success toast on wallet connect, error toast on failure - courses/[courseId]/page.tsx: toast on enroll success and error - modules/[moduleId]/page.tsx: toast on module complete and error - quiz/page.tsx: toast on quiz submit success and error - rewards/page.tsx: wrap claim handler with success/error toasts
✅ Deploy Preview for chainlearn ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
- Add .eslintrc.json with next/core-web-vitals (Next.js strict config) - Add eslint@^8 and eslint-config-next@14 to devDependencies - Update package-lock.json
DeFiVC
left a comment
There was a problem hiding this comment.
Summary
Integrates toast notifications into 5 key user flows per issue #3: wallet connect, course enrollment, module completion, quiz submission, and reward claiming. Each page independently uses useToast() with its own <ToastContainer />.
What's Changed
-
src/app/(auth)/connect/page.tsx: Success/error toast on wallet connect -
src/app/courses/[courseId]/page.tsx: Success/error toast on course enrollment -
src/app/courses/[courseId]/modules/[moduleId]/page.tsx: Success/error toast on module completion -
src/app/courses/[courseId]/quiz/page.tsx: Success/error toast on quiz submission -
src/app/rewards/page.tsx: Success/error toast on reward claim (wrapsclaiminhandleClaim) -
.eslintrc.json+package.json/package-lock.json: ESLint setup (same as PR #5)
Blocking Issues
None. ✅
Minor Nits
⚠️ Quiz toast messages are generic success/error rather than showing the score percentage as issue #3 suggested. Consider addingresult.percentageif the API supports it.⚠️ Error message wording slightly differs from issue spec (cosmetic only).
What's Good
- Consistent pattern across all 5 pages — each calls
useToast()and renders its own<ToastContainer /> - Clean try/catch blocks with user-friendly messages
- No scope creep — only toast-related changes
- The approach (local toast state per page) is simpler than the global ToastProvider suggested in the issue, and avoids adding complexity to the server-component layout
Closes #3
What changed
connect/page.tsx: show success toast after wallet connects, error toast on failurecourses/[courseId]/page.tsx: toast on enrollment success and on enrollment errorcourses/[courseId]/modules/[moduleId]/page.tsx: toast on module complete and on errorcourses/[courseId]/quiz/page.tsx: toast on quiz submit success and on failurerewards/page.tsx: wrap claim handler to show success/error toast after each claim attemptWhy
Each page calls the existing
useToast()hook locally (returns{ addToast, ToastContainer }), rendering<ToastContainer />in its own JSX. This matches the hook's design — independent state per call site — and avoids adding a global context to the server-componentlayout.tsx.How to test