feat: dynamic media pages
This commit is contained in:
parent
ae973948c8
commit
0187aaa766
13 changed files with 560 additions and 360 deletions
|
@ -36,7 +36,11 @@ export default async function () {
|
|||
try {
|
||||
const movies = await fetchAllMovies()
|
||||
const favoriteMovies = movies.filter(movie => movie['favorite'])
|
||||
const recentlyWatchedMovies = movies.filter(movie => movie['last_watched'] && year - DateTime.fromISO(movie['last_watched']).year <= 3)
|
||||
const now = DateTime.now();
|
||||
const recentlyWatchedMovies = movies.filter(movie => {
|
||||
const lastWatched = movie['last_watched']
|
||||
return (lastWatched && now.diff(DateTime.fromISO(lastWatched), 'months').months <= 6)
|
||||
})
|
||||
|
||||
return {
|
||||
movies,
|
||||
|
|
|
@ -46,7 +46,7 @@ export default async function () {
|
|||
|
||||
return {
|
||||
shows,
|
||||
recentlyWatched: episodes.slice(0, 225),
|
||||
recentlyWatched: episodes.slice(0, 125),
|
||||
favorites: shows.filter(show => show.favorite).sort((a, b) => a.title.localeCompare(b.title)),
|
||||
}
|
||||
} catch (error) {
|
||||
|
|
Reference in a new issue