import { useEffect, useMemo, useState } from "react"; import { Link } from "react-router-dom"; import Layout from "@/components/Layout"; import { useAuth } from "@/contexts/AuthContext"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import LoadingScreen from "@/components/LoadingScreen"; import { aethexUserService, type AethexUserProfile, } from "@/lib/aethex-database-adapter"; import { cn } from "@/lib/utils"; import { Search, RefreshCw, UserRound, Users, Sparkles } from "lucide-react"; const realmFilters: Array<{ value: string; label: string }> = [ { value: "all", label: "All Realms" }, { value: "game_developer", label: "Development Forge" }, { value: "client", label: "Strategist Nexus" }, { value: "community_member", label: "Innovation Commons" }, { value: "customer", label: "Experience Hub" }, ]; const realmBadgeStyles: Record = { game_developer: "bg-gradient-to-r from-neon-purple to-aethex-500 text-white", client: "bg-gradient-to-r from-neon-blue to-aethex-400 text-white", community_member: "bg-gradient-to-r from-neon-green to-aethex-600 text-white", customer: "bg-gradient-to-r from-amber-400 to-aethex-700 text-white", }; interface DeveloperCardProps { profile: AethexUserProfile & { email?: string | null }; } const DeveloperCard = ({ profile }: DeveloperCardProps) => { const realmStyle = realmBadgeStyles[profile.user_type] || "bg-aethex-500 text-white"; const isGodMode = (profile.level ?? 1) >= 100; const passportHref = profile.username ? `/passport/${profile.username}` : `/passport/${profile.id}`; return (
{profile.user_type.replace("_", " ")} {isGodMode && ( GOD Mode )}
Level {profile.level ?? 1}
{profile.full_name || profile.username || "AeThex Explorer"} {profile.email && ( {profile.email} )}
XP
{profile.total_xp ?? 0}
Loyalty
{(profile as any)?.loyalty_points ?? 0}
{(profile as any)?.skills?.slice(0, 3)?.map((skill: string) => ( {skill} ))} {((profile as any)?.skills?.length || 0) > 3 && ( +{((profile as any)?.skills?.length || 0) - 3} )}
); }; const DevelopersDirectory = () => { const [profiles, setProfiles] = useState([]); const [loading, setLoading] = useState(true); const [search, setSearch] = useState(""); const [realmFilter, setRealmFilter] = useState("all"); const { profile: authProfile } = useAuth(); const myPassportHref = authProfile?.username ? `/passport/${authProfile.username}` : "/passport/me"; const filteredProfiles = useMemo(() => { const lowerSearch = search.trim().toLowerCase(); return profiles.filter((profile) => { const matchesRealm = realmFilter === "all" || profile.user_type === realmFilter; const matchesSearch = lowerSearch ? [profile.full_name, profile.username, (profile as any)?.company] .filter(Boolean) .some((value) => String(value).toLowerCase().includes(lowerSearch)) : true; return matchesRealm && matchesSearch; }); }, [profiles, search, realmFilter]); const refreshProfiles = async () => { try { setLoading(true); const list = await aethexUserService.listProfiles(60); setProfiles(list); } catch (error) { console.error("Failed to load profiles", error); setProfiles([]); } finally { setLoading(false); } }; useEffect(() => { refreshProfiles(); }, []); if (loading) { return ; } return (
AeThex Developer Network

Discover AeThex developers

Browse verified builders, clients, and community members across every AeThex realm.

setSearch(event.target.value)} placeholder="Search by name, username, or company" className="border-0 bg-transparent text-slate-100 focus-visible:ring-0" />
{filteredProfiles.length === 0 ? (
No developers found

Try adjusting your search or realm filters. New developers join AeThex every day!

) : (
{filteredProfiles.map((profile) => ( ))}
)}
); }; export default DevelopersDirectory;