Skip to content

feat: shared UI components — stats-card, course-progress-card, leaderboard-table, notification-bell - #392

Merged
DeFiVC merged 1 commit into
ChainLearnOfficial:mainfrom
jajafwangshak86-ops:feat/ui-components-253-256
Aug 29, 2026
Merged

feat: shared UI components — stats-card, course-progress-card, leaderboard-table, notification-bell#392
DeFiVC merged 1 commit into
ChainLearnOfficial:mainfrom
jajafwangshak86-ops:feat/ui-components-253-256

Conversation

@jajafwangshak86-ops

@jajafwangshak86-ops jajafwangshak86-ops commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Closes #253
Closes #254
Closes #255
Closes #256

Summary

Reusable UI components that replace the ad-hoc markup currently duplicated across the dashboard and course pages.

#253src/components/shared/stats-card.tsx

  • Icon + value + label, configurable color themes (primary, success, warning, danger, purple, muted)
  • Optional trend indicator (up / down / flat) with label
  • Wired into the dashboard stats grid (Enrolled, Completed, LEARN tokens, Credentials)
  • Accessible semantics, icons aria-hidden, dark-mode aware

#254src/components/course/course-progress-card.tsx

  • Course title, animated progress bar, module count, completion status badge
  • Continue/Review action linking to the course
  • Wired into the dashboard My Courses tab, replacing the plain cards

#255src/components/shared/leaderboard-table.tsx

  • Rank / name / score columns using the shared ui/table primitives
  • Top-3 rank medallions, current-user highlight + "You" badge
  • compact mode for sidebars (tighter cells, no avatars) and full mode for pages

#256 — notification system

  • src/types/notification.ts, src/lib/api/notifications.ts, src/lib/hooks/use-notifications.ts
  • src/components/shared/notification-bell.tsx in the header: bell with unread-count badge, type-aware icons, relative timestamps, mark-read on click, mark-all-read, plus loading (skeleton), empty, and error/retry states
  • Panel closes on outside click / Esc (Radix dropdown)

Tests

New suites for all four components (34 tests) plus a fixed header suite. All new tests pass.

Notable: pre-existing fixes required for green CI

main did not typecheck and next build was broken. I fixed three minimal, unrelated syntax errors so the branch (and the repo) builds again:

  • loading-skeleton.tsx — missing import { on the skeleton import
  • module-list.tsx — leftover duplicated className line from a botched merge
  • quiz-interface.tsx — unclosed <p> tag
  • layout.tsx — duplicate PageTransition import

These were confirmed broken on main; the remaining failing tests (claim-button, credential-card date, legacy duplicate header test, loading-skeleton count assertions) also fail on main and are outside these issues.

Verification

  • npm run typecheck — clean
  • npm run lint — clean
  • npm run build — succeeds
  • npm test — 361 pass / 14 fail (the 14 are all pre-existing on main; this branch fixes the previously-failing header suite)

…otifications

Closes ChainLearnOfficial#253 (stats-card), ChainLearnOfficial#254 (course-progress-card), ChainLearnOfficial#255 (leaderboard-table),
ChainLearnOfficial#256 (notification-bell).

- Add reusable StatsCard with icon, value, label, theme and trend indicator;
  use it in the dashboard stats grid
- Add CourseProgressCard with animated progress, module count, completion
  status and continue action; use it in the dashboard My Courses section
- Add LeaderboardTable with rank medallions, current-user highlight and a
  compact sidebar mode
- Add notification system (types, API client, hook) and NotificationBell in the
  header with unread badge, read/unread states, empty and error states
- Fix pre-existing syntax errors in loading-skeleton, module-list, quiz-interface
  and layout (broken imports / unclosed tags) that broke typecheck and tests
@netlify

netlify Bot commented Aug 29, 2026

Copy link
Copy Markdown

Deploy Preview for chainlearn ready!

Name Link
🔨 Latest commit ade4d4d
🔍 Latest deploy log https://app.netlify.com/projects/chainlearn/deploys/6a928adeebd65700080d43d1
😎 Deploy Preview https://deploy-preview-392--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.

@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@jajafwangshak86-ops 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

@DeFiVC
DeFiVC merged commit 466a5cf into ChainLearnOfficial:main Aug 29, 2026
4 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

2 participants