'use client'; import Link from 'next/link'; import {CheckCircleOutlined, ClockCircleOutlined, FileTextOutlined} from '@ant-design/icons'; import {Progress, Skeleton} from 'antd'; import {useAuth} from '@/app/context/AuthContext'; import {useLanguage} from '@/app/context/LanguageContext'; import OrderCard from '@/components/dashboard/OrderCard'; import {accountCopy} from '@/data/account'; import {useCustomerOrders} from '../hooks/useCustomerOrders'; import {getActiveOrderCount, getProfileCompletion} from '../lib/orderSummary'; export default function DashboardOverview() { const auth = useAuth(); const {locale} = useLanguage(); const copy = accountCopy[locale]; const numberLocale = locale === 'fa' ? 'fa-IR' : 'en-US'; const profile = auth.session?.profile; const orders = useCustomerOrders(profile); if (!profile || !orders) return ; const completion = getProfileCompletion(profile); const activeOrders = getActiveOrderCount(orders); const cards = [ { label: copy.profileCompletion, value: `${completion.toLocaleString(numberLocale)}٪`, icon: , extra: , }, { label: copy.activeOrders, value: activeOrders.toLocaleString(numberLocale), icon: , }, { label: copy.totalOrders, value: orders.length.toLocaleString(numberLocale), icon: , }, ]; return ( <>

{copy.welcome} {profile.firstName}

{copy.dashboardDescription}

{cards.map(card => (
{card.icon}

{card.label}

{card.value} {card.extra &&
{card.extra}
}
))}

{copy.recentOrders}

{copy.viewAll}
{orders.slice(0, 2).map(order => ( ))}
); }