From c5a238ab05c06eb448878ed87235254760aa6737 Mon Sep 17 00:00:00 2001 From: adueck Date: Wed, 7 Aug 2024 16:04:31 -0400 Subject: [PATCH] fixed up determiners for a beta rollout --- .github/workflows/publish.yml | 1 + package.json | 2 +- src/components/package-lock.json | 4 ++-- src/components/package.json | 2 +- src/components/src/blocks/Block.tsx | 15 ++++++++++----- .../src/np-picker/DeterminersPicker.tsx | 8 +++++++- src/lib/package.json | 2 +- src/lib/src/phrase-building/blocks-utils.ts | 15 ++++++++------- src/lib/src/phrase-building/np-tools.ts | 9 ++++++--- src/lib/src/phrase-building/render-np.ts | 6 ++---- src/types.ts | 10 +++++----- 11 files changed, 44 insertions(+), 30 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 23fdbe3..114ce9e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -30,6 +30,7 @@ jobs: yarn install-r yarn build-library yarn test --silent + yarn check-all-inflections cp .npmrc src/lib cp .npmrc src/components cd src/lib diff --git a/package.json b/package.json index f76057c..a4c70e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pashto-inflector", - "version": "7.5.0", + "version": "7.5.1", "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/package-lock.json b/src/components/package-lock.json index 5b5366e..c6af0ca 100644 --- a/src/components/package-lock.json +++ b/src/components/package-lock.json @@ -1,12 +1,12 @@ { "name": "@lingdocs/ps-react", - "version": "7.5.0", + "version": "7.5.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@lingdocs/ps-react", - "version": "7.5.0", + "version": "7.5.1", "license": "MIT", "dependencies": { "@formkit/auto-animate": "^1.0.0-beta.3", diff --git a/src/components/package.json b/src/components/package.json index 7e7a59a..5f79812 100644 --- a/src/components/package.json +++ b/src/components/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/ps-react", - "version": "7.5.0", + "version": "7.5.1", "description": "Pashto inflector library module with React components", "main": "dist/components/library.js", "module": "dist/components/library.js", diff --git a/src/components/src/blocks/Block.tsx b/src/components/src/blocks/Block.tsx index c96db97..f368b1d 100644 --- a/src/components/src/blocks/Block.tsx +++ b/src/components/src/blocks/Block.tsx @@ -609,15 +609,20 @@ function Determiners({ script: "p" | "f"; children: T.Rendered | undefined; }) { - if (!children) { + if (!children || children.determiners.length === 0) { return null; } return (
- Determiners here! - {/* {children.ps[script]} -
DEM
- {children.e} */} +
+ {children.determiners.map((d) => ( +
+ {d.ps[0][script]} +
{"demonstrative" in d.determiner ? "DEM" : "DET"}
+ {d.e} +
+ ))} +
); } diff --git a/src/components/src/np-picker/DeterminersPicker.tsx b/src/components/src/np-picker/DeterminersPicker.tsx index b8b7d0d..90c0125 100644 --- a/src/components/src/np-picker/DeterminersPicker.tsx +++ b/src/components/src/np-picker/DeterminersPicker.tsx @@ -12,10 +12,16 @@ export default function DeterminersPicker({ opts: T.TextOptions; negative: boolean; }) { + const hasDemonstrative = + determiners && + determiners.determiners.some((d) => "demonstrative" in d.determiner); function allowed(d: T.Determiner): boolean { if (d.p === "هیڅ" && !negative) { return false; } + if (hasDemonstrative && "demonstrative" in d) { + return false; + } return true; } function handleWithNounChange(e: React.ChangeEvent) { @@ -93,7 +99,7 @@ export default function DeterminersPicker({ checked={determiners?.withNoun} onChange={handleWithNounChange} id="withNoun" - disabled={!determiners} + disabled={!hasDemonstrative} />