diff --git a/src/App.jsx b/src/App.jsx index b02859e..d1c542b 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -437,19 +437,26 @@ function App() { opacity: 0, }} animate={{ - opacity: backdropLoading ? 0 : 0.5, + opacity: backdropLoading ? 0 : 0.6, }} exit={{ opacity: 0, }} transition={{ - duration: 0.5, + duration: 0.8, ease: "easeInOut", }} - onLoad={() => setBackdropLoading(false)} + onLoadCapture={() => { + console.log(`loading ${backdropId}`); + setBackdropLoading(true); + }} + onLoad={() => { + console.log(`loaded ${backdropId}`); + setBackdropLoading(false); + }} loading="eager" style={{ - transition: "opacity 1s", + transition: "opacity 0.8s", }} /> diff --git a/src/components/buttons/likeButton.jsx b/src/components/buttons/likeButton.jsx index 7352999..57afdb0 100644 --- a/src/components/buttons/likeButton.jsx +++ b/src/components/buttons/likeButton.jsx @@ -1,7 +1,7 @@ /** @format */ import PropTypes from "prop-types"; -import { useEffect } from "react"; +import React from "react"; import IconButton from "@mui/material/IconButton"; @@ -25,14 +25,13 @@ const LikeButton = ({ const { enqueueSnackbar } = useSnackbar(); const handleLiking = async () => { - let result; if (isFavorite) { - result = await getUserLibraryApi(window.api).unmarkFavoriteItem({ + await getUserLibraryApi(window.api).unmarkFavoriteItem({ userId: userId, itemId: itemId, }); } else if (!isFavorite) { - result = await getUserLibraryApi(window.api).markFavoriteItem({ + await getUserLibraryApi(window.api).markFavoriteItem({ userId: userId, itemId: itemId, }); @@ -40,7 +39,7 @@ const LikeButton = ({ }; const mutation = useMutation({ mutationFn: handleLiking, - onError: (error, a, context) => { + onError: (error) => { enqueueSnackbar(`${error}`, { variant: "error", }); diff --git a/src/components/carouselSlide/index.jsx b/src/components/carouselSlide/index.jsx index 3b0a5b9..1a9de31 100644 --- a/src/components/carouselSlide/index.jsx +++ b/src/components/carouselSlide/index.jsx @@ -59,7 +59,7 @@ const CarouselSlide = ({ item }) => { const handleMoreInfo = () => { if (availableSpecialRoutes.includes(item.Type)) { navigate(`/${item.Type.toLocaleLowerCase()}/${item.Id}`); - } else if (!!item.Role) { + } else if (item.Role) { navigate(`/person/${item.Id}`); } else { navigate(`/item/${item.Id}`); @@ -106,7 +106,7 @@ const CarouselSlide = ({ item }) => { { initial={{ transform: animationDirection == "right" - ? "translateX(40px)" - : "translateX(-40px)", + ? "translateX(60px)" + : "translateX(-60px)", opacity: 0, }} animate={{ @@ -139,8 +139,8 @@ const CarouselSlide = ({ item }) => { exit={{ transform: animationDirection == "right" - ? "translateX(-40px)" - : "translateX(40px)", + ? "translateX(-60px)" + : "translateX(60px)", opacity: 0, }} @@ -199,7 +199,7 @@ const CarouselSlide = ({ item }) => { className="hero-carousel-info" > - {!!item.ProductionYear + {item.ProductionYear ? item.ProductionYear : "Unknown"} @@ -215,7 +215,7 @@ const CarouselSlide = ({ item }) => { }} className="hero-carousel-info-rating" > - {!!item.CommunityRating ? ( + {item.CommunityRating ? ( <> { queryKey={["item", id]} disableInfoStrip disablePlayButton - disableLikeButton disableMarkAsPlayedButton />
diff --git a/src/routes/series/index.jsx b/src/routes/series/index.jsx index f634256..e515927 100644 --- a/src/routes/series/index.jsx +++ b/src/routes/series/index.jsx @@ -1,5 +1,5 @@ /** @format */ -import { useState, useEffect } from "react"; +import React, { useState, useEffect } from "react"; import PropTypes from "prop-types"; import Box from "@mui/material/Box"; @@ -12,7 +12,7 @@ import MenuItem from "@mui/material/MenuItem"; import { motion } from "framer-motion"; -import { useParams, useNavigate, Link as RouterLink } from "react-router-dom"; +import { useParams } from "react-router-dom"; import { BaseItemKind, @@ -26,7 +26,7 @@ import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api"; import { useQuery } from "@tanstack/react-query"; -import { getRuntimeMusic, getRuntimeFull, endsAt } from "../../utils/date/time"; +import { getRuntimeMusic } from "../../utils/date/time"; import Hero from "../../components/layouts/item/hero"; import { Card } from "../../components/card/card"; @@ -36,12 +36,12 @@ import { CardScroller } from "../../components/cardScroller/cardScroller"; import "./series.module.scss"; import { EpisodeCardsSkeleton } from "../../components/skeleton/episodeCards"; import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice"; -import { usePlaybackStore } from "../../utils/store/playback"; import { useBackdropStore } from "../../utils/store/backdrop"; import { ActorCard } from "../../components/card/actorCards"; import { SeasonSelectorSkeleton } from "../../components/skeleton/seasonSelector"; -import { stagger } from "framer-motion"; +import LikeButton from "../../components/buttons/likeButton"; +import MarkPlayedButton from "../../components/buttons/markPlayedButton"; function TabPanel(props) { const { children, value, index, ...other } = props; @@ -65,16 +65,8 @@ TabPanel.propTypes = { value: PropTypes.number.isRequired, }; -function a11yProps(index) { - return { - id: `full-width-tab-${index}`, - "aria-controls": `full-width-tabpanel-${index}`, - }; -} - const SeriesTitlePage = () => { const { id } = useParams(); - const navigate = useNavigate(); const user = useQuery({ queryKey: ["user"], @@ -148,6 +140,21 @@ const SeriesTitlePage = () => { }); const [currentSeason, setCurrentSeason] = useState(0); + + const currentSeasonItem = useQuery({ + queryKey: ["item", id, "season", currentSeason], + queryFn: async () => { + const result = await getUserLibraryApi(window.api).getItem({ + userId: user.data.Id, + itemId: seasons.data.Items[currentSeason].Id, + }); + return result.data; + }, + enabled: seasons.isSuccess, + networkMode: "always", + refetchOnWindowFocus: true, + }); + const episodes = useQuery({ queryKey: ["item", id, `season ${currentSeason + 1}`, "episodes"], queryFn: async () => { @@ -178,24 +185,6 @@ const SeriesTitlePage = () => { }, enabled: item.isSuccess, }); - const [ - setUrl, - setPosition, - setDuration, - setItemId, - setItemName, - setSubtitleTracksStore, - setSelectedSubtitleTrack, - ] = usePlaybackStore((state) => [ - state.setUrl, - state.setPosition, - state.setDuration, - state.setItemId, - state.setItemName, - state.setSubtitleTracks, - state.setSelectedSubtitleTrack, - ]); - const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]); const [directors, setDirectors] = useState([]); @@ -262,40 +251,35 @@ const SeriesTitlePage = () => { displayCards={4} disableDecoration > - {nextUpEpisode.data.Items.map( - (episode, index) => { - return ( - - ); - }, - )} + {nextUpEpisode.data.Items.map((episode) => { + return ( + + ); + })} )} @@ -345,110 +329,163 @@ const SeriesTitlePage = () => { } >
- - setCurrentSeason(e.target.value) - } - select - SelectProps={{ - MenuProps: { - disableScrollLock: true, - }, +
- {seasons.data.Items.map( - (season, index) => { - return ( - - {season.Name} - - ); - }, + {currentSeasonItem.isSuccess && ( + )} - + {currentSeasonItem.isSuccess && ( + <> + + + )} + + setCurrentSeason( + e.target.value, + ) + } + select + SelectProps={{ + MenuProps: { + disableScrollLock: true, + }, + }} + size="small" + > + {seasons.data.Items.map( + (season, index) => { + return ( + + {season.Name} + + ); + }, + )} + +
{episodes.isLoading ? ( ) : ( - episodes.data.Items.map( - (episode, index) => { - return ( - - - - ); - }, - ) + episodes.data.Items.map((episode) => { + return ( + + + + ); + }) )}
@@ -460,46 +497,40 @@ const SeriesTitlePage = () => { displayCards={8} disableDecoration > - {specialFeatures.data.map( - (special, index) => { - return ( - {}} - /> - ); - }, - )} + {specialFeatures.data.map((special) => { + return ( + {}} + /> + ); + })} )} {item.data.People.length > 0 && ( @@ -508,7 +539,7 @@ const SeriesTitlePage = () => { displayCards={8} disableDecoration > - {item.data.People.map((person, index) => { + {item.data.People.map((person) => { return ( { displayCards={8} disableDecoration > - {similarItems.data.Items.map((similar, index) => { + {similarItems.data.Items.map((similar) => { return ( { ? `${ similar.ProductionYear } - ${ - !!similar.EndDate + similar.EndDate ? new Date( similar.EndDate, ).toLocaleString( diff --git a/src/styles/global.scss b/src/styles/global.scss index 052f010..7f53b9c 100644 --- a/src/styles/global.scss +++ b/src/styles/global.scss @@ -50,7 +50,7 @@ body { top: -100px; left: -100px; z-index: -1; - filter: blur(100px) saturate(120%) contrast(90%); + filter: blur(120px) saturate(130%) contrast(140%); &-container { position: fixed; width: 100vw;