This commit is contained in:
lingdocs 2022-04-07 16:11:17 +05:00
parent d0850066a2
commit 977f37da71
2 changed files with 15 additions and 6 deletions

View File

@ -23,7 +23,14 @@ function VerbPicker({ onChange, subject, changeSubject, verb, verbs, opts, verbL
verbLocked: boolean, verbLocked: boolean,
}) { }) {
const [showRootsAndStems, setShowRootsAndStems] = useStickyState<boolean>(false, "showRootsAndStems"); const [showRootsAndStems, setShowRootsAndStems] = useStickyState<boolean>(false, "showRootsAndStems");
const info = verb ? getVerbInfo(verb.verb.entry, verb.verb.complement) : undefined; const infoRaw = verb ? getVerbInfo(verb.verb.entry, verb.verb.complement) : undefined;
const info = (!infoRaw || !verb)
? undefined
: ("stative" in infoRaw)
? infoRaw[verb.isCompound === "stative" ? "stative" : "dynamic"]
: ("transitive" in infoRaw)
? infoRaw[verb.transitivity === "grammatically transitive" ? "grammaticallyTransitive" : "transitive"]
: infoRaw;
if (info && ("stative" in info || "transitive" in info)) { if (info && ("stative" in info || "transitive" in info)) {
return <div>ERROR: Verb version should be select first</div>; return <div>ERROR: Verb version should be select first</div>;
} }

View File

@ -8,13 +8,15 @@ import {
} from "../../lib/phrase-building/vp-tools"; } from "../../lib/phrase-building/vp-tools";
function ChartDisplay({ VS, opts }: { VS: VerbSelection, opts: T.TextOptions }) { function ChartDisplay({ VS, opts }: { VS: VerbSelection, opts: T.TextOptions }) {
const conjugations = conjugateVerb(VS.verb.entry, VS.verb.complement); const rawConjugations = conjugateVerb(VS.verb.entry, VS.verb.complement);
if (!conjugations) { if (!rawConjugations) {
return <div>Error conjugating verb</div>; return <div>Error conjugating verb</div>;
} }
if ("stative" in conjugations || "transitive" in conjugations) { const conjugations = ("stative" in rawConjugations)
return <div>Error: compound or transitivity type should be selected first</div>; ? rawConjugations[VS.isCompound === "stative" ? "stative" : "dynamic"]
} : ("transitive" in rawConjugations)
? rawConjugations[VS.transitivity === "grammatically transitive" ? "grammaticallyTransitive" : "transitive"]
: rawConjugations;
const form = getTenseVerbForm(conjugations, VS.tense, VS.tenseCategory, VS.voice); const form = getTenseVerbForm(conjugations, VS.tense, VS.tenseCategory, VS.voice);
return <div className="mb-4"> return <div className="mb-4">
<VerbFormDisplay <VerbFormDisplay