Browse Source

Combining usage of the useLastRound hook

Kirk Trombley 5 năm trước cách đây
mục cha
commit
6ae5aa77d4

+ 2 - 2
client/src/components/screens/RoundSummary/RoundSummary.jsx

@@ -39,11 +39,11 @@ const NextButton = styled(DelayedButton)`
 
 export default () => {
   // get the info about the last round
-  const { roundNum, score, totalScore } = useLastRound();
+  const { roundNum, score, totalScore, targetPoint } = useLastRound();
 
   // draw the map
   const mapDivRef = useRef(null);
-  useMapWithMarkers(mapDivRef);
+  useMapWithMarkers(mapDivRef, roundNum, targetPoint);
 
   // whether or not the game is done
   const [gameFinished] = useRoundInfo();

+ 2 - 5
client/src/components/screens/RoundSummary/useMapWithMarkers.jsx

@@ -1,15 +1,12 @@
 import { useEffect } from "react";
-import { useLastRound, usePlayerName } from "../../../domain/gameStore";
+import { usePlayerName } from "../../../domain/gameStore";
 import useMap from "../../../hooks/useMap";
 import useGameInfo from "../../../hooks/useGameInfo";
 import { makeQuestionMarker, makeFlagMarker, makeLine } from "./markers";
 import getColorGenerator from "./getColorGenerator";
 import { useRef } from "react";
 
-const useMapWithMarkers = (mapDivRef) => {
-  // get the info about the last round
-  const { roundNum, targetPoint } = useLastRound();
-
+const useMapWithMarkers = (mapDivRef, roundNum, targetPoint) => {
   // create the map
   const mapRef = useMap(mapDivRef, targetPoint.lat, targetPoint.lng, 4);