Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | 3x 88x 88x 11x 3x 8x | import React from "react";
import { Card, Button, Container, Row, Col } from "react-bootstrap";
import { isFutureDate } from "./gameCardUtils";
const GameCard = ({ buttonText, buttonLink, game }) => {
const testIdPrefix = "gameCard";
return (
<Card.Body className="woodenboardtable">
<Container>
<Row>
<Col sx={4} data-testid={`${testIdPrefix}-id-${game.id}`}>
{game.id}
</Col>
<Col sx={4} data-testid={`${testIdPrefix}-name-${game.id}`}>
{game.name}
</Col>
{buttonText != null && (
<Col sm={4}>
<Button
data-testid={`${testIdPrefix}-button-${buttonText}-${game.id}`}
size="sm"
className="buttonchange"
onClick={() => {
if (
buttonText === "Join" &&
isFutureDate(game.startingDate)
) {
// Stryker disable all: unable to read alert text in tests
alert(
"This game has not started yet and cannot be joined.\nThe starting date is " +
parseInt(game.startingDate.substring(5, 7)) +
"/" +
parseInt(game.startingDate.substring(8, 10)) +
"/" +
parseInt(game.startingDate),
);
// Stryker restore all
} else {
buttonLink(game.id);
}
}}
>
{buttonText}
</Button>
</Col>
)}
</Row>
</Container>
</Card.Body>
);
};
export default GameCard;
|