diff --git a/apps/web/src/app/(dashboard)/admin/stats/monthly-active-users-chart.tsx b/apps/web/src/app/(dashboard)/admin/stats/monthly-active-users-chart.tsx index 512463c31..048d9599c 100644 --- a/apps/web/src/app/(dashboard)/admin/stats/monthly-active-users-chart.tsx +++ b/apps/web/src/app/(dashboard)/admin/stats/monthly-active-users-chart.tsx @@ -1,7 +1,9 @@ 'use client'; import { DateTime } from 'luxon'; +import type { TooltipProps } from 'recharts'; import { Bar, BarChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts'; +import type { NameType, ValueType } from 'recharts/types/component/DefaultTooltipContent'; import type { GetMonthlyActiveUsersResult } from '@documenso/lib/server-only/admin/get-users-stats'; @@ -12,6 +14,22 @@ export type MonthlyActiveUsersChartProps = { data: GetMonthlyActiveUsersResult; }; +const CustomTooltip = ({ active, payload, label }: TooltipProps) => { + if (active && payload && payload.length) { + return ( +
+

{label}

+

+ {payload[0].name === 'cume_count' ? 'Cumulative MAU' : 'Monthly Active Users'}:{' '} + {Number(payload[0].value).toLocaleString('en-US')} +

+
+ ); + } + + return null; +}; + export const MonthlyActiveUsersChart = ({ className, data, @@ -38,16 +56,7 @@ export const MonthlyActiveUsersChart = ({ - [ - Number(value).toLocaleString('en-US'), - cummulative ? 'Cumulative MAU' : 'Monthly Active Users', - ]} - cursor={{ fill: 'hsl(var(--primary) / 10%)' }} - /> + } cursor={{ fill: 'hsl(var(--primary) / 10%)' }} /> & { tooltip?: string }) => { if (active && payload && payload.length) { return ( -
+

{label}

{`${tooltip} : `}