import React, { useState, useEffect } from 'react'; import { Calculator, User, LogOut, Settings, BarChart3, FileText, Users, Package, TrendingUp, DollarSign } from 'lucide-react'; import { localStorageService, UserData } from '../lib/localStorage'; interface DashboardProps { onLogout: () => void; } function Dashboard({ onLogout }: DashboardProps) { const [userProfile, setUserProfile] = useState(null); const [isLoading, setIsLoading] = useState(true); useEffect(() => { loadUserProfile(); }, []); const loadUserProfile = async () => { try { const user = localStorageService.getCurrentUser(); setUserProfile(user); } catch (error) { console.error('خطأ في تحميل ملف المستخدم:', error); } finally { setIsLoading(false); } }; const handleLogout = async () => { try { localStorageService.logoutUser(); onLogout(); } catch (error) { console.error('خطأ في تسجيل الخروج:', error); } }; if (isLoading) { return (
); } return (
{/* Header */}
AccountPro
{userProfile ? `${userProfile.firstName} ${userProfile.lastName}` : 'المستخدم'}
{/* Main Content */}
{/* Welcome Section */}

مرحباً، {userProfile?.firstName || 'المستخدم'}!

مرحباً بك في لوحة التحكم الخاصة بـ {userProfile?.companyName || 'منشأتك'}

15
فاتورة هذا الشهر
85%
نسبة الإنجاز
12
عميل جديد
98%
رضا العملاء
{/* Quick Actions */}

إنشاء فاتورة

إنشاء فاتورة جديدة للعملاء

إدارة العملاء

عرض وإدارة بيانات العملاء

إدارة المخزون

متابعة المنتجات والمخزون

التقارير

عرض التقارير والإحصائيات

{/* User Profile Info */} {userProfile && (

معلومات الحساب

{userProfile.firstName} {userProfile.lastName}

{userProfile.email}

{userProfile.phone}

{userProfile.companyName}

{userProfile.role}

{userProfile.sector}

{userProfile.companySize}

)}
); }