📚 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
UserContext and GameModeContext accordingly.
- 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.ts hook that uses React Query to fetch user data.
- On successful API response:
- Update
UserContext with user profile and coin data.
- Update
GameModeContext with the current game mode.
- In the
GameActivityNavbar.tsx component:
- Use the
useUserData hook to trigger data fetching.
- Render the user data as specified by the Figma design.
- Implement loading indicators and error handling to improve user experience.
📋 Acceptance Criteria
💻 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 🚀!
📚 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
UserContextandGameModeContext, ensuring a seamless and consistent gameplay experience.🎯 Objectives
UserContextandGameModeContextaccordingly.🔍 Technical Implementation
useUserData.tshook that uses React Query to fetch user data.UserContextwith user profile and coin data.GameModeContextwith the current game mode.GameActivityNavbar.tsxcomponent:useUserDatahook to trigger data fetching.📋 Acceptance Criteria
UserContextandGameModeContextare updated correctly based on the fetched data.💻 Additional Information
Let's add a touch of interactivity and ensure smooth gameplay experience 🚀!