temp fix for the lack of verb length options the new VP compile function

This commit is contained in:
adueck 2024-03-15 07:37:55 -04:00
parent 7495bf896e
commit 82efab7809
1 changed files with 15 additions and 2 deletions

View File

@ -12,6 +12,7 @@ import {
isPastTense, isPastTense,
getPassiveRootsAndStems, getPassiveRootsAndStems,
getAbilityRootsAndStems, getAbilityRootsAndStems,
getLength,
} from "@lingdocs/ps-react"; } from "@lingdocs/ps-react";
import { import {
isImperativeTense, isImperativeTense,
@ -23,7 +24,6 @@ import {
basicVerbs, basicVerbs,
intransitivePastVerbs, intransitivePastVerbs,
} from "../content/verbs/basic-present-verbs"; } from "../content/verbs/basic-present-verbs";
import { getLength } from "@lingdocs/ps-react/dist/lib/src/p-text-helpers";
import { isThirdPerson } from "@lingdocs/ps-react"; import { isThirdPerson } from "@lingdocs/ps-react";
function BasicVerbShowCase({ function BasicVerbShowCase({
@ -280,8 +280,11 @@ function makeExamplePhrases(
const selection = makeSelection(person); const selection = makeSelection(person);
const rendered = renderVP(selection); const rendered = renderVP(selection);
const compiled = compileVP(rendered, rendered.form); const compiled = compileVP(rendered, rendered.form);
console.log({ rendered, compiled });
return { return {
ps: [modifyP(getLength(compiled.ps, length)[0])], ps: [
modifyP(getLengthTempFix(getLength(compiled.ps, "long"), length)[0]),
],
e: compiled.e e: compiled.e
? modifyEnglish(compiled.e.join(" • "), tense, isThirdPerson(person)) ? modifyEnglish(compiled.e.join(" • "), tense, isThirdPerson(person))
: "", : "",
@ -407,3 +410,13 @@ function createVerbTable(
], ],
}; };
} }
function getLengthTempFix(
ps: T.PsString[],
length: "long" | "short"
): T.PsString[] {
if (length === "short" && ps.length > 1) {
return [ps[1]];
}
return [ps[0]];
}