refactor: metrics into reusable component

This commit is contained in:
Ephraim Atta-Duncan
2023-09-22 14:08:25 +00:00
committed by Mythie
parent 7659c51980
commit 0a035f8b60
4 changed files with 22 additions and 84 deletions

View File

@ -1,12 +1,12 @@
import { z } from 'zod';
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 { BarMetric } from './bar-metrics';
import { CapTable } from './cap-table';
import { EarlyAdopterMetrics } from './early-adopter-metrics';
import { FundingRaised } from './funding-raised';
import { GithubMetric } from './gh-metrics';
import { TeamMembers } from './team-members';
export const revalidate = 3600;
@ -41,8 +41,6 @@ const ZEarlyAdoptersResponse = z.record(
export type StargazersType = z.infer<typeof ZStargazersLiveResponse>;
export type EarlyAdoptersType = z.infer<typeof ZEarlyAdoptersResponse>;
// const ZOpenPullRequestsResponse = ZMergedPullRequestsResponse;
export default async function OpenPage() {
const {
forks_count: forksCount,
@ -125,11 +123,11 @@ export default async function OpenPage() {
<SalaryBands className="col-span-12 lg:col-span-6" />
<FundingRaised className="col-span-12 lg:col-span-6" />
<FundingRaised data={FUNDING_RAISED} className="col-span-12 lg:col-span-6" />
<CapTable className="col-span-12 lg:col-span-6" />
<EarlyAdopterMetrics
<BarMetric<EarlyAdoptersType>
data={EARLY_ADOPTERS_DATA}
metricKey="earlyAdopters"
title="Early Adopters"
@ -137,7 +135,7 @@ export default async function OpenPage() {
className="col-span-12 lg:col-span-6"
/>
<GithubMetric
<BarMetric<StargazersType>
data={STARGAZERS_DATA}
metricKey="stars"
title="Github: Total Stars"
@ -145,7 +143,7 @@ export default async function OpenPage() {
className="col-span-12 lg:col-span-6"
/>
<GithubMetric
<BarMetric<StargazersType>
data={STARGAZERS_DATA}
metricKey="mergedPRs"
title="Github: Total Merged PRs"
@ -153,7 +151,8 @@ export default async function OpenPage() {
chartHeight={300}
className="col-span-12 lg:col-span-6"
/>
<GithubMetric
<BarMetric<StargazersType>
data={STARGAZERS_DATA}
metricKey="forks"
title="Github: Total Forks"
@ -161,7 +160,8 @@ export default async function OpenPage() {
chartHeight={300}
className="col-span-12 lg:col-span-6"
/>
<GithubMetric
<BarMetric<StargazersType>
data={STARGAZERS_DATA}
metricKey="openIssues"
title="Github: Total Open Issues"