import { Link } from 'react-router-dom'; import { AlertTriangle, Eye } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { useCurrentUser } from '@/hooks/useCurrentUser'; import { useLabProfile } from '@/hooks/useLabProfiles'; /** * Lab provider profiles (coach, filmer, editor, photographer, builder…) are * addressable events keyed by a fixed `d` identifier per type * (e.g. "coach-profile"). That means re-publishing REPLACES the existing one. * * The "Become a …" forms start blank and don't reconstruct prior state, so a * returning provider who submits again would silently wipe every field they'd * set before (bio, rate, spots, contact…). This notice makes that consequence * explicit: it appears only when the current user already has a profile of this * type, warns that submitting will overwrite it, and links them to view it. */ export function ExistingLabProfileNotice({ identifier, label, }: { /** The fixed `d` identifier for this Lab profile type, e.g. "coach-profile". */ identifier: string; /** Human label for the profile type, e.g. "coach". */ label: string; }) { const { user } = useCurrentUser(); const { data: existing } = useLabProfile(identifier, user?.pubkey); if (!user || !existing) return null; return (
You already have a {label} profile
Publishing this form replaces your current {label} profile — anything you don't re-enter here will be lost. Review your existing profile first so you don't drop details you already set.