'use client'
import { Check, Copy, ExternalLink } from 'lucide-react'
import { usePathname } from 'next/navigation'
import { useState } from 'react'
import { isFeatureEnabled } from 'common'
import { cn } from 'ui'
import { ExpandableVideo } from 'ui-patterns/ExpandableVideo'
import { Toc, TOCItems, TOCScrollArea } from 'ui-patterns/Toc'
import { Feedback } from '~/components/Feedback'
import { useTocAnchors } from '../features/docs/GuidesMdx.state'
import { Chatgpt } from 'icons'
import { Claude } from 'icons'
interface TOCHeader {
id?: string
text: string
link: string
level: number
}
function AiTools({ className }: { className?: string }) {
const [copied, setCopied] = useState(false)
const path = usePathname()
async function copyMarkdown() {
const mdUrl = `/docs/${path}.md`
try {
const res = await fetch(mdUrl)
const text = await res.text()
await navigator.clipboard.writeText(text)
setCopied(true)
setTimeout(() => setCopied(false), 2000)
} catch (error) {
console.error('Failed to copy markdown', error)
}
}
return (
AI Tools