diff --git a/app/page.tsx b/app/page.tsx index cdfe178..c38e803 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -6,6 +6,9 @@ import { Button } from "@/components/ui/button"; import Link from "next/link"; import { AnimatedStatsSection } from "@/components/animated-stats-section"; +// Force the page to be dynamically rendered +export const dynamic = 'force-dynamic'; + // Constants const PY_20 = 20; const PY_32 = 32; diff --git a/lib/api.ts b/lib/api.ts index 5ef2da2..6f4cdfd 100644 --- a/lib/api.ts +++ b/lib/api.ts @@ -45,13 +45,24 @@ export { type ShippingOptionsResponse, } from './services/shipping-service'; +// Define the PlatformStats interface to match the expected format +export interface PlatformStats { + orders: { + completed: number; + }; + vendors: { + total: number; + }; + transactions: { + volume: number; + averageOrderValue?: number; + }; +} + // Re-export stats services export { getPlatformStats, getVendorStats, - - // Types - type PlatformStats, } from './services/stats-service'; // Re-export server API functions diff --git a/lib/server-api.ts b/lib/server-api.ts index cd3b787..6f78c2b 100644 --- a/lib/server-api.ts +++ b/lib/server-api.ts @@ -114,7 +114,7 @@ export const getCustomerDetailsServer = async (userId: string): Promise { +export async function getPlatformStatsServer() { try { // Try to fetch from server first const serverData = await fetchServer('/stats/platform') @@ -131,21 +131,31 @@ export async function getPlatformStatsServer(): Promise { // If API call failed or returned empty data, use sample data console.info('Using sample stats data for demo'); return { - totalProducts: 243, - totalVendors: 15, - totalOrders: 1289, - totalCustomers: 756, - gmv: 38450 + orders: { + completed: 1289 + }, + vendors: { + total: 15 + }, + transactions: { + volume: 38450, + averageOrderValue: 29.83 + } }; } catch (error) { console.error('Error fetching platform stats (server):', error); // Return default stats to prevent UI breakage return { - totalProducts: 0, - totalVendors: 0, - totalOrders: 0, - totalCustomers: 0, - gmv: 0 + orders: { + completed: 0 + }, + vendors: { + total: 0 + }, + transactions: { + volume: 0, + averageOrderValue: 0 + } }; } } \ No newline at end of file diff --git a/next.config.mjs b/next.config.mjs index a15c1f9..a7304ed 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,5 +1,6 @@ /** @type {import('next').NextConfig} */ const nextConfig = { + output: 'standalone', images: { remotePatterns: [ { @@ -24,6 +25,9 @@ const nextConfig = { }, ]; }, + experimental: { + serverExternalPackages: [], + }, // Reduce memory usage during builds onDemandEntries: { // Period (in ms) where the server will keep pages in the buffer