fix with active/passive
This commit is contained in:
parent
c6f9626039
commit
ebdfc33de1
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lingdocs/pashto-inflector",
|
||||
"version": "2.1.5",
|
||||
"version": "2.1.6",
|
||||
"author": "lingdocs.com",
|
||||
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
|
||||
"homepage": "https://verbs.lingdocs.com",
|
||||
|
|
|
@ -177,6 +177,7 @@ function TensePicker(props: ({
|
|||
...props.vps,
|
||||
verb: {
|
||||
...props.vps.verb,
|
||||
voice: "active",
|
||||
tenseCategory: value,
|
||||
},
|
||||
}));
|
||||
|
@ -196,6 +197,8 @@ function TensePicker(props: ({
|
|||
: ("vps" in props && (props.vps.verb?.tenseCategory === "imperative"))
|
||||
? imperativeTenseOptions
|
||||
: verbTenseOptions;
|
||||
const showImperativeOption = ("vps" in props && props.vps.verb.voice === "active")
|
||||
|| ("vpsComplete" in props && props.vpsComplete.verb.voice !== "active");
|
||||
return <div>
|
||||
<div style={{ maxWidth: "300px", minWidth: "250px", margin: "0 auto" }}>
|
||||
<div className="h5">Tense:</div>
|
||||
|
@ -205,7 +208,7 @@ function TensePicker(props: ({
|
|||
value={"vpsComplete" in props
|
||||
? getTenseCategory(props.vpsComplete.verb.tense)
|
||||
: props.vps.verb.tenseCategory}
|
||||
options={[{
|
||||
options={showImperativeOption ? [{
|
||||
label: "Basic",
|
||||
value: "basic",
|
||||
}, {
|
||||
|
@ -217,6 +220,15 @@ function TensePicker(props: ({
|
|||
}, {
|
||||
label: "Imperative",
|
||||
value: "imperative",
|
||||
}] : [{
|
||||
label: "Basic",
|
||||
value: "basic",
|
||||
}, {
|
||||
label: "Perfect",
|
||||
value: "perfect",
|
||||
}, {
|
||||
label: "Modal",
|
||||
value: "modal",
|
||||
}]}
|
||||
handleChange={props.mode !== "quiz" ? onTenseCategorySelect : () => null}
|
||||
/>
|
||||
|
|
|
@ -28,10 +28,14 @@ function VerbPicker(props: {
|
|||
}
|
||||
function onVoiceSelect(value: "active" | "passive") {
|
||||
if (props.vps.verb && props.vps.verb.changeVoice) {
|
||||
if (value === "passive" && props.vps.verb.tenseCategory === "imperative") {
|
||||
return;
|
||||
}
|
||||
if (value === "passive" && (typeof props.vps.verb.object === "object")) {
|
||||
props.onChange({
|
||||
...props.vps,
|
||||
subject: props.vps.verb.object,
|
||||
verb: props.vps.verb.changeVoice(value, props.vps.verb.object),
|
||||
});
|
||||
} else {
|
||||
props.onChange({
|
||||
|
@ -98,7 +102,12 @@ function VerbPicker(props: {
|
|||
<ButtonSelect
|
||||
small
|
||||
value={props.vps.verb.voice}
|
||||
options={[{
|
||||
options={props.vps.verb.tenseCategory === "imperative"
|
||||
? [{
|
||||
label: "Active",
|
||||
value: "active",
|
||||
}]
|
||||
: [{
|
||||
label: "Active",
|
||||
value: "active",
|
||||
}, {
|
||||
|
|
Loading…
Reference in New Issue