"use client"; import { ChevronDown, Globe } from "lucide-react"; import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, } from "@/components/ui/dropdown-menu"; import { Button } from "@/components/ui/button"; import { AlgorithmKey, LanguageCode } from "@/lib/types"; const ALGORITHMS: { key: AlgorithmKey; label: string }[] = [ { key: "bubble", label: "Bubble Sort" }, { key: "insertion", label: "Insertion Sort" }, { key: "merge", label: "Merge Sort" }, { key: "heap", label: "Heap Sort" }, { key: "quick", label: "Quick Sort" }, { key: "radix", label: "Radix Sort" }, { key: "counting", label: "Counting Sort" }, { key: "bucket", label: "Bucket Sort" }, { key: "shell", label: "Shell Sort" }, ]; const LANGUAGES: LanguageCode[] = ["en", "fr", "it", "de", "es", "ja", "no", "sv", "ua", "ru"]; interface AlgorithmPickerProps { value: AlgorithmKey; onChange: (key: AlgorithmKey) => void; triggerLabel: string; } export function AlgorithmPicker({ value, onChange, triggerLabel }: AlgorithmPickerProps) { const current = ALGORITHMS.find((a) => a.key === value)?.label ?? triggerLabel; return ( onChange(v as AlgorithmKey)}> {ALGORITHMS.map((a) => ( {a.label} ))} ); } interface LanguagePickerProps { value: LanguageCode; onChange: (lang: LanguageCode) => void; } export function LanguagePicker({ value, onChange }: LanguagePickerProps) { return ( onChange(v as LanguageCode)}> {LANGUAGES.map((lang) => ( {lang.toUpperCase()} ))} ); }