display check on accomplished game

This commit is contained in:
lingdocs 2021-09-18 23:19:39 -04:00
parent 36b78a94e2
commit 1d12771804
1 changed files with 7 additions and 2 deletions

View File

@ -1,8 +1,13 @@
import React from "react";
import { useUser } from "../user-context";
function GameDisplay({ record: { title, Game } }: { record: GameRecord }) {
function GameDisplay({ record: { title, Game, id } }: { record: GameRecord }) {
const { user } = useUser();
const completed = user?.tests.some((t) => (
(t.done === true) && (t.id === id)
));
return <div>
<h4 className="my-4"><span role="img" aria-label="">🎮</span> {title}</h4>
<h4 className="my-4"><span role="img" aria-label="">🎮</span> {title} {completed ? "✅" : ""}</h4>
<Game />
</div>
}