Add no teams found message to other pages

This commit is contained in:
Justin Edmund 2024-04-23 04:00:20 -07:00
parent bba89795a5
commit 4e4f7d2c03
3 changed files with 36 additions and 21 deletions

View file

@ -71,7 +71,8 @@ const ProfileRoute: React.FC<Props> = ({
recordCount, recordCount,
parties, parties,
setParties, setParties,
isFetching, loaded,
fetching,
setFetching, setFetching,
fetchError, fetchError,
fetch, fetch,
@ -155,6 +156,13 @@ const ProfileRoute: React.FC<Props> = ({
} }
const renderInfiniteScroll = ( const renderInfiniteScroll = (
<>
{parties.length === 0 && !loaded && renderLoading(3)}
{parties.length === 0 && loaded && (
<div className="notFound">
<h2>There are no teams with your specified filters</h2>
</div>
)}
<InfiniteScroll <InfiniteScroll
dataLength={parties && parties.length > 0 ? parties.length : 0} dataLength={parties && parties.length > 0 ? parties.length : 0}
next={() => setCurrentPage(currentPage + 1)} next={() => setCurrentPage(currentPage + 1)}
@ -163,6 +171,7 @@ const ProfileRoute: React.FC<Props> = ({
> >
<GridRepCollection>{renderParties()}</GridRepCollection> <GridRepCollection>{renderParties()}</GridRepCollection>
</InfiniteScroll> </InfiniteScroll>
</>
) )
if (context) { if (context) {

View file

@ -66,7 +66,8 @@ const SavedRoute: React.FC<Props> = ({
recordCount, recordCount,
parties, parties,
setParties, setParties,
isFetching, loaded,
fetching,
setFetching, setFetching,
fetchError, fetchError,
fetch, fetch,
@ -150,6 +151,13 @@ const SavedRoute: React.FC<Props> = ({
} }
const renderInfiniteScroll = ( const renderInfiniteScroll = (
<>
{parties.length === 0 && !loaded && renderLoading(3)}
{parties.length === 0 && loaded && (
<div className="notFound">
<h2>There are no teams with your specified filters</h2>
</div>
)}
<InfiniteScroll <InfiniteScroll
dataLength={parties && parties.length > 0 ? parties.length : 0} dataLength={parties && parties.length > 0 ? parties.length : 0}
next={() => setCurrentPage(currentPage + 1)} next={() => setCurrentPage(currentPage + 1)}
@ -158,6 +166,7 @@ const SavedRoute: React.FC<Props> = ({
> >
<GridRepCollection>{renderParties()}</GridRepCollection> <GridRepCollection>{renderParties()}</GridRepCollection>
</InfiniteScroll> </InfiniteScroll>
</>
) )
if (context) { if (context) {

View file

@ -32,7 +32,6 @@ import { CollectionPage } from '~utils/enums'
interface Props { interface Props {
context?: PageContextObj context?: PageContextObj
query: { [key: string]: string }
version: AppUpdate version: AppUpdate
error: boolean error: boolean
status?: ResponseStatus status?: ResponseStatus
@ -40,7 +39,6 @@ interface Props {
const TeamsRoute: React.FC<Props> = ({ const TeamsRoute: React.FC<Props> = ({
context, context,
query,
version, version,
error, error,
status, status,
@ -212,7 +210,6 @@ export const getServerSideProps = async ({ req, res, locale, query }: { req: Nex
return { return {
props: { props: {
context: { raidGroups }, context: { raidGroups },
query,
version, version,
error: false, error: false,
...(await serverSideTranslations(locale, ['common'])), ...(await serverSideTranslations(locale, ['common'])),