import { useState } from "react"; import { Apple, Monitor, Terminal } from "lucide-react"; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, } from "@/components/ui/dialog"; import { cn } from "@/lib/utils"; type Platform = "mac" | "windows" | "linux"; const platforms: { id: Platform; label: string; icon: typeof Apple }[] = [ { id: "mac", label: "macOS", icon: Apple }, { id: "windows", label: "Windows", icon: Monitor }, { id: "linux", label: "Linux", icon: Terminal }, ]; const instructions: Record = { mac: { steps: [ "Open Finder and navigate to the folder.", "Right-click (or Control-click) the folder.", "Hold the Option (⌥) key — \"Copy\" changes to \"Copy as Pathname\".", "Click \"Copy as Pathname\", then paste here.", ], tip: "You can also open Terminal, type cd, drag the folder into the terminal window, and press Enter. Then type pwd to see the full path.", }, windows: { steps: [ "Open File Explorer and navigate to the folder.", "Click in the address bar at the top — the full path will appear.", "Copy the path, then paste here.", ], tip: "Alternatively, hold Shift and right-click the folder, then select \"Copy as path\".", }, linux: { steps: [ "Open a terminal and navigate to the directory with cd.", "Run pwd to print the full path.", "Copy the output and paste here.", ], tip: "In most file managers, Ctrl+L reveals the full path in the address bar.", }, }; function detectPlatform(): Platform { const ua = navigator.userAgent.toLowerCase(); if (ua.includes("mac")) return "mac"; if (ua.includes("win")) return "windows"; return "linux"; } interface PathInstructionsModalProps { open: boolean; onOpenChange: (open: boolean) => void; } export function PathInstructionsModal({ open, onOpenChange, }: PathInstructionsModalProps) { const [platform, setPlatform] = useState(detectPlatform); const current = instructions[platform]; return ( How to get a full path Paste the absolute path (e.g.{" "} /Users/you/project ) into the input field. {/* Platform tabs */}
{platforms.map((p) => ( ))}
{/* Steps */}
    {current.steps.map((step, i) => (
  1. {i + 1}. {step}
  2. ))}
{current.tip && (

{current.tip}

)}
); } /** * Small "Choose" button that opens the PathInstructionsModal. * Drop-in replacement for the old showDirectoryPicker buttons. */ export function ChoosePathButton({ className }: { className?: string }) { const [open, setOpen] = useState(false); return ( <> ); }