diff --git a/package-lock.json b/package-lock.json index 82b848c..efa8ffb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,9 @@ "": { "name": "reiverr", "version": "0.9.0", + "dependencies": { + "gsap": "^3.12.5" + }, "devDependencies": { "@jellyfin/sdk": "^0.8.2", "@playwright/test": "^1.28.1", @@ -4281,6 +4284,11 @@ "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", "dev": true }, + "node_modules/gsap": { + "version": "3.12.5", + "resolved": "https://registry.npmjs.org/gsap/-/gsap-3.12.5.tgz", + "integrity": "sha512-srBfnk4n+Oe/ZnMIOXt3gT605BX9x5+rh/prT2F1SsNJsU1XuMiP0E2aptW481OnonOGACZWBqseH5Z7csHxhQ==" + }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", diff --git a/package.json b/package.json index 917b7cf..ce1c3e4 100644 --- a/package.json +++ b/package.json @@ -66,5 +66,8 @@ "last 1 firefox version", "last 1 safari version" ] + }, + "dependencies": { + "gsap": "^3.12.5" } } diff --git a/src/lib/components/HeroShowcase/HeroShowcase.svelte b/src/lib/components/HeroShowcase/HeroShowcase.svelte index 79f7791..6bb8ec0 100644 --- a/src/lib/components/HeroShowcase/HeroShowcase.svelte +++ b/src/lib/components/HeroShowcase/HeroShowcase.svelte @@ -4,19 +4,21 @@ import type { ShowcaseItemProps } from './HeroShowcase'; import HeroShowcaseBackground from './HeroShowcaseBackground.svelte'; import { Selectable } from '../../selectable'; + import IconButton from '../IconButton.svelte'; + import { ChevronRight, DotFilled } from 'radix-icons-svelte'; + import CardPlaceholder from '../Card/CardPlaceholder.svelte'; + import classNames from 'classnames'; + import Poster from '../Poster/Poster.svelte'; + import { TMDB_POSTER_SMALL } from '../../constants'; export let items: Promise = Promise.resolve([]); - let showcaseIndex = 0; + let showcaseIndex = 6; let showcaseLength = 0; $: items.then((i) => (showcaseLength = i?.length || 0)); function onNext() { - if (showcaseIndex === showcaseLength - 1) { - Selectable.focusRight(); - } else { - showcaseIndex = (showcaseIndex + 1) % showcaseLength; - } + showcaseIndex = (showcaseIndex + 1) % showcaseLength; return true; } @@ -38,36 +40,88 @@ Selectable.focusLeft() + up: () => Selectable.focusLeft() || true }} > - - - - - - - - - - - - - - - - - - - - - +
+ {#await items} +
+ +
+
stats
+
title
+
genres
+
+
+
+
+ + + +
+ +
+ {:then items} + {#if items[showcaseIndex]} + {@const item = items[showcaseIndex]} +
+
+ +
+
+
= 15 + } + )} + > + {item?.title} +
+
+

{item.year}

+ + +

{item.rating} TMDB

+
+
+ {item.overview} +
+ +
+
+ {/if} +
+
+ + + +
+ +
+ {:catch error} +

{error.message}

+ {/await} +
- + diff --git a/src/lib/components/HeroShowcase/HeroShowcase.ts b/src/lib/components/HeroShowcase/HeroShowcase.ts index 826542e..9c74d57 100644 --- a/src/lib/components/HeroShowcase/HeroShowcase.ts +++ b/src/lib/components/HeroShowcase/HeroShowcase.ts @@ -1,4 +1,5 @@ import type { getTmdbPopularMovies } from '../../apis/tmdb/tmdbApi'; +import { formatMinutesToTime } from '../../utils'; export type RatingSource = 'tmdb'; // TODO: Add more rating sources & move elsewhere @@ -9,25 +10,30 @@ export type ShowcaseItemProps = { trailerUrl?: string; title: string; + overview?: string; year?: number; - runtime?: number; - rating?: number; + runtime?: string; + rating?: string; ratingSource?: RatingSource; genres: string[]; + url?: string; }; export async function getShowcasePropsFromTmdb( response: Awaited> ): Promise { + console.log(response); return response.slice(0, 10).map((movie) => ({ title: movie.title || '', posterUrl: movie.poster_path || '', backdropUrl: movie.backdrop_path || '', - rating: movie.vote_average, + rating: movie.vote_average?.toFixed(1) || '0', genres: [], //(movie as any)?.genres?.map((genre: any) => genre?.name), year: movie.release_date ? new Date(movie.release_date).getFullYear() : undefined, - runtime: (movie as any).runtime || 0, + runtime: formatMinutesToTime((movie as any).runtime || 0), ratingSource: 'tmdb', - trailerUrl: '' + trailerUrl: '', + url: `https://www.themoviedb.org/movie/${movie.id}`, + overview: movie.overview || '' })); } diff --git a/src/lib/components/HeroShowcase/HeroShowcaseBackground.svelte b/src/lib/components/HeroShowcase/HeroShowcaseBackground.svelte index c4fd409..40ef76c 100644 --- a/src/lib/components/HeroShowcase/HeroShowcaseBackground.svelte +++ b/src/lib/components/HeroShowcase/HeroShowcaseBackground.svelte @@ -13,22 +13,27 @@ } -
- {#await items then items} - {#each items as item, index} -
+
+
+ {#await items then items} + {#each items as item, i}
-
- {/each} - {/await} + class="w-full h-full flex-shrink-0 basis-auto relative" + style="transform-style: preserve-3d; -webkit-transform-style: preserve-3d; overflow: hidden;" + bind:this={htmlElements[i]} + > +
+
+ {/each} + {/await} +
+
diff --git a/src/lib/components/HeroShowcase/PageDots.svelte b/src/lib/components/HeroShowcase/PageDots.svelte index cec18e9..1f355b7 100644 --- a/src/lib/components/HeroShowcase/PageDots.svelte +++ b/src/lib/components/HeroShowcase/PageDots.svelte @@ -1,6 +1,5 @@