forked from mfittko/geo-playground
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Parent: #7
Scope
Apply refactors after E2E coverage is green to simplify components, reduce re‑renders, and align with coding best practices.
Deliverables
- GeometryCanvas
- Extract hooks:
useGridSync(external↔internal sync + drag guards),useFormulaSelection(point selection/navigation),useMeasurementsPanel(read/update) - Split render into
ShapeLayersandFormulaLayer - Memoize heavy computations; wrap
FormulaGraph/ShapeRendererinReact.memo - Replace magic numbers/timeouts with named constants (e.g.,
GRID_POSITION_DEBOUNCE_MS) - Centralize calibration/localStorage via helper
- Extract hooks:
- CanvasGrid
- Debounce origin updates via small util; extract z‑index constants
- ShareViewOptions context
- Split
isSharePanelOpeninto separate context; memoize provider values;updateShareViewOptionviauseCallback
- Split
- URL helpers
- Consolidate boolean parsing utilities; ensure deterministic param ordering; unit tests for env‑overridden defaults (admin)
- UnifiedSettingsModal / SharePanel
- ARIA labels for icon buttons; lazy render tab content; extract
ToggleRow/OptionRow
- ARIA labels for icon buttons; lazy render tab content; extract
- GlobalControls / Toolbar
- Ensure accessible names; unify
IconButtonpattern; memoize handlers
- Ensure accessible names; unify
- Logging/ESLint
- Gate verbose logs behind
loggingEnabled/NODE_ENV; narrow react‑refresh overrides
- Gate verbose logs behind
Acceptance Criteria
- No functional regressions; E2E remains green
- Drag remains smooth (no remounts on drag); no snap‑back
- Component tree size reduced; fewer renders on drag and toggle changes
- Lint clean; unit tests added for new helpers
Copilot