Skip to content

Component Refactoring & Organization Notes โ€‹

Recent Changes (January 7, 2026) โ€‹

Dashboard UI extracted โ€‹

  • Dashboard UI primitives moved to src/components/dashboard/Primitives.jsx (shared DashboardButton, DashboardCard, DashboardBadge).
  • Offer promo components moved to src/components/dashboard/OfferCards.jsx (HeroOfferCard, OfferPill).
  • View components moved to src/components/dashboard/ (HomeView, VenueView, ActiveLanternView, ScheduleConfirmationView, DashboardNavigation).
  • Dashboard now imports these instead of inlining, reducing file size and clarifying ownership.
  • Screen wrappers added in src/screens/dashboard/ (PlacesScreen.jsx, VenueDetailScreen.jsx, ActiveLanternScreen.jsx, LanternSuccessScreen.jsx) so Dashboard renders screens instead of inline views.

Recent Changes (January 3, 2026) โ€‹

Components Extracted from Dashboard โ€‹

The following components were previously embedded in Dashboard.jsx and have been extracted into standalone, reusable components:

  1. LightLanternForm โ†’ src/components/LightLanternForm.jsx
    • Previously: 70 lines embedded in Dashboard
    • Now: Standalone component, reusable for immediate and scheduled lighting
    • Storybook: 4 stories showcasing different configurations

New Components Created โ€‹

  1. VenuePicker โ†’ src/components/VenuePicker.jsx

    • Purpose: Global venue selection interface
    • Features: List/map views, search, category filtering
    • Use cases: Light lantern, schedule light, future features
  2. ScheduleLightForm โ†’ src/components/ScheduleLightForm.jsx

    • Purpose: Multi-step wizard for scheduling future lights
    • Steps: Venue โ†’ Date/Time โ†’ Interest/Mood
    • Integrates with: VenuePicker, LightLanternForm

Future Refactoring Considerations โ€‹

Potential Component Extractions โ€‹

Based on the conversation about "potentially moving places and lantern lights into their own components or screens," here are recommendations:

1. Places/Venues Screen โ€‹

Current State:

  • Venue list and map are rendered via PlacesScreen.jsx (wraps HomeView)
  • Venue detail lives in VenueDetailScreen.jsx (wraps VenueView)

Remaining Recommendation:

  • Extract venue map view โ†’ src/components/VenuesMap.jsx
  • Extract venue list โ†’ src/components/VenuesList.jsx
  • Keep VenueView but consider renaming to VenueDetail.jsx for clarity

2. Active Lantern Screen โ€‹

Current State:

  • ActiveLanternView component inside Dashboard.jsx (lines ~632-695)

Recommendation:

  • Extract โ†’ src/screens/ActiveLanternScreen.jsx or src/components/ActiveLantern.jsx

Benefits:

  • Standalone testing
  • Easier to add features (edit lantern, view waves, etc.)
  • Could become a full "My Lantern" screen with tabs

Current File Structure (as of January 7, 2026) โ€‹

Note: Screens have been migrated to src/screens/{domain}/. See SCREENS_ORGANIZATION.md.

src/
  components/          # Reusable UI components
    Button.jsx
    Card.jsx
    Badge.jsx
    LanternBeacon.jsx
    LanternHub.jsx
    LightLanternForm.jsx
    VenuePicker.jsx
    ScheduleLightForm.jsx
    WaveManager.jsx
    Chat.jsx
    VenuesMap.jsx      # FUTURE - extracted map view
    VenuesList.jsx     # FUTURE - extracted list view
    VenueCard.jsx      # FUTURE - individual venue card
    ActiveLantern.jsx  # FUTURE - active lantern view
    
  screens/             # Full-screen views (routes)
    auth/
      SignupFlow.jsx
    dashboard/
      Dashboard.jsx    # Orchestrates dashboard flows
      PlacesScreen.jsx # Wraps HomeView
      VenueDetailScreen.jsx
      ActiveLanternScreen.jsx
      LanternSuccessScreen.jsx
    merchant/
      MerchantDashboard.jsx
      OfferForm.jsx
    profile/
      ProfileSettings.jsx
      CreateNewProfile.jsx

Benefits of Further Refactoring โ€‹

Current State (Partially Refactored) โ€‹

โœ… Forms are reusable โœ… Picker is standalone โœ… Hub triggers flows cleanly โš ๏ธ Dashboard.jsx still ~1100 lines โš ๏ธ HomeView, VenueView, ActiveLanternView embedded

After Full Refactoring โ€‹

  • Dashboard.jsx โ†’ ~400 lines (orchestration only)
  • Each screen โ†’ 100-300 lines (focused, testable)
  • Components โ†’ 50-200 lines (highly reusable)
  • Storybook coverage for all screens
  • Easier onboarding for new developers
  • Simpler unit testing

Phase 1: Extract Screens (High Impact, Low Risk) โ€‹

  1. Extract HomeView โ†’ PlacesScreen.jsx
  2. Extract VenueView โ†’ VenueDetailScreen.jsx
  3. Extract ActiveLanternView โ†’ ActiveLanternScreen.jsx
  4. Update Dashboard to import and render screens
  5. Create Storybook stories for each screen

Phase 2: Break Down Places Screen (Medium Impact) โ€‹

  1. Extract map view โ†’ VenuesMap.jsx
  2. Extract list view โ†’ VenuesList.jsx
  3. Extract individual venue card โ†’ VenueCard.jsx
  4. PlacesScreen uses these components

Phase 3: Advanced Organization (Lower Priority) โ€‹

  1. Create src/features/ directory
  2. Group related components by feature:
    • features/venues/ (map, list, detail, picker)
    • features/lantern/ (hub, form, active view)
    • features/social/ (waves, chat, beacon)
  3. Update imports across codebase

Trade-offs to Consider โ€‹

โœ… Pros of Refactoring โ€‹

  • Better code organization
  • Easier testing and maintenance
  • Smaller, focused files
  • Better for team collaboration
  • Clearer dependencies

โš ๏ธ Cons to Watch For โ€‹

  • Initial time investment
  • Need to update all imports
  • Risk of breaking existing flows
  • More files to navigate

When to Refactor โ€‹

  • โœ… Do it now if planning to add more features
  • โœ… Do it if team is growing
  • โš ๏ธ Wait if launching pilot soon (defer until after)
  • โš ๏ธ Wait if no immediate pain points

Current Status โ€‹

As of this refactoring session:

  • โœ… Forms are extracted and reusable
  • โœ… Multi-step flows work smoothly
  • โœ… Storybook coverage good for new components
  • โš ๏ธ Dashboard still contains screen views
  • โš ๏ธ Could benefit from screen/component split

Recommendation: The current state is production-ready for the pilot. Further refactoring can be done iteratively as new features are added.


Built with VitePress