-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated page file names and added links between pages
- Loading branch information
1 parent
0fa5a33
commit e6fd4a2
Showing
12 changed files
with
168 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Button } from "../components/Button" | ||
import { useNavigate } from "react-router-dom" | ||
|
||
export function LandingPlayer() { | ||
const navigate = useNavigate() | ||
const handleClick = () => { | ||
navigate('/lobby/player') | ||
} | ||
return ( | ||
<> | ||
<Button handleClick={handleClick} buttonText="Join Room"/> | ||
</> | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// The page where the players are waiting while everybody joins the game | ||
// For the host, this is the page with the 'start the game' button | ||
|
||
import { Link } from "react-router-dom"; | ||
import { Button } from "../components/Button"; | ||
{/* import { Button } from "../components/Button"; */} | ||
|
||
export function LobbyHost({ gameRoom }) { | ||
return ( | ||
<> | ||
<Button buttonText="Start Game"/> | ||
<div>{`Game Room: http://localhost:5173/join/${gameRoom}`}</div> | ||
</> | ||
) | ||
// return ( | ||
// <div className="lobby"> | ||
// <div className="players_list"> | ||
// <h1>Players joining component placeholder</h1> | ||
// <p> | ||
// Players | ||
// <ul> | ||
// <li>Player1</li> | ||
// <li>Player2</li> | ||
// <li>Player3</li> | ||
// </ul> | ||
// </p> | ||
// </div> | ||
|
||
// <Link to="/in-game" className="in-game-link"></Link> | ||
// {/* <Button onClick={handleClick}>Start game</Button> */} | ||
|
||
// <div className="share_link"> | ||
// <h1>Share link component placeholder</h1> | ||
// <p data-testid="add-players-prompt"> | ||
// Add up to 6 players using this link | ||
// </p> | ||
// <a> Link</a> | ||
// </div> | ||
|
||
// </div> | ||
// ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export function LobbyPlayer({ gameRoom }) { | ||
return ( | ||
<> | ||
<div >Waiting for host to start game...</div> | ||
<div>{`Game Room: http://localhost:5173/join/${gameRoom}`}</div> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Tests for the landing page where the players can share a link to join | ||
// the game, and the players can join the game | ||
|
||
//required imports | ||
import { render, screen } from "@testing-library/react"; | ||
import { BrowserRouter } from "react-router-dom"; | ||
import { describe, expect, test } from "vitest"; | ||
import { LandingPlayer } from "../../src/pages/LandingPlayer"; | ||
|
||
|
||
describe("LandingPlayer tests", () => { | ||
test("join room button is visible", () => { | ||
render( | ||
<BrowserRouter> | ||
<LandingPlayer /> | ||
</BrowserRouter> | ||
); | ||
const buttonEl = screen.getByRole("button") | ||
expect(buttonEl.textContent).toEqual("Join Room") | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Tests for the lobby page where the host can share a link to join | ||
// the game, the host can start the game, and the host can see who has joined | ||
|
||
//required imports | ||
import { render, screen } from "@testing-library/react"; | ||
import { BrowserRouter } from "react-router-dom"; | ||
import { LobbyHost } from "../../src/pages/LobbyHost"; | ||
import { describe, expect, test } from "vitest"; | ||
|
||
|
||
describe("LobbyHost tests", () => { | ||
test("there is a button", () => { | ||
render( | ||
<BrowserRouter> | ||
<LobbyHost gameRoom={""}/> | ||
</BrowserRouter> | ||
); | ||
|
||
const buttonEl = screen.getByRole("button"); | ||
expect(buttonEl.textContent).toEqual("Start Game"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Tests for the lobby page where the players can share a link to join | ||
// the game, and the players can see who has joined | ||
|
||
//required imports | ||
import { render, screen } from "@testing-library/react"; | ||
import { BrowserRouter } from "react-router-dom"; | ||
import { LobbyPlayer } from "../../src/pages/LobbyPlayer"; | ||
import { describe, expect, test } from "vitest"; | ||
|
||
|
||
describe("LobbyPlayer tests", () => { | ||
test("name of the game", () => { | ||
render( | ||
<BrowserRouter> | ||
<LobbyPlayer gameRoom={""}/> | ||
</BrowserRouter> | ||
); | ||
|
||
expect(screen.getByText("Waiting for host to start game...")).toBeTruthy(); | ||
}); | ||
}); |