From 9a466456f68e3f2ae6ff80b441f5849964258cd4 Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Thu, 26 May 2022 20:29:07 -0500 Subject: [PATCH] hopefully fix bug on the sandwich picker --- package.json | 2 +- src/components/np-picker/SandwichPicker.tsx | 7 +++++-- src/lib/sandwiches.ts | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index f991d44..84ccc31 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/components/np-picker/SandwichPicker.tsx b/src/components/np-picker/SandwichPicker.tsx index 4b13a7e..9dd9d36 100644 --- a/src/components/np-picker/SandwichPicker.tsx +++ b/src/components/np-picker/SandwichPicker.tsx @@ -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(undefined); + const [sandwichBase, setSandwichBase] = useState(props.sandwich); + useEffect(() => { + setSandwichBase(props.sandwich); + }, [props.sandwich]); function handleNounChange(n: T.NPSelection | undefined) { if (!n) { props.onChange(undefined); diff --git a/src/lib/sandwiches.ts b/src/lib/sandwiches.ts index dac245f..6fa8c96 100644 --- a/src/lib/sandwiches.ts +++ b/src/lib/sandwiches.ts @@ -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; \ No newline at end of file