diff --git a/src/app/(main)/reports/ReportsDataTable.tsx b/src/app/(main)/reports/ReportsDataTable.tsx index cf5953e8..7c99fb25 100644 --- a/src/app/(main)/reports/ReportsDataTable.tsx +++ b/src/app/(main)/reports/ReportsDataTable.tsx @@ -1,16 +1,23 @@ import { useReports } from 'components/hooks'; import ReportsTable from './ReportsTable'; import DataTable from 'components/common/DataTable'; +import { ReactNode } from 'react'; export default function ReportsDataTable({ websiteId, teamId, + children, }: { websiteId?: string; teamId?: string; + children?: ReactNode; }) { const queryResult = useReports({ websiteId, teamId }); + if (queryResult?.result?.data?.length === 0) { + return children; + } + return ( {({ data }) => } diff --git a/src/app/(main)/settings/teams/TeamsDataTable.tsx b/src/app/(main)/settings/teams/TeamsDataTable.tsx index fe92b6a0..6baeba33 100644 --- a/src/app/(main)/settings/teams/TeamsDataTable.tsx +++ b/src/app/(main)/settings/teams/TeamsDataTable.tsx @@ -1,17 +1,24 @@ import DataTable from 'components/common/DataTable'; import TeamsTable from 'app/(main)/settings/teams/TeamsTable'; import { useLogin, useTeams } from 'components/hooks'; +import { ReactNode } from 'react'; export function TeamsDataTable({ allowEdit, showActions, + children, }: { allowEdit?: boolean; showActions?: boolean; + children?: ReactNode; }) { const { user } = useLogin(); const queryResult = useTeams(user.id); + if (queryResult?.result?.data?.length === 0) { + return children; + } + return ( {({ data }) => { diff --git a/src/app/(main)/settings/users/UsersDataTable.tsx b/src/app/(main)/settings/users/UsersDataTable.tsx index cfff4e71..681b4dc2 100644 --- a/src/app/(main)/settings/users/UsersDataTable.tsx +++ b/src/app/(main)/settings/users/UsersDataTable.tsx @@ -1,10 +1,21 @@ import DataTable from 'components/common/DataTable'; import { useUsers } from 'components/hooks'; import UsersTable from './UsersTable'; +import { ReactNode } from 'react'; -export function UsersDataTable({ showActions }: { showActions?: boolean }) { +export function UsersDataTable({ + showActions, + children, +}: { + showActions?: boolean; + children?: ReactNode; +}) { const queryResult = useUsers(); + if (queryResult?.result?.data?.length === 0) { + return children; + } + return ( {({ data }) => } diff --git a/src/app/(main)/settings/websites/WebsitesDataTable.tsx b/src/app/(main)/settings/websites/WebsitesDataTable.tsx index b3472942..1780dfb4 100644 --- a/src/app/(main)/settings/websites/WebsitesDataTable.tsx +++ b/src/app/(main)/settings/websites/WebsitesDataTable.tsx @@ -18,7 +18,7 @@ export function WebsitesDataTable({ }) { const queryResult = useWebsites({ teamId }); - if (!queryResult?.result?.data?.length) { + if (queryResult?.result?.data?.length === 0) { return children; }