bug fix with limiting conjugation viewer forms
This commit is contained in:
parent
198bae9f07
commit
2a16468f52
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@lingdocs/pashto-inflector",
|
"name": "@lingdocs/pashto-inflector",
|
||||||
"version": "0.8.0",
|
"version": "0.8.1",
|
||||||
"author": "lingdocs.com",
|
"author": "lingdocs.com",
|
||||||
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
|
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
|
||||||
"homepage": "https://verbs.lingdocs.com",
|
"homepage": "https://verbs.lingdocs.com",
|
||||||
|
|
|
@ -301,6 +301,7 @@ function App() {
|
||||||
entry={v?.verb.entry}
|
entry={v?.verb.entry}
|
||||||
complement={v?.verb.complement}
|
complement={v?.verb.complement}
|
||||||
textOptions={textOptions}
|
textOptions={textOptions}
|
||||||
|
showOnly={["Perfective Future"]}
|
||||||
/>}
|
/>}
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { useEffect, useReducer } from "react";
|
import { useEffect, useReducer } from "react";
|
||||||
import VerbInfo, { RootsAndStems } from "./verb-info/VerbInfo";
|
import VerbInfo from "./verb-info/VerbInfo";
|
||||||
import VerbFormDisplay from "./VerbFormDisplay";
|
import VerbFormDisplay from "./VerbFormDisplay";
|
||||||
import ButtonSelect from "./ButtonSelect";
|
import ButtonSelect from "./ButtonSelect";
|
||||||
import Hider from "./Hider";
|
import Hider from "./Hider";
|
||||||
|
@ -224,7 +224,7 @@ function ConjugationViewer({ entry, complement, textOptions, showOnly, highlight
|
||||||
} : undefined;
|
} : undefined;
|
||||||
|
|
||||||
const filterDifficulty = (f: T.DisplayForm): boolean => (
|
const filterDifficulty = (f: T.DisplayForm): boolean => (
|
||||||
state.difficulty === "advanced" || !f.advanced
|
state.difficulty === "advanced" || !!showOnly || !f.advanced
|
||||||
);
|
);
|
||||||
const limitTo = !showOnly
|
const limitTo = !showOnly
|
||||||
? undefined
|
? undefined
|
||||||
|
@ -235,7 +235,8 @@ function ConjugationViewer({ entry, complement, textOptions, showOnly, highlight
|
||||||
conj: verbConj,
|
conj: verbConj,
|
||||||
filterFunc: [
|
filterFunc: [
|
||||||
filterDifficulty,
|
filterDifficulty,
|
||||||
...limitTo ? [(f: T.DisplayForm): boolean => limitTo.includes(f.label)] : [],
|
...limitTo ? [(f: T.DisplayForm): boolean => limitTo.includes(f.label)
|
||||||
|
] : [],
|
||||||
],
|
],
|
||||||
mode: state.mode,
|
mode: state.mode,
|
||||||
subject: state.subject,
|
subject: state.subject,
|
||||||
|
@ -294,7 +295,6 @@ function ConjugationViewer({ entry, complement, textOptions, showOnly, highlight
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>}
|
</div>}
|
||||||
{!limitTo ?
|
|
||||||
<VerbInfo
|
<VerbInfo
|
||||||
info={verbConj.info}
|
info={verbConj.info}
|
||||||
textOptions={textOptions}
|
textOptions={textOptions}
|
||||||
|
@ -302,15 +302,8 @@ function ConjugationViewer({ entry, complement, textOptions, showOnly, highlight
|
||||||
highlightInRootsAndStems={highlightInRootsAndStems}
|
highlightInRootsAndStems={highlightInRootsAndStems}
|
||||||
toggleShowingSar={() => dispatch({ type: "toggle showingStemsAndRoots" })}
|
toggleShowingSar={() => dispatch({ type: "toggle showingStemsAndRoots" })}
|
||||||
hidePastParticiple={hidePastParticiple}
|
hidePastParticiple={hidePastParticiple}
|
||||||
|
hideTypeInfo={!!limitTo}
|
||||||
/>
|
/>
|
||||||
:
|
|
||||||
<RootsAndStems
|
|
||||||
textOptions={textOptions}
|
|
||||||
info={verbConj.info}
|
|
||||||
highlighted={highlightInRootsAndStems}
|
|
||||||
hidePastParticiple={hidePastParticiple}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
<div className="d-flex flex-row align-items-center justify-content-around flex-wrap mt-4 mb-2">
|
<div className="d-flex flex-row align-items-center justify-content-around flex-wrap mt-4 mb-2">
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
<ButtonSelect
|
<ButtonSelect
|
||||||
|
|
|
@ -173,21 +173,22 @@ export function RootsAndStems({ textOptions, info, hidePastParticiple, highlight
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function VerbInfo({ info, textOptions, showingStemsAndRoots, toggleShowingSar, highlightInRootsAndStems, hidePastParticiple }: {
|
function VerbInfo({ info, textOptions, showingStemsAndRoots, toggleShowingSar, highlightInRootsAndStems, hidePastParticiple, hideTypeInfo }: {
|
||||||
info: T.NonComboVerbInfo,
|
info: T.NonComboVerbInfo,
|
||||||
textOptions: T.TextOptions,
|
textOptions: T.TextOptions,
|
||||||
showingStemsAndRoots: boolean,
|
showingStemsAndRoots: boolean,
|
||||||
highlightInRootsAndStems?: T.RootsOrStemsToHighlight,
|
highlightInRootsAndStems?: T.RootsOrStemsToHighlight,
|
||||||
toggleShowingSar: () => void,
|
toggleShowingSar: () => void,
|
||||||
hidePastParticiple?: boolean,
|
hidePastParticiple?: boolean,
|
||||||
|
hideTypeInfo?: boolean,
|
||||||
}) {
|
}) {
|
||||||
const inf = noPersInfs(info.root.imperfective).long;
|
const inf = noPersInfs(info.root.imperfective).long;
|
||||||
return (
|
return (
|
||||||
<div className="my-3">
|
<div className="my-3">
|
||||||
<VerbTypeInfo
|
{!hideTypeInfo && <VerbTypeInfo
|
||||||
info={info}
|
info={info}
|
||||||
textOptions={textOptions}
|
textOptions={textOptions}
|
||||||
/>
|
/>}
|
||||||
<Hider
|
<Hider
|
||||||
showing={showingStemsAndRoots}
|
showing={showingStemsAndRoots}
|
||||||
label={`🌳 Roots and Stems for ${inf.p}`}
|
label={`🌳 Roots and Stems for ${inf.p}`}
|
||||||
|
|
Loading…
Reference in New Issue