add web vitals

This commit is contained in:
pablodanswer
2025-01-25 17:33:20 -08:00
parent d6863ec775
commit a5fe5e136b
3 changed files with 15 additions and 2 deletions

View File

@@ -23,6 +23,7 @@ import PostHogPageView from "./PostHogPageView";
import Script from "next/script";
import { LogoType } from "@/components/logo/Logo";
import { Hanken_Grotesk } from "next/font/google";
import { WebVitals } from "./web-vitals";
const inter = Inter({
subsets: ["latin"],
@@ -206,6 +207,7 @@ export default async function RootLayout({
<PostHogPageView />
</Suspense>
{children}
{process.env.NEXT_PUBLIC_POSTHOG_KEY && <WebVitals />}
</AppProvider>
);
}

View File

@@ -0,0 +1,12 @@
"use client";
import { useReportWebVitals } from "next/web-vitals";
import { usePostHog } from "posthog-js/react";
export function WebVitals() {
const posthog = usePostHog();
useReportWebVitals((metric) => {
posthog.capture(metric.name, metric);
});
return <></>;
}

View File

@@ -63,7 +63,7 @@ export function Modal({
<div
onMouseDown={handleMouseDown}
className={cn(
`fixed inset-0 bg-white bg-opacity-25 backdrop-blur-sm h-full
`fixed inset-0 bg-black border boder-border bg-opacity-10 backdrop-blur-sm h-full
flex items-center justify-center z-[9999] transition-opacity duration-300 ease-in-out`
)}
>
@@ -76,7 +76,6 @@ export function Modal({
}}
className={`
bg-background
bg-blue-400
text-emphasis
rounded
shadow-2xl