-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Labels
Description
📚 Overview
This feature aims to fetch user data (profile info, coin balance, and selected game mode) using React Query and display it in the GameActivity Navbar. The fetched data will be synchronized with the global state managed by UserContext and GameModeContext, ensuring a seamless and consistent gameplay experience.
🎯 Objectives
- Fetch user data via an API endpoint (or mock API) and update both
UserContextandGameModeContextaccordingly. - Render the user profile information, coin balance, and selected game mode in the GameActivity Navbar.
- Implement loading and error states for better UX.
- Ensure the UI aligns with the Figma design.
🔍 Technical Implementation
- Create a
useUserData.tshook that uses React Query to fetch user data. - On successful API response:
- Update
UserContextwith user profile and coin data. - Update
GameModeContextwith the current game mode.
- Update
- In the
GameActivityNavbar.tsxcomponent:- Use the
useUserDatahook to trigger data fetching. - Render the user data as specified by the Figma design.
- Use the
- Implement loading indicators and error handling to improve user experience.
📋 Acceptance Criteria
- User data is reliably fetched using React Query.
- The navbar displays profile information, coin balance, and selected game mode accurately.
-
UserContextandGameModeContextare updated correctly based on the fetched data. - The UI strictly follows the design provided in the Figma link.
- Loading and error states are handled gracefully.
💻 Additional Information
- Ensure to sync with the latest changes from the LogiQuest repository before starting work. Refer to the Contribution Guidelines for more details.
- Please attach a screenshot of the updated navbar with loaded user data in your pull request.
Let's add a touch of interactivity and ensure smooth gameplay experience 🚀!