import { Combobox, Transition } from '@headlessui/react' import clsx from 'clsx' import { FormControl } from 'components/FormControl' import type { ExecuteListItem } from 'contracts/baseMinter/messages/execute' import { EXECUTE_LIST } from 'contracts/baseMinter/messages/execute' import { matchSorter } from 'match-sorter' import { Fragment, useState } from 'react' import { FaChevronDown, FaInfoCircle } from 'react-icons/fa' export interface ExecuteComboboxProps { value: ExecuteListItem | null onChange: (item: ExecuteListItem) => void } export const ExecuteCombobox = ({ value, onChange }: ExecuteComboboxProps) => { const [search, setSearch] = useState('') const filtered = search === '' ? EXECUTE_LIST : matchSorter(EXECUTE_LIST, search, { keys: ['id', 'name', 'description'] }) return (
val?.name ?? ''} id="message-type" onChange={(event) => setSearch(event.target.value)} placeholder="Select message type" /> {({ open }) => setSearch('')} as={Fragment}> {filtered.length < 1 && ( Message type not found. )} {filtered.map((entry) => ( clsx('flex relative flex-col py-2 px-4 space-y-1 cursor-pointer', { 'bg-stargaze-80': active }) } value={entry} > {entry.name} {entry.description} ))}
{value && (
{value.description}
)}
) }