Add ActorCards and fix episodeCards size issue #160
This commit is contained in:
6 files changed
+19
-116
No files matched your search
@@ -18,6 +18,7 @@ import LikeButton from "../buttons/likeButton";
|
|||||||
import MarkPlayedButton from "../buttons/markPlayedButton";
|
import MarkPlayedButton from "../buttons/markPlayedButton";
|
||||||
import PlayButton from "../buttons/playButton";
|
import PlayButton from "../buttons/playButton";
|
||||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import { MdiAccountTie } from "../icons/mdiAccountTie";
|
||||||
|
|
||||||
const cardImageAspectRatios = {
|
const cardImageAspectRatios = {
|
||||||
thumb: 1.777,
|
thumb: 1.777,
|
||||||
@@ -32,17 +33,11 @@ const availableSpecialRoutes = [BaseItemKind.Series];
|
|||||||
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemDto} item
|
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemDto} item
|
||||||
* @property {string} cardTitle
|
* @property {string} cardTitle
|
||||||
* @property {string | number} cardCaption
|
* @property {string | number} cardCaption
|
||||||
* @property {string} imageType
|
|
||||||
* @property {string} imageBlurhash
|
* @property {string} imageBlurhash
|
||||||
* @property {string} cardType
|
|
||||||
* @property {Array} queryKey
|
|
||||||
* @property {string} userId
|
|
||||||
* @property {string} seriesId
|
* @property {string} seriesId
|
||||||
* @property {boolean} hideText
|
* @property {boolean} hideText
|
||||||
* @property {() => {}} onClick
|
* @property {() => {}} onClick
|
||||||
* @property {boolean} disableOverlay
|
|
||||||
* @property {boolean} disablePadding
|
* @property {boolean} disablePadding
|
||||||
* @property {any} overrideIcon
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,17 +50,11 @@ export const ActorCard = ({
|
|||||||
item,
|
item,
|
||||||
cardTitle,
|
cardTitle,
|
||||||
cardCaption,
|
cardCaption,
|
||||||
imageType = "Primary",
|
|
||||||
imageBlurhash,
|
imageBlurhash,
|
||||||
cardType,
|
|
||||||
queryKey,
|
|
||||||
userId,
|
|
||||||
seriesId,
|
seriesId,
|
||||||
hideText,
|
hideText,
|
||||||
onClick,
|
onClick,
|
||||||
disableOverlay = false,
|
|
||||||
disablePadding,
|
disablePadding,
|
||||||
overrideIcon,
|
|
||||||
}) => {
|
}) => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const defaultOnClick = () => {
|
const defaultOnClick = () => {
|
||||||
@@ -84,48 +73,14 @@ export const ActorCard = ({
|
|||||||
className="card-container"
|
className="card-container"
|
||||||
onClick={!!onClick ? onClick : defaultOnClick}
|
onClick={!!onClick ? onClick : defaultOnClick}
|
||||||
>
|
>
|
||||||
<MuiCard className="card" elevation={0}>
|
<MuiCard className="card card-actor" elevation={0}>
|
||||||
<div className="card-box">
|
<div className="card-box">
|
||||||
<div
|
<div
|
||||||
className="card-image-container"
|
className="card-image-container"
|
||||||
style={{
|
style={{
|
||||||
aspectRatio: cardImageAspectRatios[cardType],
|
aspectRatio: 1,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{!!item.UserData && (
|
|
||||||
<>
|
|
||||||
<div
|
|
||||||
className="card-indicator check"
|
|
||||||
style={{
|
|
||||||
opacity: item.UserData?.Played
|
|
||||||
? 1
|
|
||||||
: 0,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<MdiCheck />
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
className={`card-indicator text`}
|
|
||||||
style={{
|
|
||||||
opacity: !!item.UserData
|
|
||||||
?.UnplayedItemCount
|
|
||||||
? 1
|
|
||||||
: 0,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Typography
|
|
||||||
variant="subtitle2"
|
|
||||||
padding="0.1em 0.4em"
|
|
||||||
fontWeight={400}
|
|
||||||
>
|
|
||||||
{
|
|
||||||
item.UserData
|
|
||||||
?.UnplayedItemCount
|
|
||||||
}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{!!imageBlurhash && (
|
{!!imageBlurhash && (
|
||||||
<Blurhash
|
<Blurhash
|
||||||
hash={imageBlurhash}
|
hash={imageBlurhash}
|
||||||
@@ -137,26 +92,18 @@ export const ActorCard = ({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<div className="card-image-icon-container">
|
<div className="card-image-icon-container">
|
||||||
{!!overrideIcon
|
<MdiAccountTie className="card-image-icon" />
|
||||||
? TypeIconCollectionCard[overrideIcon]
|
|
||||||
: TypeIconCollectionCard[item.Type]}
|
|
||||||
</div>
|
</div>
|
||||||
<img
|
<img
|
||||||
src={
|
src={window.api.getItemImageUrl(
|
||||||
overrideIcon == "User"
|
!!seriesId ? item.SeriesId : item.Id,
|
||||||
? `${window.api.basePath}/Users/${item.Id}/Images/Primary`
|
"Primary",
|
||||||
: window.api.getItemImageUrl(
|
|
||||||
!!seriesId
|
|
||||||
? item.SeriesId
|
|
||||||
: item.Id,
|
|
||||||
imageType,
|
|
||||||
{
|
{
|
||||||
quality: 90,
|
quality: 90,
|
||||||
fillHeight: 512,
|
fillHeight: 512,
|
||||||
fillWidth: 512,
|
fillWidth: 512,
|
||||||
},
|
},
|
||||||
)
|
)}
|
||||||
}
|
|
||||||
style={{
|
style={{
|
||||||
height: "100%",
|
height: "100%",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
@@ -166,57 +113,6 @@ export const ActorCard = ({
|
|||||||
onLoad={(e) => (e.target.style.opacity = 1)}
|
onLoad={(e) => (e.target.style.opacity = 1)}
|
||||||
className="card-image"
|
className="card-image"
|
||||||
/>
|
/>
|
||||||
{!disableOverlay && (
|
|
||||||
<div className="card-overlay">
|
|
||||||
<PlayButton
|
|
||||||
itemId={item.Id}
|
|
||||||
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>
|
|
||||||
)}
|
|
||||||
{item.UserData?.PlaybackPositionTicks > 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>
|
||||||
<div
|
<div
|
||||||
className="card-text-container"
|
className="card-text-container"
|
||||||
|
|||||||
@@ -112,4 +112,10 @@
|
|||||||
height: unset !important;
|
height: unset !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-actor {
|
||||||
|
.card-image-container {
|
||||||
|
border-radius: 100% !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -179,7 +179,6 @@ export const EpisodeCard = ({
|
|||||||
<Typography
|
<Typography
|
||||||
variant="subtitle1"
|
variant="subtitle1"
|
||||||
fontWeight={500}
|
fontWeight={500}
|
||||||
noWrap
|
|
||||||
textAlign="start"
|
textAlign="start"
|
||||||
style={{ opacity: 0.9 }}
|
style={{ opacity: 0.9 }}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ import { MdiMusic } from "../../components/icons/mdiMusic";
|
|||||||
import { usePlaybackStore } from "../../utils/store/playback";
|
import { usePlaybackStore } from "../../utils/store/playback";
|
||||||
import { Tooltip } from "@mui/material";
|
import { Tooltip } from "@mui/material";
|
||||||
import { useBackdropStore } from "../../utils/store/backdrop";
|
import { useBackdropStore } from "../../utils/store/backdrop";
|
||||||
|
import { ActorCard } from "../../components/card/actorCards";
|
||||||
function TabPanel(props) {
|
function TabPanel(props) {
|
||||||
const { children, value, index, ...other } = props;
|
const { children, value, index, ...other } = props;
|
||||||
|
|
||||||
@@ -609,7 +610,7 @@ const ItemDetail = () => {
|
|||||||
>
|
>
|
||||||
{item.data.People.map((person, index) => {
|
{item.data.People.map((person, index) => {
|
||||||
return (
|
return (
|
||||||
<Card
|
<ActorCard
|
||||||
key={person.Id}
|
key={person.Id}
|
||||||
item={person}
|
item={person}
|
||||||
cardTitle={person.Name}
|
cardTitle={person.Name}
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ import { MdiMusic } from "../../components/icons/mdiMusic";
|
|||||||
import { usePlaybackStore } from "../../utils/store/playback";
|
import { usePlaybackStore } from "../../utils/store/playback";
|
||||||
import { Tooltip } from "@mui/material";
|
import { Tooltip } from "@mui/material";
|
||||||
import { useBackdropStore } from "../../utils/store/backdrop";
|
import { useBackdropStore } from "../../utils/store/backdrop";
|
||||||
|
import { ActorCard } from "../../components/card/actorCards";
|
||||||
function TabPanel(props) {
|
function TabPanel(props) {
|
||||||
const { children, value, index, ...other } = props;
|
const { children, value, index, ...other } = props;
|
||||||
|
|
||||||
@@ -542,7 +543,7 @@ const SeriesTitlePage = () => {
|
|||||||
>
|
>
|
||||||
{item.data.People.map((person, index) => {
|
{item.data.People.map((person, index) => {
|
||||||
return (
|
return (
|
||||||
<Card
|
<ActorCard
|
||||||
key={person.Id}
|
key={person.Id}
|
||||||
item={person}
|
item={person}
|
||||||
cardTitle={person.Name}
|
cardTitle={person.Name}
|
||||||
|
|||||||
@@ -16,6 +16,6 @@
|
|||||||
gap: 0.25em;
|
gap: 0.25em;
|
||||||
margin-top: 0.5em;
|
margin-top: 0.5em;
|
||||||
align-items: start;
|
align-items: start;
|
||||||
justify-items: center;
|
justify-items: stretch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user