feat(home): cinematic rounded home page with integrated hero
Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped

Home is now a floating rounded window: an integrated header over full-bleed artwork, a large featured title with actions, and a Trending now rail that switches the hero. Existing home sections continue below in the same frame.
This commit is contained in:
1xDed committed 2026-11-27 18:42:19 +03:00
1 parent affbd00157
commit d5c1bfac64
9 files changed
+873 -489

No files matched your search

+2
View File
@@ -28,6 +28,8 @@ const HIDDEN_PATHS = [
"/settings", "/settings",
"/library", "/library",
"/search", "/search",
// The home page draws its own header inside the hero frame.
"/home",
]; ];
export const AppBar = () => { export const AppBar = () => {
+454 -169
View File
@@ -1,196 +1,481 @@
.carousel { @use "@/styles/variables.scss" as *;
position: relative;
overflow: visible;
height: 65vh;
margin-bottom: 3em;
display: grid;
grid-template-areas: "main sidebar";
grid-template-columns: 1fr 340px;
gap: 1.5em;
&-slide-wrapper { /* Cinematic home hero: full-bleed artwork, integrated type, bottom rail. */
grid-area: main; .cinema-hero {
position: relative; position: relative;
height: 100%; height: calc(100vh - 32px);
min-width: 0; min-height: 620px;
overflow: hidden;
isolation: isolate;
.hero-carousel-slide {
position: absolute;
inset: 0;
overflow: hidden; overflow: hidden;
border-radius: 20px; border: 0;
border-radius: 0;
box-shadow: none;
} }
&-sidebar { .hero-carousel-background-container {
overflow-y: auto; 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%; height: 100%;
position: relative; object-fit: cover;
@include glass-effect($bg-color: rgba(10, 10, 14, 0.4)); object-position: center;
border-radius: 24px;
grid-area: sidebar; &.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; display: flex;
flex-direction: column; flex-direction: column;
padding: 12px; justify-content: flex-end;
gap: 8px; align-items: flex-start;
gap: 0.9rem;
// Ensure programmatic scroll respects padding max-width: none;
scroll-padding-block: 24px; 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 { &::-webkit-scrollbar {
width: 0; width: 0;
height: 0; height: 0;
display: none; display: none;
} }
} }
&-button { .cinema-trending-card {
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);
position: relative; position: relative;
border-radius: 12px; // Slightly smaller radius to work with the bar flex: 0 0 auto;
background: transparent; width: clamp(200px, 21vw, 300px);
border: 1px solid transparent; aspect-ratio: 16 / 9;
padding: 0;
&: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;
overflow: hidden; overflow: hidden;
border-radius: 2px; border: 1px solid rgb(255 255 255 / 0.12);
padding: 2px; border-radius: 12px;
transition: opacity $transition-time-fast; background: rgb(255 255 255 / 0.05);
opacity: 0.5; cursor: pointer;
width: auto; opacity: 0.72;
&:hover { transition:
cursor: pointer; opacity 0.2s ease,
opacity: 0.8; border-color 0.2s ease,
} transform 0.2s ease;
&-container { img {
display: flex;
gap: 1em;
align-items: center;
justify-content: center;
}
&-image {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
border-radius: 4px; display: block;
} }
&-icon { &::after {
display: flex; content: "";
align-items: center; position: absolute;
justify-content: center; inset: 0;
width: 100%; background: linear-gradient(0deg, rgb(0 0 0 / 0.35), transparent 55%);
height: 100%;
background: rgb(155 155 155 / 0.4);
border-radius: 4px;
} }
&:hover {
opacity: 1;
border-color: rgb(255 255 255 / 0.4);
transform: translateY(-2px);
}
&.active { &.active {
opacity: 1; opacity: 1;
border-color: rgb(255 255 255 / 0.7);
.material-symbols-rounded { box-shadow: 0 0 0 1px rgb(255 255 255 / 0.25);
}
--fill: 1; }
}
.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;
}
}
}
+125 -90
View File
@@ -1,23 +1,23 @@
import React, { useCallback, useEffect, useState } from "react"; import React, { useCallback, useEffect, useState } from "react";
import type { Api } from "@jellyfin/sdk"; import type { Api } from "@jellyfin/sdk";
import { useCarouselStore } from "../../utils/store/carousel";
import "./carousel.scss";
import { import {
type BaseItemDto, type BaseItemDto,
BaseItemKind, BaseItemKind,
} from "@jellyfin/sdk/lib/generated-client"; } from "@jellyfin/sdk/lib/generated-client";
import { useCarouselStore } from "../../utils/store/carousel";
import "./carousel.scss";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi"; import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { resolveItemImage } from "@/utils/methods/itemImages"; import { resolveItemImage } from "@/utils/methods/itemImages";
import { useApiInContext } from "@/utils/store/api"; import { useApiInContext } from "@/utils/store/api";
import CarouselSlide from "../carouselSlide"; import CarouselSlide from "../carouselSlide";
import CarouselTickers from "./tickers";
const AUTOPLAY_MS = 9000;
// Memoize CarouselSlide to prevent unnecessary re-renders // Memoize CarouselSlide to prevent unnecessary re-renders
const MemoizedCarouselSlide = React.memo(CarouselSlide); const MemoizedCarouselSlide = React.memo(CarouselSlide);
/** Sidebar thumbnail: prefer Thumb, fall back to Backdrop/Primary when missing. */ /** Wide artwork for the trending rail, falling back through the item's images. */
const tickerImageUrl = ( const trendingImageUrl = (
api: Api, api: Api,
item: BaseItemDto, item: BaseItemDto,
): string | undefined => { ): string | undefined => {
@@ -27,13 +27,19 @@ const tickerImageUrl = (
image.itemId, image.itemId,
image.imageType, image.imageType,
{ {
quality: 90, quality: 85,
fillHeight: 360, fillWidth: 480,
tag: image.tag, 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 = ({ const Carousel = ({
content, content,
onChange, onChange,
@@ -43,107 +49,136 @@ const Carousel = ({
}) => { }) => {
const [currentSlide, setCurrentSlide] = useState(0); const [currentSlide, setCurrentSlide] = useState(0);
const [isPaused, setIsPaused] = useState(false); const [isPaused, setIsPaused] = useState(false);
const sidebarRef = React.useRef<HTMLDivElement>(null);
const tickerRefs = React.useRef<(HTMLDivElement | null)[]>([]);
const currentSlideRef = React.useRef(currentSlide);
const [setDirection] = useCarouselStore((state) => [state.setDirection]); const [setDirection] = useCarouselStore((state) => [state.setDirection]);
const api = useApiInContext((s) => s.api);
const total = content.length;
useEffect(() => { useEffect(() => {
currentSlideRef.current = currentSlide; if (currentSlide >= total && total > 0) {
}, [currentSlide]); setCurrentSlide(total - 1);
}
}, [currentSlide, total]);
useEffect(() => { useEffect(() => {
onChange(currentSlide); onChange(currentSlide);
}, [currentSlide, onChange]);
// Auto-scroll sidebar to keep active item in view const goTo = useCallback(
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(
(index: number) => { (index: number) => {
if (index === currentSlideRef.current) return; if (index === currentSlide) return;
setDirection(index > currentSlideRef.current ? "right" : "left"); setDirection(index > currentSlide ? "right" : "left");
setCurrentSlide(index); 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 ( return (
<div <section
className={`carousel ${isPaused ? "paused" : ""}`} className={`cinema-hero ${isPaused ? "paused" : ""}`}
aria-roledescription="carousel"
aria-label="Featured"
onMouseEnter={() => setIsPaused(true)} onMouseEnter={() => setIsPaused(true)}
onMouseLeave={() => setIsPaused(false)} onMouseLeave={() => setIsPaused(false)}
> >
<div className="hero-carousel-slide-wrapper"> <MemoizedCarouselSlide key={currentItem.Id} item={currentItem} />
<MemoizedCarouselSlide item={content[currentSlide]} />
</div> {total > 1 && (
<div className="carousel-sidebar" ref={sidebarRef}> <>
{content.map((item, index) => ( <button
<div type="button"
key={item.Id} className="cinema-arrow left"
ref={(el) => { onClick={previous}
tickerRefs.current[index] = el; aria-label="Previous"
}}
className="carousel-ticker-wrapper"
> >
<CarouselTickers <span className="material-symbols-rounded">chevron_left</span>
imageUrl={tickerImageUrl(api, item)} </button>
isActive={index === currentSlide} <button
itemName={item.Name ?? "Unknown"} type="button"
itemYear={ className="cinema-arrow right"
item.Type === BaseItemKind.Series && item.EndDate onClick={next}
? `${item.ProductionYear ?? ""} - ${new Date(item.EndDate).getFullYear().toString()}` aria-label="Next"
: (item.ProductionYear?.toString() ?? "") >
} <span className="material-symbols-rounded">chevron_right</span>
onTickerClick={handleTickerClick} </button>
index={index} </>
itemType={item.Type as BaseItemKind} )}
/>
</div> <div className="cinema-trending">
))} <div className="cinema-trending-head">
<h3>Trending now</h3>
{total > 1 && (
<div className="cinema-dots">
{content.map((item, index) => (
<button
key={item.Id}
type="button"
className={index === currentSlide ? "active" : ""}
onClick={() => goTo(index)}
aria-label={item.Name ?? `Slide ${index + 1}`}
aria-current={index === currentSlide}
/>
))}
</div>
)}
</div>
<div className="cinema-trending-rail">
{content.map((item, index) => {
const imageUrl = trendingImageUrl(api, item);
return (
<button
key={item.Id}
type="button"
className={`cinema-trending-card ${
index === currentSlide ? "active" : ""
}`}
onClick={() => goTo(index)}
aria-label={item.Name ?? "Featured item"}
>
{imageUrl ? (
<img src={imageUrl} alt="" loading="lazy" />
) : (
<div className="cinema-trending-placeholder">
<span className="material-symbols-rounded">
{ item.Type === BaseItemKind.Series ? "tv" : "movie" }
</span>
</div>
)}
<span className="cinema-trending-chip">
{trendingLabel(item)}
</span>
</button>
);
})}
</div>
</div> </div>
</div> </section>
); );
}; };
+15 -18
View File
@@ -137,6 +137,20 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
}, },
}} }}
> >
<MotionStack
custom={animationDirection}
variants={textVariants}
direction="row"
sx={{ alignItems: "center", gap: 1 }}
>
<span className="hero-carousel-label">
{item.UserData?.PlaybackPositionTicks
? "Continue watching"
: item.Type === BaseItemKind.Series
? "New series"
: "New movie"}
</span>
</MotionStack>
<MotionTypography <MotionTypography
custom={animationDirection} custom={animationDirection}
variants={textVariants} variants={textVariants}
@@ -146,26 +160,9 @@ const CarouselSlide = ({ item }: { item: BaseItemDto }) => {
sx={{ sx={{
fontWeight: 600, fontWeight: 600,
overflow: "visible", overflow: "visible",
mb: "5px",
}} }}
> >
{!item.ImageTags?.Logo ? ( {item.Name}
item.Name
) : (
<img
alt={item.Name ?? "Item"}
className="hero-carousel-text-logo"
src={`${api?.basePath}/Items/${item.Id}/Images/Logo?quality=90&tag=${item.ImageTags.Logo}`}
style={{
opacity: 0,
transition: "opacity 0.2s",
objectFit: "contain",
}}
onLoad={(e) => {
e.currentTarget.style.opacity = "1";
}}
/>
)}
</MotionTypography> </MotionTypography>
<MotionStack <MotionStack
custom={animationDirection} custom={animationDirection}
+16 -1
View File
@@ -52,6 +52,7 @@ const OverlayScrollbar = () => {
document.body.classList.add("has-overlay-scrollbar"); document.body.classList.add("has-overlay-scrollbar");
let frame = 0; let frame = 0;
let measureTimer = 0;
let lastShow = 0; let lastShow = 0;
const setVisible = (visible: boolean) => { const setVisible = (visible: boolean) => {
@@ -90,10 +91,12 @@ const OverlayScrollbar = () => {
// Expensive path: runs on mount and when page/window geometry changes. // Expensive path: runs on mount and when page/window geometry changes.
const measure = () => { 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 header = document.querySelector("header");
const insetTop = Math.max( const insetTop = Math.max(
0, 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 trackHeight = Math.max(0, window.innerHeight - insetTop - 6);
const topStyle = `${insetTop}px`; const topStyle = `${insetTop}px`;
@@ -139,8 +142,19 @@ const OverlayScrollbar = () => {
if (frame) return; if (frame) return;
frame = window.requestAnimationFrame(() => { frame = window.requestAnimationFrame(() => {
frame = 0; frame = 0;
window.clearTimeout(measureTimer);
measure(); 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 = () => { const onScroll = () => {
@@ -214,6 +228,7 @@ const OverlayScrollbar = () => {
return () => { return () => {
window.clearTimeout(hideTimer.current); window.clearTimeout(hideTimer.current);
window.clearTimeout(measureTimer);
if (frame) window.cancelAnimationFrame(frame); if (frame) window.cancelAnimationFrame(frame);
scroller.removeEventListener("scroll", onScroll); scroller.removeEventListener("scroll", onScroll);
window.removeEventListener("resize", onResize); window.removeEventListener("resize", onResize);
+147 -194
View File
@@ -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; position: relative;
overflow: visible; overflow: hidden;
isolation: isolate; min-height: calc(100vh - 32px);
height: 100%; border: 1px solid rgb(255 255 255 / 0.07);
width: 100%; border-radius: 28px;
background: #08090d;
box-shadow: 0 28px 70px rgb(0 0 0 / 0.45);
}
&-slide { /* Header floating over the hero artwork. */
position: relative; .home-header {
height: 100%; position: absolute;
width: 100%; top: 0;
overflow: hidden; left: 0;
margin: 0; right: 0;
border: none; z-index: 20;
border-radius: 20px; display: grid;
grid-area: main; grid-template-columns: 1fr auto 1fr;
border: 1.2px solid rgb(255 255 255 / 0.1); align-items: center;
box-shadow: 0 0 20px rgba(0,0,0,0.2); 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 { &-left,
&-container { &-right {
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 <img> 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;
display: flex; display: flex;
gap: 1.5em; align-items: center;
height: 100%; gap: 0.35rem;
width: 100%; min-width: 0;
max-width: 1400px; }
padding: 4rem;
padding-bottom: 5rem; &-right {
padding-left: 5rem;
flex-direction: column;
justify-content: flex-end; justify-content: flex-end;
align-items: flex-start;
left: 0;
bottom: 0;
} }
&-info { &-logo {
text-shadow: 0 1px 2px rgba(0,0,0,0.8); 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 { .home-sections {
background: linear-gradient( display: flex;
45deg, flex-direction: column;
$clr-background-default, padding: 2.5rem clamp(1.5rem, 3vw, 2.5rem) 8rem;
$clr-background-light 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) { body:has(.audio-player) .home-sections {
.carousel { padding-bottom: 10rem;
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. @media (max-width: 900px) {
min-height: 430px; .home-header {
} .home-nav-link {
.hero-carousel {
&-poster {
display: none; display: none;
} }
&-detail { &-logo {
width: 100%; font-size: 1.6rem;
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;
}
} }
} }
} }
@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;
}
}
+83
View File
@@ -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 (
<>
<header className="home-header" data-tauri-drag-region>
<div className="home-header-left" data-tauri-drag-region>
<IconButton
aria-label="Open navigation"
onClick={() => setDrawerOpen(true)}
>
<span className="material-symbols-rounded">menu</span>
</IconButton>
{moviesLibrary?.Id && (
<button
type="button"
className="home-nav-link"
onClick={openMovies}
>
Movies
</button>
)}
<button
type="button"
className="home-nav-link"
onClick={onNewAndPopular}
>
New &amp; Popular
</button>
</div>
<div className="home-header-logo" data-tauri-drag-region>
Blink
</div>
<div className="home-header-right">
<IconButton aria-label="Search" onClick={toggleSearchDialog}>
<span className="material-symbols-rounded">search</span>
</IconButton>
<CastButton />
<IconButton
aria-label="Favorites"
onClick={() => navigate({ to: "/favorite" })}
>
<span className="material-symbols-rounded">favorite</span>
</IconButton>
<UserAvatarMenu />
</div>
</header>
<NavigationDrawer
open={drawerOpen}
onClose={() => setDrawerOpen(false)}
/>
</>
);
};
export default HomeHeader;
+30 -17
View File
@@ -28,6 +28,7 @@ import { getLatestItemsQueryOptions } from "@/utils/queries/items";
import { useApiInContext } from "@/utils/store/api"; import { useApiInContext } from "@/utils/store/api";
import { useBackdropStore } from "@/utils/store/backdrop"; import { useBackdropStore } from "@/utils/store/backdrop";
import { useCentralStore } from "@/utils/store/central"; import { useCentralStore } from "@/utils/store/central";
import HomeHeader from "./homeHeader";
export const Route = createFileRoute("/_api/home/")({ export const Route = createFileRoute("/_api/home/")({
component: Home, component: Home,
@@ -129,10 +130,13 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) {
const heroItems = useMemo( const heroItems = useMemo(
() => () =>
latestMedia.data?.filter( latestMedia.data
(item) => ?.filter(
item.Type === BaseItemKind.Movie || item.Type === BaseItemKind.Series, (item) =>
) ?? [], item.Type === BaseItemKind.Movie ||
item.Type === BaseItemKind.Series,
)
.slice(0, 10) ?? [],
[latestMedia.data], [latestMedia.data],
); );
@@ -168,20 +172,27 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) {
[heroItems, setBackdropForItem], [heroItems, setBackdropForItem],
); );
return ( const scrollToNewAndPopular = useCallback(() => {
<main document
className="scrollY home padded-top" .getElementById("home-sections")
style={{ ?.scrollIntoView({ behavior: "smooth", block: "start" });
flexGrow: 1, }, []);
position: "relative",
}}
>
<ErrorBoundary FallbackComponent={ErrorNotice}>
{heroItems.length > 0 && (
<Carousel content={heroItems} onChange={handleOnChangeCarousel} />
)}
</ErrorBoundary>
return (
<main className="home-cinema">
<div className="home-frame">
<HomeHeader
libraries={libraries.data?.Items ?? []}
onNewAndPopular={scrollToNewAndPopular}
/>
<ErrorBoundary FallbackComponent={ErrorNotice}>
{heroItems.length > 0 && (
<Carousel content={heroItems} onChange={handleOnChangeCarousel} />
)}
</ErrorBoundary>
<div className="home-sections" id="home-sections">
<ErrorBoundary <ErrorBoundary
fallback={ fallback={
<div className="error"> <div className="error">
@@ -353,6 +364,8 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) {
return <LatestMediaSection key={lib.Id} latestMediaLib={lib} />; return <LatestMediaSection key={lib.Id} latestMediaLib={lib} />;
})} })}
</ErrorBoundary> </ErrorBoundary>
</div>
</div>
</main> </main>
); );
} }
+1
View File
@@ -64,6 +64,7 @@ export const getLatestItemsQueryOptions = (
ItemFields.ParentId, ItemFields.ParentId,
ItemFields.SeasonUserData, ItemFields.SeasonUserData,
ItemFields.IsHd, ItemFields.IsHd,
ItemFields.Genres,
ItemFields.MediaStreams, ItemFields.MediaStreams,
ItemFields.MediaSources, ItemFields.MediaSources,
], ],