diff --git a/src/App.jsx b/src/App.jsx index f9efb4e..9602954 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -72,13 +72,17 @@ import { delUser, getUser } from "./utils/storage/user.js"; import axios from "axios"; import { useBackdropStore } from "./utils/store/backdrop.js"; -import { usePlaybackDataLoadStore } from "./utils/store/playback.js"; +import { + usePlaybackDataLoadStore, + usePlaybackStore, +} from "./utils/store/playback.js"; import BoxSetTitlePage from "./routes/boxset/index.jsx"; import PersonTitlePage from "./routes/person/index.jsx"; import MusicAlbumTitlePage from "./routes/album/index.jsx"; import AudioPlayer from "./components/playback/audioPlayer/index.jsx"; import { useAudioPlayback } from "./utils/store/audioPlayback.js"; import ArtistTitlePage from "./routes/artist/index.jsx"; +import EpisodeTitlePage from "./routes/episode/index.jsx"; const jellyfin = new Jellyfin({ clientInfo: { @@ -268,9 +272,6 @@ function App() { }; const location = useLocation(); - useEffect(() => { - window.scrollTo(0, 0); - }, [location.pathname]); if (!window.api) { serverAvailable().then((available) => { @@ -489,6 +490,11 @@ function App() { path="/boxset/:id" element={} /> + } + /> - {/* */} + ); diff --git a/src/components/card/card.jsx b/src/components/card/card.jsx index 327e568..d092c6f 100644 --- a/src/components/card/card.jsx +++ b/src/components/card/card.jsx @@ -29,6 +29,7 @@ const availableSpecialRoutes = [ BaseItemKind.Series, BaseItemKind.BoxSet, BaseItemKind.MusicAlbum, + BaseItemKind.Episode, ]; /** diff --git a/src/components/card/episodeCard.jsx b/src/components/card/episodeCard.jsx index a154d11..7df7272 100644 --- a/src/components/card/episodeCard.jsx +++ b/src/components/card/episodeCard.jsx @@ -18,8 +18,6 @@ import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client"; import { MdiTelevisionClassic } from "../icons/mdiTelevisionClassic"; import { getRuntimeCompact } from "../../utils/date/time"; -const availableSpecialRoutes = [BaseItemKind.Series]; - /** * @typedef {Object} Props * @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemDto} item @@ -48,11 +46,7 @@ export const EpisodeCard = ({ }) => { const navigate = useNavigate(); const defaultOnClick = () => { - if (availableSpecialRoutes.includes(item.Type)) { - navigate(`/${item.Type.toLocaleLowerCase()}/${item.Id}`); - } else { - navigate(`/item/${item.Id}`); - } + navigate(`/episode/${item.Id}`); }; return ( setCarouselRef(el)} className="card-scroller" + customTransition="all .6s" + transitionDuration={600} > {children} diff --git a/src/components/layouts/item/hero.jsx b/src/components/layouts/item/hero.jsx index 3d26ec9..157af9f 100644 --- a/src/components/layouts/item/hero.jsx +++ b/src/components/layouts/item/hero.jsx @@ -1,7 +1,7 @@ /** @format */ import PropTypes from "prop-types"; -import React, { useEffect, useState, useRef } from "react"; +import React, { useEffect, useState } from "react"; import TextField from "@mui/material/TextField"; import MenuItem from "@mui/material/MenuItem"; import Chip from "@mui/material/Chip"; @@ -24,7 +24,6 @@ import PlayButton from "../../buttons/playButton"; import "./hero.module.scss"; import { Blurhash } from "react-blurhash"; -import { MediaTypeIconCollection } from "../../utils/iconsCollection"; import TextLink from "../../textLink"; /** @@ -42,6 +41,7 @@ import TextLink from "../../textLink"; * @property {bool} disableMarkAsPlayedButton * @property {string} albumBy * @property {bool} audioPlayButton + * @property {bool} favourParentImg */ /** @@ -63,9 +63,9 @@ const Hero = ({ disableMarkAsPlayedButton, albumBy, audioPlayButton = false, + favourParentImg = true, + isEpisode = false, }) => { - const backgroundRef = useRef(null); - const filterMediaStreamVideo = (source) => { if (source.Type == MediaStreamType.Video) { return true; @@ -105,12 +105,12 @@ const Hero = ({ return (
-
+
{!!item.ImageBlurHashes.Backdrop && ( <> {Object.keys(item.ImageBlurHashes.Backdrop) @@ -124,7 +124,6 @@ const Hero = ({ )[0] ] } - // hash="LEHV6nWB2yk8pyo0adR*.7kCMdnj" width="1080" height="720" resolutionX={64} @@ -150,65 +149,65 @@ const Hero = ({ )}
-
- {}} - /> -
-
- - {!!item.ImageTags.Logo ? ( - { - e.target.style.opacity = 1; +
+ {isEpisode ? ( + <> + - ) : ( - item.Name - )} - + > + {!!item.ParentLogoImageTag ? ( + { + e.target.style.opacity = 1; + }} + /> + ) : ( + item.SeriesName + )} + + + {`S${item.ParentIndexNumber}:E${item.IndexNumber} ${item.Name}`} + + + ) : ( + + {!!item.ImageTags.Logo ? ( + { + e.target.style.opacity = 1; + }} + /> + ) : ( + item.Name + )} + + )} {!!albumBy && ( - By {albumBy} + By {albumBy.Name} )}
@@ -556,10 +555,12 @@ const Hero = ({ {writers.map((writer, index) => ( <> + > + {writer.Name} + {index != writers.length - 1 && ( ( <> + > + {director.Name} + {index != directors.length - 1 && ( ( <> + > + {artist.Name} + {index != artists.length - 1 && (
+
+ {}} + /> +
); }; diff --git a/src/components/layouts/item/hero.module.scss b/src/components/layouts/item/hero.module.scss index 284049b..0d26270 100644 --- a/src/components/layouts/item/hero.module.scss +++ b/src/components/layouts/item/hero.module.scss @@ -1,9 +1,18 @@ /** @format */ $maskPercentage: 40%; .hero { - position: relative; + display: flex; + width: 100%; + gap: 2em; + justify-content: space-between; + padding-right: 1em; + .item-detail-primaryImage { + width: 26%; + flex-shrink: 0; + } &-backdrop { - position: absolute; + position: fixed; + background-attachment: fixed; width: 100%; height: 100vh; top: 0; @@ -55,8 +64,8 @@ $maskPercentage: 40%; } &-name-logo { - width: 8.3em; - height: 2.3em; + width: 10.4em; + height: 2.6em; object-fit: contain; object-position: left; opacity: 0; diff --git a/src/components/menu/sidemenu.jsx b/src/components/menu/sidemenu.jsx index e0528c3..7fb0bdd 100644 --- a/src/components/menu/sidemenu.jsx +++ b/src/components/menu/sidemenu.jsx @@ -122,7 +122,7 @@ export const SideMenu = ({}) => { sx: { backgroundColor: "inherit", border: "none", - width: `calc(${theme.spacing(7)} + 10px)`, + width: `4em`, height: "100vh", zIndex: "1", }, diff --git a/src/components/textLink/index.jsx b/src/components/textLink/index.jsx index 388505c..49c563e 100644 --- a/src/components/textLink/index.jsx +++ b/src/components/textLink/index.jsx @@ -5,7 +5,7 @@ import { useNavigate } from "react-router-dom"; import "./textLink.module.scss"; -const TextLink = ({ text, location, variant, otherProps }) => { +const TextLink = ({ children, location, variant, otherProps }) => { const navigate = useNavigate(); return ( @@ -15,7 +15,7 @@ const TextLink = ({ text, location, variant, otherProps }) => { onClick={() => navigate(location)} {...otherProps} > - {text} + {children} ); }; diff --git a/src/components/textLink/textLink.module.scss b/src/components/textLink/textLink.module.scss index 6ed7fac..485f128 100644 --- a/src/components/textLink/textLink.module.scss +++ b/src/components/textLink/textLink.module.scss @@ -4,6 +4,7 @@ text-decoration: underline; text-decoration-color: rgb(255 255 255 / 0.5); white-space: pre-line; + width: fit-content; &:hover { cursor: pointer; text-decoration-color: rgb(255 255 255 / 1); diff --git a/src/routes/artist/index.jsx b/src/routes/artist/index.jsx index 199a012..bc3f188 100644 --- a/src/routes/artist/index.jsx +++ b/src/routes/artist/index.jsx @@ -261,6 +261,7 @@ const ArtistTitlePage = () => { queryKey={["item", id]} disableMarkAsPlayedButton audioPlayButton + disableInfoStrip />
diff --git a/src/routes/episode/episode.module.scss b/src/routes/episode/episode.module.scss new file mode 100644 index 0000000..9886df6 --- /dev/null +++ b/src/routes/episode/episode.module.scss @@ -0,0 +1,5 @@ +/** @format */ + +.episode .item-detail-primaryImage { + align-self: center; +} diff --git a/src/routes/episode/index.jsx b/src/routes/episode/index.jsx new file mode 100644 index 0000000..7304e39 --- /dev/null +++ b/src/routes/episode/index.jsx @@ -0,0 +1,328 @@ +/** @format */ +import { useState, useEffect, useRef } from "react"; +import PropTypes from "prop-types"; + +import Box from "@mui/material/Box"; +import CircularProgress from "@mui/material/CircularProgress"; +import Typography from "@mui/material/Typography"; +import Stack from "@mui/material/Stack"; +import Chip from "@mui/material/Chip"; +import Divider from "@mui/material/Divider"; +import LinearProgress from "@mui/material/LinearProgress"; +import Tabs from "@mui/material/Tabs"; +import Tab from "@mui/material/Tab"; +import Grid2 from "@mui/material/Unstable_Grid2"; +import Button from "@mui/material/Button"; +import IconButton from "@mui/material/IconButton"; +import Paper from "@mui/material/Paper"; +import TableContainer from "@mui/material/TableContainer"; +import Table from "@mui/material/Table"; +import TableHead from "@mui/material/TableHead"; +import TableRow from "@mui/material/TableRow"; +import TableBody from "@mui/material/TableBody"; +import TableCell from "@mui/material/TableCell"; +import TextField from "@mui/material/TextField"; +import MenuItem from "@mui/material/MenuItem"; +import Link from "@mui/material/Link"; +import { green, pink, yellow } from "@mui/material/colors"; + +import { AnimatePresence, motion } from "framer-motion"; + +import { Blurhash } from "react-blurhash"; +import { useParams, useNavigate, Link as RouterLink } from "react-router-dom"; + +import { + BaseItemKind, + ItemFields, + LocationType, + MediaStreamType, + SortOrder, +} from "@jellyfin/sdk/lib/generated-client"; +import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api"; +import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api"; +import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api"; +import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api"; +import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api"; +import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api"; + +import { useQuery } from "@tanstack/react-query"; + +import { MdiPlayOutline } from "../../components/icons/mdiPlayOutline"; +import { MdiStar } from "../../components/icons/mdiStar"; +import { MdiCheck } from "../../components/icons/mdiCheck"; +import { MdiHeartOutline } from "../../components/icons/mdiHeartOutline"; +import { MdiHeart } from "../../components/icons/mdiHeart"; +import { MdiClockOutline } from "../../components/icons/mdiClockOutline"; + +import { getRuntimeMusic, getRuntimeFull, endsAt } from "../../utils/date/time"; +import { TypeIconCollectionCard } from "../../components/utils/iconsCollection"; + +import Hero from "../../components/layouts/item/hero"; +import { Card } from "../../components/card/card"; +import { EpisodeCard } from "../../components/card/episodeCard"; +import { CardScroller } from "../../components/cardScroller/cardScroller"; + +import "./episode.module.scss"; +import { EpisodeCardsSkeleton } from "../../components/skeleton/episodeCards"; +import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice"; +import { ArtistAlbum } from "../../components/layouts/artist/artistAlbum"; +import { MdiMusic } from "../../components/icons/mdiMusic"; +import { usePlaybackStore } from "../../utils/store/playback"; +import { Tooltip } from "@mui/material"; +import { useBackdropStore } from "../../utils/store/backdrop"; +import { ActorCard } from "../../components/card/actorCards"; +function TabPanel(props) { + const { children, value, index, ...other } = props; + + return ( + + ); +} + +TabPanel.propTypes = { + children: PropTypes.node, + index: PropTypes.number.isRequired, + value: PropTypes.number.isRequired, +}; + +function a11yProps(index) { + return { + id: `full-width-tab-${index}`, + "aria-controls": `full-width-tabpanel-${index}`, + }; +} + +const EpisodeTitlePage = () => { + const { id } = useParams(); + + const user = useQuery({ + queryKey: ["user"], + queryFn: async () => { + let usr = await getUserApi(window.api).getCurrentUser(); + return usr.data; + }, + networkMode: "always", + }); + + const item = useQuery({ + queryKey: ["item", id], + queryFn: async () => { + const result = await getUserLibraryApi(window.api).getItem({ + userId: user.data.Id, + itemId: id, + fields: [ItemFields.Crew], + }); + return result.data; + }, + enabled: !!user.data, + networkMode: "always", + refetchOnWindowFocus: true, + }); + + const [videoTracks, setVideoTracks] = useState([]); + const [audioTracks, setAudioTracks] = useState([]); + const [subtitleTracks, setSubtitleTracks] = useState([]); + + const filterMediaStreamVideo = (source) => { + if (source.Type == MediaStreamType.Video) { + return true; + } + return false; + }; + const filterMediaStreamAudio = (source) => { + if (source.Type == MediaStreamType.Audio) { + return true; + } + return false; + }; + const filterMediaStreamSubtitle = (source) => { + if (source.Type == MediaStreamType.Subtitle) { + return true; + } + return false; + }; + + useEffect(() => { + if (item.isSuccess && !!item.data.MediaStreams) { + let videos = item.data.MediaStreams.filter( + filterMediaStreamVideo, + ); + let audios = item.data.MediaStreams.filter( + filterMediaStreamAudio, + ); + let subs = item.data.MediaStreams.filter( + filterMediaStreamSubtitle, + ); + + setVideoTracks(videos); + setAudioTracks(audios); + setSubtitleTracks(subs); + } + }, [item.isSuccess]); + + const upcomingEpisodes = useQuery({ + queryKey: ["item", id, "episode", "upcomingEpisodes"], + queryFn: async () => { + const result = await getItemsApi(window.api).getItems({ + userId: user.data.Id, + parentId: item.data.ParentId, + startIndex: item.data.IndexNumber, + }); + return result.data; + }, + enabled: item.isSuccess && item.data.Type == BaseItemKind.Episode, + networkMode: "always", + }); + + const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]); + + const [directors, setDirectors] = useState([]); + const [writers, setWriters] = useState([]); + useEffect(() => { + if (item.isSuccess) { + setAppBackdrop( + item.data.Type === BaseItemKind.MusicAlbum || + item.data.Type === BaseItemKind.Episode + ? `${window.api.basePath}/Items/${item.data.ParentBackdropItemId}/Images/Backdrop` + : `${window.api.basePath}/Items/${item.data.Id}/Images/Backdrop`, + item.data.Id, + ); + let direTp = item.data.People.filter( + (itm) => itm.Type == "Director", + ); + setDirectors(direTp); + let writeTp = item.data.People.filter( + (itm) => itm.Type == "Writer", + ); + setWriters(writeTp); + } + }, [item.isSuccess]); + + if (item.isLoading) { + return ( + + + + ); + } + if (item.isSuccess) { + return ( +
+ + {item.data.People.length > 0 && ( + + {item.data.People.map((person, index) => { + return ( + + ); + })} + + )} + {upcomingEpisodes.isSuccess && + upcomingEpisodes.data.Items.length > 0 && ( + + {upcomingEpisodes.data.Items.map( + (episode, index) => { + return ( + + ); + }, + )} + + )} +
+ ); + } + if (item.isError) { + return ; + } +}; + +export default EpisodeTitlePage; diff --git a/src/routes/item/item.module.scss b/src/routes/item/item.module.scss index 8eec1f1..1a1f0eb 100644 --- a/src/routes/item/item.module.scss +++ b/src/routes/item/item.module.scss @@ -1,13 +1 @@ /** @format */ - -.item-detail { - &-hero { - display: flex; - width: 100%; - gap: 2em; - } - &-primaryImage { - width: 26%; - flex-shrink: 0; - } -} diff --git a/src/routes/player/videoPlayer.module.scss b/src/routes/player/videoPlayer.module.scss index 6dbd4b7..c1e73ef 100644 --- a/src/routes/player/videoPlayer.module.scss +++ b/src/routes/player/videoPlayer.module.scss @@ -4,6 +4,7 @@ &-osd { opacity: 0; transition: opacity 0.1s linear; + width: 100vw; } &-osd-visible &-osd { opacity: 1; @@ -12,8 +13,11 @@ position: fixed; left: 0; top: 0; - width: 100%; - height: 100%; + width: 100vw; + height: 100vh; + right: 0; + bottom: 0; + overflow: hidden; } } diff --git a/src/routes/series/index.jsx b/src/routes/series/index.jsx index bf44fe4..0308d86 100644 --- a/src/routes/series/index.jsx +++ b/src/routes/series/index.jsx @@ -102,33 +102,11 @@ const SeriesTitlePage = () => { const similarItems = useQuery({ queryKey: ["item", id, "similarItem"], queryFn: async () => { - let result; - if (item.data.Type == "Movie") { - result = await getLibraryApi(window.api).getSimilarMovies({ - userId: user.data.Id, - itemId: item.data.Id, - }); - } else if (item.data.Type == "Series") { - result = await getLibraryApi(window.api).getSimilarShows({ - userId: user.data.Id, - itemId: item.data.Id, - }); - } else if (item.data.Type == "MusicAlbum") { - result = await getLibraryApi(window.api).getSimilarAlbums({ - userId: user.data.Id, - itemId: item.data.Id, - }); - } else if (item.data.Type == "MusicArtist") { - result = await getLibraryApi(window.api).getSimilarArtists({ - userId: user.data.Id, - itemId: item.data.Id, - }); - } else { - result = await getLibraryApi(window.api).getSimilarItems({ - userId: user.data.Id, - itemId: item.data.Id, - }); - } + const result = await getLibraryApi(window.api).getSimilarShows({ + userId: user.data.Id, + itemId: item.data.Id, + limit: 16, + }); return result.data; }, enabled: item.isSuccess, diff --git a/src/routes/series/series.module.scss b/src/routes/series/series.module.scss index a65e2d3..aeb714a 100644 --- a/src/routes/series/series.module.scss +++ b/src/routes/series/series.module.scss @@ -1,15 +1,6 @@ /** @format */ .item-detail { - &-hero { - display: flex; - width: 100%; - gap: 2em; - } - &-primaryImage { - width: 26%; - flex-shrink: 0; - } &-episodes-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); diff --git a/src/styles/global.scss b/src/styles/global.scss index b6cf6ec..811fc71 100644 --- a/src/styles/global.scss +++ b/src/styles/global.scss @@ -60,13 +60,16 @@ body { } } -#root, +#root { + width: 100%; +} + .root-page { height: fit-content; - width: 100%; + width: calc(100% - 5em); + position: relative; - overflow-y: hidden; - overflow-x: hidden; + overflow: visible; min-height: 100vh; } @@ -116,10 +119,9 @@ h1 { } .scrollY { - overflow-x: hidden; - overflow-y: visible; + overflow: visible; height: fit-content; - width: inherit; + width: 100%; box-sizing: border-box; min-height: 100vh; padding-left: 1em; @@ -134,3 +136,16 @@ h1 { .empty { display: none; } + +.react-multi-carousel { + &-list { + overflow: visible !important; + } + &-item { + opacity: 0.4; + transition: opacity 550ms; + &--active { + opacity: 1; + } + } +}