mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
Improve playlist view
This commit is contained in:
parent
a92de80121
commit
b695e170e8
@ -6,14 +6,6 @@ import { Icons } from "@components/Icons"
|
|||||||
|
|
||||||
import "./index.less"
|
import "./index.less"
|
||||||
|
|
||||||
const typeToNavigationType = {
|
|
||||||
playlist: "playlist",
|
|
||||||
album: "album",
|
|
||||||
track: "track",
|
|
||||||
single: "track",
|
|
||||||
ep: "album",
|
|
||||||
}
|
|
||||||
|
|
||||||
const Playlist = (props) => {
|
const Playlist = (props) => {
|
||||||
const [coverHover, setCoverHover] = React.useState(false)
|
const [coverHover, setCoverHover] = React.useState(false)
|
||||||
|
|
||||||
@ -28,13 +20,27 @@ const Playlist = (props) => {
|
|||||||
return props.onClick(playlist)
|
return props.onClick(playlist)
|
||||||
}
|
}
|
||||||
|
|
||||||
return app.location.push(`/music/list/${playlist._id}`)
|
const params = new URLSearchParams()
|
||||||
|
|
||||||
|
if (playlist.type) {
|
||||||
|
params.set("type", playlist.type)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (playlist.service) {
|
||||||
|
params.set("service", playlist.service)
|
||||||
|
}
|
||||||
|
|
||||||
|
return app.location.push(
|
||||||
|
`/music/list/${playlist._id}?${params.toString()}`,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onClickPlay = (e) => {
|
const onClickPlay = (e) => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
|
|
||||||
app.cores.player.start(playlist.items)
|
if (playlist.items) {
|
||||||
|
app.cores.player.start(playlist.items)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -68,8 +74,16 @@ const Playlist = (props) => {
|
|||||||
<div className="playlist_info_title" onClick={onClick}>
|
<div className="playlist_info_title" onClick={onClick}>
|
||||||
<h1>{playlist.title}</h1>
|
<h1>{playlist.title}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{props.row && (
|
{props.row && (
|
||||||
<div className="playlist_details">
|
<div className="playlist_details">
|
||||||
|
{playlist.service === "tidal" && (
|
||||||
|
<p>
|
||||||
|
<Icons.SiTidal />
|
||||||
|
Tidal
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<Icons.MdAlbum />
|
<Icons.MdAlbum />
|
||||||
{playlist.type ?? "playlist"}
|
{playlist.type ?? "playlist"}
|
||||||
|
@ -45,6 +45,13 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
.playlist_info_title {
|
.playlist_info_title {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
gap: 7px;
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
white-space: wrap;
|
white-space: wrap;
|
||||||
|
@ -16,6 +16,7 @@ const typeToKind = {
|
|||||||
ep: "releases",
|
ep: "releases",
|
||||||
compilation: "releases",
|
compilation: "releases",
|
||||||
playlist: "playlists",
|
playlist: "playlists",
|
||||||
|
single: "tracks",
|
||||||
}
|
}
|
||||||
|
|
||||||
const PlaylistHeader = ({
|
const PlaylistHeader = ({
|
||||||
@ -77,7 +78,6 @@ const PlaylistHeader = ({
|
|||||||
|
|
||||||
<div className="play_info_details">
|
<div className="play_info_details">
|
||||||
<div className="play_info_title">
|
<div className="play_info_title">
|
||||||
{playlist.service === "tidal" && <Icons.SiTidal />}{" "}
|
|
||||||
{typeof playlist.title === "function" ? (
|
{typeof playlist.title === "function" ? (
|
||||||
playlist.title()
|
playlist.title()
|
||||||
) : (
|
) : (
|
||||||
@ -86,19 +86,24 @@ const PlaylistHeader = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="play_info_statistics">
|
<div className="play_info_statistics">
|
||||||
|
{playlist.service === "tidal" && (
|
||||||
|
<div className="play_info_statistics_item">
|
||||||
|
<p>
|
||||||
|
<Icons.SiTidal /> From Tidal
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{PlaylistTypeDecorators[playlistType] && (
|
{PlaylistTypeDecorators[playlistType] && (
|
||||||
<div className="play_info_statistics_item">
|
<div className="play_info_statistics_item">
|
||||||
{PlaylistTypeDecorators[playlistType]()}
|
{PlaylistTypeDecorators[playlistType]()}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="play_info_statistics_item">
|
<div className="play_info_statistics_item">
|
||||||
<p>
|
<p>
|
||||||
<Icons.MdLibraryMusic /> {playlist.total_items}{" "}
|
<Icons.MdLibraryMusic /> {playlist.total_items}{" "}
|
||||||
Items
|
Items
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{playlist.total_duration > 0 && (
|
{playlist.total_duration > 0 && (
|
||||||
<div className="play_info_statistics_item">
|
<div className="play_info_statistics_item">
|
||||||
<p>
|
<p>
|
||||||
@ -107,7 +112,6 @@ const PlaylistHeader = ({
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{playlist.publisher && (
|
{playlist.publisher && (
|
||||||
<div className="play_info_statistics_item">
|
<div className="play_info_statistics_item">
|
||||||
<p onClick={handlePublisherClick}>
|
<p onClick={handlePublisherClick}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user