+ {/* Search */}
+
+
+ Search Consent Records
+
+
+ setSearch(e.target.value)}
+ onKeyDown={(e) => e.key === 'Enter' && handleSearch()}
+ />
+
+ {activeSearch && (
+
+ )}
+
+ {activeSearch && (
+
+ Showing results for visitor: {activeSearch}
+
+ )}
+
+
+ {/* Results */}
+ {isLoading ? (
+
+ ) : !data || data.items.length === 0 ? (
+
+ {activeSearch
+ ? 'No consent records found for this visitor.'
+ : 'No consent records yet.'}
+
+ ) : (
+ <>
+
+ {data.total} record{data.total !== 1 ? 's' : ''}
+ Page {page} of {totalPages}
+
+
+
+
+
+ | Visitor |
+ Action |
+ Categories |
+ Date |
+ |
+
+
+
+ {data.items.map((record) => (
+ <>
+ setExpandedId(expandedId === record.id ? null : record.id)}
+ >
+ |
+ {record.visitor_id.length > 16
+ ? record.visitor_id.slice(0, 8) + '…' + record.visitor_id.slice(-8)
+ : record.visitor_id}
+ |
+
+
+ {actionLabel(record.action)}
+
+ |
+
+ {record.categories_accepted.join(', ')}
+ |
+
+ {new Date(record.consented_at).toLocaleString()}
+ |
+
+ {expandedId === record.id ? '▲' : '▼'}
+ |
+
+ {expandedId === record.id && (
+
+ )}
+ >
+ ))}
+
+
+
+
+ {/* Pagination */}
+ {totalPages > 1 && (
+
+
+
+ {page} / {totalPages}
+
+
+
+ )}
+ >
+ )}
+
+ );
+}
diff --git a/apps/admin-ui/src/components/SiteOverviewTab.tsx b/apps/admin-ui/src/components/SiteOverviewTab.tsx
index ac64338..86d63f8 100644
--- a/apps/admin-ui/src/components/SiteOverviewTab.tsx
+++ b/apps/admin-ui/src/components/SiteOverviewTab.tsx
@@ -1,3 +1,5 @@
+import { useState } from 'react';
+
import { Card } from './ui/card';
import { MetricCard } from './ui/metric-card';
import type { Site, SiteConfig } from '../types/api';
@@ -8,7 +10,8 @@ interface Props {
}
export default function SiteOverviewTab({ site, config }: Props) {
- const scriptTag = ``;
+ const scriptTag = ``;
+ const [copied, setCopied] = useState(false);
return (
@@ -36,17 +39,38 @@ export default function SiteOverviewTab({ site, config }: Props) {
Add this script tag to the {'
'} of your website, before any other scripts.
-
-
- {scriptTag}
-
+
+
+ Must be the first {'