Modularize Studio App.jsx into lib/components + add Vitest test suite#2
Merged
Merged
Conversation
App.jsx was a single 997-line file mixing data, analysis logic, CSV parsing, UI primitives, and five feature components. This splits it into focused modules and adds the Studio's first automated tests. Extraction (behavior-preserving, verbatim moves): - src/lib/lexicons.js word/emoji sets, TONE_DEFS/COLOR/PATTERNS, CAPTION_TONES - src/lib/analysis.js tokenize, countEmoji, analyzeSentiment, analyzeTone, enrich - src/lib/csv.js FIELD_MAP, pick, toNum, normalize, parseCSV - src/components/ primitives + UploadCard/Overview/Brands/Tweets/CaptionStudio - src/App.jsx thin shell (997 -> 174 lines) wiring tabs + selection state Tests (Vitest, jsdom-free Node env): - 40 tests across analysis/csv/lexicons; 100% line + 95.5% branch coverage of lib/ - npm test / test:watch / test:coverage scripts; standalone vitest.config.js so the build config is untouched Behavior is unchanged: production build is byte-stable (identical CSS hash), and a normalized source diff vs the original shows only formatter cosmetics (semicolons, trailing commas, arrow-param parens) plus the deliberate enrich/CAPTION_TONES moves. The unused lucide `Filter` import was dropped.
This was referenced Jun 13, 2026
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
Splits the single 997-line
studio/src/App.jsxinto focused modules and adds the Studio's first automated test suite (Vitest).Extraction (behavior-preserving, verbatim moves)
src/lib/lexicons.js— word/emoji sets,TONE_DEFS/TONE_COLOR/TONE_PATTERNS,CAPTION_TONESsrc/lib/analysis.js—tokenize,countEmoji,analyzeSentiment,analyzeTone,enrichsrc/lib/csv.js—FIELD_MAP,pick,toNum,normalize,parseCSVsrc/components/— primitives +UploadCard/OverviewTab/BrandsTab/TweetsTab/CaptionStudiosrc/App.jsx— thin shell (997 → 174 lines) wiring tabs + selection stateTests
lib/npm test/test:watch/test:coverage; standalonevitest.config.jsso the Vite build config is untouchedBehavior preservation
enrich/CAPTION_TONESrelocationsFilterimportNo behavior changes — pure refactor + tests.