Split files over 1000 lines into modules under 700 lines#257
Conversation
- Extract GLSL shaders from useWebGLOverlay.ts into hooks/webGLShaders.ts (buildVertexShader / buildFragmentShader functions) - Extract app constants from App.tsx into appConfig.ts (shader groups, theme options, computeModuleHash, IS_PUBLIC_MODE) - Extract 3D render block from App.tsx into components/App3DView.tsx - Extract 2D render block from App.tsx into components/MainLayout.tsx - Fix setPan prop: pass local state setter (not setLibPan) so pan syncs correctly - Fix MainLayout shaderCatalog type to use ShaderMeta from storageApi - Fix async handler types for handleLibrarySongLoad / onSyncLibrary https://claude.ai/code/session_01BKN1s4nq125fD1Q3fbSdfS
|
Looking for one thing? Review this PR in Change Stack to search files, summaries, diffs, and code without losing your place. Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThis PR refactors the app architecture by consolidating configuration and delegating UI rendering to mode-specific layout components. App.tsx now imports centralized shader/theme config and delegates to App3DView (3D mode) or MainLayout (2D mode). WebGL shader generation is extracted into a dedicated builder module. ChangesUI Architecture Refactor and Configuration Consolidation
Sequence DiagramsequenceDiagram
participant App as App.tsx
participant Config as appConfig
participant App3D as App3DView
participant MainLayout as MainLayout
participant Header as Header
participant PatternDisplay as PatternDisplay
participant Controls as Controls
App->>Config: import shader/theme config
App->>App: evaluate is3DMode
alt 3D Mode
App->>App3D: render with state/handlers
App3D->>Header: pass syncDebug diagnostics
App3D->>PatternDisplay: pass playback/channel/handlers
App3D->>Controls: pass file/media/bloom controls
else 2D Mode
App->>MainLayout: render with full state/handlers
MainLayout->>Header: Global Controls (shader/theme/audio)
MainLayout->>PatternDisplay: main display with keying
MainLayout->>Controls: bloom/night/CRT toggles
MainLayout->>MainLayout: conditional panels (playlist/library/meters)
end
Estimated Code Review Effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested Labels
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
App.tsx(1064 → 675 lines): extracted constants toappConfig.ts, 3D render tocomponents/App3DView.tsx, and 2D render tocomponents/MainLayout.tsxhooks/useWebGLOverlay.ts(1075 → 542 lines): extracted ~540 lines of inline GLSL shader strings tohooks/webGLShaders.tsasbuildVertexShader()/buildFragmentShader()functionsNew files
appConfig.tscomputeModuleHash,IS_PUBLIC_MODEhooks/webGLShaders.tscomponents/App3DView.tsxcomponents/MainLayout.tsxBug fixes during refactor
setPanprop: was incorrectly passingsetLibPan(the libopenmpt setter) instead of the local React state setter, which would have broken pan state syncMainLayoutshaderCatalogprop type to use the properShaderMetainterface fromstorageApihandleLibrarySongLoad/onSyncLibraryTest plan
https://claude.ai/code/session_01BKN1s4nq125fD1Q3fbSdfS
Generated by Claude Code
Summary by CodeRabbit