From 7d36418e0f4b22c9b163f8e9109cd2645a533cdc Mon Sep 17 00:00:00 2001 From: gregfromstl Date: Sat, 2 Nov 2024 02:23:26 +0000 Subject: [PATCH] [Dashboard] Fix: MAU date range (#5271) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes CNCT-2185 --- ## PR-Codex overview This PR focuses on updating the date range for fetching in-app wallet usage statistics from the start of the current month to the last 30 days, improving the relevance of the data displayed. ### Detailed summary - In `layout.tsx`: - Changed `from` date in `getInAppWalletUsage` from the start of the current month to 30 days ago using `subDays`. - In `header.tsx`: - Updated `from` date in `getInAppWalletUsage` similarly to 30 days ago with `subDays`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .../dashboard/connect/in-app-wallets/[clientId]/layout.tsx | 3 ++- .../connect/in-app-wallets/_components/header.tsx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/dashboard/src/app/(dashboard)/dashboard/connect/in-app-wallets/[clientId]/layout.tsx b/apps/dashboard/src/app/(dashboard)/dashboard/connect/in-app-wallets/[clientId]/layout.tsx index f5ffc9e7bd7..f0b3091f199 100644 --- a/apps/dashboard/src/app/(dashboard)/dashboard/connect/in-app-wallets/[clientId]/layout.tsx +++ b/apps/dashboard/src/app/(dashboard)/dashboard/connect/in-app-wallets/[clientId]/layout.tsx @@ -1,5 +1,6 @@ import { InAppWalletsSummary } from "components/embedded-wallets/Analytics/Summary"; import { getInAppWalletUsage } from "data/analytics/wallets/in-app"; +import { subDays } from "date-fns"; import { redirect } from "next/navigation"; import { getAuthToken } from "../../../../../api/lib/getAuthToken"; import { InAppWaletFooterSection } from "../../../../../team/[team_slug]/[project_slug]/connect/in-app-wallets/_components/footer"; @@ -42,7 +43,7 @@ export default async function Page(props: { const monthlyStatsPromise = getInAppWalletUsage({ clientId, - from: new Date(new Date().getFullYear(), new Date().getMonth(), 1), + from: subDays(new Date(), 30), to: new Date(), period: "month", }); diff --git a/apps/dashboard/src/app/team/[team_slug]/[project_slug]/connect/in-app-wallets/_components/header.tsx b/apps/dashboard/src/app/team/[team_slug]/[project_slug]/connect/in-app-wallets/_components/header.tsx index 3e2dec32c39..93e6613d68f 100644 --- a/apps/dashboard/src/app/team/[team_slug]/[project_slug]/connect/in-app-wallets/_components/header.tsx +++ b/apps/dashboard/src/app/team/[team_slug]/[project_slug]/connect/in-app-wallets/_components/header.tsx @@ -1,6 +1,7 @@ import { TrackedLinkTW } from "@/components/ui/tracked-link"; import { InAppWalletsSummary } from "components/embedded-wallets/Analytics/Summary"; import { getInAppWalletUsage } from "data/analytics/wallets/in-app"; +import { subDays } from "date-fns"; import { TRACKING_CATEGORY } from "../_constants"; export async function InAppWalletsHeader({ clientId }: { clientId: string }) { @@ -13,7 +14,7 @@ export async function InAppWalletsHeader({ clientId }: { clientId: string }) { const monthlyStatsPromise = getInAppWalletUsage({ clientId, - from: new Date(new Date().getFullYear(), new Date().getMonth(), 1), + from: subDays(new Date(), 30), to: new Date(), period: "month", });