umami/src/app/(main)/settings/websites/WebsitesDataTable.tsx

43 lines
977 B
TypeScript
Raw Normal View History

2023-09-29 12:29:22 +00:00
'use client';
2024-01-29 02:33:40 +00:00
import { ReactNode } from 'react';
2023-10-03 23:05:17 +00:00
import WebsitesTable from 'app/(main)/settings/websites/WebsitesTable';
2023-09-29 12:29:22 +00:00
import DataTable from 'components/common/DataTable';
2024-01-29 02:33:40 +00:00
import useWebsites from 'components/hooks/queries/useWebsites';
2023-09-29 12:29:22 +00:00
2023-10-08 05:42:49 +00:00
export interface WebsitesDataTableProps {
2024-01-29 02:33:40 +00:00
userId?: string;
teamId?: string;
2023-10-08 05:42:49 +00:00
allowEdit?: boolean;
allowView?: boolean;
showActions?: boolean;
children?: ReactNode;
}
2023-12-06 03:22:14 +00:00
export function WebsitesDataTable({
userId,
2024-01-29 02:33:40 +00:00
teamId,
2023-12-06 03:22:14 +00:00
allowEdit = true,
allowView = true,
showActions = true,
children,
}: WebsitesDataTableProps) {
2024-01-29 02:33:40 +00:00
const queryResult = useWebsites({ userId, teamId });
2023-09-29 12:29:22 +00:00
return (
2023-10-08 01:55:14 +00:00
<DataTable queryResult={queryResult}>
{({ data }) => (
<WebsitesTable
data={data}
showActions={showActions}
allowEdit={allowEdit}
allowView={allowView}
>
{children}
</WebsitesTable>
)}
</DataTable>
2023-09-29 12:29:22 +00:00
);
}
2023-10-04 08:46:00 +00:00
export default WebsitesDataTable;