'use client' import Image from 'next/image' import { useState } from 'react' import { useAuth } from '@/contexts/AuthContext' import { useProfileData } from '@/hooks/useProfileData' import { Card, CardContent, CardHeader } from '@/components/ui/card' import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { Skeleton } from '@/components/ui/skeleton' import { Camera, Mail, Calendar, Shield, Copy, Check, Server, Wallet } from 'lucide-react' import { BalanceDisplay } from '@/components/balance' export function ProfileCard() { const { user } = useAuth() const { profileStats, isLoading } = useProfileData() const [copied, setCopied] = useState(false) if (!user) return null // Generate Silicon ID (dummy implementation for UI testing) const siliconId = user.siliconId || '' // const siliconId = user.email?.split('@')[0]?.toUpperCase() || 'SILICON001' const handleCopySiliconId = async () => { try { await navigator.clipboard.writeText(siliconId) setCopied(true) setTimeout(() => setCopied(false), 2000) } catch (err) { console.error('Failed to copy: ', err) } } const formatDate = (dateString: string) => { return new Date(dateString).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric', }) } const getProviderBadge = (provider: string) => { const variants = { local: { variant: 'secondary' as const, label: 'Email' }, google: { variant: 'default' as const, label: 'Google' }, github: { variant: 'outline' as const, label: 'GitHub' }, } const config = variants[provider as keyof typeof variants] || variants.local return ( {config.label} ) } return ( {user.avatar ? ( ) : ( user.name.charAt(0).toUpperCase() )} {user.name} Silicon ID: {siliconId} {copied ? : } {getProviderBadge(user.provider)} {user.role === 'admin' && ( Admin )} {user.email} Joined {formatDate(user.createdAt)} {isLoading ? ( ) : ( {profileStats?.activeServices || 3} )} Active Services {/* */} {isLoading ? ( ) : ( // // ₹ // {profileS'tats?.balance?.toLocaleString('en-IN', { minimumFractionDigits: 2 }) || // '1,250.00'} // )} Balance {isLoading ? ( ) : ( {profileStats?.totalTopics || 0} )} Total Topics {isLoading ? ( ) : ( {profileStats?.totalViews ? profileStats.totalViews >= 1000 ? `${(profileStats.totalViews / 1000).toFixed(1)}K` : profileStats.totalViews.toLocaleString() : '0'} )} Total Views Account Status {user.isVerified ? 'Verified' : 'Unverified'} ) }
{siliconId}