import { desc, eq } from "drizzle-orm"; import { z } from "zod"; import { db } from "@/lib/db"; import { getCurrentSession } from "@/lib/session"; import type { ActivityLogEntry, ModuleManifest } from "./module"; import { getEntityType } from "./registry"; import { activityLog } from "./schema"; const activityConfigSchema = z.object({ limit: z.number().int().min(1).max(50).optional(), }); async function ActivityWidget({ config }: { config: unknown }) { const parsed = activityConfigSchema.parse(config); const { household } = await getCurrentSession(); const entries = await db .select() .from(activityLog) .where(eq(activityLog.householdId, household.id)) .orderBy(desc(activityLog.createdAt)) .limit(parsed.limit ?? 20); if (entries.length === 0) { return
No recent activity
; } return (