fix(web): dashboard reminders card uses X/Y; hide /accounts duplicate H1
Dashboard: * "Active reminders" card retitled to "Reminders" and now shows active / total in the same X / Y format as the Accounts card (mirroring 2 / 3 connected / total). Accounts list: * The page-level <h1>Accounts</h1> is now hidden on mobile (the top bar already shows it), matching the Dashboard pattern. The "Add Account" button still shows on every breakpoint. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f50a1fc0a7
commit
f96eea8e93
@ -168,11 +168,11 @@ export default async function DashboardPage() {
|
|||||||
href="/accounts"
|
href="/accounts"
|
||||||
/>
|
/>
|
||||||
<StatCard
|
<StatCard
|
||||||
title="Active reminders"
|
title="Reminders"
|
||||||
value={stats.activeReminders}
|
value={`${stats.activeReminders} / ${stats.totalReminders}`}
|
||||||
icon={BellIcon}
|
icon={BellIcon}
|
||||||
description="Scheduled & running"
|
description="Active / total"
|
||||||
href="/reminders?filter=active"
|
href="/reminders"
|
||||||
/>
|
/>
|
||||||
<StatCard
|
<StatCard
|
||||||
title="Recent runs"
|
title="Recent runs"
|
||||||
|
|||||||
@ -30,8 +30,9 @@ interface AccountsListViewProps {
|
|||||||
export function AccountsListView({ accounts }: AccountsListViewProps) {
|
export function AccountsListView({ accounts }: AccountsListViewProps) {
|
||||||
return (
|
return (
|
||||||
<div className="px-4 py-6 sm:px-6 sm:py-8 max-w-5xl mx-auto space-y-6">
|
<div className="px-4 py-6 sm:px-6 sm:py-8 max-w-5xl mx-auto space-y-6">
|
||||||
<div className="flex items-center justify-between gap-4">
|
<div className="flex items-center justify-end sm:justify-between gap-4">
|
||||||
<h1 className="text-2xl font-semibold tracking-tight">Accounts</h1>
|
{/* Hidden on mobile — the top header already shows "Accounts". */}
|
||||||
|
<h1 className="hidden sm:block text-2xl font-semibold tracking-tight">Accounts</h1>
|
||||||
<Button asChild size="sm">
|
<Button asChild size="sm">
|
||||||
{/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}
|
{/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}
|
||||||
<Link href={"/accounts/new" as any}>
|
<Link href={"/accounts/new" as any}>
|
||||||
|
|||||||
@ -6,9 +6,9 @@ export async function getDashboardStats(operatorId: string) {
|
|||||||
const accounts = await db.query.whatsappAccounts.findMany({
|
const accounts = await db.query.whatsappAccounts.findMany({
|
||||||
where: (a, { eq }) => eq(a.operatorId, operatorId),
|
where: (a, { eq }) => eq(a.operatorId, operatorId),
|
||||||
});
|
});
|
||||||
const reminders = await db.query.reminders.findMany({
|
// All reminder rows so the dashboard can show active/total in one query.
|
||||||
where: (_, { sql: s }) => s`status = 'active'`,
|
// 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
|
// LEFT JOIN so runs whose reminder has been deleted still appear. The
|
||||||
// ownership filter widens to: either the reminder still exists and 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
|
// operator owns its account, OR the reminder is gone but the run row
|
||||||
@ -31,7 +31,8 @@ export async function getDashboardStats(operatorId: string) {
|
|||||||
return {
|
return {
|
||||||
connectedAccounts: accounts.filter((a) => a.status === "connected").length,
|
connectedAccounts: accounts.filter((a) => a.status === "connected").length,
|
||||||
totalAccounts: accounts.length,
|
totalAccounts: accounts.length,
|
||||||
activeReminders: reminders.length,
|
activeReminders: allReminders.filter((r) => r.status === "active").length,
|
||||||
|
totalReminders: allReminders.length,
|
||||||
recentRuns: recentRuns.rows as Array<{
|
recentRuns: recentRuns.rows as Array<{
|
||||||
id: string;
|
id: string;
|
||||||
status: string;
|
status: string;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user