|
@@ -1,11 +1,11 @@
|
|
|
import React, { useState } from "react";
|
|
|
import styled from "styled-components";
|
|
|
-import ClickToCopy from "../util/ClickToCopy";
|
|
|
-import Button from "../util/Button";
|
|
|
-import Loading from "../util/Loading";
|
|
|
-import PlayerNameInput from "../util/PlayerNameInput";
|
|
|
-import usePlayerScores from "../../hooks/usePlayerScores";
|
|
|
-import { joinGame } from "../../domain/GGSHService";
|
|
|
+import ClickToCopy from "../../util/ClickToCopy";
|
|
|
+import Button from "../../util/Button";
|
|
|
+import Loading from "../../util/Loading";
|
|
|
+import PlayerNameInput from "../../util/PlayerNameInput";
|
|
|
+import LobbyPlayerList from "./LobbyPlayerList";
|
|
|
+import { joinGame } from "../../../domain/GGSHService";
|
|
|
|
|
|
const InfoContainer = styled.div`
|
|
|
flex: 3;
|
|
@@ -27,25 +27,6 @@ const FormButton = styled(Button)`
|
|
|
margin-top: 0.3em;
|
|
|
`
|
|
|
|
|
|
-const PlayerListContainer = styled.div`
|
|
|
- flex: 1;
|
|
|
-
|
|
|
- display: flex;
|
|
|
- flex-flow: column nowrap;
|
|
|
- justify-content: flex-start;
|
|
|
- align-items: flex-start;
|
|
|
-
|
|
|
- border-left: 2px solid #777;
|
|
|
- height: 100%;
|
|
|
- padding-left: 1rem;
|
|
|
-`
|
|
|
-
|
|
|
-const PlayerList = styled.ul`
|
|
|
-`
|
|
|
-
|
|
|
-const PlayerName = styled.li`
|
|
|
-`
|
|
|
-
|
|
|
const PageContainer = styled.div`
|
|
|
flex: 1;
|
|
|
display: flex;
|
|
@@ -63,8 +44,7 @@ const getUrl = gameId => {
|
|
|
const JoinedInfo = ({ gameId, playerName, onStart }) => (
|
|
|
<InfoContainer>
|
|
|
<Label>Playing as {playerName}</Label>
|
|
|
- <Label>Game Code: <ClickToCopy text={gameId} /></Label>
|
|
|
- <Label>Or, send the following link:</Label>
|
|
|
+ <Label>Use this link to join:</Label>
|
|
|
<Label><ClickToCopy text={getUrl(gameId)} /></Label>
|
|
|
<FormButton onClick={onStart}>Start Game</FormButton>
|
|
|
</InfoContainer>
|
|
@@ -112,16 +92,7 @@ const PreRound = ({ gameId, playerName, joined, onGameJoined, onStart }) => (
|
|
|
? <JoinedInfo gameId={gameId} playerName={playerName} onStart={onStart}/>
|
|
|
: <UnjoinedInfo gameId={gameId} onGameJoined={onGameJoined}/>
|
|
|
}
|
|
|
- <PlayerListContainer>
|
|
|
- <Label>Players</Label>
|
|
|
- <PlayerList>
|
|
|
- {
|
|
|
- usePlayerScores(gameId)?.map(({ name }) => (
|
|
|
- <PlayerName key={name}>{name}</PlayerName>
|
|
|
- ))
|
|
|
- }
|
|
|
- </PlayerList>
|
|
|
- </PlayerListContainer>
|
|
|
+ <LobbyPlayerList gameId={gameId} />
|
|
|
</PageContainer>
|
|
|
);
|
|
|
|