[READ-ONLY] Mirror of https://github.com/flo-bit/skywatched. review movies and tv shows, based on at proto skywatched.app
0

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #26 from flo-bit/v2-fixes

fix clicking on movie redirects to wrong page

authored by

Florian and committed by
GitHub
(Dec 9, 2024, 2:01 PM +0100) 021c88bb 634715b4

+11 -13
+5 -5
src/lib/Components/MovieCard.svelte
··· 6 6 showMark, 7 7 watchedMovies 8 8 }: { 9 - movie: { poster_path: string; original_title: string; id: number; watched?: boolean }; 9 + movie: { poster_path: string; original_title: string; movieId: number }; 10 10 showMark?: boolean; 11 11 watchedMovies?: Set<number>; 12 12 } = $props(); ··· 26 26 27 27 {#if showMark} 28 28 <form method="post" action="?/mark" use:enhance> 29 - <input type="hidden" name="id" value={movie.id} /> 29 + <input type="hidden" name="id" value={movie.movieId} /> 30 30 31 31 <button 32 32 class={cn( 33 33 'pointer-events-auto absolute bottom-2 right-2 z-20 sm:hidden rounded-full border border-base-50/20 bg-black/30 p-2 text-base-50 backdrop-blur-sm group-hover:block', 34 - watchedMovies?.has(movie.id) 34 + watchedMovies?.has(movie.movieId) 35 35 ? 'sm:block border-green-500/20 bg-green-900/60 text-green-500' 36 36 : '' 37 37 )} 38 38 onclick={() => { 39 - watchedMovies?.add(movie.id); 39 + watchedMovies?.add(movie.movieId); 40 40 }} 41 41 > 42 42 <span class="sr-only">mark as watched</span> ··· 56 56 </div> 57 57 <div class="mt-2 flex justify-between"> 58 58 <h3 class="sm:text-md text-sm font-medium text-base-50"> 59 - <a href="/movie/{movie.id}"> 59 + <a href="/movie/{movie.movieId}"> 60 60 <span aria-hidden="true" class="absolute inset-0"></span> 61 61 <div class="line-clamp-2 max-w-full"> 62 62 {movie.original_title}
+1 -1
src/lib/Components/MovieGrid.svelte
··· 8 8 showMark, 9 9 watchedMovies 10 10 }: { 11 - movies: { poster_path: string; original_title: string; id: number; movieId: number }[]; 11 + movies: { poster_path: string; original_title: string; movieId: number }[]; 12 12 class?: string; 13 13 showMark?: boolean; 14 14 watchedMovies?: Set<number>;
+2 -2
src/lib/server/movies.ts
··· 92 92 93 93 export async function getWatchedMoviesIds(username: string) { 94 94 const movies = await db 95 - .select({ id: table.movies.movieId }) 95 + .select({ movieId: table.movies.movieId }) 96 96 .from(table.movies) 97 97 .where(and(eq(table.movies.username, username), eq(table.movies.watched, 1))); 98 98 99 - return new Set(movies.map((movie) => movie.id)); 99 + return new Set(movies.map((movie) => movie.movieId)); 100 100 }
-2
src/routes/search/+page.server.ts
··· 32 32 33 33 const watched = await checkWatched(movieId, username); 34 34 35 - console.log(watched, username, movieId, result); 36 - 37 35 if (watched !== false) { 38 36 await db 39 37 .update(table.movies)
+3 -1
src/routes/movie/[id]/+page.server.ts
··· 18 18 19 19 const trailer = await getTrailer(id); 20 20 21 - const recommendations = await getRecommendations(id); 21 + const recommendations = (await getRecommendations(id)).map((movie) => { 22 + return { ...movie, movieId: movie.id }; 23 + }); 22 24 23 25 let watched = false; 24 26
-2
src/routes/movie/[id]/+page.svelte
··· 9 9 10 10 let { data }: { data: PageData } = $props(); 11 11 12 - console.log(data); 13 - 14 12 let hoveringWatchButton = $state(false); 15 13 </script> 16 14