Fix noResultsFound.

This commit is contained in:
Brian Cao 2023-08-15 13:01:50 -07:00
parent 14df1e5a29
commit c3d0a1a628
2 changed files with 61 additions and 61 deletions

View File

@ -29,7 +29,6 @@ export function WebsitesList({ showTeam, showHeader = true, includeTeams, onlyTe
{ enabled: !!user },
);
const { showToast } = useToasts();
const hasData = data && data.length !== 0;
const handleSave = async () => {
await refetch();
@ -57,7 +56,6 @@ export function WebsitesList({ showTeam, showHeader = true, includeTeams, onlyTe
return (
<Page loading={isLoading} error={error}>
{showHeader && <PageHeader title={formatMessage(labels.websites)}>{addButton}</PageHeader>}
{hasData && (
<WebsitesTable
data={data}
showTeam={showTeam}
@ -66,12 +64,6 @@ export function WebsitesList({ showTeam, showHeader = true, includeTeams, onlyTe
onPageSizeChange={handlePageSizeChange}
filterValue={filter}
/>
)}
{!hasData && (
<EmptyPlaceholder message={formatMessage(messages.noDataAvailable)}>
{addButton}
</EmptyPlaceholder>
)}
</Page>
);
}

View File

@ -1,3 +1,4 @@
import EmptyPlaceholder from 'components/common/EmptyPlaceholder';
import Link from 'next/link';
import { Button, Text, Icon, Icons } from 'react-basics';
import SettingsTable from 'components/common/SettingsTable';
@ -13,10 +14,12 @@ export function WebsitesTable({
onPageSizeChange,
showTeam,
}) {
const { formatMessage, labels } = useMessages();
const { formatMessage, labels, messages } = useMessages();
const { openExternal } = useConfig();
const { user } = useUser();
const showTable = data && (filterValue || data?.data.length !== 0);
const teamColumns = [
{ name: 'teamName', label: formatMessage(labels.teamName) },
{ name: 'owner', label: formatMessage(labels.owner) },
@ -30,6 +33,8 @@ export function WebsitesTable({
];
return (
<>
{showTable && (
<SettingsTable
columns={columns}
data={data}
@ -75,6 +80,9 @@ export function WebsitesTable({
);
}}
</SettingsTable>
)}
{!showTable && <EmptyPlaceholder message={formatMessage(messages.noDataAvailable)} />}
</>
);
}