From 50072b2320684bb57aad40a1dcbfaab1a3ce183e Mon Sep 17 00:00:00 2001 From: SrGooglo Date: Tue, 13 Dec 2022 12:01:01 +0000 Subject: [PATCH] added `play` page --- packages/app/src/pages/play/[play_id].jsx | 87 +++++++++++++++++++++++ packages/app/src/pages/play/index.less | 63 ++++++++++++++++ 2 files changed, 150 insertions(+) create mode 100644 packages/app/src/pages/play/[play_id].jsx create mode 100644 packages/app/src/pages/play/index.less diff --git a/packages/app/src/pages/play/[play_id].jsx b/packages/app/src/pages/play/[play_id].jsx new file mode 100644 index 00000000..df808a8f --- /dev/null +++ b/packages/app/src/pages/play/[play_id].jsx @@ -0,0 +1,87 @@ +import React from "react" +import * as antd from "antd" +import classnames from "classnames" +import { ImageViewer } from "components" + +import PlaylistsModel from "models/playlists" + +import "./index.less" + +const PlaylistItem = ({ playlist }) => { + return
+ Playlist Tracks +
+} + +const TrackItem = ({ track }) => { + return
+ Track +
+} + +export default (props) => { + const play_id = props.match.params.play_id + + const [playlist, setPlaylist] = React.useState(null) + + const loadData = async () => { + const response = await PlaylistsModel.getPlaylist(play_id).catch((err) => { + console.error(err) + app.message.error("Failed to load playlist") + return null + }) + + console.log(response) + + if (response) { + setPlaylist(response) + } + } + + React.useEffect(() => { + loadData() + }, []) + + if (!playlist) { + return + } + + const renderComponent = () => { + switch (playlist.type) { + case "playlist": { + return + } + case "track": { + return + } + default: { + return + } + } + } + + return
+
+
+
+ +
+ +
+
+

{playlist.title}

+
+
+ {playlist.user.username} +
+
+
+
+ + {renderComponent()} +
+} \ No newline at end of file diff --git a/packages/app/src/pages/play/index.less b/packages/app/src/pages/play/index.less new file mode 100644 index 00000000..abda97f3 --- /dev/null +++ b/packages/app/src/pages/play/index.less @@ -0,0 +1,63 @@ +.play { + display: grid; + + grid-template-columns: 1fr 50vw; + grid-template-rows: 1fr; + grid-column-gap: 20px; + grid-row-gap: 0px; + + .play_info_wrapper { + display: flex; + flex-direction: column; + + align-items: center; + justify-content: center; + + width: 100%; + + padding: 20px; + + .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%; + + img { + width: 100%; + height: 100%; + object-fit: cover; + border-radius: 12px; + } + } + + .play_info_details { + margin-top: 20px; + + .play_info_title { + font-size: 1.5rem; + font-family: "Space Grotesk", sans-serif; + } + } + } + } + +} \ No newline at end of file