{rw.map((r, j) => {
- const active = (p.row === i && p.col === j)
+ const active = is2ndPersonPicker
+ ? (p.col === j)
+ : (p.row === i && p.col === j);
return handleClick(i, j)}
+ onClick={() => {
+ handleClick(is2ndPersonPicker ? 1 : i, j);
+ }}
className={classNames({ "table-active": active, "text-on-gender-color": active })}
style={{
backgroundColor: active ? gColors[p.gender] : "inherit",
diff --git a/src/components/vp-explorer/ChartDisplay.tsx b/src/components/vp-explorer/ChartDisplay.tsx
index c610798..039c4c4 100644
--- a/src/components/vp-explorer/ChartDisplay.tsx
+++ b/src/components/vp-explorer/ChartDisplay.tsx
@@ -16,7 +16,7 @@ function ChartDisplay({ VS, opts }: { VS: T.VerbSelection, opts: T.TextOptions }
: ("transitive" in rawConjugations)
? rawConjugations[VS.transitivity === "grammatically transitive" ? "grammaticallyTransitive" : "transitive"]
: rawConjugations;
- const form = getTenseVerbForm(conjugations, getTenseFromVerbSelection(VS), VS.voice);
+ const form = getTenseVerbForm(conjugations, getTenseFromVerbSelection(VS), VS.voice, VS.negative);
return
present ,
@@ -55,8 +56,16 @@ const perfectTenseOptions: { label: string | JSX.Element, value: T.PerfectTense
value: "pastSubjunctivePerfect",
}];
-export function getRandomTense(o?: T.PerfectTense | T.VerbTense | T.ModalTense): T.PerfectTense | T.VerbTense | T.ModalTense {
- let tns: T.PerfectTense | T.VerbTense | T.ModalTense;
+const imperativeTenseOptions: { label: string | JSX.Element, value: T.ImperativeTense }[] = [{
+ label: imperfective imp. ,
+ value: "imperfectiveImperative",
+}, {
+ label: perfective imp. ,
+ value: "perfectiveImperative",
+}];
+
+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
? undefined
: getTenseCategory(o);
@@ -64,6 +73,8 @@ export function getRandomTense(o?: T.PerfectTense | T.VerbTense | T.ModalTense):
? perfectTenseOptions
: oldTenseCategory === "modal"
? verbTenseOptions.map(x => ({ ...x, value: `${x.value}Modal` as T.ModalTense }))
+ : oldTenseCategory === "imperative"
+ ? imperativeTenseOptions
: verbTenseOptions;
do {
tns = tenseOptions[
@@ -81,7 +92,7 @@ function TensePicker(props: ({
onChange: (p: T.VPSelection) => void,
mode: "charts" | "phrases" | "quiz",
}) {
- function onTenseSelect(o: { value: T.VerbTense | T.PerfectTense } | null) {
+ function onTenseSelect(o: { value: T.VerbTense | T.PerfectTense | T.ImperativeTense } | null) {
if ("vpsComplete" in props) return;
const value = o?.value ? o.value : undefined;
if (props.vps.verb && value) {
@@ -94,6 +105,15 @@ function TensePicker(props: ({
tenseCategory: "perfect",
},
});
+ } else if (isImperativeTense(value)) {
+ props.onChange({
+ ...props.vps,
+ verb: {
+ ...props.vps.verb,
+ imperativeTense: value,
+ tenseCategory: "imperative",
+ },
+ });
} else {
props.onChange({
...props.vps,
@@ -112,9 +132,19 @@ function TensePicker(props: ({
if ("vpsComplete" in props) return;
if (!props.vps.verb) return;
return () => {
- const tenses = props.vps.verb.tenseCategory === "perfect" ? perfectTenseOptions : verbTenseOptions;
+ // 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[
- props.vps.verb.tenseCategory === "perfect" ? "perfectTense" : "verbTense"
+ // 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);
@@ -139,9 +169,19 @@ function TensePicker(props: ({
});
}
}
- function onTenseCategorySelect(value: "basic" | "modal" | "perfect") {
+ function onTenseCategorySelect(value: "basic" | "modal" | "perfect" | "imperative") {
if ("vpsComplete" in props) return;
if (props.vps.verb) {
+ if (value === "imperative") {
+ props.onChange(ensure2ndPersSubjPronounAndNoConflict({
+ ...props.vps,
+ verb: {
+ ...props.vps.verb,
+ tenseCategory: value,
+ },
+ }));
+ return;
+ }
props.onChange({
...props.vps,
verb: {
@@ -153,40 +193,47 @@ function TensePicker(props: ({
}
const tOptions = ("vps" in props && (props.vps.verb?.tenseCategory === "perfect"))
? perfectTenseOptions
+ : ("vps" in props && (props.vps.verb?.tenseCategory === "imperative"))
+ ? imperativeTenseOptions
: verbTenseOptions;
return
-
- Tense:
- {("vpsComplete" in props || props.vps.verb) &&
- null}
- />
- }
-
+ Tense:
+ {("vpsComplete" in props || props.vps.verb) &&
+ null}
+ />
+ }
{"vpsComplete" in props
?
- {[...verbTenseOptions, ...perfectTenseOptions].find(o => o.value === props.vpsComplete.verb.tense)?.label}
+ {[...verbTenseOptions, ...perfectTenseOptions, ...imperativeTenseOptions].find(o => o.value === props.vpsComplete.verb.tense)?.label}
:
- {(vps.verb && (typeof vps.verb.object === "object") && (vps.verb.isCompound !== "dynamic") && (mode === "phrases")) &&
+ {(vps.verb && (typeof vps.verb.object === "object") && (vps.verb.isCompound !== "dynamic") && (vps.verb.tenseCategory !== "imperative") &&(mode === "phrases")) &&
|