|
@@ -1,10 +1,8 @@
|
|
import React, { useRef } from "react";
|
|
import React, { useRef } from "react";
|
|
import styled from "styled-components";
|
|
import styled from "styled-components";
|
|
-import { useLastRound, dispatch } from "../../../domain/gameStore";
|
|
|
|
-import useRoundInfo from "../../../hooks/useRoundInfo";
|
|
|
|
-import DelayedButton from "../../util/DelayedButton";
|
|
|
|
-import Button from "../../util/Button";
|
|
|
|
|
|
+import { useLastRound } from "../../../domain/gameStore";
|
|
import useMapWithMarkers from "./useMapWithMarkers";
|
|
import useMapWithMarkers from "./useMapWithMarkers";
|
|
|
|
+import NextRoundButton from "./NextRoundButton";
|
|
|
|
|
|
const SummaryDiv = styled.div`
|
|
const SummaryDiv = styled.div`
|
|
position: absolute;
|
|
position: absolute;
|
|
@@ -27,16 +25,6 @@ const MapDiv = styled.div`
|
|
width: 100%;
|
|
width: 100%;
|
|
`
|
|
`
|
|
|
|
|
|
-const FinishedButton = styled(Button)`
|
|
|
|
- margin-top: 5px;
|
|
|
|
- padding: 1em;
|
|
|
|
-`
|
|
|
|
-
|
|
|
|
-const NextButton = styled(DelayedButton)`
|
|
|
|
- margin-top: 5px;
|
|
|
|
- padding: 1em;
|
|
|
|
-`
|
|
|
|
-
|
|
|
|
export default () => {
|
|
export default () => {
|
|
// get the info about the last round
|
|
// get the info about the last round
|
|
const { roundNum, score, totalScore, targetPoint } = useLastRound();
|
|
const { roundNum, score, totalScore, targetPoint } = useLastRound();
|
|
@@ -44,9 +32,6 @@ export default () => {
|
|
// draw the map
|
|
// draw the map
|
|
const mapDivRef = useRef(null);
|
|
const mapDivRef = useRef(null);
|
|
useMapWithMarkers(mapDivRef, roundNum, targetPoint);
|
|
useMapWithMarkers(mapDivRef, roundNum, targetPoint);
|
|
-
|
|
|
|
- // whether or not the game is done
|
|
|
|
- const [gameFinished] = useRoundInfo();
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
<div>
|
|
<div>
|
|
@@ -54,15 +39,7 @@ export default () => {
|
|
<SummaryDiv>
|
|
<SummaryDiv>
|
|
<ScoreSpan>Score for Round {roundNum}: {score}</ScoreSpan>
|
|
<ScoreSpan>Score for Round {roundNum}: {score}</ScoreSpan>
|
|
<ScoreSpan>Running Total: {totalScore}</ScoreSpan>
|
|
<ScoreSpan>Running Total: {totalScore}</ScoreSpan>
|
|
- {
|
|
|
|
- gameFinished
|
|
|
|
- ? <FinishedButton onClick={dispatch.startRound}>
|
|
|
|
- View Summary
|
|
|
|
- </FinishedButton>
|
|
|
|
- : <NextButton onEnd={dispatch.startRound} countDownFormatter={rem => `Click to cancel, ${rem}s...`}>
|
|
|
|
- Next Round
|
|
|
|
- </NextButton>
|
|
|
|
- }
|
|
|
|
|
|
+ <NextRoundButton/>
|
|
</SummaryDiv>
|
|
</SummaryDiv>
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|