"use client"; import { LoadingButton } from "@/components/loading-button"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "@/components/ui/command"; import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover"; import { cn } from "@/lib/utils"; import { useState } from "react"; import { LuDownload } from "react-icons/lu"; import { LuCheck, LuChevronsUpDown } from "react-icons/lu"; import { ScrollArea } from "./ui/scroll-area"; interface GithubRelease { tag_name: string; assets: Array<{ name: string; browser_download_url: string; hash?: string; }>; published_at: string; is_nightly: boolean; } interface VersionSelectorProps { selectedVersion: string | null; onVersionSelect: (version: string | null) => void; availableVersions: GithubRelease[]; downloadedVersions: string[]; isDownloading: boolean; onDownload: () => void; placeholder?: string; showDownloadButton?: boolean; } export function VersionSelector({ selectedVersion, onVersionSelect, availableVersions, downloadedVersions, isDownloading, onDownload, placeholder = "Select version...", showDownloadButton = true, }: VersionSelectorProps) { const [versionPopoverOpen, setVersionPopoverOpen] = useState(false); const isVersionDownloaded = selectedVersion ? downloadedVersions.includes(selectedVersion) : false; return (