inflector bump

This commit is contained in:
lingdocs 2022-04-03 19:37:47 +05:00
parent 474f77c351
commit 03c7a8ba02
3 changed files with 12 additions and 17 deletions

View File

@ -5,7 +5,7 @@
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": "^5.15.4", "@fortawesome/fontawesome-free": "^5.15.4",
"@lingdocs/lingdocs-main": "^0.2.0", "@lingdocs/lingdocs-main": "^0.2.0",
"@lingdocs/pashto-inflector": "^1.6.7", "@lingdocs/pashto-inflector": "^1.6.8",
"@testing-library/jest-dom": "^5.11.4", "@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0", "@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10", "@testing-library/user-event": "^12.1.10",

View File

@ -92,8 +92,9 @@ function VerbPicker({ onChange, subject, changeSubject, verb, verbs }: {
} }
onChange(makeVerbSelection(v, changeSubject, verb)); onChange(makeVerbSelection(v, changeSubject, verb));
} }
function onTenseSelect({ value }: { label: string | JSX.Element, value: VerbTense | PerfectTense }) { function onTenseSelect(o: { value: VerbTense | PerfectTense } | null) {
if (verb) { const value = o?.value ? o.value : undefined;
if (verb && value) {
if (isPerfectTense(value)) { if (isPerfectTense(value)) {
onChange({ onChange({
...verb, ...verb,
@ -174,6 +175,7 @@ function VerbPicker({ onChange, subject, changeSubject, verb, verbs }: {
onChange(verb.changeStatDyn(c)); onChange(verb.changeStatDyn(c));
} }
} }
const tOptions = (verb?.tenseCategory === "perfect") ? perfectTenseOptions : tenseOptions;
return <div style={{ maxWidth: "225px", minWidth: "175px" }}> return <div style={{ maxWidth: "225px", minWidth: "175px" }}>
<div>Verb:</div> <div>Verb:</div>
<Select <Select
@ -236,18 +238,11 @@ function VerbPicker({ onChange, subject, changeSubject, verb, verbs }: {
<div>Tense:</div> <div>Tense:</div>
<Select <Select
isSearchable={false} isSearchable={false}
value={verb && verb.tense} // for some reason can't use tOptions with find here;
// @ts-ignore value={verb && ([...tenseOptions, ...perfectTenseOptions].find(o => o.value === verb.tense))}
onChange={onTenseSelect} onChange={onTenseSelect}
className="mb-2" className="mb-2"
// @ts-ignore options={tOptions}
options={verb?.tenseCategory === "perfect" ? perfectTenseOptions : tenseOptions}
placeholder={verb ? (() => {
const label = (verb.tenseCategory === "perfect")
? perfectTenseOptions.find(o => o.value === verb.tense)?.label
: tenseOptions.find(o => o.value === verb.tense)?.label;
return label || "Select Tense...";
})() : undefined}
{...zIndexProps} {...zIndexProps}
/> />
{verb && verb.changeStatDyn && <div className="text-center"> {verb && verb.changeStatDyn && <div className="text-center">

View File

@ -1684,10 +1684,10 @@
pbf "^3.2.1" pbf "^3.2.1"
rambda "^6.7.0" rambda "^6.7.0"
"@lingdocs/pashto-inflector@^1.6.7": "@lingdocs/pashto-inflector@^1.6.8":
version "1.6.7" version "1.6.8"
resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-1.6.7.tgz#958d7cf8a27db44f960d0a76a9b8f04a9537b5a3" resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-1.6.8.tgz#adc94c84c49cc067e26fb3066fae2a13b9d25d03"
integrity sha512-DnhSL2Uiphm+z2Y0eTVsYCtq73JG+eqf00Txo1fDx0928w7dRQuaaTquuiuk2W+HSR/HuGTTDi+yHjRTMDj13w== integrity sha512-BGzMP0URWm6fEGdUUX653oImSMEkn11S/3vxeQILrQDCUNjGpNPQlORF27OlzCs8+n9lDBMDQHVjfhBlAZFN4w==
dependencies: dependencies:
classnames "^2.2.6" classnames "^2.2.6"
pbf "^3.2.1" pbf "^3.2.1"