|
@@ -1,10 +1,11 @@
|
|
import React, { useRef } from "react";
|
|
import React, { useRef } from "react";
|
|
import styled from "styled-components";
|
|
import styled from "styled-components";
|
|
import { useLastRound } from "../../../domain/gameStore";
|
|
import { useLastRound } from "../../../domain/gameStore";
|
|
-import useMarkersFromGuesses from "./useMarkersFromGuesses";
|
|
|
|
|
|
+import useMarkersFromGuesses from "../../../hooks/useMarkersFromGuesses";
|
|
import useMap from "../../../hooks/useMap";
|
|
import useMap from "../../../hooks/useMap";
|
|
import NextRoundButton from "./NextRoundButton";
|
|
import NextRoundButton from "./NextRoundButton";
|
|
import useClickToCheckScore from "./useClickToCheckScore";
|
|
import useClickToCheckScore from "./useClickToCheckScore";
|
|
|
|
+import useGameInfo from "../../../hooks/useGameInfo";
|
|
|
|
|
|
const SummaryDiv = styled.div`
|
|
const SummaryDiv = styled.div`
|
|
position: absolute;
|
|
position: absolute;
|
|
@@ -35,8 +36,14 @@ export default () => {
|
|
const mapDivRef = useRef(null);
|
|
const mapDivRef = useRef(null);
|
|
const mapRef = useMap(mapDivRef, targetPoint.lat, targetPoint.lng, 4);
|
|
const mapRef = useMap(mapDivRef, targetPoint.lat, targetPoint.lng, 4);
|
|
|
|
|
|
|
|
+ // 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] }));
|
|
|
|
+
|
|
// add the player guess markers
|
|
// add the player guess markers
|
|
- useMarkersFromGuesses(mapRef, roundNum, targetPoint);
|
|
|
|
|
|
+ useMarkersFromGuesses(mapRef, players, targetPoint);
|
|
|
|
|
|
// let the current player click the map to see a possible score
|
|
// let the current player click the map to see a possible score
|
|
useClickToCheckScore(mapRef, targetPoint);
|
|
useClickToCheckScore(mapRef, targetPoint);
|