diff --git a/client/pages/hub/ClientHub.tsx b/client/pages/hub/ClientHub.tsx index ce73ac07..0c040d0f 100644 --- a/client/pages/hub/ClientHub.tsx +++ b/client/pages/hub/ClientHub.tsx @@ -28,6 +28,9 @@ import { ArrowRight, MessageSquare, Phone, + Briefcase, + ArrowDown, + MapPin, } from "lucide-react"; const API_BASE = import.meta.env.VITE_API_BASE || ""; @@ -36,8 +39,9 @@ export default function ClientHub() { const navigate = useNavigate(); const { user, loading: authLoading } = useAuth(); const [activeTab, setActiveTab] = useState("overview"); - const [opportunities, setOpportunities] = useState([]); const [contracts, setContracts] = useState([]); + const [invoices, setInvoices] = useState([]); + const [teamMembers, setTeamMembers] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { @@ -53,32 +57,45 @@ export default function ClientHub() { const token = session?.access_token; if (!token) throw new Error("No auth token"); - // Load opportunities - const oppRes = await fetch(`${API_BASE}/api/nexus/client/opportunities`, { - headers: { Authorization: `Bearer ${token}` }, - }); - if (oppRes.ok) { - const data = await oppRes.json(); - setOpportunities(data.opportunities || []); - } - - // Load contracts - const contractRes = await fetch(`${API_BASE}/api/nexus/client/contracts`, { + // Load contracts for milestone tracking + const contractRes = await fetch(`${API_BASE}/api/corp/contracts?limit=10`, { headers: { Authorization: `Bearer ${token}` }, }); if (contractRes.ok) { const data = await contractRes.json(); - setContracts(data.contracts || []); + setContracts(Array.isArray(data) ? data : data.contracts || []); + } + + // Load invoices + const invoiceRes = await fetch(`${API_BASE}/api/corp/invoices?limit=20`, { + headers: { Authorization: `Bearer ${token}` }, + }); + if (invoiceRes.ok) { + const data = await invoiceRes.json(); + setInvoices(Array.isArray(data) ? data : data.invoices || []); + } + + // Load team members (Account Manager, Solutions Architect) + const teamRes = await fetch(`${API_BASE}/api/corp/team`, { + headers: { Authorization: `Bearer ${token}` }, + }); + if (teamRes.ok) { + const data = await teamRes.json(); + setTeamMembers(Array.isArray(data) ? data : data.team || []); } } catch (error: any) { - console.error("Failed to load hub data", error); + console.error("Failed to load CORP dashboard data", error); + aethexToast({ + message: "Failed to load some dashboard data", + type: "error", + }); } finally { setLoading(false); } }; if (authLoading || loading) { - return ; + return ; } if (!user) { @@ -87,9 +104,9 @@ export default function ClientHub() {

- Client Hub + CORP Client Portal

-

Enterprise collaboration & hiring

+

Enterprise solutions for your business

-
{/* Quick Stats */} -
+
- +
-

Open Opportunities

- +
+

Active Projects

+

{contracts.filter(c => c.status === "active").length}

+
+
-

{openOpportunities.length}

- +
-

Applications

- +
+

Total Invoices

+

${(totalInvoiceValue / 1000).toFixed(0)}k

+
+
-

{pendingApplications}

- - + 0 ? 'from-orange-950/40 to-orange-900/20 border-orange-500/20' : 'from-green-950/40 to-green-900/20 border-green-500/20'}`}> +
-

Active Contracts

- +
+

Outstanding

+

{outstandingInvoices}

+
+ 0 ? "#f97316" : "#22c55e", + opacity: 0.5 + }} />
-

{activeContracts.length}

- - + +
-

Total Spent

- +
+

Team Members

+

{teamMembers.length}

+
+
-

- ${totalSpent.toLocaleString('en-US', { maximumFractionDigits: 0 })} -

@@ -183,217 +203,292 @@ export default function ClientHub() { Overview - Opportunities - Contracts - Support + Project Status + Invoices & Billing + My AeThex Team {/* Overview Tab */} - {/* Account Manager Card */} - + {/* QuantumLeap Dashboard */} + - - - Your AeThex Team - + My QuantumLeap Dashboard + Live AI analytics and insights for your project - -
- {/* Account Manager */} -
-

Account Manager

-
-
- AC -
-
-

Account Manager

-

account@aethex.dev

-
-
- -
- - {/* Solutions Architect */} -
-

Solutions Architect

-
-
- SA -
-
-

Solutions Architect

-

architect@aethex.dev

-
-
- -
+ +
+