Two bug fixes:
1. Don't show sentence forms when the conjugation viewer is limited to forms that don't have sentence capability 2. Fixed English conjugation of "they ~sees~ see" etc.
This commit is contained in:
parent
2a16468f52
commit
a909ff533f
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lingdocs/pashto-inflector",
|
||||
"version": "0.8.1",
|
||||
"version": "0.8.2",
|
||||
"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",
|
||||
|
|
20
src/App.tsx
20
src/App.tsx
|
@ -11,7 +11,6 @@ import ConjugationViewer from "./components/ConjugationViewer";
|
|||
import verbs from "./verbs";
|
||||
import Pashto from "./components/Pashto";
|
||||
import Phonetics from "./components/Phonetics";
|
||||
import InlinePs from "./components/InlinePs";
|
||||
import { getVerbInfo } from "./lib/verb-info";
|
||||
import ButtonSelect from "./components/ButtonSelect";
|
||||
import {
|
||||
|
@ -51,7 +50,6 @@ function App() {
|
|||
const [transitivityShowing, setTransitivityShowing] = useState<T.Transitivity>("intransitive");
|
||||
const [showingTextOptions, setShowingTextOptions] = useState<boolean>(false);
|
||||
const [textOptions, setTextOptions] = useState<T.TextOptions>(defualtTextOptions);
|
||||
const [aayTailType, setAayTailType] = useState<T.AayTail>("aay");
|
||||
const [theme, setTheme] = useState<"light" | "dark">("light");
|
||||
// const onlyGrammTrans = (arr: Transitivity[]) => (
|
||||
// arr.length === 1 && arr[0] === "grammatically transitive"
|
||||
|
@ -69,7 +67,6 @@ function App() {
|
|||
const transitivitiyShowing = localStorage.getItem("transitivityShowing") as undefined | T.Transitivity;
|
||||
const theme = localStorage.getItem("theme");
|
||||
const textOptionst = localStorage.getItem("textOptions");
|
||||
const aayTailType = localStorage.getItem("aayType");
|
||||
if (regularIrregular) {
|
||||
setRegularIrregular(regularIrregular);
|
||||
}
|
||||
|
@ -91,9 +88,6 @@ function App() {
|
|||
if (textOptionst) {
|
||||
setTextOptions(JSON.parse(textOptionst) as T.TextOptions);
|
||||
}
|
||||
if (aayTailType) {
|
||||
setAayTailType(aayTailType as T.AayTail);
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -103,7 +97,6 @@ function App() {
|
|||
localStorage.setItem("transitivityShowing", transitivityShowing);
|
||||
localStorage.setItem("textOptions", JSON.stringify(textOptions));
|
||||
localStorage.setItem("theme", theme);
|
||||
localStorage.setItem("aayType", aayTailType);
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -301,7 +294,6 @@ function App() {
|
|||
entry={v?.verb.entry}
|
||||
complement={v?.verb.complement}
|
||||
textOptions={textOptions}
|
||||
showOnly={["Perfective Future"]}
|
||||
/>}
|
||||
</div>
|
||||
</main>
|
||||
|
@ -322,20 +314,8 @@ function App() {
|
|||
...textOptions,
|
||||
spelling: p as "Afghan" | "Pakistani",
|
||||
});
|
||||
if (p === "Pakistani") setAayTailType("ey");
|
||||
}}
|
||||
/>
|
||||
{textOptions.spelling !== "Pakistani" && <>
|
||||
<h6 className="mt-3">Non-Inflecting Tail Spelling</h6>
|
||||
<ButtonSelect
|
||||
options={[
|
||||
{ label: <InlinePs opts={textOptions}>{{ p: "ی", f: "ey" }}</InlinePs>, value: "ey" },
|
||||
{ label: <InlinePs opts={textOptions}>{{ p: "ای", f: "aay" }}</InlinePs>, value: "aay" },
|
||||
]}
|
||||
value={aayTailType}
|
||||
handleChange={(p) => setAayTailType(p as "ey" | "aay")}
|
||||
/>
|
||||
</>}
|
||||
<h6 className="mt-3">Diacritics</h6>
|
||||
<ButtonSelect
|
||||
options={[
|
||||
|
|
|
@ -244,7 +244,8 @@ function ConjugationViewer({ entry, complement, textOptions, showOnly, highlight
|
|||
negative: state.negative,
|
||||
sentenceLevel,
|
||||
englishConjugation,
|
||||
})
|
||||
});
|
||||
const sentencesAvailable = forms.some((form) => "sentence" in form);
|
||||
return <div className="mb-4">
|
||||
{"transitive" in conjugation && <div className="text-center my-2">
|
||||
<VerbChoiceWarning />
|
||||
|
@ -305,7 +306,7 @@ function ConjugationViewer({ entry, complement, textOptions, showOnly, highlight
|
|||
hideTypeInfo={!!limitTo}
|
||||
/>
|
||||
<div className="d-flex flex-row align-items-center justify-content-around flex-wrap mt-4 mb-2">
|
||||
<div className="mb-3">
|
||||
{sentencesAvailable && <div className="mb-3">
|
||||
<ButtonSelect
|
||||
options={[
|
||||
{ label: `Chart${forms.length !== 1 ? "s" : ""}`, value: "chart" },
|
||||
|
@ -314,7 +315,7 @@ function ConjugationViewer({ entry, complement, textOptions, showOnly, highlight
|
|||
value={state.mode}
|
||||
handleChange={(p) => dispatch({ type: "setMode", payload: p as "chart" | "sentence" })}
|
||||
/>
|
||||
</div>
|
||||
</div>}
|
||||
{!limitTo && <>
|
||||
<div className="mb-3">
|
||||
<ButtonSelect
|
||||
|
@ -339,7 +340,7 @@ function ConjugationViewer({ entry, complement, textOptions, showOnly, highlight
|
|||
</div>
|
||||
</>}
|
||||
</div>
|
||||
{state.mode === "sentence" &&
|
||||
{(state.mode === "sentence" && sentencesAvailable) &&
|
||||
<div className="position-sticky pb-1" style={{ top: 0, background: "var(--theme-shade)", zIndex: 1000 }}>
|
||||
<PersonSelection
|
||||
subject={state.subject}
|
||||
|
@ -367,7 +368,7 @@ function ConjugationViewer({ entry, complement, textOptions, showOnly, highlight
|
|||
}
|
||||
<FormsDisplay
|
||||
forms={forms}
|
||||
state={state}
|
||||
state={{ ...state, mode: sentencesAvailable ? "chart" : state.mode }}
|
||||
handleChange={(payload: string) => dispatch({ type: "set forms opened", payload })}
|
||||
verbConj={verbConj}
|
||||
textOptions={textOptions}
|
||||
|
|
|
@ -683,8 +683,15 @@ function isThirdPerson(p: T.Person): boolean {
|
|||
);
|
||||
}
|
||||
|
||||
function isThirdPersonSing(p: T.Person): boolean {
|
||||
return (
|
||||
p === T.Person.ThirdSingMale ||
|
||||
p === T.Person.ThirdSingFemale
|
||||
);
|
||||
}
|
||||
|
||||
function engPresC(s: T.Person, ec: T.EnglishVerbConjugationEc | [string, string]): string {
|
||||
return isThirdPerson(s) ? ec[1] : ec[0];
|
||||
return isThirdPersonSing(s) ? ec[1] : ec[0];
|
||||
}
|
||||
|
||||
function engEquative(tense: "past" | "present", s: T.Person): string {
|
||||
|
|
Loading…
Reference in New Issue