diff --git a/src/App.jsx b/src/App.jsx index d9376a0..bd7a839 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -470,6 +470,31 @@ function App() { path="/item/:id" element={} /> + } + /> + } + /> + } + /> + } + /> + } + /> } diff --git a/src/components/buttons/likeButton.jsx b/src/components/buttons/likeButton.jsx index 7fa5b9f..fc07768 100644 --- a/src/components/buttons/likeButton.jsx +++ b/src/components/buttons/likeButton.jsx @@ -84,12 +84,13 @@ const LikeButton = ({ itemId, isFavorite, queryKey, userId, itemName }) => { queryClient.setQueryData(queryKey, context.previousData); console.error(error); setIsError(true); - setIsLoading(false); }, onSuccess: () => { console.log("Successfully updated", itemId); queryClient.invalidateQueries(queryKey); setIsSuccess(true); + }, + onSettled: () => { setIsLoading(false); }, }); diff --git a/src/components/buttons/markPlayedButton.jsx b/src/components/buttons/markPlayedButton.jsx index d488abf..d582616 100644 --- a/src/components/buttons/markPlayedButton.jsx +++ b/src/components/buttons/markPlayedButton.jsx @@ -82,12 +82,13 @@ const MarkPlayedButton = ({ itemId, isPlayed, queryKey, userId, itemName }) => { queryClient.setQueryData(queryKey, context.previousData); console.error(error); setIsError(true); - setIsLoading(false); }, onSuccess: () => { console.log("Successfully updated", itemId); queryClient.invalidateQueries(queryKey); setIsSuccess(true); + }, + onSettled: () => { setIsLoading(false); }, }); diff --git a/src/components/buttons/playButton.jsx b/src/components/buttons/playButton.jsx index 47a1d41..3c07af1 100644 --- a/src/components/buttons/playButton.jsx +++ b/src/components/buttons/playButton.jsx @@ -2,7 +2,7 @@ import PropTypes from "prop-types"; import Button from "@mui/material/Button"; -import IconButton from "@mui/material/IconButton"; +import Fab from "@mui/material/Fab"; import LinearProgress from "@mui/material/LinearProgress"; import { MdiPlayOutline } from "../icons/mdiPlayOutline"; import { @@ -115,14 +115,16 @@ const PlayButton = ({ }; if (iconOnly) { return ( - - + ); } else { return ( diff --git a/src/components/card/card.jsx b/src/components/card/card.jsx index 6b653d1..14374ff 100644 --- a/src/components/card/card.jsx +++ b/src/components/card/card.jsx @@ -51,11 +51,11 @@ export const Card = ({ cardType, queryKey, userId, - availableImagesTypes, seriesId, - + hideText, onClick, disableOverlay = false, + disablePadding, }) => { const ref = useRef(); const isVisible = useIntersecting(ref); @@ -63,7 +63,7 @@ export const Card = ({ const defaultOnClick = () => navigate(`/item/${item.Id}`); return ( @@ -204,7 +204,7 @@ export const Card = ({ currentVideoTrack={0} className="card-play-button" iconProps={{ - sx: { fontSize: "1.5em" }, + sx: { fontSize: "2.5em" }, }} iconOnly /> @@ -245,7 +245,11 @@ export const Card = ({ /> )} - + { + return ( +
+
+ +
+
+
+ + {item.Name} + +
+
+ + {item.Overview} + +
+
+
+ ); +}; + +export default Hero; diff --git a/src/routes/album/index.jsx b/src/routes/album/index.jsx new file mode 100644 index 0000000..e69de29 diff --git a/src/routes/artist/index.jsx b/src/routes/artist/index.jsx new file mode 100644 index 0000000..e69de29 diff --git a/src/routes/collection/index.jsx b/src/routes/collection/index.jsx new file mode 100644 index 0000000..e69de29 diff --git a/src/routes/home/index.jsx b/src/routes/home/index.jsx index 5cd4e12..af10e17 100644 --- a/src/routes/home/index.jsx +++ b/src/routes/home/index.jsx @@ -17,16 +17,10 @@ import Carousel from "../../components/carousel"; // Custom Components import { Card } from "../../components/card/card"; import { CardScroller } from "../../components/cardScroller/cardScroller"; -import { LatestMediaSection } from "../../components/homeSection/latestMediaSection"; +import { LatestMediaSection } from "../../components/layouts/homeSection/latestMediaSection"; import { CarouselSkeleton } from "../../components/skeleton/carousel"; import { CardsSkeleton } from "../../components/skeleton/cards"; -// Icons -import { MediaTypeIconCollection } from "../../components/utils/iconsCollection.jsx"; -import { MdiStar } from "../../components/icons/mdiStar"; -import { MdiPlayOutline } from "../../components/icons/mdiPlayOutline"; -import { MdiChevronRight } from "../../components/icons/mdiChevronRight"; - import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api"; import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api"; import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api"; @@ -39,6 +33,7 @@ import { useBackdropStore } from "../../utils/store/backdrop"; import CarouselSlide from "../../components/carouselSlide"; import { BaseItemKind, ItemFields } from "@jellyfin/sdk/lib/generated-client"; + const Home = () => { const authUser = useQuery({ queryKey: ["home", "authenticateUser"], diff --git a/src/routes/item/index.jsx b/src/routes/item/index.jsx index 8520158..01e80ca 100644 --- a/src/routes/item/index.jsx +++ b/src/routes/item/index.jsx @@ -57,6 +57,7 @@ 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"; @@ -575,2739 +576,18 @@ const ItemDetail = () => { } if (item.isSuccess && similarItems.isSuccess) { return ( - <> - - - - {item.data.Type != BaseItemKind.MusicAlbum && - item.data.Type != BaseItemKind.Episode - ? item.data.BackdropImageTags.length != - 0 && ( - - setBackdropImageLoaded( - true, - ) - } - /> - ) - : !!item.data.ParentBackdropItemId && ( - - setBackdropImageLoaded( - true, - ) - } - /> - )} - {item.data.BackdropImageTags.length != 0 && ( - - )} - - {TypeIconCollectionCard[item.data.Type]} - - - - - - } - sx={{ - transition: "opacity 150ms", - opacity: item.data.UserData - .Played - ? 1 - : 0, - top: 5, - right: 5, - }} - /> - {!!item.data.ImageTags.Primary && ( - - setPrimaryImageLoaded( - true, - ) - } - /> - )} - {!!item.data.ImageTags.Primary && - Object.keys( - item.data.ImageBlurHashes - .Primary, - ).length != 0 && ( - - )} -
- { - TypeIconCollectionCard[ - item.data.Type - ] - } -
-
- - - {item.data.Type === - BaseItemKind.Episode && ( - - {!!item.data - .ParentLogoItemId ? ( - - ) : ( - item.data.SeriesName - )} - - )} - {item.data.Type === - BaseItemKind.Episode ? ( - - {`S${item.data.ParentIndexNumber}:E${item.data.IndexNumber} - ${item.data.Name}`} - - ) : ( - - {!!item.data.ImageTags - .Logo ? ( - - ) : ( - item.data.Name - )} - - )} - - {item.data.OriginalTitle} - - {!!item.data.AlbumArtists && ( - - , -
- } - > - {item.data.AlbumArtists.map( - ( - artist, - aindex, - ) => { - return ( - - { - artist.Name - } - - ); - }, - )} - - )} -
- - } - sx={{ - alignItems: "center", - width: "100%", - }} - > - {item.data.Type != "MusicArtist" && - item.data.ProductionYear && ( - - { - item.data - .ProductionYear - } - - )} - {item.data.Type != - "MusicArtist" && ( - - )} - {item.data.Type != - "MusicArtist" && ( - - {!!item.data - .CommunityRating ? ( - <> - - - {Math.round( - item - .data - .CommunityRating * - 10, - ) / 10} - - - ) : ( - - No Community - Rating - - )} - - )} - {!!item.data.RunTimeTicks && ( - - {getRuntimeFull( - item.data - .RunTimeTicks, - )} - - )} - {!!item.data.RunTimeTicks && ( - - {endsAt( - item.data - .RunTimeTicks, - )} - - )} - -
- - {item.data.Type != "Person" && - !item.data.Type.includes( - "Music", - ) && ( - <> - - - - - - - - - - - )} - - {item.data.UserData.IsFavorite ? ( - - ) : ( - - )} - - - - - - - {item.data.Taglines[0]} - - - - - - - {item.data.Genres != 0 && ( - - - - Genre - - - - - {item.data.Genres.map( - ( - genre, - index, - ) => { - return ( - - ); - }, - )} - - - - )} - - {item.data.ExternalUrls.length != 0 && ( - - - - Links - - - - - , - - } - > - {item.data.ExternalUrls.map( - ( - item, - index, - ) => { - return ( - - { - item.Name - } - - ); - }, - )} - - - - )} - - {item.data.Type == - BaseItemKind.MusicAlbum && ( - - - - Artists - - - - - , - - } - flexWrap="wrap" - > - {item.data.Artists.map( - ( - mitem, - mindex, - ) => { - return ( - - { - mitem - } - - ); - }, - )} - - - - )} - {item.data.Studios.length != 0 && ( - - - - Studios - - - - - , - - } - width="100%" - > - {item.data.Studios.map( - ( - item, - index, - ) => { - return ( - - { - item.Name - } - - ); - }, - )} - - - - )} - {directors.length != 0 && ( - - - - Director - - - - - , - - } - > - {directors.map( - ( - item, - index, - ) => { - return ( - - { - item.Name - } - - ); - }, - )} - - - - )} - {writers.length != 0 && ( - - - - Writers - - - - - , - - } - > - {writers.map( - ( - item, - index, - ) => { - return ( - - { - item.Name - } - - ); - }, - )} - - - - )} - - {!!item.data.MediaStreams && - item.data.MediaStreams.length != - 0 && ( - <> - {videoTracks.length != - 0 && ( - - - - Video - - - - { - setCurrentVideoTrack( - e - .target - .value, - ); - }} - > - {videoTracks.map( - ( - stream, - sindex, - ) => { - if ( - stream.Type == - BaseItemKind.Video - ) - return ( - - { - stream.DisplayTitle - } - - ); - }, - )} - - - - )} - {audioTracks.length != - 0 && ( - - - - Audio - - - - { - setCurrentAudioTrack( - e - .target - .value, - ); - }} - > - {audioTracks.map( - ( - stream, - sindex, - ) => { - return ( - - { - stream.DisplayTitle - } - - ); - }, - )} - - - - )} - {subtitleTracks.length != - 0 && ( - - - - Subtitle - - - - { - setCurrentSubTrack( - e - .target - .value, - ); - }} - > - - None - - {subtitleTracks.map( - ( - stream, - sindex, - ) => { - return ( - - { - stream.DisplayTitle - } - - ); - }, - )} - - - - )} - - )} - -
-
- {!!item.data.Overview && ( - - - Overview - - - {item.data.Overview} - - - )} - - {item.data.Type == BaseItemKind.MusicAlbum && ( - - - - - - - # - - - - - - Name - - - - - - - - - - - {musicTracks.isSuccess && - musicTracks.data.Items.map( - (mitem, mindex) => { - return ( - - - - { - mitem.IndexNumber - } - - - - - handleLikingTrack( - mitem, - ) - } - > - {mitem - .UserData - .IsFavorite ? ( - - ) : ( - - )} - - - - - { - mitem.Name - } - - - - - {getRuntimeMusic( - mitem.RunTimeTicks, - )} - - - - ); - }, - )} - -
-
- )} - - {item.data.Type == BaseItemKind.Person && - personShows.isSuccess && - personMovies.isSuccess && - personBooks.isSuccess && - personPhotos.isSuccess && - personEpisodes.isSuccess && ( - - - - setActivePersonTab( - newVal, - ) - } - aria-label="person-tabs" - > - {personTabs.map( - (pitem, index) => { - return ( - - ); - }, - )} - - - {personTabs.map((pitem, index) => { - return ( - - {pitem == "Movies" && ( - - {personMovies.data.Items.map( - ( - mitem, - mindex, - ) => { - return ( - - { - navigate( - `/item/${mitem.Id}`, - ); - }} - > - - ); - }, - )} - - )} - {pitem == "TV Shows" && ( - - {personShows.data.Items.map( - ( - mitem, - mindex, - ) => { - return ( - - { - navigate( - `/item/${mitem.Id}`, - ); - }} - > - - ); - }, - )} - - )} - {pitem == "Books" && ( - - {personBooks.data.Items.map( - ( - mitem, - mindex, - ) => { - return ( - - { - navigate( - `/item/${mitem.Id}`, - ); - }} - > - - ); - }, - )} - - )} - {pitem == "Photos" && ( - - {personPhotos.data.Items.map( - ( - mitem, - mindex, - ) => { - return ( - - { - navigate( - `/item/${mitem.Id}`, - ); - }} - > - - ); - }, - )} - - )} - {pitem == "Episodes" && ( - - {personEpisodes.data.Items.map( - ( - mitem, - mindex, - ) => { - return ( - - - - ); - }, - )} - - )} - - ); - })} - - )} - - {nextUpEpisode.isSuccess && - nextUpEpisode.data.TotalRecordCount != 0 && ( - - - Next Up - - - {nextUpEpisode.data.Items.map( - (mitem, mindex) => { - return ( - - - - ); - }, - )} - - - )} - - {seasons.isSuccess && ( - - - - Episodes - - ) : ( - episodes.data - .TotalRecordCount - ) - } - sx={{ ml: 2 }} - /> - - { - setCurrentSeason( - e.target.value, - ); - }} - size="small" - > - {seasons.data.Items.map( - (season, index) => { - return ( - - {season.Name} - - ); - }, - )} - - - - - {episodes.isLoading ? ( - - ) : ( - episodes.data.Items.map( - (mitem, mindex) => { - return ( - - - - ); - }, - ) - )} - - - )} - - {item.data.Type == BaseItemKind.MusicArtist && - artistDiscography.isSuccess && - artistSongs.isSuccess && - artistAppearances.isSuccess && ( - - - setActiveArtistTab(newVal) - } - aria-label="artists-tabs" - sx={{ - borderBottom: 1, - borderColor: "divider", - mb: 2, - }} - > - {artistTabs.map((pitem, index) => { - return ( - - ); - })} - - {artistTabs.map((pitem, index) => { - return ( - - {pitem == - "Discography" && - artistDiscography.data.Items.map( - ( - musicItem, - mindex, - ) => { - return ( - - ); - }, - )} - {pitem == "Songs" && ( - - - - {artistSongs.data.Items.map( - ( - music, - mindex, - ) => { - return ( - - - - {!!music - .ImageTags - .Primary && ( - - )} - - - - - - - - { - music.Name - } - - - , - - } - > - {music.Artists.map( - ( - artist, - aindex, - ) => { - return ( - - { - artist - } - - ); - }, - )} - - - - - {getRuntimeMusic( - music.RunTimeTicks, - )} - - - - { - handleLiking( - music, - ); - }} - > - {music - .UserData - .IsFavorite ? ( - - ) : ( - - )} - - - - ); - }, - )} - -
-
- )} - {pitem == - "Appearances" && ( - - - - {artistAppearances.data.Items.map( - ( - musicItem, - mindex, - ) => { - return ( - - ); - }, - )} - -
-
- )} -
- ); - })} -
- )} - - {item.data.Type === BaseItemKind.Episode && ( - - {upcomingEpisodes.isSuccess && - upcomingEpisodes.data.Items.map( - (episode, index) => { - return ( - - ); - }, - )} - - )} - - {item.data.People.length != 0 && ( - - {item.data.People.map((person, index) => { - return ( - - ); - })} - - )} - - {similarItems.data.Items.length != 0 && ( - - {similarItems.data.Items.map( - (simItem, index) => { - return ( - { - navigate( - `/item/${simItem.Id}`, - ); - }} - /> - ); - }, - )} - - )} - - +
+ +
); } if (item.isError || similarItems.isError) { diff --git a/src/routes/item/item.module.scss b/src/routes/item/item.module.scss index 6d24093..8eec1f1 100644 --- a/src/routes/item/item.module.scss +++ b/src/routes/item/item.module.scss @@ -1,84 +1,13 @@ /** @format */ .item-detail { - &-heading { - opacity: 0.85; - } - &-backdrop { - position: fixed; - top: 0; - left: 0; - width: inherit; - height: 100%; - z-index: -2; - opacity: 0.2; - } - &-header { + &-hero { display: flex; - gap: 1em; - justify-content: flex-start; - align-items: flex-end; - position: relative; - flex-wrap: wrap; - &-backdrop { - position: absolute; - width: 100vw; - height: 80vh; - top: -88px; - width: 100vw; - right: 0; - left: -24px; - z-index: -2; - filter: brightness(0.6); - mask-image: linear-gradient(0deg, transparent, black 75%); - -webkit-mask-image: linear-gradient( - 0deg, - transparent, - black 75% - ); - } - } - &-image { - position: absolute; width: 100%; - height: 100%; - object-fit: cover; - object-position: top; - transition: opacity $transition-time-default; - &-blurhash { - z-index: -1; - } - &-container { - width: 15%; - flex-shrink: 0; - position: relative; - border-radius: $border-radius-default; - overflow: hidden; - box-shadow: 0 0 15px rgb(0 0 0 / 0.4); - &.Episode { - flex-shrink: 0; - flex-grow: 0.25; - } - } - &-icon-container { - background: $clr-gradient-dark; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - display: flex; - align-items: center; - justify-content: center; - z-index: -2; - } + gap: 2em; } - &-title-logo { - filter: drop-shadow(0 0 10px rgb(0 0 0 /0.2)); - height: 100%; - max-height: 5em; - width: 45%; - object-fit: contain; - object-position: bottom; + &-primaryImage { + width: 26%; + flex-shrink: 0; } } diff --git a/src/routes/person/index.jsx b/src/routes/person/index.jsx new file mode 100644 index 0000000..e69de29 diff --git a/src/routes/series/index.jsx b/src/routes/series/index.jsx new file mode 100644 index 0000000..e69de29