diff --git a/src/components/carousel/carousel.scss b/src/components/carousel/carousel.scss
index ca90520..ab59c02 100644
--- a/src/components/carousel/carousel.scss
+++ b/src/components/carousel/carousel.scss
@@ -1,15 +1,42 @@
.carousel {
position: relative;
- height: 64vh;
- width: calc(100% + 2*$page-margin);
- left: -$page-margin;
- margin-bottom: 3.2em;
- .slider {
- position: absolute;
- bottom: 0;
- max-width: 35%;
- right: $page-margin;
+ overflow: hidden;
+ height: 62vh;
+ margin-bottom: 2em;
+ display: grid;
+ grid-template-areas: "main sidebar";
+ grid-template-columns: 1fr 25vw;
+ gap: 1em;
+
+ &-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 {
position: absolute !important;
top: 50%;
@@ -25,14 +52,46 @@
}
}
+ &-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 {
aspect-ratio: 1.77777;
- overflow: hidden;
- border-radius: 2px;
- padding: 2px;
- transition: opacity $transition-time-fast;
- opacity: 0.5;
- width: auto;
+ overflow: hidden;
+ border-radius: 2px;
+ padding: 2px;
+ transition: opacity $transition-time-fast;
+ opacity: 0.5;
+ width: auto;
&:hover {
cursor: pointer;
opacity: 0.8;
@@ -44,29 +103,29 @@
align-items: center;
justify-content: center;
}
-&-image {
- width: 100%;
- height: 100%;
- object-fit: cover;
- border-radius: 4px;
-}
-
-&-icon {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 100%;
- height: 100%;
- background: rgb(155 155 155 / 0.4);
- border-radius: 4px;
-}
+ &-image {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ border-radius: 4px;
+ }
+
+ &-icon {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 100%;
+ height: 100%;
+ background: rgb(155 155 155 / 0.4);
+ border-radius: 4px;
+ }
&.active {
opacity: 1;
- .material-symbols-rounded {
-
- --fill: 1;
- }
- }
+ .material-symbols-rounded {
+
+ --fill: 1;
}
+ }
+ }
}
\ No newline at end of file
diff --git a/src/components/carousel/index.tsx b/src/components/carousel/index.tsx
index e8c59df..e3f4ad6 100644
--- a/src/components/carousel/index.tsx
+++ b/src/components/carousel/index.tsx
@@ -1,29 +1,20 @@
-import { AnimatePresence, motion } from "motion/react";
-import type { PanInfo } from "motion/react";
-import React, { useEffect, useState, useMemo, useCallback } from "react";
-import type { MouseEvent, PointerEvent } from "react";
+import { AnimatePresence } from "motion/react";
+import React, { useCallback, useEffect, useState } from "react";
import { useCarouselStore } from "../../utils/store/carousel";
import "./carousel.scss";
-import { useApiInContext } from "@/utils/store/api";
-import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
-import CarouselSlide from "../carouselSlide";
-
+import {
+ type BaseItemDto,
+ BaseItemKind,
+} from "@jellyfin/sdk/lib/generated-client";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
-import Slider from "../Slider";
-import { getTypeIcon } from "../utils/iconsCollection";
-
-const swipeConfidenceThreshold = 8000;
-const swipePower = (offset: number, velocity: number) => {
- return Math.abs(offset) * velocity;
-};
+import { useApiInContext } from "@/utils/store/api";
+import CarouselSlide from "../carouselSlide";
+import CarouselTickers from "./tickers";
// Memoize CarouselSlide to prevent unnecessary re-renders
const MemoizedCarouselSlide = React.memo(CarouselSlide);
-// Memoize Slider to prevent unnecessary re-renders
-const MemoizedSlider = React.memo(Slider);
-
const Carousel = ({
content,
onChange,
@@ -41,112 +32,50 @@ const Carousel = ({
const api = useApiInContext((s) => s.api);
- // Memoize the content mapping
- const sliderContent = useMemo(() => {
- return content.map((item, index) => {
- return (
- {
- if (currentSlide > index) {
- setDirection("left");
- } else if (currentSlide <= index) {
- setDirection("right");
- }
- setCurrentSlide(index);
- }}
- >
- {item.ImageTags?.Thumb ? (
-
- ) : (
-
- {getTypeIcon(item.Type ?? "Movie")}
-
- )}
-
- );
- });
- }, [content, currentSlide, api, setDirection]);
-
- const handleDragEnd = useCallback(
- (
- _: 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);
- }
+ const handleTickerClick = useCallback(
+ (index: number) => {
+ if (index === currentSlide) return;
+ setDirection(index > currentSlide ? "right" : "left");
+ setCurrentSlide(index);
},
- [currentSlide, content.length, setDirection],
+ [currentSlide, setDirection],
);
+ if (!api) return null;
+
return (
-
-
-
+
-
+
+ {content.map((item, index) => (
+ handleTickerClick(index)}
+ />
+ ))}
+
);
};
diff --git a/src/components/carousel/tickers.tsx b/src/components/carousel/tickers.tsx
new file mode 100644
index 0000000..bbd828c
--- /dev/null
+++ b/src/components/carousel/tickers.tsx
@@ -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 (
+
+

+
+
+ {itemName}
+
+
+ {itemYear}
+
+
+
+ );
+};
+export default CarouselTickers;
diff --git a/src/components/carouselSlide/index.tsx b/src/components/carouselSlide/index.tsx
index 4f3c1f0..b59b633 100644
--- a/src/components/carouselSlide/index.tsx
+++ b/src/components/carouselSlide/index.tsx
@@ -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 {
type BaseItemDto,
BaseItemKind,
} 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 MarkPlayedButton from "../buttons/markPlayedButton";
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 api = useApiInContext((s) => s.api);
@@ -66,7 +84,13 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
return (
-
+
{item.BackdropImageTags?.length ? (
{
{getTypeIcon(item.Type ?? "Movie")}
)}
-
-
+
+
+ {/* @ts-ignore */}
{!item.ImageTags?.Logo ? (
@@ -142,31 +166,11 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
/>
)}
+ {/* @ts-ignore */}
{
>
{item.PremiereDate && (
- {item.ProductionYear}
+ {item.ProductionYear ?? ""}
)}
{item.OfficialRating && (
@@ -239,82 +243,49 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
)}
- {item.RunTimeTicks ? (
+ {item.RunTimeTicks && (
{getRuntime(item.RunTimeTicks)}
- ) : (
- <>>
)}
- {item.RunTimeTicks ? (
+ {item.RunTimeTicks && (
{endsAt(
item.RunTimeTicks - (item.UserData?.PlaybackPositionTicks ?? 0),
)}
- ) : (
- <>>
)}
{item.Genres?.slice(0, 4).join(" / ")}
+ {/* @ts-ignore */}
{item.Overview}
+ {/* @ts-ignore */}
{
-
+
);
};
diff --git a/src/components/itemHeader/index.tsx b/src/components/itemHeader/index.tsx
index b03aa52..6d74eb1 100644
--- a/src/components/itemHeader/index.tsx
+++ b/src/components/itemHeader/index.tsx
@@ -4,6 +4,7 @@ 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 { Link } from "@tanstack/react-router";
import React, { type ReactNode, type RefObject } from "react";
import { Blurhash } from "react-blurhash";
import heroBg from "@/assets/herobg.png";
@@ -26,7 +27,6 @@ import { getTypeIcon } from "@/components/utils/iconsCollection";
import { endsAt, getRuntime } from "@/utils/date/time";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import type MediaQualityInfo from "@/utils/types/mediaQualityInfo";
-import { Link } from "@tanstack/react-router";
import "./itemHeader.scss";
interface ItemHeaderProps {
@@ -54,8 +54,6 @@ const ItemHeader = ({
? (item.ParentBackdropItemId ?? 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 =
(item as any).ParentLogoImageTag || (item as any).ParentLogoImageTags?.[0];
const logoTag =
diff --git a/src/components/playback/audioPlayer/components/PlayerProgress.tsx b/src/components/playback/audioPlayer/components/PlayerProgress.tsx
index 08270a8..8b3c5ae 100644
--- a/src/components/playback/audioPlayer/components/PlayerProgress.tsx
+++ b/src/components/playback/audioPlayer/components/PlayerProgress.tsx
@@ -6,7 +6,7 @@ import { getRuntimeMusic } from "@/utils/date/time";
interface PlayerProgressProps {
progress: number;
duration: number;
- onSeek: (value: number) => void;
+ onSeek?: (value: number) => void;
onSeekCommit: (value: number) => void;
}
@@ -29,7 +29,7 @@ const PlayerProgress = ({
setIsScrubbing(true);
const newValue = Array.isArray(value) ? value[0] : value;
setSliderValue(newValue);
- onSeek(newValue);
+ onSeek?.(newValue);
};
const handleChangeCommitted = (_: unknown, value: number | number[]) => {
diff --git a/src/components/playback/audioPlayer/index.tsx b/src/components/playback/audioPlayer/index.tsx
index 7924396..a368f8f 100644
--- a/src/components/playback/audioPlayer/index.tsx
+++ b/src/components/playback/audioPlayer/index.tsx
@@ -26,7 +26,7 @@ const AudioPlayer = () => {
const user = useCentralStore((s) => s.currentUser);
const navigate = useNavigate();
const location = useLocation();
-
+
const audioRef = useRef(null);
const [url, display, item, volume, isMuted] = useAudioPlayback((state) => [
state.url,
@@ -35,32 +35,33 @@ const AudioPlayer = () => {
state.player.volume,
state.player.isMuted,
]);
-
+
const [tracks, currentTrack] = useQueue((state) => [
state.tracks,
state.currentItemIndex,
]);
-
+
const [playing, setPlaying] = useState(false);
const [progress, setProgress] = useState(0);
-
+
// Sync volume and ref
useEffect(() => {
if (display) {
setAudioRef(audioRef);
+
if (audioRef.current) {
audioRef.current.volume = isMuted ? 0 : volume;
}
}
}, [display, url, tracks?.[currentTrack]?.Id]);
-
+
// Update volume when state changes
useEffect(() => {
if (audioRef.current) {
audioRef.current.volume = isMuted ? 0 : volume;
}
}, [volume, isMuted]);
-
+
// Media Session Metadata
useEffect(() => {
if ("mediaSession" in navigator && item) {
@@ -87,7 +88,7 @@ const AudioPlayer = () => {
});
}
}, [item, api]);
-
+
// Media Session Action Handlers
useEffect(() => {
if ("mediaSession" in navigator) {
@@ -114,7 +115,7 @@ const AudioPlayer = () => {
});
}
}, [api, user?.Id]);
-
+
const updatePositionState = () => {
if (
"mediaSession" in navigator &&
@@ -132,7 +133,7 @@ const AudioPlayer = () => {
}
}
};
-
+
const handlePlayPause = () => {
if (audioRef.current) {
if (audioRef.current.paused) {
@@ -144,41 +145,41 @@ const AudioPlayer = () => {
}
}
};
-
+
const handleTimeUpdate = (e: SyntheticEvent) => {
setProgress(secToTicks(e.currentTarget.currentTime));
};
-
+
const handleEnded = () => {
setPlaying(false);
if (tracks?.[currentTrack + 1]?.Id && api && user?.Id) {
playItemFromQueue("next", user.Id, api);
}
};
-
+
const handleSeekCommit = (value: number) => {
if (audioRef.current) {
audioRef.current.currentTime = ticksToSec(value);
setProgress(value);
}
};
-
+
const handleVolumeChange = (newVolume: number) => {
setVolume(newVolume);
};
-
+
const handleMuteToggle = () => {
setIsMuted(!isMuted);
};
-
+
const handleClose = () => {
useAudioPlayback.setState(useAudioPlayback.getInitialState());
};
-
+
const handleNavigate = () => {
navigate({ to: "/player/audio" });
};
-
+
// Listen to play/pause events directly from audio element to keep state in sync
// (e.g. if paused by media keys)
const onPlay = () => {
@@ -195,7 +196,7 @@ const AudioPlayer = () => {
navigator.mediaSession.playbackState = "paused";
}
};
-
+
return (
{display && (
@@ -214,7 +215,7 @@ const AudioPlayer = () => {