()
| 13 | import { cn } from '@/lib/utils' |
| 14 | |
| 15 | export function InstallDialog() { |
| 16 | const { isOpen, close } = useInstallDialog() |
| 17 | const cdCopyButtonRef = useRef<HTMLButtonElement>(null) |
| 18 | const installCopyButtonRef = useRef<HTMLButtonElement>(null) |
| 19 | const runCopyButtonRef = useRef<HTMLButtonElement>(null) |
| 20 | |
| 21 | const editors = [ |
| 22 | { name: 'VS Code', href: 'vscode://~/', icon: '/logos/visual-studio.png' }, |
| 23 | { name: 'Cursor', href: 'cursor://~/', icon: '/logos/cursor.png' }, |
| 24 | { |
| 25 | name: 'IntelliJ', |
| 26 | href: 'idea://~/', |
| 27 | icon: '/logos/intellij.png', |
| 28 | needsWhiteBg: true, |
| 29 | }, |
| 30 | { |
| 31 | name: 'PyCharm', |
| 32 | href: 'pycharm://~/', |
| 33 | icon: '/logos/pycharm.png', |
| 34 | needsWhiteBg: true, |
| 35 | }, |
| 36 | ] |
| 37 | |
| 38 | const handleEditorClick = (editorName: string, href: string) => { |
| 39 | window.open( |
| 40 | href + |
| 41 | encodeURIComponent( |
| 42 | typeof window !== 'undefined' ? window.location.pathname : '', |
| 43 | ), |
| 44 | '_blank', |
| 45 | ) |
| 46 | } |
| 47 | |
| 48 | const handleCdCommandCopy = () => { |
| 49 | navigator.clipboard.writeText('cd /path/to/your-repo') |
| 50 | posthog.capture(AnalyticsEvent.INSTALL_DIALOG_CD_COMMAND_COPIED) |
| 51 | cdCopyButtonRef.current?.click() |
| 52 | } |
| 53 | |
| 54 | const handleRunCommandCopy = () => { |
| 55 | navigator.clipboard.writeText('codebuff') |
| 56 | posthog.capture(AnalyticsEvent.INSTALL_DIALOG_RUN_COMMAND_COPIED) |
| 57 | runCopyButtonRef.current?.click() |
| 58 | } |
| 59 | |
| 60 | const handleInstallCommandCopy = () => { |
| 61 | navigator.clipboard.writeText('npm install -g codebuff') |
| 62 | posthog.capture(AnalyticsEvent.INSTALL_DIALOG_INSTALL_COMMAND_COPIED) |
| 63 | installCopyButtonRef.current?.click() |
| 64 | } |
| 65 | |
| 66 | return ( |
| 67 | <Dialog open={isOpen} onOpenChange={close}> |
| 68 | <DialogContent className="px-8 sm:px-10"> |
| 69 | <div className="space-y-6"> |
| 70 | <h2 className="text-2xl font-bold">Get started with Codebuff</h2> |
| 71 | <ol className="list-decimal list-inside space-y-6"> |
| 72 | <li className="text-lg leading-relaxed"> |
nothing calls this directly
no test coverage detected