+
{chapter.chapter}
{chapter.items.map(({ id, title, Game, studyLink }) => {
const done = user && user.tests.some(t => t.id === id);
const open = opened === id;
return
-
handleTitleClick(id)}>
+ handleTitleClick(id)}>
{title}
{` `}
-
+
@@ -41,7 +41,7 @@ function GamesBrowser() {
})}
- >
+
))}
}
diff --git a/src/games/games.tsx b/src/games/games.tsx
index 3915fd0..872ca34 100644
--- a/src/games/games.tsx
+++ b/src/games/games.tsx
@@ -39,49 +39,56 @@ export const equativeGamePresent = makeGameRecord(
"Write the present equative",
"equative-present",
"/equatives/present-equative/",
- (id, link) => (s: (a: "start" | "stop") => void) =>
,
+ (id, link) => (s: (a: "start" | "stop") => void) =>
,
);
export const equativeGameHabitual = makeGameRecord(
"Write the habitual equative",
"equative-habitual",
"/equatives/habitual-equative/",
- (id, link) => (s: (a: "start" | "stop") => void) =>
,
+ (id, link) => (s: (a: "start" | "stop") => void) =>
,
);
export const equativeGameSubjunctive = makeGameRecord(
"Write the subjunctive equative",
"equative-subjunctive",
"/equatives/other-equatives/#subjunctive-equative",
- (id, link) => (s: (a: "start" | "stop") => void) =>
,
+ (id, link) => (s: (a: "start" | "stop") => void) =>
,
);
export const equativeGameFuture = makeGameRecord(
"Write the future equative",
"equative-future",
"/equatives/other-equatives/#future-equative",
- (id, link) => (s: (a: "start" | "stop") => void) =>
,
+ (id, link) => (s: (a: "start" | "stop") => void) =>
,
);
export const equativeGamePast = makeGameRecord(
"Write the past equative",
"equative-past",
"/equatives/other-equatives/#past-equative",
- (id, link) => (s: (a: "start" | "stop") => void) =>
,
+ (id, link) => (s: (a: "start" | "stop") => void) =>
,
);
export const equativeGameWouldBe = makeGameRecord(
'Write the "would be" equative',
"equative-would-be",
- "equatives/other-equatives/#would-be-equative",
- (id, link) => (s: (a: "start" | "stop") => void) =>
,
+ "/equatives/other-equatives/#would-be-equative",
+ (id, link) => (s: (a: "start" | "stop") => void) =>
,
);
export const equativeGamePastSubjunctive = makeGameRecord(
'Write the past subjunctive equative',
"equative-past-subjunctive",
"/equatives/other-equatives/#past-subjunctive",
- (id, link) => (s: (a: "start" | "stop") => void) =>
,
+ (id, link) => (s: (a: "start" | "stop") => void) =>
,
+);
+
+export const equativeGameAll = makeGameRecord(
+ 'Write the equative (summary)',
+ "equative-past-summary",
+ "/equatives/other-equatives",
+ (id, link) => (s: (a: "start" | "stop") => void) =>
,
);
const games: { chapter: string, items: GameRecord[] }[] = [
@@ -103,6 +110,7 @@ const games: { chapter: string, items: GameRecord[] }[] = [
equativeGamePast,
equativeGameWouldBe,
equativeGamePastSubjunctive,
+ equativeGameAll,
],
},
];
diff --git a/src/games/sub-cores/EquativeGame.tsx b/src/games/sub-cores/EquativeGame.tsx
index 8c33c5f..9f2ecee 100644
--- a/src/games/sub-cores/EquativeGame.tsx
+++ b/src/games/sub-cores/EquativeGame.tsx
@@ -1,4 +1,4 @@
-import { useState } from "react";
+import { useEffect, useState } from "react";
import {
makeProgress,
} from "../../lib/game-utils";
@@ -44,13 +44,17 @@ const locAdverbs: T.LocativeAdverbEntry[] = [
{"ts":1527812558,"i":6241,"p":"دلته","f":"dălta","g":"dalta","e":"here","c":"loc. adv."},
{"ts":1527812449,"i":13937,"p":"هلته","f":"hálta, álta","g":"halta,alta","e":"there","c":"loc. adv."},
].filter(tp.isLocativeAdverbEntry);
+const tenses: T.EquativeTense[] = [
+ "present", "habitual", "subjunctive", "future", "past", "wouldBe", "pastSubjunctive",
+];
const amount = 20;
-const timeLimit = 55;
+const timeLimit = 75;
type Question = {
phrase: { ps: T.PsString, e?: string[] },
equative: T.EquativeRendered,
+ tense: T.EquativeTense,
};
const pronounTypes = [
@@ -63,7 +67,7 @@ const pronounTypes = [
[T.Person.ThirdPlurMale, T.Person.ThirdPlurFemale],
];
-export default function EquativeGame({ id, link, tense, onStartStop }: { id: string, link: string, tense: T.EquativeTense, onStartStop: (a: "start" | "stop") => void }) {
+export default function EquativeGame({ id, link, level, onStartStop }: { id: string, link: string, level: T.EquativeTense | "all", onStartStop: (a: "start" | "stop") => void }) {
function* questions (): Generator
> {
let pool = [...pronounTypes];
function makeRandPronoun(): T.PronounSelection {
@@ -100,6 +104,7 @@ export default function EquativeGame({ id, link, tense, onStartStop }: { id: str
makeRandPronoun,
])();
const pred = randFromArray([...adjectives, ...locAdverbs]);
+ const tense = level === "all" ? randFromArray(tenses) : level;
const EPS = makeEPS(subj, pred, tense);
const rendered = renderEP(EPS);
const compiled = compileEP(rendered, true, { equative: true, ba: false, kidsSection: true });
@@ -112,6 +117,7 @@ export default function EquativeGame({ id, link, tense, onStartStop }: { id: str
question: {
phrase,
equative: rendered.equative,
+ tense,
},
};
};
@@ -132,32 +138,34 @@ export default function EquativeGame({ id, link, tense, onStartStop }: { id: str
if (correct) {
setAnswer("");
}
- callback(!correct
- ?
-
- {flattenLengths(question.equative.ps).reduce(((accum, curr, i): JSX.Element[] => (
- [
- ...accum,
- ...i > 0 ? [ or ] : [],
- {curr.p},
- ]
- )), [] as JSX.Element[])}
-
-
{question.equative.hasBa ? "with" : "without"} a {grammarUnits.baParticle} in the kids' section.
-
- : true);
+ callback(!correct ? makeCorrectAnswer(question) : true);
}
+ useEffect(() => {
+ if (level === "all") setWithBa(false);
+ }, [question]);
return
- {/*
- @ts-ignore */}
-
- {question.phrase.e && question.phrase.e.map(e => (
-
{e}
+ {/* @ts-ignore */}
+
+ {question.phrase.e && question.phrase.e.map((e, i) => (
+
{e}
))}
+
{humanReadableTense(question.tense)} equative