diff --git a/packages/app/src/pages/music/components/feed/index.jsx b/packages/app/src/pages/music/components/feed/index.jsx new file mode 100644 index 00000000..23c28085 --- /dev/null +++ b/packages/app/src/pages/music/components/feed/index.jsx @@ -0,0 +1,107 @@ +import React from "react" +import * as antd from "antd" +import { ImageViewer } from "components" +import { Icons } from "components/Icons" + +import FeedModel from "models/feed" + +import "./index.less" + +const PlaylistItem = (props) => { + const { playlist } = props + + const onClick = () => { + if (typeof props.onClick === "function") { + return props.onClick(playlist) + } + + return app.setLocation(`/play/${playlist._id}`) + } + + return
+
+ +
+
+
+ {playlist.title} +
+
+ {playlist.user.username} +
+
+
+} + +export default () => { + const [loading, setLoading] = React.useState(true) + const [list, setList] = React.useState([]) + + const loadData = async () => { + setLoading(true) + + const response = await FeedModel.getPlaylistsFeed({ + limit: 10, + trim: 0, + }).catch((err) => { + console.error(err) + app.message.error("Failed to load playlists") + return null + }) + + setLoading(false) + + console.log(response) + + if (response) { + setList(response) + } + } + + React.useEffect(() => { + loadData() + }, []) + + if (loading) { + return + } + + return
+
+
+

Releases from your artist

+
+
+ { + list.map((playlist, index) => { + return + }) + } +
+
+ +
+
+

Discover new trends

+
+
+ { + list.map((playlist, index) => { + return + }) + } +
+
+
+} \ No newline at end of file diff --git a/packages/app/src/pages/music/components/feed/index.less b/packages/app/src/pages/music/components/feed/index.less new file mode 100644 index 00000000..abe710da --- /dev/null +++ b/packages/app/src/pages/music/components/feed/index.less @@ -0,0 +1,107 @@ +.playlistExplorer { + display: flex; + flex-direction: column; + + width: 100%; + + max-width: 70vw; + + overflow: hidden; + + .playlistExplorer_section { + display: flex; + flex-direction: column; + + margin-bottom: 50px; + + .playlistExplorer_section_header { + h1 { + font-size: 1.5rem; + } + } + + .playlistExplorer_section_list { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + + align-items: center; + + overflow-x: scroll; + + padding: 10px 0; + + >.playlistItem { + margin-right: 20px; + } + } + } +} + +.playlistItem { + position: relative; + display: flex; + flex-direction: column; + + cursor: pointer; + + width: 200px; + min-width: 200px; + + border-radius: 12px; + + transition: all 0.2s ease-in-out; + + &:hover { + transform: translate(0, -5px); + outline: 2px solid var(--background-color-accent); + } + + background-color: var(--background-color-accent); + border-radius: 8px; + + .playlistItem_cover { + width: 100%; + height: 100%; + + transition: all 0.2s ease-in-out; + + filter: drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.25)); + + img { + width: 100%; + height: 100%; + object-fit: cover; + border-radius: 8px; + } + } + + .playlistItem_info { + width: 100%; + + padding: 10px; + + transition: all 0.2s ease-in-out; + + .playlistItem_info_title { + font-size: 1.2rem; + font-weight: 600; + color: var(--background-color-contrast); + font-family: "Space Grotesk", sans-serif; + + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + } + + .playlistItem_info_author { + font-size: 1rem; + font-weight: 400; + color: var(--text-color); + + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + } + } +} \ No newline at end of file diff --git a/packages/app/src/pages/music/components/playlists/index.jsx b/packages/app/src/pages/music/components/playlists/index.jsx deleted file mode 100644 index 6e870e1d..00000000 --- a/packages/app/src/pages/music/components/playlists/index.jsx +++ /dev/null @@ -1,7 +0,0 @@ -import React from "react" - -export default () => { - return
- -
-} \ No newline at end of file diff --git a/packages/app/src/pages/music/tabs.jsx b/packages/app/src/pages/music/tabs.jsx index 3e5ce2ff..e21c8246 100644 --- a/packages/app/src/pages/music/tabs.jsx +++ b/packages/app/src/pages/music/tabs.jsx @@ -1,11 +1,21 @@ -import PlaylistsTabs from "./components/playlists" +import FeedTab from "./components/feed" import SpacesTabs from "./components/spaces" export default { - "playlists": { - title: "Playlists", + "feed": { + title: "Feed", + icon: "Compass", + component: FeedTab + }, + "library": { + title: "Library", icon: "MdLibraryMusic", - component: PlaylistsTabs + component: FeedTab + }, + "dashboard": { + title: "Dashboard", + icon: "MdOutlineDashboard", + component: FeedTab }, "spaces": { title: "Spaces",