From 61d20649f62703e1e14ad7d8c3884238ba413c05 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sun, 19 Oct 2025 22:21:35 +0000 Subject: [PATCH] Add platform filter and badges with inference to DevelopersDirectory cgen-9873b79b68b0447ea3ac672aced4a3a9 --- client/pages/DevelopersDirectory.tsx | 66 ++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 3 deletions(-) diff --git a/client/pages/DevelopersDirectory.tsx b/client/pages/DevelopersDirectory.tsx index df9fc96e..33011ac0 100644 --- a/client/pages/DevelopersDirectory.tsx +++ b/client/pages/DevelopersDirectory.tsx @@ -29,6 +29,37 @@ import { import { cn } from "@/lib/utils"; import { Search, RefreshCw, UserRound, Users, Sparkles } from "lucide-react"; +const PLATFORM_OPTIONS = [ + { value: "all", label: "All Platforms" }, + { value: "roblox", label: "Roblox" }, + { value: "unity", label: "Unity" }, + { value: "unreal", label: "Unreal" }, + { value: "godot", label: "Godot" }, + { value: "cryengine", label: "CryEngine" }, + { value: "other", label: "Other" }, +] as const; + +const inferPlatforms = (profile: any): string[] => { + const out = new Set(); + const pushIf = (cond: boolean, v: string) => { + if (cond) out.add(v); + }; + const skills = Array.isArray(profile?.skills) + ? (profile.skills as string[]).map((s) => String(s).toLowerCase()) + : []; + const bio = String(profile?.bio || "").toLowerCase(); + const tags = Array.isArray(profile?.tags) + ? (profile.tags as string[]).map((t) => String(t).toLowerCase()) + : []; + const text = [skills.join(" "), tags.join(" "), bio].join(" "); + pushIf(/roblox|rbx|luau|roact/.test(text), "roblox"); + pushIf(/unity|c#|csharp/.test(text), "unity"); + pushIf(/unreal|ue5|ue4|blueprint/.test(text), "unreal"); + pushIf(/godot|gdscript/.test(text), "godot"); + pushIf(/cryengine/.test(text), "cryengine"); + return Array.from(out); +}; + const realmFilters: Array<{ value: string; label: string }> = [ { value: "all", label: "All Realms" }, { value: "game_developer", label: "Development Forge" }, @@ -215,6 +246,19 @@ const DeveloperCard = ({ profile }: DeveloperCardProps) => { {availabilityLabel} +
+ {((profile as any)?.platforms as string[] | undefined)?.length + ? ((profile as any).platforms as string[]).slice(0, 4).map((p) => ( + + {p} + + )) + : inferPlatforms(profile).slice(0, 4).map((p) => ( + + {p} + + ))} +
{ const [loading, setLoading] = useState(true); const [search, setSearch] = useState(""); const [realmFilter, setRealmFilter] = useState("all"); + const [platformFilter, setPlatformFilter] = useState("all"); const { profile: authProfile } = useAuth(); const myPassportHref = authProfile?.username ? `/passport/${authProfile.username}` @@ -312,9 +357,12 @@ const DevelopersDirectory = () => { .filter(Boolean) .some((value) => String(value).toLowerCase().includes(lowerSearch)) : true; - return matchesRealm && matchesSearch; + const platforms: string[] = ((profile as any)?.platforms as any[]) || inferPlatforms(profile); + const matchesPlatform = + platformFilter === "all" || platforms.map((p) => String(p).toLowerCase()).includes(platformFilter); + return matchesRealm && matchesSearch && matchesPlatform; }); - }, [profiles, search, realmFilter]); + }, [profiles, search, realmFilter, platformFilter]); const { toast } = useToast(); @@ -386,7 +434,7 @@ const DevelopersDirectory = () => { -
+
{ ))} +
{filteredProfiles.length === 0 ? (