refactor(renderer): shared files/timeline-geometry libs + inspector/settings sub-modules#56
Merged
Merged
Conversation
…big components Decomposes the largest components into testable pure libs and self-contained sub-modules, and removes the duplication the audit named: - lib/files.ts: pathsFrom(files) — the FileList->paths snippet was copy- pasted verbatim in 5 components (LeftRail/Timeline/CritiquePanel/ StylePanel and a variant in Settings). All now import it. - lib/timeline-geometry.ts: the pure timeline math + types + constants + placeAudioOnTrack + ASSET_MIME, out of Timeline.tsx (704->552 lines). ASSET_MIME no longer crosses a component->component import (LeftRail imported it from Timeline). timeline-geometry.test.ts covers computePreview/geomFor/placeAudioOnTrack. - components/inspector/fields.tsx: the Inspector's form primitives (Section/SegGroup/DraftTextArea/NumberChip/DraftSlider/ColorChip/ InspSelect/PaddingChip) (InspectorPanel 745->424 lines). - components/settings/controls.tsx: SettingRow/SettingSelect/Toggle/ Divider/modelLabel (SettingsModal 605->525 lines). Pure moves + import rewiring; no behavior change. 123 tests (9 new). Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
Audit roadmap Phase 6 (renderer decomposition). Splits the largest components into testable pure libs and self-contained sub-modules, and removes the duplication/smells the audit named:
lib/files.ts—pathsFrom(files): theFileList → disk pathssnippet was copy-pasted verbatim in 5 components (LeftRail,Timeline,CritiquePanel,StylePanel, + a variant inSettingsModal). All now import the one helper.lib/timeline-geometry.ts: the pure timeline math (computePreview/geomFor/commit/clamp/round), types, constants,placeAudioOnTrack, andASSET_MIME, extracted fromTimeline.tsx(704 → 552 lines).ASSET_MIMEno longer crosses a component→component import (LeftRailimported it fromTimeline). Newtimeline-geometry.test.tscoverscomputePreview(move/left/right + clamps),geomFor, andplaceAudioOnTrack(role inference + music ducking).components/inspector/fields.tsx: the Inspector's form primitives (Section,SegGroup,DraftTextArea,NumberChip,DraftSlider,ColorChip,InspSelect,PaddingChip+ internalDraftNumberInput/normalizeHex), extracted fromInspectorPanel.tsx(745 → 424 lines).components/settings/controls.tsx:SettingRow/SettingSelect/Toggle/Divider/modelLabel, extracted fromSettingsModal.tsx(605 → 525 lines).Pure moves + import rewiring — no behavior change. Renderer-only, no dev-server restart needed.
Scope note:
Home.tsxandSettingsModal's statefulVoicesTabweren't sub-split here — they're large and stateful, and this PR already delivers the testable-lib extractions and the cross-component dedup with lower risk. They can follow as their own moves.Test plan
Made with Cursor