diff --git a/src/components/appBar/appBar.tsx b/src/components/appBar/appBar.tsx index 7a579eb..40aba0f 100644 --- a/src/components/appBar/appBar.tsx +++ b/src/components/appBar/appBar.tsx @@ -28,6 +28,8 @@ const HIDDEN_PATHS = [ "/settings", "/library", "/search", + // The home page draws its own header inside the hero frame. + "/home", ]; export const AppBar = () => { diff --git a/src/components/carousel/carousel.scss b/src/components/carousel/carousel.scss index 3a3f8c3..e115a3f 100644 --- a/src/components/carousel/carousel.scss +++ b/src/components/carousel/carousel.scss @@ -1,196 +1,481 @@ -.carousel { - position: relative; - overflow: visible; - height: 65vh; - margin-bottom: 3em; - display: grid; - grid-template-areas: "main sidebar"; - grid-template-columns: 1fr 340px; - gap: 1.5em; +@use "@/styles/variables.scss" as *; - &-slide-wrapper { - grid-area: main; - position: relative; - height: 100%; - min-width: 0; +/* Cinematic home hero: full-bleed artwork, integrated type, bottom rail. */ +.cinema-hero { + position: relative; + height: calc(100vh - 32px); + min-height: 620px; + overflow: hidden; + isolation: isolate; + + .hero-carousel-slide { + position: absolute; + inset: 0; overflow: hidden; - border-radius: 20px; + border: 0; + border-radius: 0; + box-shadow: none; } - &-sidebar { - overflow-y: auto; + .hero-carousel-background-container { + position: absolute; + inset: 0; + z-index: 0; + + &::after { + content: ""; + position: absolute; + inset: 0; + z-index: 2; + background: + linear-gradient( + 90deg, + rgb(6 8 12 / 0.94) 0%, + rgb(6 8 12 / 0.72) 28%, + rgb(6 8 12 / 0.28) 52%, + rgb(6 8 12 / 0) 72% + ), + linear-gradient( + 0deg, + rgb(6 8 12 / 0.96) 0%, + rgb(6 8 12 / 0.55) 26%, + rgb(6 8 12 / 0) 56% + ); + } + } + + .hero-carousel-background-image { + position: absolute; + inset: 0; + width: 100%; height: 100%; - position: relative; - @include glass-effect($bg-color: rgba(10, 10, 14, 0.4)); - border-radius: 24px; - grid-area: sidebar; + object-fit: cover; + object-position: center; + + &.is-poster { + filter: blur(42px) saturate(1.5) brightness(0.55); + transform: scale(1.25); + } + } + + .hero-carousel-background-blurhash { + position: absolute; + inset: 0; + width: 100% !important; + height: 100% !important; + z-index: 0; + filter: blur(40px) saturate(1.4); + } + + .hero-carousel-background-icon-container { + position: absolute; + inset: 0; + z-index: 0; + background: linear-gradient(135deg, #12141a, #1d2028); + + .material-symbols-rounded { + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + font-size: 15em !important; + opacity: 0.35; + } + } + + .hero-carousel-detail { + position: absolute; + inset: 0; + z-index: 3; display: flex; flex-direction: column; - padding: 12px; - gap: 8px; - - // Ensure programmatic scroll respects padding - scroll-padding-block: 24px; + justify-content: flex-end; + align-items: flex-start; + gap: 0.9rem; + max-width: none; + padding: 0 clamp(2rem, 5vw, 4.5rem) calc(var(--home-trending-space, 200px) + 3rem); + background: none; + } + + .hero-carousel-label { + display: inline-flex; + align-items: center; + height: 34px; + padding: 0 16px; + border-radius: 10px; + background: rgb(255 255 255 / 0.16); + border: 1px solid rgb(255 255 255 / 0.18); + backdrop-filter: blur(14px); + color: #fff; + font-size: 0.86rem; + font-weight: 500; + letter-spacing: 0.01em; + } + + .hero-carousel-text { + display: block; + overflow: visible; + margin: 0; + max-width: 16ch; + font-size: clamp(2.4rem, 4.1vw, 4.4rem) !important; + line-height: 0.98 !important; + font-weight: 650 !important; + letter-spacing: -0.035em; + text-shadow: 0 2px 30px rgb(0 0 0 / 0.35); + } + + .hero-carousel-info { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 0.9em !important; + margin-top: 0.1em !important; + color: rgb(255 255 255 / 0.78); + font-size: 0.9rem; + text-shadow: 0 1px 2px rgb(0 0 0 / 0.6); + + .MuiTypography-root { + font-size: 0.9rem; + } + + .MuiChip-root { + height: 24px; + background: rgb(255 255 255 / 0.14); + color: #fff; + font-size: 0.75rem; + backdrop-filter: blur(8px); + } + + .hero-carousel-info-rating { + gap: 0.2em; + } + } + + .hero-carousel-overview { + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 4; + overflow: hidden; + max-width: 34rem; + margin: 0.15rem 0 0; + color: rgb(255 255 255 / 0.82); + font-size: 1rem; + line-height: 1.55; + text-shadow: 0 1px 3px rgb(0 0 0 / 0.55); + } + + .hero-carousel-button-container { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 0.85rem; + width: auto; + margin-top: 0.6rem; + + .MuiButton-root { + min-height: 50px; + padding: 0 24px; + border-radius: 999px; + text-transform: none; + font-size: 1rem; + font-weight: 600; + letter-spacing: -0.01em; + box-shadow: none; + } + + .play-button .MuiButton-root, + .MuiButton-contained { + background: #f5f5f4; + color: #101116; + + &:hover { + background: #fff; + } + + .material-symbols-rounded { + color: #101116; + } + } + + .MuiButton-outlined { + border-color: rgb(255 255 255 / 0.34); + color: #fff; + backdrop-filter: blur(10px); + + &:hover { + background: rgb(255 255 255 / 0.1); + border-color: rgb(255 255 255 / 0.6); + } + } + + .MuiIconButton-root { + color: rgb(255 255 255 / 0.75); + + &:hover { + color: #fff; + background: rgb(255 255 255 / 0.1); + } + } + } + + /* Big cinematic arrows */ + .cinema-arrow { + position: absolute; + top: 50%; + z-index: 7; + display: flex; + align-items: center; + justify-content: center; + width: 48px; + height: 48px; + border-radius: 50%; + border: 1px solid rgb(255 255 255 / 0.18); + background: rgb(14 16 21 / 0.36); + backdrop-filter: blur(14px); + color: #fff; + cursor: pointer; + transform: translateY(-50%); + opacity: 0; + transition: + opacity 0.2s ease, + background-color 0.2s ease, + color 0.2s ease; + + &.left { + left: 1.25rem; + } + + &.right { + right: 1.25rem; + } + + .material-symbols-rounded { + font-size: 1.7rem; + } + + &:hover { + background: #f5f5f4; + color: #101116; + } + } + + &:hover .cinema-arrow, + &.paused .cinema-arrow { + opacity: 1; + } + + /* Bottom rail */ + .cinema-trending { + position: absolute; + left: 0; + right: 0; + bottom: 0; + z-index: 6; + padding: 2rem clamp(2rem, 5vw, 4.5rem) 1.5rem; + background: linear-gradient( + 0deg, + rgb(7 8 12 / 0.98) 0%, + rgb(7 8 12 / 0.9) 46%, + rgb(7 8 12 / 0) 100% + ); + } + + .cinema-trending-head { + display: flex; + align-items: center; + justify-content: space-between; + gap: 1rem; + margin-bottom: 0.9rem; + + h3 { + margin: 0; + font-size: 1.1rem; + font-weight: 600; + letter-spacing: -0.01em; + } + } + + .cinema-dots { + display: flex; + align-items: center; + gap: 6px; + + button { + width: 26px; + height: 3px; + padding: 0; + border: 0; + border-radius: 999px; + background: rgb(255 255 255 / 0.3); + cursor: pointer; + transition: + background-color 0.2s ease, + width 0.2s ease; + + &.active { + width: 38px; + background: #fff; + } + } + } + + .cinema-trending-rail { + display: flex; + gap: 0.75rem; + overflow-x: auto; + overflow-y: hidden; + padding-bottom: 2px; + scrollbar-width: none; + -ms-overflow-style: none; - // Hide scrollbar but keep functionality - scrollbar-width: none; - -ms-overflow-style: none; &::-webkit-scrollbar { width: 0; height: 0; - display: none; + display: none; } } - - &-button { - position: absolute !important; - top: 50%; - transform: translateY(-50%); - z-index: 100; - - &.right { - right: 0.5em; - } - - &.left { - left: 0.5em; - } - } - - &-ticker{ - overflow: hidden; - height: 72px; - display: flex; - padding: 8px; - align-items: center; - gap: 12px; - transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); + + .cinema-trending-card { position: relative; - border-radius: 12px; // Slightly smaller radius to work with the bar - background: transparent; - border: 1px solid transparent; - - &:hover { - background: rgba(255, 255, 255, 0.05); - cursor: pointer; - } - - &.active { - background: rgba(255, 255, 255, 0.08); // Subtle background - - // Vertical Progress Bar - &::after { - content: ''; - position: absolute; - left: 0; - bottom: 0; - width: 4px; - background-color: var(--mui-palette-primary-main, #fff); - height: 0%; - animation: ticker-v-progress 8s linear; - } - } - - &-image { - height: 56px; - width: 100px; - flex-shrink: 0; - border-radius: 8px; - object-fit: cover; - box-shadow: 0 2px 8px rgba(0,0,0,0.2); - - &.placeholder { - display: flex; - align-items: center; - justify-content: center; - background: rgb(100 100 100 / 0.1); - color: rgb(200 200 200 / 0.7); - font-size: 2rem; - } - } - - & > div { - display: flex; - flex-direction: column; - justify-content: center; - min-width: 0; // flexible text truncation - padding-left: 4px; // compensate for visual weight of potential bar - - .carousel-ticker-title { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - font-weight: 500; // Slightly lighter - font-size: 0.95rem; - line-height: 1.2; - margin-bottom: 2px; - opacity: 0.9; - } - .carousel-ticker-year { - font-size: 0.8rem; - opacity: 0.6; - } - } - } - - // Pause progress when carousel is paused - &.paused { - .carousel-ticker.active::after { - animation-play-state: paused; - } - } - - @keyframes ticker-v-progress { - from { height: 0%; } - to { height: 100%; } - } - - &-indicator { - aspect-ratio: 1.77777; + flex: 0 0 auto; + width: clamp(200px, 21vw, 300px); + aspect-ratio: 16 / 9; + padding: 0; overflow: hidden; - border-radius: 2px; - padding: 2px; - transition: opacity $transition-time-fast; - opacity: 0.5; - width: auto; - &:hover { - cursor: pointer; - opacity: 0.8; - } - - &-container { - display: flex; - gap: 1em; - align-items: center; - justify-content: center; - } - &-image { + border: 1px solid rgb(255 255 255 / 0.12); + border-radius: 12px; + background: rgb(255 255 255 / 0.05); + cursor: pointer; + opacity: 0.72; + transition: + opacity 0.2s ease, + border-color 0.2s ease, + transform 0.2s ease; + + img { width: 100%; height: 100%; object-fit: cover; - border-radius: 4px; + display: block; } - - &-icon { - display: flex; - align-items: center; - justify-content: center; - width: 100%; - height: 100%; - background: rgb(155 155 155 / 0.4); - border-radius: 4px; + + &::after { + content: ""; + position: absolute; + inset: 0; + background: linear-gradient(0deg, rgb(0 0 0 / 0.35), transparent 55%); } + + &:hover { + opacity: 1; + border-color: rgb(255 255 255 / 0.4); + transform: translateY(-2px); + } + &.active { opacity: 1; - - .material-symbols-rounded { - - --fill: 1; - } + border-color: rgb(255 255 255 / 0.7); + box-shadow: 0 0 0 1px rgb(255 255 255 / 0.25); + } + } + + .cinema-trending-chip { + position: absolute; + top: 10px; + left: 10px; + z-index: 1; + padding: 3px 10px; + border-radius: 8px; + background: rgb(245 245 244 / 0.9); + color: #131419; + font-size: 0.75rem; + font-weight: 500; + line-height: 1.5; + } + + .cinema-trending-placeholder { + display: flex; + align-items: center; + justify-content: center; + width: 100%; + height: 100%; + color: rgb(255 255 255 / 0.5); + + .material-symbols-rounded { + font-size: 2rem; } } } -.carousel-ticker-wrapper { -scroll-margin-block: 24px; + +/* Reserve room for the floating player bar so the rail is never covered. */ +body:has(.audio-player) .cinema-trending { + padding-bottom: 116px; } +/* With the player bar visible the hero has less vertical room, so keep the + copy compact instead of pushing it under the header. */ +body:has(.audio-player) .cinema-hero .hero-carousel-text { + font-size: clamp(2.1rem, 3.6vw, 4rem) !important; +} + +body:has(.audio-player) .cinema-hero .hero-carousel-overview { + -webkit-line-clamp: 3; +} + +@media (max-width: 1100px) { + .cinema-hero { + height: calc(100vh - 32px); + min-height: 560px; + + .hero-carousel-detail { + padding-left: 2rem; + padding-right: 2rem; + padding-bottom: calc(var(--home-trending-space, 200px) + 1.5rem); + } + + .hero-carousel-text { + font-size: 2.6rem !important; + max-width: 14ch; + } + + .hero-carousel-overview { + -webkit-line-clamp: 3; + max-width: 30rem; + } + + .cinema-trending { + padding-left: 2rem; + padding-right: 2rem; + } + + .cinema-arrow.left { + display: none; + } + } +} + +@media (max-width: 700px) { + .cinema-hero { + min-height: 520px; + + .hero-carousel-text { + font-size: 2.1rem !important; + } + + .hero-carousel-info { + display: none; + } + + .hero-carousel-overview { + display: none; + } + + .cinema-arrow { + display: none; + } + + .cinema-trending-card { + width: 160px; + } + } +} diff --git a/src/components/carousel/index.tsx b/src/components/carousel/index.tsx index b3e9841..3895526 100644 --- a/src/components/carousel/index.tsx +++ b/src/components/carousel/index.tsx @@ -1,23 +1,23 @@ import React, { useCallback, useEffect, useState } from "react"; import type { Api } from "@jellyfin/sdk"; - -import { useCarouselStore } from "../../utils/store/carousel"; -import "./carousel.scss"; import { type BaseItemDto, BaseItemKind, } from "@jellyfin/sdk/lib/generated-client"; +import { useCarouselStore } from "../../utils/store/carousel"; +import "./carousel.scss"; import getImageUrlsApi from "@/utils/methods/getImageUrlsApi"; import { resolveItemImage } from "@/utils/methods/itemImages"; import { useApiInContext } from "@/utils/store/api"; import CarouselSlide from "../carouselSlide"; -import CarouselTickers from "./tickers"; + +const AUTOPLAY_MS = 9000; // Memoize CarouselSlide to prevent unnecessary re-renders const MemoizedCarouselSlide = React.memo(CarouselSlide); -/** Sidebar thumbnail: prefer Thumb, fall back to Backdrop/Primary when missing. */ -const tickerImageUrl = ( +/** Wide artwork for the trending rail, falling back through the item's images. */ +const trendingImageUrl = ( api: Api, item: BaseItemDto, ): string | undefined => { @@ -27,13 +27,19 @@ const tickerImageUrl = ( image.itemId, image.imageType, { - quality: 90, - fillHeight: 360, + quality: 85, + fillWidth: 480, tag: image.tag, }, ); }; +const trendingLabel = (item: BaseItemDto): string => { + const genre = item.Genres?.[0]; + if (genre) return genre.charAt(0).toUpperCase() + genre.slice(1); + return item.Type === BaseItemKind.Series ? "Series" : "Movie"; +}; + const Carousel = ({ content, onChange, @@ -43,107 +49,136 @@ const Carousel = ({ }) => { const [currentSlide, setCurrentSlide] = useState(0); const [isPaused, setIsPaused] = useState(false); - const sidebarRef = React.useRef(null); - const tickerRefs = React.useRef<(HTMLDivElement | null)[]>([]); - const currentSlideRef = React.useRef(currentSlide); - const [setDirection] = useCarouselStore((state) => [state.setDirection]); + const api = useApiInContext((s) => s.api); + + const total = content.length; useEffect(() => { - currentSlideRef.current = currentSlide; - }, [currentSlide]); + if (currentSlide >= total && total > 0) { + setCurrentSlide(total - 1); + } + }, [currentSlide, total]); useEffect(() => { onChange(currentSlide); + }, [currentSlide, onChange]); - // Auto-scroll sidebar to keep active item in view - const activeTicker = tickerRefs.current[currentSlide]; - const sidebar = sidebarRef.current; - - if (activeTicker && sidebar) { - const sidebarTop = sidebar.scrollTop; - const sidebarBottom = sidebarTop + sidebar.clientHeight; - const activeTickerTop = activeTicker.offsetTop; - const activeTickerBottom = - activeTicker.offsetTop + activeTicker.offsetHeight; - - // If element is below the visible area - if (activeTickerBottom > sidebarBottom) { - sidebar.scrollTo({ - top: activeTickerBottom - sidebar.clientHeight + 24, // 24px padding - behavior: "smooth", - }); - } - // If element is above the visible area - else if (activeTickerTop < sidebarTop) { - sidebar.scrollTo({ - top: activeTickerTop - 24, // 24px padding - behavior: "smooth", - }); - } - } - }, [currentSlide, content, onChange]); - - // Autoplay functionality - useEffect(() => { - if (isPaused || content.length === 0) return; - - const timer = setInterval(() => { - setDirection("right"); - setCurrentSlide((prev) => (prev + 1) % content.length); - }, 8000); - - return () => clearInterval(timer); - }, [isPaused, content.length, setDirection, currentSlide]); - - const api = useApiInContext((s) => s.api); - - const handleTickerClick = useCallback( + const goTo = useCallback( (index: number) => { - if (index === currentSlideRef.current) return; - setDirection(index > currentSlideRef.current ? "right" : "left"); + if (index === currentSlide) return; + setDirection(index > currentSlide ? "right" : "left"); setCurrentSlide(index); }, - [setDirection], + [currentSlide, setDirection], ); - if (!api) return null; + const next = useCallback(() => { + if (total < 2) return; + setDirection("right"); + setCurrentSlide((prev) => (prev + 1) % total); + }, [total, setDirection]); + + const previous = useCallback(() => { + if (total < 2) return; + setDirection("left"); + setCurrentSlide((prev) => (prev - 1 + total) % total); + }, [total, setDirection]); + + // Autoplay; pauses while the pointer is over the hero. + useEffect(() => { + if (isPaused || total < 2) return; + const timer = window.setInterval(() => { + setDirection("right"); + setCurrentSlide((prev) => (prev + 1) % total); + }, AUTOPLAY_MS); + return () => window.clearInterval(timer); + }, [isPaused, total, setDirection]); + + if (!api || total === 0) return null; + + const currentItem = content[currentSlide]; return ( -
setIsPaused(true)} onMouseLeave={() => setIsPaused(false)} > -
- -
-
- {content.map((item, index) => ( -
{ - tickerRefs.current[index] = el; - }} - className="carousel-ticker-wrapper" + + + {total > 1 && ( + <> +
- ))} + chevron_left + + + + )} + +
+
+

