diff --git a/components/hearts.tsx b/components/hearts.tsx index d1eec6b..5b9b04e 100644 --- a/components/hearts.tsx +++ b/components/hearts.tsx @@ -34,11 +34,14 @@ interface Props { export default function Hearts(props: Props) { const { lives } = props; + const elements: JSX.Element[] = []; + for (let counter = 1; counter <= lives; counter++) { + elements.push(= counter} />); + } + return (
- = 1} /> - = 2} /> - = 3} /> + {elements}
); } diff --git a/lib/items.ts b/lib/items.ts index b459d69..fb75809 100644 --- a/lib/items.ts +++ b/lib/items.ts @@ -20,6 +20,11 @@ export function getRandomItem(deck: Item[], played: Item[]): Item { if (tooClose(candidate, played)) { return false; } + for (const playedItem of played) { + if (playedItem.id === candidate.id) { + return false; + } + } return true; });