Skip to content

🎥 Make videos programmatically with React

add chatgpt and claude links

Igor Samokhovetsaad34e187510
diff --git a/packages/docs/src/theme/DocBreadcrumbs/icons.tsx b/packages/docs/src/theme/DocBreadcrumbs/icons.tsx
new file mode 100644
index 0000000000..26a632084c
--- /dev/null
+++ b/packages/docs/src/theme/DocBreadcrumbs/icons.tsx
@@ -0,0 +1,116 @@
+import React from 'react';
+
+export function CopyIcon({size = 16}: {readonly size?: number}) {
+ return (
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 18 18"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z"
+ stroke="currentColor"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ <path
+ d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097"
+ stroke="currentColor"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ );
+}
+
+export function OpenAIIcon({size = 16}: {readonly size?: number}) {
+ return (
+ <svg
+ fill="currentColor"
+ fillRule="evenodd"
+ height={size}
+ viewBox="0 0 24 24"
+ width={size}
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <title>OpenAI</title>
+ <path d="M21.55 10.004a5.416 5.416 0 00-.478-4.501c-1.217-2.09-3.662-3.166-6.05-2.66A5.59 5.59 0 0010.831 1C8.39.995 6.224 2.546 5.473 4.838A5.553 5.553 0 001.76 7.496a5.487 5.487 0 00.691 6.5 5.416 5.416 0 00.477 4.502c1.217 2.09 3.662 3.165 6.05 2.66A5.586 5.586 0 0013.168 23c2.443.006 4.61-1.546 5.361-3.84a5.553 5.553 0 003.715-2.66 5.488 5.488 0 00-.693-6.497v.001zm-8.381 11.558a4.199 4.199 0 01-2.675-.954c.034-.018.093-.05.132-.074l4.44-2.53a.71.71 0 00.364-.623v-6.176l1.877 1.069c.02.01.033.029.036.05v5.115c-.003 2.274-1.87 4.118-4.174 4.123zM4.192 17.78a4.059 4.059 0 01-.498-2.763c.032.02.09.055.131.078l4.44 2.53c.225.13.504.13.73 0l5.42-3.088v2.138a.068.068 0 01-.027.057L9.9 19.288c-1.999 1.136-4.552.46-5.707-1.51h-.001zM3.023 8.216A4.15 4.15 0 015.198 6.41l-.002.151v5.06a.711.711 0 00.364.624l5.42 3.087-1.876 1.07a.067.067 0 01-.063.005l-4.489-2.559c-1.995-1.14-2.679-3.658-1.53-5.63h.001zm15.417 3.54l-5.42-3.088L14.896 7.6a.067.067 0 01.063-.006l4.489 2.557c1.998 1.14 2.683 3.662 1.529 5.633a4.163 4.163 0 01-2.174 1.807V12.38a.71.71 0 00-.363-.623zm1.867-2.773a6.04 6.04 0 00-.132-.078l-4.44-2.53a.731.731 0 00-.729 0l-5.42 3.088V7.325a.068.068 0 01.027-.057L14.1 4.713c2-1.137 4.555-.46 5.707 1.513.487.833.664 1.809.499 2.757h.001zm-11.741 3.81l-1.877-1.068a.065.065 0 01-.036-.051V6.559c.001-2.277 1.873-4.122 4.181-4.12.976 0 1.92.338 2.671.954-.034.018-.092.05-.131.073l-4.44 2.53a.71.71 0 00-.365.623l-.003 6.173v.002zm1.02-2.168L12 9.25l2.414 1.375v2.75L12 14.75l-2.415-1.375v-2.75z" />
+ </svg>
+ );
+}
+
+export function AnthropicIcon({size = 16}: {readonly size?: number}) {
+ return (
+ <svg
+ fill="currentColor"
+ fillRule="evenodd"
+ height={size}
+ viewBox="0 0 24 24"
+ width={size}
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <title>Anthropic</title>
+ <path d="M13.827 3.52h3.603L24 20h-3.603l-6.57-16.48zm-7.258 0h3.767L16.906 20h-3.674l-1.343-3.461H5.017l-1.344 3.46H0L6.57 3.522zm4.132 9.959L8.453 7.687 6.205 13.48H10.7z" />
+ </svg>
+ );
+}
+
+export function CursorIcon({size = 16}: {readonly size?: number}) {
+ return (
+ <svg
+ height={size}
+ viewBox="0 0 24 24"
+ width={size}
+ xmlns="http://www.w3.org/2000/svg"
+ fill="currentColor"
+ >
+ <title>Cursor</title>
+ <path d="M11.925 24l10.425-6-10.425-6L1.5 18l10.425 6z" />
+ <path d="M22.35 18V6L11.925 0v12l10.425 6z" />
+ <path d="M11.925 0L1.5 6v12l10.425-6V0z" />
+ <path d="M22.35 6L11.925 24V12L22.35 6z" opacity="0.6" />
+ <path d="M22.35 6l-10.425 6L1.5 6h20.85z" />
+ </svg>
+ );
+}
+
+export function VSCodeIcon({size = 16}: {readonly size?: number}) {
+ return (
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 100 100"
+ fill="currentColor"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ fillRule="evenodd"
+ clipRule="evenodd"
+ d="M70.9119 99.3171C72.4869 99.9307 74.2828 99.8914 75.8725 99.1264L96.4608 89.2197C98.6242 88.1787 100 85.9892 100 83.5872V16.4133C100 14.0113 98.6243 11.8218 96.4609 10.7808L75.8725 0.873756C73.7862 -0.130129 71.3446 0.11576 69.5135 1.44695C69.252 1.63711 69.0028 1.84943 68.769 2.08341L29.3551 38.0415L12.1872 25.0096C10.589 23.7965 8.35363 23.8959 6.86933 25.2461L1.36303 30.2549C-0.452552 31.9064 -0.454633 34.7627 1.35853 36.417L16.2471 50.0001L1.35853 63.5832C-0.454633 65.2374 -0.452552 68.0938 1.36303 69.7453L6.86933 74.7541C8.35363 76.1043 10.589 76.2037 12.1872 74.9905L29.3551 61.9587L68.769 97.9167C69.3925 98.5406 70.1246 99.0104 70.9119 99.3171ZM75.0152 27.2989L45.1091 50.0001L75.0152 72.7012V27.2989Z"
+ />
+ </svg>
+ );
+}
+
+export function ExternalLinkIcon({size = 12}: {readonly size?: number}) {
+ return (
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ width={size}
+ height={size}
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ >
+ <path d="M7 7h10v10" />
+ <path d="M7 17 17 7" />
+ </svg>
+ );
+}
diff --git a/packages/docs/src/theme/DocBreadcrumbs/index.tsx b/packages/docs/src/theme/DocBreadcrumbs/index.tsx
index 27ed21c8d2..00412db750 100644
--- a/packages/docs/src/theme/DocBreadcrumbs/index.tsx
+++ b/packages/docs/src/theme/DocBreadcrumbs/index.tsx
@@ -3,9 +3,94 @@ import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
import DocBreadcrumbs from '@theme-original/DocBreadcrumbs';
import type DocBreadcrumbsType from '@theme/DocBreadcrumbs';
import React, {type ReactNode, useCallback, useState} from 'react';
+import {
+ AnthropicIcon,
+ CopyIcon,
+ CursorIcon,
+ ExternalLinkIcon,
+ OpenAIIcon,
+ VSCodeIcon,
+} from './icons';
type Props = WrapperProps<typeof DocBreadcrumbsType>;
+const dropdownItemStyle: React.CSSProperties = {
+ padding: '6px',
+ fontSize: '0.875rem',
+ cursor: 'pointer',
+ borderRadius: '12px',
+ outline: 'none',
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px',
+};
+
+const iconContainerStyle: React.CSSProperties = {
+ border: '1px solid var(--border-color)',
+ borderRadius: '8px',
+ padding: '6px',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+};
+
+const itemContentStyle: React.CSSProperties = {
+ flex: 1,
+ paddingLeft: '4px',
+};
+
+const itemTitleStyle: React.CSSProperties = {
+ fontSize: '0.875rem',
+ fontWeight: 500,
+ color: 'var(--text-color)',
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px',
+};
+
+const itemDescriptionStyle: React.CSSProperties = {
+ fontSize: '0.75rem',
+ color: 'var(--light-text-color)',
+};
+
+interface DropdownItemProps {
+ readonly icon: ReactNode;
+ readonly title: string;
+ readonly description: string;
+ readonly onClick?: () => void;
+ readonly showExternalIcon?: boolean;
+}
+
+function AiDropdownItemComponent({
+ icon,
+ title,
+ description,
+ onClick,
+ showExternalIcon = false,
+}: DropdownItemProps) {
+ return (
+ <DropdownMenu.Item
+ onClick={onClick}
+ style={dropdownItemStyle}
+ onMouseEnter={(e) => {
+ e.currentTarget.style.backgroundColor = 'var(--clear-hover)';
+ }}
+ onMouseLeave={(e) => {
+ e.currentTarget.style.backgroundColor = 'transparent';
+ }}
+ >
+ <div style={iconContainerStyle}>{icon}</div>
+ <div style={itemContentStyle}>
+ <div style={itemTitleStyle}>
+ {title}
+ {showExternalIcon && <ExternalLinkIcon />}
+ </div>
+ <div style={itemDescriptionStyle}>{description}</div>
+ </div>
+ </DropdownMenu.Item>
+ );
+}
+
async function copy(text: string) {
if (navigator.clipboard?.writeText) {
await navigator.clipboard.writeText(text);
@@ -55,6 +140,23 @@ export default function DocBreadcrumbsWrapper(props: Props): ReactNode {
}
}, []);
+ const getPrompt = useCallback((): string => {
+ const currentUrl = window.location.href;
+ return `Please read the documentation from ${currentUrl} and help me understand it. I may have questions about the content, features, and how to use what's described on this page.`;
+ }, []);
+
+ const handleOpenInChatGPT = useCallback(() => {
+ const prompt = getPrompt();
+ const chatgptUrl = `https://chatgpt.com/?hints=search&prompt=${encodeURIComponent(prompt)}`;
+ window.open(chatgptUrl, '_blank');
+ }, [getPrompt]);
+
+ const handleOpenInClaude = useCallback(() => {
+ const prompt = getPrompt();
+ const claudeUrl = `https://claude.ai/?q=${encodeURIComponent(prompt)}`;
+ window.open(claudeUrl, '_blank');
+ }, [getPrompt]);
+
return (
<div
style={{
@@ -96,7 +198,7 @@ export default function DocBreadcrumbsWrapper(props: Props): ReactNode {
d="M384 336H192c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16l140.1 0L400 115.9V320c0 8.8-7.2 16-16 16zM192 384H384c35.3 0 64-28.7 64-64V115.9c0-12.7-5.1-24.9-14.1-33.9L366.1 14.1c-9-9-21.2-14.1-33.9-14.1H192c-35.3 0-64 28.7-64 64V320c0 35.3 28.7 64 64 64zM64 128c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H256c35.3 0 64-28.7 64-64V416H272v32c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V192c0-8.8 7.2-16 16-16H96V128H64z"
/>
</svg>
- {copied ? 'Copied' : 'Copy page'}
+ {copied ? 'Copied' : 'Ask AI'}
</button>
<DropdownMenu.Root>
<DropdownMenu.Trigger asChild>
@@ -133,32 +235,49 @@ export default function DocBreadcrumbsWrapper(props: Props): ReactNode {
style={{
backgroundColor: 'var(--background)',
border: '1px solid var(--border-color)',
- borderRadius: '6px',
+ borderRadius: '12px',
padding: '4px',
- minWidth: '180px',
+ minWidth: '280px',
boxShadow: 'var(--box-shadow)',
zIndex: 9999,
}}
>
- <DropdownMenu.Item
+ <AiDropdownItemComponent
+ icon={<CopyIcon />}
+ title="Copy page"
+ description="Copy page as Markdown for LLMs"
onClick={handleCopyMarkdown}
- style={{
- padding: '8px 12px',
- fontSize: '0.875rem',
- cursor: 'pointer',
- borderRadius: '4px',
- outline: 'none',
- color: 'var(--text-color)',
- }}
- onMouseEnter={(e) => {
- e.currentTarget.style.backgroundColor = 'var(--clear-hover)';
- }}
- onMouseLeave={(e) => {
- e.currentTarget.style.backgroundColor = 'transparent';
- }}
- >
- Copy as Markdown
- </DropdownMenu.Item>
+ />
+
+ <AiDropdownItemComponent
+ icon={<OpenAIIcon />}
+ title="Open in ChatGPT"
+ description="Ask questions about this page"
+ onClick={handleOpenInChatGPT}
+ showExternalIcon
+ />
+
+ <AiDropdownItemComponent
+ icon={<AnthropicIcon />}
+ title="Open in Claude"
+ description="Ask questions about this page"
+ onClick={handleOpenInClaude}
+ showExternalIcon
+ />
+
+ <AiDropdownItemComponent
+ icon={<CursorIcon />}
+ title="Connect to Cursor"
+ description="Install MCP Server on Cursor"
+ showExternalIcon
+ />
+
+ <AiDropdownItemComponent
+ icon={<VSCodeIcon />}
+ title="Connect to VS Code"
+ description="Install MCP Server on VS Code"
+ showExternalIcon
+ />
</DropdownMenu.Content>
</DropdownMenu.Portal>
</DropdownMenu.Root>