feat(music): redesign the music section around the player
- album, playlist and artist pages share one layout: sleeve with a record edge, large title, metadata, full-width track list and an about block - full-screen player: wall colour from the cover's blurhash, large sleeve, transport at the bottom, queue sliding out from under the cover - queue rows show current/upcoming tracks with covers, hearts and durations; lyrics open in the same panel - bottom bar follows: floating capsule, white play button and accent progress - artist page rebuilt with a round portrait, tabs and an album grid - music library gets a calmer grid and an aligned alphabet rail
This commit is contained in:
1 parent
fcf61012db
commit
9f314582c0
13 files changed
+2105
-1505
No files matched your search
@@ -1,60 +1,111 @@
|
||||
.item-info-track{
|
||||
display: grid;
|
||||
grid-template-columns: 3em 60% 6em 1fr;
|
||||
gap: 1em;
|
||||
padding: 1em;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
border-radius: $border-radius-default;
|
||||
transition: background $transition-time-fast;
|
||||
&.header {
|
||||
border-bottom: 1px solid rgb(255 255 255 / 0.2);
|
||||
color: rgb(255 255 255 / 0.7);
|
||||
border-radius: 0 !important;
|
||||
}
|
||||
.index-container {
|
||||
justify-self: center;
|
||||
position: relative;
|
||||
.material-symbols-rounded {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
font-size: 2em !important;
|
||||
opacity: 0;
|
||||
transition: none !important;
|
||||
color: $clr-accent-default;
|
||||
}
|
||||
}
|
||||
&-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.1em
|
||||
}
|
||||
&:hover {
|
||||
background: rgb(255 255 255 / 0.1) !important;
|
||||
.index-container {
|
||||
// font-size: 0em;
|
||||
.index {
|
||||
opacity: 0;
|
||||
transition: opacity 0;
|
||||
}
|
||||
.material-symbols-rounded {
|
||||
opacity: 1;
|
||||
font-size: 2.2em !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.playing {
|
||||
background: rgb(0 0 0 / 0.4) !important;
|
||||
.item-info-track-info-name, .index {
|
||||
color: $clr-accent-default;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
&-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.4em
|
||||
}
|
||||
}
|
||||
.album-track {
|
||||
display: grid;
|
||||
grid-template-columns: 2.4em minmax(0, 1fr) 4.5em 2.6em;
|
||||
gap: 1em;
|
||||
align-items: center;
|
||||
padding: 0.5em 1em;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
transition: background $transition-time-fast;
|
||||
|
||||
&-index {
|
||||
position: relative;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
&-number {
|
||||
font-size: 0.8rem;
|
||||
color: rgb(255 255 255 / 0.4);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
&-play {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%) scale(0.9);
|
||||
opacity: 0;
|
||||
font-size: 1.4rem;
|
||||
color: #fff;
|
||||
transition: opacity $transition-time-fast, transform $transition-time-fast;
|
||||
}
|
||||
|
||||
&-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.15em;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&-name {
|
||||
font-size: 0.95rem;
|
||||
color: rgb(255 255 255 / 0.92);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
&-artist {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5em;
|
||||
font-size: 0.78rem;
|
||||
color: rgb(255 255 255 / 0.45);
|
||||
|
||||
img {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
&-duration {
|
||||
text-align: right;
|
||||
font-size: 0.8rem;
|
||||
color: rgb(255 255 255 / 0.45);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
&-like {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
opacity: 0;
|
||||
transition: opacity $transition-time-fast;
|
||||
|
||||
.MuiIconButton-root {
|
||||
padding: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: rgb(255 255 255 / 0.06);
|
||||
|
||||
.album-track-number {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.album-track-play {
|
||||
opacity: 1;
|
||||
transform: translate(-50%, -50%) scale(1);
|
||||
}
|
||||
|
||||
.album-track-like {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&.is-playing {
|
||||
background: rgb(245 25 107 / 0.1);
|
||||
|
||||
.album-track-name,
|
||||
.album-track-number,
|
||||
.album-track-duration {
|
||||
color: $clr-accent-default;
|
||||
}
|
||||
|
||||
.album-track-like {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,19 @@
|
||||
import type {
|
||||
BaseItemDto,
|
||||
BaseItemDtoQueryResult,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import React from "react";
|
||||
import { useSnackbar } from "notistack";
|
||||
import lyricsIcon from "../../assets/icons/lyrics.svg";
|
||||
import { getRuntimeMusic } from "@/utils/date/time";
|
||||
import {
|
||||
generateAudioStreamUrl,
|
||||
playAudio,
|
||||
useAudioPlayback,
|
||||
} from "@/utils/store/audioPlayback";
|
||||
import type {
|
||||
BaseItemDto,
|
||||
BaseItemDtoQueryResult,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { Typography } from "@mui/material";
|
||||
import React from "react";
|
||||
|
||||
import { getRuntimeMusic } from "@/utils/date/time";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { setQueue } from "@/utils/store/queue";
|
||||
import { useSnackbar } from "notistack";
|
||||
import lyricsIcon from "../../assets/icons/lyrics.svg";
|
||||
import LikeButton from "../buttons/likeButton";
|
||||
|
||||
import "./albumMusicTrack.scss";
|
||||
@@ -62,46 +60,42 @@ export default function AlbumMusicTrack(props: AlbumMusicTrackProps) {
|
||||
setQueue(queue, index);
|
||||
}
|
||||
};
|
||||
|
||||
const isPlaying = currentPlayingItem?.Id === track.Id;
|
||||
const artists = track.Artists?.filter(Boolean) ?? [];
|
||||
|
||||
return (
|
||||
<div
|
||||
className={
|
||||
currentPlayingItem?.Id === track.Id
|
||||
? "item-info-track playing"
|
||||
: "item-info-track"
|
||||
}
|
||||
key={track.Id}
|
||||
className={isPlaying ? "album-track is-playing" : "album-track"}
|
||||
onClick={() => {
|
||||
if (musicTracks?.Items) {
|
||||
handlePlayback(trackIndex, track, musicTracks.Items);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div className="index-container">
|
||||
<span className="material-symbols-rounded fill ">play_arrow</span>
|
||||
<Typography className="index">{track.IndexNumber ?? "-"}</Typography>
|
||||
<div className="album-track-index">
|
||||
<span className="material-symbols-rounded album-track-play">
|
||||
play_arrow
|
||||
</span>
|
||||
<span className="album-track-number">
|
||||
{track.IndexNumber ?? "–"}
|
||||
</span>
|
||||
</div>
|
||||
<div className="item-info-track-info">
|
||||
<Typography className="item-info-track-info-name">
|
||||
{track.Name}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
style={{
|
||||
opacity: 0.6,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: "0.6em",
|
||||
}}
|
||||
sx={{
|
||||
fontWeight: 300,
|
||||
}}
|
||||
>
|
||||
{track.HasLyrics && <img src={lyricsIcon} alt="Текст песни" />}
|
||||
{track.Artists?.join(", ")}
|
||||
</Typography>
|
||||
<div className="album-track-info">
|
||||
<span className="album-track-name">{track.Name}</span>
|
||||
{(artists.length > 0 || track.HasLyrics) && (
|
||||
<span className="album-track-artist">
|
||||
{track.HasLyrics && (
|
||||
<img src={lyricsIcon} alt="Есть текст песни" />
|
||||
)}
|
||||
{artists.join(", ")}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<Typography>{getRuntimeMusic(track.RunTimeTicks ?? 0)}</Typography>
|
||||
<div className="flex flex-align-center">
|
||||
<span className="album-track-duration">
|
||||
{getRuntimeMusic(track.RunTimeTicks ?? 0)}
|
||||
</span>
|
||||
<div className="album-track-like" onClick={(e) => e.stopPropagation()}>
|
||||
<LikeButton
|
||||
itemId={track.Id}
|
||||
isFavorite={track.UserData?.IsFavorite}
|
||||
|
||||
@@ -232,12 +232,12 @@ $art-size: 48px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: min(1440px, calc(100% - 1.5rem));
|
||||
height: 84px;
|
||||
height: 82px;
|
||||
gap: 1.25rem;
|
||||
padding: 0 0.9rem;
|
||||
background: #0b0c12;
|
||||
background: #0b0816;
|
||||
border: 1px solid rgb(255 255 255 / 0.08);
|
||||
border-radius: 16px;
|
||||
border-radius: 18px;
|
||||
|
||||
.media-bar {
|
||||
&-left {
|
||||
@@ -325,7 +325,7 @@ $art-size: 48px;
|
||||
background: rgb(255 255 255 / 0.06);
|
||||
}
|
||||
&.active {
|
||||
color: #7cc7ff;
|
||||
color: $clr-accent-default;
|
||||
}
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.25rem;
|
||||
@@ -334,11 +334,19 @@ $art-size: 48px;
|
||||
}
|
||||
|
||||
&-play {
|
||||
width: 42px !important;
|
||||
height: 42px !important;
|
||||
margin: 0 0.35rem;
|
||||
border: 1px solid rgb(255 255 255 / 0.35);
|
||||
color: #fff !important;
|
||||
width: 46px !important;
|
||||
height: 46px !important;
|
||||
margin: 0 0.5rem;
|
||||
background: #fff !important;
|
||||
border: 0;
|
||||
color: #0b0417 !important;
|
||||
box-shadow: 0 6px 18px rgb(0 0 0 / 0.35);
|
||||
transition: transform 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
background: #fff !important;
|
||||
transform: scale(1.04);
|
||||
}
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.6rem !important;
|
||||
}
|
||||
@@ -350,7 +358,7 @@ $art-size: 48px;
|
||||
|
||||
.MuiSlider-root {
|
||||
padding: 10px 0;
|
||||
color: #7cc7ff;
|
||||
color: $clr-accent-default;
|
||||
}
|
||||
.MuiSlider-rail {
|
||||
background: rgb(255 255 255 / 0.16);
|
||||
@@ -397,7 +405,7 @@ $art-size: 48px;
|
||||
&-volume {
|
||||
width: 84px !important;
|
||||
margin: 0 0.35rem 0 0 !important;
|
||||
color: #7cc7ff !important;
|
||||
color: $clr-accent-default !important;
|
||||
|
||||
.MuiSlider-rail {
|
||||
background: rgb(255 255 255 / 0.16);
|
||||
|
||||
@@ -89,6 +89,9 @@ const AudioPlayer = () => {
|
||||
const [remoteVolumeDraft, setRemoteVolumeDraft] = useState<number | null>(
|
||||
null,
|
||||
);
|
||||
const remoteVolumeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(
|
||||
null,
|
||||
);
|
||||
useEffect(() => setRemoteVolumeDraft(null), [selectedRemoteId]);
|
||||
|
||||
const sessions = useQuery({
|
||||
@@ -132,6 +135,20 @@ const AudioPlayer = () => {
|
||||
: undefined;
|
||||
remoteActiveRef.current = Boolean(remote);
|
||||
|
||||
// Keep the picked remote volume until the target reports it back (progress
|
||||
// updates can lag by seconds), then drop the optimistic value.
|
||||
useEffect(() => {
|
||||
if (remoteVolumeDraft == null) return;
|
||||
const server = remote?.PlayState?.VolumeLevel;
|
||||
if (server != null && Math.abs(server / 100 - remoteVolumeDraft) <= 0.02) {
|
||||
setRemoteVolumeDraft(null);
|
||||
if (remoteVolumeTimerRef.current) {
|
||||
clearTimeout(remoteVolumeTimerRef.current);
|
||||
remoteVolumeTimerRef.current = null;
|
||||
}
|
||||
}
|
||||
}, [remote?.PlayState?.VolumeLevel, remoteVolumeDraft]);
|
||||
|
||||
const activeItem: BaseItemDto | undefined | null =
|
||||
remote?.NowPlayingItem ?? item;
|
||||
const artists = activeItem?.ArtistItems?.length
|
||||
@@ -198,7 +215,9 @@ const AudioPlayer = () => {
|
||||
// visibility rather than the DOM: during the exit animation the element is
|
||||
// still mounted but already off-screen.
|
||||
const isFullPlayer =
|
||||
location.pathname === "/player" || location.pathname === "/player/audio";
|
||||
location.pathname === "/player" ||
|
||||
location.pathname === "/player/audio" ||
|
||||
location.pathname === "/remote";
|
||||
useEffect(() => {
|
||||
const visible = barVisible && !isFullPlayer;
|
||||
document.body.classList.toggle("has-player-bar", visible);
|
||||
@@ -735,7 +754,13 @@ const AudioPlayer = () => {
|
||||
onChangeCommitted={(_, value) => {
|
||||
if (!remote) return;
|
||||
const next = Array.isArray(value) ? value[0] : value;
|
||||
setRemoteVolumeDraft(null);
|
||||
setRemoteVolumeDraft(next);
|
||||
if (remoteVolumeTimerRef.current) {
|
||||
clearTimeout(remoteVolumeTimerRef.current);
|
||||
}
|
||||
remoteVolumeTimerRef.current = setTimeout(() => {
|
||||
setRemoteVolumeDraft(null);
|
||||
}, 12000);
|
||||
sendGeneral(GeneralCommandType.SetVolume, {
|
||||
Volume: String(Math.round(next * 100)),
|
||||
});
|
||||
@@ -797,13 +822,13 @@ const AudioPlayer = () => {
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
setMoreAnchor(null);
|
||||
openRemoteDialog();
|
||||
navigate({ to: "/remote" });
|
||||
}}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<span className="material-symbols-rounded">settings_remote</span>
|
||||
</ListItemIcon>
|
||||
<ListItemText primary="Удалённое управление…" />
|
||||
<ListItemText primary="Удалённый пульт" />
|
||||
</MenuItem>
|
||||
<Divider />
|
||||
<MenuItem
|
||||
|
||||
+163
-175
@@ -2,34 +2,41 @@ import { BaseItemKind, SortOrder } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { createFileRoute, Link } from "@tanstack/react-router";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import React, { useLayoutEffect, useMemo } from "react";
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import AlbumMusicTrack from "@/components/albumMusicTrack";
|
||||
import InstantMixButton from "@/components/buttons/instantMixButton";
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import PlayButton from "@/components/buttons/playButton";
|
||||
import { Card } from "@/components/card/card";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||
import { getRuntimeCompact } from "@/utils/date/time";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import "./album.scss";
|
||||
|
||||
import { Chip } from "@mui/material";
|
||||
import { createFileRoute, Link } from "@tanstack/react-router";
|
||||
import { createPortal } from "react-dom";
|
||||
import AlbumMusicTrack from "@/components/albumMusicTrack";
|
||||
import ShowMoreText from "@/components/showMoreText";
|
||||
import TagChip from "@/components/tagChip";
|
||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||
import { getRuntimeCompact } from "@/utils/date/time";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
|
||||
import "../music.scss";
|
||||
|
||||
export const Route = createFileRoute("/_api/music/album/$id")({
|
||||
component: MusicAlbumTitlePage,
|
||||
});
|
||||
|
||||
const tracksLabel = (count: number) => {
|
||||
const mod10 = count % 10;
|
||||
const mod100 = count % 100;
|
||||
if (mod10 === 1 && mod100 !== 11) return `${count} трек`;
|
||||
if (mod10 >= 2 && mod10 <= 4 && (mod100 < 12 || mod100 > 14)) {
|
||||
return `${count} трека`;
|
||||
}
|
||||
return `${count} треков`;
|
||||
};
|
||||
|
||||
function MusicAlbumTitlePage() {
|
||||
const { id } = Route.useParams();
|
||||
const api = useApiInContext((s) => s.api);
|
||||
@@ -120,7 +127,7 @@ function MusicAlbumTitlePage() {
|
||||
}
|
||||
}, [item.isSuccess, item.data, setBackdrop]);
|
||||
|
||||
if (item.isPending || similarItems.isPending) {
|
||||
if (item.isPending) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@@ -135,170 +142,153 @@ function MusicAlbumTitlePage() {
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
if (item.isSuccess && item.data && similarItems.isSuccess) {
|
||||
|
||||
if (item.isError) {
|
||||
return <ErrorNotice />;
|
||||
}
|
||||
|
||||
if (item.isSuccess && item.data) {
|
||||
const trackCount = musicTracks.data?.TotalRecordCount ?? 0;
|
||||
const genres = item.data.GenreItems ?? [];
|
||||
const artistId = item.data.AlbumArtists?.[0]?.Id;
|
||||
const coverUrl =
|
||||
api && item.data.ImageTags?.Primary
|
||||
? getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
tag: item.data.ImageTags.Primary,
|
||||
quality: 90,
|
||||
},
|
||||
)
|
||||
: null;
|
||||
|
||||
return (
|
||||
<div key={id} className="scrollY padded-top item item-album">
|
||||
<div className="item-info">
|
||||
<Typography className="item-info-name" variant="h3">
|
||||
{item.data?.Name}
|
||||
</Typography>
|
||||
<div className="flex flex-align-center item-info-album-info">
|
||||
{/* @ts-ignore - Using Link as component */}
|
||||
<Link
|
||||
to="/music/artist/$id"
|
||||
params={{ id: item.data.AlbumArtists?.[0].Id ?? "" }}
|
||||
>
|
||||
<Chip
|
||||
// component={Link}
|
||||
className="flex flex-align-center"
|
||||
style={{
|
||||
color: "white",
|
||||
textDecoration: "none",
|
||||
}}
|
||||
icon={
|
||||
<span
|
||||
className="material-symbols-rounded fill"
|
||||
style={{
|
||||
paddingLeft: "0.25em",
|
||||
}}
|
||||
>
|
||||
artist
|
||||
</span>
|
||||
}
|
||||
label={item.data.AlbumArtist}
|
||||
/>
|
||||
</Link>
|
||||
<Typography className="opacity-07">
|
||||
{item.data.ProductionYear}
|
||||
</Typography>
|
||||
<Typography className="opacity-07">
|
||||
{(musicTracks.data?.TotalRecordCount ?? 0) > 1
|
||||
? `${musicTracks.data?.TotalRecordCount} песен`
|
||||
: "Сингл"}
|
||||
</Typography>
|
||||
<Typography className="opacity-07">
|
||||
{getRuntimeCompact(item.data.CumulativeRunTimeTicks ?? 0)}
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="item-info-buttons">
|
||||
<PlayButton
|
||||
item={item.data}
|
||||
audio
|
||||
itemType={item.data.Type ?? "Audio"}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
<InstantMixButton item={item.data} />
|
||||
<LikeButton
|
||||
itemId={item.data.Id}
|
||||
isFavorite={item.data.UserData?.IsFavorite}
|
||||
queryKey={["item", "musicTracks"]}
|
||||
userId={user?.Id}
|
||||
itemName={item.data.Name}
|
||||
/>
|
||||
</div>
|
||||
<div className="item-info-track-container ">
|
||||
{allDiscs.length > 1 ? (
|
||||
allDiscs.map((disc) => (
|
||||
<div className="item-info-disc-container" key={disc}>
|
||||
<div
|
||||
className="item-info-disc-header flex flex-row flex-align-center"
|
||||
style={{ marginBottom: "1em" }}
|
||||
>
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
style={{ fontSize: "2em" }}
|
||||
>
|
||||
album
|
||||
</span>
|
||||
<Typography variant="h5">Диск {disc}</Typography>
|
||||
</div>
|
||||
<div className="item-info-track header">
|
||||
<span className="material-symbols-rounded index">tag</span>
|
||||
<Typography variant="subtitle1">Название</Typography>
|
||||
<Typography variant="subtitle1">Длительность</Typography>
|
||||
</div>
|
||||
{musicTracks.data?.Items?.map(
|
||||
(track, index) =>
|
||||
track.ParentIndexNumber === disc && (
|
||||
<AlbumMusicTrack
|
||||
key={track.Id}
|
||||
track={track}
|
||||
trackIndex={index}
|
||||
musicTracks={musicTracks.data}
|
||||
/>
|
||||
),
|
||||
)}
|
||||
</div>
|
||||
))
|
||||
<div key={id} className="scrollY padded-top music-page">
|
||||
<header className="music-hero">
|
||||
<div className="music-cover">
|
||||
<div className="music-cover-disc" aria-hidden="true" />
|
||||
{coverUrl ? (
|
||||
<img src={coverUrl} alt={item.data.Name ?? "Альбом"} />
|
||||
) : (
|
||||
<div>
|
||||
<div className="item-info-track header">
|
||||
<span className="material-symbols-rounded index">tag</span>
|
||||
<Typography variant="subtitle1">Название</Typography>
|
||||
<Typography variant="subtitle1">Длительность</Typography>
|
||||
</div>
|
||||
{musicTracks.data?.Items?.map((track, index) => (
|
||||
<AlbumMusicTrack
|
||||
key={track.Id}
|
||||
track={track}
|
||||
trackIndex={index}
|
||||
musicTracks={musicTracks.data}
|
||||
<div className="music-cover-fallback">
|
||||
{getTypeIcon("MusicAlbum")}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="music-hero-info">
|
||||
<div className="music-eyebrow">
|
||||
{trackCount > 1 ? "Альбом" : "Сингл"}
|
||||
{item.data.ProductionYear
|
||||
? ` · ${item.data.ProductionYear}`
|
||||
: ""}
|
||||
</div>
|
||||
<h1 className="music-title">{item.data.Name}</h1>
|
||||
{artistId ? (
|
||||
<Link
|
||||
to="/music/artist/$id"
|
||||
params={{ id: artistId }}
|
||||
className="music-artist"
|
||||
>
|
||||
{item.data.AlbumArtist}
|
||||
</Link>
|
||||
) : (
|
||||
<span className="music-artist">{item.data.AlbumArtist}</span>
|
||||
)}
|
||||
<div className="music-meta">
|
||||
<span>{tracksLabel(trackCount)}</span>
|
||||
<span className="music-meta-dot" />
|
||||
<span>
|
||||
{getRuntimeCompact(item.data.CumulativeRunTimeTicks ?? 0)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="music-actions">
|
||||
<PlayButton
|
||||
item={item.data}
|
||||
audio
|
||||
itemType={item.data.Type ?? "Audio"}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
<InstantMixButton item={item.data} />
|
||||
<LikeButton
|
||||
itemId={item.data.Id}
|
||||
isFavorite={item.data.UserData?.IsFavorite}
|
||||
queryKey={["item", "musicTracks"]}
|
||||
userId={user?.Id}
|
||||
itemName={item.data.Name}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section className="music-tracks" aria-label="Треки">
|
||||
<div className="music-tracks-head">
|
||||
<span>#</span>
|
||||
<span>Название</span>
|
||||
<span>Время</span>
|
||||
<span />
|
||||
</div>
|
||||
{allDiscs.length > 1 ? (
|
||||
allDiscs.map((disc) => (
|
||||
<div key={disc} className="music-disc">
|
||||
<h2 className="music-disc-title">Диск {disc}</h2>
|
||||
{musicTracks.data?.Items?.map((track, index) =>
|
||||
track.ParentIndexNumber === disc ? (
|
||||
<AlbumMusicTrack
|
||||
key={track.Id}
|
||||
track={track}
|
||||
trackIndex={index}
|
||||
musicTracks={musicTracks.data ?? null}
|
||||
/>
|
||||
) : null,
|
||||
)}
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
musicTracks.data?.Items?.map((track, index) => (
|
||||
<AlbumMusicTrack
|
||||
key={track.Id}
|
||||
track={track}
|
||||
trackIndex={index}
|
||||
musicTracks={musicTracks.data ?? null}
|
||||
/>
|
||||
))
|
||||
)}
|
||||
{trackCount === 0 && (
|
||||
<p className="music-empty">Треки не найдены</p>
|
||||
)}
|
||||
</section>
|
||||
|
||||
{(genres.length > 0 || item.data.Overview) && (
|
||||
<section className="music-about">
|
||||
<h2>Об альбоме</h2>
|
||||
{genres.length > 0 && (
|
||||
<div className="music-genres">
|
||||
{genres.map((genre) => (
|
||||
<TagChip
|
||||
label={genre.Name ?? "жанр"}
|
||||
key={genre.Id}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{createPortal(
|
||||
<div className="item-info-sidebar">
|
||||
<div className="item-info-sidebar-image-container">
|
||||
{item.data.ImageTags?.Primary ? (
|
||||
<img
|
||||
className="item-info-sidebar-image"
|
||||
alt={item.data.Name ?? "Album"}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
tag: item.data.ImageTags.Primary,
|
||||
quality: 90,
|
||||
},
|
||||
)
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<div className="item-info-sidebar-icon">
|
||||
{getTypeIcon("MusicAlbum")}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div
|
||||
className="flex flex-align-center"
|
||||
style={{ gap: "1em", flexWrap: "wrap" }}
|
||||
>
|
||||
{item.data.GenreItems?.map((genre) => (
|
||||
<TagChip label={genre.Name ?? "genre"} key={genre.Id} />
|
||||
))}
|
||||
</div>
|
||||
<div className="item-info-sidebar-overview">
|
||||
{item.data.Overview && (
|
||||
<ShowMoreText
|
||||
content={item.data.Overview ?? ""}
|
||||
collapsedLines={4}
|
||||
content={item.data.Overview}
|
||||
collapsedLines={5}
|
||||
/>
|
||||
</div>
|
||||
</div>,
|
||||
document.body,
|
||||
)}
|
||||
</section>
|
||||
)}
|
||||
|
||||
{(similarItems.data?.TotalRecordCount ?? 0) > 0 && (
|
||||
<CardScroller
|
||||
title="Вам может понравиться"
|
||||
displayCards={5}
|
||||
disableDecoration
|
||||
>
|
||||
{similarItems.data?.Items?.map((similar) => {
|
||||
return (
|
||||
<div className="music-similar">
|
||||
<CardScroller
|
||||
title="Вам может понравиться"
|
||||
displayCards={5}
|
||||
disableDecoration
|
||||
>
|
||||
{similarItems.data?.Items?.map((similar) => (
|
||||
<Card
|
||||
key={similar.Id}
|
||||
item={similar}
|
||||
@@ -315,9 +305,10 @@ function MusicAlbumTitlePage() {
|
||||
: similar.Type === BaseItemKind.Series
|
||||
? `${similar.ProductionYear} - ${
|
||||
similar.EndDate
|
||||
? new Date(similar.EndDate).toLocaleString("ru-RU", {
|
||||
year: "numeric",
|
||||
})
|
||||
? new Date(similar.EndDate).toLocaleString(
|
||||
"ru-RU",
|
||||
{ year: "numeric" },
|
||||
)
|
||||
: "н.в."
|
||||
}`
|
||||
: similar.ProductionYear
|
||||
@@ -331,16 +322,13 @@ function MusicAlbumTitlePage() {
|
||||
queryKey={["item", id, "similarItem"]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
))}
|
||||
</CardScroller>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (item.isError || similarItems.isError) {
|
||||
return <ErrorNotice />;
|
||||
}
|
||||
}
|
||||
|
||||
export default MusicAlbumTitlePage;
|
||||
@@ -1,229 +0,0 @@
|
||||
$border-radius: 20px;
|
||||
.item-album {
|
||||
width: 70vw;
|
||||
padding-right: 2.2em;
|
||||
.item-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.2em;
|
||||
&-container {
|
||||
grid-template-columns: 1fr 25%;
|
||||
display: grid;
|
||||
gap: 3em;
|
||||
}
|
||||
|
||||
&-album-info {
|
||||
gap: 1.2em;
|
||||
}
|
||||
&-buttons {
|
||||
display: flex;
|
||||
gap: 1em;
|
||||
}
|
||||
&-disc-header{
|
||||
padding: 1em 2em;
|
||||
background: hsla(0, 0, 100%, 10%);
|
||||
border-radius: 100px;
|
||||
gap: 1em;
|
||||
margin-top: 1em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.item-info-sidebar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
position: fixed;
|
||||
// max-height: 100vh;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 30vw;
|
||||
padding: 4.4em;
|
||||
padding-left: 2.2em;
|
||||
&-image {
|
||||
width: 100%;
|
||||
object-fit: cover;
|
||||
border-radius: $border-radius-default;
|
||||
}
|
||||
&-artist {
|
||||
display: flex;
|
||||
gap: 1em;
|
||||
align-items: center;
|
||||
padding: 1em 0;
|
||||
color: rgb(255 255 255 / 0.7);
|
||||
transition: $transition-time-default;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
&:hover {
|
||||
color: rgb(255 255 255)
|
||||
}
|
||||
&-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
z-index: 1;
|
||||
position: relative;
|
||||
&-container {
|
||||
width: 3em;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 100%;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
.material-symbols-rounded {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
z-index: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
&-container {
|
||||
// max-height: 20em;/
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
}
|
||||
&-overview {
|
||||
overflow-y: auto;
|
||||
max-height: 28vh;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.item-detail-album {
|
||||
&-track {
|
||||
display: grid;
|
||||
grid-template-columns: 4% 1fr 80% 1fr;
|
||||
align-items: center;
|
||||
justify-items: center;
|
||||
gap: 0.5em;
|
||||
width: 100%;
|
||||
padding: 0.25em 0;
|
||||
background: rgb(0 0 0 / 0.4);
|
||||
transition: background $transition-time-default;
|
||||
backdrop-filter: blur(5px);
|
||||
&:first-child {
|
||||
border-radius: $border-radius $border-radius 8px 8px;
|
||||
cursor: default !important;
|
||||
}
|
||||
&:last-child {
|
||||
border-radius: 8px 8px $border-radius $border-radius;
|
||||
}
|
||||
border-radius: 8px;
|
||||
&s {
|
||||
background: transparent !important;
|
||||
box-shadow: none !important;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 5px;
|
||||
}
|
||||
&:hover {
|
||||
background: rgb(0 0 0 / 0.5);
|
||||
cursor: pointer;
|
||||
}
|
||||
&.playing {
|
||||
color: $clr-accent-default;
|
||||
}
|
||||
}
|
||||
}
|
||||
$cardWidth: 22%;
|
||||
.item-album.item {
|
||||
|
||||
.item-detail {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 35%;
|
||||
justify-items: center;
|
||||
align-items: start;
|
||||
gap: 3em;
|
||||
&-cast {
|
||||
max-height: 50vh;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
mask-image: linear-gradient(to top, transparent, black 1.2em);
|
||||
-webkit-mask-image: linear-gradient(to top, transparent, black 1.2em);
|
||||
&-title {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
background: black;
|
||||
border: 1px solid rgb(255 255 255 / 0.2);
|
||||
padding: 0.35em;
|
||||
border-radius: 10px;
|
||||
z-index: 1;
|
||||
}
|
||||
&-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
}
|
||||
&-grid {
|
||||
display: grid;
|
||||
gap: 1em;
|
||||
margin-bottom: 1em;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
&-card {
|
||||
display: grid;
|
||||
grid-template-columns: 6em 1fr;
|
||||
gap: 0.5em;
|
||||
align-items: center;
|
||||
color: white !important;
|
||||
text-decoration: none;
|
||||
padding: 0.5em;
|
||||
background: rgb(255 255 255 / 0);
|
||||
transition: background $transition-time-default;
|
||||
border-radius: $border-radius-default;
|
||||
&:hover {
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
}
|
||||
&-image,
|
||||
&-icon {
|
||||
width: 6em;
|
||||
height: 6em;
|
||||
object-fit: cover;
|
||||
border-radius: 100%;
|
||||
box-shadow: $shadow-card-image;
|
||||
}
|
||||
&-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 1em;
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
.material-symbols-rounded {
|
||||
font-size: 3em;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&-link {
|
||||
color: white;
|
||||
text-decoration-color: rgb(255 255 255 / 0.5);
|
||||
&:hover {
|
||||
text-decoration-color: white;
|
||||
}
|
||||
}
|
||||
&-episodes-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 0.25em;
|
||||
margin-top: 0.5em;
|
||||
align-items: start;
|
||||
justify-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
@media (max-width: 1320px) {
|
||||
.item-album .item-detail {
|
||||
&-cast {
|
||||
&-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,42 +6,29 @@ import {
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Divider from "@mui/material/Divider";
|
||||
import Tab from "@mui/material/Tab";
|
||||
import Tabs from "@mui/material/Tabs";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { AnimatePresence, motion } from "motion/react";
|
||||
import React, {
|
||||
type ReactNode,
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import InstantMixButton from "@/components/buttons/instantMixButton";
|
||||
import PlayButton from "@/components/buttons/playButton";
|
||||
import { Card } from "@/components/card/card";
|
||||
import ItemHeader from "@/components/itemHeader";
|
||||
import { ArtistAlbum } from "@/components/layouts/artist/artistAlbum";
|
||||
import MusicTrack from "@/components/musicTrack";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import ShowMoreText from "@/components/showMoreText";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import "./artist.scss";
|
||||
|
||||
import type { Api } from "@jellyfin/sdk";
|
||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import React, { useEffect, useMemo, useState } from "react";
|
||||
import type { Api } from "@jellyfin/sdk";
|
||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import AlbumMusicTrack from "@/components/albumMusicTrack";
|
||||
import InstantMixButton from "@/components/buttons/instantMixButton";
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import PlayButton from "@/components/buttons/playButton";
|
||||
import { Card } from "@/components/card/card";
|
||||
import IconLink from "@/components/iconLink";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import ShowMoreText from "@/components/showMoreText";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { playItemFromQueue } from "@/utils/store/playback";
|
||||
import { setQueue } from "@/utils/store/queue";
|
||||
|
||||
import "../music.scss";
|
||||
|
||||
/** Queues the given tracks in random order and starts playing. */
|
||||
const shuffleAndPlay = (
|
||||
tracks: BaseItemDto[],
|
||||
@@ -57,33 +44,20 @@ const shuffleAndPlay = (
|
||||
playItemFromQueue(0, userId, api);
|
||||
};
|
||||
|
||||
type TabPanelProp = {
|
||||
children: ReactNode;
|
||||
index: number;
|
||||
value: number;
|
||||
};
|
||||
|
||||
function TabPanel(props: TabPanelProp) {
|
||||
const { children, value, index, ...other } = props;
|
||||
|
||||
return (
|
||||
<div
|
||||
role="tabpanel"
|
||||
hidden={value !== index}
|
||||
id={`full-width-tabpanel-${index}`}
|
||||
aria-labelledby={`full-width-tab-${index}`}
|
||||
{...other}
|
||||
style={{ marginTop: "1em" }}
|
||||
>
|
||||
{value === index && <Box>{children}</Box>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export const Route = createFileRoute("/_api/music/artist/$id")({
|
||||
component: ArtistTitlePage,
|
||||
});
|
||||
|
||||
const plural = (count: number, one: string, few: string, many: string) => {
|
||||
const mod10 = count % 10;
|
||||
const mod100 = count % 100;
|
||||
if (mod10 === 1 && mod100 !== 11) return `${count} ${one}`;
|
||||
if (mod10 >= 2 && mod10 <= 4 && (mod100 < 12 || mod100 > 14)) {
|
||||
return `${count} ${few}`;
|
||||
}
|
||||
return `${count} ${many}`;
|
||||
};
|
||||
|
||||
function ArtistTitlePage() {
|
||||
const { id } = Route.useParams();
|
||||
const api = Route.useRouteContext().api;
|
||||
@@ -158,36 +132,31 @@ function ArtistTitlePage() {
|
||||
});
|
||||
|
||||
const artistTabs = [
|
||||
{ title: "Дискография", data: artistDiscography },
|
||||
{ title: "Песни", data: artistSongs },
|
||||
{ title: "Участие", data: artistAppearances },
|
||||
{
|
||||
key: "discography",
|
||||
title: "Дискография",
|
||||
count: artistDiscography.data?.TotalRecordCount ?? 0,
|
||||
},
|
||||
{
|
||||
key: "songs",
|
||||
title: "Песни",
|
||||
count: artistSongs.data?.TotalRecordCount ?? 0,
|
||||
},
|
||||
{
|
||||
key: "appearances",
|
||||
title: "Участие",
|
||||
count: artistAppearances.data?.TotalRecordCount ?? 0,
|
||||
},
|
||||
];
|
||||
const [activeArtistTab, setActiveArtistTab] = useState(0);
|
||||
const [activeTab, setActiveTab] = useState("discography");
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (
|
||||
artistDiscography.isSuccess &&
|
||||
artistSongs.isSuccess &&
|
||||
artistAppearances.isSuccess &&
|
||||
artistDiscography.data &&
|
||||
artistSongs.data &&
|
||||
artistAppearances.data
|
||||
) {
|
||||
if (artistDiscography.data.TotalRecordCount !== 0) {
|
||||
setActiveArtistTab(0);
|
||||
} else if (artistSongs.data.TotalRecordCount !== 0) {
|
||||
setActiveArtistTab(1);
|
||||
} else if (artistAppearances.data.TotalRecordCount !== 0) {
|
||||
setActiveArtistTab(2);
|
||||
}
|
||||
useEffect(() => {
|
||||
if (artistDiscography.data && artistSongs.data && artistAppearances.data) {
|
||||
if (artistDiscography.data.TotalRecordCount) setActiveTab("discography");
|
||||
else if (artistSongs.data.TotalRecordCount) setActiveTab("songs");
|
||||
else if (artistAppearances.data.TotalRecordCount) setActiveTab("appearances");
|
||||
}
|
||||
}, [
|
||||
artistDiscography.isSuccess,
|
||||
artistSongs.isSuccess,
|
||||
artistAppearances.isSuccess,
|
||||
]);
|
||||
|
||||
const [animationDirection, setAnimationDirection] = useState("forward");
|
||||
}, [artistDiscography.data, artistSongs.data, artistAppearances.data]);
|
||||
|
||||
const setBackdrop = useBackdropStore((s) => s.setBackdrop);
|
||||
const backdropTag = item.data?.BackdropImageTags?.[0];
|
||||
@@ -197,20 +166,30 @@ function ArtistTitlePage() {
|
||||
setBackdrop(backdropHash);
|
||||
}, [backdropHash, setBackdrop]);
|
||||
|
||||
const scrollTargetRef = useRef<HTMLDivElement | null>(null);
|
||||
const albumCount = artistDiscography.data?.TotalRecordCount ?? 0;
|
||||
const songCount = artistSongs.data?.TotalRecordCount ?? 0;
|
||||
|
||||
const pluralize = (count: number, word: string) =>
|
||||
`${count} ${count === 1 ? word : `${word}s`}`;
|
||||
const catalogueSummary = [
|
||||
artistDiscography.data?.TotalRecordCount
|
||||
? pluralize(artistDiscography.data.TotalRecordCount, "album")
|
||||
const portraitUrl = useMemo(
|
||||
() =>
|
||||
api && item.data?.ImageTags?.Primary
|
||||
? getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id ?? "",
|
||||
"Primary",
|
||||
{ quality: 90 },
|
||||
)
|
||||
: undefined,
|
||||
[api, item.data?.Id, item.data?.ImageTags?.Primary],
|
||||
);
|
||||
|
||||
const metaItems = [
|
||||
albumCount > 0 ? plural(albumCount, "альбом", "альбома", "альбомов") : null,
|
||||
songCount > 0 ? plural(songCount, "песня", "песни", "песен") : null,
|
||||
item.data?.PremiereDate
|
||||
? new Date(item.data.PremiereDate).toLocaleDateString("ru-RU", {
|
||||
year: "numeric",
|
||||
})
|
||||
: null,
|
||||
artistSongs.data?.TotalRecordCount
|
||||
? pluralize(artistSongs.data.TotalRecordCount, "song")
|
||||
: null,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" · ");
|
||||
].filter(Boolean);
|
||||
|
||||
if (item.isPending) {
|
||||
return (
|
||||
@@ -227,39 +206,42 @@ function ArtistTitlePage() {
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
if (item.isError) {
|
||||
return <ErrorNotice />;
|
||||
}
|
||||
|
||||
if (item.isSuccess && item.data) {
|
||||
return (
|
||||
<motion.div
|
||||
key={id}
|
||||
initial={{
|
||||
opacity: 0,
|
||||
}}
|
||||
animate={{
|
||||
opacity: 1,
|
||||
}}
|
||||
transition={{
|
||||
duration: 0.25,
|
||||
ease: "easeInOut",
|
||||
}}
|
||||
className="scrollY item item-artist"
|
||||
>
|
||||
<div ref={scrollTargetRef} />
|
||||
<ItemHeader
|
||||
item={item.data}
|
||||
api={api}
|
||||
scrollTargetRef={scrollTargetRef}
|
||||
>
|
||||
<div className="item-hero-buttons-container">
|
||||
<div className="flex flex-row" style={{ width: "100%" }}>
|
||||
<div key={id} className="scrollY padded-top music-page music-artist-page">
|
||||
<header className="music-hero music-hero-artist">
|
||||
<div className="music-portrait">
|
||||
{portraitUrl ? (
|
||||
<img src={portraitUrl} alt={item.data.Name ?? "Исполнитель"} />
|
||||
) : (
|
||||
<span className="material-symbols-rounded">person</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="music-hero-info">
|
||||
<div className="music-eyebrow">Исполнитель</div>
|
||||
<h1 className="music-title">{item.data.Name}</h1>
|
||||
{metaItems.length > 0 && (
|
||||
<div className="music-meta">
|
||||
{metaItems.map((meta, index) => (
|
||||
<React.Fragment key={String(meta)}>
|
||||
{index > 0 && <span className="music-meta-dot" />}
|
||||
<span>{meta}</span>
|
||||
</React.Fragment>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
<div className="music-actions">
|
||||
<PlayButton
|
||||
item={item.data}
|
||||
itemType={BaseItemKind.MusicArtist}
|
||||
userId={user?.Id}
|
||||
audio
|
||||
buttonProps={{ fullWidth: true }}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-row" style={{ gap: "1em" }}>
|
||||
<Tooltip title="Перемешать">
|
||||
<span>
|
||||
<IconButton
|
||||
@@ -286,201 +268,99 @@ function ArtistTitlePage() {
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</ItemHeader>
|
||||
<div className="item-detail">
|
||||
<div style={{ width: "100%", overflow: "hidden" }}>
|
||||
{catalogueSummary && (
|
||||
<Typography sx={{ opacity: 0.8, mb: 1.5 }}>
|
||||
{catalogueSummary}
|
||||
</Typography>
|
||||
)}
|
||||
<ShowMoreText
|
||||
content={item.data.Overview ?? ""}
|
||||
collapsedLines={4}
|
||||
/>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
gap: "0.6em",
|
||||
alignSelf: "end",
|
||||
marginTop: "1em",
|
||||
}}
|
||||
>
|
||||
{item.data.ExternalUrls?.map((url) => (
|
||||
<IconLink
|
||||
url={url.Url ?? ""}
|
||||
name={url.Name ?? ""}
|
||||
key={url.Url}
|
||||
{item.data.Overview && (
|
||||
<div className="music-artist-about">
|
||||
<ShowMoreText
|
||||
content={item.data.Overview}
|
||||
collapsedLines={3}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
{item.data.PremiereDate && (
|
||||
<div>
|
||||
<Typography variant="h5">Дата рождения</Typography>
|
||||
<Typography sx={{ opacity: 0.8 }}>
|
||||
{new Date(item.data.PremiereDate).toLocaleDateString("ru-RU")}
|
||||
</Typography>
|
||||
</div>
|
||||
)}
|
||||
{item.data.EndDate && (
|
||||
<div>
|
||||
<Typography
|
||||
variant="h5"
|
||||
sx={{
|
||||
mt: 2,
|
||||
}}
|
||||
>
|
||||
Дата смерти
|
||||
</Typography>
|
||||
<Typography sx={{ opacity: 0.8 }}>
|
||||
{new Date(item.data.EndDate).toLocaleDateString("ru-RU")}
|
||||
</Typography>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="item-detail-artist-container">
|
||||
<div className="item-detail-artist-header">
|
||||
<Tabs
|
||||
variant="scrollable"
|
||||
value={activeArtistTab}
|
||||
onChange={(_, newVal) => {
|
||||
if (newVal > activeArtistTab) {
|
||||
setAnimationDirection("forward");
|
||||
} else if (newVal < activeArtistTab) {
|
||||
setAnimationDirection("backwards");
|
||||
}
|
||||
setActiveArtistTab(newVal);
|
||||
}}
|
||||
>
|
||||
{artistTabs.map((tab) => {
|
||||
return (
|
||||
<Tab
|
||||
key={tab.title}
|
||||
label={tab.title}
|
||||
disabled={tab.data.data?.TotalRecordCount === 0}
|
||||
{(item.data.ExternalUrls?.length ?? 0) > 0 && (
|
||||
<div className="music-links">
|
||||
{item.data.ExternalUrls?.map((url) => (
|
||||
<IconLink
|
||||
url={url.Url ?? ""}
|
||||
name={url.Name ?? ""}
|
||||
key={url.Url}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</Tabs>
|
||||
<Divider />
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<AnimatePresence>
|
||||
<TabPanel value={activeArtistTab} index={0}>
|
||||
<motion.div
|
||||
key={activeArtistTab}
|
||||
initial={{
|
||||
opacity: 0,
|
||||
transform:
|
||||
animationDirection === "forward"
|
||||
? "translate(30px)"
|
||||
: "translate(-30px)",
|
||||
}}
|
||||
animate={{
|
||||
opacity: 1,
|
||||
transform: "translate(0px)",
|
||||
}}
|
||||
transition={{
|
||||
duration: 0.2,
|
||||
ease: "anticipate",
|
||||
}}
|
||||
>
|
||||
{user &&
|
||||
artistDiscography.data?.Items?.map((tabitem) => {
|
||||
return (
|
||||
<ArtistAlbum
|
||||
key={tabitem.Id}
|
||||
user={user}
|
||||
album={tabitem}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</motion.div>
|
||||
</TabPanel>
|
||||
<TabPanel value={activeArtistTab} index={1}>
|
||||
<motion.div
|
||||
key={activeArtistTab}
|
||||
initial={{
|
||||
opacity: 0,
|
||||
transform:
|
||||
animationDirection === "forward"
|
||||
? "translate(30px)"
|
||||
: "translate(-30px)",
|
||||
}}
|
||||
animate={{
|
||||
opacity: 1,
|
||||
transform: "translate(0px)",
|
||||
}}
|
||||
transition={{
|
||||
duration: 0.2,
|
||||
ease: "anticipate",
|
||||
}}
|
||||
>
|
||||
{artistSongs.isSuccess &&
|
||||
artistSongs.data?.Items?.map((tabitem) => {
|
||||
return (
|
||||
<MusicTrack
|
||||
item={tabitem}
|
||||
key={tabitem.Id}
|
||||
queryKey={["item", id, "artist", "songs"]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</motion.div>
|
||||
</TabPanel>
|
||||
<TabPanel value={activeArtistTab} index={2}>
|
||||
<motion.div
|
||||
key={activeArtistTab}
|
||||
initial={{
|
||||
opacity: 0,
|
||||
transform:
|
||||
animationDirection === "forward"
|
||||
? "translate(30px)"
|
||||
: "translate(-30px)",
|
||||
}}
|
||||
animate={{
|
||||
opacity: 1,
|
||||
transform: "translate(0px)",
|
||||
}}
|
||||
transition={{
|
||||
duration: 0.2,
|
||||
ease: "anticipate",
|
||||
}}
|
||||
className="grid"
|
||||
>
|
||||
{artistAppearances.isSuccess &&
|
||||
artistAppearances.data?.Items?.map((tabitem) => {
|
||||
return (
|
||||
<Card
|
||||
key={tabitem.Id}
|
||||
item={tabitem}
|
||||
cardTitle={tabitem.Name}
|
||||
imageType={"Primary"}
|
||||
cardCaption={tabitem.AlbumArtist}
|
||||
cardType={"square"}
|
||||
queryKey={["item", id, "artist", "appearences"]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</motion.div>
|
||||
</TabPanel>
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
</motion.div>
|
||||
</header>
|
||||
|
||||
<nav className="music-tabs" aria-label="Разделы исполнителя">
|
||||
{artistTabs.map((tab) => (
|
||||
<button
|
||||
key={tab.key}
|
||||
type="button"
|
||||
className={activeTab === tab.key ? "is-active" : undefined}
|
||||
disabled={tab.count === 0}
|
||||
onClick={() => setActiveTab(tab.key)}
|
||||
>
|
||||
{tab.title}
|
||||
{tab.count > 0 && <span>{tab.count}</span>}
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
|
||||
{activeTab === "discography" && (
|
||||
<div className="music-album-grid">
|
||||
{artistDiscography.data?.Items?.map((album) => (
|
||||
<Card
|
||||
key={album.Id}
|
||||
item={album}
|
||||
cardTitle={album.Name}
|
||||
imageType={"Primary"}
|
||||
cardCaption={album.ProductionYear}
|
||||
cardType={"square"}
|
||||
queryKey={["item", id, "artist", "discography"]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{activeTab === "songs" && (
|
||||
<section className="music-tracks" aria-label="Песни">
|
||||
<div className="music-tracks-head">
|
||||
<span>#</span>
|
||||
<span>Название</span>
|
||||
<span>Время</span>
|
||||
<span />
|
||||
</div>
|
||||
{artistSongs.data?.Items?.map((track, index) => (
|
||||
<AlbumMusicTrack
|
||||
key={track.Id}
|
||||
track={track}
|
||||
trackIndex={index}
|
||||
musicTracks={artistSongs.data ?? null}
|
||||
/>
|
||||
))}
|
||||
{songCount === 0 && <p className="music-empty">Песен пока нет</p>}
|
||||
</section>
|
||||
)}
|
||||
|
||||
{activeTab === "appearances" && (
|
||||
<div className="music-album-grid">
|
||||
{artistAppearances.data?.Items?.map((album) => (
|
||||
<Card
|
||||
key={album.Id}
|
||||
item={album}
|
||||
cardTitle={album.Name}
|
||||
imageType={"Primary"}
|
||||
cardCaption={album.AlbumArtist}
|
||||
cardType={"square"}
|
||||
queryKey={["item", id, "artist", "appearences"]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (item.isError) {
|
||||
return <ErrorNotice />;
|
||||
}
|
||||
}
|
||||
|
||||
export default ArtistTitlePage;
|
||||
@@ -0,0 +1,365 @@
|
||||
/**
|
||||
* Shared layout for the music pages (album, playlist): "Полка".
|
||||
*
|
||||
* The cover is the object, the track list is the main content. No fixed
|
||||
* sidebar, no duplicate cover on the right — the page reads top to bottom.
|
||||
*/
|
||||
.music-page {
|
||||
max-width: 1180px;
|
||||
margin: 0 auto;
|
||||
padding: clamp(3.4em, 6vw, 4.6em) clamp(1.5em, 4vw, 3.5em) 7em;
|
||||
|
||||
.music-hero {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
gap: clamp(1.6em, 3.4vw, 3.2em);
|
||||
margin-bottom: clamp(2em, 4vw, 3.4em);
|
||||
}
|
||||
|
||||
.music-cover {
|
||||
position: relative;
|
||||
flex: 0 0 auto;
|
||||
width: clamp(170px, 19vw, 250px);
|
||||
aspect-ratio: 1;
|
||||
|
||||
img,
|
||||
.music-cover-fallback {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 22px 48px rgb(0 0 0 / 0.55);
|
||||
}
|
||||
|
||||
.music-cover-fallback {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: rgb(255 255 255 / 0.06);
|
||||
color: rgb(255 255 255 / 0.5);
|
||||
font-size: 3rem;
|
||||
}
|
||||
}
|
||||
|
||||
// A vinyl record peeking out of the sleeve.
|
||||
.music-cover-disc {
|
||||
position: absolute;
|
||||
z-index: 0;
|
||||
top: 7%;
|
||||
right: -14%;
|
||||
width: 86%;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
background: repeating-radial-gradient(
|
||||
circle at 50% 50%,
|
||||
#191322 0 2px,
|
||||
#0c0815 2px 4px
|
||||
);
|
||||
box-shadow: 0 12px 32px rgb(0 0 0 / 0.55);
|
||||
}
|
||||
|
||||
.music-hero-info {
|
||||
min-width: 0;
|
||||
padding-bottom: 0.3em;
|
||||
}
|
||||
|
||||
.music-eyebrow {
|
||||
font-size: 0.72rem;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.22em;
|
||||
text-transform: uppercase;
|
||||
color: rgb(255 255 255 / 0.45);
|
||||
}
|
||||
|
||||
.music-title {
|
||||
margin: 0.35em 0 0.4em;
|
||||
font-size: clamp(2.2rem, 4.6vw, 3.8rem);
|
||||
font-weight: 600;
|
||||
line-height: 0.98;
|
||||
letter-spacing: -0.02em;
|
||||
color: #fff;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.music-artist {
|
||||
display: inline-flex;
|
||||
width: fit-content;
|
||||
padding-bottom: 2px;
|
||||
border-bottom: 1px solid rgb(255 255 255 / 0.16);
|
||||
font-size: 1rem;
|
||||
color: rgb(255 255 255 / 0.8);
|
||||
text-decoration: none;
|
||||
transition: color $transition-time-fast, border-color $transition-time-fast;
|
||||
|
||||
&:hover {
|
||||
color: #fff;
|
||||
border-color: rgb(255 255 255 / 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
.music-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.7em;
|
||||
margin-top: 1em;
|
||||
font-size: 0.85rem;
|
||||
color: rgb(255 255 255 / 0.5);
|
||||
}
|
||||
|
||||
.music-meta-dot {
|
||||
width: 3px;
|
||||
height: 3px;
|
||||
border-radius: 50%;
|
||||
background: currentColor;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.music-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5em;
|
||||
margin-top: 1.6em;
|
||||
}
|
||||
|
||||
.music-tracks {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.music-tracks-head {
|
||||
display: grid;
|
||||
grid-template-columns: 2.4em minmax(0, 1fr) 4.5em 2.6em;
|
||||
gap: 1em;
|
||||
align-items: center;
|
||||
padding: 0 1em 0.7em;
|
||||
border-bottom: 1px solid rgb(255 255 255 / 0.08);
|
||||
font-size: 0.7rem;
|
||||
letter-spacing: 0.16em;
|
||||
text-transform: uppercase;
|
||||
color: rgb(255 255 255 / 0.35);
|
||||
|
||||
span:nth-child(3) {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
.music-disc-title {
|
||||
margin: 1.8em 1em 0.3em;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.18em;
|
||||
text-transform: uppercase;
|
||||
color: rgb(255 255 255 / 0.4);
|
||||
}
|
||||
|
||||
.music-empty {
|
||||
padding: 1.6em 1em;
|
||||
font-size: 0.9rem;
|
||||
color: rgb(255 255 255 / 0.4);
|
||||
}
|
||||
|
||||
.music-about {
|
||||
max-width: 66ch;
|
||||
margin-top: 3em;
|
||||
padding-top: 2em;
|
||||
border-top: 1px solid rgb(255 255 255 / 0.07);
|
||||
|
||||
h2 {
|
||||
margin: 0 0 0.8em;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.18em;
|
||||
text-transform: uppercase;
|
||||
color: rgb(255 255 255 / 0.45);
|
||||
}
|
||||
|
||||
> div,
|
||||
> p {
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.65;
|
||||
color: rgb(255 255 255 / 0.62);
|
||||
}
|
||||
}
|
||||
|
||||
.music-genres {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.4em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.music-similar {
|
||||
margin-top: 3.4em;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.music-page {
|
||||
.music-hero {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.music-cover {
|
||||
width: min(52vw, 220px);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ artist */
|
||||
|
||||
.music-page .music-portrait {
|
||||
flex: 0 0 auto;
|
||||
width: clamp(150px, 16vw, 230px);
|
||||
aspect-ratio: 1;
|
||||
overflow: hidden;
|
||||
border-radius: 50%;
|
||||
background: rgb(255 255 255 / 0.06);
|
||||
box-shadow: 0 24px 50px rgb(0 0 0 / 0.5), 0 0 0 1px rgb(255 255 255 / 0.1);
|
||||
|
||||
img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
> .material-symbols-rounded {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 5rem;
|
||||
color: rgb(255 255 255 / 0.4);
|
||||
background: linear-gradient(
|
||||
160deg,
|
||||
rgb(255 255 255 / 0.09),
|
||||
rgb(255 255 255 / 0.02)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
.music-page .music-hero-artist .music-title {
|
||||
font-size: clamp(1.9rem, 3.8vw, 3.2rem);
|
||||
}
|
||||
|
||||
.music-artist-about {
|
||||
max-width: 64ch;
|
||||
margin-top: 1.1em;
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.6;
|
||||
color: rgb(255 255 255 / 0.6);
|
||||
}
|
||||
|
||||
.music-links {
|
||||
display: flex;
|
||||
gap: 0.6em;
|
||||
margin-top: 0.9em;
|
||||
}
|
||||
|
||||
.music-tabs {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.15em;
|
||||
margin-top: 0.5em;
|
||||
padding-bottom: 0.6em;
|
||||
border-bottom: 1px solid rgb(255 255 255 / 0.08);
|
||||
|
||||
button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5em;
|
||||
padding: 0.5em 1em;
|
||||
border: 0;
|
||||
border-radius: 999px;
|
||||
background: transparent;
|
||||
color: rgb(255 255 255 / 0.5);
|
||||
font: inherit;
|
||||
font-size: 0.85rem;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.15s ease, color 0.15s ease;
|
||||
|
||||
span {
|
||||
font-size: 0.7rem;
|
||||
color: rgb(255 255 255 / 0.35);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
color: #fff;
|
||||
background: rgb(255 255 255 / 0.05);
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
color: #fff;
|
||||
|
||||
span {
|
||||
color: rgb(255 255 255 / 0.7);
|
||||
}
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.3;
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.music-album-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
|
||||
gap: 1.4em;
|
||||
margin-top: 1.8em;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------- library */
|
||||
|
||||
.music-library-band {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
gap: 1.5em;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 0.4em;
|
||||
|
||||
.music-title {
|
||||
margin-bottom: 0.15em;
|
||||
}
|
||||
}
|
||||
|
||||
.music-library {
|
||||
// Album shelf: deeper corners, a soft lift and a calmer hover veil than
|
||||
// the rest of the media grid.
|
||||
.card {
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
transform: translateY(-3px);
|
||||
}
|
||||
|
||||
.card-image-container {
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 10px 24px rgb(0 0 0 / 0.32);
|
||||
}
|
||||
|
||||
.card-overlay {
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgb(0 0 0 / 0) 40%,
|
||||
rgb(0 0 0 / 0.6)
|
||||
);
|
||||
backdrop-filter: none;
|
||||
}
|
||||
|
||||
.card-play-button .MuiFab-root {
|
||||
width: 46px;
|
||||
height: 46px;
|
||||
min-height: 46px;
|
||||
background: #fff;
|
||||
color: #0b0417;
|
||||
box-shadow: 0 8px 20px rgb(0 0 0 / 0.4);
|
||||
}
|
||||
}
|
||||
@@ -1,36 +1,41 @@
|
||||
import React, { useEffect } from "react";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import { getPlaylistApi } from "@jellyfin/sdk/lib/utils/api/playlist-api";
|
||||
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { Card } from "@/components/card/card";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import "./playlist.scss";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import React, { useEffect } from "react";
|
||||
import AlbumMusicTrack from "@/components/albumMusicTrack";
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import PlayButton from "@/components/buttons/playButton";
|
||||
import { Card } from "@/components/card/card";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import ShowMoreText from "@/components/showMoreText";
|
||||
import TagChip from "@/components/tagChip";
|
||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||
import { getRuntimeCompact } from "@/utils/date/time";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { Typography } from "@mui/material";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import { createPortal } from "react-dom";
|
||||
|
||||
import "../music.scss";
|
||||
|
||||
export const Route = createFileRoute("/_api/music/playlist/$id")({
|
||||
component: PlaylistTitlePage,
|
||||
});
|
||||
|
||||
const tracksLabel = (count: number) => {
|
||||
const mod10 = count % 10;
|
||||
const mod100 = count % 100;
|
||||
if (mod10 === 1 && mod100 !== 11) return `${count} трек`;
|
||||
if (mod10 >= 2 && mod10 <= 4 && (mod100 < 12 || mod100 > 14)) {
|
||||
return `${count} трека`;
|
||||
}
|
||||
return `${count} треков`;
|
||||
};
|
||||
|
||||
function PlaylistTitlePage() {
|
||||
const { id } = Route.useParams();
|
||||
const api = Route.useRouteContext().api;
|
||||
@@ -92,7 +97,7 @@ function PlaylistTitlePage() {
|
||||
}
|
||||
}, [item.isSuccess, setAppBackdrop]);
|
||||
|
||||
if (item.isPending || similarItems.isPending) {
|
||||
if (item.isPending) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@@ -107,106 +112,114 @@ function PlaylistTitlePage() {
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
if (item.isSuccess && item.data && similarItems.isSuccess) {
|
||||
|
||||
if (item.isError) {
|
||||
return <ErrorNotice />;
|
||||
}
|
||||
|
||||
if (item.isSuccess && item.data) {
|
||||
const trackCount = musicTracks.data?.TotalRecordCount ?? 0;
|
||||
const genres = item.data.GenreItems ?? [];
|
||||
const coverUrl =
|
||||
api && item.data.ImageTags?.Primary
|
||||
? getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
tag: item.data.ImageTags.Primary,
|
||||
quality: 90,
|
||||
},
|
||||
)
|
||||
: null;
|
||||
|
||||
return (
|
||||
<div key={id} className="scrollY padded-top item item-playlist">
|
||||
<div className="item-info">
|
||||
<Typography className="item-info-name" variant="h3">
|
||||
{item.data?.Name}
|
||||
</Typography>
|
||||
<div className="flex flex-align-center item-info-playlist-info">
|
||||
<Typography className="opacity-07">
|
||||
{(musicTracks.data?.TotalRecordCount ?? 0) > 1
|
||||
? `${musicTracks.data?.TotalRecordCount} песен`
|
||||
: "Сингл"}
|
||||
</Typography>
|
||||
<Typography className="opacity-07">
|
||||
{getRuntimeCompact(item.data.CumulativeRunTimeTicks ?? 0)}
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="item-info-buttons">
|
||||
<PlayButton
|
||||
item={item.data}
|
||||
audio
|
||||
itemType={item.data.Type ?? "Playlist"}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
<LikeButton
|
||||
itemId={item.data.Id}
|
||||
isFavorite={item.data.UserData?.IsFavorite}
|
||||
queryKey={["item"]}
|
||||
userId={user?.Id}
|
||||
itemName={item.data.Name}
|
||||
/>
|
||||
</div>
|
||||
<div className="item-info-track-container ">
|
||||
<div>
|
||||
<div className="item-info-track header">
|
||||
<span className="material-symbols-rounded index">tag</span>
|
||||
<Typography variant="subtitle1">Название</Typography>
|
||||
<Typography variant="subtitle1">Длительность</Typography>
|
||||
<div key={id} className="scrollY padded-top music-page">
|
||||
<header className="music-hero">
|
||||
<div className="music-cover">
|
||||
<div className="music-cover-disc" aria-hidden="true" />
|
||||
{coverUrl ? (
|
||||
<img src={coverUrl} alt={item.data.Name ?? "Плейлист"} />
|
||||
) : (
|
||||
<div className="music-cover-fallback">
|
||||
{getTypeIcon("Playlist")}
|
||||
</div>
|
||||
{musicTracks.data?.Items?.map((track, index) => (
|
||||
<AlbumMusicTrack
|
||||
key={track.Id}
|
||||
track={track}
|
||||
trackIndex={index}
|
||||
musicTracks={musicTracks.data}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{createPortal(
|
||||
<div className="item-info-sidebar">
|
||||
<div className="item-info-sidebar-image-container">
|
||||
{item.data.ImageTags?.Primary ? (
|
||||
<img
|
||||
className="item-info-sidebar-image"
|
||||
alt={item.data.Name ?? "Playlist"}
|
||||
src={
|
||||
api &&
|
||||
getImageUrlsApi(api).getItemImageUrlById(
|
||||
item.data.Id ?? "",
|
||||
"Primary",
|
||||
{
|
||||
tag: item.data.ImageTags.Primary,
|
||||
quality: 90,
|
||||
},
|
||||
)
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<div className="item-info-sidebar-icon">
|
||||
{getTypeIcon("Playlist")}
|
||||
</div>
|
||||
)}
|
||||
<div className="music-hero-info">
|
||||
<div className="music-eyebrow">Плейлист</div>
|
||||
<h1 className="music-title">{item.data.Name}</h1>
|
||||
<div className="music-meta">
|
||||
<span>{tracksLabel(trackCount)}</span>
|
||||
<span className="music-meta-dot" />
|
||||
<span>
|
||||
{getRuntimeCompact(item.data.CumulativeRunTimeTicks ?? 0)}
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
className="flex flex-align-center"
|
||||
style={{ gap: "1em", flexWrap: "wrap" }}
|
||||
>
|
||||
{item.data.GenreItems?.map((genre) => (
|
||||
<TagChip label={genre.Name ?? "genre"} key={genre.Id} />
|
||||
))}
|
||||
</div>
|
||||
<div className="item-info-sidebar-overview">
|
||||
<ShowMoreText
|
||||
content={item.data.Overview ?? ""}
|
||||
collapsedLines={4}
|
||||
<div className="music-actions">
|
||||
<PlayButton
|
||||
item={item.data}
|
||||
audio
|
||||
itemType={item.data.Type ?? "Playlist"}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
<LikeButton
|
||||
itemId={item.data.Id}
|
||||
isFavorite={item.data.UserData?.IsFavorite}
|
||||
queryKey={["item"]}
|
||||
userId={user?.Id}
|
||||
itemName={item.data.Name}
|
||||
/>
|
||||
</div>
|
||||
</div>,
|
||||
document.body,
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section className="music-tracks" aria-label="Треки">
|
||||
<div className="music-tracks-head">
|
||||
<span>#</span>
|
||||
<span>Название</span>
|
||||
<span>Время</span>
|
||||
<span />
|
||||
</div>
|
||||
{musicTracks.data?.Items?.map((track, index) => (
|
||||
<AlbumMusicTrack
|
||||
key={track.Id}
|
||||
track={track}
|
||||
trackIndex={index}
|
||||
musicTracks={musicTracks.data ?? null}
|
||||
/>
|
||||
))}
|
||||
{trackCount === 0 && (
|
||||
<p className="music-empty">В плейлисте пока нет треков</p>
|
||||
)}
|
||||
</section>
|
||||
|
||||
{(genres.length > 0 || item.data.Overview) && (
|
||||
<section className="music-about">
|
||||
<h2>О плейлисте</h2>
|
||||
{genres.length > 0 && (
|
||||
<div className="music-genres">
|
||||
{genres.map((genre) => (
|
||||
<TagChip label={genre.Name ?? "жанр"} key={genre.Id} />
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{item.data.Overview && (
|
||||
<ShowMoreText
|
||||
content={item.data.Overview}
|
||||
collapsedLines={5}
|
||||
/>
|
||||
)}
|
||||
</section>
|
||||
)}
|
||||
|
||||
{(similarItems.data?.TotalRecordCount ?? 0) > 0 && (
|
||||
<CardScroller
|
||||
title="Вам может понравиться"
|
||||
displayCards={5}
|
||||
disableDecoration
|
||||
>
|
||||
{similarItems.data?.Items?.map((similar) => {
|
||||
return (
|
||||
<div className="music-similar">
|
||||
<CardScroller
|
||||
title="Вам может понравиться"
|
||||
displayCards={5}
|
||||
disableDecoration
|
||||
>
|
||||
{similarItems.data?.Items?.map((similar) => (
|
||||
<Card
|
||||
key={similar.Id}
|
||||
item={similar}
|
||||
@@ -223,9 +236,10 @@ function PlaylistTitlePage() {
|
||||
: similar.Type === BaseItemKind.Series
|
||||
? `${similar.ProductionYear} - ${
|
||||
similar.EndDate
|
||||
? new Date(similar.EndDate).toLocaleString("ru-RU", {
|
||||
year: "numeric",
|
||||
})
|
||||
? new Date(similar.EndDate).toLocaleString(
|
||||
"ru-RU",
|
||||
{ year: "numeric" },
|
||||
)
|
||||
: "н.в."
|
||||
}`
|
||||
: similar.ProductionYear
|
||||
@@ -234,16 +248,13 @@ function PlaylistTitlePage() {
|
||||
queryKey={["item", id, "similarItem"]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
))}
|
||||
</CardScroller>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (item.isError || similarItems.isError) {
|
||||
return <ErrorNotice />;
|
||||
}
|
||||
}
|
||||
|
||||
export default PlaylistTitlePage;
|
||||
@@ -1,141 +0,0 @@
|
||||
$border-radius: 20px;
|
||||
.item-playlist {
|
||||
width: 70vw;
|
||||
padding-right: 2.2em;
|
||||
.item-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.2em;
|
||||
&-container {
|
||||
grid-template-columns: 1fr 25%;
|
||||
display: grid;
|
||||
gap: 3em;
|
||||
}
|
||||
&-playlist-info {
|
||||
gap: 1.2em;
|
||||
}
|
||||
&-buttons {
|
||||
display: flex;
|
||||
gap: 1em;
|
||||
}
|
||||
&-disc-header {
|
||||
padding: 1em 2em;
|
||||
background: hsla(0, 0, 100%, 10%);
|
||||
border-radius: 100px;
|
||||
gap: 1em;
|
||||
margin-top: 1em;
|
||||
}
|
||||
}
|
||||
}
|
||||
.item-info-sidebar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
position: fixed;
|
||||
// max-height: 100vh;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 30vw;
|
||||
padding: 4.4em;
|
||||
padding-left: 2.2em;
|
||||
&-image {
|
||||
width: 100%;
|
||||
object-fit: cover;
|
||||
border-radius: $border-radius-default;
|
||||
}
|
||||
&-artist {
|
||||
display: flex;
|
||||
gap: 1em;
|
||||
align-items: center;
|
||||
padding: 1em 0;
|
||||
color: rgb(255 255 255 / 0.7);
|
||||
transition: $transition-time-default;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
&:hover {
|
||||
color: rgb(255 255 255)
|
||||
}
|
||||
&-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
z-index: 1;
|
||||
position: relative;
|
||||
&-container {
|
||||
width: 3em;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 100%;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
.material-symbols-rounded {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
z-index: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
&-container {
|
||||
// max-height: 20em;/
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
}
|
||||
&-overview {
|
||||
overflow-y: auto;
|
||||
max-height: 28vh;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
}
|
||||
.item-detail- {
|
||||
&-track {
|
||||
display: grid;
|
||||
grid-template-columns: 4% 1fr 80% 1fr;
|
||||
align-items: center;
|
||||
justify-items: center;
|
||||
gap: 0.5em;
|
||||
width: 100%;
|
||||
padding: 0.25em 0;
|
||||
background: rgb(0 0 0 / 0.4);
|
||||
transition: background $transition-time-default;
|
||||
backdrop-filter: blur(5px);
|
||||
&:first-child {
|
||||
border-radius: $border-radius $border-radius 8px 8px;
|
||||
cursor: default !important;
|
||||
}
|
||||
&:last-child {
|
||||
border-radius: 8px 8px $border-radius $border-radius;
|
||||
}
|
||||
border-radius: 8px;
|
||||
&s {
|
||||
background: transparent !important;
|
||||
box-shadow: none !important;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 5px;
|
||||
}
|
||||
&:hover {
|
||||
background: rgb(0 0 0 / 0.5);
|
||||
cursor: pointer;
|
||||
}
|
||||
&.playing {
|
||||
color: $clr-accent-default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1320px) {
|
||||
.item-playlist .item-detail {
|
||||
&-cast {
|
||||
&-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+595
-280
@@ -1,317 +1,632 @@
|
||||
.audio {
|
||||
&-background {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: -1;
|
||||
overflow: hidden;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
// No live backdrop-filter here: blurring a full-screen layer over a
|
||||
// repainting page made the whole player shimmer.
|
||||
background: rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
|
||||
&-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
// Blur the image itself instead of the layer behind the page.
|
||||
filter: blur(70px) brightness(0.55) saturate(1.2);
|
||||
transform: scale(1.2); // Hide blurred edges
|
||||
}
|
||||
}
|
||||
|
||||
&-container {
|
||||
// Art size drives the whole left column so everything fits the viewport.
|
||||
--np-size: min(420px, 44vh, 80vw);
|
||||
/**
|
||||
* Full-screen player, media-player style:
|
||||
* a wall coloured by the sleeve, the cover large in the middle, only the
|
||||
* transport at the bottom, and the play queue sliding in from the right.
|
||||
*/
|
||||
.music-player {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
color: #fff;
|
||||
background:
|
||||
radial-gradient(
|
||||
90% 70% at 50% -10%,
|
||||
rgb(255 255 255 / 0.1),
|
||||
transparent 60%
|
||||
),
|
||||
linear-gradient(180deg, var(--mp-base, #2a1f3d), var(--mp-deep, #120b1c));
|
||||
|
||||
display: grid;
|
||||
grid-template-columns: var(--np-size) minmax(0, 560px);
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: clamp(2rem, 6vw, 6rem);
|
||||
height: 100vh;
|
||||
width: 100%;
|
||||
padding: 5rem 3rem 2.5rem;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
color: white;
|
||||
overflow: hidden;
|
||||
&-chrome {
|
||||
position: absolute;
|
||||
inset: 0 0 auto;
|
||||
z-index: 6;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 46px;
|
||||
padding: 4px 8px;
|
||||
|
||||
@media (max-width: 900px) {
|
||||
grid-template-columns: minmax(0, var(--np-size));
|
||||
grid-template-rows: auto minmax(0, 1fr);
|
||||
align-items: start;
|
||||
padding: 4.5rem 1rem 1rem;
|
||||
gap: 1.5rem;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
&-end {
|
||||
margin-left: auto;
|
||||
}
|
||||
}
|
||||
|
||||
&-now-playing {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.25rem;
|
||||
width: var(--np-size);
|
||||
min-width: 0;
|
||||
&-collapse {
|
||||
position: absolute;
|
||||
top: 58px;
|
||||
right: 22px;
|
||||
z-index: 6;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 50%;
|
||||
background: rgb(0 0 0 / 0.18);
|
||||
color: rgb(255 255 255 / 0.85);
|
||||
cursor: pointer;
|
||||
transition: background-color 0.15s ease, transform 0.15s ease,
|
||||
opacity 0.15s ease;
|
||||
|
||||
&-art {
|
||||
width: 100%;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 1.25rem;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 24px 60px rgb(0 0 0 / 0.55);
|
||||
background: rgb(255 255 255 / 0.08);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
}
|
||||
.material-symbols-rounded {
|
||||
font-size: 6rem;
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
&:hover {
|
||||
background: rgb(0 0 0 / 0.3);
|
||||
transform: translateY(1px);
|
||||
}
|
||||
}
|
||||
|
||||
&-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
// The queue panel has its own close button in the same corner.
|
||||
&.has-panel &-collapse {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&-text {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
&-stage {
|
||||
position: absolute;
|
||||
inset: 46px 0 96px;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 clamp(1.25rem, 3vw, 3rem);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
&-subtitle {
|
||||
opacity: 0.7;
|
||||
&-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
gap: clamp(2rem, 4vw, 4rem);
|
||||
width: 100%;
|
||||
max-width: 1680px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
&-main {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
flex: 0 0 auto;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
transition: transform 0.32s cubic-bezier(0.2, 0, 0, 1);
|
||||
}
|
||||
|
||||
&-transport {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
// The sleeve slides left as one piece: no resizing, no vertical shift.
|
||||
&.has-panel &-main {
|
||||
transform: translateX(calc(1vw - 255px));
|
||||
}
|
||||
|
||||
// Spread prev / play / next evenly with shuffle and repeat
|
||||
.player-controls {
|
||||
display: contents !important;
|
||||
}
|
||||
&-art {
|
||||
width: clamp(200px, min(48vh, 34vw), 430px);
|
||||
aspect-ratio: 1;
|
||||
overflow: hidden;
|
||||
border-radius: 6px;
|
||||
background: rgb(0 0 0 / 0.25);
|
||||
box-shadow: 0 30px 80px rgb(0 0 0 / 0.45);
|
||||
display: grid;
|
||||
place-items: center;
|
||||
|
||||
// Toggle-style buttons read as "off" until enabled
|
||||
> .MuiIconButton-root,
|
||||
> span > .MuiIconButton-root {
|
||||
color: rgb(255 255 255 / 0.55);
|
||||
}
|
||||
> .MuiIconButton-root.is-active {
|
||||
color: $clr-accent-default;
|
||||
}
|
||||
}
|
||||
img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
&-utility {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
}
|
||||
> .material-symbols-rounded {
|
||||
font-size: 5rem;
|
||||
color: rgb(255 255 255 / 0.4);
|
||||
}
|
||||
}
|
||||
|
||||
&-volume {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
max-width: 14rem;
|
||||
opacity: 0.85;
|
||||
&-meta {
|
||||
width: min(560px, 100%);
|
||||
margin-top: clamp(1.2rem, 3vh, 2rem);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
// Secondary control: neutral instead of the accent colour
|
||||
.MuiSlider-root {
|
||||
color: rgb(255 255 255 / 0.85);
|
||||
}
|
||||
}
|
||||
}
|
||||
&-title {
|
||||
margin: 0;
|
||||
font-size: clamp(1.25rem, 2.2vw, 1.7rem);
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.01em;
|
||||
line-height: 1.2;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
&-side {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
height: min(80vh, 760px);
|
||||
min-height: 0;
|
||||
&-subtitle {
|
||||
margin-top: 0.35em;
|
||||
font-size: 0.95rem;
|
||||
color: rgb(255 255 255 / 0.65);
|
||||
|
||||
@media (max-width: 900px) {
|
||||
height: 70vh;
|
||||
}
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
|
||||
&-lyrics {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
scrollbar-width: none;
|
||||
// Fade lines in and out at the edges
|
||||
mask-image: linear-gradient(transparent, black 15%, black 85%, transparent);
|
||||
&:hover {
|
||||
color: #fff;
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
&-seek {
|
||||
width: min(420px, 100%);
|
||||
margin: 1.1rem auto 0;
|
||||
|
||||
// "Up next" sits on a quiet card; no blur so the artwork backdrop stays clean
|
||||
&-queue {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
// The queue view scrolls its own list so the header stays put
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
padding: 1rem 1.25rem 0;
|
||||
.MuiSlider-root {
|
||||
padding: 8px 0;
|
||||
color: rgb(255 255 255 / 0.92);
|
||||
}
|
||||
|
||||
.queue {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
background: rgb(0 0 0 / 0.22);
|
||||
border: 1px solid rgb(255 255 255 / 0.06);
|
||||
border-radius: 1.25rem;
|
||||
.MuiSlider-rail {
|
||||
background: rgb(255 255 255 / 0.25);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 3px;
|
||||
}
|
||||
}
|
||||
.MuiSlider-thumb {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
background: #fff;
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
&.has-lyrics .audio-side-queue {
|
||||
flex: 0 1 auto;
|
||||
max-height: 40%;
|
||||
}
|
||||
}
|
||||
&-controls {
|
||||
position: absolute;
|
||||
inset: auto 0 0;
|
||||
z-index: 4;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
height: 96px;
|
||||
padding: 0 clamp(1.25rem, 3vw, 3rem);
|
||||
box-sizing: border-box;
|
||||
|
||||
&-lyrics {
|
||||
width: 100%;
|
||||
.MuiIconButton-root {
|
||||
color: rgb(255 255 255 / 0.72);
|
||||
|
||||
&-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
// Room above and below so the active line can scroll to the middle
|
||||
padding: 35% 0.5rem;
|
||||
}
|
||||
&:hover {
|
||||
color: #fff;
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
}
|
||||
|
||||
&-status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
min-height: 200px;
|
||||
opacity: 0.7;
|
||||
}
|
||||
&.is-active {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-line {
|
||||
margin: 0 0 0.6rem !important;
|
||||
padding: 0.35rem 0.75rem;
|
||||
border-radius: 0.75rem;
|
||||
font-size: clamp(1.25rem, 2vw, 1.85rem) !important;
|
||||
line-height: 1.35 !important;
|
||||
font-weight: 700 !important;
|
||||
text-align: left;
|
||||
opacity: 0.35;
|
||||
transition: opacity 0.35s ease, filter 0.35s ease;
|
||||
filter: blur(0.4px);
|
||||
&-controls-side {
|
||||
display: flex;
|
||||
flex: 0 0 220px;
|
||||
align-items: center;
|
||||
gap: 0.15rem;
|
||||
|
||||
&[data-active-lyric="true"] {
|
||||
opacity: 1;
|
||||
filter: none;
|
||||
}
|
||||
&.is-end {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
|
||||
&[data-seekable="true"] {
|
||||
cursor: pointer;
|
||||
transition: opacity 0.35s ease, filter 0.35s ease, background-color 0.2s ease;
|
||||
&-transport {
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.6rem;
|
||||
}
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
opacity: 0.8;
|
||||
filter: none;
|
||||
background: rgb(255 255 255 / 0.08);
|
||||
outline: none;
|
||||
}
|
||||
&[data-active-lyric="true"]:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
&-play {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
margin: 0 0.4rem;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 50%;
|
||||
background: #f5196b;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 10px 26px rgb(0 0 0 / 0.35);
|
||||
transition: transform 0.15s ease, filter 0.15s ease;
|
||||
|
||||
// Unsynced lyrics: plain readable text, no highlight
|
||||
&[data-has-synced-lyrics="false"] {
|
||||
.audio-lyrics-container {
|
||||
padding: 1rem 0.5rem 4rem;
|
||||
}
|
||||
.audio-lyrics-line {
|
||||
font-size: 1.15rem !important;
|
||||
font-weight: 500 !important;
|
||||
opacity: 0.85;
|
||||
filter: none;
|
||||
margin-bottom: 0.25rem !important;
|
||||
}
|
||||
}
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.9rem;
|
||||
}
|
||||
|
||||
&-unsynced-notice {
|
||||
position: sticky;
|
||||
bottom: 1rem;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.4rem 0.9rem;
|
||||
margin-left: 0.5rem;
|
||||
background: rgb(0 0 0 / 0.35);
|
||||
border-radius: 2rem;
|
||||
opacity: 0.85;
|
||||
&:hover {
|
||||
transform: scale(1.05);
|
||||
filter: brightness(1.05);
|
||||
}
|
||||
}
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.player-progress-stacked {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
&-volume {
|
||||
width: 92px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.MuiSlider-root {
|
||||
padding: 10px 0;
|
||||
}
|
||||
.MuiSlider-root {
|
||||
color: rgb(255 255 255 / 0.82);
|
||||
}
|
||||
|
||||
&-times {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 0.8rem;
|
||||
opacity: 0.7;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.MuiSlider-rail {
|
||||
background: rgb(255 255 255 / 0.22);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.MuiSlider-thumb {
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
&-panel {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 22%;
|
||||
right: clamp(1.5rem, 3vw, 3rem);
|
||||
bottom: 0;
|
||||
width: clamp(360px, 46vw, 900px);
|
||||
overflow: hidden;
|
||||
|
||||
&-inner {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
&-panel-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.7rem 0.7rem 0.2rem 0.9rem;
|
||||
}
|
||||
|
||||
&-panel-tabs {
|
||||
display: flex;
|
||||
gap: 0.15rem;
|
||||
flex: 1;
|
||||
|
||||
button {
|
||||
padding: 0.4rem 0.2rem;
|
||||
margin-right: 0.9rem;
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
color: rgb(255 255 255 / 0.5);
|
||||
font: inherit;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: color 0.15s ease;
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.35;
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-panel-body {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
padding: 0.4rem 0.7rem 0.9rem;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
border-radius: 3px;
|
||||
background: rgb(255 255 255 / 0.18);
|
||||
}
|
||||
}
|
||||
|
||||
&-panel-source {
|
||||
font-size: 0.8rem;
|
||||
color: rgb(255 255 255 / 0.75);
|
||||
}
|
||||
|
||||
&-panel-title {
|
||||
margin: 0.15em 0 0.9em;
|
||||
font-size: 1.65rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.01em;
|
||||
line-height: 1.15;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
&-panel-label {
|
||||
margin: 1.6rem 0.2rem 0.5rem;
|
||||
font-size: 0.98rem;
|
||||
font-weight: 600;
|
||||
color: #fff;
|
||||
|
||||
&:first-child {
|
||||
margin-top: 0.2rem;
|
||||
}
|
||||
}
|
||||
|
||||
&-panel-empty {
|
||||
margin: 0;
|
||||
padding: 0.6rem;
|
||||
font-size: 0.85rem;
|
||||
line-height: 1.5;
|
||||
color: rgb(255 255 255 / 0.5);
|
||||
}
|
||||
|
||||
&-panel-lyrics {
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
&-queue-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
&-queue-row {
|
||||
display: grid;
|
||||
grid-template-columns: 48px minmax(0, 1fr) 30px 46px;
|
||||
gap: 14px;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
padding: 7px 4px;
|
||||
border: 0;
|
||||
border-radius: 6px;
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
background: rgb(255 255 255 / 0.06);
|
||||
}
|
||||
|
||||
&.is-current {
|
||||
cursor: default;
|
||||
|
||||
.music-player-queue-title {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-queue-cover {
|
||||
position: relative;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
overflow: hidden;
|
||||
border-radius: 6px;
|
||||
background: rgb(255 255 255 / 0.08);
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.1rem;
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
&-queue-playing {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: rgb(0 0 0 / 0.45);
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.5rem !important;
|
||||
color: #fff;
|
||||
opacity: 1 !important;
|
||||
}
|
||||
}
|
||||
|
||||
&-queue-text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&-queue-title {
|
||||
font-size: 0.95rem;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
&-queue-artist {
|
||||
font-size: 0.8rem;
|
||||
color: rgb(255 255 255 / 0.5);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
&-queue-time {
|
||||
font-size: 0.8rem;
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: rgb(255 255 255 / 0.6);
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
&-queue-like {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
opacity: 0.8;
|
||||
transition: opacity 0.15s ease;
|
||||
|
||||
.MuiIconButton-root {
|
||||
padding: 4px;
|
||||
color: rgb(255 255 255 / 0.6);
|
||||
|
||||
&:hover {
|
||||
color: #fff;
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-panel-lyrics .audio-lyrics {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.audio-lyrics-container {
|
||||
padding: 24% 0.4rem;
|
||||
}
|
||||
|
||||
.audio-lyrics-line {
|
||||
margin: 0 0 0.45rem !important;
|
||||
padding: 0.2rem 0.55rem;
|
||||
border-radius: 0.6rem;
|
||||
font-size: clamp(1rem, 1.4vw, 1.35rem) !important;
|
||||
line-height: 1.3 !important;
|
||||
font-weight: 600 !important;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
&-stage {
|
||||
padding: 0 1rem;
|
||||
}
|
||||
|
||||
&-controls-side {
|
||||
flex-basis: auto;
|
||||
|
||||
&:not(.is-end) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&-volume {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&-panel {
|
||||
top: 1rem;
|
||||
right: 1rem;
|
||||
width: min(84vw, 520px);
|
||||
}
|
||||
|
||||
&.has-panel &-main {
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// macOS keeps its native traffic lights inside the overlay titlebar.
|
||||
html.is-macos .music-player-chrome {
|
||||
padding-top: 12px;
|
||||
padding-left: 84px;
|
||||
min-height: 56px;
|
||||
}
|
||||
|
||||
/* Lyrics list, shared with the queue panel. */
|
||||
.audio-lyrics {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
scrollbar-width: none;
|
||||
mask-image: linear-gradient(transparent, black 12%, black 88%, transparent);
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
padding: 30% 0.5rem;
|
||||
}
|
||||
|
||||
&-status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
min-height: 200px;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
&-line {
|
||||
margin: 0 0 0.6rem !important;
|
||||
padding: 0.35rem 0.75rem;
|
||||
border-radius: 0.75rem;
|
||||
font-size: clamp(1.1rem, 1.7vw, 1.6rem) !important;
|
||||
line-height: 1.35 !important;
|
||||
font-weight: 700 !important;
|
||||
text-align: left;
|
||||
opacity: 0.35;
|
||||
transition: opacity 0.35s ease, filter 0.35s ease;
|
||||
filter: blur(0.4px);
|
||||
|
||||
&[data-active-lyric="true"] {
|
||||
opacity: 1;
|
||||
filter: none;
|
||||
}
|
||||
|
||||
&[data-seekable="true"] {
|
||||
cursor: pointer;
|
||||
transition: opacity 0.35s ease, filter 0.35s ease, background-color 0.2s ease;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
opacity: 0.8;
|
||||
filter: none;
|
||||
background: rgb(255 255 255 / 0.08);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
&[data-active-lyric="true"]:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&[data-has-synced-lyrics="false"] {
|
||||
.audio-lyrics-container {
|
||||
padding: 1rem 0.5rem 4rem;
|
||||
}
|
||||
|
||||
.audio-lyrics-line {
|
||||
font-size: 1rem !important;
|
||||
font-weight: 500 !important;
|
||||
opacity: 0.85;
|
||||
filter: none;
|
||||
margin-bottom: 0.25rem !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+394
-145
@@ -7,24 +7,23 @@ import {
|
||||
ListItemIcon,
|
||||
Menu,
|
||||
MenuItem,
|
||||
Slider,
|
||||
Tooltip,
|
||||
Typography,
|
||||
} from "@mui/material";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { createFileRoute, Link, useNavigate } from "@tanstack/react-router";
|
||||
import { AnimatePresence, motion } from "motion/react";
|
||||
import React, { useEffect, useMemo, useState } from "react";
|
||||
import CastButton from "@/components/buttons/castButton";
|
||||
import InstantMixButton from "@/components/buttons/instantMixButton";
|
||||
import LikeButton from "@/components/buttons/likeButton";
|
||||
import LyricsPanel, {
|
||||
getLyricsQueryOptions,
|
||||
} from "@/components/playback/audioPlayer/components/LyricsPanel";
|
||||
import PlayerControls from "@/components/playback/audioPlayer/components/PlayerControls";
|
||||
import PlayerProgress from "@/components/playback/audioPlayer/components/PlayerProgress";
|
||||
import PlayerVolume from "@/components/playback/audioPlayer/components/PlayerVolume";
|
||||
import StatsPanel from "@/components/playback/audioPlayer/components/StatsPanel";
|
||||
import QueueView from "@/components/queue/queueView";
|
||||
import { secToTicks, ticksToSec } from "@/utils/date/time";
|
||||
import WindowControls from "@/components/windowControls";
|
||||
import { getRuntimeMusic, secToTicks, ticksToSec } from "@/utils/date/time";
|
||||
import { getCoverPalette } from "@/utils/methods/coverColor";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { getItemQueryOptions } from "@/utils/queries/items";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
@@ -34,6 +33,7 @@ import {
|
||||
useAudioPlayback,
|
||||
} from "@/utils/store/audioPlayback";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { playItemFromQueue } from "@/utils/store/playback";
|
||||
import useQueue, {
|
||||
cycleRepeatMode,
|
||||
type RepeatMode,
|
||||
@@ -52,44 +52,76 @@ const repeatLabels: Record<RepeatMode, string> = {
|
||||
one: "Повтор одного",
|
||||
};
|
||||
|
||||
/** Artists (linked) and album (linked) for the current track. */
|
||||
const TrackSubtitle = ({ item }: { item: BaseItemDto }) => {
|
||||
const artists = item.ArtistItems?.length
|
||||
? item.ArtistItems
|
||||
: (item.AlbumArtists ?? []);
|
||||
return (
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
className="audio-now-playing-subtitle"
|
||||
noWrap
|
||||
>
|
||||
{artists.map((artist, index) => (
|
||||
<React.Fragment key={artist.Id ?? artist.Name}>
|
||||
{index > 0 && ", "}
|
||||
{artist.Id ? (
|
||||
<Link to="/music/artist/$id" params={{ id: artist.Id }}>
|
||||
{artist.Name}
|
||||
</Link>
|
||||
) : (
|
||||
artist.Name
|
||||
)}
|
||||
</React.Fragment>
|
||||
))}
|
||||
{item.Album && (
|
||||
<>
|
||||
{artists.length > 0 && " · "}
|
||||
{item.AlbumId ? (
|
||||
<Link to="/music/album/$id" params={{ id: item.AlbumId }}>
|
||||
{item.Album}
|
||||
</Link>
|
||||
) : (
|
||||
item.Album
|
||||
)}
|
||||
</>
|
||||
const QueueRow = ({
|
||||
item,
|
||||
index,
|
||||
isCurrent,
|
||||
coverUrl,
|
||||
onPlay,
|
||||
queryKey,
|
||||
userId,
|
||||
}: {
|
||||
item: BaseItemDto;
|
||||
index: number;
|
||||
isCurrent: boolean;
|
||||
coverUrl?: string;
|
||||
onPlay: (index: number) => void;
|
||||
queryKey: string[];
|
||||
userId?: string;
|
||||
}) => (
|
||||
// biome-ignore lint/a11y/useSemanticElements: the row contains its own like button
|
||||
<div
|
||||
className={`music-player-queue-row${isCurrent ? " is-current" : ""}`}
|
||||
onClick={() => {
|
||||
if (!isCurrent) onPlay(index);
|
||||
}}
|
||||
onKeyDown={(event) => {
|
||||
if (isCurrent) return;
|
||||
if (event.key === "Enter" || event.key === " ") {
|
||||
event.preventDefault();
|
||||
onPlay(index);
|
||||
}
|
||||
}}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
>
|
||||
<span className="music-player-queue-cover">
|
||||
{coverUrl ? (
|
||||
<img src={coverUrl} alt="" />
|
||||
) : (
|
||||
<span className="material-symbols-rounded">music_note</span>
|
||||
)}
|
||||
</Typography>
|
||||
);
|
||||
};
|
||||
{isCurrent && (
|
||||
<span className="music-player-queue-playing">
|
||||
<span className="material-symbols-rounded">play_arrow</span>
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
<span className="music-player-queue-text">
|
||||
<span className="music-player-queue-title">{item.Name}</span>
|
||||
<span className="music-player-queue-artist">
|
||||
{item.Artists?.join(", ") ?? item.AlbumArtist ?? item.Album}
|
||||
</span>
|
||||
</span>
|
||||
<span
|
||||
className="music-player-queue-like"
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
onKeyDown={(event) => event.stopPropagation()}
|
||||
role="presentation"
|
||||
>
|
||||
<LikeButton
|
||||
itemId={item.Id}
|
||||
itemName={item.Name}
|
||||
isFavorite={item.UserData?.IsFavorite}
|
||||
queryKey={queryKey}
|
||||
userId={userId}
|
||||
/>
|
||||
</span>
|
||||
<span className="music-player-queue-time">
|
||||
{getRuntimeMusic(item.RunTimeTicks ?? 0)}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
|
||||
function AudioPlayerRoute() {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
@@ -109,6 +141,8 @@ function AudioPlayerRoute() {
|
||||
|
||||
const [progress, setProgress] = useState(0);
|
||||
const [playing, setPlaying] = useState(false);
|
||||
const [panelOpen, setPanelOpen] = useState(false);
|
||||
const [panelTab, setPanelTab] = useState<"queue" | "lyrics">("queue");
|
||||
const [menuAnchor, setMenuAnchor] = useState<HTMLElement | null>(null);
|
||||
const [statsOpen, setStatsOpen] = useState(false);
|
||||
|
||||
@@ -141,6 +175,9 @@ function AudioPlayerRoute() {
|
||||
const lyrics = useQuery(getLyricsQueryOptions(item, api));
|
||||
const hasLyrics = (lyrics.data?.Lyrics?.length ?? 0) > 0;
|
||||
|
||||
// Wall colour derived from the sleeve.
|
||||
const palette = useMemo(() => getCoverPalette(item), [item]);
|
||||
|
||||
const handlePlayPause = () => {
|
||||
const player = audioPlayerRef?.current;
|
||||
if (!player) return;
|
||||
@@ -170,52 +207,235 @@ function AudioPlayerRoute() {
|
||||
[item?.Id, item?.ImageTags?.Primary, api],
|
||||
);
|
||||
|
||||
const coverFor = (track: BaseItemDto) =>
|
||||
api && track.ImageTags?.Primary
|
||||
? getImageUrlsApi(api).getItemImageUrlById(
|
||||
track.AlbumId ?? track.Id ?? "",
|
||||
"Primary",
|
||||
{ quality: 70, fillHeight: 96, fillWidth: 96 },
|
||||
)
|
||||
: undefined;
|
||||
|
||||
const hasUpcoming = (queue?.length ?? 0) > currentTrack + 1;
|
||||
const isFavorite =
|
||||
itemDetails.data?.UserData?.IsFavorite ?? item?.UserData?.IsFavorite;
|
||||
const artistId = item?.ArtistItems?.[0]?.Id ?? item?.AlbumArtists?.[0]?.Id;
|
||||
const tracks = queue ?? [];
|
||||
const current = tracks[currentTrack];
|
||||
const upcoming = tracks.slice(currentTrack + 1);
|
||||
|
||||
const openPanel = (tab: "queue" | "lyrics") => {
|
||||
if (panelOpen && panelTab === tab) {
|
||||
setPanelOpen(false);
|
||||
return;
|
||||
}
|
||||
setPanelTab(tab);
|
||||
setPanelOpen(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="audio-background">
|
||||
{imageUrl && (
|
||||
<img src={imageUrl} alt="" className="audio-background-image" />
|
||||
)}
|
||||
</div>
|
||||
<div className="audio-container">
|
||||
<section className="audio-now-playing" key={item?.Id}>
|
||||
<div className="audio-now-playing-art">
|
||||
{imageUrl ? (
|
||||
<img alt={item?.Name ?? "Обложка"} src={imageUrl} />
|
||||
) : (
|
||||
<span className="material-symbols-rounded">music_note</span>
|
||||
)}
|
||||
<div
|
||||
className={`music-player${panelOpen ? " has-panel" : ""}`}
|
||||
style={
|
||||
{
|
||||
"--mp-base": palette.base,
|
||||
"--mp-deep": palette.deep,
|
||||
} as React.CSSProperties
|
||||
}
|
||||
>
|
||||
<header className="music-player-chrome" data-tauri-drag-region>
|
||||
<div className="music-player-chrome-end">
|
||||
<WindowControls />
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<Tooltip title="Свернуть плеер">
|
||||
<button
|
||||
type="button"
|
||||
className="music-player-collapse"
|
||||
onClick={() => window.history.back()}
|
||||
aria-label="Свернуть плеер"
|
||||
>
|
||||
<span className="material-symbols-rounded">expand_more</span>
|
||||
</button>
|
||||
</Tooltip>
|
||||
|
||||
<div className="music-player-stage">
|
||||
<div className="music-player-row">
|
||||
<div className="music-player-main">
|
||||
<motion.div
|
||||
key={item?.Id}
|
||||
className="music-player-art"
|
||||
initial={{ opacity: 0, scale: 0.98 }}
|
||||
animate={{ opacity: 1, scale: 1 }}
|
||||
transition={{ duration: 0.3, ease: "easeOut" }}
|
||||
>
|
||||
{imageUrl ? (
|
||||
<img alt={item?.Name ?? "Обложка"} src={imageUrl} />
|
||||
) : (
|
||||
<span className="material-symbols-rounded">music_note</span>
|
||||
)}
|
||||
</motion.div>
|
||||
|
||||
<div className="music-player-meta">
|
||||
<h1 className="music-player-title">{item?.Name}</h1>
|
||||
<div className="music-player-subtitle">
|
||||
{item?.ArtistItems?.length
|
||||
? item.ArtistItems.map((artist, index) => (
|
||||
<React.Fragment key={artist.Id ?? artist.Name}>
|
||||
{index > 0 && ", "}
|
||||
{artist.Id ? (
|
||||
<Link
|
||||
to="/music/artist/$id"
|
||||
params={{ id: artist.Id }}
|
||||
>
|
||||
{artist.Name}
|
||||
</Link>
|
||||
) : (
|
||||
artist.Name
|
||||
)}
|
||||
</React.Fragment>
|
||||
))
|
||||
: item?.Artists?.join(", ")}
|
||||
{item?.Album && (
|
||||
<>
|
||||
{(item?.ArtistItems?.length || item?.Artists?.length) &&
|
||||
" · "}
|
||||
{item.AlbumId ? (
|
||||
<Link
|
||||
to="/music/album/$id"
|
||||
params={{ id: item.AlbumId }}
|
||||
>
|
||||
{item.Album}
|
||||
</Link>
|
||||
) : (
|
||||
item.Album
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="music-player-seek">
|
||||
<Slider
|
||||
value={Math.min(
|
||||
secToTicks(progress),
|
||||
item?.RunTimeTicks ?? 0,
|
||||
)}
|
||||
max={item?.RunTimeTicks ?? 1}
|
||||
step={1}
|
||||
size="small"
|
||||
aria-label="Перемотка"
|
||||
onChange={(_, value) => {
|
||||
const next = Array.isArray(value) ? value[0] : value;
|
||||
setProgress(ticksToSec(next));
|
||||
}}
|
||||
onChangeCommitted={(_, value) => {
|
||||
const next = Array.isArray(value) ? value[0] : value;
|
||||
handleSeekCommit(next);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="audio-now-playing-meta">
|
||||
<div className="audio-now-playing-text">
|
||||
<Typography
|
||||
variant="h5"
|
||||
sx={{
|
||||
fontWeight: 700,
|
||||
lineHeight: 1.2,
|
||||
overflowWrap: "anywhere",
|
||||
}}
|
||||
<AnimatePresence initial={false}>
|
||||
{panelOpen && (
|
||||
<motion.aside
|
||||
key="panel"
|
||||
className="music-player-panel"
|
||||
initial={{ x: -240, opacity: 0 }}
|
||||
animate={{ x: 0, opacity: 1 }}
|
||||
exit={{ x: -240, opacity: 0 }}
|
||||
transition={{ duration: 0.32, ease: [0.2, 0, 0, 1] }}
|
||||
>
|
||||
{item?.Name}
|
||||
</Typography>
|
||||
{item && <TrackSubtitle item={item} />}
|
||||
</div>
|
||||
{item && <InstantMixButton item={item} />}
|
||||
{item && <CastButton
|
||||
item={item}
|
||||
transfer={{
|
||||
kind: "audio",
|
||||
positionTicks: secToTicks(progress),
|
||||
queue: queue ?? [],
|
||||
startIndex: currentTrack,
|
||||
}}
|
||||
/>}
|
||||
<div className="music-player-panel-inner">
|
||||
{panelTab === "lyrics" ? (
|
||||
<>
|
||||
<div className="music-player-panel-head">
|
||||
<span className="music-player-panel-source">
|
||||
Текст песни
|
||||
</span>
|
||||
<IconButton
|
||||
size="small"
|
||||
aria-label="Показать очередь"
|
||||
onClick={() => setPanelTab("queue")}
|
||||
>
|
||||
<span className="material-symbols-rounded">close</span>
|
||||
</IconButton>
|
||||
</div>
|
||||
<div className="music-player-panel-body music-player-panel-lyrics">
|
||||
{hasLyrics ? (
|
||||
<LyricsPanel
|
||||
item={item}
|
||||
api={api}
|
||||
currentTime={progress}
|
||||
onSeek={handleSeekCommit}
|
||||
/>
|
||||
) : (
|
||||
<p className="music-player-panel-empty">
|
||||
Для этого трека нет текста.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<div className="music-player-panel-body">
|
||||
<div className="music-player-panel-source">
|
||||
Сейчас играет из{" "}
|
||||
{item?.Album ? "альбома" : "очереди"}
|
||||
</div>
|
||||
<h2 className="music-player-panel-title">
|
||||
{item?.Album ?? "Очередь"}
|
||||
</h2>
|
||||
{current && (
|
||||
<QueueRow
|
||||
item={current}
|
||||
index={currentTrack}
|
||||
isCurrent
|
||||
coverUrl={coverFor(current)}
|
||||
onPlay={() => undefined}
|
||||
queryKey={["queue-current"]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
)}
|
||||
<div className="music-player-panel-label">
|
||||
Далее в очереди
|
||||
</div>
|
||||
{upcoming.length === 0 ? (
|
||||
<p className="music-player-panel-empty">
|
||||
Очередь пуста. Запустите альбом или плейлист,
|
||||
чтобы она наполнилась.
|
||||
</p>
|
||||
) : (
|
||||
<div className="music-player-queue-list">
|
||||
{upcoming.map((track, offset) => (
|
||||
<QueueRow
|
||||
key={track.Id}
|
||||
item={track}
|
||||
index={currentTrack + 1 + offset}
|
||||
isCurrent={false}
|
||||
coverUrl={coverFor(track)}
|
||||
onPlay={(index) =>
|
||||
playItemFromQueue(index, user?.Id, api)
|
||||
}
|
||||
queryKey={["queue-upcoming"]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</motion.aside>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer className="music-player-controls">
|
||||
<div className="music-player-controls-side">
|
||||
<LikeButton
|
||||
itemId={item?.Id ?? undefined}
|
||||
itemName={item?.Name}
|
||||
@@ -223,58 +443,21 @@ function AudioPlayerRoute() {
|
||||
queryKey={["item", item?.Id ?? ""]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<PlayerProgress
|
||||
layout="stacked"
|
||||
progress={secToTicks(progress)}
|
||||
duration={item?.RunTimeTicks ?? 1}
|
||||
onSeek={(value) => setProgress(ticksToSec(value))}
|
||||
onSeekCommit={handleSeekCommit}
|
||||
/>
|
||||
|
||||
<div className="audio-now-playing-transport">
|
||||
<Tooltip title="Перемешать следующие">
|
||||
<span>
|
||||
<IconButton
|
||||
onClick={shuffleUpcoming}
|
||||
disabled={!hasUpcoming}
|
||||
aria-label="Перемешать следующие"
|
||||
>
|
||||
<span className="material-symbols-rounded">shuffle</span>
|
||||
</IconButton>
|
||||
</span>
|
||||
</Tooltip>
|
||||
<PlayerControls
|
||||
playing={playing}
|
||||
onPlayPause={handlePlayPause}
|
||||
size="large"
|
||||
/>
|
||||
<Tooltip title={repeatLabels[repeatMode]}>
|
||||
<IconButton
|
||||
onClick={cycleRepeatMode}
|
||||
aria-label={repeatLabels[repeatMode]}
|
||||
className={repeatMode !== "off" ? "is-active" : undefined}
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
{repeatMode === "one" ? "repeat_one" : "repeat"}
|
||||
</span>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
<div className="audio-now-playing-utility">
|
||||
<div className="audio-now-playing-volume">
|
||||
<PlayerVolume
|
||||
volume={volume}
|
||||
isMuted={isMuted}
|
||||
onVolumeChange={setVolume}
|
||||
onMuteToggle={() => setIsMuted(!isMuted)}
|
||||
{item && (
|
||||
<CastButton
|
||||
item={item}
|
||||
transfer={{
|
||||
kind: "audio",
|
||||
positionTicks: secToTicks(progress),
|
||||
queue: queue ?? [],
|
||||
startIndex: currentTrack,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<IconButton
|
||||
onClick={(e) => setMenuAnchor(e.currentTarget)}
|
||||
aria-label="Ещё"
|
||||
title="Ещё"
|
||||
>
|
||||
<span className="material-symbols-rounded">more_horiz</span>
|
||||
</IconButton>
|
||||
@@ -282,8 +465,8 @@ function AudioPlayerRoute() {
|
||||
anchorEl={menuAnchor}
|
||||
open={Boolean(menuAnchor)}
|
||||
onClose={() => setMenuAnchor(null)}
|
||||
anchorOrigin={{ vertical: "top", horizontal: "right" }}
|
||||
transformOrigin={{ vertical: "bottom", horizontal: "right" }}
|
||||
anchorOrigin={{ vertical: "top", horizontal: "left" }}
|
||||
transformOrigin={{ vertical: "bottom", horizontal: "left" }}
|
||||
>
|
||||
<MenuItem
|
||||
disabled={!item?.AlbumId}
|
||||
@@ -332,26 +515,92 @@ function AudioPlayerRoute() {
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<aside
|
||||
className={`audio-side ${hasLyrics ? "has-lyrics" : ""}`}
|
||||
aria-label="Текст и очередь"
|
||||
>
|
||||
{hasLyrics && (
|
||||
<div className="audio-side-lyrics">
|
||||
<LyricsPanel
|
||||
item={item}
|
||||
api={api}
|
||||
currentTime={progress}
|
||||
onSeek={handleSeekCommit}
|
||||
<div className="music-player-transport">
|
||||
<Tooltip title="Перемешать следующие">
|
||||
<span>
|
||||
<IconButton
|
||||
onClick={shuffleUpcoming}
|
||||
disabled={!hasUpcoming}
|
||||
aria-label="Перемешать следующие"
|
||||
>
|
||||
<span className="material-symbols-rounded">shuffle</span>
|
||||
</IconButton>
|
||||
</span>
|
||||
</Tooltip>
|
||||
<IconButton
|
||||
onClick={() => playItemFromQueue("previous", user?.Id, api)}
|
||||
aria-label="Предыдущий"
|
||||
title="Предыдущий"
|
||||
>
|
||||
<span className="material-symbols-rounded">skip_previous</span>
|
||||
</IconButton>
|
||||
<button
|
||||
type="button"
|
||||
className="music-player-play"
|
||||
onClick={handlePlayPause}
|
||||
aria-label={playing ? "Пауза" : "Играть"}
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
{playing ? "pause" : "play_arrow"}
|
||||
</span>
|
||||
</button>
|
||||
<IconButton
|
||||
onClick={() => playItemFromQueue("next", user?.Id, api)}
|
||||
aria-label="Следующий"
|
||||
title="Следующий"
|
||||
>
|
||||
<span className="material-symbols-rounded">skip_next</span>
|
||||
</IconButton>
|
||||
<Tooltip title={repeatLabels[repeatMode]}>
|
||||
<IconButton
|
||||
onClick={cycleRepeatMode}
|
||||
aria-label={repeatLabels[repeatMode]}
|
||||
className={repeatMode !== "off" ? "is-active" : undefined}
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
{repeatMode === "one" ? "repeat_one" : "repeat"}
|
||||
</span>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
<div className="music-player-controls-side is-end">
|
||||
<div className="music-player-volume">
|
||||
<PlayerVolume
|
||||
volume={volume}
|
||||
isMuted={isMuted}
|
||||
onVolumeChange={setVolume}
|
||||
onMuteToggle={() => setIsMuted(!isMuted)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<div className="audio-side-queue">
|
||||
<QueueView variant="panel" />
|
||||
<Tooltip title="Текст песни">
|
||||
<span>
|
||||
<IconButton
|
||||
onClick={() => openPanel("lyrics")}
|
||||
aria-label="Текст песни"
|
||||
className={
|
||||
panelOpen && panelTab === "lyrics" ? "is-active" : undefined
|
||||
}
|
||||
disabled={!hasLyrics}
|
||||
>
|
||||
<span className="material-symbols-rounded">lyrics</span>
|
||||
</IconButton>
|
||||
</span>
|
||||
</Tooltip>
|
||||
<Tooltip title="Очередь">
|
||||
<IconButton
|
||||
onClick={() => openPanel("queue")}
|
||||
aria-label="Очередь"
|
||||
className={
|
||||
panelOpen && panelTab === "queue" ? "is-active" : undefined
|
||||
}
|
||||
>
|
||||
<span className="material-symbols-rounded">queue_music</span>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</aside>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<Dialog
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { decode } from "blurhash";
|
||||
|
||||
type Palette = {
|
||||
/** Main wall colour of the player. */
|
||||
base: string;
|
||||
/** Darker end of the vertical gradient. */
|
||||
deep: string;
|
||||
};
|
||||
|
||||
const FALLBACK: Palette = { base: "hsl(266 32% 22%)", deep: "hsl(266 40% 9%)" };
|
||||
|
||||
const clamp = (value: number, min: number, max: number) =>
|
||||
Math.min(max, Math.max(min, value));
|
||||
|
||||
const rgbToHsl = (r: number, g: number, b: number) => {
|
||||
const rn = r / 255;
|
||||
const gn = g / 255;
|
||||
const bn = b / 255;
|
||||
const max = Math.max(rn, gn, bn);
|
||||
const min = Math.min(rn, gn, bn);
|
||||
const l = (max + min) / 2;
|
||||
let h = 0;
|
||||
let s = 0;
|
||||
if (max !== min) {
|
||||
const d = max - min;
|
||||
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
||||
switch (max) {
|
||||
case rn:
|
||||
h = (gn - bn) / d + (gn < bn ? 6 : 0);
|
||||
break;
|
||||
case gn:
|
||||
h = (bn - rn) / d + 2;
|
||||
break;
|
||||
default:
|
||||
h = (rn - gn) / d + 4;
|
||||
}
|
||||
h /= 6;
|
||||
}
|
||||
return { h: h * 360, s, l };
|
||||
};
|
||||
|
||||
const hsl = (h: number, s: number, l: number) =>
|
||||
`hsl(${Math.round(h)} ${Math.round(s * 100)}% ${Math.round(l * 100)}%)`;
|
||||
|
||||
/**
|
||||
* The player wall follows the record: decode the cover's blurhash, average it
|
||||
* and turn it into a muted, slightly saturated background. Blurhash is local
|
||||
* (no CORS/network work), and the artwork always ships one from Jellyfin.
|
||||
*/
|
||||
export const getCoverPalette = (item?: BaseItemDto | null): Palette => {
|
||||
const tag = item?.ImageTags?.Primary;
|
||||
const hash = tag ? item?.ImageBlurHashes?.Primary?.[tag] : undefined;
|
||||
if (!hash) return FALLBACK;
|
||||
|
||||
try {
|
||||
const size = 32;
|
||||
const pixels = decode(hash, size, size);
|
||||
let r = 0;
|
||||
let g = 0;
|
||||
let b = 0;
|
||||
let count = 0;
|
||||
for (let i = 0; i < pixels.length; i += 4) {
|
||||
r += pixels[i];
|
||||
g += pixels[i + 1];
|
||||
b += pixels[i + 2];
|
||||
count++;
|
||||
}
|
||||
if (!count) return FALLBACK;
|
||||
const { h, s, l } = rgbToHsl(r / count, g / count, b / count);
|
||||
|
||||
// A wall, not a black rectangle: keep a hint of the cover's hue and
|
||||
// lift it into a comfortable mid-dark range.
|
||||
const wallSaturation = clamp(s + 0.14, 0.16, 0.42);
|
||||
const wallLightness = clamp(l + 0.1, 0.16, 0.3);
|
||||
|
||||
return {
|
||||
base: hsl(h, wallSaturation, wallLightness),
|
||||
deep: hsl(h, wallSaturation, clamp(wallLightness * 0.45, 0.05, 0.12)),
|
||||
};
|
||||
} catch {
|
||||
return FALLBACK;
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user