'use client' import { CalendarPlusIcon, ChevronDownIcon } from 'lucide-react' import { useState } from 'react' import { MENU_POPOVER, MENU_ROW, SECONDARY_ACTION } from '@/components/shareLink/menuControls' import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/Popover' import { buildGoogleCalendarEventUrl } from '@/lib/calendarEvent' import { shareLinkIcsPath } from '@/lib/shareLink' type ShareLinkAgendaMenuProps = { slug: string title: string description: string location: string | null startsAt: string | null endsAt: string | null } /** * S29 — "Adicionar à agenda" (design cena 04): Google Agenda (a prefilled * `action=TEMPLATE` URL) and the server-generated `.ics` download. Without a * start date the whole control disappears — never an empty/disabled option. */ export const ShareLinkAgendaMenu = ({ slug, title, description, location, startsAt, endsAt, }: ShareLinkAgendaMenuProps) => { const [open, setOpen] = useState(false) const googleUrl = startsAt ? buildGoogleCalendarEventUrl({ title, description, location, startsAt, endsAt }) : null if (!googleUrl) return null return ( setOpen(false)} className={MENU_ROW} > Google Agenda Abrir evento preenchido setOpen(false)} className={MENU_ROW} > ) }