diff --git a/packages/app/src/pages/play/[play_id].jsx b/packages/app/src/pages/play/[play_id].jsx index 104b34f6..780be9ca 100755 --- a/packages/app/src/pages/play/[play_id].jsx +++ b/packages/app/src/pages/play/[play_id].jsx @@ -2,20 +2,35 @@ import React from "react" import * as antd from "antd" import classnames from "classnames" import { ImageViewer } from "components" +import moment from "moment" + +import { Icons } from "components/Icons" import PlaylistsModel from "models/playlists" import "./index.less" -const PlaylistItem = ({ playlist }) => { - return
- Playlist Tracks -
-} - -const TrackItem = ({ track }) => { - return
- Track +const TrackItem = (props) => { + return
+
+ } + onClick={props.onClick} + /> +
+
+ +
+
+
+ {props.track.title} +
+
+ {props.track.artist} +
+
} @@ -38,6 +53,19 @@ export default (props) => { } } + const handleOnClickTrack = (track) => { + // search index of track + const index = playlist.list.findIndex((item) => { + return item._id === track._id + }) + + if (index === -1) { + return + } + + app.cores.player.startPlaylist(playlist.list, index) + } + React.useEffect(() => { loadData() }, []) @@ -46,20 +74,6 @@ export default (props) => { return } - const renderComponent = () => { - switch (playlist.type) { - case "playlist": { - return - } - case "track": { - return - } - default: { - return - } - } - } - return
{
- +

{playlist.title}

-
- {playlist.user.username} + +
+

+ {playlist.description} +

+
+ +
+
+

{ + app.navigation.goToAccount(playlist.user.username) + }} + > + + + Publised by {playlist.user.username} +

+
+
+

+ {playlist.list.length} Tracks +

+
+ +
+

+ Released on {moment(playlist.created_at).format("DD/MM/YYYY")} +

+
- {renderComponent()} +
+

+ Tracks +

+ { + playlist.list.map((item, index) => { + return handleOnClickTrack(item)} + /> + }) + } +
} \ No newline at end of file diff --git a/packages/app/src/pages/play/index.less b/packages/app/src/pages/play/index.less index abda97f3..47cba07c 100755 --- a/packages/app/src/pages/play/index.less +++ b/packages/app/src/pages/play/index.less @@ -1,7 +1,7 @@ .play { display: grid; - grid-template-columns: 1fr 50vw; + grid-template-columns: 30vw 1fr; grid-template-rows: 1fr; grid-column-gap: 20px; grid-row-gap: 0px; @@ -15,49 +15,207 @@ width: 100%; - padding: 20px; + color: var(--text-color); .play_info { display: flex; flex-direction: column; - + align-self: center; - + width: 30vw; height: 100%; - + padding: 20px; - + background-color: var(--background-color-accent); border-radius: 12px; .play_info_cover { display: flex; flex-direction: column; - + align-items: center; justify-content: center; - - width: 100%; - height: 100%; - + + align-self: center; + + width: 400px; + height: 400px; + + background-color: black; + border-radius: 12px; + + overflow: hidden; + img { width: 100%; height: 100%; - object-fit: cover; + border-radius: 12px; + + object-fit: cover; } } .play_info_details { - margin-top: 20px; - + padding: 20px; + .play_info_title { font-size: 1.5rem; font-family: "Space Grotesk", sans-serif; + + h1 { + margin: 0; + } + + word-break: break-all; + + font-weight: 600; + + margin-bottom: 10px; + } + + .play_info_description { + font-size: 0.8rem; + font-weight: 400; + } + + .play_info_statistics { + display: flex; + flex-direction: column; + + margin-top: 20px; + + background-color: var(--background-color-primary); + + padding: 20px; + + border-radius: 8px; + + .play_info_statistics_item { + display: flex; + flex-direction: row; + + align-items: center; + + margin-bottom: 10px; + + h1, + h2, + h3, + h4, + h5, + h6, + p, + span { + margin: 0; + } + + .play_info_statistics_item_icon { + margin-right: 10px; + } + + .play_info_statistics_item_text { + font-size: 0.8rem; + font-weight: 400; + } + + &:last-child { + margin-bottom: 0; + } + } + } } } } - + + .list { + display: flex; + flex-direction: column; + + color: var(--text-color); + + padding: 0 30px; + } +} + + +.track_item { + display: flex; + flex-direction: row; + + align-items: center; + + padding: 10px; + margin-bottom: 10px; + + border-radius: 8px; + + background-color: var(--background-color-accent); + + cursor: pointer; + + .track_item_actions { + margin-right: 10px; + + .ant-btn { + svg { + margin: 0 !important; + + background-color: transparent; + } + + margin-right: 10px; + + &:last-child { + margin-right: 0; + } + } + } + + .track_item_cover { + display: flex; + flex-direction: column; + + align-items: center; + justify-content: center; + + background-color: black; + + border-radius: 12px; + + overflow: hidden; + + width: 50px; + height: 50px; + + img { + width: 100%; + height: 100%; + + object-fit: cover; + } + } + + .track_item_details { + display: flex; + flex-direction: column; + + margin-left: 10px; + + .track_item_title { + font-size: 1rem; + font-family: "Space Grotesk", sans-serif; + } + + .track_item_artist { + font-size: 0.8rem; + } + } + + &:last-child { + margin-bottom: 0; + } } \ No newline at end of file