Skip to content

[V2 200pts] Optimise images, fonts, and lazy loading to improve Core Web Vitals on landing page and dashboard#406

Merged
portableDD merged 1 commit into
Nexacore-Org:v2from
olaleyeolajide81-sketch:optimize-core-web-vitals
Jul 6, 2026
Merged

[V2 200pts] Optimise images, fonts, and lazy loading to improve Core Web Vitals on landing page and dashboard#406
portableDD merged 1 commit into
Nexacore-Org:v2from
olaleyeolajide81-sketch:optimize-core-web-vitals

Conversation

@olaleyeolajide81-sketch

Copy link
Copy Markdown

Summary

This PR implements performance optimizations to improve Core Web Vitals (LCP, CLS, INP) on the landing page and dashboard. It is the rebased version of PR #393 (closed) targeting the v2 branch as requested.

Changes Made

  1. Self-host Fonts with display: swap

    • File: app/layout.tsx
    • Added display: swap to all font configurations (Geist, Geist_Mono, Inter, Manrope)
    • This ensures text is visible immediately with a fallback font while the custom font loads, improving LCP and reducing layout shifts.
  2. Lazy Load Heavy Components with Dynamic Imports

    • File: app/(admin)/admin/analytics/page.tsx
    • Converted RevenueChart (recharts) to dynamic import with ssr: false
    • Added loading state with spinner for better UX
    • Reduces initial bundle size and improves initial page load time.
    • File: components/dashboard/InstantDepositModal.tsx
    • Converted QRCodeSVG (qrcode.react) to dynamic import with ssr: false
    • Added loading state for QR code component
    • QR code only loads when modal is opened, reducing initial bundle size.
  3. Next.js Config Optimizations

    • File: next.config.ts
    • Removed deprecated images.domains in favour of images.remotePatterns (security improvement)
    • Added modern image formats: ["image/avif", "image/webp"] for better compression
    • Set minimumCacheTTL: 60 for image caching
    • Enabled compress: true for gzip compression
    • These optimizations reduce image payload sizes and improve LCP.

Rebase Notes

This PR is the rebased version of PR #393 onto v2. The original PR commit (64da38a) was cherry-picked onto upstream v2 (e5f7b07); conflicts in app/layout.tsx, app/(admin)/admin/analytics/page.tsx, and next.config.ts were resolved by preserving v2s structural additions while applying the PRs targeted Core Web Vitals optimizations. Duplicate imports in components/dashboard/InstantDepositModal.tsx and a redundant copy icon button were cleaned up during merge.

Closes #245
Replaces #393

@vercel

vercel Bot commented Jul 4, 2026

Copy link
Copy Markdown

@olaleyeolajide81-sketch is attempting to deploy a commit to the Emmanuel Dorcas' projects Team on Vercel.

A member of the Team first needs to authorize it.

@portableDD portableDD left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@portableDD portableDD merged commit 7c5869e into Nexacore-Org:v2 Jul 6, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants