From d3647ee0d5d88ae5f01a7e1178ad37d30681a971 Mon Sep 17 00:00:00 2001
From: lingdocs <71590811+lingdocs@users.noreply.github.com>
Date: Mon, 5 Jul 2021 11:21:57 +0300
Subject: [PATCH] support for English phrasal verbs
---
package.json | 2 +-
src/App.tsx | 1 +
src/components/ConjugationViewer.tsx | 8 +++-
src/components/Examples.tsx | 16 ++++++-
src/components/SingleItemDisplay.tsx | 2 +-
src/components/TableCell.tsx | 4 +-
src/lib/add-pronouns.ts | 8 ++--
src/lib/conjugation-forms.tsx | 66 ++++++++++++++--------------
src/lib/misc-helpers.ts | 7 +--
src/types.ts | 12 +++--
10 files changed, 74 insertions(+), 52 deletions(-)
diff --git a/package.json b/package.json
index 524ceba..19bf30b 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@lingdocs/pashto-inflector",
- "version": "0.5.2",
+ "version": "0.5.3",
"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/App.tsx b/src/App.tsx
index a8d9fbc..6501b64 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -312,6 +312,7 @@ function App() {
conjugation={conjugation}
textOptions={textOptions}
ec={v ? v.verb.entry.ec : undefined}
+ ep={v ? v.verb.entry.ep : undefined}
/>}
diff --git a/src/components/ConjugationViewer.tsx b/src/components/ConjugationViewer.tsx
index b1fbaf6..0b7167c 100644
--- a/src/components/ConjugationViewer.tsx
+++ b/src/components/ConjugationViewer.tsx
@@ -171,10 +171,11 @@ const initialState: State = {
formsOpened: [],
};
-function ConjugationViewer({ conjugation, textOptions, ec }: {
+function ConjugationViewer({ conjugation, textOptions, ec, ep }: {
conjugation: T.VerbOutput,
textOptions: T.TextOptions,
ec?: string | undefined,
+ ep?: string | undefined,
}) {
const [state, dispatch] = useReducer(reducer, initialState);
useEffect(() => {
@@ -196,7 +197,10 @@ function ConjugationViewer({ conjugation, textOptions, ec }: {
const verbConj = (verbConj1.singularForm && state.compoundComplementVersionSelected === "sing")
? verbConj1.singularForm
: verbConj1;
- const englishConjugation = parseEc(ec);
+ const englishConjugation: T.EnglishVerbConjugation | undefined = ec ? {
+ ec: parseEc(ec),
+ ep: ep,
+ } : undefined;
useEffect(() => {
localStorage.setItem(stateLocalStorageName, JSON.stringify(state));
diff --git a/src/components/Examples.tsx b/src/components/Examples.tsx
index 90803dd..42a4a6b 100644
--- a/src/components/Examples.tsx
+++ b/src/components/Examples.tsx
@@ -12,6 +12,18 @@ import * as T from "../types";
type PsStringWSub = T.PsString & { sub?: any };
+function EnglishContent({ children }: { children: (string | JSX.Element)[] | (string | JSX.Element) }) {
+ if (Array.isArray(children)) {
+ console.log(children);
+ return <>
+ {children.map((x) => {x})}
+ >
+ }
+ return
+ {children}
+
;
+}
+
function Examples({
children,
ex,
@@ -30,9 +42,9 @@ function Examples({
- {text.e &&
+ {text.e &&
{text.e}
-
}
+ }
{text.sub &&
{text.sub}
}
diff --git a/src/components/SingleItemDisplay.tsx b/src/components/SingleItemDisplay.tsx
index 481b894..76cf574 100644
--- a/src/components/SingleItemDisplay.tsx
+++ b/src/components/SingleItemDisplay.tsx
@@ -19,7 +19,7 @@ function SingleItemDisplay({ item, textOptions, english }: {
return
- {eng &&
{eng}
}
+ {eng &&
{eng}
}
;
}
diff --git a/src/components/TableCell.tsx b/src/components/TableCell.tsx
index 5498c91..7c506c5 100644
--- a/src/components/TableCell.tsx
+++ b/src/components/TableCell.tsx
@@ -35,7 +35,9 @@ function TableCell({ item, textOptions, center, noBorder }: {
- {w.e && {w.e}
}
+ {w.e && (Array.isArray(w.e)
+ ? w.e.map(e => {e}
)
+ : {w.e}
)}
{item.length > 1 &&