From a17183db8183b3eeb7991065ed0af920764576c3 Mon Sep 17 00:00:00 2001
From: lingdocs <71590811+lingdocs@users.noreply.github.com>
Date: Thu, 14 Apr 2022 13:12:10 +0500
Subject: [PATCH] more info and compound info
---
package.json | 2 +-
src/App.tsx | 1 +
.../vp-explorer/CompoundDisplay.tsx | 102 ++++++++++++++++++
src/components/vp-explorer/VPExplorer.tsx | 6 +-
src/components/vp-explorer/VerbPicker.tsx | 8 +-
src/lib/irregular-conjugations.ts | 18 ++++
src/lib/type-predicates.ts | 2 +-
src/lib/verb-info.ts | 15 +++
src/types.ts | 1 +
9 files changed, 150 insertions(+), 5 deletions(-)
create mode 100644 src/components/vp-explorer/CompoundDisplay.tsx
diff --git a/package.json b/package.json
index a5515ea..b26a09e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@lingdocs/pashto-inflector",
- "version": "2.0.5",
+ "version": "2.0.6",
"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 46f30f9..5eb6bd2 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -259,6 +259,7 @@ function App() {
{v?.verb.entry &&
+
+ {a}
+
+
+ +
+
+
+ {b}
+
+
+ );
+}
+
+function CompoundDisplay({ info, opts, handleLinkClick }: {
+ info: T.NonComboVerbInfo,
+ opts: T.TextOptions,
+ handleLinkClick: ((ts: number) => void) | 0,
+}) {
+ const isComplement = ("complement" in info || "objComplement" in info);
+ if (!isComplement) {
+ return null;
+ }
+ const complement = ((): T.PsString => {
+ if ("objComplement" in info) {
+ return info.objComplement.plural
+ ? info.objComplement.plural
+ : info.objComplement.entry;
+ }
+ if ("complement" in info) {
+ return info.complement.masc[0][0];
+ }
+ else return makePsString("aa", "aa");
+ })();
+ const aux = ((): { ps: T.PsString, e: string } => {
+ if (info.type === "stative compound" || info.type === "generative stative compound") {
+ return info.transitivity === "transitive"
+ ? { ps: { p: "کول", f: "kawul" }, e: "to make"}
+ : { ps: { p: "کېدل", f: "kedul" }, e: "to become"};
+ }
+ if (!("auxVerb" in info)) return { ps: {p: "", f: ""}, e: ""};
+ const kawulDyn = info.type === "dynamic compound" && info.auxVerb.p === "کول";
+ return {
+ ps: makePsString(info.auxVerb.p, info.auxVerb.f),
+ e: kawulDyn ? "to do" : "",
+ }
+ })();
+ return (
+
+
{info.type}
+
handleLinkClick(info.entry.complement?.ts)
+ : undefined}
+ >
+
+
+ {info.entry.complement?.c}
+ {info.type === "dynamic compound" &&
+ (Object)
+
}
+ }
+ b={ handleLinkClick(info.entry.entry.ts)
+ : undefined}>
+
+
+ {aux.e &&
{aux.e}
}
+
}
+ />
+
+ );
+}
+
+export default CompoundDisplay;
\ No newline at end of file
diff --git a/src/components/vp-explorer/VPExplorer.tsx b/src/components/vp-explorer/VPExplorer.tsx
index 1b4f770..a683859 100644
--- a/src/components/vp-explorer/VPExplorer.tsx
+++ b/src/components/vp-explorer/VPExplorer.tsx
@@ -39,6 +39,7 @@ const servantIcon = ;
export function VPExplorer(props: {
verb: T.VerbEntry,
opts: T.TextOptions,
+ handleLinkClick: ((ts: number) => undefined) | 0,
} & ({
nouns: T.NounEntry[],
verbs: T.VerbEntry[],
@@ -119,6 +120,7 @@ export function VPExplorer(props: {
vps={vps}
onChange={quizLock(setVps)}
opts={props.opts}
+ handleLinkClick={props.handleLinkClick}
/>
{roles.king === "subject"
? setShowingKingExplanation("subject")}>Subject {kingIcon}
- : setShowingKingExplanation("subject")}>Subject {servantIcon}
}
+ : setShowingServantExplanation("subject")}>Subject {servantIcon}
}
king {kingIcon} of the phrase. That means that:
-
-
It controls the verb conjugation. The verb agrees with the gender and number of the king.
+ It controls the verb conjugation. The verb agrees with the gender and number of the king.
-
👍 It can be removed / left out from the phrase.
diff --git a/src/components/vp-explorer/VerbPicker.tsx b/src/components/vp-explorer/VerbPicker.tsx
index 019eea8..6301799 100644
--- a/src/components/vp-explorer/VerbPicker.tsx
+++ b/src/components/vp-explorer/VerbPicker.tsx
@@ -4,7 +4,7 @@ import { RootsAndStems } from "../verb-info/VerbInfo";
import { getVerbInfo } from "../../lib/verb-info";
import Hider from "../Hider";
import useStickyState from "../../lib/useStickyState";
-
+import CompoundDisplay from "./CompoundDisplay";
// TODO: dark on past tense selecitons
@@ -12,6 +12,7 @@ function VerbPicker(props: {
vps: T.VPSelection,
onChange: (p: T.VPSelection) => void,
opts: T.TextOptions,
+ handleLinkClick: ((ts: number) => void) | 0,
}) {
const [showRootsAndStems, setShowRootsAndStems] = useStickyState(false, "showRootsAndStems");
const infoRaw = props.vps.verb ? getVerbInfo(props.vps.verb.verb.entry, props.vps.verb.verb.complement) : undefined;
@@ -60,6 +61,11 @@ function VerbPicker(props: {
}
}
return