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
|
||||
|
||||
Reference in new issue
Block a user