Skip to content

Commit 00a363e

Browse files
committed
feat: add txCount metric
1 parent 886c8be commit 00a363e

File tree

4 files changed

+35
-34
lines changed

4 files changed

+35
-34
lines changed

app/[locale]/enterprise/page.tsx

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import type { Case, EcosystemPlayer, Feature } from "./types"
5252
import { parseActivity } from "./utils"
5353

5454
import { fetchEthereumStablecoinsMcap } from "@/lib/api/fetchEthereumStablecoinsMcap"
55+
import { fetchGrowThePie } from "@/lib/api/fetchGrowThePie"
5556
import EthGlyph from "@/public/images/assets/svgs/eth-diamond-rainbow.svg"
5657
import heroImage from "@/public/images/heroes/enterprise-hero-white.png"
5758

@@ -67,7 +68,10 @@ const CasesSwiper = dynamic(() => import("./_components/CasesSwiper"), {
6768

6869
// TODO: Switch back to this for cache and mock-data dev fallback
6970
// const loadData = dataLoader(
70-
// [["ethereumStablecoinsResponse", fetchEthereumStablecoinsMcap]],
71+
// [
72+
// ["ethereumStablecoinsResponse", fetchEthereumStablecoinsMcap],
73+
// ["growThePieData", fetchGrowThePie],
74+
// ],
7175
// BASE_TIME_UNIT * 1000
7276
// )
7377

@@ -76,13 +80,14 @@ const Page = async ({ params }: { params: Promise<{ locale: Lang }> }) => {
7680

7781
const t = await getTranslations({ locale, namespace: "page-enterprise" })
7882

79-
// const [ethereumStablecoinsResponse] = await loadData()
80-
const ethereumStablecoinsResponse = await fetchEthereumStablecoinsMcap()
83+
// const [{ txCount }, ethereumStablecoinsResponse] = await loadData()
84+
const { txCount } = await fetchGrowThePie()
85+
const stablecoinMarketCap = await fetchEthereumStablecoinsMcap()
8186

8287
const metrics = await parseActivity(
8388
{
84-
// dailyTxCount,
85-
stablecoinMarketCap: ethereumStablecoinsResponse,
89+
txCount,
90+
stablecoinMarketCap,
8691
// totalCapitalSecured,
8792
},
8893
locale
@@ -161,9 +166,13 @@ const Page = async ({ params }: { params: Promise<{ locale: Lang }> }) => {
161166
),
162167
},
163168
{
164-
name: "TODO: New Item",
165-
content:
166-
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
169+
name: "Visa",
170+
content: (
171+
<>
172+
Settled over <strong>$225 million</strong> in stablecoin transactions
173+
using USDC across Ethereum and other blockchains.
174+
</>
175+
),
167176
},
168177
]
169178

@@ -281,19 +290,14 @@ const Page = async ({ params }: { params: Promise<{ locale: Lang }> }) => {
281290
metrics={metrics}
282291
locale={locale}
283292
className={cn(
293+
metrics.length < 2 && "hidden", // Minimum before displaying
284294
"w-fit max-w-xl shrink-0 gap-8 sm:max-md:grid-cols-2",
285295
"[&_[data-label='big-number']]:border-none [&_[data-label='big-number']]:p-0",
286296
"[&_[data-label='big-number']:nth-of-type(1)_[data-label='value']]:text-accent-a",
287297
"[&_[data-label='big-number']:nth-of-type(2)_[data-label='value']]:text-accent-b",
288298
"[&_[data-label='big-number']:nth-of-type(3)_[data-label='value']]:text-accent-c"
289299
)}
290300
/>
291-
292-
{/* <div className="TODO:METRICS flex max-w-[min(41rem,100%)] gap-6 md:ms-auto">
293-
<Skeleton className="h-32 w-64 rounded-2xl" />
294-
<Skeleton className="h-32 w-64 rounded-2xl" />
295-
<Skeleton className="h-32 w-64 rounded-2xl" />
296-
</div> */}
297301
</section>
298302

299303
<section id="features">

app/[locale]/enterprise/utils.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import type {
66
StatsBoxMetric,
77
} from "@/lib/types"
88

9-
import { /* formatLargeNumber, */ formatLargeUSD } from "@/lib/utils/numbers"
9+
import { formatLargeNumber, formatLargeUSD } from "@/lib/utils/numbers"
1010
import { getLocaleForNumberFormat } from "@/lib/utils/translations"
1111

1212
// Convert numerical value to formatted values
1313
export const parseActivity = async (
1414
{
15-
// dailyTxCount,
15+
txCount,
1616
stablecoinMarketCap,
1717
// totalCapitalSecured,
1818
}: AllEnterpriseActivityData,
@@ -22,13 +22,13 @@ export const parseActivity = async (
2222

2323
const localeForNumberFormat = getLocaleForNumberFormat(locale)
2424

25-
// const dailyTxCountFormatted =
26-
// "error" in dailyTxCount
27-
// ? { error: dailyTxCount.error }
28-
// : {
29-
// ...dailyTxCount,
30-
// value: formatLargeNumber(dailyTxCount.value, localeForNumberFormat),
31-
// }
25+
const txCountFormatted =
26+
"error" in txCount
27+
? { error: txCount.error }
28+
: {
29+
...txCount,
30+
value: formatLargeNumber(txCount.value, localeForNumberFormat),
31+
}
3232

3333
const stablecoinMarketCapFormatted =
3434
"error" in stablecoinMarketCap
@@ -53,13 +53,12 @@ export const parseActivity = async (
5353
// }
5454

5555
const metrics: StatsBoxMetric[] = [
56-
// {
57-
// // TODO
58-
// label: t("page-enterprise-activity-daily-tx"),
59-
// apiProvider: "TBD",
60-
// apiUrl: "https://www.TBD.com",
61-
// state: dailyTxCountFormatted,
62-
// },
56+
{
57+
label: t("page-enterprise-activity-tx-count"),
58+
apiProvider: "growthepie",
59+
apiUrl: "https://www.growthepie.xyz/fundamentals/transaction-count",
60+
state: txCountFormatted,
61+
},
6362
{
6463
label: t("page-enterprise-activity-stablecoin-mktcap"),
6564
apiProvider: "CoinGecko",

src/intl/en/page-enterprise.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"page-enterprise-": "",
3-
"page-enterprise-activity-daily-tx": "Daily transactions",
3+
"page-enterprise-activity-tx-count": "Daily transactions",
44
"page-enterprise-activity-stablecoin-mktcap": "Stablecoin market cap",
55
"page-enterprise-activity-total-secured": "Total capital secured",
66
"page-enterprise-ecosystem-cta": "See use cases",

src/lib/types.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -574,9 +574,7 @@ export type AllHomepageActivityData = Record<
574574
MetricReturnData
575575
>
576576

577-
export type EnterpriseActivityMetric =
578-
// | "dailyTxCount"
579-
"stablecoinMarketCap"
577+
export type EnterpriseActivityMetric = "txCount" | "stablecoinMarketCap"
580578
// | "totalCapitalSecured"
581579

582580
export type AllEnterpriseActivityData = Record<

0 commit comments

Comments
 (0)