Start adding SeriesTitlePage #160
This commit is contained in:
6 files changed
+550
-32
No files matched your search
@@ -18,6 +18,7 @@ import { MdiCheck } from "../icons/mdiCheck";
|
||||
import LikeButton from "../buttons/likeButton";
|
||||
import MarkPlayedButton from "../buttons/markPlayedButton";
|
||||
import PlayButton from "../buttons/playButton";
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
|
||||
const cardImageAspectRatios = {
|
||||
thumb: 1.777,
|
||||
@@ -25,6 +26,32 @@ const cardImageAspectRatios = {
|
||||
square: 1,
|
||||
};
|
||||
|
||||
const availableSpecialRoutes = [BaseItemKind.Series];
|
||||
|
||||
/**
|
||||
* @typedef {Object} Props
|
||||
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemDto} item
|
||||
* @property {string} cardTitle
|
||||
* @property {string | number} cardCaption
|
||||
* @property {string} imageType
|
||||
* @property {string} imageBlurhash
|
||||
* @property {string} cardType
|
||||
* @property {Array} queryKey
|
||||
* @property {string} userId
|
||||
* @property {string} seriesId
|
||||
* @property {boolean} hideText
|
||||
* @property {() => {}} onClick
|
||||
* @property {boolean} disableOverlay
|
||||
* @property {boolean} disablePadding
|
||||
* @property {any} overrideIcon
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description Hero section for item pages
|
||||
* @param {Props}
|
||||
* @returns {React.Component}
|
||||
*/
|
||||
|
||||
export const Card = ({
|
||||
item,
|
||||
cardTitle,
|
||||
@@ -42,7 +69,13 @@ export const Card = ({
|
||||
overrideIcon,
|
||||
}) => {
|
||||
const navigate = useNavigate();
|
||||
const defaultOnClick = () => navigate(`/item/${item.Id}`);
|
||||
const defaultOnClick = () => {
|
||||
if (availableSpecialRoutes.includes(item.Type)) {
|
||||
navigate(`/${item.Type.toLocaleLowerCase()}/${item.Id}`);
|
||||
} else {
|
||||
navigate(`/item/${item.Id}`);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<CardActionArea
|
||||
sx={{ padding: disablePadding ? 0 : 1, borderRadius: "10px" }}
|
||||
@@ -230,19 +263,3 @@ export const Card = ({
|
||||
</CardActionArea>
|
||||
);
|
||||
};
|
||||
|
||||
Card.propTypes = {
|
||||
item: PropTypes.any.isRequired,
|
||||
cardTitle: PropTypes.string,
|
||||
cardCaption: PropTypes.any,
|
||||
imageType: PropTypes.string,
|
||||
imageBlurhash: PropTypes.string,
|
||||
cardType: PropTypes.string,
|
||||
queryKey: PropTypes.any,
|
||||
userId: PropTypes.string.isRequired,
|
||||
seriesId: PropTypes.string,
|
||||
hideText: PropTypes.bool,
|
||||
onClick: PropTypes.func,
|
||||
disableOverlay: PropTypes.bool,
|
||||
disablePadding: PropTypes.bool,
|
||||
};
|
||||
@@ -80,10 +80,6 @@ const Hero = ({
|
||||
const [currentSubtitleIndex, setCurrentSubtitleIndex] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
console.error(
|
||||
JSON.stringify([videoTracks, audioTracks, subtitleTracks]) +
|
||||
`${new Date()}`,
|
||||
);
|
||||
if (!!videoTracks && !!audioTracks & !!subtitleTracks) {
|
||||
setCurrentVideoIndex(videoTracks[0]?.Index);
|
||||
setCurrentAudioIndex(audioTracks[0]?.Index);
|
||||
|
||||
Reference in new issue
Block a user