feat: admin monthly active users metric (#1724)

This commit is contained in:
Ephraim Duncan
2025-06-19 05:12:17 +00:00
committed by GitHub
parent 1be0e2842c
commit 2345de679b
4 changed files with 132 additions and 6 deletions

View File

@ -18,12 +18,14 @@ import {
import { getDocumentStats } from '@documenso/lib/server-only/admin/get-documents-stats';
import { getRecipientsStats } from '@documenso/lib/server-only/admin/get-recipients-stats';
import {
getMonthlyActiveUsers,
getOrganisationsWithSubscriptionsCount,
getUserWithSignedDocumentMonthlyGrowth,
getUsersCount,
} from '@documenso/lib/server-only/admin/get-users-stats';
import { getSignerConversionMonthly } from '@documenso/lib/server-only/user/get-signer-conversion';
import { MonthlyActiveUsersChart } from '~/components/general/admin-monthly-active-user-charts';
import { AdminStatsSignerConversionChart } from '~/components/general/admin-stats-signer-conversion-chart';
import { AdminStatsUsersWithDocumentsChart } from '~/components/general/admin-stats-users-with-documents';
import { CardMetric } from '~/components/general/metric-card';
@ -39,6 +41,7 @@ export async function loader() {
recipientStats,
signerConversionMonthly,
monthlyUsersWithDocuments,
monthlyActiveUsers,
] = await Promise.all([
getUsersCount(),
getOrganisationsWithSubscriptionsCount(),
@ -46,6 +49,7 @@ export async function loader() {
getRecipientsStats(),
getSignerConversionMonthly(),
getUserWithSignedDocumentMonthlyGrowth(),
getMonthlyActiveUsers(),
]);
return {
@ -55,6 +59,7 @@ export async function loader() {
recipientStats,
signerConversionMonthly,
monthlyUsersWithDocuments,
monthlyActiveUsers,
};
}
@ -68,6 +73,7 @@ export default function AdminStatsPage({ loaderData }: Route.ComponentProps) {
recipientStats,
signerConversionMonthly,
monthlyUsersWithDocuments,
monthlyActiveUsers,
} = loaderData;
return (
@ -144,6 +150,14 @@ export default function AdminStatsPage({ loaderData }: Route.ComponentProps) {
<Trans>Charts</Trans>
</h3>
<div className="mt-5 grid grid-cols-2 gap-8">
<MonthlyActiveUsersChart title={_(msg`MAU (signed in)`)} data={monthlyActiveUsers} />
<MonthlyActiveUsersChart
title={_(msg`Cumulative MAU (signed in)`)}
data={monthlyActiveUsers}
cummulative
/>
<AdminStatsUsersWithDocumentsChart
data={monthlyUsersWithDocuments}
title={_(msg`MAU (created document)`)}