diff --git a/apps/web/src/components/CodeSnippetModalButton.tsx b/apps/web/src/components/CodeSnippetModalButton.tsx index f09ee4c9..a26cfe3c 100644 --- a/apps/web/src/components/CodeSnippetModalButton.tsx +++ b/apps/web/src/components/CodeSnippetModalButton.tsx @@ -1,12 +1,10 @@ -import { Dialog } from "@headlessui/react"; +import { cn } from "lib/utils"; import { useProjectId } from "lib/hooks/useProjectId"; import { useTracking } from "lib/tracking"; -import { Code, Copy } from "lucide-react"; -import { useRouter } from "next/router"; +import { Check, Copy, ExternalLink, Terminal } from "lucide-react"; import { useState } from "react"; import { toast } from "react-hot-toast"; import { BsCodeSlash } from "react-icons/bs"; -import { CodeSnippet } from "./CodeSnippet"; import { DropdownMenu, DropdownMenuContent, @@ -14,28 +12,196 @@ import { DropdownMenuTrigger, } from "./DropdownMenu"; import { Button } from "./ui/button"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, +} from "./ui/dialog"; -function CodeSnippetModal({ +function CliInstructionsModal({ isOpen, onClose, }: { isOpen: boolean; onClose: () => void; }) { - const projectId = useRouter().query.projectId as string; + const [copiedIndex, setCopiedIndex] = useState(null); + const [packageManager, setPackageManager] = useState<"npm" | "pnpm" | "yarn">( + "npm" + ); + + const copyToClipboard = (text: string, index: number) => { + navigator.clipboard.writeText(text); + setCopiedIndex(index); + toast.success("Copied to clipboard!"); + setTimeout(() => setCopiedIndex(null), 2000); + }; + + const installCommands = { + npm: "npm i -g @tryabby/cli", + pnpm: "pnpm i -g @tryabby/cli", + yarn: "yarn add -g @tryabby/cli", + }; return ( - - {/* The backdrop, rendered as a fixed sibling to the panel container */} -