"use client"
import { BASE_URL } from "@/lib/constants"
import { getLlmContent } from "@/lib/llms-utils"
import {
Button,
ButtonGroup,
ButtonProps,
IconButton,
IconButtonProps,
Menu,
Portal,
Separator,
useClipboard,
} from "@chakra-ui/react"
import NextLink from "next/link"
import { BsMarkdown } from "react-icons/bs"
import { LuCheck, LuChevronDown } from "react-icons/lu"
import { Docs } from ".velite"
export const LLMSCopyWidget = (props: { data: Docs }) => {
const { data } = props
return (
)
}
const CopyMarkdownButton = (props: ButtonProps & { data: Docs }) => {
const { data, ...rest } = props
const clipboard = useClipboard({ value: getLlmContent(data), timeout: 1000 })
return (
)
}
const ActionMenu = (props: IconButtonProps & { data: Docs }) => {
const { data, ...rest } = props
const readUrl = encodeURIComponent(
`Use web browsing to access links and information: ${BASE_URL}/${data.slug}.mdx`,
)
const items = [
{
label: "View as markdown",
href: `${BASE_URL}/${data.slug}.mdx`,
icon: BsMarkdown,
},
{
label: "Open in ChatGPT",
href: `https://chatgpt.com/?hints=search&q=${readUrl}`,
icon: OpenAiIcon,
},
{
label: "Open in Claude",
href: `https://claude.ai/new?q=${readUrl}`,
icon: AnthropicIcon,
},
]
return (
{items.map((item) => (
{item.label}
))}
)
}
const AnthropicIcon = (props: React.SVGProps) => {
return (
)
}
const OpenAiIcon = (props: React.SVGProps) => {
return (
)
}