-
+ {!npType &&
+
+ Choose NP
+
+ {npTypes.map((npt) =>
+
)}
}
+ {(props.np && props.np.type !== "pronoun" && (props.np.possesor || addingPoss)) &&
+
+
Possesive:
+ {props.np.possesor &&
{
+ props.handleShrinkPossesive(possesiveUid === props.shrunkenPossesiveInPhrase
+ ? undefined
+ : possesiveUid
+ );
+ }}>
+ {possesiveUid === props.shrunkenPossesiveInPhrase ? "👶 Shrunken" : "Shrink"}
+
}
+
{
+ setAddingPoss(false);
+ handlePossesiveChange(undefined);
+ }}>
+
+
+
+
+
}
+ {(npType === "noun" || npType === "participle") && props.np && !addingPoss &&
+ setAddingPoss(true)}>+ Possesive
+
}
{(npType === "pronoun" && props.np?.type === "pronoun")
?
;
}
-// {(npType && !isDynamicComplement) && }
+function checkForNewPossesor(n: T.NPSelection | undefined, old: T.PossesorSelection | undefined): boolean {
+ if (!old || !n) {
+ return true;
+ }
+ if (n.type !== old.np.type) {
+ return true;
+ }
+ if (n.type === "pronoun") return false;
+ if (n.type === "noun" && old.np.type === "noun") {
+ return n.entry.ts !== old.np.entry.ts;
+ }
+ if (n.type === "participle" && old.np.type === "participle") {
+ return n.verb.entry.ts !== old.np.verb.entry.ts;
+ }
+ return false;
+}
+
+// TODO: BETTER UID
+function makeUID() {
+ return Math.floor(Math.random() * 50000);
+}
export default NPPicker;
\ No newline at end of file
diff --git a/src/components/np-picker/NPPronounPicker.tsx b/src/components/np-picker/NPPronounPicker.tsx
index 1d3fce2..2bf8d3a 100644
--- a/src/components/np-picker/NPPronounPicker.tsx
+++ b/src/components/np-picker/NPPronounPicker.tsx
@@ -12,7 +12,7 @@ const gColors = {
};
// TODO: better logic on this
-const labels = (role: "subject" | "object" | "ergative") => ({
+const labels = (role: "subject" | "object" | "ergative" | "possesor") => ({
// persons: [
// ["1st", "1st pl."],
// ["2nd", "2nd pl."],
@@ -20,11 +20,15 @@ const labels = (role: "subject" | "object" | "ergative") => ({
// ],
e: role === "object" ? [
["me", "us"],
- ["you", "you pl."],
+ ["you", "y'all"],
[{ masc: "him/it", fem: "her/it"}, "them"],
+ ] : role === "possesor" ? [
+ ["my", "our"],
+ ["your", "y'all's"],
+ [{ masc: "his/its", fem: "her/its"}, "their"],
] : [
["I", "We"],
- ["You", "You pl."],
+ ["You", "Y'all"],
[{ masc: "He/It", fem: "She/It"}, "They"],
],
p: role === "subject" ? {
@@ -49,6 +53,17 @@ const labels = (role: "subject" | "object" | "ergative") => ({
["ته", "تاسو"],
[{ masc: "دهٔ", fem: "دې" }, "دوي"],
],
+ } : role === "possesor" ? {
+ far: [
+ ["زما", "زمونږ"],
+ ["ستا", "ستاسو"],
+ [{ masc: "د هغهٔ", fem: "د هغې" }, "د هغوي"],
+ ],
+ near: [
+ ["زما", "زمونږ"],
+ ["ستا", "ستاسو"],
+ [{ masc: "د دهٔ", fem: "د دې" }, "د دوي"],
+ ],
} : {
far: [
["ما", "مونږ"],
@@ -79,11 +94,10 @@ function pickerStateToPerson(s: PickerState): T.Person {
+ (6 * s.col);
}
-function NPPronounPicker({ onChange, pronoun, role, clearButton, opts, is2ndPersonPicker }: {
+function NPPronounPicker({ onChange, pronoun, role, opts, is2ndPersonPicker }: {
pronoun: T.PronounSelection,
onChange: (p: T.PronounSelection) => void,
- role: "object" | "subject" | "ergative",
- clearButton?: JSX.Element,
+ role: "object" | "subject" | "ergative" | "possesor",
opts: T.TextOptions,
is2ndPersonPicker?: boolean,
}) {
diff --git a/src/components/np-picker/picker-tools.tsx b/src/components/np-picker/picker-tools.tsx
index c846fd2..f7d780d 100644
--- a/src/components/np-picker/picker-tools.tsx
+++ b/src/components/np-picker/picker-tools.tsx
@@ -106,6 +106,7 @@ export function makeNounSelection(entry: T.NounEntry, dynamicComplement?: true):
number,
numberCanChange: number === "singular",
adjectives: [],
+ possesor: undefined,
dynamicComplement,
};
}
\ No newline at end of file
diff --git a/src/components/vp-explorer/VPExplorer.tsx b/src/components/vp-explorer/VPExplorer.tsx
index 7f0dbfb..478b2b6 100644
--- a/src/components/vp-explorer/VPExplorer.tsx
+++ b/src/components/vp-explorer/VPExplorer.tsx
@@ -45,7 +45,7 @@ export function VPExplorer(props: {
}) {
const [vps, setVps] = useStickyState
(
savedVps => makeVPSelectionState(props.verb, savedVps),
- "vpsState5",
+ "vpsState6",
);
const [mode, setMode] = useStickyState<"charts" | "phrases" | "quiz">(
savedMode => {
@@ -97,6 +97,12 @@ export function VPExplorer(props: {
if (vps.verb?.isCompound === "dynamic") return;
setVps(switchSubjObj)
}
+ function handleShrinkPossesive(shrunkenPossesive: number | undefined) {
+ setVps(o => ({
+ ...o,
+ shrunkenPossesive,
+ }));
+ }
function quizLock(f: T) {
if (mode === "quiz") {
return () => {
@@ -142,10 +148,12 @@ export function VPExplorer(props: {
? "ergative"
: "subject"
}
+ shrunkenPossesiveInPhrase={vps.shrunkenPossesive}
is2ndPersonPicker={vps.verb.tenseCategory === "imperative"}
np={vps.subject}
counterPart={vps.verb ? vps.verb.object : undefined}
onChange={handleSubjectChange}
+ handleShrinkPossesive={handleShrinkPossesive}
opts={props.opts}
/>
@@ -153,6 +161,8 @@ export function VPExplorer(props: {
{(typeof vps.verb.object === "number")
?
Unspoken 3rd Pers. Masc. Plur.