Skip to content

Feat/complexity - #204

Draft
sylhare wants to merge 9 commits into
mainfrom
feat/complexity
Draft

Feat/complexity#204
sylhare wants to merge 9 commits into
mainfrom
feat/complexity

Conversation

@sylhare

@sylhare sylhare commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Reduce cyclomatic complexity

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.
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