From 2a6a4a9918c58692bf2ecb1b806fc150d6225b83 Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Sat, 23 Apr 2022 12:19:08 +0500 Subject: [PATCH] add modal formulas --- src/components/vp-explorer/TensePicker.tsx | 24 ++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/components/vp-explorer/TensePicker.tsx b/src/components/vp-explorer/TensePicker.tsx index 1b4d3ae..81d326c 100644 --- a/src/components/vp-explorer/TensePicker.tsx +++ b/src/components/vp-explorer/TensePicker.tsx @@ -6,38 +6,46 @@ import { ensure2ndPersSubjPronounAndNoConflict } from "../../lib/phrase-building import useStickyState from "../../lib/useStickyState"; import { customStyles } from "../EntrySelect"; -const verbTenseOptions: { label: string | JSX.Element, value: T.VerbTense, formula: string }[] = [{ +const verbTenseOptions: { label: string | JSX.Element, value: T.VerbTense, formula: string, modalFormula: string, }[] = [{ label:
present
, value: "presentVerb", formula: "imperfective stem + present verb ending", + modalFormula: `imperfective root + tail + kedul "to become" subjunctive`, }, { label:
subjunctive
, value: "subjunctiveVerb", formula: "perfective stem + present verb ending", + modalFormula: `perfective root + tail + kedul "to become" subjunctive`, }, { label:
imperfective future
, value: "imperfectiveFuture", formula: "ba + present", + modalFormula: `ba + present modal`, }, { label:
perfective future
, value: "perfectiveFuture", formula: "ba + subjunctive", + modalFormula: `ba + subjunctive modal`, }, { label:
continuous past
, value: "imperfectivePast", formula: "imperfective root + past verb ending", + modalFormula: `imperfective root + tail + kedul "to become" simple past`, }, { label:
simple past
, value: "perfectivePast", formula: "perfective root + past verb ending", + modalFormula: `perfective root + tail + kedul "to become" simple past`, }, { label:
habitual continual past
, value: "habitualImperfectivePast", formula: "ba + contiunous past", + modalFormula: `ba + imperfective past modal`, }, { label:
habitual simple past
, value: "habitualPerfectivePast", formula: "ba + simple past", + modalFormula: `ba + perfective past modal`, }]; const perfectTenseOptions: { label: string | JSX.Element, value: T.PerfectTense, formula: string }[] = [{ @@ -216,12 +224,11 @@ function TensePicker(props: ({ : verbTenseOptions; const showImperativeOption = ("vps" in props && props.vps.verb.voice === "active") || ("vpsComplete" in props && props.vpsComplete.verb.voice !== "active"); - const canShowFormula = "vps" in props && props.vps.verb.tenseCategory !== "modal"; return
Tense:
- {canShowFormula &&
setShowFormula(x => !x)}> + {"vps" in props &&
setShowFormula(x => !x)}> 🧪 {!showFormula ? "Show" : "Hide"} Formula
}
@@ -298,7 +305,7 @@ function TensePicker(props: ({
} - {(canShowFormula && "vps" in props && showFormula && props.vps.verb.tenseCategory !== "modal") && (() => { + {("vps" in props && showFormula) && (() => { // TODO: Be able to show modal formulas too const curr = (props.vps.verb.tenseCategory === "imperative" && props.vps.verb.negative) ? imperativeTenseOptions.find(x => x.value === "imperfectiveImperative") @@ -309,9 +316,14 @@ function TensePicker(props: ({ ? "imperativeTense" : "verbTense" ]); + const formula = !curr + ? "" + : ("modalFormula" in curr && props.vps.verb.tenseCategory === "modal") + ? curr.modalFormula + : curr.formula; if (curr && "formula" in curr) { - return
- {curr.formula} + return
+ {formula}
} })()}