diff --git a/package-lock.json b/package-lock.json
index 493978b..e76512b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "pashto-inflector",
- "version": "5.0.12",
+ "version": "5.1.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "pashto-inflector",
- "version": "5.0.12",
+ "version": "5.1.0",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
diff --git a/package.json b/package.json
index b0670af..2e9a85a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "pashto-inflector",
- "version": "5.0.12",
+ "version": "5.1.0",
"author": "lingdocs.com",
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
"homepage": "https://verbs.lingdocs.com",
diff --git a/src/components/package.json b/src/components/package.json
index 99f64e6..2e3a03c 100644
--- a/src/components/package.json
+++ b/src/components/package.json
@@ -1,6 +1,6 @@
{
"name": "@lingdocs/ps-react",
- "version": "5.0.12",
+ "version": "5.1.0",
"description": "Pashto inflector library module with React components",
"main": "dist/components/library.js",
"module": "dist/components/library.js",
diff --git a/src/components/src/Hider.tsx b/src/components/src/Hider.tsx
index e04e0ec..560da2c 100644
--- a/src/components/src/Hider.tsx
+++ b/src/components/src/Hider.tsx
@@ -21,7 +21,7 @@ const defaultLevel = 4;
const indentAfterLevel = 5;
function Hider(props: {
- label: string,
+ label: string | JSX.Element,
showing: boolean,
aspect?: T.Aspect,
handleChange: () => void,
@@ -48,14 +48,16 @@ function Hider(props: {
extraMargin,
),
},
- <>
+
{props.showing ? caretDown : caretRight}
{` `}
{props.aspect
- ?
+ ?
: ""}
- {props.label}
- >,
+
+ {props.label}
+
+
,
)}
{props.showing && props.children}
diff --git a/src/components/src/vp-explorer/AllTensesDisplay.tsx b/src/components/src/vp-explorer/AllTensesDisplay.tsx
new file mode 100644
index 0000000..c587641
--- /dev/null
+++ b/src/components/src/vp-explorer/AllTensesDisplay.tsx
@@ -0,0 +1,58 @@
+import { abilityTenseOptions, imperativeTenseOptions, perfectTenseOptions, verbTenseOptions } from "./verbTenseOptions";
+import ChartDisplay from "./VPChartDisplay";
+import Hider from "../Hider";
+import * as T from "../../../types";
+import useStickyState from "../useStickyState";
+import { isModalTense, isPerfectTense, isVerbTense } from "../../../lib/src/type-predicates";
+
+function AllTensesDisplay({ VS, opts }: { VS: T.VerbSelection, opts: T.TextOptions }) {
+ const [showing, setShowing] = useStickyState([], "tensesShowing");
+ const [showFormulas, setShowFormulas] = useStickyState(false, "showFormulasWithCharts");
+ const adjustShowing = (v: string) => {
+ if (showing.includes(v)) {
+ setShowing(os => os.filter(x => x !== v));
+ } else {
+ setShowing(os => [v, ...os]);
+ }
+ }
+ const options = VS.tenseCategory === "basic"
+ ? verbTenseOptions
+ : VS.tenseCategory === "perfect"
+ ? perfectTenseOptions
+ : VS.tenseCategory === "modal"
+ ? abilityTenseOptions
+ : imperativeTenseOptions;
+ return
+
setShowFormulas(x => !x)}>
+ {!showFormulas ? "Show" : "Hide"} Formulas
+
+ {options.map((tense) =>
+
adjustShowing(tense.value)}
+ hLevel={5}
+ >
+ {showFormulas &&
+ 🧪 {tense.formula}
+
}
+
+
+
)}
+
;
+}
+
+export default AllTensesDisplay;
\ No newline at end of file
diff --git a/src/components/src/vp-explorer/TensePicker.tsx b/src/components/src/vp-explorer/TensePicker.tsx
index dfc3061..aee1370 100644
--- a/src/components/src/vp-explorer/TensePicker.tsx
+++ b/src/components/src/vp-explorer/TensePicker.tsx
@@ -7,40 +7,7 @@ import { customStyles } from "../EntrySelect";
import {
VpsReducerAction
} from "../../../lib/src/phrase-building/vps-reducer";
-
-const verbTenseOptions: { label: string | JSX.Element, value: T.VerbTense, formula: string }[] = [{
- label: present
,
- value: "presentVerb",
- formula: "imperfective stem + present verb ending",
-}, {
- label: subjunctive
,
- value: "subjunctiveVerb",
- formula: "perfective stem + present verb ending",
-}, {
- label: imperfective future
,
- value: "imperfectiveFuture",
- formula: "ba + present",
-}, {
- label: perfective future
,
- value: "perfectiveFuture",
- formula: "ba + subjunctive",
-}, {
- label: continuous past
,
- value: "imperfectivePast",
- formula: "imperfective root + past verb ending",
-}, {
- label: simple past
,
- value: "perfectivePast",
- formula: "perfective root + past verb ending",
-}, {
- label: habitual continual past
,
- value: "habitualImperfectivePast",
- formula: "ba + continuous past",
-}, {
- label: habitual simple past
,
- value: "habitualPerfectivePast",
- formula: "ba + simple past",
-}];
+import { imperativeTenseOptions, perfectTenseOptions, verbTenseOptions } from "./verbTenseOptions";
function composeFormula(formula: string, prefix: "passive" | "ability"): string {
return formula.replace(/^perfective/, `${prefix} perfective`)
@@ -52,50 +19,6 @@ function composeFormula(formula: string, prefix: "passive" | "ability"): string
.replace("past participle", `${prefix} past participle`);
}
-const perfectTenseOptions: { label: string | JSX.Element, value: T.PerfectTense, formula: string }[] = [{
- label: "Present Perfect",
- value: "presentPerfect",
- formula: "past participle + present equative",
-}, {
- label: "Habitual Perfect",
- value: "habitualPerfect",
- formula: "past participle + habitual equative",
-}, {
- label: "Subjunctive Perfect",
- value: "subjunctivePerfect",
- formula: "past participle + subjunctive equative",
-}, {
- label: "Future Perfect",
- value: "futurePerfect",
- formula: "past participle + future equative",
-}, {
- label: "Past Perfect",
- value: "pastPerfect",
- formula: "past participle + past equative",
-}, {
- label: `"Would Be" Perfect`,
- value: "wouldBePerfect",
- formula: `past participle + "would be" equative`,
-}, {
- label: "Past Subjunctive Perfect",
- value: "pastSubjunctivePerfect",
- formula: "past participle + past subjunctive equative",
-}, {
- label: `"Would Have Been" Perfect`,
- value: "wouldHaveBeenPerfect",
- formula: `past participle + "would have been" equative`,
-}];
-
-const imperativeTenseOptions: { label: string | JSX.Element, value: T.ImperativeTense, formula: string }[] = [{
- label: imperfective imperative
,
- value: "imperfectiveImperative",
- formula: "imperfective stem + imperative ending",
-}, {
- label: perfective imperative
,
- value: "perfectiveImperative",
- formula: "perfective stem + imperative ending",
-}];
-
export function getRandomTense(o?: T.PerfectTense | T.VerbTense | T.ModalTense | T.ImperativeTense): T.PerfectTense | T.VerbTense | T.ModalTense | T.ImperativeTense {
let tns: T.PerfectTense | T.VerbTense | T.ModalTense | T.ImperativeTense;
const oldTenseCategory = !o
@@ -184,11 +107,18 @@ function TensePicker(props: ({
const showImperativeOption = ("vps" in props && props.vps.verb.voice === "active")
|| ("vpsComplete" in props && props.vpsComplete.verb.voice !== "active");
const inPassiveVoice = ("vps" in props && props.vps.verb.voice === "passive") || ("vpsComplete" in props && props.vpsComplete.verb.voice === "passive");;
- const canHaveFormula = "vps" in props && props.mode !== "quiz";
+ const inAllTensesMode = props.mode === "charts";
+ const canHaveFormula = "vps" in props
+ && props.mode !== "quiz"
+ && !inAllTensesMode;
return
-
Verb Tense:
+
+ {props.mode === "charts"
+ ? "Tense Category:"
+ : "Verb Tense:"}
+
{canHaveFormula &&
setShowFormula(x => !x)}>
🧪 {!showFormula ? "Show" : "Hide"} Formula
}
@@ -230,7 +160,7 @@ function TensePicker(props: ({
{[...verbTenseOptions, ...perfectTenseOptions, ...imperativeTenseOptions].find(o => o.value === props.vpsComplete.verb.tense)?.label}
: <>
-