Skip to content

Refactor web App.tsx into smaller modules #3

Description

@codetea-ping999

Goal

Reduce maintenance risk in the Studio web app by splitting apps/web/src/App.tsx into smaller modules with clear responsibilities.

Scope

  • apps/web/src/App.tsx
  • New files under apps/web/src/components/
  • New files under apps/web/src/hooks/
  • New files under apps/web/src/lib/

Background

App.tsx currently handles API calls, polling, payload building, gallery actions, asset detail handling, and rendering. The feature set is useful, but the file has become a high-change concentration point.

Required changes

  • Move API request helpers into apps/web/src/lib/api.ts
  • Move request/reuse payload builders into apps/web/src/lib/payloads.ts
  • Move job polling logic into apps/web/src/hooks/useJobPolling.ts
  • Extract presentational pieces into components such as:
    • StagePreview
    • gallery panel/list
    • asset detail panel
  • Keep current UI behavior and endpoint usage intact
  • Prefer low-risk refactoring over redesign

Constraints

  • Do not change visible product behavior unless necessary for correctness
  • Keep endpoint contracts unchanged
  • Avoid introducing new dependencies unless clearly justified

Acceptance criteria

  • npm run build passes in apps/web
  • App.tsx becomes a composition/root container instead of a large mixed-responsibility file
  • Existing generation, polling, gallery selection, reuse, export, and project binding flows still work

Validation

  • Run cd apps/web && npm run build
  • Manually smoke-check:
    • media type switching
    • queue generation
    • latest job polling
    • gallery item selection
    • asset reuse/export/project binding

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions