Files
umami/src/app/(main)/settings/websites/WebsitesDataTable.tsx
2024-05-07 22:47:39 -07:00

41 lines
897 B
TypeScript

import { ReactNode } from 'react';
import WebsitesTable from 'app/(main)/settings/websites/WebsitesTable';
import DataTable from 'components/common/DataTable';
import { useWebsites } from 'components/hooks';
export function WebsitesDataTable({
teamId,
allowEdit = true,
allowView = true,
showActions = true,
children,
}: {
teamId?: string;
allowEdit?: boolean;
allowView?: boolean;
showActions?: boolean;
children?: ReactNode;
}) {
const queryResult = useWebsites({ teamId });
if (!queryResult?.result?.data?.length) {
return children;
}
return (
<DataTable queryResult={queryResult}>
{({ data }) => (
<WebsitesTable
teamId={teamId}
data={data}
showActions={showActions}
allowEdit={allowEdit}
allowView={allowView}
/>
)}
</DataTable>
);
}
export default WebsitesDataTable;