Feat/complexity - #204
Draft
sylhare wants to merge 9 commits into
Draft
Conversation
StatsPage's getDiagnostics and its helpers were CC 49 closures recreated every render. Move them to statsDiagnostics.ts as plain functions taking players/maps as params, reusing countTier from graphColors instead of a second copy of the count-bucketing thresholds.
…r-key parsing
computeDiagnostics only needed roundsPlayed off engineState, so fold it into
the maps it already takes instead of a whole extra param. Also share one
splitPairKey helper (playerUtils) between statsDiagnostics and TeammateGraph
instead of two copies of pair.split('|').
The touch/mouse/armed/dragging branching in handleMove/handleUp was CC 41 worth of logic buried in pointer-event closures. Move the decisions (decideMoveAction, decideUpAction, resolveDropTarget) to slotDragGesture.ts as pure functions, directly unit-testable without simulating PointerEvents. Also drops a redundant duplicate positionGhost() call on drag start.
…ate pieces CourtAssignments was CC 36 across settings, edit-mode banner, courts grid, bench, winner tip, regenerate, and three empty states in one function. Pull CourtSettingsBar/BenchSection/AssignmentsEmptyState out as presentational components, matching the existing CourtCard/TeamPlayerList split. Also shares one clamp() helper (numberUtils) between courtCountUtils and NumberField instead of two inline min/max reimplementations.
…ompact The 4 count maps (bench/single/win/loss) were named twice — once building allPlayerIds, once packing ps — with no single source of truth for their order. Share one SCALAR_FIELDS tuple so toCompact derives both from it; fromCompact's per-field truthy guards stay explicit (parallel, not duplicated logic) rather than going through a generic loop, which review found less readable for no real complexity win.
…config AlgorithmPage/EnginePage/LevelTrackerPage were byte-for-byte identical 12-line wrappers around NotebookPage, differing only by URL/title strings. Route each notebook URL/title directly in main.tsx against a single lazy NotebookPage import instead, dropping the three files and their near- duplicate lazy chunks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reduce cyclomatic complexity