Improved modal content dynamic rendering and scalability for "New & Popular" page #76
+185
−28
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.
This pull request refactors the modal functionality on new&popular.html to use a centralized contentData array for all content metadata, rather than hardcoded description objects or scattered static strings.
Changes made:
Introduced a single contentData array containing all relevant info (title, description, image URL, genres, cast, director, rating, release date, duration) for each content card.
Refactored the openModal function to dynamically populate modal elements based on the clicked title using this array, making the modal more scalable and maintainable.
Removed the old static object mapping titles to descriptions, reducing code duplication.
Ensured proper filling of all modal fields: title, description, hero image, genre tags, and all rows of metadata.
All other interactivity (modal close, notify/remind button toggles, carousel drag, reveal animations) remain unaffected and fully functional.
Why:
Scalability: New titles/content can now be added to the modal by simply updating the contentData array, with no JS or HTML structure changes required.
Maintainability: Centralizing all metadata reduces mistakes, improves reviewability, and separates data from markup/presentation logic.
Best practices: This approach prepares the project for future features and additional content without repetitively editing multiple files or functions.
No impact on existing feature tabs, navigation, or styles—this pull request is self-contained to the modal improvement for the New & Popular page.