'use client' import { useEffect } from 'react' import { useRouter } from 'next/navigation' import useAuthStore from '../store/authStore' import Header from '../components/nav/Header' import Footer from '../components/Footer' import { ShoppingBagIcon, UsersIcon, UserCircleIcon, StarIcon, ChartBarIcon, HeartIcon, BuildingOffice2Icon // <-- added } from '@heroicons/react/24/outline' export default function DashboardPage() { const router = useRouter() const user = useAuthStore(state => state.user) const isAuthReady = useAuthStore(state => state.isAuthReady) // Redirect if not logged in (only after auth is ready) useEffect(() => { if (isAuthReady && !user) { router.push('/login') } }, [isAuthReady, user, router]) // Show loading until auth is ready or user is confirmed if (!isAuthReady || !user) { return (

Loading...

) } // Get user name const getUserName = () => { if (user.firstName && user.lastName) { return `${user.firstName} ${user.lastName}` } if (user.firstName) return user.firstName if (user.email) return user.email.split('@')[0] return 'User' } // Quick actions const quickActions = [ { title: 'Browse Shop', description: 'Explore sustainable products', icon: ShoppingBagIcon, href: '/shop', color: 'bg-blue-500' }, { title: 'Join Community', description: 'Connect with like-minded people', icon: UsersIcon, href: '/community', color: 'bg-green-500' }, { title: 'Edit Profile', description: 'Update your information', icon: UserCircleIcon, href: '/profile', color: 'bg-purple-500' } ] // Stats (mock data for now) const stats = [ { label: 'Orders', value: '12', icon: ShoppingBagIcon }, { label: 'Favorites', value: '8', icon: HeartIcon }, { label: 'Gold Points', value: '250', icon: StarIcon }, { label: 'Activity', value: '15', icon: ChartBarIcon } ] // Referral statistics (mock values) const referralStats = [ { label: 'Registered Users', value: '123', icon: UsersIcon, color: 'bg-indigo-600' }, { label: 'Personal Users', value: '85', icon: UserCircleIcon, color: 'bg-teal-600' }, { label: 'Company Users', value: '38', icon: BuildingOffice2Icon, color: 'bg-amber-600' }, ] return (
{/* Welcome Section */}

Welcome back, {getUserName()}! 👋

Here's what's happening with your Profit Planet account

{/* Account setup note */}

Complete your account setup

Complete your verification process to unlock all features.{' '}

{/* Stats Grid - Tailwind UI Plus "With brand icon" */}
{stats.map((stat, index) => { // Define icon colors for each stat const iconColors = [ 'bg-blue-500', // Orders 'bg-red-500', // Favorites 'bg-yellow-500', // Gold Points 'bg-green-500' // Activity ]; return (

{stat.label}

{stat.value}

); })}
{/* Referral Statistics */}

Referral Statistics

{referralStats.map((stat, i) => (

{stat.label}

{stat.value}

))}
{/* Quick Actions */}

Quick Actions

{quickActions.map((action, index) => ( ))}
{/* Gold Member Status */}

Gold Member Status

Enjoy exclusive benefits and discounts

{/* Recent Activity */}

Recent Activity

Order completed

Eco-friendly water bottle

2 days ago

Added to favorites

Sustainable backpack

1 week ago

Joined community

Eco Warriors Group

2 weeks ago
) }