diff --git a/next.config.mjs b/next.config.mjs index b47d2dd..1af1ee0 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -10,7 +10,7 @@ const withMDX = createMDX(); const config = { reactStrictMode: true, experimental: { - optimizePackageImports: ["@phosphor-icons/react"], + optimizePackageImports: ["@phosphor-icons/react", "lucide-react"], }, turbopack: { root: __dirname, diff --git a/public/fonts/PPMori-Regular.otf b/public/fonts/PPMori-Regular.otf deleted file mode 100644 index 2ba3d47..0000000 Binary files a/public/fonts/PPMori-Regular.otf and /dev/null differ diff --git a/public/fonts/THICCCBOI-Bold.woff2 b/public/fonts/THICCCBOI-Bold.woff2 deleted file mode 100644 index b9463a7..0000000 Binary files a/public/fonts/THICCCBOI-Bold.woff2 and /dev/null differ diff --git a/public/fonts/THICCCBOI-Medium.woff2 b/public/fonts/THICCCBOI-Medium.woff2 deleted file mode 100644 index 614244a..0000000 Binary files a/public/fonts/THICCCBOI-Medium.woff2 and /dev/null differ diff --git a/public/fonts/THICCCBOI-Regular.woff2 b/public/fonts/THICCCBOI-Regular.woff2 deleted file mode 100644 index bc25c8d..0000000 Binary files a/public/fonts/THICCCBOI-Regular.woff2 and /dev/null differ diff --git a/public/fonts/THICCCBOI-SemiBold.woff2 b/public/fonts/THICCCBOI-SemiBold.woff2 deleted file mode 100644 index 62132cd..0000000 Binary files a/public/fonts/THICCCBOI-SemiBold.woff2 and /dev/null differ diff --git a/public/fonts/delight/Web-TT/Delight-Black.woff b/public/fonts/delight/Web-TT/Delight-Black.woff deleted file mode 100644 index af971ab..0000000 Binary files a/public/fonts/delight/Web-TT/Delight-Black.woff and /dev/null differ diff --git a/public/fonts/delight/Web-TT/Delight-Bold.woff b/public/fonts/delight/Web-TT/Delight-Bold.woff deleted file mode 100644 index b26c914..0000000 Binary files a/public/fonts/delight/Web-TT/Delight-Bold.woff and /dev/null differ diff --git a/public/fonts/delight/Web-TT/Delight-ExtraBold.woff b/public/fonts/delight/Web-TT/Delight-ExtraBold.woff deleted file mode 100644 index f08638c..0000000 Binary files a/public/fonts/delight/Web-TT/Delight-ExtraBold.woff and /dev/null differ diff --git a/public/fonts/delight/Web-TT/Delight-ExtraLight.woff b/public/fonts/delight/Web-TT/Delight-ExtraLight.woff deleted file mode 100644 index 42f1b7b..0000000 Binary files a/public/fonts/delight/Web-TT/Delight-ExtraLight.woff and /dev/null differ diff --git a/public/fonts/delight/Web-TT/Delight-ExtraLight.woff2 b/public/fonts/delight/Web-TT/Delight-ExtraLight.woff2 deleted file mode 100644 index a569acf..0000000 Binary files a/public/fonts/delight/Web-TT/Delight-ExtraLight.woff2 and /dev/null differ diff --git a/public/fonts/delight/Web-TT/Delight-Light.woff b/public/fonts/delight/Web-TT/Delight-Light.woff deleted file mode 100644 index 4a0ed1e..0000000 Binary files a/public/fonts/delight/Web-TT/Delight-Light.woff and /dev/null differ diff --git a/public/fonts/delight/Web-TT/Delight-Light.woff2 b/public/fonts/delight/Web-TT/Delight-Light.woff2 deleted file mode 100644 index 11c1c1d..0000000 Binary files a/public/fonts/delight/Web-TT/Delight-Light.woff2 and /dev/null differ diff --git a/public/fonts/delight/Web-TT/Delight-Medium.woff b/public/fonts/delight/Web-TT/Delight-Medium.woff deleted file mode 100644 index 47101c8..0000000 Binary files a/public/fonts/delight/Web-TT/Delight-Medium.woff and /dev/null differ diff --git a/public/fonts/delight/Web-TT/Delight-Regular.woff b/public/fonts/delight/Web-TT/Delight-Regular.woff deleted file mode 100644 index b38e220..0000000 Binary files a/public/fonts/delight/Web-TT/Delight-Regular.woff and /dev/null differ diff --git a/public/fonts/delight/Web-TT/Delight-SemiBold.woff b/public/fonts/delight/Web-TT/Delight-SemiBold.woff deleted file mode 100644 index 82f1fa4..0000000 Binary files a/public/fonts/delight/Web-TT/Delight-SemiBold.woff and /dev/null differ diff --git a/public/fonts/delight/Web-TT/Delight-Thin.woff b/public/fonts/delight/Web-TT/Delight-Thin.woff deleted file mode 100644 index adaee04..0000000 Binary files a/public/fonts/delight/Web-TT/Delight-Thin.woff and /dev/null differ diff --git a/public/fonts/delight/Web-TT/Delight-Thin.woff2 b/public/fonts/delight/Web-TT/Delight-Thin.woff2 deleted file mode 100644 index 64fc080..0000000 Binary files a/public/fonts/delight/Web-TT/Delight-Thin.woff2 and /dev/null differ diff --git a/src/app/global.css b/src/app/global.css index 268841f..8dd2a1d 100644 --- a/src/app/global.css +++ b/src/app/global.css @@ -4,9 +4,7 @@ /* Delight Font Family */ @font-face { font-family: "Delight"; - src: - url("/fonts/delight/Web-TT/Delight-Regular.woff2") format("woff2"), - url("/fonts/delight/Web-TT/Delight-Regular.woff") format("woff"); + src: url("/fonts/delight/Web-TT/Delight-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; @@ -14,9 +12,7 @@ @font-face { font-family: "Delight"; - src: - url("/fonts/delight/Web-TT/Delight-Medium.woff2") format("woff2"), - url("/fonts/delight/Web-TT/Delight-Medium.woff") format("woff"); + src: url("/fonts/delight/Web-TT/Delight-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; @@ -24,9 +20,7 @@ @font-face { font-family: "Delight"; - src: - url("/fonts/delight/Web-TT/Delight-SemiBold.woff2") format("woff2"), - url("/fonts/delight/Web-TT/Delight-SemiBold.woff") format("woff"); + src: url("/fonts/delight/Web-TT/Delight-SemiBold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; @@ -34,9 +28,7 @@ @font-face { font-family: "Delight"; - src: - url("/fonts/delight/Web-TT/Delight-Bold.woff2") format("woff2"), - url("/fonts/delight/Web-TT/Delight-Bold.woff") format("woff"); + src: url("/fonts/delight/Web-TT/Delight-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; @@ -44,9 +36,7 @@ @font-face { font-family: "Delight"; - src: - url("/fonts/delight/Web-TT/Delight-ExtraBold.woff2") format("woff2"), - url("/fonts/delight/Web-TT/Delight-ExtraBold.woff") format("woff"); + src: url("/fonts/delight/Web-TT/Delight-ExtraBold.woff2") format("woff2"); font-weight: 800; font-style: normal; font-display: swap; @@ -54,9 +44,7 @@ @font-face { font-family: "Delight"; - src: - url("/fonts/delight/Web-TT/Delight-Black.woff2") format("woff2"), - url("/fonts/delight/Web-TT/Delight-Black.woff") format("woff"); + src: url("/fonts/delight/Web-TT/Delight-Black.woff2") format("woff2"); font-weight: 900; font-style: normal; font-display: swap; diff --git a/src/components/helpers/network-toggle.tsx b/src/components/helpers/network-toggle.tsx index a8c9c8c..2eae44c 100644 --- a/src/components/helpers/network-toggle.tsx +++ b/src/components/helpers/network-toggle.tsx @@ -3,8 +3,8 @@ import type { NexusNetwork } from "@avail-project/nexus-core"; import { useEffect, useState } from "react"; import { useAnalytics } from "@/hooks/use-analytics"; +import { NETWORK_KEY } from "@/lib/constants"; import { getItem, setItem } from "@/lib/local-storage"; -import { NETWORK_KEY } from "@/providers/Web3Provider"; import { useNexus } from "../nexus/NexusProvider"; import { Select, diff --git a/src/components/mdx/themed-image.tsx b/src/components/mdx/themed-image.tsx index 5077277..f9fe41e 100644 --- a/src/components/mdx/themed-image.tsx +++ b/src/components/mdx/themed-image.tsx @@ -6,10 +6,13 @@ export function ThemedImage({ light, dark, alt, + priority = false, }: { light: string; dark: string; alt: string; + /** Set to true for hero/above-fold images to avoid delaying LCP */ + priority?: boolean; }) { const dialogRef = useRef(null); @@ -26,6 +29,8 @@ export function ThemedImage({ {alt} @@ -38,6 +43,8 @@ export function ThemedImage({ {alt} diff --git a/src/components/showcase/showcase-wrapper.tsx b/src/components/showcase/showcase-wrapper.tsx index 34bc19d..20b48cb 100644 --- a/src/components/showcase/showcase-wrapper.tsx +++ b/src/components/showcase/showcase-wrapper.tsx @@ -2,8 +2,8 @@ import { Check, X } from "@phosphor-icons/react"; import type React from "react"; import { useEffect, useState } from "react"; +import { NETWORK_KEY } from "@/lib/constants"; import { getItem } from "@/lib/local-storage"; -import { NETWORK_KEY } from "@/providers/Web3Provider"; import NetworkToggle from "../helpers/network-toggle"; import { PreviewPanel } from "../helpers/preview-panel"; import { Toggle } from "../ui/toggle"; diff --git a/src/hooks/use-posthog-identify.ts b/src/hooks/use-posthog-identify.ts index 40029bc..b3f84ee 100644 --- a/src/hooks/use-posthog-identify.ts +++ b/src/hooks/use-posthog-identify.ts @@ -11,8 +11,8 @@ import { track, unsetSuperProperties, } from "@/lib/analytics/posthog"; +import { NETWORK_KEY } from "@/lib/constants"; import { getItem } from "@/lib/local-storage"; -import { NETWORK_KEY } from "@/providers/Web3Provider"; /** * Hash a wallet address using SHA-256 for privacy-preserving identification diff --git a/src/lib/constants.ts b/src/lib/constants.ts new file mode 100644 index 0000000..8576612 --- /dev/null +++ b/src/lib/constants.ts @@ -0,0 +1,2 @@ +/** localStorage key for the Nexus network selection (mainnet/testnet) */ +export const NETWORK_KEY = "nexus-elements-network-key"; diff --git a/src/providers/PostHogProvider.tsx b/src/providers/PostHogProvider.tsx index ae103dd..8b28629 100644 --- a/src/providers/PostHogProvider.tsx +++ b/src/providers/PostHogProvider.tsx @@ -30,7 +30,12 @@ interface PostHogProviderProps { */ export function PostHogProvider({ children }: PostHogProviderProps) { useEffect(() => { - initPostHog(); + // Defer PostHog init until browser is idle to avoid competing with hydration + if ("requestIdleCallback" in window) { + requestIdleCallback(() => initPostHog()); + } else { + setTimeout(() => initPostHog(), 2000); + } }, []); // Don't wrap with provider if PostHog is not configured diff --git a/src/providers/Web3Provider.tsx b/src/providers/Web3Provider.tsx index 92ebc2a..10a6d59 100644 --- a/src/providers/Web3Provider.tsx +++ b/src/providers/Web3Provider.tsx @@ -25,6 +25,7 @@ import { import { PostHogIdentify } from "@/components/analytics/PostHogIdentify"; import NexusProvider from "@/components/nexus/NexusProvider"; import { Skeleton } from "@/components/ui/skeleton"; +import { NETWORK_KEY } from "@/lib/constants"; import { getItem, setItem } from "@/lib/local-storage"; const hyperEVM = defineChain({ @@ -128,7 +129,6 @@ const defaultConfig = getDefaultConfig({ }); const wagmiConfig = createConfig(defaultConfig); -export const NETWORK_KEY = "nexus-elements-network-key"; function NexusContainer({ children }: Readonly<{ children: React.ReactNode }>) { const [network, setNetwork] = useState("mainnet"); diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..2cffc50 --- /dev/null +++ b/vercel.json @@ -0,0 +1,22 @@ +{ + "headers": [ + { + "source": "/fonts/(.*)", + "headers": [ + { + "key": "Cache-Control", + "value": "public, max-age=31536000, immutable" + } + ] + }, + { + "source": "/img/(.*)", + "headers": [ + { + "key": "Cache-Control", + "value": "public, max-age=31536000, immutable" + } + ] + } + ] +}