import { Check, Link } from 'lucide-react' import { useState } from 'react' import { copyToClipboard } from 'ui' import { ButtonTooltip } from '@/components/ui/ButtonTooltip' interface ReportSectionHeaderProps { id: string title: string description: string } export const ReportSectionHeader = ({ id, title, description }: ReportSectionHeaderProps) => { const [copiedLink, setCopiedLink] = useState(null) const copyLinkToClipboard = async () => { // [jordi] We want to keep the existing query params (filters) // But if the user has an anchor in the URL, // we remove it and add the one for this section // This is so the shared URL shows the exact same report as the one the user is on const url = `${window.location.href.split('#')[0]}#${id}` await copyToClipboard(url) setCopiedLink(id) setTimeout(() => setCopiedLink(null), 2000) } return (

{title}

: } className="w-7 h-7 opacity-0 group-hover:opacity-100 transition-opacity" tooltip={{ content: { side: 'bottom', text: copiedLink === id ? 'Link copied!' : 'Copy link to section', }, }} />

{description}

) }