1"use client";
2
3
12import { useCallback } from "react";
13import { Activity } from "lucide-react";
14import { meApi } from "@/lib/api";
15import { ActivityFeed } from "@/components/activity/activity-feed";
16import type { ActivityRow } from "@/lib/types";
17
18export default function MyActivityPage() {
19 const fetchPage = useCallback(
20 (cursor?: string) => meApi.myActivity({ cursor, limit: 30 }),
21 []
22 );
23
24
25
26
27 const hrefFor = useCallback((row: ActivityRow): string | null => {
28 const ws = row.workspaceId;
29 if (!ws) return null;
30 if (row.pageId) return `/w/${ws}/page/${row.pageId}`;
31 if (row.resourceType === "database") return `/w/${ws}/databases/${row.resourceId}`;
32 return null;
33 }, []);
34
35 return (
36 <div className="mx-auto max-w-2xl px-6 py-8">
37 <div className="mb-5 flex items-center gap-2">
38 <Activity className="size-5 text-muted-foreground" aria-hidden />
39 <h1 className="text-xl font-semibold">My activity</h1>
40 </div>
41 <p className="mb-4 text-sm text-muted-foreground">
42 What you did, across your workspaces.
43 </p>
44 <ActivityFeed
45 fetchPage={fetchPage}
46 hrefFor={hrefFor}
47 emptyMessage="No activity yet — edit a page or comment to see it here."
48 />
49 </div>
50 );
51}
52