fixed issue with the leftover form choice potentially not being compatible with a dynamic compound when selected
This commit is contained in:
parent
2c41595b98
commit
e9ef40f8a1
|
@ -28,6 +28,7 @@ import defualtTextOptions from "./lib/default-text-options";
|
||||||
import PhraseBuilder from "./components/vp-explorer/VPExplorer";
|
import PhraseBuilder from "./components/vp-explorer/VPExplorer";
|
||||||
import useStickyState from "./lib/useStickyState";
|
import useStickyState from "./lib/useStickyState";
|
||||||
import { EPExplorer } from "./library";
|
import { EPExplorer } from "./library";
|
||||||
|
|
||||||
type VerbType = "simple" | "stative compound" | "dynamic compound";
|
type VerbType = "simple" | "stative compound" | "dynamic compound";
|
||||||
const verbTypes: VerbType[] = [
|
const verbTypes: VerbType[] = [
|
||||||
"simple",
|
"simple",
|
||||||
|
|
|
@ -74,7 +74,9 @@ export function makeVPSelectionState(
|
||||||
externalComplement: takesExternalComplement(verb)
|
externalComplement: takesExternalComplement(verb)
|
||||||
? { type: "complement", selection: { type: "unselected" }}
|
? { type: "complement", selection: { type: "unselected" }}
|
||||||
: undefined,
|
: undefined,
|
||||||
form: os ? os.form : { removeKing: false, shrinkServant: false },
|
form: (os && info.type !== "dynamic compound")
|
||||||
|
? os.form
|
||||||
|
: { removeKing: false, shrinkServant: false },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,16 +60,25 @@ export function psJSXMap(ps: T.PsJSX, target: "p" | "f", dealWithString: (ps: T.
|
||||||
* @param f a function to transform the text
|
* @param f a function to transform the text
|
||||||
* @returns the JSX Element with all the text transformed
|
* @returns the JSX Element with all the text transformed
|
||||||
*/
|
*/
|
||||||
export function JSXMap(e: JSX.Element, f: (s: string) => string): JSX.Element {
|
export function JSXTextTransform(
|
||||||
|
e: JSX.Element | string,
|
||||||
|
f: (s: string) => string
|
||||||
|
): JSX.Element | string {
|
||||||
|
if (typeof e === "string") {
|
||||||
|
return f(e);
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
...e,
|
...e,
|
||||||
props: {
|
props: {
|
||||||
...e.props,
|
...e.props,
|
||||||
children: typeof e.props.children === "string"
|
children:
|
||||||
? f(e.props.children)
|
typeof e.props.children === "string"
|
||||||
: e.props.children.map((x: string | JSX.Element) => (
|
? f(e.props.children)
|
||||||
(typeof x === "string") ? f(x) : JSXMap(x, f)
|
: Array.isArray(e.props.children)
|
||||||
)),
|
? e.props.children.map((x: string | JSX.Element) => (
|
||||||
},
|
JSXTextTransform(x, f)
|
||||||
|
))
|
||||||
|
: JSXTextTransform(e.props.children, f)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -24,7 +24,8 @@ export function isAdverbEntry(e: T.Entry | T.DictionaryEntry): e is T.AdverbEntr
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isLocativeAdverbEntry(e: T.Entry | T.DictionaryEntry): e is T.LocativeAdverbEntry {
|
export function isLocativeAdverbEntry(e: T.Entry | T.DictionaryEntry): e is T.LocativeAdverbEntry {
|
||||||
return isAdverbEntry(e) && e.c.includes("loc. adv.");
|
if ("entry" in e) return false;
|
||||||
|
return !!e.c?.includes("loc. adv.");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isNounOrAdjEntry(e: T.Entry): e is (T.NounEntry | T.AdjectiveEntry) {
|
export function isNounOrAdjEntry(e: T.Entry): e is (T.NounEntry | T.AdjectiveEntry) {
|
||||||
|
|
Loading…
Reference in New Issue