Caching content: Caching the user stats and making submission sync to codeforces#132
Conversation
|
@aviralsaxena16 is attempting to deploy a commit to the aviralsaxena16's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Caution Review failedThe pull request is closed. WalkthroughThis PR integrates Codeforces submission verification and syncing across the platform, redesigns contest and POTD displays with dual-source data fetching and fallback logic, expands Firebase services for user stats and authentication, and modernizes UI styling and layout across multiple components. It also refactors the questions editor and updates formatting utilities to support markdown-like HTML conversion. Changes
Sequence DiagramssequenceDiagram
participant User
participant App as Application
participant CF as Codeforces API
participant DB as Firestore
User->>App: Click "Verify Submission" (POTD)
activate App
App->>CF: Fetch user submissions (last 50)
activate CF
CF-->>App: Return submissions list
deactivate CF
App->>App: Parse problem URL to extract contest/index
App->>App: Search for matching accepted submission
alt Submission Found & Verified
App->>DB: Run transaction: update coins, streak, lastSolvedDate
activate DB
DB->>DB: Add user to daily solvers sub-collection
DB-->>App: Transaction committed
deactivate DB
App-->>User: Display "Solved" state
else No Valid Submission
App-->>User: Show verification failed message
end
deactivate App
sequenceDiagram
participant App as Application
participant CLIST as clist.by API
participant FALLBACK as competeapi API
participant Response as Client
App->>App: Fetch contests request
activate App
App->>CLIST: Request contests with Authorization header
activate CLIST
alt CLIST Success (HTTP 200)
CLIST-->>App: Return contest data
App->>App: Transform to Contest[] with source: "clist"
App-->>Response: Return {contests, source: "clist"}
else CLIST Failure
CLIST-->>App: Error or timeout
deactivate CLIST
App->>FALLBACK: Request contests (fallback source)
activate FALLBACK
FALLBACK-->>App: Return contest data
App->>App: Filter by allowed platforms, transform to Contest[]
App-->>Response: Return {contests, source: "fallback"}
deactivate FALLBACK
end
deactivate App
sequenceDiagram
participant User
participant App as QuesList Component
participant CF as Codeforces API
participant DB as Firestore
User->>App: Click "Sync Progress" button
activate App
App->>App: Set syncing state, show spinner
App->>CF: Fetch user submissions
activate CF
CF-->>App: Return submissions
deactivate CF
App->>App: Parse CF problem URLs, extract contest/index
App->>App: Compare with local questions, identify new solves
loop For each new solved problem
App->>DB: Update user.solvedQuestions[rating] with problem ID
activate DB
DB-->>App: Acknowledged
deactivate DB
App->>App: Update local solvedIds and progress
end
App->>App: Clear syncing state
App-->>User: Display updated progress and status badges
deactivate App
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Suggested reviewers
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (9)
📒 Files selected for processing (19)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🎉 Thanks for Your Contribution to CanonForces!
|
Description
This PR revamps the UI for the Problem of the Day (POTD) page to align it with the "Practice Arena" design language. The primary focus was fixing the header layout issues where the mascot image was forcing unnecessary height, and improving the visual hierarchy of the typography.
Additionally, a dedicated "Empty State" has been added to the leaderboard for days where no users have solved the problem yet.
🔑 Key Changes
1. Header Redesign (Visual Polish)
2. Layout Fixes
position: absolute. It "pops out" of the container without affecting the header's height or pushing text content down.2.5fr 1frfor better spacing between the Problem Description and the Leaderboard.3. New Features
nosolve.pngwith a "Be the first to claim the throne!" message whendailySolversis empty, replacing the previous text-only placeholder.📸 Screenshots
nosolve.pngwhen empty.🧪 Testing
📂 Files Changed
styles/POTDpage.module.css: Complete CSS overhaul for.heroSectionand.leaderboardCard.pages/POTDPage.tsx: Structural updates to the Hero section DOM and Conditional rendering for the empty state.Summary by CodeRabbit
Release Notes
New Features
Style
✏️ Tip: You can customize this high-level summary in your review settings.