import { SearchableSelect } from "@/components/Select" import { isEnumComplex, isEnumVoid } from "@/utils/shape" import { EditEnum, NOTIN } from "@codec-components" import { Marker } from "../common/Markers" import { useSubtreeFocus } from "../common/SubtreeFocus" export const CEnum: EditEnum = ({ type, value, tags, inner, shape, onValueChanged, path, }) => { const focus = useSubtreeFocus() const sub = focus.getNextPath(path) if (sub) { return inner } const options = tags.map((t) => t.tag).sort() const getOptionType = (option: string) => { const innerType = shape.value[option] if (innerType.type !== "lookupEntry") return "" switch (innerType.value.type) { case "primitive": return ` (${innerType.value.value})` case "compact": return ` (${innerType.value.size})` case "AccountId20": case "AccountId32": return ` (${innerType.value.type})` } return "" } const isComplexShape = type !== "blank" && isEnumComplex(shape, value.type) return (