Trending now

+ {total > 1 && ( +
+ {content.map((item, index) => ( +
+ )} +
+
+ {content.map((item, index) => { + const imageUrl = trendingImageUrl(api, item); + return ( + + ); + })} +
-
+ ); }; diff --git a/src/components/carouselSlide/index.tsx b/src/components/carouselSlide/index.tsx index f7c4a53..f9cc708 100644 --- a/src/components/carouselSlide/index.tsx +++ b/src/components/carouselSlide/index.tsx @@ -137,6 +137,20 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => { }, }} > + + + {item.UserData?.PlaybackPositionTicks + ? "Continue watching" + : item.Type === BaseItemKind.Series + ? "New series" + : "New movie"} + + { sx={{ fontWeight: 600, overflow: "visible", - mb: "5px", }} > - {!item.ImageTags?.Logo ? ( - item.Name - ) : ( - {item.Name { - e.currentTarget.style.opacity = "1"; - }} - /> - )} + {item.Name} { document.body.classList.add("has-overlay-scrollbar"); let frame = 0; + let measureTimer = 0; let lastShow = 0; const setVisible = (visible: boolean) => { @@ -90,10 +91,12 @@ const OverlayScrollbar = () => { // Expensive path: runs on mount and when page/window geometry changes. const measure = () => { + // Use the header height rather than its viewport position: the + // header scrolls with the page, but the track must stay put. const header = document.querySelector("header"); const insetTop = Math.max( 0, - Math.round(header?.getBoundingClientRect().bottom ?? 0) + 4, + Math.round(header?.getBoundingClientRect().height ?? 0) + 6, ); const trackHeight = Math.max(0, window.innerHeight - insetTop - 6); const topStyle = `${insetTop}px`; @@ -139,8 +142,19 @@ const OverlayScrollbar = () => { if (frame) return; frame = window.requestAnimationFrame(() => { frame = 0; + window.clearTimeout(measureTimer); measure(); }); + // Animation frames stop in an occluded window, but the page can + // still grow (route/data changes). Refresh geometry on a timer too. + window.clearTimeout(measureTimer); + measureTimer = window.setTimeout(() => { + if (frame) { + window.cancelAnimationFrame(frame); + frame = 0; + } + measure(); + }, 250); }; const onScroll = () => { @@ -214,6 +228,7 @@ const OverlayScrollbar = () => { return () => { window.clearTimeout(hideTimer.current); + window.clearTimeout(measureTimer); if (frame) window.cancelAnimationFrame(frame); scroller.removeEventListener("scroll", onScroll); window.removeEventListener("resize", onResize); diff --git a/src/routes/_api/home/home.scss b/src/routes/_api/home/home.scss index 03da24d..9088821 100644 --- a/src/routes/_api/home/home.scss +++ b/src/routes/_api/home/home.scss @@ -1,211 +1,164 @@ +/* Home page: a floating, rounded "cinema window" with an integrated header. */ +.home-cinema { + --home-trending-space: 200px; -.hero-carousel { + min-height: 100vh; + padding: 16px; + box-sizing: border-box; + background: #05060a; +} + +body:has(.audio-player) .home-cinema { + --home-trending-space: 316px; +} + +.home-frame { position: relative; - overflow: visible; - isolation: isolate; - height: 100%; - width: 100%; + overflow: hidden; + min-height: calc(100vh - 32px); + border: 1px solid rgb(255 255 255 / 0.07); + border-radius: 28px; + background: #08090d; + box-shadow: 0 28px 70px rgb(0 0 0 / 0.45); +} - &-slide { - position: relative; - height: 100%; - width: 100%; - overflow: hidden; - margin: 0; - border: none; - border-radius: 20px; - grid-area: main; - border: 1.2px solid rgb(255 255 255 / 0.1); - box-shadow: 0 0 20px rgba(0,0,0,0.2); - } +/* Header floating over the hero artwork. */ +.home-header { + position: absolute; + top: 0; + left: 0; + right: 0; + z-index: 20; + display: grid; + grid-template-columns: 1fr auto 1fr; + align-items: center; + gap: 1rem; + padding: 1.3rem clamp(1.5rem, 3vw, 2.5rem) 1.4rem; + color: #fff; + background: linear-gradient(180deg, rgb(0 0 0 / 0.42), transparent); - &-background { - &-container { - position: absolute; - z-index: 0; - top: 0; - left: 0; - right: 0; - bottom: 0; - height: 100%; - - // Gradient overlay to make text readable - &::after { - content: ""; - 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 { - position: absolute; - background-size: cover; - z-index: 1; - right: 0; - top: 0; - bottom: 0; - left: 0; - background-position: center; - object-fit: cover; - width: 100%; - height: 100%; - - // Poster-only item: never stretch/crop a 2:3 poster across 16:9. - // Blur it into an ambient background and show the sharp poster on top. - &.is-poster { - filter: blur(36px) saturate(1.6) brightness(0.65); - transform: scale(1.25); - } - } - - &-blurhash { - position: absolute; - inset: 0; - width: 100% !important; - height: 100% !important; - z-index: 0; - filter: blur(30px) saturate(1.4); - } - - &-icon-container { - position: absolute; - background: url("/src/assets/herobg.png"), rgb(0 0 0 /0.3); - z-index: 0; - top: 0; - left: 0; - right: 0; - bottom: 0; - background-blend-mode: overlay; - height: 100%; - - .material-symbols-rounded { - position: absolute; - font-size: 15em !important; - left: 50%; - top: 50%; - transform: translate(-50%, -50%); - font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 50, "opsz" 60; - opacity: 0.5; - } - } - } - - &-text { - display: -webkit-box; - overflow: hidden; - 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 { - max-width: 25vw; - max-height: 20vh; - object-fit: contain; - object-position: left bottom; - filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); - // The logo is an inside a line-clamped heading; as an inline image - // its box was clipped by the heading's line box (cut-off titles). - display: block; - } - } - - &-poster { - position: absolute; - z-index: 3; - right: 7%; - top: 50%; - transform: translateY(-50%); - height: 66%; - max-width: 26%; - object-fit: contain; - border-radius: 14px; - box-shadow: 0 24px 60px rgb(0 0 0 / 0.65), 0 0 0 1px rgb(255 255 255 / 0.08); - pointer-events: none; - } - - &-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 { - position: absolute; - z-index: 3; + &-left, + &-right { display: flex; - gap: 1.5em; - height: 100%; - width: 100%; - max-width: 1400px; - padding: 4rem; - padding-bottom: 5rem; - padding-left: 5rem; - flex-direction: column; + align-items: center; + gap: 0.35rem; + min-width: 0; + } + + &-right { justify-content: flex-end; - align-items: flex-start; - left: 0; - bottom: 0; } - - &-info { - text-shadow: 0 1px 2px rgba(0,0,0,0.8); + + &-logo { + font-size: 1.9rem; + font-weight: 600; + font-style: italic; + letter-spacing: -0.045em; + line-height: 1; + user-select: none; + text-shadow: 0 2px 18px rgb(0 0 0 / 0.35); + } + + .home-nav-link { + padding: 0.5rem 0.7rem; + border: 0; + border-radius: 999px; + background: transparent; + color: rgb(255 255 255 / 0.76); + font: inherit; + font-size: 0.92rem; + font-weight: 500; + cursor: pointer; + transition: + color 0.18s ease, + background-color 0.18s ease; + + &:hover { + color: #fff; + background: rgb(255 255 255 / 0.08); + } + } + + .MuiIconButton-root { + width: 38px; + height: 38px; + color: rgb(255 255 255 / 0.88); + background: rgb(255 255 255 / 0.08); + border: 1px solid rgb(255 255 255 / 0.1); + backdrop-filter: blur(10px); + transition: + background-color 0.18s ease, + color 0.18s ease; + + &:hover { + color: #fff; + background: rgb(255 255 255 / 0.16); + } + + .material-symbols-rounded { + font-size: 1.25rem; + } } } -.backdropContainer { - background: linear-gradient( - 45deg, - $clr-background-default, - $clr-background-light - ); +.home-sections { + display: flex; + flex-direction: column; + padding: 2.5rem clamp(1.5rem, 3vw, 2.5rem) 8rem; + background: linear-gradient(180deg, #08090d 0%, #0b0c12 100%); + + .card-scroller-container { + margin-bottom: 1.8em; + } + + .card-scroller-heading-decoration { + display: none; + } + + .card-scroller-heading { + font-size: 1.15rem !important; + font-weight: 600 !important; + letter-spacing: -0.01em; + } } -@media (max-width: 1140px) { - .carousel { - height: 60vh !important; - // Never squeeze the hero below the height its own content needs, - // otherwise the title/logo is clipped by the slide's overflow. - min-height: 430px; - } - .hero-carousel { - &-poster { +body:has(.audio-player) .home-sections { + padding-bottom: 10rem; +} + +@media (max-width: 900px) { + .home-header { + .home-nav-link { display: none; } - &-detail { - width: 100%; - padding: 3rem; - padding-bottom: 4rem; - background: linear-gradient(to top, rgba(0,0,0,0.9), transparent); - } - - &-background-container::after { - background: linear-gradient(to top, rgba(0,0,0,0.8), transparent); - } - - &-text { - // Narrow layouts: the hero column is ~400px, a 3.75rem title wraps - // to two lines and overflows the slide, clipping the top line. - font-size: 2.5rem !important; - line-height: 1.15 !important; - - &-logo { - max-width: 60vw; - max-height: 10vh; - } + &-logo { + font-size: 1.6rem; } } -} \ No newline at end of file +} + +@media (max-width: 700px) { + .home-cinema { + padding: 0; + } + + .home-frame { + min-height: 100vh; + border: 0; + border-radius: 0; + } + + .home-header { + padding: 1rem 1.1rem; + + .MuiIconButton-root { + width: 34px; + height: 34px; + } + } + + .home-sections { + padding: 2rem 1.1rem 8rem; + } +} diff --git a/src/routes/_api/home/homeHeader.tsx b/src/routes/_api/home/homeHeader.tsx new file mode 100644 index 0000000..7ead9ab --- /dev/null +++ b/src/routes/_api/home/homeHeader.tsx @@ -0,0 +1,83 @@ +import IconButton from "@mui/material/IconButton"; +import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client"; +import { useNavigate } from "@tanstack/react-router"; +import React, { useCallback, useState } from "react"; +import { NavigationDrawer } from "@/components/appBar/navigationDrawer"; +import CastButton from "@/components/buttons/castButton"; +import { UserAvatarMenu } from "@/components/userAvatarMenu"; +import useSearchStore from "@/utils/store/search"; + +type HomeHeaderProps = { + libraries: BaseItemDto[]; + onNewAndPopular: () => void; +}; + +const HomeHeader = ({ libraries, onNewAndPopular }: HomeHeaderProps) => { + const navigate = useNavigate(); + const [drawerOpen, setDrawerOpen] = useState(false); + const toggleSearchDialog = useSearchStore((s) => s.toggleSearchDialog); + + const moviesLibrary = libraries.find( + (library) => library.CollectionType === "movies", + ); + + const openMovies = useCallback(() => { + if (!moviesLibrary?.Id) return; + navigate({ to: "/library/$id", params: { id: moviesLibrary.Id } }); + }, [moviesLibrary?.Id, navigate]); + + return ( + <> +
+
+ setDrawerOpen(true)} + > + menu + + {moviesLibrary?.Id && ( + + )} + +
+ +
+ Blink +
+ +
+ + search + + + navigate({ to: "/favorite" })} + > + favorite + + +
+
+ setDrawerOpen(false)} + /> + + ); +}; + +export default HomeHeader; diff --git a/src/routes/_api/home/index.tsx b/src/routes/_api/home/index.tsx index 37b38ab..5e985db 100644 --- a/src/routes/_api/home/index.tsx +++ b/src/routes/_api/home/index.tsx @@ -28,6 +28,7 @@ import { getLatestItemsQueryOptions } from "@/utils/queries/items"; import { useApiInContext } from "@/utils/store/api"; import { useBackdropStore } from "@/utils/store/backdrop"; import { useCentralStore } from "@/utils/store/central"; +import HomeHeader from "./homeHeader"; export const Route = createFileRoute("/_api/home/")({ component: Home, @@ -129,10 +130,13 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) { const heroItems = useMemo( () => - latestMedia.data?.filter( - (item) => - item.Type === BaseItemKind.Movie || item.Type === BaseItemKind.Series, - ) ?? [], + latestMedia.data + ?.filter( + (item) => + item.Type === BaseItemKind.Movie || + item.Type === BaseItemKind.Series, + ) + .slice(0, 10) ?? [], [latestMedia.data], ); @@ -168,20 +172,27 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) { [heroItems, setBackdropForItem], ); - return ( -
- - {heroItems.length > 0 && ( - - )} - + const scrollToNewAndPopular = useCallback(() => { + document + .getElementById("home-sections") + ?.scrollIntoView({ behavior: "smooth", block: "start" }); + }, []); + return ( +
+
+ + + + {heroItems.length > 0 && ( + + )} + + +
@@ -353,6 +364,8 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) { return ; })} +
+
); } diff --git a/src/utils/queries/items.ts b/src/utils/queries/items.ts index 1d39d76..ebe876c 100644 --- a/src/utils/queries/items.ts +++ b/src/utils/queries/items.ts @@ -64,6 +64,7 @@ export const getLatestItemsQueryOptions = ( ItemFields.ParentId, ItemFields.SeasonUserData, ItemFields.IsHd, + ItemFields.Genres, ItemFields.MediaStreams, ItemFields.MediaSources, ],