'use client' import { CheckIcon, ChevronDownIcon, CopyIcon, Share2Icon } from 'lucide-react' import { useState } from 'react' import { MENU_POPOVER, MENU_ROW, SECONDARY_ACTION } from '@/components/shareLink/menuControls' import { WhatsAppIcon } from '@/components/socialIcons' import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/Popover' import { buildContentShareLink, buildContentShareWhatsAppUrl } from '@/lib/contentShare' import { copyFeedbackLabels, copyFeedbackLiveMessages, useCopyFeedback } from '@/lib/copyFeedback' import { shareLinkPath } from '@/lib/shareLink' import { cn } from '@/lib/utils' type ShareLinkShareMenuProps = { slug: string title: string className?: string } /** * S29 — "Compartilhar" (design cena 04): shares the short link itself (never * the destination URL) with the activity title — WhatsApp with a pre-filled * message, or copy to the clipboard with the standard feedback contract. The * short link keeps working even after the destination is swapped. */ export const ShareLinkShareMenu = ({ slug, title, className }: ShareLinkShareMenuProps) => { const [open, setOpen] = useState(false) const [origin] = useState(() => (typeof window === 'undefined' ? '' : window.location.origin)) const { feedback, copy } = useCopyFeedback() const link = buildContentShareLink(shareLinkPath(slug), origin || shareLinkPath(slug)) const whatsAppUrl = buildContentShareWhatsAppUrl('event', title, link) return ( setOpen(false)} className={MENU_ROW} > Compartilhar no WhatsApp {copyFeedbackLiveMessages[feedback]} ) }