better formatting
This commit is contained in:
parent
1d12771804
commit
36682d67fb
|
@ -27,7 +27,7 @@ function GameCore<T>({ questions, Display, timeLimit, Instructions, studyLink, i
|
||||||
}) {
|
}) {
|
||||||
// TODO: report pass with id to user info
|
// TODO: report pass with id to user info
|
||||||
const rewardRef = useRef<RewardElement | null>(null);
|
const rewardRef = useRef<RewardElement | null>(null);
|
||||||
const { user } = useUser();
|
const { user, pullUser } = useUser();
|
||||||
const [finish, setFinish] = useState<null | "pass" | "fail" | "time out">(null);
|
const [finish, setFinish] = useState<null | "pass" | "fail" | "time out">(null);
|
||||||
const [current, setCurrent] = useState<Current<T> | undefined>(undefined);
|
const [current, setCurrent] = useState<Current<T> | undefined>(undefined);
|
||||||
const [questionBox, setQuestionBox] = useState<QuestionGenerator<T>>(questions());
|
const [questionBox, setQuestionBox] = useState<QuestionGenerator<T>>(questions());
|
||||||
|
@ -50,7 +50,7 @@ function GameCore<T>({ questions, Display, timeLimit, Instructions, studyLink, i
|
||||||
function handleFinish() {
|
function handleFinish() {
|
||||||
setFinish("pass");
|
setFinish("pass");
|
||||||
rewardRef.current?.rewardMe();
|
rewardRef.current?.rewardMe();
|
||||||
if (user) {
|
if (!user) return;
|
||||||
const result: AT.TestResult = {
|
const result: AT.TestResult = {
|
||||||
done: true,
|
done: true,
|
||||||
time: getTimestamp(),
|
time: getTimestamp(),
|
||||||
|
@ -58,9 +58,11 @@ function GameCore<T>({ questions, Display, timeLimit, Instructions, studyLink, i
|
||||||
};
|
};
|
||||||
console.log("will post result", JSON.stringify(result));
|
console.log("will post result", JSON.stringify(result));
|
||||||
postTestResults([result])
|
postTestResults([result])
|
||||||
.then(console.log)
|
.then((res) => {
|
||||||
.catch(console.error);
|
if (res.ok) {
|
||||||
|
pullUser();
|
||||||
}
|
}
|
||||||
|
}).catch(console.error);
|
||||||
}
|
}
|
||||||
function handleQuit() {
|
function handleQuit() {
|
||||||
setFinish(null);
|
setFinish(null);
|
||||||
|
|
|
@ -7,7 +7,12 @@ function GameDisplay({ record: { title, Game, id } }: { record: GameRecord }) {
|
||||||
(t.done === true) && (t.id === id)
|
(t.done === true) && (t.id === id)
|
||||||
));
|
));
|
||||||
return <div>
|
return <div>
|
||||||
<h4 className="my-4"><span role="img" aria-label="">🎮</span> {title} {completed ? "✅" : ""}</h4>
|
<div className="d-flex flex-row justify-content-between">
|
||||||
|
<div>
|
||||||
|
<h4 className="my-4"><span role="img" aria-label="">🎮</span> {title}</h4>
|
||||||
|
</div>
|
||||||
|
<div>{completed ? "✅" : ""}</div>
|
||||||
|
</div>
|
||||||
<Game />
|
<Game />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue