Skip to content

Conversation

IanMayo
Copy link
Contributor

@IanMayo IanMayo commented Aug 11, 2025

Summary

Simplifies the state structure by removing the unnecessary AxesConfig wrapper type that only contained a single margins property.

Changes

✅ Type Simplification

  • Removed AxesConfig typedef (was only wrapping margins)
  • Updated GramFrameState to use AxesMargins directly
  • Updated ViewportConfig to reference margins directly

✅ Code Updates

  • Changed state.axes.marginsstate.margins throughout codebase (14 occurrences)
  • Updated state initialization in src/core/state.js
  • Updated all affected files:
    • src/modes/BaseMode.js
    • src/modes/doppler/DopplerMode.js
    • src/modes/harmonics/HarmonicsMode.js
    • src/modes/pan/PanMode.js
    • src/core/keyboardControl.js (3 occurrences)
    • src/core/events.js
    • src/components/table.js (4 occurrences)
    • src/rendering/cursors.js

Impact

Before:

state.axes.margins.left  // Unnecessary nesting

After:

state.margins.left  // Direct and cleaner

Benefits

  • 🎯 Removes unnecessary nesting - One less level of object traversal
  • 📖 Improves readability - state.margins is clearer than state.axes.margins
  • 🏗️ Simplifies architecture - Eliminates wrapper types that serve no purpose
  • No functional changes - Pure refactoring with no behavior changes

Testing

✅ All 65 tests passing with no regressions
✅ TypeScript checking passes
✅ No functional changes - purely structural refactoring

Related

This follows up on #132 and #145 to continue improving the codebase architecture by eliminating unnecessary complexity.

Copy link

netlify bot commented Aug 11, 2025

Deploy Preview for gramframe ready!

Name Link
🔨 Latest commit 59c0970
🔍 Latest deploy log https://app.netlify.com/projects/gramframe/deploys/6899ae5d46aa0e0008e5ea99
😎 Deploy Preview https://deploy-preview-146--gramframe.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@IanMayo IanMayo changed the base branch from main to issue-132-final-refactor August 11, 2025 08:49
@IanMayo IanMayo requested a review from Copilot August 11, 2025 08:50
Copy link
Contributor

@Copilot 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 simplifies the state structure by removing the unnecessary AxesConfig wrapper type that only contained a single margins property, making the codebase more direct and readable.

  • Removes AxesConfig typedef and updates GramFrameState to use AxesMargins directly
  • Changes all references from state.axes.margins to state.margins throughout the codebase
  • Updates state initialization to remove the axes wrapper object

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/types.js Removes AxesConfig typedef and updates GramFrameState type definition
src/core/state.js Updates initial state structure to use margins directly instead of nested axes.margins
src/rendering/cursors.js Updates margin access in cursor drawing functions
src/modes/pan/PanMode.js Updates margin access in pan mode calculations
src/modes/harmonics/HarmonicsMode.js Updates margin access in harmonic line calculations
src/modes/doppler/DopplerMode.js Updates margin access in Doppler mode rendering
src/modes/BaseMode.js Updates margin access in viewport configuration
src/core/keyboardControl.js Updates margin access in keyboard movement functions (3 occurrences)
src/core/events.js Updates margin access in coordinate conversion
src/components/table.js Updates margin access in layout and rendering functions (4 occurrences)

@IanMayo IanMayo merged commit 248fe36 into issue-132-final-refactor Aug 11, 2025
4 checks passed
@IanMayo IanMayo deleted the simplify-axes-config branch August 11, 2025 08:51
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.

1 participant