|
@@ -4,6 +4,7 @@ import Loading from '../../util/Loading';
|
|
|
import Button from "../../util/Button";
|
|
|
import PlayerScoreTile from "./PlayerScoreTile";
|
|
|
import usePlayerScores from '../../../hooks/usePlayerScores';
|
|
|
+import ClickToCopy from '../../util/ClickToCopy';
|
|
|
|
|
|
const Container = styled.div`
|
|
|
display: flex;
|
|
@@ -20,6 +21,16 @@ const ScoreBoard = styled.div`
|
|
|
align-content: space-around;
|
|
|
`
|
|
|
|
|
|
+const Label = styled.span`
|
|
|
+ padding: 0.2em;
|
|
|
+`
|
|
|
+
|
|
|
+const getUrl = gameId => {
|
|
|
+ const u = new URL(window.location.href);
|
|
|
+ u.searchParams.append("summary", gameId);
|
|
|
+ return u.href;
|
|
|
+}
|
|
|
+
|
|
|
export default ({ gameId, onReturnToStart }) => {
|
|
|
const scores = usePlayerScores(gameId);
|
|
|
|
|
@@ -37,6 +48,8 @@ export default ({ gameId, onReturnToStart }) => {
|
|
|
.map(({ name, guesses, totalScore }) => <PlayerScoreTile key={name} {...{ name, guesses, totalScore }} />)
|
|
|
}
|
|
|
</ScoreBoard>
|
|
|
+ <Label>This page can be directly linked with:</Label>
|
|
|
+ <Label><ClickToCopy text={getUrl(gameId)} /></Label>
|
|
|
<Button onClick={onReturnToStart}>Return to Start</Button>
|
|
|
</Container>
|
|
|
);
|