import { useState, useEffect } from "react"; import { useNavigate } from "react-router-dom"; import Layout from "@/components/Layout"; import { Button } from "@/components/ui/button"; 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 { Code, Users, Briefcase, ExternalLink, ArrowRight, AlertCircle, Edit, Save } from "lucide-react"; const API_BASE = import.meta.env.VITE_API_BASE || ""; export default function DevLinkDashboard() { const navigate = useNavigate(); const { user, loading: authLoading } = useAuth(); const [activeTab, setActiveTab] = useState("overview"); const [profile, setProfile] = useState(null); const [opportunities, setOpportunities] = useState([]); const [teams, setTeams] = useState([]); const [loading, setLoading] = useState(true); const [isEditing, setIsEditing] = 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 profileRes = await fetch(`${API_BASE}/api/devlink/profile`, { headers: { Authorization: `Bearer ${token}` }, }); if (profileRes.ok) setProfile(await profileRes.json()); const oppRes = await fetch(`${API_BASE}/api/devlink/opportunities`, { headers: { Authorization: `Bearer ${token}` }, }); if (oppRes.ok) setOpportunities(await oppRes.json()); const teamsRes = await fetch(`${API_BASE}/api/devlink/teams`, { headers: { Authorization: `Bearer ${token}` }, }); if (teamsRes.ok) setTeams(await teamsRes.json()); } catch (error) { console.error("Failed to load DEV-LINK data", error); } finally { setLoading(false); } }; if (authLoading || loading) { return ; } if (!user) { return (

DEV-LINK

Roblox Developer Network

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

DEV-LINK

Roblox Developer Network | Vibrant Cyan

{/* Tabs */} Overview Profile Editor Roblox Jobs Teams {/* Overview Tab */}

Profile Views

{profile?.profile_views || 0}

Job Matches

{opportunities.length}

Team Requests

{teams.length}

{/* Quick Links */}

Browse Roblox Jobs

Find a Teammate

{/* Profile Editor Tab */} My dev-link Profile Editor Customize your Roblox portfolio {/* Roblox Creations */}

My Roblox Creations

{isEditing ? (