umami/src/app/(main)/reports/ReportsDataTable.tsx

27 lines
617 B
TypeScript
Raw Normal View History

2023-12-03 11:07:03 +00:00
import { useReports } from 'components/hooks';
2023-10-08 01:55:14 +00:00
import ReportsTable from './ReportsTable';
import DataTable from 'components/common/DataTable';
2024-05-08 06:09:19 +00:00
import { ReactNode } from 'react';
2023-10-08 01:55:14 +00:00
2024-01-30 08:10:25 +00:00
export default function ReportsDataTable({
websiteId,
teamId,
2024-05-08 06:09:19 +00:00
children,
2024-01-30 08:10:25 +00:00
}: {
websiteId?: string;
teamId?: string;
2024-05-08 06:09:19 +00:00
children?: ReactNode;
2024-01-30 08:10:25 +00:00
}) {
const queryResult = useReports({ websiteId, teamId });
2023-10-08 01:55:14 +00:00
2024-05-08 06:09:19 +00:00
if (queryResult?.result?.data?.length === 0) {
return children;
}
2023-10-08 01:55:14 +00:00
return (
<DataTable queryResult={queryResult}>
2023-10-15 04:59:54 +00:00
{({ data }) => <ReportsTable data={data} showDomain={!websiteId} />}
2023-10-08 01:55:14 +00:00
</DataTable>
);
}