import { useMemo } from 'react'; import { Label } from '@/components/ui/label'; import { Badge } from '@/components/ui/badge'; import { Users, X, Link2 } from 'lucide-react'; import { useCrews } from '@/hooks/useCrews'; import { useTranslation } from '@/contexts/language'; import { useCurrentUser } from '@/hooks/useCurrentUser'; import { SKATE_CREW_KIND } from '@/lib/types'; import { cn } from '@/lib/utils'; interface CrewLinkFieldProps { /** Selected crew coordinate `35006:pubkey:d`, or undefined. */ value?: string; onChange: (coord: string | undefined) => void; accentText?: string; accentBg?: string; } /** * Lets a Lab-profile owner link ONE of their own crews. Cross-links a collective * Lab profile (studio) to its crew so each surfaces the other. */ export function CrewLinkField({ value, onChange, accentText = 'text-teal-400', accentBg = 'bg-teal-500' }: CrewLinkFieldProps) { const { t } = useTranslation(); const { user } = useCurrentUser(); const { data: allCrews } = useCrews(200); // Only offer the crews this user founded — you can only vouch a link from a crew you control. const myCrews = useMemo( () => (allCrews ?? []).filter((c) => c.pubkey === user?.pubkey), [allCrews, user?.pubkey] ); const coordFor = (pubkey: string, identifier: string) => `${SKATE_CREW_KIND}:${pubkey}:${identifier}`; return (
{t('socialUi.linkField.description')}{' '} {t('common.verified')} {t('socialUi.linkField.descriptionRest')}
{t('socialUi.linkField.none')}
) : (