From 977f37da710598823018cffab851e3c20936ebf9 Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Thu, 7 Apr 2022 16:11:17 +0500 Subject: [PATCH] fixed --- src/components/VerbPicker.tsx | 9 ++++++++- src/components/phrase-builder/ChartDisplay.tsx | 12 +++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/components/VerbPicker.tsx b/src/components/VerbPicker.tsx index e8de5e1..3276532 100644 --- a/src/components/VerbPicker.tsx +++ b/src/components/VerbPicker.tsx @@ -23,7 +23,14 @@ function VerbPicker({ onChange, subject, changeSubject, verb, verbs, opts, verbL verbLocked: boolean, }) { const [showRootsAndStems, setShowRootsAndStems] = useStickyState(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)) { return
ERROR: Verb version should be select first
; } diff --git a/src/components/phrase-builder/ChartDisplay.tsx b/src/components/phrase-builder/ChartDisplay.tsx index 74554b9..6faeeb1 100644 --- a/src/components/phrase-builder/ChartDisplay.tsx +++ b/src/components/phrase-builder/ChartDisplay.tsx @@ -8,13 +8,15 @@ import { } from "../../lib/phrase-building/vp-tools"; function ChartDisplay({ VS, opts }: { VS: VerbSelection, opts: T.TextOptions }) { - const conjugations = conjugateVerb(VS.verb.entry, VS.verb.complement); - if (!conjugations) { + const rawConjugations = conjugateVerb(VS.verb.entry, VS.verb.complement); + if (!rawConjugations) { return
Error conjugating verb
; } - if ("stative" in conjugations || "transitive" in conjugations) { - return
Error: compound or transitivity type should be selected first
; - } + const conjugations = ("stative" in rawConjugations) + ? 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); return