|
@@ -1,4 +1,5 @@
|
|
|
import React from "react";
|
|
|
+import styled from "styled-components";
|
|
|
import ClickToCopy from "../../util/ClickToCopy";
|
|
|
import Button from "../../util/Button";
|
|
|
import usePlayerScores from "../../../hooks/usePlayerScores";
|
|
@@ -20,28 +21,55 @@ const useTopScorer = (gameId, roundNum) => {
|
|
|
top.topScore = score;
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
return top;
|
|
|
}
|
|
|
|
|
|
-export default ({ gameId, selectedPoint, targetPoint, roundNum, score, totalScore, onNext }) => {
|
|
|
+const Container = styled.div`
|
|
|
+ display: flex;
|
|
|
+ flex-flow: column nowrap;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ @media only screen and (min-width: 600px) {
|
|
|
+ margin-left: 10px;
|
|
|
+ align-items: flex-start;
|
|
|
+ }
|
|
|
+`
|
|
|
+
|
|
|
+const TimedOut = styled.span`
|
|
|
+ color: red;
|
|
|
+`
|
|
|
+
|
|
|
+const NextButton = styled(Button)`
|
|
|
+ margin-top: 5px;
|
|
|
+ padding: 1em;
|
|
|
+`
|
|
|
+
|
|
|
+export default ({
|
|
|
+ gameId,
|
|
|
+ selectedPoint,
|
|
|
+ targetPoint,
|
|
|
+ roundNum,
|
|
|
+ score,
|
|
|
+ totalScore,
|
|
|
+ onNext
|
|
|
+}) => {
|
|
|
const { topPlayer, topScore } = useTopScorer(gameId, roundNum);
|
|
|
|
|
|
return (
|
|
|
- <div className="round-summary__info-pane">
|
|
|
- {selectedPoint
|
|
|
- ? <span className="round-summary__guess">
|
|
|
+ <Container>
|
|
|
+ {selectedPoint
|
|
|
+ ? <span>
|
|
|
You selected: <ClickToCopy text={`${selectedPoint.lat}, ${selectedPoint.lng}`}/>
|
|
|
- </span>
|
|
|
- : <span className="round-summary__guess round-summary__guess--timed-out">
|
|
|
- Timed out!
|
|
|
</span>
|
|
|
+ : <TimedOut>Timed out!</TimedOut>
|
|
|
}
|
|
|
- <span className="round-summary__target-point">Target: <ClickToCopy text={`${targetPoint.lat}, ${targetPoint.lng}`}/></span>
|
|
|
- <span className="round-summary__round-score">Score For Round {roundNum}: {score}</span>
|
|
|
- <span className="round-summary__total-score">Running Total Score: {totalScore}</span>
|
|
|
+ <span>Target: <ClickToCopy text={`${targetPoint.lat}, ${targetPoint.lng}`}/></span>
|
|
|
+ <span>Score For Round {roundNum}: {score}</span>
|
|
|
+ <span>Running Total Score: {totalScore}</span>
|
|
|
{topPlayer ? <span className="round-summary__top-score">Current best is {topPlayer} with {topScore}</span> : null}
|
|
|
- <Button className="round-summary__button" onClick={onNext}>{roundNum === "5" ? "View Summary" : "Next Round"}</Button>
|
|
|
- </div>
|
|
|
+ <NextButton onClick={onNext}>{roundNum === "5" ? "View Summary" : "Next Round"}</NextButton>
|
|
|
+ </Container>
|
|
|
);
|
|
|
}
|