gender on nouns in selector
This commit is contained in:
parent
c30ff70340
commit
a97b85863e
|
@ -10,7 +10,7 @@ import {
|
||||||
ButtonSelect,
|
ButtonSelect,
|
||||||
Types as T,
|
Types as T,
|
||||||
} from "@lingdocs/pashto-inflector";
|
} from "@lingdocs/pashto-inflector";
|
||||||
import { isPluralEntry } from "../../lib/type-predicates";
|
import { isFemNoun, isMascNoun, isPluralEntry } from "../../lib/type-predicates";
|
||||||
import Select from "react-select";
|
import Select from "react-select";
|
||||||
|
|
||||||
const zIndexProps = {
|
const zIndexProps = {
|
||||||
|
@ -111,29 +111,33 @@ export function SubjectSelector({ state, dispatch }: {
|
||||||
placeholder={options.find(o => o.value === subject?.ts.toString())?.label}
|
placeholder={options.find(o => o.value === subject?.ts.toString())?.label}
|
||||||
{...zIndexProps}
|
{...zIndexProps}
|
||||||
/>
|
/>
|
||||||
<div className="d-flex flex-row justify-content-center">
|
<div className="d-flex flex-row justify-content-center mt-3">
|
||||||
{state.subjectType !== "participle" && <div className={state.subjectType === "unisexNoun" ? "mr-2" : ""}>
|
{state.subjectType !== "participle" && <>
|
||||||
<ButtonSelect
|
<div className="mr-2">
|
||||||
small
|
<ButtonSelect
|
||||||
options={[
|
small
|
||||||
...!pluralNounSelected ? [{ label: "Singular", value: "singular" }] : [],
|
options={[
|
||||||
{ label: "Plural", value: "plural" },
|
...(state.subjectType === "unisexNoun" || ("noun" && isMascNoun(state.subjectsSelected[state.subjectType])))
|
||||||
]}
|
? [{ label: "Masc.", value: "masc" }] : [],
|
||||||
value={(state.subjectsSelected.info.plural || pluralNounSelected) ? "plural" : "singular"}
|
...(state.subjectType === "unisexNoun" || ("noun" && isFemNoun(state.subjectsSelected[state.subjectType])))
|
||||||
handleChange={(p) => dispatch({ type: "setSubjectPlural", payload: p === "plural" ? true : false })}
|
? [{ label: "Fem.", value: "fem" }] : [],
|
||||||
/>
|
]}
|
||||||
</div>}
|
value={state.subjectType === "noun" ? (isMascNoun(state.subjectsSelected[state.subjectType]) ? "masc" : "fem") : state.subjectsSelected.info.gender}
|
||||||
{state.subjectType === "unisexNoun" && <div className="ml-2">
|
handleChange={state.subjectType === "noun" ? p => null : (p) => dispatch({ type: "setSubjectGender", payload: p as T.Gender })}
|
||||||
<ButtonSelect
|
/>
|
||||||
small
|
</div>
|
||||||
options={[
|
<div className="ml-2">
|
||||||
{ label: "Masc.", value: "masc" },
|
<ButtonSelect
|
||||||
{ label: "Fem.", value: "fem" },
|
small
|
||||||
]}
|
options={[
|
||||||
value={state.subjectsSelected.info.gender}
|
...!pluralNounSelected ? [{ label: "Singular", value: "singular" }] : [],
|
||||||
handleChange={(p) => dispatch({ type: "setSubjectGender", payload: p as T.Gender })}
|
{ label: "Plural", value: "plural" },
|
||||||
/>
|
]}
|
||||||
</div>}
|
value={(state.subjectsSelected.info.plural || pluralNounSelected) ? "plural" : "singular"}
|
||||||
|
handleChange={(p) => dispatch({ type: "setSubjectPlural", payload: p === "plural" ? true : false })}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</>}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue