diff --git a/app/(dashboard)/OverviewClient.tsx b/app/(dashboard)/OverviewClient.tsx index 8b21755a..66bcc862 100644 --- a/app/(dashboard)/OverviewClient.tsx +++ b/app/(dashboard)/OverviewClient.tsx @@ -56,12 +56,14 @@ export default function OverviewClient({ userName, stats, trafficSummary, - recentEvents + recentEvents, + isAdmin = true }: { userName: string; stats: StatCard[]; trafficSummary: TrafficSummary; recentEvents: RecentEvent[]; + isAdmin?: boolean; }) { return (
@@ -98,75 +100,79 @@ export default function OverviewClient({ ); })} - {/* Traffic (24h) card */} - - - -
-
- + {/* Traffic (24h) card — admin only */} + {isAdmin && ( + + + +
+
+ +
+ + {trafficSummary ? trafficSummary.totalRequests.toLocaleString() : "—"} +
- - {trafficSummary ? trafficSummary.totalRequests.toLocaleString() : "—"} - -
-

Traffic (24h)

- {trafficSummary && trafficSummary.totalRequests > 0 && ( -
-
- Blocked - 0 ? "text-rose-500" : "text-muted-foreground"}`}> - {trafficSummary.blockedPercent}% - +

Traffic (24h)

+ {trafficSummary && trafficSummary.totalRequests > 0 && ( +
+
+ Blocked + 0 ? "text-rose-500" : "text-muted-foreground"}`}> + {trafficSummary.blockedPercent}% + +
+
+
+
-
+ )} + + + + )} +
+ + {/* Recent Activity — admin only */} + {isAdmin && ( +
+
+
+ +
+

Recent Activity

+
+ + + + {recentEvents.length === 0 ? ( +

No activity recorded yet.

+ ) : ( +
+ {/* Vertical timeline line */} +
+ {recentEvents.map((event, index) => (
-
+ key={`${event.created_at}-${index}`} + className="relative flex items-start gap-4 px-5 py-3 hover:bg-muted/30 transition-colors" + > + {/* Dot */} +
+ {event.summary} + + {formatRelativeTime(event.created_at)} + +
+ ))}
)} - -
- - {/* Recent Activity */} -
-
-
- -
-

Recent Activity

- - - - {recentEvents.length === 0 ? ( -

No activity recorded yet.

- ) : ( -
- {/* Vertical timeline line */} -
- {recentEvents.map((event, index) => ( -
- {/* Dot */} -
- {event.summary} - - {formatRelativeTime(event.created_at)} - -
- ))} -
- )} - - -
+ )}
); } diff --git a/app/(dashboard)/page.tsx b/app/(dashboard)/page.tsx index 22ef1a50..98369ad4 100644 --- a/app/(dashboard)/page.tsx +++ b/app/(dashboard)/page.tsx @@ -54,6 +54,7 @@ export default async function OverviewPage() { stats={[]} trafficSummary={null} recentEvents={[]} + isAdmin={false} /> ); } @@ -78,6 +79,7 @@ export default async function OverviewPage() { userName={session.user.name ?? session.user.email ?? "Admin"} stats={stats} trafficSummary={trafficSummary} + isAdmin={true} recentEvents={recentEventsRaw.map((event) => ({ summary: event.summary ?? `${event.action} on ${event.entityType}`, created_at: toIso(event.createdAt)!