|
@@ -1,23 +1,19 @@
|
|
|
import { useEffect } from "react";
|
|
|
-import { usePlayerName } from "../../../domain/gameStore";
|
|
|
-import useGameInfo from "../../../hooks/useGameInfo";
|
|
|
-import { makeQuestionMarker, makeFlagMarker, makeLine } from "./markers";
|
|
|
-import getColorGenerator from "./getColorGenerator";
|
|
|
+import { usePlayerName } from "../domain/gameStore";
|
|
|
+import { makeQuestionMarker, makeFlagMarker, makeLine } from "../components/screens/RoundSummary/markers";
|
|
|
+import getColorGenerator from "../components/screens/RoundSummary/getColorGenerator";
|
|
|
import { useRef } from "react";
|
|
|
|
|
|
-export default (mapRef, roundNum, targetPoint) => {
|
|
|
+export default (mapRef, players, targetPoint) => {
|
|
|
// set up the flag at the target point
|
|
|
useEffect(() => {
|
|
|
+ if (targetPoint === null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
const targetMarker = makeFlagMarker(mapRef.current, targetPoint);
|
|
|
return () => targetMarker.setMap(null);
|
|
|
}, [mapRef, targetPoint]);
|
|
|
|
|
|
- // live update with all the scores
|
|
|
- const players = useGameInfo()
|
|
|
- ?.players
|
|
|
- ?.filter(({ guesses }) => guesses[roundNum] && guesses[roundNum].score !== null)
|
|
|
- ?.map(({ name, totalScore, guesses }) => ({ name, totalScore, guess: guesses[roundNum] }));
|
|
|
-
|
|
|
// get the current player's name
|
|
|
const playerName = usePlayerName();
|
|
|
|