oops
This commit is contained in:
parent
1506c60afd
commit
c19b126c07
|
@ -2,11 +2,7 @@ import { useUser } from "../user-context";
|
||||||
|
|
||||||
function GameDisplay({ record: { title, Game, id } }: { record: GameRecord }) {
|
function GameDisplay({ record: { title, Game, id } }: { record: GameRecord }) {
|
||||||
const { user } = useUser();
|
const { user } = useUser();
|
||||||
const completed = user?.tests.some((t) => (
|
const completed = user?.tests.some((t) => t.done && t.id === id);
|
||||||
// TODO: Or if it's in the locally stored (unposted test results)
|
|
||||||
(t.done === true) && (t.id === id)
|
|
||||||
));
|
|
||||||
console.log({ id, completed, tests: user?.tests });
|
|
||||||
return <div>
|
return <div>
|
||||||
<div className="d-flex flex-row justify-content-between align-items-center">
|
<div className="d-flex flex-row justify-content-between align-items-center">
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -49,7 +49,7 @@ function ChapterDisplay({ chapter, user, handleClick, expanded }: {
|
||||||
</div>
|
</div>
|
||||||
<SmoothCollapse expanded={expanded}>
|
<SmoothCollapse expanded={expanded}>
|
||||||
{chapter.items.map(({ id, title, Game }) => {
|
{chapter.items.map(({ id, title, Game }) => {
|
||||||
const done = user && user.tests.some(t => t.id === id);
|
const done = user?.tests.some(t => t.done && t.id === id);
|
||||||
const open = opened === id;
|
const open = opened === id;
|
||||||
return <div key={id}>
|
return <div key={id}>
|
||||||
<div className="d-flex flex-row justify-content-between align-items-center">
|
<div className="d-flex flex-row justify-content-between align-items-center">
|
||||||
|
|
Loading…
Reference in New Issue