Skip to content

Commit ed9b714

Browse files
committed
Adjust QR code centering behaviour on small screens
1 parent 8609042 commit ed9b714

File tree

2 files changed

+26
-43
lines changed

2 files changed

+26
-43
lines changed

ui/package-lock.json

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/src/game/WaitingToStartScreen.tsx

Lines changed: 17 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
import { useContext } from "react";
22
import { GameContext } from "../GameContext";
3-
import {
4-
Button,
5-
Spinner,
6-
Table,
7-
TableBody,
8-
TableCell,
9-
TableHead,
10-
TableHeadCell,
11-
TableRow,
12-
} from "flowbite-react";
3+
import { Button, Spinner, Table, TableBody, TableCell, TableHead, TableHeadCell, TableRow } from "flowbite-react";
134
import useApiClient from "../useApiClient";
145
import GameIdCopyButton from "./common/GameIdCopyButton";
156
import QRCode from "react-qr-code";
@@ -22,17 +13,14 @@ export default function WaitingToStartScreen() {
2213
return <></>;
2314
}
2415

25-
const isHost =
26-
game.players.find((x) => x.username === username)?.role === "Host";
16+
const isHost = game.players.find((x) => x.username === username)?.role === "Host";
2717

2818
return (
29-
<div className="flex flex-col max-w-(--breakpoint-md) mx-auto mb-8 items-stretch">
19+
<div className="flex flex-col max-w-(--breakpoint-md) mx-auto mb-8 items-stretch px-1">
3020
<div className="text-center my-4">
3121
<Spinner />
3222
</div>
33-
<h1 className="text-lg font-semibold self-center mb-5">
34-
Waiting for Host to Start Game
35-
</h1>
23+
<h1 className="text-lg font-semibold self-center mb-5">Waiting for Host to Start Game</h1>
3624
<div className="flex flex-wrap gap-4 justify-center">
3725
{/* Players table */}
3826
<div className="flex-1 min-w-[300px]">
@@ -71,38 +59,29 @@ export default function WaitingToStartScreen() {
7159
</TableHead>
7260
<TableBody>
7361
<TableRow>
74-
<TableCell className="items-middle text-center">
75-
<div className="inline-flex items-middle">
62+
<TableCell className="flex flex-col items-center gap-4">
63+
<div className="inline-flex items-middle text-center">
7664
{!prefs.hideGameId ? (
7765
<div>
78-
<span className="py-2 pr-1">Use Game ID </span>
66+
<span className="py-2 pr-1">Use Game ID</span>
7967
<GameIdCopyButton className="text-gray-500 hover:bg-gray-100 active:bg-gray-200" />
80-
<span className="py-2 pl-1">
81-
to join or scan QR code
82-
</span>
68+
<span className="py-2 pl-1">to join, or scan the QR code:</span>
8369
</div>
8470
) : (
8571
<div>
86-
<span className="py-2 pr-1">
87-
Click to copy Game URL{" "}
88-
</span>
72+
<span className="py-2 pr-1">Click to copy Game URL</span>
8973
<GameIdCopyButton className="text-gray-500 hover:bg-gray-100 active:bg-gray-200" />
9074
<span className="py-2 pl-1"></span>
9175
</div>
9276
)}
9377
</div>
94-
<div>
95-
{!prefs.hideGameId ? (
96-
<TableCell>
97-
<QRCode
98-
style={{ height: "auto", maxWidth: "100%" }}
99-
value={window.location.href + "?gameId=" + game.id}
100-
/>
101-
</TableCell>
102-
) : (
103-
<></>
104-
)}
105-
</div>
78+
{!prefs.hideGameId ? (
79+
<div>
80+
<QRCode style={{ height: "auto", width: "auto" }} value={window.location.href + "?gameId=" + game.id} />
81+
</div>
82+
) : (
83+
<></>
84+
)}
10685
</TableCell>
10786
</TableRow>
10887
</TableBody>
@@ -111,12 +90,7 @@ export default function WaitingToStartScreen() {
11190
</div>
11291

11392
{isHost ? (
114-
<Button
115-
className="mt-4"
116-
color="success"
117-
size="lg"
118-
onClick={apiClient.startGame}
119-
>
93+
<Button className="mt-4" color="green" size="lg" onClick={apiClient.startGame}>
12094
Start Game
12195
</Button>
12296
) : (

0 commit comments

Comments
 (0)