aboutsummaryrefslogtreecommitdiff
path: root/src/app/(main)/websites/WebsitesDataTable.tsx
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-01-24 13:09:50 +0000
committerFuwn <[email protected]>2026-01-24 13:09:50 +0000
commit396acf3bbbe00a192cb0ea0a9ccf91b1d8d2850b (patch)
treeb9df4ca6a70db45cfffbae6fdd7252e20fb8e93c /src/app/(main)/websites/WebsitesDataTable.tsx
downloadumami-main.tar.xz
umami-main.zip
Initial commitHEADmain
Created from https://vercel.com/new
Diffstat (limited to 'src/app/(main)/websites/WebsitesDataTable.tsx')
-rw-r--r--src/app/(main)/websites/WebsitesDataTable.tsx47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/app/(main)/websites/WebsitesDataTable.tsx b/src/app/(main)/websites/WebsitesDataTable.tsx
new file mode 100644
index 0000000..3f0a6b9
--- /dev/null
+++ b/src/app/(main)/websites/WebsitesDataTable.tsx
@@ -0,0 +1,47 @@
+import Link from 'next/link';
+import { DataGrid } from '@/components/common/DataGrid';
+import { useLoginQuery, useNavigation, useUserWebsitesQuery } from '@/components/hooks';
+import { Favicon } from '@/index';
+import { Icon, Row } from '@umami/react-zen';
+import { WebsitesTable } from './WebsitesTable';
+
+export function WebsitesDataTable({
+ userId,
+ teamId,
+ allowEdit = true,
+ allowView = true,
+ showActions = true,
+}: {
+ userId?: string;
+ teamId?: string;
+ allowEdit?: boolean;
+ allowView?: boolean;
+ showActions?: boolean;
+}) {
+ const { user } = useLoginQuery();
+ const queryResult = useUserWebsitesQuery({ userId: userId || user?.id, teamId });
+ const { renderUrl } = useNavigation();
+
+ const renderLink = (row: any) => (
+ <Row alignItems="center" gap="3">
+ <Icon size="md" color="muted">
+ <Favicon domain={row.domain} />
+ </Icon>
+ <Link href={renderUrl(`/websites/${row.id}`, false)}>{row.name}</Link>
+ </Row>
+ );
+
+ return (
+ <DataGrid query={queryResult} allowSearch allowPaging>
+ {({ data }) => (
+ <WebsitesTable
+ data={data}
+ showActions={showActions}
+ allowEdit={allowEdit}
+ allowView={allowView}
+ renderLink={renderLink}
+ />
+ )}
+ </DataGrid>
+ );
+}