Skip to content

Frontend: Fetch and Display User Data in GameActivity Navbar #151

@onlydustapp

Description

@onlydustapp

📚 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

  1. Create a useUserData.ts hook that uses React Query to fetch user data.
  2. On successful API response:
    • Update UserContext with user profile and coin data.
    • Update GameModeContext with the current game mode.
  3. In the GameActivityNavbar.tsx component:
    • Use the useUserData hook to trigger data fetching.
    • Render the user data as specified by the Figma design.
  4. 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.
  • UserContext and GameModeContext are 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 🚀!

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions