Skip to content

Comments

Admin/add react context#82

Closed
ascibisz wants to merge 4 commits intofix/refactor-into-more-componentsfrom
admin/add-react-context
Closed

Admin/add react context#82
ascibisz wants to merge 4 commits intofix/refactor-into-more-componentsfrom
admin/add-react-context

Conversation

@ascibisz
Copy link
Contributor

@ascibisz ascibisz commented Sep 16, 2025

Problem

We were moving really fast to hit the Sept 15 deadline, but now that we have some breathing room, it's a good time to do some re-org and make sure that things are set up in a way that makes sense for our growing code base!

When Joe was helping me debug this issue last week, he noted that we should improve our state management system. Now seems as good a time as any!

Solution

  • Started using React Context for state management. So far, I'm just using one context provider and I'm initializing it in PackingInput, and then providing it to all downstream components

Note: functionally, there should be no changes! The site should behave exactly as it did before.

@ascibisz ascibisz force-pushed the admin/add-react-context branch from ca0a73b to 28796e6 Compare September 16, 2025 22:57
@github-actions
Copy link

github-actions bot commented Sep 17, 2025

PR Preview Action v1.6.2
Preview removed because the pull request was closed.
2025-09-25 21:46 UTC

@ascibisz ascibisz marked this pull request as ready for review September 17, 2025 16:47
@ascibisz ascibisz linked an issue Sep 17, 2025 that may be closed by this pull request
@ascibisz ascibisz requested review from Copilot and rugeli September 17, 2025 17:11
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.

Pull Request Overview

This PR introduces React Context for state management to improve the organization of the codebase. The changes refactor existing functionality to use a centralized state management approach without changing user-facing behavior.

  • Implements React Context (PackingContext) to manage shared state across components
  • Extracts UI components (StatusBar, RecipeForm, GradientStrength) from larger components to improve modularity
  • Refactors prop drilling by moving state access to React Context

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/context.tsx Defines the new PackingContext interface and default values
src/components/StatusBar/index.tsx Extracts status display and download functionality into standalone component
src/components/RecipeForm/index.tsx Separates recipe form logic into dedicated component using context
src/components/GradientInput/index.tsx Refactors to use context and extracts GradientStrength component
src/components/InputSwitch/index.tsx Updates to consume state from context instead of props
src/components/JSONViewer/index.tsx Simplifies props by removing toggle state management
src/components/PackingInput/index.tsx Provides context to child components and removes inline form rendering
src/App.tsx Simplifies by delegating status bar rendering to StatusBar component

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@rugeli rugeli requested a review from interim17 September 17, 2025 21:46
Copy link
Contributor

@interim17 interim17 left a comment

Choose a reason for hiding this comment

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

I will go through this in detail, but imho when establishing a new pattern like adding global state, its best not to have that in the same PR as refactoring components and CSS, because it makes it hard to tell which changes are truly related to the new pattern.

@ascibisz ascibisz changed the base branch from main to fix/refactor-into-more-components September 17, 2025 23:04
@ascibisz ascibisz marked this pull request as draft September 24, 2025 21:52
@ascibisz ascibisz closed this Sep 25, 2025
@ascibisz ascibisz deleted the admin/add-react-context branch October 8, 2025 22:07
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.

Refactor: Use React Context

2 participants