hopefully fix bug on the sandwich picker

This commit is contained in:
lingdocs 2022-05-26 20:29:07 -05:00
parent 6b2d6b5804
commit 9a466456f6
3 changed files with 24 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@lingdocs/pashto-inflector",
"version": "2.6.5",
"version": "2.6.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",

View File

@ -1,7 +1,7 @@
import * as T from "../../types";
import { sandwiches } from "../../lib/sandwiches";
import { SandwichSelect } from "../../components/EntrySelect";
import { useState } from "react";
import { useEffect, useState } from "react";
import NPPicker from "./NPPicker";
function SandwichPicker(props: {
@ -12,7 +12,10 @@ function SandwichPicker(props: {
phraseIsComplete: boolean,
onExit: () => void,
}) {
const [sandwichBase, setSandwichBase] = useState<T.Sandwich | undefined>(undefined);
const [sandwichBase, setSandwichBase] = useState<T.Sandwich | undefined>(props.sandwich);
useEffect(() => {
setSandwichBase(props.sandwich);
}, [props.sandwich]);
function handleNounChange(n: T.NPSelection | undefined) {
if (!n) {
props.onChange(undefined);

View File

@ -104,6 +104,24 @@ export const sandwiches: T.Sandwich[] = [
after: { p: "په لور", f: "pu lor" },
e: "towards",
},
{
type: "sandwich",
before: { p: "د", f: "du" },
after: { p: "په اړه", f: "pu aRa" },
e: "about",
},
{
type: "sandwich",
before: { p: "د", f: "du" },
after: { p: "په باره کې", f: "pu baara ke" },
e: "about",
},
{
type: "sandwich",
before: { p: "د", f: "du" },
after: { p: "په اړوند", f: "pu aRwand" },
e: "concerning",
},
];
export default sandwiches;