From c85af3051876187dbbaccac58c3b4e0bf5cde044 Mon Sep 17 00:00:00 2001 From: NotII <46204250+NotII@users.noreply.github.com> Date: Tue, 8 Apr 2025 01:46:57 +0100 Subject: [PATCH] ?? --- .gitignore | 1 + app/page.tsx | 13 ++++-- components/3d/StatsSection.tsx | 84 ++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 components/3d/StatsSection.tsx diff --git a/.gitignore b/.gitignore index e98dca5..67b161e 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,4 @@ env.local /lib/deprecated-backup public/git-info.json public/git-info.json +public/git-info.json diff --git a/app/page.tsx b/app/page.tsx index f4894bb..1fb21b5 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,11 +1,17 @@ import { getPlatformStatsServer } from "@/lib/api"; import { HomeNavbar } from "@/components/home-navbar"; import { Suspense } from "react"; -import { AnimatedStatsSection } from "@/components/animated-stats-section"; import { Shield, LineChart, Zap } from "lucide-react"; import { Button } from "@/components/ui/button"; import Link from "next/link"; import HeroSection from "@/components/3d/HeroSection"; +import dynamic from 'next/dynamic'; + +// Dynamically import the 3D stats component to avoid SSR issues +const StatsSection = dynamic(() => import('@/components/3d/StatsSection'), { + ssr: false, + loading: () =>
+}); // Constants const PY_20 = 20; @@ -42,8 +48,9 @@ export default async function Home() { {/* Statistics Section */}
- Loading statistics...
}> - +

Platform Statistics

+ }> +
diff --git a/components/3d/StatsSection.tsx b/components/3d/StatsSection.tsx new file mode 100644 index 0000000..24eac5b --- /dev/null +++ b/components/3d/StatsSection.tsx @@ -0,0 +1,84 @@ +"use client"; + +import React from 'react'; +import { motion } from 'framer-motion'; +import StatCard from './StatCard'; + +interface StatsProps { + stats: { + totalProducts?: number; + totalVendors?: number; + totalOrders?: number; + totalCustomers?: number; + gmv?: number; + }; +} + +function formatNumberValue(num: number = 0): string { + return new Intl.NumberFormat().format(Math.round(num)); +} + +function formatCurrencyValue(amount: number = 0): string { + return new Intl.NumberFormat('en-GB', { + style: 'currency', + currency: 'GBP', + maximumFractionDigits: 0 + }).format(amount); +} + +export default function StatsSection({ stats }: StatsProps) { + const { totalProducts = 0, totalVendors = 0, totalOrders = 0, totalCustomers = 0, gmv = 0 } = stats; + + // Container animation variants + const containerVariants = { + hidden: { opacity: 0 }, + visible: { + opacity: 1, + transition: { + staggerChildren: 0.1 + } + } + }; + + // Item animation variants + const itemVariants = { + hidden: { y: 20, opacity: 0 }, + visible: { + y: 0, + opacity: 1, + transition: { + type: "spring", + stiffness: 260, + damping: 20 + } + } + }; + + return ( +
+ + + + + + + + + + + + + + + + + +
+ ); +} \ No newline at end of file