Skip to content

[P3] Refactor: extract a shared ScrollytellingWrapper, relocate shared utils, remove any #92

Description

@dmchaledev

Context

CODE-QUALITY-AUDIT.md §1 (Top-5 #3). The three scrollytelling components are 100% structurally identical (~47 lines each), differing only in name and which StickyVisualization/NarrativeSteps they import:

  • src/components/eviction-data/EvictionScrollytelling.tsx
  • src/components/campaign-finance-data/CampaignFinanceScrollytelling.tsx
  • src/components/sidewalk-data/SidewalkScrollytelling.tsx

The work

  • Extract a generic ScrollytellingWrapper taking the viz + steps as props/children; collapse the three files to thin wrappers.
  • Move shared useLocale.ts and styles.css out of sidewalk-data/ (where eviction & campaign-finance currently reach across to import them) into src/components/shared/ or src/utils/.
  • Replace the two let scroller: any declarations with the proper scrollama type already used in the sidewalk component.
  • Adopt the configured path aliases (@components/*, etc.) consistently while touching these files.

Effort: Low (~an hour). Removes ~100 lines of duplication and the only any types in the codebase.

Priority: Low — code-health cleanup, no user-facing change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions