From a46811fb35c212a0257671da76650e82aec5c251 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carl-Gerhard=20Lindesva=CC=88rd?=
Date: Tue, 21 May 2024 08:59:53 +0200
Subject: [PATCH] public: update hero
---
apps/public/src/app/hero.tsx | 47 +++++++++++++++++++++---------------
1 file changed, 28 insertions(+), 19 deletions(-)
diff --git a/apps/public/src/app/hero.tsx b/apps/public/src/app/hero.tsx
index 8206fb51..550722da 100644
--- a/apps/public/src/app/hero.tsx
+++ b/apps/public/src/app/hero.tsx
@@ -4,6 +4,14 @@ import { chQuery } from '@openpanel/db';
import { Heading1, Lead2 } from './copy';
+function shortNumber(num: number) {
+ if (num < 1e3) return num;
+ if (num >= 1e3 && num < 1e6) return +(num / 1e3).toFixed(1) + 'K';
+ if (num >= 1e6 && num < 1e9) return +(num / 1e6).toFixed(1) + 'M';
+ if (num >= 1e9 && num < 1e12) return +(num / 1e9).toFixed(1) + 'B';
+ if (num >= 1e12) return +(num / 1e12).toFixed(1) + 'T';
+}
+
export async function Hero() {
const projects = await chQuery<{ project_id: string; count: number }>(
'SELECT project_id, count(*) as count from events GROUP by project_id order by count()'
@@ -36,29 +44,30 @@ export async function Hero() {
size="lg"
href="https://dashboard.openpanel.dev/register"
>
- Create account
-
-
- See demo
+ Get started
-
- We have{' '}
- {projectCount} projects{' '}
- receiving{' '}
-
- {new Intl.NumberFormat('en').format(eventCount)} events
- {' '}
- in total!
+
+
+
+ Collected events
+
+
+ {shortNumber(eventCount)}
+
+
+
+
+ Active projects
+
+
+ {projectCount}
+
+
-