feat: add new last media layout
This commit is contained in:
8 files changed
+326
-289
No files matched your search
@@ -1,15 +1,42 @@
|
|||||||
.carousel {
|
.carousel {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 64vh;
|
overflow: hidden;
|
||||||
width: calc(100% + 2*$page-margin);
|
height: 62vh;
|
||||||
left: -$page-margin;
|
margin-bottom: 2em;
|
||||||
margin-bottom: 3.2em;
|
display: grid;
|
||||||
.slider {
|
grid-template-areas: "main sidebar";
|
||||||
position: absolute;
|
grid-template-columns: 1fr 25vw;
|
||||||
bottom: 0;
|
gap: 1em;
|
||||||
max-width: 35%;
|
|
||||||
right: $page-margin;
|
&-sidebar {
|
||||||
|
overflow-y: auto;
|
||||||
|
height: inherit;
|
||||||
|
background: rgb(0 0 0 / 0.2);
|
||||||
|
border-radius: 20px;
|
||||||
|
border: 1.2px solid rgb(255 255 255 / 0.1);
|
||||||
|
grid-area: sidebar;
|
||||||
|
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
width: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&::-webkit-scrollbar-track {
|
||||||
|
background: transparent;
|
||||||
|
margin-block: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::-webkit-scrollbar-thumb {
|
||||||
|
background-color: rgba(255, 255, 255, 0.2);
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 4px solid transparent;
|
||||||
|
background-clip: content-box;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: rgba(255, 255, 255, 0.4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&-button {
|
&-button {
|
||||||
position: absolute !important;
|
position: absolute !important;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
@@ -25,6 +52,38 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-ticker{
|
||||||
|
overflow: hidden;
|
||||||
|
height: 8em;
|
||||||
|
display: flex;
|
||||||
|
// margin-bottom: 1em;
|
||||||
|
padding: 1em;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1em;
|
||||||
|
border-bottom: 1px solid rgb(255 255 255 / 0.1);
|
||||||
|
transition: background $transition-time-fast;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: rgb(0 0 0 / .25);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background: rgb(255 255 255 / 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
&-image {
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 4px;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&-indicator {
|
&-indicator {
|
||||||
aspect-ratio: 1.77777;
|
aspect-ratio: 1.77777;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@@ -44,14 +103,14 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
&-image {
|
&-image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-icon {
|
&-icon {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -59,7 +118,7 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
background: rgb(155 155 155 / 0.4);
|
background: rgb(155 155 155 / 0.4);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
&.active {
|
&.active {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +1,20 @@
|
|||||||
import { AnimatePresence, motion } from "motion/react";
|
import { AnimatePresence } from "motion/react";
|
||||||
import type { PanInfo } from "motion/react";
|
import React, { useCallback, useEffect, useState } from "react";
|
||||||
import React, { useEffect, useState, useMemo, useCallback } from "react";
|
|
||||||
import type { MouseEvent, PointerEvent } from "react";
|
|
||||||
|
|
||||||
import { useCarouselStore } from "../../utils/store/carousel";
|
import { useCarouselStore } from "../../utils/store/carousel";
|
||||||
import "./carousel.scss";
|
import "./carousel.scss";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import {
|
||||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
type BaseItemDto,
|
||||||
import CarouselSlide from "../carouselSlide";
|
BaseItemKind,
|
||||||
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import Slider from "../Slider";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { getTypeIcon } from "../utils/iconsCollection";
|
import CarouselSlide from "../carouselSlide";
|
||||||
|
import CarouselTickers from "./tickers";
|
||||||
const swipeConfidenceThreshold = 8000;
|
|
||||||
const swipePower = (offset: number, velocity: number) => {
|
|
||||||
return Math.abs(offset) * velocity;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Memoize CarouselSlide to prevent unnecessary re-renders
|
// Memoize CarouselSlide to prevent unnecessary re-renders
|
||||||
const MemoizedCarouselSlide = React.memo(CarouselSlide);
|
const MemoizedCarouselSlide = React.memo(CarouselSlide);
|
||||||
|
|
||||||
// Memoize Slider to prevent unnecessary re-renders
|
|
||||||
const MemoizedSlider = React.memo(Slider);
|
|
||||||
|
|
||||||
const Carousel = ({
|
const Carousel = ({
|
||||||
content,
|
content,
|
||||||
onChange,
|
onChange,
|
||||||
@@ -41,112 +32,50 @@ const Carousel = ({
|
|||||||
|
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
|
|
||||||
// Memoize the content mapping
|
const handleTickerClick = useCallback(
|
||||||
const sliderContent = useMemo(() => {
|
(index: number) => {
|
||||||
return content.map((item, index) => {
|
if (index === currentSlide) return;
|
||||||
return (
|
setDirection(index > currentSlide ? "right" : "left");
|
||||||
<motion.div
|
|
||||||
className={
|
|
||||||
currentSlide === index
|
|
||||||
? "carousel-indicator active"
|
|
||||||
: "carousel-indicator"
|
|
||||||
}
|
|
||||||
layout
|
|
||||||
initial={{
|
|
||||||
height: "4.6em",
|
|
||||||
}}
|
|
||||||
whileHover={{
|
|
||||||
height: "5.5em",
|
|
||||||
}}
|
|
||||||
transition={{
|
|
||||||
duration: 0.05,
|
|
||||||
}}
|
|
||||||
key={item.Id}
|
|
||||||
onClick={() => {
|
|
||||||
if (currentSlide > index) {
|
|
||||||
setDirection("left");
|
|
||||||
} else if (currentSlide <= index) {
|
|
||||||
setDirection("right");
|
|
||||||
}
|
|
||||||
setCurrentSlide(index);
|
setCurrentSlide(index);
|
||||||
}}
|
|
||||||
>
|
|
||||||
{item.ImageTags?.Thumb ? (
|
|
||||||
<img
|
|
||||||
src={
|
|
||||||
api &&
|
|
||||||
getImageUrlsApi(api).getItemImageUrlById(
|
|
||||||
item.Id ?? "",
|
|
||||||
"Thumb",
|
|
||||||
{
|
|
||||||
tag: item.ImageTags.Primary,
|
|
||||||
fillWidth: 300,
|
|
||||||
},
|
},
|
||||||
)
|
[currentSlide, setDirection],
|
||||||
}
|
|
||||||
alt={item.Name ?? "item-image"}
|
|
||||||
className="carousel-indicator-image"
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<div className="carousel-indicator-icon">
|
|
||||||
{getTypeIcon(item.Type ?? "Movie")}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</motion.div>
|
|
||||||
);
|
);
|
||||||
});
|
|
||||||
}, [content, currentSlide, api, setDirection]);
|
|
||||||
|
|
||||||
const handleDragEnd = useCallback(
|
if (!api) return null;
|
||||||
(
|
|
||||||
_: MouseEvent | TouchEvent | PointerEvent,
|
|
||||||
{ offset, velocity }: PanInfo,
|
|
||||||
) => {
|
|
||||||
const swipe = swipePower(offset.x, velocity.x);
|
|
||||||
if (
|
|
||||||
currentSlide !== content.length - 1 &&
|
|
||||||
swipe < -swipeConfidenceThreshold
|
|
||||||
) {
|
|
||||||
setDirection("right");
|
|
||||||
setCurrentSlide((init) => init + 1);
|
|
||||||
} else if (currentSlide !== 0 && swipe > swipeConfidenceThreshold) {
|
|
||||||
setDirection("left");
|
|
||||||
setCurrentSlide((init) => init - 1);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[currentSlide, content.length, setDirection],
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="carousel">
|
<div className="carousel">
|
||||||
<AnimatePresence mode="sync">
|
<AnimatePresence mode="sync">
|
||||||
<motion.div
|
|
||||||
key={currentSlide}
|
|
||||||
initial={{ opacity: 0 }}
|
|
||||||
animate={{ opacity: 1 }}
|
|
||||||
exit={{ opacity: 0 }}
|
|
||||||
transition={{
|
|
||||||
duration: 0.25,
|
|
||||||
ease: "linear",
|
|
||||||
}}
|
|
||||||
drag={"x"}
|
|
||||||
dragConstraints={{ left: 0, right: 0 }}
|
|
||||||
dragElastic={1}
|
|
||||||
//@ts-ignore
|
|
||||||
onDragEnd={handleDragEnd}
|
|
||||||
style={{
|
|
||||||
height: "100%",
|
|
||||||
width: "100%",
|
|
||||||
position: "absolute",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<MemoizedCarouselSlide
|
<MemoizedCarouselSlide
|
||||||
item={content[currentSlide]}
|
item={content[currentSlide]}
|
||||||
key={content[currentSlide].Id}
|
key={content[currentSlide].Id}
|
||||||
/>
|
/>
|
||||||
</motion.div>
|
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
<MemoizedSlider currentSlide={currentSlide} content={sliderContent} />
|
<div className="carousel-sidebar">
|
||||||
|
{content.map((item, index) => (
|
||||||
|
<CarouselTickers
|
||||||
|
key={item.Id}
|
||||||
|
imageUrl={
|
||||||
|
getImageUrlsApi(api).getItemImageUrlById(
|
||||||
|
item.Id ?? "",
|
||||||
|
"Primary",
|
||||||
|
{
|
||||||
|
quality: 90,
|
||||||
|
fillWidth: 360,
|
||||||
|
},
|
||||||
|
) ?? undefined
|
||||||
|
}
|
||||||
|
isActive={index === currentSlide}
|
||||||
|
itemName={item.Name ?? "Unknown"}
|
||||||
|
itemYear={
|
||||||
|
item.Type === BaseItemKind.Series && item.EndDate
|
||||||
|
? `${item.ProductionYear ?? ""} - ${new Date(item.EndDate).getFullYear().toString()}`
|
||||||
|
: (item.ProductionYear?.toString() ?? "")
|
||||||
|
}
|
||||||
|
onClick={() => handleTickerClick(index)}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import { Typography } from "@mui/material";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
type CarouselTickersProps = {
|
||||||
|
imageUrl?: string;
|
||||||
|
itemName: string;
|
||||||
|
itemYear: string;
|
||||||
|
onClick: () => void;
|
||||||
|
isActive: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
const CarouselTickers = ({
|
||||||
|
imageUrl,
|
||||||
|
itemName,
|
||||||
|
itemYear,
|
||||||
|
onClick,
|
||||||
|
isActive,
|
||||||
|
}: CarouselTickersProps) => {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={`carousel-ticker${isActive ? " active" : ""}`}
|
||||||
|
onClick={onClick}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src={imageUrl}
|
||||||
|
alt={itemName}
|
||||||
|
className="carousel-ticker-image"
|
||||||
|
// style={{ width: "5em", height: "100%", objectFit: "cover" }}
|
||||||
|
/>
|
||||||
|
<div>
|
||||||
|
<Typography variant="subtitle1" className="carousel-ticker-title">
|
||||||
|
{itemName}
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="caption" className="carousel-ticker-year">
|
||||||
|
{itemYear}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default CarouselTickers;
|
||||||
@@ -1,29 +1,47 @@
|
|||||||
import React from "react";
|
|
||||||
|
|
||||||
import { motion } from "motion/react";
|
|
||||||
|
|
||||||
import Button from "@mui/material/Button";
|
|
||||||
import Chip from "@mui/material/Chip";
|
|
||||||
import Stack from "@mui/material/Stack";
|
|
||||||
import Typography from "@mui/material/Typography";
|
|
||||||
|
|
||||||
import { yellow } from "@mui/material/colors";
|
|
||||||
|
|
||||||
import { endsAt, getRuntime } from "@/utils/date/time";
|
|
||||||
import { green, red } from "@mui/material/colors";
|
|
||||||
import { useNavigate } from "@tanstack/react-router";
|
|
||||||
import { getTypeIcon } from "../utils/iconsCollection";
|
|
||||||
|
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
|
||||||
import { useCarouselStore } from "@/utils/store/carousel";
|
|
||||||
import { useCentralStore } from "@/utils/store/central";
|
|
||||||
import {
|
import {
|
||||||
type BaseItemDto,
|
type BaseItemDto,
|
||||||
BaseItemKind,
|
BaseItemKind,
|
||||||
} from "@jellyfin/sdk/lib/generated-client";
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
|
import Button from "@mui/material/Button";
|
||||||
|
import Chip from "@mui/material/Chip";
|
||||||
|
import { green, red, yellow } from "@mui/material/colors";
|
||||||
|
import Stack from "@mui/material/Stack";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
|
import { motion } from "motion/react";
|
||||||
|
import React from "react";
|
||||||
|
import { endsAt, getRuntime } from "@/utils/date/time";
|
||||||
|
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
import { useCarouselStore } from "@/utils/store/carousel";
|
||||||
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import LikeButton from "../buttons/likeButton";
|
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 { getTypeIcon } from "../utils/iconsCollection";
|
||||||
|
|
||||||
|
const textVariants = {
|
||||||
|
initial: (direction: string) => ({
|
||||||
|
x: direction === "right" ? 40 : -40,
|
||||||
|
opacity: 0,
|
||||||
|
}),
|
||||||
|
animate: {
|
||||||
|
x: 0,
|
||||||
|
opacity: 1,
|
||||||
|
transition: {
|
||||||
|
duration: 0.35,
|
||||||
|
ease: [0.2, 0, 0, 1],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
exit: (direction: string) => ({
|
||||||
|
x: direction === "right" ? -40 : 40,
|
||||||
|
opacity: 0,
|
||||||
|
transition: {
|
||||||
|
duration: 0.2,
|
||||||
|
ease: "easeInOut",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
||||||
const api = useApiInContext((s) => s.api);
|
const api = useApiInContext((s) => s.api);
|
||||||
@@ -66,7 +84,13 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="hero-carousel-slide">
|
<div className="hero-carousel-slide">
|
||||||
<div className="hero-carousel-background-container">
|
<motion.div
|
||||||
|
className="hero-carousel-background-container"
|
||||||
|
initial={{ opacity: 0 }}
|
||||||
|
animate={{ opacity: 1 }}
|
||||||
|
exit={{ opacity: 0 }}
|
||||||
|
transition={{ duration: 0.4, ease: "easeInOut" }}
|
||||||
|
>
|
||||||
{item.BackdropImageTags?.length ? (
|
{item.BackdropImageTags?.length ? (
|
||||||
<img
|
<img
|
||||||
alt={item.Name ?? "item"}
|
alt={item.Name ?? "item"}
|
||||||
@@ -89,39 +113,39 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
|||||||
{getTypeIcon(item.Type ?? "Movie")}
|
{getTypeIcon(item.Type ?? "Movie")}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</motion.div>
|
||||||
<div className="hero-carousel-detail">
|
<motion.div
|
||||||
|
className="hero-carousel-detail"
|
||||||
|
initial="initial"
|
||||||
|
animate="animate"
|
||||||
|
exit="exit"
|
||||||
|
variants={{
|
||||||
|
animate: {
|
||||||
|
transition: {
|
||||||
|
staggerChildren: 0.05,
|
||||||
|
delayChildren: 0.05,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
exit: {
|
||||||
|
transition: {
|
||||||
|
staggerChildren: 0.02,
|
||||||
|
staggerDirection: -1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{/* @ts-ignore */}
|
||||||
<Typography
|
<Typography
|
||||||
component={motion.div}
|
component={motion.div}
|
||||||
initial={{
|
custom={animationDirection}
|
||||||
transform:
|
variants={textVariants}
|
||||||
animationDirection === "right"
|
|
||||||
? "translateX(60px)"
|
|
||||||
: "translateX(-60px)",
|
|
||||||
opacity: 0,
|
|
||||||
}}
|
|
||||||
animate={{
|
|
||||||
transform: "translateX(0px)",
|
|
||||||
opacity: 1,
|
|
||||||
}}
|
|
||||||
exit={{
|
|
||||||
transform:
|
|
||||||
animationDirection === "right"
|
|
||||||
? "translateX(-60px)"
|
|
||||||
: "translateX(60px)",
|
|
||||||
opacity: 0,
|
|
||||||
}}
|
|
||||||
transition={{
|
|
||||||
duration: 0.25,
|
|
||||||
ease: "easeInOut",
|
|
||||||
}}
|
|
||||||
key={item.Id}
|
key={item.Id}
|
||||||
variant="h2"
|
variant="h2"
|
||||||
className="hero-carousel-text"
|
className="hero-carousel-text"
|
||||||
sx={{
|
sx={{
|
||||||
mb: "5px",
|
mb: "5px",
|
||||||
}}
|
}}
|
||||||
fontWeight={200}
|
fontWeight={600}
|
||||||
overflow="visible"
|
overflow="visible"
|
||||||
>
|
>
|
||||||
{!item.ImageTags?.Logo ? (
|
{!item.ImageTags?.Logo ? (
|
||||||
@@ -142,31 +166,11 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
{/* @ts-ignore */}
|
||||||
<Stack
|
<Stack
|
||||||
component={motion.div}
|
component={motion.div}
|
||||||
initial={{
|
custom={animationDirection}
|
||||||
transform:
|
variants={textVariants}
|
||||||
animationDirection === "right"
|
|
||||||
? "translateX(20px)"
|
|
||||||
: "translateX(-20px)",
|
|
||||||
opacity: 0,
|
|
||||||
}}
|
|
||||||
animate={{
|
|
||||||
transform: "translateX(0px)",
|
|
||||||
opacity: 1,
|
|
||||||
}}
|
|
||||||
exit={{
|
|
||||||
transform:
|
|
||||||
animationDirection === "right"
|
|
||||||
? "translateX(-20px)"
|
|
||||||
: "translateX(20px)",
|
|
||||||
|
|
||||||
opacity: 0,
|
|
||||||
}}
|
|
||||||
transition={{
|
|
||||||
duration: 0.25,
|
|
||||||
ease: "easeInOut",
|
|
||||||
}}
|
|
||||||
direction="row"
|
direction="row"
|
||||||
gap={2}
|
gap={2}
|
||||||
className="hero-carousel-info"
|
className="hero-carousel-info"
|
||||||
@@ -176,7 +180,7 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
|||||||
>
|
>
|
||||||
{item.PremiereDate && (
|
{item.PremiereDate && (
|
||||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||||
{item.ProductionYear}
|
{item.ProductionYear ?? ""}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
{item.OfficialRating && (
|
{item.OfficialRating && (
|
||||||
@@ -239,82 +243,49 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{item.RunTimeTicks ? (
|
{item.RunTimeTicks && (
|
||||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||||
{getRuntime(item.RunTimeTicks)}
|
{getRuntime(item.RunTimeTicks)}
|
||||||
</Typography>
|
</Typography>
|
||||||
) : (
|
|
||||||
<></>
|
|
||||||
)}
|
)}
|
||||||
{item.RunTimeTicks ? (
|
{item.RunTimeTicks && (
|
||||||
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
<Typography style={{ opacity: "0.8" }} variant="subtitle2">
|
||||||
{endsAt(
|
{endsAt(
|
||||||
item.RunTimeTicks - (item.UserData?.PlaybackPositionTicks ?? 0),
|
item.RunTimeTicks - (item.UserData?.PlaybackPositionTicks ?? 0),
|
||||||
)}
|
)}
|
||||||
</Typography>
|
</Typography>
|
||||||
) : (
|
|
||||||
<></>
|
|
||||||
)}
|
)}
|
||||||
<Typography variant="subtitle2" style={{ opacity: 0.8 }}>
|
<Typography variant="subtitle2" style={{ opacity: 0.8 }}>
|
||||||
{item.Genres?.slice(0, 4).join(" / ")}
|
{item.Genres?.slice(0, 4).join(" / ")}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
{/* @ts-ignore */}
|
||||||
<Typography
|
<Typography
|
||||||
component={motion.div}
|
component={motion.div}
|
||||||
initial={{
|
custom={animationDirection}
|
||||||
transform:
|
variants={textVariants}
|
||||||
animationDirection === "right"
|
className="hero-carousel-overview"
|
||||||
? "translateX(20px)"
|
variant="body1"
|
||||||
: "translateX(-20px)",
|
fontWeight={400}
|
||||||
opacity: 0,
|
|
||||||
}}
|
|
||||||
animate={{
|
|
||||||
transform: "translateX(0px)",
|
|
||||||
opacity: 1,
|
|
||||||
}}
|
|
||||||
exit={{
|
|
||||||
transform:
|
|
||||||
animationDirection === "right"
|
|
||||||
? "translateX(-20px)"
|
|
||||||
: "translateX(20px)",
|
|
||||||
|
|
||||||
opacity: 0,
|
|
||||||
}}
|
|
||||||
transition={{
|
|
||||||
duration: 0.25,
|
|
||||||
ease: "easeInOut",
|
|
||||||
}}
|
|
||||||
className="hero-carousel-text"
|
|
||||||
sx={{
|
|
||||||
display: "-webkit-box",
|
|
||||||
maxWidth: "70%",
|
|
||||||
maxHeight: "50%",
|
|
||||||
textOverflow: "ellipsis",
|
|
||||||
overflow: "hidden",
|
|
||||||
WebkitLineClamp: "4",
|
|
||||||
WebkitBoxOrient: "vertical",
|
|
||||||
}}
|
|
||||||
variant="subtitle2"
|
|
||||||
fontWeight={300}
|
|
||||||
>
|
>
|
||||||
{item.Overview}
|
{item.Overview}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
|
{/* @ts-ignore */}
|
||||||
<Stack
|
<Stack
|
||||||
mt={3}
|
|
||||||
direction="row"
|
direction="row"
|
||||||
gap={3}
|
gap={2}
|
||||||
width="100%"
|
width="100%"
|
||||||
className="hero-carousel-button-container"
|
className="hero-carousel-button-container"
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
|
component={motion.div}
|
||||||
|
custom={animationDirection}
|
||||||
|
variants={textVariants}
|
||||||
>
|
>
|
||||||
<PlayButton
|
<PlayButton
|
||||||
item={item}
|
item={item}
|
||||||
userId={user?.Id}
|
userId={user?.Id}
|
||||||
itemType={item.Type ?? "Movie"}
|
itemType={item.Type ?? "Movie"}
|
||||||
currentAudioTrack={0}
|
|
||||||
currentSubTrack={0}
|
|
||||||
currentVideoTrack={0}
|
|
||||||
buttonProps={{
|
buttonProps={{
|
||||||
size: "large",
|
size: "large",
|
||||||
}}
|
}}
|
||||||
@@ -330,7 +301,7 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
size="large"
|
size="large"
|
||||||
//@ts-ignore
|
//@ts-expect-error
|
||||||
color="white"
|
color="white"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
endIcon={
|
endIcon={
|
||||||
@@ -364,7 +335,7 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
|
|||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
</div>
|
</motion.div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import Chip from "@mui/material/Chip";
|
|||||||
import { green, red, yellow } from "@mui/material/colors";
|
import { green, red, yellow } from "@mui/material/colors";
|
||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
import { Link } from "@tanstack/react-router";
|
||||||
import React, { type ReactNode, type RefObject } from "react";
|
import React, { type ReactNode, type RefObject } from "react";
|
||||||
import { Blurhash } from "react-blurhash";
|
import { Blurhash } from "react-blurhash";
|
||||||
import heroBg from "@/assets/herobg.png";
|
import heroBg from "@/assets/herobg.png";
|
||||||
@@ -26,7 +27,6 @@ import { getTypeIcon } from "@/components/utils/iconsCollection";
|
|||||||
import { endsAt, getRuntime } from "@/utils/date/time";
|
import { endsAt, getRuntime } from "@/utils/date/time";
|
||||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import type MediaQualityInfo from "@/utils/types/mediaQualityInfo";
|
import type MediaQualityInfo from "@/utils/types/mediaQualityInfo";
|
||||||
import { Link } from "@tanstack/react-router";
|
|
||||||
import "./itemHeader.scss";
|
import "./itemHeader.scss";
|
||||||
|
|
||||||
interface ItemHeaderProps {
|
interface ItemHeaderProps {
|
||||||
@@ -54,8 +54,6 @@ const ItemHeader = ({
|
|||||||
? (item.ParentBackdropItemId ?? item.Id)
|
? (item.ParentBackdropItemId ?? item.Id)
|
||||||
: item.Id;
|
: item.Id;
|
||||||
|
|
||||||
// @ts-expect-error - ParentLogoImageTag is not in the type definition
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
const parentLogoImageTag =
|
const parentLogoImageTag =
|
||||||
(item as any).ParentLogoImageTag || (item as any).ParentLogoImageTags?.[0];
|
(item as any).ParentLogoImageTag || (item as any).ParentLogoImageTags?.[0];
|
||||||
const logoTag =
|
const logoTag =
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { getRuntimeMusic } from "@/utils/date/time";
|
|||||||
interface PlayerProgressProps {
|
interface PlayerProgressProps {
|
||||||
progress: number;
|
progress: number;
|
||||||
duration: number;
|
duration: number;
|
||||||
onSeek: (value: number) => void;
|
onSeek?: (value: number) => void;
|
||||||
onSeekCommit: (value: number) => void;
|
onSeekCommit: (value: number) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ const PlayerProgress = ({
|
|||||||
setIsScrubbing(true);
|
setIsScrubbing(true);
|
||||||
const newValue = Array.isArray(value) ? value[0] : value;
|
const newValue = Array.isArray(value) ? value[0] : value;
|
||||||
setSliderValue(newValue);
|
setSliderValue(newValue);
|
||||||
onSeek(newValue);
|
onSeek?.(newValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleChangeCommitted = (_: unknown, value: number | number[]) => {
|
const handleChangeCommitted = (_: unknown, value: number | number[]) => {
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ const AudioPlayer = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (display) {
|
if (display) {
|
||||||
setAudioRef(audioRef);
|
setAudioRef(audioRef);
|
||||||
|
|
||||||
if (audioRef.current) {
|
if (audioRef.current) {
|
||||||
audioRef.current.volume = isMuted ? 0 : volume;
|
audioRef.current.volume = isMuted ? 0 : volume;
|
||||||
}
|
}
|
||||||
@@ -214,7 +215,7 @@ const AudioPlayer = () => {
|
|||||||
<PlayerInfo
|
<PlayerInfo
|
||||||
item={item}
|
item={item}
|
||||||
api={api}
|
api={api}
|
||||||
trackName={tracks?.[currentTrack]?.Name}
|
trackName={tracks?.[currentTrack]?.Name ?? "Unknown Track"}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<audio
|
<audio
|
||||||
|
|||||||
@@ -3,37 +3,47 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
isolation: isolate;
|
isolation: isolate;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
&-slide {
|
&-slide {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: visible;
|
overflow: hidden;
|
||||||
margin: 0 auto;
|
margin: 0;
|
||||||
border: none;
|
border: none;
|
||||||
// box-shadow: 0 0 30px black !important;
|
border-radius: 20px;
|
||||||
|
grid-area: main;
|
||||||
|
border: 1.2px solid rgb(255 255 255 / 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
&-background {
|
&-background {
|
||||||
&-blurhash {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
position: absolute;
|
|
||||||
z-index: 1;
|
|
||||||
filter: brightness(0.4);
|
|
||||||
}
|
|
||||||
&-container {
|
&-container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
top: -4.4em;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
height: 90vh;
|
bottom: 0;
|
||||||
filter: brightness(0.8);
|
height: 100%;
|
||||||
mask-image: linear-gradient(to left, black 50%, transparent), linear-gradient(to bottom, black 60%, transparent);
|
|
||||||
-webkit-mask-image: linear-gradient(to left,
|
// Gradient overlay to make text readable
|
||||||
black 50%,
|
&::after {
|
||||||
transparent), linear-gradient(to bottom, black 40%, transparent);
|
content: "";
|
||||||
mask-composite: intersect;
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background: linear-gradient(
|
||||||
|
to top right,
|
||||||
|
rgba(0, 0, 0, 0.9) 0%,
|
||||||
|
rgba(0, 0, 0, 0.4) 50%,
|
||||||
|
transparent 100%
|
||||||
|
);
|
||||||
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
&-image {
|
&-image {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
@@ -41,16 +51,16 @@
|
|||||||
right: 0;
|
right: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 90vh;
|
height: 100%;
|
||||||
transition: opacity 0.5s;
|
transition: opacity 0.5s;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-icon-container {
|
&-icon-container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
// background: $clr-gradient-dark;
|
|
||||||
background: url("/src/assets/herobg.png"), rgb(0 0 0 /0.3);
|
background: url("/src/assets/herobg.png"), rgb(0 0 0 /0.3);
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
@@ -58,41 +68,67 @@
|
|||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background-blend-mode: overlay;
|
background-blend-mode: overlay;
|
||||||
height: 90vh;
|
height: 100%;
|
||||||
|
|
||||||
.material-symbols-rounded {
|
.material-symbols-rounded {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
font-size: 15em !important;
|
font-size: 15em !important;
|
||||||
left: 80%;
|
left: 50%;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 50,
|
font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 50, "opsz" 60;
|
||||||
"opsz" 60;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&-text {
|
&-text {
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
-webkit-line-clamp: 2;
|
|
||||||
margin-bottom: 0.5em;
|
margin-bottom: 0.5em;
|
||||||
|
text-shadow: 0 0 10px rgba(0,0,0,0.5), 0 0 20px rgba(0,0,0,0.3);
|
||||||
|
|
||||||
&-logo {
|
&-logo {
|
||||||
max-width: 34vw;
|
max-width: 25vw;
|
||||||
max-height: 2.4em;
|
max-height: 20vh;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
object-position: bottom;
|
object-position: left bottom;
|
||||||
|
filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-overview {
|
||||||
|
overflow: hidden;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
text-shadow: 0 1px 2px rgba(0,0,0,0.8);
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
display: block;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
opacity: 0.9;
|
||||||
|
max-width: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
&-detail {
|
&-detail {
|
||||||
position: relative;
|
position: absolute;
|
||||||
z-index: 0;
|
z-index: 3;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
gap: 1.5em;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 80%;
|
width: 100%;
|
||||||
padding: $page-margin;
|
max-width: 1400px;
|
||||||
padding-bottom: 0;
|
padding: 4rem;
|
||||||
|
padding-bottom: 5rem;
|
||||||
|
padding-left: 5rem;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-info {
|
||||||
|
text-shadow: 0 1px 2px rgba(0,0,0,0.8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,21 +141,23 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 1140px) {
|
@media (max-width: 1140px) {
|
||||||
.carousel{
|
.carousel {
|
||||||
height: 60vh !important;
|
height: 60vh !important;
|
||||||
}
|
}
|
||||||
.hero-carousel{
|
.hero-carousel {
|
||||||
&-background-image{
|
&-detail {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
|
||||||
}
|
}
|
||||||
&-text {
|
|
||||||
-webkit-line-clamp: 2 !important;
|
|
||||||
|
|
||||||
|
&-background-container::after {
|
||||||
|
background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
&-text {
|
||||||
&-logo {
|
&-logo {
|
||||||
max-width: 7em;
|
max-width: 60vw;
|
||||||
max-height: 2em;
|
max-height: 10vh;
|
||||||
object-fit: contain;
|
|
||||||
object-position: bottom;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user