refactor: move to tanstack router
This commit is contained in:
1 parent
a4ea932153
commit
522621ed69
136 files changed
+7063
-6127
No files matched your search
@@ -5,24 +5,22 @@ import Paper from "@mui/material/Paper";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { getRuntimeMusic } from "../../../utils/date/time";
|
||||
|
||||
import { SortOrder } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { useApi } from "../../../utils/store/api";
|
||||
import { useAudioPlayback } from "../../../utils/store/audioPlayback";
|
||||
import LikeButton from "../../buttons/likeButton";
|
||||
import PlayButton from "../../buttons/playButton";
|
||||
|
||||
import TrackList from "../tracksList/index";
|
||||
import "./albumArtist.scss";
|
||||
import { Link, useRouteContext } from "@tanstack/react-router";
|
||||
|
||||
export const ArtistAlbum = ({ user, album, boxProps }) => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const api = useRouteContext({ from: "/" }).api;
|
||||
const albumTracks = useQuery({
|
||||
queryKey: ["artist", "album", album.Id],
|
||||
queryFn: async () => {
|
||||
@@ -117,7 +115,7 @@ export const ArtistAlbum = ({ user, album, boxProps }) => {
|
||||
</Typography>
|
||||
<MuiLink
|
||||
component={Link}
|
||||
to={`/musicalbum/${album.Id}`}
|
||||
to="/album/$Id"
|
||||
variant="h2"
|
||||
color="inherit"
|
||||
underline="hover"
|
||||
|
||||
@@ -7,13 +7,13 @@ import { CardsSkeleton } from "../../skeleton/cards";
|
||||
import { BaseItemKind } 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 { useApi } from "../../../utils/store/api";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
|
||||
/**
|
||||
* @description Latest Media Section
|
||||
*/
|
||||
export const LatestMediaSection = ({ latestMediaLib }) => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const api = useRouteContext({ from: "/" }).api;
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
|
||||
@@ -1,824 +0,0 @@
|
||||
import Chip from "@mui/material/Chip";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import React, { useEffect, useState } from "react";
|
||||
|
||||
// import { BaseItemDto } from "";
|
||||
// import { BaseItemPerson } from "@jellyfin/sdk/lib/generated-client/models/base-item-person";
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client/models/base-item-kind";
|
||||
import { MediaStreamType } from "@jellyfin/sdk/lib/generated-client/models/media-stream-type";
|
||||
|
||||
import { red, yellow } from "@mui/material/colors";
|
||||
import { endsAt, getRuntime, getRuntimeFull } from "../../../utils/date/time";
|
||||
import LikeButton from "../../buttons/likeButton";
|
||||
import MarkPlayedButton from "../../buttons/markPlayedButton";
|
||||
import PlayButton from "../../buttons/playButton";
|
||||
import { Card } from "../../card/card";
|
||||
|
||||
import { Blurhash } from "react-blurhash";
|
||||
import TextLink from "../../textLink";
|
||||
import "./hero.scss";
|
||||
|
||||
import { ErrorBoundary } from "react-error-boundary";
|
||||
import { useApi } from "../../../utils/store/api";
|
||||
/**
|
||||
* @typedef {Object} Props
|
||||
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemDto} item
|
||||
* @property {Array} queryKey
|
||||
* @property {string} userId
|
||||
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemPerson[]} writers
|
||||
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemPerson[]} directors
|
||||
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemPerson[]} artists
|
||||
* @property {import("@jellyfin/sdk/lib/generated-client/models").NameGuidPair[]} studios
|
||||
* @property {bool} disableInfoStrip
|
||||
* @property {bool} disablePlayButton
|
||||
* @property {bool} disableLikeButton
|
||||
* @property {bool} disableMarkAsPlayedButton
|
||||
* @property {string} albumBy
|
||||
* @property {bool} audioPlayButton
|
||||
* @property {bool} favourParentImg
|
||||
* @property {"portrait"| "thumb"| 'square'} cardType
|
||||
* @property {bool} enableVideoInfoStrip
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description Hero section for item pages
|
||||
* @param {Props}
|
||||
* @returns {React.Component}
|
||||
*/
|
||||
const Hero = ({
|
||||
item,
|
||||
queryKey,
|
||||
userId,
|
||||
writers = [],
|
||||
directors = [],
|
||||
artists = [],
|
||||
studios = [],
|
||||
disableInfoStrip,
|
||||
disablePlayButton,
|
||||
disableLikeButton,
|
||||
disableMarkAsPlayedButton,
|
||||
albumBy,
|
||||
audioPlayButton = false,
|
||||
favourParentImg = true,
|
||||
isEpisode = false,
|
||||
cardType = "portrait",
|
||||
enableVideoInfoStrip = false,
|
||||
}) => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
const videoTracks = item.MediaStreams?.filter(filterMediaStreamVideo);
|
||||
const audioTracks = item.MediaStreams?.filter(filterMediaStreamAudio);
|
||||
const subtitleTracks = item.MediaStreams?.filter(filterMediaStreamSubtitle);
|
||||
|
||||
const [currentVideoIndex, setCurrentVideoIndex] = useState(0);
|
||||
const [currentAudioIndex, setCurrentAudioIndex] = useState(0);
|
||||
const [currentSubtitleIndex, setCurrentSubtitleIndex] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
if (!!videoTracks && !!audioTracks & !!subtitleTracks) {
|
||||
setCurrentVideoIndex(videoTracks[0]?.Index);
|
||||
setCurrentAudioIndex(audioTracks[0]?.Index);
|
||||
setCurrentSubtitleIndex(subtitleTracks[0]?.Index);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const qualityLabel = () => {
|
||||
if (
|
||||
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("2160p") ||
|
||||
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("4k")
|
||||
) {
|
||||
return "4K";
|
||||
}
|
||||
if (
|
||||
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("1080p") ||
|
||||
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("hd")
|
||||
) {
|
||||
return "HD";
|
||||
}
|
||||
return "SD";
|
||||
};
|
||||
|
||||
const atmosLabel = () => {
|
||||
if (
|
||||
audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("atmos") &&
|
||||
audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("truehd")
|
||||
) {
|
||||
return "TrueHD | Atmos";
|
||||
}
|
||||
if (audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("atmos")) {
|
||||
return "Atmos";
|
||||
}
|
||||
if (audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("truehd")) {
|
||||
return "TrueHD";
|
||||
}
|
||||
return "";
|
||||
};
|
||||
|
||||
const surroundSoundLabel = () => {
|
||||
if (audioTracks[0]?.DisplayTitle.includes("7.1")) {
|
||||
return "7.1";
|
||||
}
|
||||
if (audioTracks[0].DisplayTitle.includes("5.1")) {
|
||||
return "5.1";
|
||||
}
|
||||
return "2.0";
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className="item-detail-hero hero"
|
||||
style={{
|
||||
marginBottom: "2em",
|
||||
}}
|
||||
>
|
||||
<div className="hero-backdrop">
|
||||
{!!item.ImageBlurHashes.Backdrop && (
|
||||
<>
|
||||
{Object.keys(item.ImageBlurHashes.Backdrop).length !== 0 && (
|
||||
<Blurhash
|
||||
hash={
|
||||
item.ImageBlurHashes.Backdrop[
|
||||
Object.keys(item.ImageBlurHashes.Backdrop)[0]
|
||||
]
|
||||
}
|
||||
width="1080"
|
||||
height="720"
|
||||
resolutionX={64}
|
||||
resolutionY={96}
|
||||
className="hero-backdrop-blurhash"
|
||||
punch={1}
|
||||
/>
|
||||
)}
|
||||
<img
|
||||
className="hero-backdrop-image"
|
||||
src={
|
||||
item.ParentBackdropItemId
|
||||
? `${api.basePath}/Items/${item.ParentBackdropItemId}/Images/Backdrop`
|
||||
: `${api.basePath}/Items/${item.Id}/Images/Backdrop`
|
||||
}
|
||||
style={{
|
||||
opacity: 0,
|
||||
}}
|
||||
onLoad={(e) => {
|
||||
e.target.style.opacity = 1;
|
||||
}}
|
||||
loading="eager"
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
<div className="hero-backdrop-icon-container" />
|
||||
</div>
|
||||
<div
|
||||
className="item-detail-hero-info-container"
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
<div>
|
||||
<div className="item-name">
|
||||
{isEpisode ? (
|
||||
<>
|
||||
<TextLink
|
||||
variant="h2"
|
||||
location={`/series/${item.SeriesId}`}
|
||||
otherProps={{
|
||||
fontWeight: 300,
|
||||
}}
|
||||
>
|
||||
{item.ParentLogoImageTag ? (
|
||||
<img
|
||||
src={`${api.basePath}/Items/${item.SeriesId}/Images/Logo`}
|
||||
className="hero-name-logo"
|
||||
onLoad={(e) => {
|
||||
e.target.style.opacity = 1;
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
item.SeriesName
|
||||
)}
|
||||
</TextLink>
|
||||
<Typography variant="h3" fontWeight={300}>
|
||||
{`S${item.ParentIndexNumber}:E${item.IndexNumber} ${item.Name}`}
|
||||
</Typography>
|
||||
</>
|
||||
) : (
|
||||
<Typography variant="h2" fontWeight={300}>
|
||||
{item.ImageTags.Logo ? (
|
||||
<img
|
||||
src={
|
||||
item.SeriesId
|
||||
? `${api.basePath}/Items/${item.SeriesId}/Images/Logo`
|
||||
: `${api.basePath}/Items/${item.Id}/Images/Logo`
|
||||
}
|
||||
className="hero-name-logo"
|
||||
onLoad={(e) => {
|
||||
e.target.style.opacity = 1;
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
item.Name
|
||||
)}
|
||||
</Typography>
|
||||
)}
|
||||
{!!albumBy && (
|
||||
<TextLink
|
||||
variant="h6"
|
||||
location={`/artist/${albumBy.Id}`}
|
||||
otherProps={{
|
||||
fontWeight: 400,
|
||||
style: {
|
||||
opacity: 0.8,
|
||||
},
|
||||
}}
|
||||
>
|
||||
By {albumBy.Name}
|
||||
</TextLink>
|
||||
)}
|
||||
</div>
|
||||
{enableVideoInfoStrip && (
|
||||
<Stack direction="row" gap={1} mb={2} mt={2}>
|
||||
{!!qualityLabel() && (
|
||||
<Chip
|
||||
variant="filled"
|
||||
label={
|
||||
<Typography
|
||||
variant="caption"
|
||||
fontWeight={600}
|
||||
// fontFamily="JetBrains Mono Variable"
|
||||
>
|
||||
{qualityLabel()}
|
||||
</Typography>
|
||||
}
|
||||
sx={{
|
||||
borderRadius: "8px !important",
|
||||
"& .MuiChip-label": {
|
||||
fontSize: "2.2em",
|
||||
},
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{!!surroundSoundLabel() && (
|
||||
<Chip
|
||||
variant="filled"
|
||||
label={
|
||||
<Typography
|
||||
variant="caption"
|
||||
fontWeight={600}
|
||||
fontFamily="JetBrains Mono Variable"
|
||||
>
|
||||
{surroundSoundLabel()}
|
||||
</Typography>
|
||||
}
|
||||
sx={{
|
||||
borderRadius: "8px !important",
|
||||
"& .MuiChip-label": {
|
||||
fontSize: "2.2em",
|
||||
},
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{!!videoTracks[0]?.VideoRangeType && (
|
||||
<Chip
|
||||
variant="filled"
|
||||
label={
|
||||
<Typography
|
||||
variant="caption"
|
||||
fontWeight={600}
|
||||
fontFamily="JetBrains Mono Variable"
|
||||
>
|
||||
{videoTracks[0].VideoRangeType}
|
||||
</Typography>
|
||||
}
|
||||
sx={{
|
||||
borderRadius: "8px !important",
|
||||
"& .MuiChip-label": {
|
||||
fontSize: "2.2em",
|
||||
},
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{!!atmosLabel() && (
|
||||
<Chip
|
||||
variant="filled"
|
||||
label={
|
||||
<Typography
|
||||
variant="caption"
|
||||
fontWeight={600}
|
||||
fontFamily="JetBrains Mono Variable"
|
||||
>
|
||||
{atmosLabel()}
|
||||
</Typography>
|
||||
}
|
||||
sx={{
|
||||
borderRadius: "8px !important",
|
||||
"& .MuiChip-label": {
|
||||
fontSize: "2.2em",
|
||||
},
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{!!subtitleTracks.length > 0 && (
|
||||
<Chip
|
||||
variant="filled"
|
||||
label={
|
||||
<Typography
|
||||
variant="caption"
|
||||
fontWeight={600}
|
||||
fontFamily="JetBrains Mono Variable"
|
||||
>
|
||||
CC
|
||||
</Typography>
|
||||
}
|
||||
sx={{
|
||||
borderRadius: "8px !important",
|
||||
"& .MuiChip-label": {
|
||||
fontSize: "2.2em",
|
||||
},
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Stack>
|
||||
)}
|
||||
{!disableInfoStrip && (
|
||||
<Stack
|
||||
direction="row"
|
||||
gap={2}
|
||||
className="hero-carousel-info"
|
||||
mt={1}
|
||||
justifyItems="flex-start"
|
||||
alignItems="center"
|
||||
>
|
||||
<Typography style={{ opacity: "0.8" }} variant="subtitle1">
|
||||
{item.ProductionYear ? item.ProductionYear : "Unknown"}
|
||||
</Typography>
|
||||
<Chip
|
||||
variant="filled"
|
||||
label={item.OfficialRating ?? "Not Rated"}
|
||||
/>
|
||||
<ErrorBoundary fallback>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
gap: "0.25em",
|
||||
alignItems: "center",
|
||||
}}
|
||||
className="hero-carousel-info-rating"
|
||||
>
|
||||
<div
|
||||
className="material-symbols-rounded "
|
||||
style={{
|
||||
// fontSize: "2.2em",
|
||||
color: yellow[400],
|
||||
fontVariationSettings:
|
||||
'"FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40',
|
||||
}}
|
||||
>
|
||||
star
|
||||
</div>
|
||||
<Typography
|
||||
style={{
|
||||
opacity: "0.8",
|
||||
}}
|
||||
variant="subtitle1"
|
||||
>
|
||||
{Math.round(item.CommunityRating * 10) / 10}
|
||||
</Typography>
|
||||
</div>
|
||||
</ErrorBoundary>
|
||||
{Boolean(item.CriticRating) && (
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
gap: "0.25em",
|
||||
alignItems: "center",
|
||||
}}
|
||||
className="hero-carousel-info-rating"
|
||||
>
|
||||
<div
|
||||
className="material-symbols-rounded "
|
||||
style={{
|
||||
color: red[400],
|
||||
fontVariationSettings:
|
||||
'"FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40',
|
||||
}}
|
||||
>
|
||||
thumb_up
|
||||
</div>
|
||||
<Typography
|
||||
style={{
|
||||
opacity: "0.8",
|
||||
}}
|
||||
variant="subtitle1"
|
||||
>
|
||||
{item.CriticRating}
|
||||
</Typography>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!!item.RunTimeTicks && (
|
||||
<Typography style={{ opacity: "0.8" }} variant="subtitle1">
|
||||
{getRuntime(item.RunTimeTicks)}
|
||||
</Typography>
|
||||
)}
|
||||
{!!item.RunTimeTicks && (
|
||||
<Typography style={{ opacity: "0.8" }} variant="subtitle1">
|
||||
{endsAt(item.RunTimeTicks)}
|
||||
</Typography>
|
||||
)}
|
||||
</Stack>
|
||||
)}
|
||||
<Typography style={{ opacity: "0.8" }} variant="subtitle1" mt={1}>
|
||||
{item.Genres.join(", ")}
|
||||
</Typography>
|
||||
</div>
|
||||
{item.UserData?.PlaybackPositionTicks > 0 && (
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: "0.5em",
|
||||
margin: " 1em 0 0 0",
|
||||
}}
|
||||
>
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
value={item.UserData?.PlayedPercentage}
|
||||
style={{
|
||||
width: "50%",
|
||||
borderRadius: "1em",
|
||||
}}
|
||||
color="white"
|
||||
/>
|
||||
<Typography variant="subtitle1" fontWeight={600}>
|
||||
{getRuntimeFull(
|
||||
item.RunTimeTicks - item.UserData.PlaybackPositionTicks,
|
||||
)}{" "}
|
||||
remaining
|
||||
</Typography>
|
||||
</div>
|
||||
)}
|
||||
<div
|
||||
style={{
|
||||
margin: "1em 0",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: "1em",
|
||||
}}
|
||||
className="item-button-container"
|
||||
>
|
||||
{!disablePlayButton && (
|
||||
<PlayButton
|
||||
itemId={item.Id}
|
||||
userId={userId}
|
||||
itemType={item.Type}
|
||||
currentVideoTrack={currentVideoIndex}
|
||||
currentAudioTrack={currentAudioIndex}
|
||||
currentSubTrack={currentSubtitleIndex}
|
||||
buttonProps={{
|
||||
size: "large",
|
||||
}}
|
||||
itemUserData={item.UserData}
|
||||
audio={audioPlayButton}
|
||||
playlistItemId={item.Type === BaseItemKind.Playlist && item.Id}
|
||||
/>
|
||||
)}
|
||||
{!disableLikeButton && (
|
||||
<LikeButton
|
||||
queryKey={["item", item.Id]}
|
||||
itemId={item.Id}
|
||||
itemName={item.Name}
|
||||
isFavorite={item.UserData?.IsFavorite}
|
||||
userId={userId}
|
||||
/>
|
||||
)}
|
||||
{!disableMarkAsPlayedButton && (
|
||||
<MarkPlayedButton
|
||||
queryKey={["item", item.Id]}
|
||||
itemId={item.Id}
|
||||
itemName={item.Name}
|
||||
isPlayed={item.UserData?.Played}
|
||||
userId={userId}
|
||||
/>
|
||||
)}{" "}
|
||||
</div>
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: "0.4em",
|
||||
maxWidth: "60%",
|
||||
}}
|
||||
>
|
||||
{Boolean(videoTracks?.length) && (
|
||||
<div className="hero-grid">
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
style={{
|
||||
opacity: 0.6,
|
||||
}}
|
||||
noWrap
|
||||
>
|
||||
Video
|
||||
</Typography>
|
||||
<TextField
|
||||
size="small"
|
||||
value={currentVideoIndex}
|
||||
select
|
||||
onChange={(e) => setCurrentVideoIndex(e.target.value)}
|
||||
SelectProps={{
|
||||
MenuProps: {
|
||||
disableScrollLock: true,
|
||||
},
|
||||
}}
|
||||
>
|
||||
{videoTracks.map((track) => {
|
||||
return (
|
||||
<MenuItem key={track.Index} value={track.Index}>
|
||||
{track.DisplayTitle}
|
||||
</MenuItem>
|
||||
);
|
||||
})}
|
||||
</TextField>
|
||||
</div>
|
||||
)}
|
||||
{Boolean(audioTracks?.length) && (
|
||||
<div className="hero-grid">
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
style={{
|
||||
opacity: 0.6,
|
||||
}}
|
||||
noWrap
|
||||
>
|
||||
Audio
|
||||
</Typography>
|
||||
<TextField
|
||||
size="small"
|
||||
value={currentAudioIndex}
|
||||
select
|
||||
onChange={(e) => setCurrentAudioIndex(e.target.value)}
|
||||
SelectProps={{
|
||||
MenuProps: {
|
||||
disableScrollLock: true,
|
||||
},
|
||||
}}
|
||||
>
|
||||
{audioTracks.map((track) => {
|
||||
return (
|
||||
<MenuItem key={track.Index} value={track.Index}>
|
||||
{track.DisplayTitle}
|
||||
</MenuItem>
|
||||
);
|
||||
})}
|
||||
</TextField>
|
||||
</div>
|
||||
)}
|
||||
{Boolean(subtitleTracks?.length) && (
|
||||
<div className="hero-grid">
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
style={{
|
||||
opacity: 0.6,
|
||||
}}
|
||||
noWrap
|
||||
>
|
||||
Subtitle
|
||||
</Typography>
|
||||
<TextField
|
||||
size="small"
|
||||
value={currentSubtitleIndex}
|
||||
select
|
||||
onChange={(e) => {
|
||||
console.log(e.target.value);
|
||||
setCurrentSubtitleIndex(e.target.value);
|
||||
}}
|
||||
SelectProps={{
|
||||
MenuProps: {
|
||||
disableScrollLock: true,
|
||||
},
|
||||
}}
|
||||
>
|
||||
{subtitleTracks.map((track) => {
|
||||
return (
|
||||
<MenuItem key={track.Index} value={track.Index}>
|
||||
{track.DisplayTitle}
|
||||
</MenuItem>
|
||||
);
|
||||
})}
|
||||
</TextField>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
marginTop: "0.2em",
|
||||
}}
|
||||
>
|
||||
<Typography fontStyle="italic" variant="h5" mb={1} mt={1}>
|
||||
{item.Taglines[0]}
|
||||
</Typography>
|
||||
<Typography variant="subtitle1">{item.Overview}</Typography>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
marginTop: "2em",
|
||||
alignSelf: "flex-end",
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
{writers.length > 0 && (
|
||||
<div className="hero-grid">
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
style={{
|
||||
opacity: 0.6,
|
||||
}}
|
||||
noWrap
|
||||
>
|
||||
Written by
|
||||
</Typography>
|
||||
<div className="hero-text-container">
|
||||
{writers.map((writer, index) => (
|
||||
<>
|
||||
<TextLink
|
||||
key={writer.Id}
|
||||
variant={"subtitle1"}
|
||||
location={`/person/${writer.Id}`}
|
||||
>
|
||||
{writer.Name}
|
||||
</TextLink>
|
||||
{index !== writers.length - 1 && (
|
||||
<span
|
||||
style={{
|
||||
whiteSpace: "pre",
|
||||
}}
|
||||
>
|
||||
,{" "}
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{directors.length > 0 && (
|
||||
<div
|
||||
style={{
|
||||
marginTop: "0.5em",
|
||||
}}
|
||||
className="hero-grid"
|
||||
>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
style={{
|
||||
opacity: 0.6,
|
||||
}}
|
||||
noWrap
|
||||
>
|
||||
Directed by
|
||||
</Typography>
|
||||
<div className="hero-text-container">
|
||||
{directors.map((director, index) => (
|
||||
<>
|
||||
<TextLink
|
||||
key={director.Id}
|
||||
variant={"subtitle1"}
|
||||
location={`/person/${director.Id}`}
|
||||
>
|
||||
{director.Name}
|
||||
</TextLink>
|
||||
{index !== directors.length - 1 && (
|
||||
<span
|
||||
style={{
|
||||
whiteSpace: "pre",
|
||||
}}
|
||||
>
|
||||
,{" "}
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{artists.length > 0 && (
|
||||
<div
|
||||
className="hero-grid"
|
||||
style={{
|
||||
marginTop: "0.5em",
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
style={{
|
||||
opacity: 0.6,
|
||||
}}
|
||||
noWrap
|
||||
>
|
||||
Artists
|
||||
</Typography>
|
||||
<div className="hero-text-container">
|
||||
{artists.map((artist, index) => (
|
||||
<>
|
||||
<TextLink
|
||||
key={artist.Id}
|
||||
variant={"subtitle1"}
|
||||
location={`/artist/${artist.Id}`}
|
||||
>
|
||||
{artist.Name}
|
||||
</TextLink>
|
||||
{index !== artists.length - 1 && (
|
||||
<span
|
||||
style={{
|
||||
whiteSpace: "pre",
|
||||
}}
|
||||
>
|
||||
,{" "}
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{studios.length > 0 && (
|
||||
<div
|
||||
className="hero-grid"
|
||||
style={{
|
||||
marginTop: "0.5em",
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
style={{
|
||||
opacity: 0.6,
|
||||
}}
|
||||
noWrap
|
||||
>
|
||||
Studios
|
||||
</Typography>
|
||||
<Typography variant="subtitle1">
|
||||
{studios.map((studio) => studio.Name).join(", ")}
|
||||
</Typography>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="item-detail-primaryImage">
|
||||
<Card
|
||||
item={item}
|
||||
seriesId={favourParentImg && item.SeriesId}
|
||||
imageType={"Primary"}
|
||||
cardType={cardType}
|
||||
queryKey={queryKey}
|
||||
userId={userId}
|
||||
imageBlurhash={
|
||||
!!item.ImageBlurHashes?.Primary &&
|
||||
item.ImageBlurHashes?.Primary[
|
||||
Object.keys(item.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
hideText
|
||||
disablePadding
|
||||
disableOverlay
|
||||
onClick={() => {}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Hero;
|
||||
|
||||
Hero.defaultProps = {
|
||||
disableInfoStrip: false,
|
||||
disablePlayButton: false,
|
||||
disableLikeButton: false,
|
||||
disableMarkAsPlayedButton: false,
|
||||
};
|
||||
@@ -1,70 +0,0 @@
|
||||
$maskPercentage: 40%;
|
||||
.hero {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
gap: 2em;
|
||||
justify-content: space-between;
|
||||
padding-right: 1em;
|
||||
.item-detail-primaryImage {
|
||||
width: 26%;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
&-backdrop {
|
||||
position: absolute;
|
||||
background-attachment: scroll;
|
||||
width: calc(100vw + 100px);
|
||||
height: calc(100vh + 100px);
|
||||
top: -50px;
|
||||
left: -50px;
|
||||
z-index: -1;
|
||||
filter: brightness(0.4);
|
||||
mask-image: linear-gradient(to bottom, black 40%, transparent),
|
||||
linear-gradient(to left, black 40%, transparent);
|
||||
-webkit-mask-image: linear-gradient(to bottom, black 40%, transparent),
|
||||
linear-gradient(to left, black 40%, transparent);
|
||||
mask-composite: source-in;
|
||||
-webkit-mask-composite: source-in;
|
||||
& > * {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
&-image {
|
||||
object-fit: cover;
|
||||
z-index: 1;
|
||||
}
|
||||
&-blurhash {
|
||||
z-index: 0;
|
||||
}
|
||||
&-icon {
|
||||
&-container {
|
||||
background: url(../../../assets/herobg.png);
|
||||
background-size: cover;
|
||||
z-index: -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
&-grid {
|
||||
display: grid;
|
||||
width: 100%;
|
||||
grid-template-columns: 1fr 85%;
|
||||
}
|
||||
|
||||
&-name-logo {
|
||||
width: 10.4em;
|
||||
max-height: 2.6em;
|
||||
object-fit: contain;
|
||||
object-position: left;
|
||||
opacity: 0;
|
||||
transition: opacity $transition-time-fast;
|
||||
filter: drop-shadow(0px 4px 10px rgb(0 0 0 / 0.5));
|
||||
}
|
||||
&-text-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,14 @@ import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
import React from "react";
|
||||
import { useApi } from "../../../../utils/store/api";
|
||||
import { Card } from "../../../card/card";
|
||||
import { CardScroller } from "../../../cardScroller/cardScroller";
|
||||
|
||||
const GenreView = ({ libraryId, genreId, genreName, userId }) => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const api = useRouteContext({ from: "/" }).api;
|
||||
|
||||
const items = useQuery({
|
||||
queryKey: ["library", "genreItem", genreId],
|
||||
queryFn: async () => {
|
||||
|
||||
@@ -5,17 +5,17 @@ import React from "react";
|
||||
import type { BaseItemDto, UserDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
|
||||
import { getRuntimeMusic } from "../../../utils/date/time";
|
||||
import { useApi } from "../../../utils/store/api";
|
||||
import { useAudioPlayback } from "../../../utils/store/audioPlayback";
|
||||
import LikeButton from "../../buttons/likeButton";
|
||||
import "./tracksList.scss";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
|
||||
export default function TracksList({
|
||||
tracks,
|
||||
user,
|
||||
queryKey,
|
||||
}: { tracks: BaseItemDto[]; user: UserDto; queryKey: [] }) {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const api = useRouteContext({ from: "/" }).api;
|
||||
|
||||
const [
|
||||
currentItem,
|
||||
|
||||
Reference in new issue
Block a user