import { Link } from 'react-router-dom'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { Users, ChevronRight, MapPin } from 'lucide-react'; import { useCrewsByFocus } from '@/hooks/useCrews'; import { CREW_FOCUS_LABELS, crewFocusForServiceType, type SkateCrew, type CrewFocus } from '@/lib/types'; import { Skeleton } from '@/components/ui/skeleton'; /** The Lab page's own ServiceType union (kept in sync with LabPage). */ type ServiceType = | 'coaching' | 'filming' | 'editing' | 'photography' | 'building' | 'art' | 'graffiti' | 'tattoo' | 'training' | 'music' | 'judging' | 'organizing' | 'barbering'; /** Translate the Lab page's ServiceType into a crew focus scene (or null). */ function focusForLabService(serviceType: ServiceType): Exclude | null { switch (serviceType) { // No crew scene maps to judges or organizers — better to show nothing than // to fall through to "Photo & Film" and imply a wrong association. case 'judging': case 'organizing': case 'barbering': return null; case 'art': case 'graffiti': case 'tattoo': return 'art'; case 'music': return 'music'; case 'training': return 'wellness'; case 'building': return crewFocusForServiceType('building'); case 'coaching': return crewFocusForServiceType('coaching'); default: return crewFocusForServiceType('filming'); // filming / editing / photography → photo } } function CrewChip({ crew }: { crew: SkateCrew }) { return ( {crew.name.slice(0, 2).toUpperCase()}

{crew.name}

{crew.location ? (

{crew.location}

) : (

{crew.members.length} {crew.members.length === 1 ? 'member' : 'members'}

)}
); } /** * A horizontal strip of crews that share the active Lab scene's focus. * Shown beneath the Lab results so crews and individual service providers * cross-reference each other. Renders nothing when there are no matching crews. */ export function LabCrewsStrip({ serviceType }: { serviceType: ServiceType }) { const focus = focusForLabService(serviceType); const { data: crews, isLoading } = useCrewsByFocus(focus, 20); // No matching crew scene for this Lab tab — don't show a strip at all. if (!focus) return null; // Only render the section when there's something to show (or while loading). if (!isLoading && (!crews || crews.length === 0)) return null; return (

Crews in this scene {CREW_FOCUS_LABELS[focus]}

All crews
{isLoading ? Array.from({ length: 3 }).map((_, i) => (
)) : crews?.map((crew) => )}
); }