refactor: cleanup person route
This commit is contained in:
7 files changed
+91
-100
No files matched your search
+1
-1
@@ -1 +1 @@
|
||||
{"encodings":["src\\main.tsx","ProviderWrapper",[52,0,71,1],[53,39,57,3],[53,8,53,11],[53,13,53,22],[53,24,53,35],[58,34,61,3],[58,8,58,12],[58,14,58,30],[66,2,69,4],"src\\components\\notices\\errorNotice\\errorNotice.tsx","ErrorNotice",[6,27,54,1],[6,28,6,56],[9,2,52,8],[20,3,31,9],[32,3,34,16],[35,3,51,16],"src\\utils\\store\\api.tsx","ApiProvider",[50,27,67,1],[50,28,50,65],[51,17,65,2],[66,8,66,75],"useApiInContext",[69,7,75,1],[70,15,70,37],[74,8,74,57],"src\\utils\\store\\central.tsx","CentralProvider",[48,31,71,1],[48,32,48,69],[49,17,67,2],[69,2,69,77],"useCentralStore",[73,7,79,1],[74,15,74,41],[78,8,78,57],"src\\routes\\_api\\player\\index.tsx","VideoPlayer",[88,0,918,1],[89,13,89,42],[90,21,90,32],[90,9,90,16],[91,39,91,54],[92,16,92,48],[94,14,94,51],[106,5,116,3],[97,2,97,16],[98,2,98,6],[99,2,99,10],[100,2,100,14],[101,2,101,15],[102,2,102,14],[103,2,103,13],[104,2,104,15],[105,2,105,11],[117,40,120,3],[117,8,117,29],[117,31,117,36],[122,31,122,45],[123,41,125,2],[127,51,127,66],[130,31,130,46],[131,31,131,45],[132,35,132,50],[133,45,133,68],[134,33,134,56],[135,43,135,58],[137,29,137,40],[138,27,138,42],[140,1,140,41],[142,41,142,72],[219,24,257,7],[259,1,267,21],[267,5,267,19],[269,1,287,7],[289,1,292,15],[292,5,292,13],[294,41,311,62],[311,5,311,31],[311,33,311,60],[313,1,334,3],[331,2,331,28],[332,2,332,29],[333,2,333,37],[336,29,344,15],[344,5,344,13],[346,24,364,25],[364,5,364,13],[364,15,364,23],[366,25,370,15],[370,5,370,13],[372,49,372,64],[373,27,375,7],[376,1,376,56],[376,46,376,54],[378,22,384,21],[384,5,384,19],[464,5,481,11],[465,6,474,8],[475,6,477,19],[478,6,480,19],[485,4,499,10],[486,5,495,7],[496,5,498,18],[504,4,511,10],[505,5,507,18],[508,5,510,18],[515,3,519,9],[516,4,518,17],[523,51,523,66],[524,1,530,13],[530,5,530,11],[542,2,916,8],[543,3,566,21],[545,5,564,18],[563,6,563,52],[568,4,582,13],[585,4,585,55],[587,3,605,21],[589,5,603,18],[595,6,597,12],[598,6,602,8],[606,3,883,16],[642,4,696,10],[643,5,645,18],[644,6,644,66],[646,5,648,18],[647,6,647,64],[649,5,695,12],[670,6,694,18],[686,7,688,18],[690,8,692,19],[698,5,881,11],[699,6,706,19],[702,8,704,21],[707,6,880,12],[708,7,763,13],[709,8,756,10],[757,8,762,14],[758,9,760,22],[761,9,761,62],[764,7,879,13],[765,8,800,14],[766,9,766,31],[767,9,777,22],[774,10,776,17],[778,9,782,22],[779,10,781,17],[783,9,793,22],[790,10,792,17],[794,9,794,27],[795,9,799,22],[801,8,878,14],[802,9,840,22],[824,10,826,23],[827,10,839,12],[841,9,854,22],[847,10,853,17],[855,9,855,24],[856,9,865,22],[860,10,864,17],[866,9,877,22],[874,10,876,17],[884,3,915,5],"sliderDisplayFormat",[386,29,521,2],"src\\routes\\_api\\home\\index.tsx","Home",[40,0,400,1],[41,13,41,42],[42,14,42,51],[44,19,54,3],[56,21,80,3],[82,26,96,3],[98,26,111,3],[113,21,130,3],[132,47,134,6],[136,18,136,31],[138,21,138,59],[140,24,142,2],[144,1,157,26],[157,5,157,24],[161,3,397,10],[168,4,208,20],[170,6,170,26],[173,7,205,9],[210,4,245,20],[212,6,214,12],[213,7,213,51],[218,6,218,23],[220,6,243,21],[224,10,240,12],[246,4,301,20],[248,6,250,12],[249,7,249,52],[254,6,254,23],[258,6,299,21],[261,9,296,11],[302,4,354,20],[304,6,306,12],[305,7,305,59],[310,6,310,23],[315,6,352,21],[318,9,349,11],[355,4,385,20],[357,6,359,12],[358,7,358,59],[363,6,363,23],[368,6,383,21],[371,9,380,11],[386,4,396,20],[388,6,390,12],[389,7,389,62],[394,13,394,69],"src\\routes\\_api\\search\\index.jsx","SearchPage",[32,0,386,1],[33,13,33,36],[35,18,35,31],[36,19,36,36],[36,9,36,14],[38,37,38,49],[41,14,41,51],[45,16,58,3],[59,16,72,3],[73,20,86,3],[87,15,100,3],[101,14,114,3],[115,22,128,3],[129,16,140,3],[141,18,153,3],[155,23,155,71],[155,8,155,19],[157,1,160,7],[162,2,384,8],[172,3,203,9],[173,4,194,6],[195,4,202,10],[201,5,201,61],[204,3,358,9],[210,5,229,20],[212,7,227,9],[232,5,257,20],[234,7,255,9],[260,5,274,20],[263,8,271,10],[277,5,290,20],[279,7,288,9],[293,5,307,20],[295,7,305,9],[310,5,324,20],[312,7,322,9],[327,5,340,20],[329,7,338,9],[343,5,356,20],[345,7,354,9],[375,5,381,11],[380,6,380,68],[383,3,383,13],"src\\routes\\_api\\favorite\\index.tsx","FavoritePage",[21,0,297,1],[22,13,22,36],[23,23,23,71],[23,8,23,19],[25,14,25,51],[27,16,38,3],[40,16,51,3],[53,20,64,3],[66,15,77,3],[79,14,90,3],[92,22,103,3],[105,16,116,3],[118,1,120,3],[123,2,295,9],[134,4,153,19],[136,6,151,8],[156,4,181,19],[158,6,179,8],[184,4,203,19],[186,6,201,8],[206,4,226,19],[208,6,224,8],[229,4,249,19],[231,6,247,8],[252,4,271,19],[254,6,269,8],[274,4,293,19],[276,6,291,8],"src\\routes\\setup\\server.list.tsx","ServerList",[28,0,206,1],[29,18,29,31],[30,39,30,53],[31,29,31,42],[31,9,31,24],[33,19,33,54],[35,21,35,37],[37,17,40,3],[42,23,45,3],[47,28,65,3],[90,1,92,7],[95,2,204,8],[96,3,96,21],[97,3,117,9],[106,4,108,17],[109,4,116,17],[115,5,115,56],[118,3,203,11],[121,6,201,12],[122,7,124,13],[125,7,173,13],[126,8,154,21],[136,10,152,12],[138,12,144,25],[155,8,163,21],[164,8,172,21],[174,7,200,13],[175,8,186,21],[185,9,185,62],[187,8,199,21],[198,9,198,71],"src\\routes\\setup\\server.add.tsx","ServerSetup",Line truncated
|
||||
{"encodings":["src\\main.tsx","ProviderWrapper",[52,0,71,1],[53,39,57,3],[53,8,53,11],[53,13,53,22],[53,24,53,35],[58,34,61,3],[58,8,58,12],[58,14,58,30],[66,2,69,4],"src\\components\\notices\\errorNotice\\errorNotice.tsx","ErrorNotice",[6,27,54,1],[6,28,6,56],[9,2,52,8],[20,3,31,9],[32,3,34,16],[35,3,51,16],"src\\utils\\store\\api.tsx","ApiProvider",[50,27,67,1],[50,28,50,65],[51,17,65,2],[66,8,66,75],"useApiInContext",[69,7,75,1],[70,15,70,37],[74,8,74,57],"src\\utils\\store\\central.tsx","CentralProvider",[48,31,71,1],[48,32,48,69],[49,17,67,2],[69,2,69,77],"useCentralStore",[73,7,79,1],[74,15,74,41],[78,8,78,57],"src\\routes\\_api\\player\\index.tsx","VideoPlayer",[88,0,918,1],[89,13,89,42],[90,21,90,32],[90,9,90,16],[91,39,91,54],[92,16,92,48],[94,14,94,51],[106,5,116,3],[97,2,97,16],[98,2,98,6],[99,2,99,10],[100,2,100,14],[101,2,101,15],[102,2,102,14],[103,2,103,13],[104,2,104,15],[105,2,105,11],[117,40,120,3],[117,8,117,29],[117,31,117,36],[122,31,122,45],[123,41,125,2],[127,51,127,66],[130,31,130,46],[131,31,131,45],[132,35,132,50],[133,45,133,68],[134,33,134,56],[135,43,135,58],[137,29,137,40],[138,27,138,42],[140,1,140,41],[142,41,142,72],[219,24,257,7],[259,1,267,21],[267,5,267,19],[269,1,287,7],[289,1,292,15],[292,5,292,13],[294,41,311,62],[311,5,311,31],[311,33,311,60],[313,1,334,3],[331,2,331,28],[332,2,332,29],[333,2,333,37],[336,29,344,15],[344,5,344,13],[346,24,364,25],[364,5,364,13],[364,15,364,23],[366,25,370,15],[370,5,370,13],[372,49,372,64],[373,27,375,7],[376,1,376,56],[376,46,376,54],[378,22,384,21],[384,5,384,19],[464,5,481,11],[465,6,474,8],[475,6,477,19],[478,6,480,19],[485,4,499,10],[486,5,495,7],[496,5,498,18],[504,4,511,10],[505,5,507,18],[508,5,510,18],[515,3,519,9],[516,4,518,17],[523,51,523,66],[524,1,530,13],[530,5,530,11],[542,2,916,8],[543,3,566,21],[545,5,564,18],[563,6,563,52],[568,4,582,13],[585,4,585,55],[587,3,605,21],[589,5,603,18],[595,6,597,12],[598,6,602,8],[606,3,883,16],[642,4,696,10],[643,5,645,18],[644,6,644,66],[646,5,648,18],[647,6,647,64],[649,5,695,12],[670,6,694,18],[686,7,688,18],[690,8,692,19],[698,5,881,11],[699,6,706,19],[702,8,704,21],[707,6,880,12],[708,7,763,13],[709,8,756,10],[757,8,762,14],[758,9,760,22],[761,9,761,62],[764,7,879,13],[765,8,800,14],[766,9,766,31],[767,9,777,22],[774,10,776,17],[778,9,782,22],[779,10,781,17],[783,9,793,22],[790,10,792,17],[794,9,794,27],[795,9,799,22],[801,8,878,14],[802,9,840,22],[824,10,826,23],[827,10,839,12],[841,9,854,22],[847,10,853,17],[855,9,855,24],[856,9,865,22],[860,10,864,17],[866,9,877,22],[874,10,876,17],[884,3,915,5],"sliderDisplayFormat",[386,29,521,2],"src\\routes\\_api\\home\\index.tsx","Home",[40,0,400,1],[41,13,41,42],[42,14,42,51],[44,19,54,3],[56,21,80,3],[82,26,96,3],[98,26,111,3],[113,21,130,3],[132,47,134,6],[136,18,136,31],[138,21,138,59],[140,24,142,2],[144,1,157,26],[157,5,157,24],[161,3,397,10],[168,4,208,20],[170,6,170,26],[173,7,205,9],[210,4,245,20],[212,6,214,12],[213,7,213,51],[218,6,218,23],[220,6,243,21],[224,10,240,12],[246,4,301,20],[248,6,250,12],[249,7,249,52],[254,6,254,23],[258,6,299,21],[261,9,296,11],[302,4,354,20],[304,6,306,12],[305,7,305,59],[310,6,310,23],[315,6,352,21],[318,9,349,11],[355,4,385,20],[357,6,359,12],[358,7,358,59],[363,6,363,23],[368,6,383,21],[371,9,380,11],[386,4,396,20],[388,6,390,12],[389,7,389,62],[394,13,394,69],"src\\routes\\_api\\search\\index.jsx","SearchPage",[32,0,386,1],[33,13,33,36],[35,18,35,31],[36,19,36,36],[36,9,36,14],[38,37,38,49],[41,14,41,51],[45,16,58,3],[59,16,72,3],[73,20,86,3],[87,15,100,3],[101,14,114,3],[115,22,128,3],[129,16,140,3],[141,18,153,3],[155,23,155,71],[155,8,155,19],[157,1,160,7],[162,2,384,8],[172,3,203,9],[173,4,194,6],[195,4,202,10],[201,5,201,61],[204,3,358,9],[210,5,229,20],[212,7,227,9],[232,5,257,20],[234,7,255,9],[260,5,274,20],[263,8,271,10],[277,5,290,20],[279,7,288,9],[293,5,307,20],[295,7,305,9],[310,5,324,20],[312,7,322,9],[327,5,340,20],[329,7,338,9],[343,5,356,20],[345,7,354,9],[375,5,381,11],[380,6,380,68],[383,3,383,13],"src\\routes\\_api\\favorite\\index.tsx","FavoritePage",[21,0,297,1],[22,13,22,36],[23,23,23,71],[23,8,23,19],[25,14,25,51],[27,16,38,3],[40,16,51,3],[53,20,64,3],[66,15,77,3],[79,14,90,3],[92,22,103,3],[105,16,116,3],[118,1,120,3],[123,2,295,9],[134,4,153,19],[136,6,151,8],[156,4,181,19],[158,6,179,8],[184,4,203,19],[186,6,201,8],[206,4,226,19],[208,6,224,8],[229,4,249,19],[231,6,247,8],[252,4,271,19],[254,6,269,8],[274,4,293,19],[276,6,291,8],"src\\routes\\setup\\server.list.tsx","ServerList",[28,0,206,1],[29,18,29,31],[30,39,30,53],[31,29,31,42],[31,9,31,24],[33,19,33,54],[35,21,35,37],[37,17,40,3],[42,23,45,3],[47,28,65,3],[90,1,92,7],[95,2,204,8],[96,3,96,21],[97,3,117,9],[106,4,108,17],[109,4,116,17],[115,5,115,56],[118,3,203,11],[121,6,201,12],[122,7,124,13],[125,7,173,13],[126,8,154,21],[136,10,152,12],[138,12,144,25],[155,8,163,21],[164,8,172,21],[174,7,200,13],[175,8,186,21],[185,9,185,62],[187,8,199,21],[198,9,198,71],"src\\routes\\setup\\server.add.tsx","ServerSetup",Line truncated
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Link, Typography } from "@mui/material";
|
||||
import React from "react";
|
||||
import React, { memo } from "react";
|
||||
|
||||
import anidbIcon from "../../assets/icons/anidb.png";
|
||||
import anilistIcon from "../../assets/icons/anilist.svg";
|
||||
@@ -25,7 +25,7 @@ const knownIcons = [
|
||||
"kitsu",
|
||||
];
|
||||
|
||||
const IconLink = ({ name, url }: { name: string; url: string }) => {
|
||||
const IconLink = memo(({ name, url }: { name: string; url: string }) => {
|
||||
return (
|
||||
<Link target="_blank" href={url} className="item-detail-link">
|
||||
{name.toLocaleLowerCase() === "imdb" && <img src={imdbIcon} alt="IMDb" />}
|
||||
@@ -61,6 +61,6 @@ const IconLink = ({ name, url }: { name: string; url: string }) => {
|
||||
)}
|
||||
</Link>
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
export default IconLink;
|
||||
@@ -1,5 +1,9 @@
|
||||
import PropTypes from "prop-types";
|
||||
import React, { useState, useLayoutEffect, useRef } from "react";
|
||||
import React, {
|
||||
useState,
|
||||
useLayoutEffect,
|
||||
useRef,
|
||||
type ReactNode,
|
||||
} from "react";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
@@ -8,16 +12,10 @@ import Tab from "@mui/material/Tab";
|
||||
import Tabs from "@mui/material/Tabs";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
import useParallax from "@/utils/hooks/useParallax";
|
||||
import { AnimatePresence, motion, useScroll } from "framer-motion";
|
||||
import { AnimatePresence, motion } from "framer-motion";
|
||||
|
||||
import {
|
||||
BaseItemKind,
|
||||
ItemFields,
|
||||
LocationType,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { BaseItemKind, LocationType } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
|
||||
import { Card } from "@/components/card/card";
|
||||
@@ -27,7 +25,7 @@ import { Blurhash } from "react-blurhash";
|
||||
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import { setBackdrop } from "@/utils/store/backdrop";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
|
||||
import meshBg from "@/assets/herobg.png";
|
||||
import ShowMoreText from "@/components/showMoreText";
|
||||
@@ -35,10 +33,17 @@ import "./person.scss";
|
||||
|
||||
import IconLink from "@/components/iconLink";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
|
||||
function TabPanel(props) {
|
||||
type TabPanelProps = {
|
||||
children: ReactNode;
|
||||
index: number;
|
||||
value: number;
|
||||
};
|
||||
|
||||
function TabPanel(props: TabPanelProps) {
|
||||
const { children, value, index, ...other } = props;
|
||||
|
||||
return (
|
||||
@@ -55,32 +60,20 @@ function TabPanel(props) {
|
||||
);
|
||||
}
|
||||
|
||||
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}`,
|
||||
};
|
||||
}
|
||||
|
||||
export const Route = createFileRoute("/_api/person/$id")({
|
||||
component: PersonTitlePage,
|
||||
});
|
||||
|
||||
function PersonTitlePage() {
|
||||
const { id } = Route.useParams();
|
||||
const api = Route.useRouteContext().api;
|
||||
const api = useApiInContext((s) => s.api);
|
||||
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const item = useQuery({
|
||||
queryKey: ["item", id],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getUserLibraryApi(api).getItem({
|
||||
userId: user?.Id,
|
||||
itemId: id,
|
||||
@@ -95,6 +88,7 @@ function PersonTitlePage() {
|
||||
const personMovies = useQuery({
|
||||
queryKey: ["item", id, "personMovies"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
personIds: [id],
|
||||
@@ -106,12 +100,13 @@ function PersonTitlePage() {
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.Person,
|
||||
enabled: item.isSuccess && item.data?.Type === BaseItemKind.Person,
|
||||
networkMode: "always",
|
||||
});
|
||||
const personShows = useQuery({
|
||||
queryKey: ["item", id, "personShows"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
personIds: [id],
|
||||
@@ -123,13 +118,13 @@ function PersonTitlePage() {
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.Person,
|
||||
enabled: item.isSuccess && item.data?.Type === BaseItemKind.Person,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const personBooks = useQuery({
|
||||
queryKey: ["item", id, "personBooks"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
personIds: [id],
|
||||
@@ -141,12 +136,13 @@ function PersonTitlePage() {
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.Person,
|
||||
enabled: item.isSuccess && item.data?.Type === BaseItemKind.Person,
|
||||
networkMode: "always",
|
||||
});
|
||||
const personPhotos = useQuery({
|
||||
queryKey: ["item", id, "personPhotos"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
personIds: [id],
|
||||
@@ -157,12 +153,13 @@ function PersonTitlePage() {
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.Person,
|
||||
enabled: item.isSuccess && item.data?.Type === BaseItemKind.Person,
|
||||
networkMode: "always",
|
||||
});
|
||||
const personEpisodes = useQuery({
|
||||
queryKey: ["item", id, "personEpisodes"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
personIds: [id],
|
||||
@@ -175,7 +172,7 @@ function PersonTitlePage() {
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: item.isSuccess && item.data.Type === BaseItemKind.Person,
|
||||
enabled: item.isSuccess && item.data?.Type === BaseItemKind.Person,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
@@ -209,6 +206,8 @@ function PersonTitlePage() {
|
||||
},
|
||||
];
|
||||
|
||||
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (
|
||||
personMovies.isSuccess &&
|
||||
@@ -217,15 +216,15 @@ function PersonTitlePage() {
|
||||
personPhotos.isSuccess &&
|
||||
personEpisodes.isSuccess
|
||||
) {
|
||||
if (personMovies.data.TotalRecordCount !== 0) {
|
||||
if (personMovies.data?.TotalRecordCount !== 0) {
|
||||
setActivePersonTab(0);
|
||||
} else if (personShows.data.TotalRecordCount !== 0) {
|
||||
} else if (personShows.data?.TotalRecordCount !== 0) {
|
||||
setActivePersonTab(1);
|
||||
} else if (personBooks.data.TotalRecordCount !== 0) {
|
||||
} else if (personBooks.data?.TotalRecordCount !== 0) {
|
||||
setActivePersonTab(2);
|
||||
} else if (personPhotos.data.TotalRecordCount !== 0) {
|
||||
} else if (personPhotos.data?.TotalRecordCount !== 0) {
|
||||
setActivePersonTab(3);
|
||||
} else if (personEpisodes.data.TotalRecordCount !== 0) {
|
||||
} else if (personEpisodes.data?.TotalRecordCount !== 0) {
|
||||
setActivePersonTab(4);
|
||||
}
|
||||
}
|
||||
@@ -241,11 +240,6 @@ function PersonTitlePage() {
|
||||
const [animationDirection, setAnimationDirection] = useState("forward");
|
||||
|
||||
const pageRef = useRef(null);
|
||||
const { scrollYProgress } = useScroll({
|
||||
target: pageRef,
|
||||
offset: ["start start", "60vh start"],
|
||||
});
|
||||
const parallax = useParallax(scrollYProgress, 50);
|
||||
|
||||
if (item.isPending) {
|
||||
return (
|
||||
@@ -263,7 +257,7 @@ function PersonTitlePage() {
|
||||
);
|
||||
}
|
||||
|
||||
if (item.isSuccess) {
|
||||
if (item.isSuccess && item.data) {
|
||||
return (
|
||||
<motion.div
|
||||
key={id}
|
||||
@@ -282,15 +276,12 @@ function PersonTitlePage() {
|
||||
>
|
||||
<div className="item-hero">
|
||||
<div className="item-hero-backdrop-container">
|
||||
<motion.img
|
||||
alt={item.data.Name}
|
||||
<img
|
||||
alt={item.data.Name ?? ""}
|
||||
src={meshBg}
|
||||
className="item-hero-backdrop"
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
}}
|
||||
style={{
|
||||
y: parallax,
|
||||
e.currentTarget.style.opacity = "1";
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
@@ -300,34 +291,35 @@ function PersonTitlePage() {
|
||||
aspectRatio: item.data.PrimaryImageAspectRatio ?? 1,
|
||||
}}
|
||||
>
|
||||
{Object.keys(item.data.ImageTags).includes("Primary") ? (
|
||||
<>
|
||||
{item.data.ImageTags?.Primary && (
|
||||
<div>
|
||||
<Blurhash
|
||||
hash={
|
||||
item.data.ImageBlurHashes.Primary[
|
||||
item.data.ImageBlurHashes?.Primary?.[
|
||||
item.data.ImageTags.Primary
|
||||
]
|
||||
] ?? ""
|
||||
}
|
||||
className="item-hero-image-blurhash"
|
||||
/>
|
||||
<img
|
||||
alt={item.data.Name}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags.Primary,
|
||||
},
|
||||
)}
|
||||
alt={item.data.Name ?? ""}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 90,
|
||||
tag: item.data.ImageTags.Primary,
|
||||
},
|
||||
)
|
||||
}
|
||||
onLoad={(e) => {
|
||||
e.currentTarget.style.opacity = 1;
|
||||
e.currentTarget.style.opacity = "1";
|
||||
}}
|
||||
className="item-hero-image"
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<></>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="item-hero-detail flex flex-column">
|
||||
@@ -339,7 +331,7 @@ function PersonTitlePage() {
|
||||
itemName={item.data.Name}
|
||||
itemId={item.data.Id}
|
||||
queryKey={["item", id]}
|
||||
isFavorite={item.data.UserData.IsFavorite}
|
||||
isFavorite={item.data.UserData?.IsFavorite}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
@@ -358,9 +350,11 @@ function PersonTitlePage() {
|
||||
marginTop: "1em",
|
||||
}}
|
||||
>
|
||||
{item.data.ExternalUrls.map((url) => (
|
||||
<IconLink url={url.Url} name={url.Name} />
|
||||
))}
|
||||
{item.data.ExternalUrls?.map(
|
||||
(url) =>
|
||||
url.Name &&
|
||||
url.Url && <IconLink url={url.Url} name={url.Name} />,
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
@@ -369,22 +363,22 @@ function PersonTitlePage() {
|
||||
}}
|
||||
>
|
||||
{item.data.PremiereDate && (
|
||||
<>
|
||||
<div>
|
||||
<Typography variant="h6">Birth</Typography>
|
||||
<Typography variant="subtitle1" sx={{ opacity: 0.8 }}>
|
||||
{new Date(item.data.PremiereDate).toDateString()}
|
||||
</Typography>
|
||||
</>
|
||||
</div>
|
||||
)}
|
||||
{item.data.EndDate && (
|
||||
<>
|
||||
<div>
|
||||
<Typography variant="h6" mt={2}>
|
||||
Death
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" sx={{ opacity: 0.8 }}>
|
||||
{new Date(item.data.EndDate).toDateString()}
|
||||
</Typography>
|
||||
</>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
@@ -394,7 +388,7 @@ function PersonTitlePage() {
|
||||
<Tabs
|
||||
variant="scrollable"
|
||||
value={activePersonTab}
|
||||
onChange={(e, newVal) => {
|
||||
onChange={(_, newVal) => {
|
||||
if (newVal > activePersonTab) {
|
||||
setAnimationDirection("forward");
|
||||
} else if (newVal < activePersonTab) {
|
||||
@@ -427,7 +421,7 @@ function PersonTitlePage() {
|
||||
? "col-7"
|
||||
: "col-4"
|
||||
}`}
|
||||
key={tab.queryKey}
|
||||
key={tab.queryKey.join("")}
|
||||
initial={{
|
||||
opacity: 0,
|
||||
transform:
|
||||
@@ -445,7 +439,7 @@ function PersonTitlePage() {
|
||||
}}
|
||||
>
|
||||
{tab.data.isSuccess &&
|
||||
tab.data.data.Items.map((tabitem, index) => {
|
||||
tab.data.data?.Items?.map((tabitem) => {
|
||||
return (
|
||||
<Card
|
||||
key={tabitem.Id}
|
||||
@@ -478,18 +472,12 @@ function PersonTitlePage() {
|
||||
}
|
||||
queryKey={tab.queryKey}
|
||||
userId={user?.Id}
|
||||
imageBlurhash={
|
||||
!!tabitem.ImageBlurHashes?.Primary &&
|
||||
tabitem.ImageBlurHashes?.Primary[
|
||||
Object.keys(tabitem.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</motion.div>
|
||||
{tab.data.isSuccess &&
|
||||
tab.data.data.TotalRecordCount > 24 && (
|
||||
(tab.data.data?.TotalRecordCount ?? 0) > 24 && (
|
||||
<Typography
|
||||
variant="h6"
|
||||
style={{
|
||||
|
||||
@@ -92,7 +92,7 @@ $cardWidth: 18%;
|
||||
}
|
||||
&-backdrop {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
object-position: top;
|
||||
opacity: 0;
|
||||
@@ -103,7 +103,7 @@ $cardWidth: 18%;
|
||||
top: -4.4em;
|
||||
left: -$page-margin;
|
||||
width: 100vw;
|
||||
height: calc(44vh + 4.4em);
|
||||
height: 100vh;
|
||||
z-index: -1;
|
||||
mask-image: linear-gradient(to top, transparent, black);
|
||||
-webkit-mask-image: linear-gradient(
|
||||
|
||||
@@ -194,10 +194,12 @@ function AudioPlayerRoute() {
|
||||
style={{ gap: "1em", alignItems: "center" }}
|
||||
>
|
||||
<Typography variant="subtitle2" className="opacity-07">
|
||||
{getRuntimeMusic(secToTicks(audioPlayer?.currentTime) ?? 0)}
|
||||
{getRuntimeMusic(secToTicks(audioPlayer?.currentTime ?? 0) ?? 0)}
|
||||
</Typography>
|
||||
<Slider
|
||||
value={isScrubbing ? sliderProgress : secToTicks(progress)}
|
||||
value={
|
||||
isScrubbing ? sliderProgress : secToTicks(Number(progress))
|
||||
}
|
||||
max={item?.RunTimeTicks ?? 1}
|
||||
step={1}
|
||||
key={item?.Id}
|
||||
@@ -318,8 +320,9 @@ function AudioPlayerRoute() {
|
||||
className="audio-lyrics-line"
|
||||
key={`${lyric.Text}${index}`}
|
||||
data-active-lyric={
|
||||
secToTicks(audioPlayer?.currentTime) >= (lyric.Start ?? 0) &&
|
||||
secToTicks(audioPlayer?.currentTime) <
|
||||
secToTicks(audioPlayer?.currentTime ?? 0) >=
|
||||
(lyric.Start ?? 0) &&
|
||||
secToTicks(audioPlayer?.currentTime ?? 0) <
|
||||
(lyrics.data?.Lyrics?.[index + 1]?.Start ?? 0)
|
||||
}
|
||||
>
|
||||
|
||||
@@ -514,15 +514,15 @@ function SeriesTitlePage() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{item.data.RunTimeTicks && (
|
||||
{Boolean(item.data.RunTimeTicks) && (
|
||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||
{getRuntime(item.data.RunTimeTicks)}
|
||||
{getRuntime(item.data.RunTimeTicks ?? 0)}
|
||||
</Typography>
|
||||
)}
|
||||
{item.data.RunTimeTicks && (
|
||||
{Boolean(item.data.RunTimeTicks) && (
|
||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||
{endsAt(
|
||||
item.data.RunTimeTicks -
|
||||
(item.data.RunTimeTicks ?? 0) -
|
||||
(item.data.UserData?.PlaybackPositionTicks ?? 0),
|
||||
)}
|
||||
</Typography>
|
||||
|
||||
@@ -35,11 +35,11 @@ if (!localStorage.getItem("deviceId")) {
|
||||
|
||||
export const jellyfin = new Jellyfin({
|
||||
clientInfo: {
|
||||
name: "JellyPlayer",
|
||||
name: "Blink",
|
||||
version: appVer,
|
||||
},
|
||||
deviceInfo: {
|
||||
name: "JellyPlayer",
|
||||
name: "Blink",
|
||||
id: deviceId,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user