'use client'; import { User } from '@/types/user'; import { formatDate, formatPrice, getFullName, getEmail, getMobile } from '@/lib/utils'; import { CalendarIcon, EnvelopeIcon, PhoneIcon, WalletIcon, UserIcon } from '@heroicons/react/24/outline'; interface UserInfoProps { user: User; } export default function UserInfo({ user }: UserInfoProps) { const fullName = getFullName(user); const initials = fullName .split(' ') .map((w) => w[0]) .slice(0, 2) .join('') .toUpperCase(); const stats = [ { label: 'کیف پول', value: `${formatPrice(user.wallet)} تومان`, icon: WalletIcon, color: 'bg-emerald-50 dark:bg-emerald-500/10 text-emerald-600 dark:text-emerald-400', }, { label: 'عضویت', value: formatDate(user.created_at), icon: CalendarIcon, color: 'bg-blue-50 dark:bg-blue-500/10 text-blue-600 dark:text-blue-400', }, ]; return (
{/* Profile Header */}
{initials || }

{fullName || 'کاربر بدون نام'}

{user.email && ( {user.email} )} {user.mobile && ( {user.mobile} )}
{/* Stats Row */}
{stats.map((stat) => (
{stat.label}

{stat.value}

))}
{/* Details Grid */}
{user.birthday && ( )} {user.gender && ( )}
); } function InfoRow({ icon: Icon, label, value, dir }: { icon: React.ElementType; label: string; value: string; dir?: string }) { return (

{label}

{value}

); }