Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion src/components/CopyPageDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ function ChatGPTIcon({ className }: { className?: string }) {
)
}

// Cursor icon
function CursorIcon({ className }: { className?: string }) {
return (
<svg viewBox="0 0 24 24" fill="currentColor" className={className}>
<path d="M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z"></path>
</svg>
)
}

// Cache for fetched markdown content
const markdownCache = new Map<string, string>()

Expand Down Expand Up @@ -153,6 +162,17 @@ export function CopyPageDropdown({
window.open(`https://chatgpt.com/?q=${prompt}`, '_blank')
}

const handleOpenInCursor = () => {
const pageUrl = window.location.href
const prompt = `Read from this URL:\n${pageUrl}\nand explain it to me`
window.open(
`cursor://anysphere.cursor-deeplink/prompt?text=${encodeURIComponent(
prompt,
)}`,
'_blank',
)
}

const menuItems = [
{
icon: MarkdownIcon,
Expand All @@ -172,6 +192,12 @@ export function CopyPageDropdown({
description: 'Ask questions about this page',
onSelect: handleOpenInChatGPT,
},
{
icon: CursorIcon,
label: 'Open in Cursor',
description: 'Ask questions about this page',
onSelect: handleOpenInCursor,
},
]

return (
Expand Down Expand Up @@ -246,7 +272,7 @@ export function CopyPageDropdown({
)}
onSelect={item.onSelect}
>
<div className="flex-shrink-0 w-5 h-5 flex items-center justify-center text-gray-500 dark:text-gray-400">
<div className="flex-shrink-0 w-5 h-5 flex items-center justify-center text-gray-700 dark:text-gray-400">
<item.icon className="w-4 h-4" />
</div>
<div className="flex flex-col gap-0.5">
Expand Down
Loading