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,
parties,
setParties,
isFetching,
loaded,
fetching,
setFetching,
fetchError,
fetch,
@ -155,14 +156,22 @@ const ProfileRoute: React.FC<Props> = ({
}
const renderInfiniteScroll = (
<InfiniteScroll
dataLength={parties && parties.length > 0 ? parties.length : 0}
next={() => setCurrentPage(currentPage + 1)}
hasMore={totalPages > currentPage}
loader={renderLoading(3)}
>
<GridRepCollection>{renderParties()}</GridRepCollection>
</InfiniteScroll>
<>
{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
dataLength={parties && parties.length > 0 ? parties.length : 0}
next={() => setCurrentPage(currentPage + 1)}
hasMore={totalPages > currentPage}
loader={renderLoading(3)}
>
<GridRepCollection>{renderParties()}</GridRepCollection>
</InfiniteScroll>
</>
)
if (context) {

View file

@ -66,7 +66,8 @@ const SavedRoute: React.FC<Props> = ({
recordCount,
parties,
setParties,
isFetching,
loaded,
fetching,
setFetching,
fetchError,
fetch,
@ -150,14 +151,22 @@ const SavedRoute: React.FC<Props> = ({
}
const renderInfiniteScroll = (
<InfiniteScroll
dataLength={parties && parties.length > 0 ? parties.length : 0}
next={() => setCurrentPage(currentPage + 1)}
hasMore={totalPages > currentPage}
loader={renderLoading(3)}
>
<GridRepCollection>{renderParties()}</GridRepCollection>
</InfiniteScroll>
<>
{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
dataLength={parties && parties.length > 0 ? parties.length : 0}
next={() => setCurrentPage(currentPage + 1)}
hasMore={totalPages > currentPage}
loader={renderLoading(3)}
>
<GridRepCollection>{renderParties()}</GridRepCollection>
</InfiniteScroll>
</>
)
if (context) {

View file

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