refactor: convert more files to typescript
This commit is contained in:
19 files changed
+93
-451
No files matched your search
@@ -16,11 +16,11 @@ export default function LikeButton({
|
||||
userId,
|
||||
itemName,
|
||||
}: {
|
||||
itemId: string;
|
||||
isFavorite: boolean;
|
||||
queryKey: string[];
|
||||
userId: string;
|
||||
itemName: string;
|
||||
itemId: string | undefined;
|
||||
isFavorite: boolean | undefined;
|
||||
queryKey: string[] | undefined;
|
||||
userId: string | undefined;
|
||||
itemName: string | undefined;
|
||||
}) {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const queryClient = useQueryClient();
|
||||
@@ -29,6 +29,9 @@ export default function LikeButton({
|
||||
const handleLiking = async () => {
|
||||
let result: UserItemDataDto = null!;
|
||||
if (!api) return;
|
||||
if (!userId) return;
|
||||
if (!itemId) return;
|
||||
if (!itemName) return;
|
||||
if (isFavorite) {
|
||||
result = (
|
||||
await getUserLibraryApi(api).unmarkFavoriteItem({
|
||||
|
||||
@@ -16,11 +16,11 @@ export default function MarkPlayedButton({
|
||||
userId,
|
||||
itemName,
|
||||
}: {
|
||||
itemId: string;
|
||||
isPlayed: boolean;
|
||||
queryKey: string[];
|
||||
userId: string;
|
||||
itemName: string;
|
||||
itemId?: string;
|
||||
isPlayed?: boolean;
|
||||
queryKey?: string[];
|
||||
userId?: string;
|
||||
itemName?: string;
|
||||
}) {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
|
||||
@@ -30,6 +30,11 @@ export default function MarkPlayedButton({
|
||||
const handleMarking = async () => {
|
||||
let result = null;
|
||||
if (!api) return;
|
||||
if (!api) return;
|
||||
if (!userId) return;
|
||||
if (!itemId) return;
|
||||
if (!itemName) return;
|
||||
|
||||
if (!isPlayed) {
|
||||
result = await getPlaystateApi(api).markPlayedItem({
|
||||
userId: userId,
|
||||
|
||||
@@ -53,7 +53,7 @@ type PlayButtonProps = {
|
||||
iconOnly?: boolean;
|
||||
audio?: boolean;
|
||||
size?: "small" | "large" | "medium";
|
||||
playlistItem?: BaseItemDto;
|
||||
playlistItem?: boolean;
|
||||
playlistItemId?: string;
|
||||
trackIndex?: number;
|
||||
};
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
import React from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
import MuiCard from "@mui/material/Card";
|
||||
import CardActionArea from "@mui/material/CardActionArea";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
import { Blurhash } from "react-blurhash";
|
||||
import { useApi } from "../../utils/store/api";
|
||||
import "./card.scss";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
|
||||
/**
|
||||
* @typedef {Object} Props
|
||||
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemDto} item
|
||||
* @property {string} cardTitle
|
||||
* @property {string | number} cardCaption
|
||||
* @property {string} imageBlurhash
|
||||
* @property {string} seriesId
|
||||
* @property {boolean} hideText
|
||||
* @property {() => {}} onClick
|
||||
* @property {boolean} disablePadding
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description Hero section for item pages
|
||||
* @param {Props}
|
||||
* @returns {React.Component}
|
||||
*/
|
||||
|
||||
export const ActorCard = ({
|
||||
item,
|
||||
cardTitle,
|
||||
cardCaption,
|
||||
imageBlurhash,
|
||||
seriesId,
|
||||
hideText,
|
||||
onClick,
|
||||
disablePadding,
|
||||
}) => {
|
||||
const [api] = useApi((state) => [state.api]);
|
||||
const navigate = useNavigate();
|
||||
const defaultOnClick = () => {
|
||||
navigate(`/person/${item.Id}`);
|
||||
};
|
||||
return (
|
||||
<div
|
||||
className="card card-actor"
|
||||
elevation={0}
|
||||
onClick={onClick ? onClick : defaultOnClick}
|
||||
>
|
||||
<div className="card-box">
|
||||
<div
|
||||
className="card-image-container"
|
||||
style={{
|
||||
aspectRatio: 1,
|
||||
}}
|
||||
>
|
||||
{!!imageBlurhash && (
|
||||
<Blurhash
|
||||
hash={imageBlurhash}
|
||||
width={128}
|
||||
height={128}
|
||||
resolutionX={24}
|
||||
resolutionY={24}
|
||||
className="card-image-blurhash"
|
||||
/>
|
||||
)}
|
||||
<div className="card-image-icon-container">
|
||||
<div className="material-symbols-rounded">person</div>
|
||||
</div>
|
||||
<img
|
||||
alt={item.Name}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(
|
||||
seriesId ? item.SeriesId : item.Id,
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
fillHeight: 448,
|
||||
fillWidth: 448,
|
||||
},
|
||||
)}
|
||||
style={{
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
opacity: 0,
|
||||
}}
|
||||
loading="lazy"
|
||||
onLoad={(e) => {
|
||||
e.target.style.opacity = 1;
|
||||
}}
|
||||
className="card-image"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className="card-text-container"
|
||||
style={{ display: hideText ? "none" : "block" }}
|
||||
>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
fontWeight={500}
|
||||
noWrap
|
||||
textAlign="center"
|
||||
style={{ opacity: 0.9 }}
|
||||
>
|
||||
{cardTitle}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
noWrap
|
||||
textAlign="center"
|
||||
style={{ opacity: 0.6 }}
|
||||
lineHeight="auto"
|
||||
>
|
||||
{cardCaption}
|
||||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -37,8 +37,8 @@ const CardComponent = ({
|
||||
item: BaseItemDto;
|
||||
cardTitle: string | undefined | null;
|
||||
cardCaption?: string | null | number;
|
||||
imageType: ImageType;
|
||||
cardType: string;
|
||||
imageType?: ImageType;
|
||||
cardType: "square" | "thumb" | "portrait";
|
||||
queryKey?: string[];
|
||||
userId?: string;
|
||||
seriesId?: string | null;
|
||||
@@ -145,17 +145,13 @@ const CardComponent = ({
|
||||
{!disableOverlay && (
|
||||
<>
|
||||
<PlayButton
|
||||
itemId={item.Id}
|
||||
item={item}
|
||||
userId={userId}
|
||||
itemType={item.Type}
|
||||
itemType={item.Type ?? "Movie"}
|
||||
currentAudioTrack={0}
|
||||
currentSubTrack="nosub"
|
||||
currentVideoTrack={0}
|
||||
className="card-play-button"
|
||||
iconProps={{
|
||||
style: { fontSize: "2.5em" },
|
||||
}}
|
||||
iconOnly
|
||||
audio={
|
||||
item.Type === BaseItemKind.MusicAlbum ||
|
||||
@@ -168,14 +164,14 @@ const CardComponent = ({
|
||||
/>
|
||||
<LikeButton
|
||||
itemId={item.Id}
|
||||
itemName={item.Name}
|
||||
itemName={item.Name ?? ""}
|
||||
isFavorite={item.UserData?.IsFavorite}
|
||||
queryKey={queryKey}
|
||||
userId={userId}
|
||||
/>
|
||||
<MarkPlayedButton
|
||||
itemId={item.Id}
|
||||
itemName={item.Name}
|
||||
itemName={item.Name ?? ""}
|
||||
isPlayed={item.UserData?.Played}
|
||||
queryKey={queryKey}
|
||||
userId={userId}
|
||||
|
||||
@@ -1,207 +0,0 @@
|
||||
import React from "react";
|
||||
|
||||
import MuiCard from "@mui/material/Card";
|
||||
import CardActionArea from "@mui/material/CardActionArea";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
import { Blurhash } from "react-blurhash";
|
||||
|
||||
import "./card.scss";
|
||||
|
||||
import { getRuntimeCompact } from "@/utils/date/time";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useNavigate, useRouteContext } from "@tanstack/react-router";
|
||||
import LikeButton from "../buttons/likeButton";
|
||||
import MarkPlayedButton from "../buttons/markPlayedButton";
|
||||
import PlayButton from "../buttons/playButton";
|
||||
|
||||
/**
|
||||
* @typedef {Object} Props
|
||||
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemDto} item
|
||||
* @property {string} cardTitle
|
||||
* @property {string | number} cardCaption
|
||||
* @property {string} imageBlurhash
|
||||
* @property {Array} queryKey
|
||||
* @property {string} userId
|
||||
* @property {boolean} disableRunTime
|
||||
* @property {() => {} | undefined} onClick
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description Hero section for item pages
|
||||
* @param {Props}
|
||||
*/
|
||||
|
||||
export const EpisodeCard = ({
|
||||
item,
|
||||
cardTitle,
|
||||
cardCaption,
|
||||
imageBlurhash,
|
||||
queryKey,
|
||||
userId,
|
||||
disableRunTime = false,
|
||||
onClick,
|
||||
}) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const navigate = useNavigate();
|
||||
const defaultOnClick = () => {
|
||||
navigate({ to: `/episode/${item.Id}` });
|
||||
};
|
||||
return (
|
||||
<div
|
||||
className="card card-episode"
|
||||
onClick={onClick ? onClick : defaultOnClick}
|
||||
>
|
||||
<div className="card-box">
|
||||
<div
|
||||
className="card-image-container"
|
||||
style={{
|
||||
aspectRatio: 1.777,
|
||||
}}
|
||||
>
|
||||
{!!item.UserData && (
|
||||
<div
|
||||
className="card-indicator check"
|
||||
style={{
|
||||
opacity: item.UserData?.Played ? 1 : 0,
|
||||
}}
|
||||
>
|
||||
<div className="material-symbols-rounded">done</div>
|
||||
</div>
|
||||
)}
|
||||
{!!imageBlurhash && (
|
||||
<Blurhash
|
||||
hash={imageBlurhash}
|
||||
width={128}
|
||||
height={128}
|
||||
resolutionX={24}
|
||||
resolutionY={24}
|
||||
className="card-image-blurhash"
|
||||
/>
|
||||
)}
|
||||
<div className="card-image-icon-container">
|
||||
<div className="material-symbols-rounded">tv_gen</div>
|
||||
</div>
|
||||
<img
|
||||
alt={item.Name}
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(item.Id, "Primary", {
|
||||
quality: 90,
|
||||
fillHeight: 512,
|
||||
fillWidth: 512,
|
||||
})}
|
||||
style={{
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
opacity: 0,
|
||||
}}
|
||||
loading="lazy"
|
||||
onLoad={(e) => {
|
||||
e.target.style.opacity = 1;
|
||||
}}
|
||||
className="card-image"
|
||||
/>
|
||||
|
||||
<div className="card-overlay">
|
||||
<PlayButton
|
||||
item={item}
|
||||
userId={userId}
|
||||
itemType={item.Type}
|
||||
currentAudioTrack={0}
|
||||
currentSubTrack={0}
|
||||
currentVideoTrack={0}
|
||||
className="card-play-button"
|
||||
iconProps={{
|
||||
style: { fontSize: "2.5em" },
|
||||
}}
|
||||
iconOnly
|
||||
/>
|
||||
<LikeButton
|
||||
itemId={item.Id}
|
||||
itemName={item.Name}
|
||||
isFavorite={item.UserData?.IsFavorite}
|
||||
queryKey={queryKey}
|
||||
userId={userId}
|
||||
/>
|
||||
<MarkPlayedButton
|
||||
itemId={item.Id}
|
||||
itemName={item.Name}
|
||||
isPlayed={item.UserData?.Played}
|
||||
queryKey={queryKey}
|
||||
userId={userId}
|
||||
/>
|
||||
</div>
|
||||
{100 > item.UserData?.PlayedPercentage > 0 && (
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
value={item.UserData.PlayedPercentage}
|
||||
style={{
|
||||
position: "absolute",
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
zIndex: 2,
|
||||
height: "6px",
|
||||
background: "rgb(5 5 5 / 0.5) !important",
|
||||
backdropFilter: "blur(5px)",
|
||||
}}
|
||||
color="primary"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<div
|
||||
className="card-text-container"
|
||||
style={{ display: "block", marginTop: "0.5em" }}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "space-between",
|
||||
gap: "1em",
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
fontWeight={500}
|
||||
textAlign="start"
|
||||
noWrap
|
||||
style={{
|
||||
opacity: 0.9,
|
||||
}}
|
||||
>
|
||||
{cardTitle}
|
||||
</Typography>
|
||||
{!disableRunTime && (
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
fontWeight={500}
|
||||
noWrap
|
||||
textAlign="start"
|
||||
style={{ opacity: 0.8, flexShrink: 0 }}
|
||||
>
|
||||
{getRuntimeCompact(item.RunTimeTicks)}
|
||||
</Typography>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
textAlign="start"
|
||||
style={{
|
||||
opacity: 0.6,
|
||||
display: "-webkit-box",
|
||||
overflow: "hidden",
|
||||
WebkitBoxOrient: "vertical",
|
||||
WebkitLineClamp: 3,
|
||||
}}
|
||||
lineHeight="auto"
|
||||
>
|
||||
{cardCaption}
|
||||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
+22
-18
@@ -1,11 +1,8 @@
|
||||
import PropTypes from "prop-types";
|
||||
import React, { useState } from "react";
|
||||
import React, { type ReactNode } from "react";
|
||||
|
||||
import Carousel from "react-multi-carousel";
|
||||
import "react-multi-carousel/lib/styles.css";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import ButtonGroup from "@mui/material/ButtonGroup";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
@@ -30,14 +27,23 @@ function LeftButton(props) {
|
||||
);
|
||||
}
|
||||
|
||||
export const CardScroller = ({
|
||||
type CardScrollerProps = {
|
||||
children: ReactNode;
|
||||
displayCards: number;
|
||||
title: string;
|
||||
headingProps?: object;
|
||||
disableDecoration?: boolean;
|
||||
boxProps?: object;
|
||||
};
|
||||
|
||||
export default function CardScroller({
|
||||
children,
|
||||
displayCards,
|
||||
title,
|
||||
headingProps,
|
||||
disableDecoration = false,
|
||||
boxProps,
|
||||
}) => {
|
||||
}: CardScrollerProps) {
|
||||
const responsive = {
|
||||
superLargeDesktop: {
|
||||
// the naming can be any, depends on you.
|
||||
@@ -73,9 +79,13 @@ export const CardScroller = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<Box {...boxProps} className="card-scroller-container" mb={1}>
|
||||
<Box
|
||||
sx={{ mb: 1 }}
|
||||
<div
|
||||
{...boxProps}
|
||||
className="card-scroller-container"
|
||||
style={{ marginBottom: "1.2em" }}
|
||||
>
|
||||
<div
|
||||
style={{ marginBottom: "1.2em" }}
|
||||
className={
|
||||
disableDecoration
|
||||
? "card-scroller-header-container hidden-decoration"
|
||||
@@ -90,7 +100,7 @@ export const CardScroller = ({
|
||||
>
|
||||
<div className="card-scroller-heading-decoration" /> {title}
|
||||
</Typography>
|
||||
</Box>
|
||||
</div>
|
||||
<Carousel
|
||||
swipeable
|
||||
draggable
|
||||
@@ -104,12 +114,6 @@ export const CardScroller = ({
|
||||
>
|
||||
{children}
|
||||
</Carousel>
|
||||
</Box>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
CardScroller.propTypes = {
|
||||
displayCards: PropTypes.number.isRequired,
|
||||
title: PropTypes.string.isRequired,
|
||||
headingProps: PropTypes.any,
|
||||
};
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { AnimatePresence, motion } from "framer-motion";
|
||||
import type { PanInfo } from "framer-motion";
|
||||
import React, { useEffect, useState, useMemo, useCallback } from "react";
|
||||
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import type { MouseEvent, PointerEvent } from "react";
|
||||
|
||||
import { useCarouselStore } from "../../utils/store/carousel";
|
||||
import "./carousel.scss";
|
||||
@@ -10,12 +10,11 @@ import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import CarouselSlide from "../carouselSlide";
|
||||
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import ReactMultiCarousel from "react-multi-carousel";
|
||||
import Slider from "../Slider";
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
|
||||
const swipeConfidenceThreshold = 8000;
|
||||
const swipePower = (offset, velocity) => {
|
||||
const swipePower = (offset: number, velocity: number) => {
|
||||
return Math.abs(offset) * velocity;
|
||||
};
|
||||
|
||||
@@ -30,14 +29,11 @@ const Carousel = ({
|
||||
onChange,
|
||||
}: {
|
||||
content: BaseItemDto[];
|
||||
onChange: () => void;
|
||||
onChange: (currentSlide: number) => void;
|
||||
}) => {
|
||||
const [currentSlide, setCurrentSlide] = useState(0);
|
||||
|
||||
const [setDirection, dir] = useCarouselStore((state) => [
|
||||
state.setDirection,
|
||||
state.direction,
|
||||
]);
|
||||
const [setDirection] = useCarouselStore((state) => [state.setDirection]);
|
||||
|
||||
useEffect(() => {
|
||||
onChange(currentSlide);
|
||||
@@ -45,27 +41,6 @@ const Carousel = ({
|
||||
|
||||
const api = useApiInContext((s) => s.api);
|
||||
|
||||
const responsive = {
|
||||
superLargeDesktop: {
|
||||
breakpoint: { max: 4000, min: 3000 },
|
||||
items: 6,
|
||||
},
|
||||
desktop: {
|
||||
breakpoint: { max: 3000, min: 1024 },
|
||||
items: 6,
|
||||
},
|
||||
tablet: {
|
||||
breakpoint: { max: 1024, min: 464 },
|
||||
items: 4,
|
||||
},
|
||||
mobile: {
|
||||
breakpoint: { max: 464, min: 0 },
|
||||
items: 1,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Memoize the content mapping
|
||||
const sliderContent = useMemo(() => {
|
||||
return content.map((item, index) => {
|
||||
@@ -98,16 +73,23 @@ const Carousel = ({
|
||||
>
|
||||
{item.ImageTags?.Thumb ? (
|
||||
<img
|
||||
src={getImageUrlsApi(api).getItemImageUrlById(item.Id, "Thumb", {
|
||||
tag: item.ImageTags.Primary,
|
||||
fillWidth: 300,
|
||||
})}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.Id ?? "",
|
||||
"Thumb",
|
||||
{
|
||||
tag: item.ImageTags.Primary,
|
||||
fillWidth: 300,
|
||||
},
|
||||
)
|
||||
}
|
||||
alt={item.Name ?? "item-image"}
|
||||
className="carousel-indicator-image"
|
||||
/>
|
||||
) : (
|
||||
<div className="carousel-indicator-icon">
|
||||
{getTypeIcon(item.Type)}
|
||||
{getTypeIcon(item.Type ?? "Movie")}
|
||||
</div>
|
||||
)}
|
||||
</motion.div>
|
||||
@@ -116,7 +98,10 @@ const Carousel = ({
|
||||
}, [content, currentSlide, api, setDirection]);
|
||||
|
||||
const handleDragEnd = useCallback(
|
||||
(e, { offset, velocity }) => {
|
||||
(
|
||||
_: MouseEvent | TouchEvent | PointerEvent,
|
||||
{ offset, velocity }: PanInfo,
|
||||
) => {
|
||||
const swipe = swipePower(offset.x, velocity.x);
|
||||
if (
|
||||
currentSlide !== content.length - 1 &&
|
||||
@@ -147,6 +132,7 @@ const Carousel = ({
|
||||
drag={"x"}
|
||||
dragConstraints={{ left: 0, right: 0 }}
|
||||
dragElastic={1}
|
||||
//@ts-ignore
|
||||
onDragEnd={handleDragEnd}
|
||||
style={{
|
||||
height: "100%",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import React from "react";
|
||||
import { Card } from "../../card/card";
|
||||
import { CardScroller } from "../../cardScroller/cardScroller";
|
||||
import CardScroller from "../../cardScroller/cardScroller";
|
||||
import { CardsSkeleton } from "../../skeleton/cards";
|
||||
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useQuery } from "@tanstack/react-query";
|
||||
import { useRouteContext } from "@tanstack/react-router";
|
||||
import React from "react";
|
||||
import { Card } from "../../../card/card";
|
||||
import { CardScroller } from "../../../cardScroller/cardScroller";
|
||||
import cardScroller from "../../../cardScroller/cardScroller";
|
||||
|
||||
const GenreView = ({ libraryId, genreId, genreName, userId }) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
@@ -25,7 +25,11 @@ const GenreView = ({ libraryId, genreId, genreName, userId }) => {
|
||||
if (items.isSuccess && items.data.Items.length > 0) {
|
||||
return (
|
||||
<div className="library-genre">
|
||||
<CardScroller title={genreName} displayCards={8} disableDecoration>
|
||||
<cardScroller.CardScroller
|
||||
title={genreName}
|
||||
displayCards={8}
|
||||
disableDecoration
|
||||
>
|
||||
{items.data.Items.map((item) => {
|
||||
return (
|
||||
<Card
|
||||
@@ -42,14 +46,14 @@ const GenreView = ({ libraryId, genreId, genreName, userId }) => {
|
||||
item.Type === BaseItemKind.Episode
|
||||
? `S${item.ParentIndexNumber}:E${item.IndexNumber} - ${item.Name}`
|
||||
: item.Type === BaseItemKind.Series
|
||||
? `${item.ProductionYear} - ${
|
||||
? `${item.ProductionYear} - ${
|
||||
item.EndDate
|
||||
? new Date(item.EndDate).toLocaleString([], {
|
||||
year: "numeric",
|
||||
})
|
||||
})
|
||||
: "Present"
|
||||
}`
|
||||
: item.ProductionYear
|
||||
}`
|
||||
: item.ProductionYear
|
||||
}
|
||||
disableOverlay={
|
||||
item.Type === BaseItemKind.Person ||
|
||||
@@ -79,7 +83,7 @@ const GenreView = ({ libraryId, genreId, genreName, userId }) => {
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
</cardScroller.CardScroller>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import { useQuery } from "@tanstack/react-query";
|
||||
import { getRuntimeCompact, getRuntimeMusic } from "@/utils/date/time";
|
||||
|
||||
import { Card } from "@/components/card/card";
|
||||
import { CardScroller } from "@/components/cardScroller/cardScroller";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import PlayButton from "@/components/buttons/playButton";
|
||||
|
||||
@@ -22,7 +22,7 @@ import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api"
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { Card } from "@/components/card/card";
|
||||
import { CardScroller } from "@/components/cardScroller/cardScroller";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import ShowMoreText from "@/components/showMoreText";
|
||||
|
||||
@@ -30,7 +30,7 @@ import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import heroBg from "@/assets/herobg.png";
|
||||
import { Card } from "@/components/card/card";
|
||||
import { CardScroller } from "@/components/cardScroller/cardScroller";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import MarkPlayedButton from "@/components/buttons/markPlayedButton";
|
||||
|
||||
@@ -7,12 +7,12 @@ import { useQuery } from "@tanstack/react-query";
|
||||
import "./favorite.scss";
|
||||
|
||||
import { Card } from "@/components/card/card";
|
||||
import { CardScroller } from "@/components/cardScroller/cardScroller";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { BaseItemKind } 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 { createFileRoute } from "@tanstack/react-router";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
|
||||
export const Route = createFileRoute("/_api/favorite/")({
|
||||
component: FavoritePage,
|
||||
|
||||
@@ -8,7 +8,7 @@ import Carousel from "@/components/carousel";
|
||||
|
||||
// Custom Components
|
||||
import { Card } from "@/components/card/card";
|
||||
import { CardScroller } from "@/components/cardScroller/cardScroller";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
import { LatestMediaSection } from "@/components/layouts/homeSection/latestMediaSection";
|
||||
import { CardsSkeleton } from "@/components/skeleton/cards";
|
||||
import { CarouselSkeleton } from "@/components/skeleton/carousel";
|
||||
|
||||
@@ -30,7 +30,7 @@ import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
||||
|
||||
import heroBg from "@/assets/herobg.png";
|
||||
import { Card } from "@/components/card/card";
|
||||
import { CardScroller } from "@/components/cardScroller/cardScroller";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
|
||||
import "./item.scss";
|
||||
|
||||
|
||||
@@ -13,14 +13,14 @@ import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api"
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { Card } from "@/components/card/card";
|
||||
import { CardScroller } from "@/components/cardScroller/cardScroller";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
|
||||
import MusicTrack from "@/components/musicTrack";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import "./playlist.scss";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
function TabPanel(props) {
|
||||
const { children, value, index, ...other } = props;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import useDebounce from "@/utils/hooks/useDebounce";
|
||||
|
||||
import { Card } from "@/components/card/card";
|
||||
import { EpisodeCard } from "@/components/card/episodeCard";
|
||||
import { CardScroller } from "@/components/cardScroller/cardScroller";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getPersonsApi } from "@jellyfin/sdk/lib/utils/api/persons-api";
|
||||
@@ -263,14 +263,14 @@ function SearchPage() {
|
||||
<CardScroller title="Episodes" displayCards={4} disableDecoration>
|
||||
{episodes.data.SearchHints?.map((episode) => {
|
||||
return (
|
||||
<EpisodeCard
|
||||
<Card
|
||||
key={episode.Id}
|
||||
item={episode}
|
||||
cardTitle={episode.Series}
|
||||
cardType="thumb"
|
||||
cardCaption={`S${episode.ParentIndexNumber}:E${episode.IndexNumber} - ${episode.Name}`}
|
||||
queryKey={["search", "items", "Episodes", query]}
|
||||
userId={user?.Id}
|
||||
disableRunTime
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -41,8 +41,7 @@ import {
|
||||
} from "@/utils/date/time";
|
||||
|
||||
import { Card } from "@/components/card/card";
|
||||
import { EpisodeCard } from "@/components/card/episodeCard";
|
||||
import { CardScroller } from "@/components/cardScroller/cardScroller";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import "./series.scss";
|
||||
@@ -885,33 +884,6 @@ function SeriesTitlePage() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{nextUpEpisode.isSuccess && nextUpEpisode.data.TotalRecordCount > 0 && (
|
||||
<CardScroller title="Next Up" displayCards={4} disableDecoration>
|
||||
{nextUpEpisode.data.Items.map((episode) => {
|
||||
return (
|
||||
<EpisodeCard
|
||||
key={episode.Id}
|
||||
item={episode}
|
||||
cardTitle={`S${episode.ParentIndexNumber}:E${episode.IndexNumber} - ${episode.Name}`}
|
||||
cardCaption={episode.Overview}
|
||||
imageBlurhash={
|
||||
episode.ImageBlurHashes?.Primary[
|
||||
Object.keys(episode.ImageBlurHashes.Primary)[0]
|
||||
]
|
||||
}
|
||||
queryKey={[
|
||||
"item",
|
||||
id,
|
||||
`season ${currentSeason + 1}`,
|
||||
"episodes",
|
||||
]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
|
||||
{seasons.isPending ? (
|
||||
<SeasonSelectorSkeleton />
|
||||
) : (
|
||||
|
||||
Reference in new issue
Block a user