Skip to content

feat(#3): integrate Toast notifications into auth, enrollment, and reward flows#6

Merged
DeFiVC merged 4 commits into
ChainLearnOfficial:mainfrom
OpenSourceCOntr:feat/issue-3-toast-notifications
Jun 24, 2026
Merged

feat(#3): integrate Toast notifications into auth, enrollment, and reward flows#6
DeFiVC merged 4 commits into
ChainLearnOfficial:mainfrom
OpenSourceCOntr:feat/issue-3-toast-notifications

Conversation

@Uchechukwu-Ekezie

Copy link
Copy Markdown
Contributor

Closes #3

What changed

  • connect/page.tsx: show success toast after wallet connects, error toast on failure
  • courses/[courseId]/page.tsx: toast on enrollment success and on enrollment error
  • courses/[courseId]/modules/[moduleId]/page.tsx: toast on module complete and on error
  • courses/[courseId]/quiz/page.tsx: toast on quiz submit success and on failure
  • rewards/page.tsx: wrap claim handler to show success/error toast after each claim attempt

Why

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-component layout.tsx.

How to test

  • Connect wallet → see green "Wallet connected successfully!" toast
  • Enroll in a course → see green "Successfully enrolled in the course!" toast; simulate a network error → see red "Enrollment failed" toast
  • Complete a module → see "Module marked as complete!" toast
  • Submit a quiz → see "Quiz submitted successfully!" toast
  • Claim a reward on the Rewards page → see "Reward claimed successfully!" toast

…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
@netlify

netlify Bot commented Jun 24, 2026

Copy link
Copy Markdown

Deploy Preview for chainlearn ready!

Name Link
🔨 Latest commit 97b9c1c
🔍 Latest deploy log https://app.netlify.com/projects/chainlearn/deploys/6a3c18f9b7779f0008b905f4
😎 Deploy Preview https://deploy-preview-6--chainlearn.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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 DeFiVC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 (wraps claim in handleClaim)

  • .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 adding result.percentage if 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

@DeFiVC DeFiVC merged commit 017d2cc into ChainLearnOfficial:main Jun 24, 2026
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.

Integrate Toast notifications into auth, enrollment, and reward flows

2 participants