Description
When a user visits the leaderboard page (frontend/leaderboard.html), the page currently renders an empty white screen while data is being fetched from the LeetCode API. If the fetch fails (network issue, API rate limit, server error), the page remains blank forever with no indication to the user that something went wrong or that they can retry.
This creates a poor user experience — visitors have no feedback about the page state and may assume the site is broken.
Proposed Solution
Phase 1 — Loading State (Skeleton UI)
- In
frontend/leaderboard.html, add skeleton placeholder rows inside the leaderboard container (10 animated shimmer rows).
- In
frontend/css/main.css, add .skeleton class with a CSS shimmer animation (@keyframes shimmer using background: linear-gradient + background-size + translateX).
- In
frontend/js/render.js, show skeleton on page load and hide it when renderLeaderboard() completes.
Phase 2 — Error State
- In
frontend/leaderboard.html, add a hidden error banner element with: an error icon, "Failed to load leaderboard" message, and a "Retry" button.
- In
frontend/js/render.js, wrap the fetch call in try/catch. On failure, hide the skeleton and show the error banner.
- Wire the "Retry" button to re-trigger the initial data fetch.
Phase 3 — Empty State
- If the API returns an empty array, show a "No leaderboard data yet" message instead of an empty table.
Acceptance Criteria
Affected Files
frontend/leaderboard.html
frontend/css/main.css
frontend/js/render.js
Description
When a user visits the leaderboard page (
frontend/leaderboard.html), the page currently renders an empty white screen while data is being fetched from the LeetCode API. If the fetch fails (network issue, API rate limit, server error), the page remains blank forever with no indication to the user that something went wrong or that they can retry.This creates a poor user experience — visitors have no feedback about the page state and may assume the site is broken.
Proposed Solution
Phase 1 — Loading State (Skeleton UI)
frontend/leaderboard.html, add skeleton placeholder rows inside the leaderboard container (10 animated shimmer rows).frontend/css/main.css, add.skeletonclass with a CSS shimmer animation (@keyframes shimmerusingbackground: linear-gradient+background-size+translateX).frontend/js/render.js, show skeleton on page load and hide it whenrenderLeaderboard()completes.Phase 2 — Error State
frontend/leaderboard.html, add a hidden error banner element with: an error icon, "Failed to load leaderboard" message, and a "Retry" button.frontend/js/render.js, wrap the fetch call in try/catch. On failure, hide the skeleton and show the error banner.Phase 3 — Empty State
Acceptance Criteria
Affected Files
frontend/leaderboard.htmlfrontend/css/main.cssfrontend/js/render.js