import Layout from "@/components/Layout"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; import { Users, Search, Github, Briefcase, MapPin, Trophy, MessageSquare, } from "lucide-react"; import { useEffect, useState } from "react"; import { useNavigate } from "react-router-dom"; import { supabase } from "@/lib/supabase"; interface DevProfile { id: string; user_id: string; full_name: string; avatar_url?: string; bio?: string; skills: string[]; experience_level: "beginner" | "intermediate" | "advanced" | "expert"; looking_for?: string; portfolio_url?: string; github_url?: string; created_at: string; } export default function DevLinkProfiles() { const [profiles, setProfiles] = useState([]); const [filteredProfiles, setFilteredProfiles] = useState([]); const [loading, setLoading] = useState(true); const [searchTerm, setSearchTerm] = useState(""); const [experienceFilter, setExperienceFilter] = useState("all"); const navigate = useNavigate(); useEffect(() => { const fetchProfiles = async () => { try { const { data, error } = await supabase .from("profiles") .select("*") .eq("deleted_at", null) .order("created_at", { ascending: false }) .limit(50); if (error) throw error; const devProfiles: DevProfile[] = data .map((p: any) => ({ id: p.id, user_id: p.user_id, full_name: p.full_name || "Anonymous Developer", avatar_url: p.avatar_url, bio: p.bio, skills: p.interests || [], experience_level: p.experience_level || "intermediate", looking_for: p.looking_for, portfolio_url: p.portfolio_url, github_url: p.github_url, created_at: p.created_at, })) .filter((p) => p.full_name !== "Anonymous Developer" || p.bio); setProfiles(devProfiles); setFilteredProfiles(devProfiles); } catch (error) { console.error("Error fetching profiles:", error); } finally { setLoading(false); } }; fetchProfiles(); }, []); useEffect(() => { let filtered = profiles; if (searchTerm) { filtered = filtered.filter( (p) => p.full_name.toLowerCase().includes(searchTerm.toLowerCase()) || p.bio?.toLowerCase().includes(searchTerm.toLowerCase()) || p.skills.some((s) => s.toLowerCase().includes(searchTerm.toLowerCase()) ) ); } if (experienceFilter !== "all") { filtered = filtered.filter((p) => p.experience_level === experienceFilter); } setFilteredProfiles(filtered); }, [searchTerm, experienceFilter, profiles]); return (
{/* Animated backgrounds */}
{/* Header Section */}
Dev-Link

Developer Profiles

Connect with {profiles.length} talented Roblox developers

{/* Search and Filter */}
setSearchTerm(e.target.value)} className="pl-10 bg-cyan-950/30 border-cyan-400/30 text-white placeholder:text-cyan-200/40 focus:border-cyan-400" />
{/* Profiles Grid */}
{loading ? (

Loading profiles...

) : filteredProfiles.length === 0 ? (

No profiles found. Try adjusting your filters.

) : (
{filteredProfiles.map((profile) => ( navigate(`/dev-link/profiles/${profile.id}`)} > {profile.avatar_url && ( {profile.full_name} )} {profile.full_name} {profile.experience_level} {profile.bio && (

{profile.bio}

)} {profile.skills && profile.skills.length > 0 && (

Skills

{profile.skills.slice(0, 3).map((skill) => ( {skill} ))} {profile.skills.length > 3 && ( +{profile.skills.length - 3} )}
)} {profile.looking_for && (
{profile.looking_for}
)}
{profile.github_url && ( e.stopPropagation()} > )} {profile.portfolio_url && ( e.stopPropagation()} > )}
))}
)}
); }