Skip to content

Conversation

@Rhys18751996
Copy link
Contributor

@Rhys18751996 Rhys18751996 commented Dec 22, 2025

Summary
This PR refactors the previously monolithic main.js into smaller, responsibility-based controllers while preserving the ability to run the project locally via index.html (no server or build step required).
It also introduces a season selector, allowing users to choose which season’s paths and markers are displayed on the map. Changing the season fully resets and reloads all relevant data to ensure consistency.

Key Changes

Application Architecture Refactor

  • Split application logic into dedicated controllers:
    • map
    • paths
    • markers
    • slider
    • UI (hiding or showing mainButton, menu, slider)
    • season
    • appState
    • CharacterCheckBoxController (This will be for dynamically showing character checkbox icons in future)
  • Introduced a centralized application state to manage:
    • Active paths
    • Active markers
    • Episode slider range and current value
    • path animation speed
    • path animation weight
  • Preserved backward compatibility with existing inline HTML event handlers
    • (e.g. character checkbox icons in the paths grid).

Data Structure Improvements

  • Split large data files into smaller, purpose-specific files to improve clarity and maintainability.
  • Separated data into distinct categories, such as:
    • Character data (characterData.js)
    • Marker data (dataMarkerMarkers.js)
    • Marker Type data (dataMarkerTypes.js)
    • Path data (paths-season1-lotr.js or paths-season2-lotr.js)
    • Seasons Data (seasonsData.js)
  • This makes it easier to track changes, update content, and extend datasets in future seasons.

Season Selector

  • Added a season/series selector to control which paths and markers are displayed.
  • When the season changes:
    • All paths and markers are cleared
    • Relevant data for the selected season is reloaded
    • The episode slider range is recalculated
  • Ensures no cross-season state leakage (e.g. Season 1 paths appearing in Season 2).

Why Separate Responsibilities?

  • Improves readability by reducing file size and cognitive load.
  • Enhances maintainability by isolating concerns and reducing coupling.
  • Makes the app far more extensible, enabling future features such as:
    • Additional seasons or series
    • Chapter- or episode-based timelines
    • Improved filtering and UI interactions
  • Provides a clearer mental model of how data, state, and UI interact across the app.

Work to do

  • Add Rings of Power season2 data
    - paths
    - markers
    - characters
  • Figure out how to handle 1 character from two different series (ie Elrond from ROP and Elrond from LOTR).
  • Style the season selector.
  • Separate the data between lotr and the hobbit so that the markers show in both series.
  • Make character checkbox icons dynamically load on the UI(pathsgrid) depending on what season was selected.

- Added a season dropdown to filter available characters and markers by season
- Integrated SeasonController to manage current season state
- Updated SliderController to dynamically adjust episode range based on selected season
- Refactored MarkersController to allow adding markers per season
- Updated main.js to initialize SeasonController and expose global seasonChange handler
- Ensures only relevant characters, paths, and markers are displayed per season
- Updated MarkersController.js to filter markers by currently selected season and slider range
- Updated PathsController.js to filter character paths by selected season and slider range
- Both controllers now dynamically use SeasonController.getCurrentSeason() instead of hardcoded season values
- Ensures markers and paths refresh automatically when season or episode range changes
- Prepares app for multiple seasons and dynamic episode counts
@Rhys18751996
Copy link
Contributor Author

hello @algernhon, I really love this creation of yours, I hope you can find some time to review or even merge my request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant