From ace6e10a926fafa97a46c5ee9df7635390d0c22b Mon Sep 17 00:00:00 2001 From: SrGooglo Date: Tue, 30 May 2023 01:10:41 +0000 Subject: [PATCH] use searcher --- .../components/dashboard/releases/index.jsx | 82 +++++++++++++------ .../components/dashboard/releases/index.less | 67 +++++++++++++++ 2 files changed, 122 insertions(+), 27 deletions(-) diff --git a/packages/app/src/pages/music/components/dashboard/releases/index.jsx b/packages/app/src/pages/music/components/dashboard/releases/index.jsx index 65c06884..81ab81bd 100644 --- a/packages/app/src/pages/music/components/dashboard/releases/index.jsx +++ b/packages/app/src/pages/music/components/dashboard/releases/index.jsx @@ -3,10 +3,12 @@ import * as antd from "antd" import { Icons } from "components/Icons" import { ImageViewer } from "components" +import Searcher from "components/Searcher" import PlaylistCreator from "../../../creator" import PlaylistsModel from "models/playlists" + import "./index.less" const ReleaseItem = (props) => { @@ -59,33 +61,34 @@ const ReleaseItem = (props) => { } +const openPlaylistCreator = (playlist_id) => { + console.log("Opening playlist creator", playlist_id) + + app.DrawerController.open("playlist_creator", PlaylistCreator, { + type: "drawer", + props: { + title:

+ + Creator +

, + width: "fit-content", + }, + componentProps: { + playlist_id: playlist_id, + } + }) +} + +const navigateToPlaylist = (playlist_id) => { + return app.setLocation(`/play/${playlist_id}`) +} + export default (props) => { - const openPlaylistCreator = (playlist_id) => { - console.log("Opening playlist creator", playlist_id) - - app.DrawerController.open("playlist_creator", PlaylistCreator, { - type: "drawer", - props: { - title:

- - Creator -

, - width: "fit-content", - }, - componentProps: { - playlist_id: playlist_id, - } - }) - } - - const navigateToPlaylist = (playlist_id) => { - return app.setLocation(`/play/${playlist_id}`) - } - + const [searchResults, setSearchResults] = React.useState(null) const [L_Releases, R_Releases, E_Releases] = app.cores.api.useRequest(PlaylistsModel.getMyReleases) if (E_Releases) { @@ -122,9 +125,34 @@ export default (props) => { + setSearchResults(null)} + /> +
{ - R_Releases.map((release) => { + searchResults && searchResults.length === 0 && + } + { + searchResults && searchResults.length > 0 && searchResults.map((release) => { + return openPlaylistCreator(release._id)} + onClickNavigate={() => navigateToPlaylist(release._id)} + /> + }) + } + { + !searchResults && R_Releases.map((release) => { return