mirror of
https://github.com/documenso/documenso.git
synced 2025-11-10 04:22:32 +10:00
feat: add total signed documents
This commit is contained in:
@ -38,7 +38,7 @@ export const MonthlyCompletedDocumentsChart = ({
|
|||||||
labelStyle={{
|
labelStyle={{
|
||||||
color: 'hsl(var(--primary-foreground))',
|
color: 'hsl(var(--primary-foreground))',
|
||||||
}}
|
}}
|
||||||
formatter={(value) => [Number(value).toLocaleString('en-US'), 'Total Users']}
|
formatter={(value) => [Number(value).toLocaleString('en-US'), 'Completed Documents']}
|
||||||
cursor={{ fill: 'hsl(var(--primary) / 10%)' }}
|
cursor={{ fill: 'hsl(var(--primary) / 10%)' }}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ export const MonthlyCompletedDocumentsChart = ({
|
|||||||
fill="hsl(var(--primary))"
|
fill="hsl(var(--primary))"
|
||||||
radius={[4, 4, 0, 0]}
|
radius={[4, 4, 0, 0]}
|
||||||
maxBarSize={60}
|
maxBarSize={60}
|
||||||
label="Monthly Completed Documents"
|
label="Completed Documents"
|
||||||
/>
|
/>
|
||||||
</BarChart>
|
</BarChart>
|
||||||
</ResponsiveContainer>
|
</ResponsiveContainer>
|
||||||
|
|||||||
@ -6,8 +6,6 @@ import { getCompletedDocumentsMonthly } from '@documenso/lib/server-only/user/ge
|
|||||||
import { getUserMonthlyGrowth } from '@documenso/lib/server-only/user/get-user-monthly-growth';
|
import { getUserMonthlyGrowth } from '@documenso/lib/server-only/user/get-user-monthly-growth';
|
||||||
|
|
||||||
import { FUNDING_RAISED } from '~/app/(marketing)/open/data';
|
import { FUNDING_RAISED } from '~/app/(marketing)/open/data';
|
||||||
import { MetricCard } from '~/app/(marketing)/open/metric-card';
|
|
||||||
import { SalaryBands } from '~/app/(marketing)/open/salary-bands';
|
|
||||||
import { CallToAction } from '~/components/(marketing)/call-to-action';
|
import { CallToAction } from '~/components/(marketing)/call-to-action';
|
||||||
|
|
||||||
import { BarMetric } from './bar-metrics';
|
import { BarMetric } from './bar-metrics';
|
||||||
@ -16,8 +14,10 @@ import { FundingRaised } from './funding-raised';
|
|||||||
import { MonthlyCompletedDocumentsChart } from './monthly-completed-documents-chart';
|
import { MonthlyCompletedDocumentsChart } from './monthly-completed-documents-chart';
|
||||||
import { MonthlyNewUsersChart } from './monthly-new-users-chart';
|
import { MonthlyNewUsersChart } from './monthly-new-users-chart';
|
||||||
import { MonthlyTotalUsersChart } from './monthly-total-users-chart';
|
import { MonthlyTotalUsersChart } from './monthly-total-users-chart';
|
||||||
|
import { SalaryBands } from './salary-bands';
|
||||||
import { TeamMembers } from './team-members';
|
import { TeamMembers } from './team-members';
|
||||||
import { OpenPageTooltip } from './tooltip';
|
import { OpenPageTooltip } from './tooltip';
|
||||||
|
import { TotalSignedDocumentsChart } from './total-signed-documents-chart';
|
||||||
import { Typefully } from './typefully';
|
import { Typefully } from './typefully';
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
@ -128,17 +128,17 @@ const fetchEarlyAdopters = async () => {
|
|||||||
|
|
||||||
export default async function OpenPage() {
|
export default async function OpenPage() {
|
||||||
const [
|
const [
|
||||||
{ forks_count: forksCount, stargazers_count: stargazersCount },
|
// { forks_count: forksCount, stargazers_count: stargazersCount },
|
||||||
{ total_count: openIssues },
|
// { total_count: openIssues },
|
||||||
{ total_count: mergedPullRequests },
|
// { total_count: mergedPullRequests },
|
||||||
STARGAZERS_DATA,
|
STARGAZERS_DATA,
|
||||||
EARLY_ADOPTERS_DATA,
|
EARLY_ADOPTERS_DATA,
|
||||||
MONTHLY_USERS,
|
MONTHLY_USERS,
|
||||||
MONTHLY_COMPLETED_DOCUMENTS,
|
MONTHLY_COMPLETED_DOCUMENTS,
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
fetchGithubStats(),
|
// fetchGithubStats(),
|
||||||
fetchOpenIssues(),
|
// fetchOpenIssues(),
|
||||||
fetchMergedPullRequests(),
|
// fetchMergedPullRequests(),
|
||||||
fetchStargazers(),
|
fetchStargazers(),
|
||||||
fetchEarlyAdopters(),
|
fetchEarlyAdopters(),
|
||||||
getUserMonthlyGrowth(),
|
getUserMonthlyGrowth(),
|
||||||
@ -166,7 +166,7 @@ export default async function OpenPage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="my-12 grid grid-cols-12 gap-8">
|
<div className="my-12 grid grid-cols-12 gap-8">
|
||||||
<div className="col-span-12 grid grid-cols-4 gap-4">
|
{/* <div className="col-span-12 grid grid-cols-4 gap-4">
|
||||||
<MetricCard
|
<MetricCard
|
||||||
className="col-span-2 lg:col-span-1"
|
className="col-span-2 lg:col-span-1"
|
||||||
title="Stargazers"
|
title="Stargazers"
|
||||||
@ -187,7 +187,7 @@ export default async function OpenPage() {
|
|||||||
title="Merged PR's"
|
title="Merged PR's"
|
||||||
value={mergedPullRequests.toLocaleString('en-US')}
|
value={mergedPullRequests.toLocaleString('en-US')}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div> */}
|
||||||
|
|
||||||
<TeamMembers className="col-span-12" />
|
<TeamMembers className="col-span-12" />
|
||||||
|
|
||||||
@ -259,6 +259,10 @@ export default async function OpenPage() {
|
|||||||
data={MONTHLY_COMPLETED_DOCUMENTS}
|
data={MONTHLY_COMPLETED_DOCUMENTS}
|
||||||
className="col-span-12 lg:col-span-6"
|
className="col-span-12 lg:col-span-6"
|
||||||
/>
|
/>
|
||||||
|
<TotalSignedDocumentsChart
|
||||||
|
data={MONTHLY_COMPLETED_DOCUMENTS}
|
||||||
|
className="col-span-12 lg:col-span-6"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,54 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { DateTime } from 'luxon';
|
||||||
|
import { Bar, BarChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts';
|
||||||
|
|
||||||
|
import type { GetUserMonthlyGrowthResult } from '@documenso/lib/server-only/user/get-user-monthly-growth';
|
||||||
|
import { cn } from '@documenso/ui/lib/utils';
|
||||||
|
|
||||||
|
export type TotalSignedDocumentsChartProps = {
|
||||||
|
className?: string;
|
||||||
|
data: GetUserMonthlyGrowthResult;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const TotalSignedDocumentsChart = ({ className, data }: TotalSignedDocumentsChartProps) => {
|
||||||
|
const formattedData = [...data].reverse().map(({ month, cume_count: count }) => {
|
||||||
|
return {
|
||||||
|
month: DateTime.fromFormat(month, 'yyyy-MM').toFormat('LLLL'),
|
||||||
|
count: Number(count),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={cn('flex flex-col', className)}>
|
||||||
|
<div className="flex items-center px-4">
|
||||||
|
<h3 className="text-lg font-semibold">Total Signed Documents</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="border-border mt-2.5 flex flex-1 items-center justify-center rounded-2xl border p-6 pl-2 pt-12 shadow-sm hover:shadow">
|
||||||
|
<ResponsiveContainer width="100%" height={400}>
|
||||||
|
<BarChart data={formattedData}>
|
||||||
|
<XAxis dataKey="month" />
|
||||||
|
<YAxis />
|
||||||
|
|
||||||
|
<Tooltip
|
||||||
|
labelStyle={{
|
||||||
|
color: 'hsl(var(--primary-foreground))',
|
||||||
|
}}
|
||||||
|
formatter={(value) => [Number(value).toLocaleString('en-US'), 'Signed Documents']}
|
||||||
|
cursor={{ fill: 'hsl(var(--primary) / 10%)' }}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Bar
|
||||||
|
dataKey="count"
|
||||||
|
fill="hsl(var(--primary))"
|
||||||
|
radius={[4, 4, 0, 0]}
|
||||||
|
maxBarSize={60}
|
||||||
|
label="Signed Documents"
|
||||||
|
/>
|
||||||
|
</BarChart>
|
||||||
|
</ResponsiveContainer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user