Skip to content

Commit

Permalink
Update: Add context referencing for chatbot (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangsonww committed Jul 26, 2024
1 parent 353e47c commit 1e43262
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 59 deletions.
2 changes: 2 additions & 0 deletions MovieVerse-Frontend/js/actor-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,8 @@ async function populateActorDetails(actor, credits) {
navigateMedia(images, imageElement, index - currentIndex);
updateDots(index);
});
dot.addEventListener('mouseover', () => dot.style.backgroundColor = '#6a6a6a');
dot.addEventListener('mouseout', () => dot.style.backgroundColor = index === currentIndex ? '#ff8623' : '#bbb');

currentLine.appendChild(dot);

Expand Down
5 changes: 1 addition & 4 deletions MovieVerse-Frontend/js/favorites.js
Original file line number Diff line number Diff line change
Expand Up @@ -1640,7 +1640,6 @@ function updateFavoriteGenre(genre_ids) {

function updateUniqueMoviesViewed(movieId) {
let viewedMovies = JSON.parse(localStorage.getItem('uniqueMoviesViewed')) || [];

if (!viewedMovies.includes(movieId)) {
viewedMovies.push(movieId);
localStorage.setItem('uniqueMoviesViewed', JSON.stringify(viewedMovies));
Expand All @@ -1661,6 +1660,7 @@ async function isListPinned(watchlistId) {
try {
const watchlistRef = doc(db, 'watchlists', watchlistId);
const watchlistDoc = await getDoc(watchlistRef);

if (watchlistDoc.exists()) {
const watchlistData = watchlistDoc.data();
return watchlistData.pinned || false;
Expand Down Expand Up @@ -1731,7 +1731,6 @@ function shareWatchList(watchlistDiv) {
const watchlistTitle = watchlistDiv.querySelector('.watchlist-title').textContent;
let itemsToShare = `Explore my curated watchlist, "${watchlistTitle}", which contains:\n`;
let finalLine = 'Happy Watching! 🍿🎬🎥\n\n'

const movieCards = watchlistDiv.querySelectorAll('[data-movie-title]');
const tvSeriesCards = watchlistDiv.querySelectorAll('[data-series-title]');

Expand Down Expand Up @@ -1844,7 +1843,6 @@ async function moveWatchList(watchlistDiv, moveUp) {
});

const index = watchlists.findIndex(watchlist => watchlist.docId === watchlistId);

if (index === -1 || watchlists.length < 2) {
hideSpinner();
return;
Expand Down Expand Up @@ -1915,7 +1913,6 @@ async function pinWatchList(watchlistDiv, watchlistId) {
}

loadWatchLists();

window.location.reload();
}

Expand Down
7 changes: 0 additions & 7 deletions MovieVerse-Frontend/js/firebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ function getFBConfig1() {
return translateFBC(fbConfig1);
}

const movieCode = {
part1: 'YzVhMjBjODY=',
part2: 'MWFjZjdiYjg=',
part3: 'ZDllOTg3ZGNjN2YxYjU1OA=='
};

function getFBConfig2() {
const fbConfig2 = "bW92aWV2ZXJzZS1hcHAuZmlyZWJhc2VhcHAuY29t";
return translateFBC(fbConfig2);
Expand Down Expand Up @@ -46,5 +40,4 @@ const firebaseConfig = {
};

export const app = !getApps().length ? initializeApp(firebaseConfig) : getApp();

export const db = getFirestore(app);
1 change: 1 addition & 0 deletions MovieVerse-Frontend/js/inception.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ async function ensureGenreMapIsAvailable() {

async function fetchGenreMap() {
const url = `https://${getMovieVerseData()}/3/genre/movie/list?${generateMovieNames()}${getMovieCode()}`;

try {
const response = await fetch(url);
const data = await response.json();
Expand Down
29 changes: 0 additions & 29 deletions MovieVerse-Frontend/js/leonardo-dicarprio.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,6 @@ function handleSearch() {
window.location.href = 'search.html';
}

function calculateMoviesToDisplay() {
const screenWidth = window.innerWidth;
if (screenWidth <= 689.9) return 10;
if (screenWidth <= 1021.24) return 20;
if (screenWidth <= 1353.74) return 21;
if (screenWidth <= 1684.9) return 20;
if (screenWidth <= 2017.49) return 20;
if (screenWidth <= 2349.99) return 18;
if (screenWidth <= 2681.99) return 21;
if (screenWidth <= 3014.49) return 24;
if (screenWidth <= 3345.99) return 27;
if (screenWidth <= 3677.99) return 20;
if (screenWidth <= 4009.99) return 22;
if (screenWidth <= 4340.99) return 24;
if (screenWidth <= 4673.49) return 26;
if (screenWidth <= 5005.99) return 28;
if (screenWidth <= 5337.99) return 30;
if (screenWidth <= 5669.99) return 32;
if (screenWidth <= 6001.99) return 34;
if (screenWidth <= 6333.99) return 36;
if (screenWidth <= 6665.99) return 38;
if (screenWidth <= 6997.99) return 40;
if (screenWidth <= 7329.99) return 42;
if (screenWidth <= 7661.99) return 44;
if (screenWidth <= 7993.99) return 46;
if (screenWidth <= 8325.99) return 48;
return 20;
}

let initialMainContent = '';

document.addEventListener('DOMContentLoaded', () => {
Expand Down
2 changes: 1 addition & 1 deletion MovieVerse-Frontend/js/movie-match.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ document.getElementById('movie-match-form').addEventListener('submit', function(
const mood = document.getElementById('mood').value;
const genre = document.getElementById('genre').value;
const period = document.getElementById('period').value;

findMovieMatch(mood, genre, period);
});

Expand Down Expand Up @@ -45,6 +44,7 @@ async function showMovieOfTheDay() {

async function fetchGenreMap() {
const url = `https://${getMovieVerseData()}/3/genre/movie/list?${generateMovieNames()}${getMovieCode()}`;

try {
const response = await fetch(url);
const data = await response.json();
Expand Down
3 changes: 2 additions & 1 deletion MovieVerse-Frontend/js/sign-in.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ document.getElementById('signInForm').addEventListener('submit', async function(
localStorage.setItem('isSignedIn', JSON.stringify(true));
localStorage.setItem('currentlySignedInMovieVerseUser', email);
window.location.href = '../../index.html';
} else {
}
else {
alert('Invalid email or password. Ensure that you have entered a correct combination of email and password - one that we have on file.');
}
}
Expand Down
10 changes: 5 additions & 5 deletions MovieVerse-Frontend/js/single-spa-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ function loadApp(name, path, activeWhen, customProps = {}) {

loadApp(
'navbar',
'/path-to-navbar-microfrontend/navbar.js',
() => true // always active
'/navbar.js',
() => true
);

loadApp(
'home',
'/path-to-home-microfrontend/home.js',
'/home.js',
(location) => location.pathname === '' || location.pathname === '/'
);

loadApp(
'movie-details',
'/path-to-movie-details-microfrontend/movie-details.js',
'/movie-details.js',
(location) => location.pathname.startsWith('/movie')
);

loadApp(
'about',
'/path-to-about-microfrontend/about.js',
'/about.js',
(location) => location.pathname.startsWith('/about')
);

Expand Down
12 changes: 0 additions & 12 deletions MovieVerse-Frontend/js/terms-of-service.js
Original file line number Diff line number Diff line change
@@ -1,72 +1,60 @@
document.getElementById('agreement').addEventListener('click', function(e) {
e.preventDefault();

document.getElementById('agreement').scrollIntoView({ behavior: 'smooth' });
});

document.getElementById('consent').addEventListener('click', function(e) {
e.preventDefault();

document.getElementById('consent').scrollIntoView({ behavior: 'smooth' });
});

document.getElementById('subheading2').addEventListener('click', function(e) {
e.preventDefault();

document.getElementById('subheading2').scrollIntoView({ behavior: 'smooth' });
});

document.getElementById('subheading').addEventListener('click', function(e) {
e.preventDefault();

document.getElementById('subheading').scrollIntoView({ behavior: 'smooth' });
});

document.getElementById('subheading3').addEventListener('click', function(e) {
e.preventDefault();

document.getElementById('subheading3').scrollIntoView({ behavior: 'smooth' });
});

document.getElementById('subheading4').addEventListener('click', function(e) {
e.preventDefault();

document.getElementById('subheading4').scrollIntoView({ behavior: 'smooth' });
});

document.getElementById('subheading5').addEventListener('click', function(e) {
e.preventDefault();

document.getElementById('subheading5').scrollIntoView({ behavior: 'smooth' });
});

document.getElementById('subheading6').addEventListener('click', function(e) {
e.preventDefault();

document.getElementById('subheading6').scrollIntoView({ behavior: 'smooth' });
});

document.getElementById('subheading7').addEventListener('click', function(e) {
e.preventDefault();

document.getElementById('subheading7').scrollIntoView({ behavior: 'smooth' });
});

document.getElementById('subheading8').addEventListener('click', function(e) {
e.preventDefault();

document.getElementById('subheading8').scrollIntoView({ behavior: 'smooth' });
});

document.getElementById('subheading9').addEventListener('click', function(e) {
e.preventDefault();

document.getElementById('subheading9').scrollIntoView({ behavior: 'smooth' });
});

document.getElementById('subheading10').addEventListener('click', function(e) {
e.preventDefault();

document.getElementById('subheading10').scrollIntoView({ behavior: 'smooth' });
});

Expand Down

0 comments on commit 1e43262

Please sign in to comment.