import { makeNounSelection, } from "./picker-tools"; import * as T from "../../types"; import ButtonSelect from "../ButtonSelect"; import InlinePs from "../InlinePs"; // import { isFemNounEntry, isPattern1Entry, isPattern2Entry, isPattern3Entry, isPattern4Entry, isPattern5Entry, isPattern6FemEntry } from "../../lib/type-predicates"; import EntrySelect from "../EntrySelect"; import AdjectiveManager from "./AdjectiveManager"; // const filterOptions = [ // { // label: "1", // value: "1", // }, // { // label: "2", // value: "2", // }, // { // label: "3", // value: "3", // }, // { // label: "4", // value: "4", // }, // { // label: "5", // value: "5", // }, // { // label: "6", // value: "6", // }, // ]; // type FilterPattern = "1" | "2" | "3" | "4" | "5" | "6"; // function nounFilter(p: FilterPattern | undefined) { // return p === undefined // ? () => true // : (p === "1") // ? isPattern1Entry // : (p === "2") // ? isPattern2Entry // : (p === "3") // ? isPattern3Entry // : (p === "4") // ? isPattern4Entry // : (p === "5") // ? isPattern5Entry // : (p === "6") // ? (n: NounEntry) => (isFemNounEntry(n) && isPattern6FemEntry(n)) // : () => true; // } function NPNounPicker(props: { entryFeeder: T.EntryFeeder, noun: T.NounSelection | undefined, onChange: (p: T.NounSelection | undefined) => void, opts: T.TextOptions, }) { // const [patternFilter, setPatternFilter] = useState(undefined); // const [showFilter, setShowFilter] = useState(false) // const nounsFiltered = props.nouns // .filter(nounFilter(patternFilter)) // .sort((a, b) => (a.p.localeCompare(b.p, "af-PS"))); function onEntrySelect(entry: T.NounEntry | undefined) { if (!entry) { return props.onChange(undefined); } props.onChange(makeNounSelection(entry, props.noun)); } // function handleFilterClose() { // setPatternFilter(undefined); // setShowFilter(false); // } function handelAdjectivesUpdate(adjectives: T.AdjectiveSelection[]) { if (props.noun) { props.onChange({ ...props.noun, adjectives, }); } } return
{/* {showFilter &&
Filter by inflection pattern
X
} */} {props.noun && }
Noun
{!(props.noun && props.noun.dynamicComplement) ?
:
{props.noun &&
Included in Dyn. Compound:
{{ p: props.noun.entry.p, f: props.noun.entry.f }}
{props.noun.entry.e}
}
} {props.noun &&
{props.noun.genderCanChange ? { if (!props.noun || !props.noun.genderCanChange) return; props.onChange({ ...props.noun, gender, }); }} /> : props.noun.gender === "masc" ? "Masc." : "Fem."}
{props.noun.numberCanChange ? { if (!props.noun || !props.noun.numberCanChange) return; props.onChange({ ...props.noun, number, }); }} /> : props.noun.number === "singular" ? "Sing." : "Plur."}
}
; } export default NPNounPicker;