Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue-404-Featured-play-search-play-fix #407

Merged
merged 2 commits into from
Jul 23, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
featured play fix and search fix
  • Loading branch information
Angryman18 committed Jul 22, 2022
commit 29644ab5a20ee1fdb03d8ce755f83660370a6eb7
2 changes: 1 addition & 1 deletion src/common/playlists/FeaturedPlays.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const FeaturedPlays = () => {
{loading && <p>Loading...</p>}
{error && <p>{error?.message ?? "Something went wrong"}</p>}
{success && data?.map((play, index) => (
<PlayThumbnail key={play.id} play={play} />
<PlayThumbnail addRoute={true} key={play.id} play={play} />
))}
</ul>
</>
Expand Down
10 changes: 8 additions & 2 deletions src/common/playlists/PlayThumbnail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Angryman18 marked this conversation as resolved.
Show resolved Hide resolved

useEffect(() => {
// Set the cover image
// if it is passed as a meta data
Expand All @@ -55,7 +57,7 @@ const PlayThumbnail = ({ play }) => {

return (
<li key={play.id}>
<Link to={play.id} state={{ id: play.id }}>
<Link to={getRoute} state={{ id: play.id }}>
<div className='play-thumb'>
<Shimmer>
<img src={cover} alt='' className='play-thumb-img' />
Expand All @@ -76,4 +78,8 @@ const PlayThumbnail = ({ play }) => {
);
};

PlayThumbnail.defaultProps = {
addRoute: false
}

export default PlayThumbnail;
11 changes: 3 additions & 8 deletions src/common/services/request/query/fetch-plays-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
/**
Expand Down