import * as React from "react"; import { ChevronsUpDown, Check } from "lucide-react"; 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"; type ActivityNameComboboxProps = { activities: any[]; value: string; onChange: (value: string) => void; }; export function ActivityNameCombobox({ activities, value, onChange }: ActivityNameComboboxProps) { // Collect unique names from repositoryName and organizationName const names = React.useMemo(() => { const set = new Set(); activities.forEach((a) => { if (a.repositoryName) set.add(a.repositoryName); if (a.organizationName) set.add(a.organizationName); }); return Array.from(set).sort(); }, [activities]); const [open, setOpen] = React.useState(false); return ( No name found. { onChange(""); setOpen(false); }} > All names {names.map((name) => ( { onChange(name); setOpen(false); }} > {name} ))} ); }