|
@@ -7,6 +7,8 @@ import useGameInfo from '../../../hooks/useGameInfo';
|
|
|
import ClickToCopy from '../../util/ClickToCopy';
|
|
|
import HeaderAndFooter from '../../util/HeaderAndFooter';
|
|
|
import { useGameId, dispatch } from '../../../domain/gameStore';
|
|
|
+import { linkGame } from '../../../domain/apiMethods';
|
|
|
+import GameCreationForm from '../../util/GameCreationForm';
|
|
|
|
|
|
const Container = styled.div`
|
|
|
display: flex;
|
|
@@ -51,7 +53,7 @@ const getUrl = gameId => {
|
|
|
|
|
|
export default () => {
|
|
|
const gameId = useGameId();
|
|
|
- const { players } = useGameInfo();
|
|
|
+ const { players, linkedGame } = useGameInfo();
|
|
|
|
|
|
if (!players) {
|
|
|
return <Loading/>
|
|
@@ -68,6 +70,15 @@ export default () => {
|
|
|
.map((data) => <PlayerScoreTile key={data.name} {...data} />)
|
|
|
}
|
|
|
</ScoreBoard>
|
|
|
+ {
|
|
|
+ linkedGame
|
|
|
+ ? (
|
|
|
+ <StyledButton onClick={() => dispatch.goToLobby(linkedGame)}>
|
|
|
+ Continue to Linked Game Lobby
|
|
|
+ </StyledButton>
|
|
|
+ )
|
|
|
+ : <GameCreationForm afterCreate={linkId => linkGame(gameId, linkId)}/>
|
|
|
+ }
|
|
|
<LowerContainer>
|
|
|
<Label>This page can be directly linked with:</Label>
|
|
|
<Label><ClickToCopy text={getUrl(gameId)} /></Label>
|