From 89b13ff8aef02237a9e613b5aeb025199cd5e17c Mon Sep 17 00:00:00 2001
From: adueck
Date: Thu, 13 Jun 2024 14:25:09 -0400
Subject: [PATCH] imporve inflection table
---
src/App.tsx | 22 ++++-
src/components/src/InflectionsTable.tsx | 125 +++++++++++++++++-------
src/components/src/TableCell.tsx | 9 +-
3 files changed, 117 insertions(+), 39 deletions(-)
diff --git a/src/App.tsx b/src/App.tsx
index 749a2e1..824b733 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -16,10 +16,11 @@ import useStickyState from "./components/src/useStickyState";
import EPExplorer from "./components/src/ep-explorer/EPExplorer";
import VPBuilderDemo from "./demo-components/VPBuilderDemo";
import { entryFeeder } from "./demo-components/entryFeeder";
-import { Hider } from "./components/library";
+import { Hider, inflectWord } from "./components/library";
import InflectionDemo from "./demo-components/InflectionDemo";
import SpellingDemo from "./demo-components/SpellingDemo";
import ParserDemo from "./demo-components/ParserDemo";
+// import InflectionTable from "./components/src/InflectionsTable";
function App() {
const [showingTextOptions, setShowingTextOptions] = useStickyState(
@@ -39,6 +40,18 @@ function App() {
document.documentElement.setAttribute("data-theme", theme);
}, [theme]);
+ const infout = inflectWord({
+ ts: 1527815306,
+ i: 9623,
+ p: "ستړی",
+ f: "stúRay",
+ g: "stuRay",
+ e: "tired",
+ r: 4,
+ c: "adj. / adv.",
+ a: 1,
+ });
+
return (
<>
@@ -97,6 +110,13 @@ function App() {
on GitHub
+ {/* for testing inflection table */}
+ {/* {typeof infout === "object" && infout.inflections && (
+
+ )} */}
Demos:
;
// }
-const InflectionTable = ({ inf, textOptions, hideTitle }: {
- inf: T.Inflections | T.PluralInflections,
- textOptions: T.TextOptions,
- hideTitle?: boolean,
+const InflectionTable = ({
+ inf,
+ textOptions,
+ hideTitle,
+}: {
+ inf: T.Inflections | T.PluralInflections;
+ textOptions: T.TextOptions;
+ hideTitle?: boolean;
}) => {
- // const [showingExplanation, setShowingExplanation] = useState(false);
- /* istanbul ignore next */ // Insanely can't see the modal to close it
- // const handleCloseExplanation = () => setShowingExplanation(false);
- // const handleShowExplanation = () => setShowingExplanation(true);
- const isPluralInfs = isPluralInflections(inf);
- return (
-
- {!hideTitle &&
- {!isPluralInfs &&
Inflections
}
- {/* {!isPluralInfs &&
+ // const [showingExplanation, setShowingExplanation] = useState(false);
+ /* istanbul ignore next */ // Insanely can't see the modal to close it
+ // const handleCloseExplanation = () => setShowingExplanation(false);
+ // const handleShowExplanation = () => setShowingExplanation(true);
+ const isPluralInfs = isPluralInflections(inf);
+ return (
+
+ {!hideTitle && (
+
+ {!isPluralInfs &&
Inflections
}
+ {/* {!isPluralInfs &&
} */}
-
}
-
-
-
- |
- {"masc" in inf && Masculine | }
- {"fem" in inf && Feminine | }
-
-
-
- {(!isPluralInfs ? ["Plain", "1st", "2nd"] : ["Plural", "2nd Inf."]).map((title, i) => (
-
- {title} |
- {"masc" in inf && }
- {"fem" in inf && }
-
- ))}
-
-
- {/* {(!hideTitle && !isPluralInfs) &&
+
+ )}
+
+
+
+ |
+ {"masc" in inf && (
+
+ Masculine
+ |
+ )}
+ {"fem" in inf && (
+
+ Feminine
+ |
+ )}
+
+
+
+ {(!isPluralInfs
+ ? ["Plain", "1st", "2nd"]
+ : ["Plural", "2nd Inf."]
+ ).map((title, i) => (
+
+
+ {title}
+ |
+ {"masc" in inf && (
+
+ )}
+ {"fem" in inf && i < 2 && (
+
+ )}
+
+ ))}
+
+
+ {/* {(!hideTitle && !isPluralInfs) &&
About {isPluralInfs ? "Inflections" : "Arabic Plural"}
@@ -86,8 +137,8 @@ const InflectionTable = ({ inf, textOptions, hideTitle }: {
} */}
-
- );
+
+ );
};
-export default InflectionTable;
\ No newline at end of file
+export default InflectionTable;
diff --git a/src/components/src/TableCell.tsx b/src/components/src/TableCell.tsx
index 88a4b46..125cc9f 100644
--- a/src/components/src/TableCell.tsx
+++ b/src/components/src/TableCell.tsx
@@ -24,11 +24,13 @@ function TableCell({
textOptions,
center,
noBorder,
+ colSpan,
}: {
item: T.PsString[];
textOptions: T.TextOptions;
center?: boolean;
noBorder?: boolean;
+ colSpan?: 1 | 2;
}) {
const [version, setVersion] = useState(0);
useEffect(() => setVersion(0), [item]);
@@ -37,7 +39,12 @@ function TableCell({
}
const w = item[version] || item[0];
return (
-
+ |
|