diff --git a/src/app/pages/ProposalDetailsPage/ProposalVotesCard.tsx b/src/app/pages/ProposalDetailsPage/ProposalVotesCard.tsx index fb20fc498d..e5ec643700 100644 --- a/src/app/pages/ProposalDetailsPage/ProposalVotesCard.tsx +++ b/src/app/pages/ProposalDetailsPage/ProposalVotesCard.tsx @@ -15,6 +15,7 @@ import { AppErrors } from '../../../types/errors' import { ErrorBoundary } from '../../components/ErrorBoundary' import Box from '@mui/material/Box' import { NoMatchingDataMaybeClearFilters, TableSearchBar } from '../../components/Search/TableSearchBar' +import { CardEmptyState } from '../../components/CardEmptyState' type ProposalVotesProps = { isLoading: boolean @@ -84,11 +85,8 @@ export const ProposalVotesView: FC = () => { const proposalId = parseInt(useParams().proposalId!, 10) const { clearFilters } = useVoteFiltering(t) - const { results, isLoading, isOnNonexistentPage, hasNoResultsBecauseOfFilters } = useVotes( - network, - proposalId, - t, - ) + const { results, isLoading, isOnNonexistentPage, hasNoResultsBecauseOfFilters, hasNoResultsWhatsoever } = + useVotes(network, proposalId, t) if (isOnNonexistentPage) throw AppErrors.PageDoesNotExist @@ -96,6 +94,10 @@ export const ProposalVotesView: FC = () => { return } + if (hasNoResultsWhatsoever) { + return + } + return ( const isOnFirstPage = results.tablePaginationProps.selectedPage === 1 const hasData = !!results.data?.length const isOnNonexistentPage = !isLoading && !isOnFirstPage && !hasData - const hasNoResultsBecauseOfFilters = !isLoading && !hasData && isOnFirstPage && hasFilters + const hasNoResultsWhatsoever = !isLoading && !allVotes.total_count + const hasNoResultsBecauseOfFilters = + !isLoading && !hasData && isOnFirstPage && hasFilters && !hasNoResultsWhatsoever - return { results, isLoading, isOnNonexistentPage, hasNoResultsBecauseOfFilters } + return { results, isLoading, isOnNonexistentPage, hasNoResultsBecauseOfFilters, hasNoResultsWhatsoever } } diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index 67e97fb641..1ff5e0ce7d 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -188,6 +188,7 @@ "createTooltip": "Voting created on epoch shown.", "deposit": "Deposit", "failedToLoadAllVotes": "Failed to load all the votes, number might be incomplete!", + "thereAreNoVotes": "No votes have been registered.", "handler": "Title", "id": "ID", "listTitle": "Network Change Proposals",