import { Link } from 'react-router-dom'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { Skeleton } from '@/components/ui/skeleton'; import { useCrewsForSpot } from '@/hooks/useCrewsForSpot'; import { crewAccent } from '@/lib/crewHelpers'; import { useTranslation } from '@/contexts/language'; import { Users } from 'lucide-react'; /** * Reverse link on a spot page: "Crews that skate here". Makes the local scene * visible from the spot side, not just from the crew side. */ export function CrewsForSpotCard({ spotPubkey, spotIdentifier, }: { spotPubkey?: string; spotIdentifier?: string; }) { const { t } = useTranslation(); const { data: crews, isLoading } = useCrewsForSpot(spotPubkey, spotIdentifier); // Nothing to show and not loading → render nothing (keeps the page clean). if (!isLoading && (!crews || crews.length === 0)) return null; return ( {t('spotUi.crewsThatSkateHere')} {isLoading ? ( Array.from({ length: 2 }).map((_, i) => (
)) ) : ( crews!.map((crew) => { const accent = crewAccent(crew); return ( {crew.name.slice(0, 2).toUpperCase()}

{crew.name}

{' '} {crew.members.length === 1 ? t('spotUi.memberOne', { count: crew.members.length }) : t('spotUi.memberOther', { count: crew.members.length })} {crew.location && ` · ${crew.location}`}

); }) )}
); }