From 16384a3c238758804ba9994251e11767a14585e1 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sat, 15 Nov 2025 09:15:14 +0000 Subject: [PATCH] Implement LABS Dashboard with research tracks, bounties, publications, IP dashboard cgen-7db3455b06be4f3a8d3f6cd4895ada60 --- client/pages/dashboards/LabsDashboard.tsx | 379 +++++++++++++++++----- 1 file changed, 301 insertions(+), 78 deletions(-) diff --git a/client/pages/dashboards/LabsDashboard.tsx b/client/pages/dashboards/LabsDashboard.tsx index caec98ef..d4e0a920 100644 --- a/client/pages/dashboards/LabsDashboard.tsx +++ b/client/pages/dashboards/LabsDashboard.tsx @@ -1,89 +1,312 @@ +import { useState, useEffect } from "react"; +import { useNavigate } from "react-router-dom"; import Layout from "@/components/Layout"; import { Button } from "@/components/ui/button"; -import { Card, CardContent } from "@/components/ui/card"; -import { Code2, ArrowRight, Sparkles } from "lucide-react"; +import { useAuth } from "@/contexts/AuthContext"; +import { supabase } from "@/lib/supabase"; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import { Badge } from "@/components/ui/badge"; +import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import LoadingScreen from "@/components/LoadingScreen"; +import { Lightbulb, FileText, Zap, Lock, ExternalLink, ArrowRight, AlertCircle, Send } from "lucide-react"; + +const API_BASE = import.meta.env.VITE_API_BASE || ""; export default function LabsDashboard() { + const navigate = useNavigate(); + const { user, loading: authLoading } = useAuth(); + const [activeTab, setActiveTab] = useState("overview"); + const [researchTracks, setResearchTracks] = useState([]); + const [bounties, setBounties] = useState([]); + const [publications, setPublications] = useState([]); + const [ipPortfolio, setIpPortfolio] = useState(null); + const [loading, setLoading] = useState(true); + const [isAdmin, setIsAdmin] = useState(false); + + useEffect(() => { + if (!authLoading && user) { + loadDashboardData(); + } + }, [user, authLoading]); + + const loadDashboardData = async () => { + try { + setLoading(true); + const { data: { session } } = await supabase.auth.getSession(); + const token = session?.access_token; + if (!token) throw new Error("No auth token"); + + const tracksRes = await fetch(`${API_BASE}/api/labs/research-tracks`, { + headers: { Authorization: `Bearer ${token}` }, + }); + if (tracksRes.ok) setResearchTracks(await tracksRes.json()); + + const bountiesRes = await fetch(`${API_BASE}/api/labs/bounties`, { + headers: { Authorization: `Bearer ${token}` }, + }); + if (bountiesRes.ok) setBounties(await bountiesRes.json()); + + const pubRes = await fetch(`${API_BASE}/api/labs/publications`, { + headers: { Authorization: `Bearer ${token}` }, + }); + if (pubRes.ok) setPublications(await pubRes.json()); + + const ipRes = await fetch(`${API_BASE}/api/labs/ip-portfolio`, { + headers: { Authorization: `Bearer ${token}` }, + }); + if (ipRes.ok) { + const data = await ipRes.json(); + setIpPortfolio(data); + setIsAdmin(data?.is_admin || false); + } + } catch (error) { + console.error("Failed to load LABS data", error); + } finally { + setLoading(false); + } + }; + + if (authLoading || loading) { + return ; + } + + if (!user) { + return ( + +
+
+

+ Research LABS +

+

Discover cutting-edge R&D

+ +
+
+
+ ); + } + return ( -
-
+
+
{/* Header */} -
-
-
-
- -
-
-

- LABS R&D Hub -

-

- This is the future home for all LABS R&D projects, IP management, and whitepaper publications. -

-
- - {/* Coming Soon Card */} - - - {/* Status */} -
-
-

Coming Soon

-
-

- The full bespoke LABS dashboard with research project tracking, IP management, and publication tools is currently in development per our Phase 3 Roadmap. -

-
- - {/* Guiding CTA */} -
-
-

- - Explore Our Research -

-

- You don't have to wait for the dashboard. You can read all our latest technical deep-dives and whitepapers on our official AeThex Blog right now. -

-
- -
-
-
- - {/* Features Coming */} -
- - -

📚

-

Research Projects

-

Track active R&D initiatives

-
-
- - -

🔒

-

IP Management

-

Secure access to our vault

-
-
- - -

📖

-

Publications

-

Whitepapers & technical docs

-
-
-
+
+

+ Research LABS +

+

R&D Workshop | Blueprint Technical

+ + {/* Tabs */} + + + Overview + Tracks + Bounties + Publications + + + {/* Overview Tab */} + +
+ + +

Active Tracks

+

{researchTracks.length}

+
+
+ + +

Available Bounties

+

{bounties.length}

+
+
+ + +

Publications

+

{publications.length}

+
+
+
+ + {/* Recent Publications */} + {publications.length > 0 && ( + + + Recent Publications + + + {publications.slice(0, 3).map((pub: any) => ( + +
+ +
+

{pub.title}

+

{new Date(pub.published_date).toLocaleDateString()}

+
+ +
+
+ ))} +
+
+ )} + + {/* Submit Research Proposal CTA */} + + +

Have a Research Idea?

+

Submit your research proposal for the LABS pipeline

+ +
+
+
+ + {/* Research Tracks Tab */} + + + + Active Research Tracks + Internal R&D projects + + + {researchTracks.length === 0 ? ( +
+ +

No active research tracks

+
+ ) : ( +
+ {researchTracks.map((track: any) => ( + +
+
+

{track.title}

+

{track.description}

+
+ + {track.status} + +
+
+ ))} +
+ )} +
+
+
+ + {/* Bounties Tab */} + + + + Research Bounties + High-difficulty opportunities from NEXUS + + + {bounties.length === 0 ? ( +
+ +

No bounties available

+
+ ) : ( +
+ {bounties.map((bounty: any) => ( +
+
+

{bounty.title}

+

${bounty.reward?.toLocaleString()}

+
+

{bounty.description}

+ +
+ ))} +
+ )} +
+
+
+ + {/* Publications Tab */} + + + + Publication Pipeline + Upcoming whitepapers and technical blog posts + + + {publications.length === 0 ? ( +
+ +

No publications

+
+ ) : ( + + )} +
+
+
+ + {/* IP Dashboard - Admin Only */} + {isAdmin && ( + + + + + IP Dashboard (Admin Only) + + + + {ipPortfolio ? ( +
+
+

Patents Filed

+

{ipPortfolio.patents_count || 0}

+
+
+

Trademarks

+

{ipPortfolio.trademarks_count || 0}

+
+
+

Trade Secrets

+

{ipPortfolio.trade_secrets_count || 0}

+
+
+

Copyrights

+

{ipPortfolio.copyrights_count || 0}

+
+
+ ) : ( +

IP portfolio data not available

+ )} +
+
+ )} +