Skip to content
fahimcodexPublic

About

An interactive browser-based platform to learn Linux, C, C++, and Python through structured lessons, real-time code execution, gamification, and AI-powered assistance.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Branch Summary

master-colab

Optimistic UI updates for XP and improved comment section sorting

Introduces optimistic UI updates for XP/level on lesson/challenge completion and refactors the comment section to handle sorting and error states without relying on Firestore orderBy. Also adds real-time profile updates and manual profile mutations for user state.

Changes

  • Implements optimistic XP/level/badge updates in ChallengePage and LessonPage using the new updateProfile function from useAuth.
  • Refactors lib/auth.js to provide real-time profile updates via onSnapshot and an updateProfile method for local state mutation.
  • Updates /app/api/challenges/submit/route.js to relax challengeId submission logic and mark the route as "force-dynamic".
  • Refactors CommentSection.js to remove Firestore orderBy in queries, instead performing client-side sorting (by upvotes and creation time for root comments, by creation time for replies).
  • Adds error handling for comment and reply posting, displaying alerts on failure and preventing state inconsistencies.
  • Refactors code for better formatting and minor UI/UX improvements (button styling, event handling).

Impact

  • Users see immediate XP, level, and badge updates on UI after completing lessons or challenges, improving responsiveness.
  • User profile information stays in sync with Firestore changes in real time.
  • Comment and reply ordering remains correct even without Firestore indexes, improving robustness and reliability.
  • Graceful error handling prevents silent failures in comment and reply posting.
  • No breaking API changes, but relies on new optimistic state management and real-time profile subscription.
  • Potential for minor increased memory usage due to additional listeners, but no major performance impact expected.

About

An interactive browser-based platform to learn Linux, C, C++, and Python through structured lessons, real-time code execution, gamification, and AI-powered assistance.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages