From 29644ab5a20ee1fdb03d8ce755f83660370a6eb7 Mon Sep 17 00:00:00 2001 From: Angryman18 Date: Fri, 22 Jul 2022 23:12:06 +0530 Subject: [PATCH 1/2] featured play fix and search fix --- src/common/playlists/FeaturedPlays.jsx | 2 +- src/common/playlists/PlayThumbnail.jsx | 10 ++++++++-- .../services/request/query/fetch-plays-filter.js | 11 +++-------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/common/playlists/FeaturedPlays.jsx b/src/common/playlists/FeaturedPlays.jsx index a6bc7ff3e..55562059b 100644 --- a/src/common/playlists/FeaturedPlays.jsx +++ b/src/common/playlists/FeaturedPlays.jsx @@ -14,7 +14,7 @@ const FeaturedPlays = () => { {loading &&

Loading...

} {error &&

{error?.message ?? "Something went wrong"}

} {success && data?.map((play, index) => ( - + ))} diff --git a/src/common/playlists/PlayThumbnail.jsx b/src/common/playlists/PlayThumbnail.jsx index 99a55f751..8fd60a8be 100644 --- a/src/common/playlists/PlayThumbnail.jsx +++ b/src/common/playlists/PlayThumbnail.jsx @@ -26,9 +26,11 @@ const Author = ({ user }) => { ); }; -const PlayThumbnail = ({ play }) => { +const PlayThumbnail = ({ play, addRoute }) => { const [cover, setCover] = useState(null); + const getRoute = addRoute ? `plays/${play.id}` : play.id + useEffect(() => { // Set the cover image // if it is passed as a meta data @@ -55,7 +57,7 @@ const PlayThumbnail = ({ play }) => { return (
  • - +
    @@ -76,4 +78,8 @@ const PlayThumbnail = ({ play }) => { ); }; +PlayThumbnail.defaultProps = { + addRoute: false +} + export default PlayThumbnail; diff --git a/src/common/services/request/query/fetch-plays-filter.js b/src/common/services/request/query/fetch-plays-filter.js index 002f6ca5a..9e1f9f5f8 100644 --- a/src/common/services/request/query/fetch-plays-filter.js +++ b/src/common/services/request/query/fetch-plays-filter.js @@ -48,7 +48,7 @@ export const FetchPlaysFilter = { }, // Filter Plays by a search string in name or description filterPlaysBySearchString(Obj) { - const payload = { + return { display: "Filter Plays by a search string in name or description", name: "Fetch_Plays", function: "plays", @@ -76,23 +76,18 @@ export const FetchPlaysFilter = { { field: "name", operator: "iregex", - value: Obj.name, + value: Obj.name.toLowerCase(), type: "string", }, { field: "description", operator: "iregex", - value: Obj.name, + value: Obj.name.toLowerCase(), type: "string", }, ], }, }; - - if (!env && !preview) { - payload.where.clause.push(defaultClause); - } - return payload; }, // Filter plays by level, user, language, and multiple tags /** From 160457e5ec7927b309872268311d9bf6bd1147bc Mon Sep 17 00:00:00 2001 From: Angryman18 Date: Sat, 23 Jul 2022 07:35:25 +0530 Subject: [PATCH 2/2] removed the addRoute prop --- src/common/playlists/FeaturedPlays.jsx | 2 +- src/common/playlists/PlayThumbnail.jsx | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/common/playlists/FeaturedPlays.jsx b/src/common/playlists/FeaturedPlays.jsx index 55562059b..a6bc7ff3e 100644 --- a/src/common/playlists/FeaturedPlays.jsx +++ b/src/common/playlists/FeaturedPlays.jsx @@ -14,7 +14,7 @@ const FeaturedPlays = () => { {loading &&

    Loading...

    } {error &&

    {error?.message ?? "Something went wrong"}

    } {success && data?.map((play, index) => ( - + ))} diff --git a/src/common/playlists/PlayThumbnail.jsx b/src/common/playlists/PlayThumbnail.jsx index 8fd60a8be..357da0f14 100644 --- a/src/common/playlists/PlayThumbnail.jsx +++ b/src/common/playlists/PlayThumbnail.jsx @@ -26,10 +26,9 @@ const Author = ({ user }) => { ); }; -const PlayThumbnail = ({ play, addRoute }) => { +const PlayThumbnail = ({ play }) => { const [cover, setCover] = useState(null); - const getRoute = addRoute ? `plays/${play.id}` : play.id useEffect(() => { // Set the cover image @@ -57,7 +56,7 @@ const PlayThumbnail = ({ play, addRoute }) => { return (
  • - +
    @@ -78,8 +77,4 @@ const PlayThumbnail = ({ play, addRoute }) => { ); }; -PlayThumbnail.defaultProps = { - addRoute: false -} - export default PlayThumbnail;