Skip to content

Conversation

@Noname397
Copy link
Collaborator

📝 Description

This pull request refactors the authentication and Piazza context management in the frontend React app. It introduces new context providers for user authentication and Piazza tab information, and updates all related components to use these contexts for state and actions. This change centralizes logic, improves code organization, and removes redundant state handling from individual components.

Context Provider Introduction and Integration

  • Added UserAuthProvider and PiazzaProvider context components in frontend/src/context/UserAuthContext.jsx and frontend/src/context/PiazzaContext.jsx, encapsulating authentication and Piazza tab logic for use throughout the app.
  • Wrapped the root app in both providers in frontend/src/popup/main.jsx to ensure global access to authentication and Piazza state.

Component Refactoring to Use Context

  • Refactored App, DashboardPage, AssistantPage, and LoginPage components to consume authentication and Piazza state/actions from context, removing local state and redundant prop drilling.

Code Simplification and Cleanup

  • Removed duplicated logic for authentication and Piazza tab info from individual components, consolidating it in context providers for easier maintenance and improved separation of concerns.
    These changes streamline state management, improve code readability, and make it easier to extend authentication and Piazza-related functionality in the future.

🎯 Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔨 Refactoring (no functional changes)
  • 🧪 Tests (adding or updating tests)
  • 🔧 Chore (dependency updates, config changes, etc.)

🧪 Testing

  • I have tested this change locally
  • I have added/updated tests for this change
  • All existing tests pass

📋 Checklist

  • My code follows the code style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

📸 Screenshots (if applicable)

N/A

🔗 Related Issues

This might be useful for #45

Copilot AI review requested due to automatic review settings November 28, 2025 06:26
@Noname397 Noname397 requested a review from hamin2006 as a code owner November 28, 2025 06:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants