Add playback indication in cards and update carousel animation #153
This commit is contained in:
10 files changed
+255
-71
No files matched your search
@@ -0,0 +1,19 @@
|
||||
/** @format */
|
||||
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import { MdiPlayOutline } from "../icons/mdiPlayOutline";
|
||||
|
||||
const PlayButton = ({ className, sx, iconProps }) => {
|
||||
return (
|
||||
<IconButton
|
||||
className={className}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
sx={sx}
|
||||
disabled
|
||||
>
|
||||
<MdiPlayOutline {...iconProps} />
|
||||
</IconButton>
|
||||
);
|
||||
};
|
||||
|
||||
export default PlayButton;
|
||||
@@ -34,6 +34,7 @@ import { MdiHeart } from "../icons/mdiHeart";
|
||||
import useIntersecting from "../../utils/hooks/useIntersecting";
|
||||
import LikeButton from "../buttons/likeButton";
|
||||
import MarkPlayedButton from "../buttons/markPlayedButton";
|
||||
import PlayButton from "../buttons/playButton";
|
||||
|
||||
const cardImageAspectRatios = {
|
||||
thumb: 1.777,
|
||||
@@ -54,6 +55,8 @@ export const Card = ({
|
||||
queryKey,
|
||||
userId,
|
||||
availableImagesTypes,
|
||||
playedProgress = 0,
|
||||
seriesId,
|
||||
|
||||
onClick,
|
||||
disableOverlay = false,
|
||||
@@ -97,8 +100,29 @@ export const Card = ({
|
||||
overflow: "hidden",
|
||||
height: "auto",
|
||||
width: "100%",
|
||||
zIndex: 0,
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
sx={{
|
||||
position: "absolute",
|
||||
top: "0.4em",
|
||||
right: "0.4em",
|
||||
zIndex: 2,
|
||||
background: "rgb(20 20 20 / 0.5)",
|
||||
padding: "0.2em 0.75em",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
borderRadius: "100px",
|
||||
backdropFilter: "blur(5px)",
|
||||
transition: "opacity 250ms",
|
||||
opacity: isPlayed ? 1 : 0,
|
||||
boxShadow: "0 0 5px rgb(0 0 0 / 0.2)",
|
||||
}}
|
||||
>
|
||||
<MdiCheck />
|
||||
</Box>
|
||||
{!!imageBlurhash && (
|
||||
<Blurhash
|
||||
hash={imageBlurhash}
|
||||
@@ -114,7 +138,7 @@ export const Card = ({
|
||||
</Box>
|
||||
<img
|
||||
src={window.api.getItemImageUrl(
|
||||
itemId,
|
||||
!!seriesId ? seriesId : itemId,
|
||||
imageType,
|
||||
{
|
||||
quality: 90,
|
||||
@@ -133,6 +157,12 @@ export const Card = ({
|
||||
/>
|
||||
{!disableOverlay && (
|
||||
<Box className="card-overlay">
|
||||
<PlayButton
|
||||
className="card-play-button"
|
||||
iconProps={{
|
||||
sx: { fontSize: "1.5em" },
|
||||
}}
|
||||
/>
|
||||
<LikeButton
|
||||
itemId={itemId}
|
||||
itemName={itemName}
|
||||
@@ -149,11 +179,29 @@ export const Card = ({
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
{playedProgress != 0 && (
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
value={playedProgress}
|
||||
sx={{
|
||||
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"
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
<Box className="card-text-container" height="15%">
|
||||
<Typography
|
||||
variant="h6"
|
||||
fontWeight={400}
|
||||
variant="subtitle1"
|
||||
fontWeight={500}
|
||||
noWrap
|
||||
textAlign="center"
|
||||
sx={{ opacity: 0.9 }}
|
||||
@@ -161,11 +209,11 @@ export const Card = ({
|
||||
{itemName}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
fontWeight={300}
|
||||
variant="subtitle2"
|
||||
noWrap
|
||||
textAlign="center"
|
||||
sx={{ opacity: 0.6 }}
|
||||
lineHeight="auto"
|
||||
>
|
||||
{secondaryText}
|
||||
</Typography>
|
||||
|
||||
@@ -62,4 +62,11 @@
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
&-play-button {
|
||||
position: absolute !important;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 1;
|
||||
}
|
||||
}
|
||||
@@ -29,21 +29,25 @@ export const CardScroller = ({
|
||||
breakpoint: { max: 4000, min: 3000 },
|
||||
items: displayCards + 1,
|
||||
slidesToSlide: displayCards + 1,
|
||||
partialVisibilityGutter: 40,
|
||||
},
|
||||
desktop: {
|
||||
breakpoint: { max: 3000, min: 625 },
|
||||
items: displayCards,
|
||||
slidesToSlide: displayCards, // optional, default to 1.
|
||||
partialVisibilityGutter: 30,
|
||||
},
|
||||
tablet: {
|
||||
breakpoint: { max: 624, min: 464 },
|
||||
items: displayCards - 2,
|
||||
slidesToSlide: displayCards - 2, // optional, default to 1.
|
||||
partialVisibilityGutter: 20,
|
||||
},
|
||||
mobile: {
|
||||
breakpoint: { max: 464, min: 0 },
|
||||
items: displayCards - 5,
|
||||
slidesToSlide: displayCards - 5, // optional, default to 1.
|
||||
partialVisibilityGutter: 10,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -60,7 +64,7 @@ export const CardScroller = ({
|
||||
}
|
||||
>
|
||||
<Typography
|
||||
variant="h4"
|
||||
variant="h5"
|
||||
color="textPrimary"
|
||||
className="card-scroller-heading"
|
||||
{...headingProps}
|
||||
@@ -89,8 +93,6 @@ export const CardScroller = ({
|
||||
responsive={responsive}
|
||||
arrows={false}
|
||||
ref={(el) => setCarouselRef(el)}
|
||||
// customButtonGroup={<HomeSectionHeader />}
|
||||
// renderButtonGroupOutside={true}
|
||||
className="card-scroller"
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
margin-bottom: 0.25em !important;
|
||||
&-decoration {
|
||||
width: 0.75em;
|
||||
height: 3px;
|
||||
height: 2px;
|
||||
background: white;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,8 @@ const Carousel = ({ content, onChange }) => {
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
transition={{
|
||||
duration: 0.4,
|
||||
duration: 0.25,
|
||||
ease: "easeInOut",
|
||||
}}
|
||||
drag={"x"}
|
||||
dragConstraints={{ left: 0, right: 0 }}
|
||||
|
||||
@@ -110,8 +110,8 @@ const CarouselSlide = ({ item }) => {
|
||||
initial={{
|
||||
transform:
|
||||
animationDirection == "right"
|
||||
? "translateX(20%)"
|
||||
: "translateX(-20%)",
|
||||
? "translateX(10%)"
|
||||
: "translateX(-10%)",
|
||||
opacity: 0,
|
||||
}}
|
||||
animate={{
|
||||
@@ -121,13 +121,14 @@ const CarouselSlide = ({ item }) => {
|
||||
exit={{
|
||||
transform:
|
||||
animationDirection == "right"
|
||||
? "translateX(-20%)"
|
||||
: "translateX(20%)",
|
||||
? "translateX(-10%)"
|
||||
: "translateX(10%)",
|
||||
|
||||
opacity: 0,
|
||||
}}
|
||||
transition={{
|
||||
duration: 0.35,
|
||||
duration: 0.25,
|
||||
ease: "easeInOut",
|
||||
}}
|
||||
className="hero-carousel-detail"
|
||||
>
|
||||
|
||||
@@ -46,8 +46,13 @@ export const LatestMediaSection = ({ latestMediaLib }) => {
|
||||
return (
|
||||
<Card
|
||||
key={index}
|
||||
itemName={item.Name}
|
||||
itemName={
|
||||
item.Type == BaseItemKind.Episode
|
||||
? item.SeriesName
|
||||
: item.Name
|
||||
}
|
||||
itemId={item.Id}
|
||||
seriesId={item.SeriesId}
|
||||
itemType={item.Type}
|
||||
imageType="Primary"
|
||||
cardType={
|
||||
@@ -56,9 +61,29 @@ export const LatestMediaSection = ({ latestMediaLib }) => {
|
||||
? "square"
|
||||
: "portrait"
|
||||
}
|
||||
secondaryText={item.ProductionYear}
|
||||
secondaryText={
|
||||
item.Type == BaseItemKind.Episode
|
||||
? `S${item.ParentIndexNumber}:E${item.IndexNumber} - ${item.Name}`
|
||||
: item.Type == BaseItemKind.Series
|
||||
? `${item.ProductionYear} - ${
|
||||
!!item.EndDate
|
||||
? new Date(
|
||||
item.EndDate,
|
||||
).toLocaleString(
|
||||
[],
|
||||
{
|
||||
year: "numeric",
|
||||
},
|
||||
)
|
||||
: "Present"
|
||||
}`
|
||||
: item.ProductionYear
|
||||
}
|
||||
isFavorite={item.UserData.IsFavorite}
|
||||
queryKey={["home", "resume", "video"]}
|
||||
queryKey={[
|
||||
"homeSection, latestMedia",
|
||||
latestMediaLib,
|
||||
]}
|
||||
isPlayed={item.UserData.Played}
|
||||
userId={user.data.Id}
|
||||
imageBlurhash={
|
||||
@@ -68,6 +93,9 @@ export const LatestMediaSection = ({ latestMediaLib }) => {
|
||||
)[0]
|
||||
]
|
||||
}
|
||||
playedProgress={
|
||||
item.UserData.PlayedPercentage
|
||||
}
|
||||
></Card>
|
||||
);
|
||||
})}
|
||||
|
||||
Reference in new issue
Block a user