Skip to content

Commit

Permalink
Integrate the join screen with chess and fix a bug: join url was wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileyJames committed Jul 17, 2021
1 parent a7c6493 commit 093f56f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/src/components/join-screen/JoinScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Flex, Box, Link } from "rebass/styled-components";
import QRCode from "qrcode.react";

const roomCodeToUrl = (roomCode) => (
`${window.location.host}/guest/${roomCode}`
`${window.location.host}/#/guest/${roomCode}`
);

const roomCodeToHref = (roomCode) => (
Expand Down Expand Up @@ -54,7 +54,7 @@ function JoinScreen({ roomCode, ...props }) {
return (
<Flex flexWrap="wrap">
<FullWidthColumn>
<Heading>How to join the game</Heading>
<Heading mt={3}>How to join the game</Heading>
</FullWidthColumn>
<HalfWidthColumn>
<TextRoomCode roomCode={roomCode}/>
Expand Down
4 changes: 2 additions & 2 deletions app/src/components/join-screen/JoinScreen.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ describe("Join screen", () => {
const textCode = queryByText("XVXV");
expect(textCode).toBeInTheDocument();

expect(qrValue).toBe("http://localhost/guest/XVXV")
expect(qrValue).toBe("http://localhost/#/guest/XVXV")

const link = getByRole("link");
expect(link.href).toBe("http://localhost/guest/XVXV")
expect(link.href).toBe("http://localhost/#/guest/XVXV")
})
})
6 changes: 2 additions & 4 deletions app/src/games/chess/client/Host.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import React from "react";
import Client from "./Client";
import { Flex, Text } from "rebass/styled-components";
import JoinScreen from "components/join-screen"

const Host = (props) => {
if (props.connections.length < 1) {
return (
<Flex justifyContent="center" p={4}>
<Text fontSize={4}>Join: <span>{props.roomId}</span></Text>
</Flex>
<JoinScreen roomCode={props.roomId}/>
)
}

Expand Down

0 comments on commit 093f56f

Please sign in to comment.