diff --git a/apps/web/src/app/page.tsx b/apps/web/src/app/page.tsx index 5e72b2a..b6cc2fd 100644 --- a/apps/web/src/app/page.tsx +++ b/apps/web/src/app/page.tsx @@ -168,11 +168,11 @@ export default async function DashboardPage() { href="/accounts" /> - - Accounts + + {/* Hidden on mobile — the top header already shows "Accounts". */} + Accounts {/* eslint-disable-next-line @typescript-eslint/no-explicit-any */} diff --git a/apps/web/src/lib/queries.ts b/apps/web/src/lib/queries.ts index ddd6cd3..6e80e6f 100644 --- a/apps/web/src/lib/queries.ts +++ b/apps/web/src/lib/queries.ts @@ -6,9 +6,9 @@ export async function getDashboardStats(operatorId: string) { const accounts = await db.query.whatsappAccounts.findMany({ where: (a, { eq }) => eq(a.operatorId, operatorId), }); - const reminders = await db.query.reminders.findMany({ - where: (_, { sql: s }) => s`status = 'active'`, - }); + // All reminder rows so the dashboard can show active/total in one query. + // Status enum today is active / ended (paused will join in a later phase). + const allReminders = await db.query.reminders.findMany(); // LEFT JOIN so runs whose reminder has been deleted still appear. The // ownership filter widens to: either the reminder still exists and the // operator owns its account, OR the reminder is gone but the run row @@ -31,7 +31,8 @@ export async function getDashboardStats(operatorId: string) { return { connectedAccounts: accounts.filter((a) => a.status === "connected").length, totalAccounts: accounts.length, - activeReminders: reminders.length, + activeReminders: allReminders.filter((r) => r.status === "active").length, + totalReminders: allReminders.length, recentRuns: recentRuns.rows as Array<{ id: string; status: string;