diff --git a/package-lock.json b/package-lock.json
index 6d7db95..493978b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "pashto-inflector",
- "version": "5.0.11",
+ "version": "5.0.12",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "pashto-inflector",
- "version": "5.0.11",
+ "version": "5.0.12",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
diff --git a/package.json b/package.json
index 4ceb98d..b0670af 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "pashto-inflector",
- "version": "5.0.11",
+ "version": "5.0.12",
"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 86bf14a..99f64e6 100644
--- a/src/components/package.json
+++ b/src/components/package.json
@@ -1,6 +1,6 @@
{
"name": "@lingdocs/ps-react",
- "version": "5.0.11",
+ "version": "5.0.12",
"description": "Pashto inflector library module with React components",
"main": "dist/components/library.js",
"module": "dist/components/library.js",
diff --git a/src/components/src/vp-explorer/TensePicker.tsx b/src/components/src/vp-explorer/TensePicker.tsx
index c3a50d4..dfc3061 100644
--- a/src/components/src/vp-explorer/TensePicker.tsx
+++ b/src/components/src/vp-explorer/TensePicker.tsx
@@ -1,9 +1,9 @@
-// import Select from "react-select";
+import Select from "react-select";
import * as T from "../../../types";
-// import ButtonSelect from "../ButtonSelect";
+import ButtonSelect from "../ButtonSelect";
import { isImperativeTense, isModalTense, isPerfectTense, isVerbTense } from "../../../lib/src/type-predicates";
-// import useStickyState from "../../lib/useStickyState";
-// import { customStyles } from "../EntrySelect";
+import useStickyState from "../useStickyState";
+import { customStyles } from "../EntrySelect";
import {
VpsReducerAction
} from "../../../lib/src/phrase-building/vps-reducer";
@@ -42,15 +42,15 @@ const verbTenseOptions: { label: string | JSX.Element, value: T.VerbTense, formu
formula: "ba + simple past",
}];
-// function composeFormula(formula: string, prefix: "passive" | "ability"): string {
-// return formula.replace(/^perfective/, `${prefix} perfective`)
-// .replace(/^imperfective/, `${prefix} imperfective`)
-// .replace("continuous", `${prefix} continuous`)
-// .replace("simple", `${prefix} simple`)
-// .replace(/present$/, `${prefix} present`)
-// .replace(/subjunctive$/, `${prefix} subjunctive`)
-// .replace("past participle", `${prefix} past participle`);
-// }
+function composeFormula(formula: string, prefix: "passive" | "ability"): string {
+ return formula.replace(/^perfective/, `${prefix} perfective`)
+ .replace(/^imperfective/, `${prefix} imperfective`)
+ .replace("continuous", `${prefix} continuous`)
+ .replace("simple", `${prefix} simple`)
+ .replace(/present$/, `${prefix} present`)
+ .replace(/subjunctive$/, `${prefix} subjunctive`)
+ .replace("past participle", `${prefix} past participle`);
+}
const perfectTenseOptions: { label: string | JSX.Element, value: T.PerfectTense, formula: string }[] = [{
label: "Present Perfect",
@@ -124,176 +124,175 @@ function TensePicker(props: ({
onChange: (p: VpsReducerAction) => void,
mode: "charts" | "phrases" | "quiz",
}) {
- return
not here
-// const [showFormula, setShowFormula] = useStickyState(false, "showFormula");
-// function onTenseSelect(o: { value: T.VerbTense | T.PerfectTense | T.ImperativeTense } | null) {
-// if ("vpsComplete" in props) return;
-// const tense = o?.value ? o.value : undefined;
-// props.onChange({
-// type: "set tense",
-// payload: tense,
-// });
-// }
-// function moveTense(dir: "forward" | "back") {
-// if ("vpsComplete" in props) return;
-// if (!props.vps.verb) return;
-// return () => {
-// // TODO: ABSTRACT THIS - SAFER
-// const tenses = props.vps.verb.tenseCategory === "perfect"
-// ? perfectTenseOptions
-// : props.vps.verb.tenseCategory === "imperative"
-// ? imperativeTenseOptions
-// : verbTenseOptions;
-// const currIndex = tenses.findIndex(tn => tn.value === props.vps.verb[
-// // TODO: ABSTRACT THIS? - SAFER
-// props.vps.verb.tenseCategory === "perfect"
-// ? "perfectTense"
-// : props.vps.verb.tenseCategory === "imperative"
-// ? "imperativeTense"
-// : "verbTense"
-// ]);
-// if (currIndex === -1) {
-// console.error("error moving tense", dir);
-// return;
-// }
-// const newIndex = dir === "forward"
-// ? ((currIndex + 1) % tenses.length)
-// : (currIndex === 0 ? (tenses.length - 1) : (currIndex - 1))
-// const newTense = tenses[newIndex];
-// onTenseSelect(newTense);
-// };
-// }
-// function onPosNegSelect(payload: "true" | "false") {
-// if ("vpsComplete" in props) return;
-// props.onChange({
-// type: "set negativity",
-// payload,
-// });
-// }
-// function onTenseCategorySelect(payload: "basic" | "modal" | "perfect" | "imperative") {
-// if ("vpsComplete" in props) return;
-// props.onChange({
-// type: "set tense category",
-// payload,
-// });
-// }
-// const tOptions = ("vps" in props && (props.vps.verb?.tenseCategory === "perfect"))
-// ? perfectTenseOptions
-// : ("vps" in props && (props.vps.verb?.tenseCategory === "imperative"))
-// ? imperativeTenseOptions
-// : verbTenseOptions;
-// 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";
-// return
-//
-//
-//
Verb Tense:
-// {canHaveFormula &&
setShowFormula(x => !x)}>
-// 🧪 {!showFormula ? "Show" : "Hide"} Formula
-//
}
-//
-// {("vpsComplete" in props || props.vps.verb) &&
-// !(inPassiveVoice && x.value === "modal"))}
-// handleChange={props.mode !== "quiz" ? onTenseCategorySelect : () => null}
-// />
-//
}
-// {"vpsComplete" in props
-// ?
-// {[...verbTenseOptions, ...perfectTenseOptions, ...imperativeTenseOptions].find(o => o.value === props.vpsComplete.verb.tense)?.label}
-//
-// : <>
-//
-//
;
+ const [showFormula, setShowFormula] = useStickyState(false, "showFormula");
+ function onTenseSelect(o: { value: T.VerbTense | T.PerfectTense | T.ImperativeTense } | null) {
+ if ("vpsComplete" in props) return;
+ const tense = o?.value ? o.value : undefined;
+ props.onChange({
+ type: "set tense",
+ payload: tense,
+ });
+ }
+ function moveTense(dir: "forward" | "back") {
+ if ("vpsComplete" in props) return;
+ if (!props.vps.verb) return;
+ return () => {
+ // TODO: ABSTRACT THIS - SAFER
+ const tenses = props.vps.verb.tenseCategory === "perfect"
+ ? perfectTenseOptions
+ : props.vps.verb.tenseCategory === "imperative"
+ ? imperativeTenseOptions
+ : verbTenseOptions;
+ const currIndex = tenses.findIndex(tn => tn.value === props.vps.verb[
+ // TODO: ABSTRACT THIS? - SAFER
+ props.vps.verb.tenseCategory === "perfect"
+ ? "perfectTense"
+ : props.vps.verb.tenseCategory === "imperative"
+ ? "imperativeTense"
+ : "verbTense"
+ ]);
+ if (currIndex === -1) {
+ console.error("error moving tense", dir);
+ return;
+ }
+ const newIndex = dir === "forward"
+ ? ((currIndex + 1) % tenses.length)
+ : (currIndex === 0 ? (tenses.length - 1) : (currIndex - 1))
+ const newTense = tenses[newIndex];
+ onTenseSelect(newTense);
+ };
+ }
+ function onPosNegSelect(payload: "true" | "false") {
+ if ("vpsComplete" in props) return;
+ props.onChange({
+ type: "set negativity",
+ payload,
+ });
+ }
+ function onTenseCategorySelect(payload: "basic" | "modal" | "perfect" | "imperative") {
+ if ("vpsComplete" in props) return;
+ props.onChange({
+ type: "set tense category",
+ payload,
+ });
+ }
+ const tOptions = ("vps" in props && (props.vps.verb?.tenseCategory === "perfect"))
+ ? perfectTenseOptions
+ : ("vps" in props && (props.vps.verb?.tenseCategory === "imperative"))
+ ? imperativeTenseOptions
+ : verbTenseOptions;
+ 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";
+ return
+
+
+
Verb Tense:
+ {canHaveFormula &&
setShowFormula(x => !x)}>
+ 🧪 {!showFormula ? "Show" : "Hide"} Formula
+
}
+
+ {("vpsComplete" in props || props.vps.verb) &&
+ !(inPassiveVoice && x.value === "modal"))}
+ handleChange={props.mode !== "quiz" ? onTenseCategorySelect : () => null}
+ />
+
}
+ {"vpsComplete" in props
+ ?
+ {[...verbTenseOptions, ...perfectTenseOptions, ...imperativeTenseOptions].find(o => o.value === props.vpsComplete.verb.tense)?.label}
+
+ : <>
+
+
;
}
export default TensePicker;
diff --git a/src/lib/package.json b/src/lib/package.json
index 95aef73..802d0ac 100644
--- a/src/lib/package.json
+++ b/src/lib/package.json
@@ -1,6 +1,6 @@
{
"name": "@lingdocs/inflect",
- "version": "5.0.11",
+ "version": "5.0.12",
"description": "Pashto inflector library",
"main": "dist/index.js",
"types": "dist/lib/library.d.ts",