Skip to content

Commit

Permalink
Final: Enhanced app frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangsonww committed Nov 14, 2024
1 parent 37ed863 commit 4fd40f2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .idea/dataSources.local.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions MovieVerse-Frontend/js/favorites.js
Original file line number Diff line number Diff line change
Expand Up @@ -1499,7 +1499,7 @@ async function displayFavoritesSection(titleText, items, displaySection) {
if (items.length > 0) {
const favoritesDiv = document.createElement('div');
favoritesDiv.className = 'watchlist';
favoritesDiv.id = titleText.toLowerCase().replace(' ', '-');
favoritesDiv.id = titleText.toLowerCase().replace(/\s+/g, '-');

const title = document.createElement('h3');
title.textContent = titleText;
Expand All @@ -1509,8 +1509,10 @@ async function displayFavoritesSection(titleText, items, displaySection) {
favoritesDiv.scrollIntoView({ behavior: 'smooth' });
});

const titleTextNew = titleText === 'Favorite Movies' ? 'favorite movies' : 'favorite TV series';

const description = document.createElement('p');
description.textContent = `A collection of your ${titleText.toLowerCase()}.`;
description.textContent = `A collection of your ${titleTextNew}.`;
description.className = 'watchlist-description';

favoritesDiv.appendChild(title);
Expand All @@ -1527,8 +1529,9 @@ async function displayFavoritesSection(titleText, items, displaySection) {
} else {
const favoritesDiv = document.createElement('div');
favoritesDiv.className = 'watchlist';
favoritesDiv.id = titleText.toLowerCase().replace(' ', '-');
favoritesDiv.innerHTML = `<div style="text-align: center"><h3 style="text-align: center; font-size: 24px; color: #ff8623">${titleText}</h3><p style="text-align: center">No ${titleText.toLowerCase()} added yet.</p></div>`;
favoritesDiv.id = titleText.toLowerCase().replace(/\s+/g, '-');
const titleTextNew = titleText === 'Favorite Movies' ? 'favorite movies' : 'favorite TV series';
favoritesDiv.innerHTML = `<div style="text-align: center"><h3 style="text-align: center; font-size: 24px; color: #ff8623">${titleText}</h3><p style="text-align: center">No ${titleTextNew} added yet.</p></div>`;
displaySection.appendChild(favoritesDiv);
}
}
Expand Down

0 comments on commit 4fd40f2

Please sign in to comment.