@@ -6,7 +6,10 @@ import {Clipboard} from 'react-feather';
66import Link from 'next/link' ;
77
88import { usePlausibleEvent } from 'sentry-docs/hooks/usePlausibleEvent' ;
9+ import ChatGPT from 'sentry-docs/icons/chatgpt' ;
910import Chevron from 'sentry-docs/icons/Chevron' ;
11+ import Claude from 'sentry-docs/icons/claude' ;
12+ import ExternalLink from 'sentry-docs/icons/external-link' ;
1013import Markdown from 'sentry-docs/icons/Markdown' ;
1114
1215interface CopyMarkdownButtonProps {
@@ -66,6 +69,16 @@ export function CopyMarkdownButton({pathname}: CopyMarkdownButtonProps) {
6669 setIsOpen ( false ) ;
6770 } ;
6871
72+ const handleOpenChatGPTClick = ( ) => {
73+ emit ( 'Open in ChatGPT' , { props : { page : pathname , source : 'chatgpt_link' } } ) ;
74+ setIsOpen ( false ) ;
75+ } ;
76+
77+ const handleOpenClaudeClick = ( ) => {
78+ emit ( 'Open in Claude' , { props : { page : pathname , source : 'claude_link' } } ) ;
79+ setIsOpen ( false ) ;
80+ } ;
81+
6982 const handleDropdownToggle = ( ) => {
7083 setIsOpen ( ! isOpen ) ;
7184 if ( ! isOpen ) {
@@ -204,6 +217,46 @@ export function CopyMarkdownButton({pathname}: CopyMarkdownButtonProps) {
204217 </ div >
205218 </ div >
206219 </ Link >
220+
221+ < a
222+ href = { `https://chatgpt.com/?hint=search&q=${ encodeURIComponent ( 'Read from ' + window . location . href + ' so I can ask questions about its contents' ) } ` }
223+ target = "_blank"
224+ rel = "noopener noreferrer"
225+ className = { `${ dropdownItemClass } no-underline` }
226+ onClick = { handleOpenChatGPTClick }
227+ >
228+ < div className = { iconContainerClass } >
229+ < ChatGPT width = { 14 } height = { 14 } />
230+ </ div >
231+ < div className = "flex-1" >
232+ < div className = "font-medium text-sm leading-5 text-gray-900 dark:text-[var(--foreground)]" >
233+ Open in ChatGPT < ExternalLink aria-hidden = "true" />
234+ </ div >
235+ < div className = "text-xs leading-4 text-gray-500 dark:text-[var(--foreground-secondary)]" >
236+ Ask ChatGPT questions about this page
237+ </ div >
238+ </ div >
239+ </ a >
240+
241+ < a
242+ href = { `https://claude.ai/new?q=${ encodeURIComponent ( 'Read from ' + window . location . href + ' so I can ask questions about its contents' ) } ` }
243+ target = "_blank"
244+ rel = "noopener noreferrer"
245+ className = { `${ dropdownItemClass } no-underline` }
246+ onClick = { handleOpenClaudeClick }
247+ >
248+ < div className = { iconContainerClass } >
249+ < Claude width = { 14 } height = { 14 } />
250+ </ div >
251+ < div className = "flex-1" >
252+ < div className = "font-medium text-sm leading-5 text-gray-900 dark:text-[var(--foreground)]" >
253+ Open in Claude < ExternalLink aria-hidden = "true" />
254+ </ div >
255+ < div className = "text-xs leading-4 text-gray-500 dark:text-[var(--foreground-secondary)]" >
256+ Ask Claude questions about this page
257+ </ div >
258+ </ div >
259+ </ a >
207260 </ div >
208261 </ div > ,
209262 document . body
0 commit comments