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

Modified the play not found message with search term #475

Closed
wants to merge 13 commits into from
Closed
22 changes: 17 additions & 5 deletions src/common/playlists/PlayList.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import PlayThumbnail from "./PlayThumbnail";
import { ReactComponent as ImageOops } from "images/img-oops.svg";
import React, { Fragment } from "react";
import React, { Fragment, useEffect, useState, useContext } from "react";
import { SearchContext } from "common/search/search-context";
import "react-loader-spinner/dist/loader/css/react-spinner-loader.css";
import Loader from "common/spinner/spinner";
import * as all_plays from "plays";
Expand All @@ -11,17 +12,28 @@ import { toSanitized } from "common/services/string";

const PlayList = () => {
const [loading, error, plays] = useGetPlays();
const { searchTerm, filterQuery } = useContext(SearchContext);

const hasFilterQuery =
filterQuery.level_id.length > 0 ||
filterQuery.tags.length > 0 ||
filterQuery.owner_user_id.length > 0 ||
filterQuery.language.length > 0;

let { playid } = useParams(); // return the parameter of url
if (loading) {
return <Loader />;
}

if (plays?.length === 0 || error) {
return (
<div className="play-not-found">
<ImageOops className="play-not-found-image" />
<p className="page-404-lead">Play not found</p>
<p className="page-404-desc">
<div className='play-not-found'>
<ImageOops className='play-not-found-image' />
<p className='page-404-lead'>Play not found
{hasFilterQuery? " for matched filter criteria" : null}
{searchTerm ? " for " + searchTerm : null}
vasantisuthar marked this conversation as resolved.
Show resolved Hide resolved
</p>
<p className='page-404-desc'>
Please change your search or adjust filters to find plays.
</p>
</div>
Expand Down