'use client' import { useSendTelemetryEvent } from '~/lib/telemetry' import { askAiUrls, useCopyMarkdownFromUrl } from 'common' import { Chatgpt, Claude } from 'icons' import { Check, ChevronDown, Copy } from 'lucide-react' import { Button, cn, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, SplitButtonGroup, } from 'ui' import { SITE_ORIGIN } from '@/lib/constants' type Props = { className?: string markdownPath?: string } export function ChangelogLlmMarkdownButton({ className, markdownPath = '/changelog.md' }: Props) { const { copied, copyMarkdown } = useCopyMarkdownFromUrl() const sendTelemetryEvent = useSendTelemetryEvent() const pagePath = markdownPath.replace(/\.md$/, '') const urls = askAiUrls(`${SITE_ORIGIN}${pagePath}`) async function handleCopy() { const ok = await copyMarkdown(markdownPath) if (ok) { sendTelemetryEvent({ action: 'copy_as_markdown_clicked', properties: { pageType: 'changelog' }, }) } } return ( {copied ? 'Copied to clipboard' : ''}