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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | 8x 2x 13x 13x 13x 5x 8x | import { useBackend } from "main/utils/useBackend"; import React from "react"; import { Card, Button } from "react-bootstrap"; import { Link } from "react-router-dom"; // This should only be used directly for stories. Otherwise use the default export. export function CommonsCardBoxWithData({ commons, userCommons }) { return ( <Card data-testid={"commons-card-box-" + commons.id} style={ // Stryker disable all : no need to unit test CSS { width: '18rem', margin: '0.3rem', backgroundColor: 'white', borderRadius: '0.5em', boxShadow: '0px 2px 4px rgba(0, 0, 0, 0.2)', textAlign: 'center', } // Stryker enable all }> <Card.Body> <Card.Title>{commons.name}</Card.Title> <Card.Text style={ // Stryker disable next-line all : no need to unit test CSS { margin: "0.2em" } }> Total wealth: ${userCommons.totalWealth} </Card.Text> <Card.Text> Owned cows: {userCommons.numOfCows} </Card.Text> <Link to={"/play/" + commons.id} data-testid={"enter-common-" + commons.id} style={{ // Stryker disable next-line all : no need to unit test CSS textDecoration: 'none' }}> <Button variant="primary"> Enter </Button> </Link> </Card.Body> </Card> ) } const CommonsCardBox = ({ commons }) => { // Stryker disable all const id = commons ? commons.id : -1; const userCommons = useBackend( [`api/usercommons/forcurrentuser?commonsId=${id}`], { method: "GET", url: '/api/usercommons/forcurrentuser', params: { commonsId: id, } } ); // Stryker enable all if (!userCommons || !userCommons.data || !commons) { return null } return ( <CommonsCardBoxWithData commons={commons} userCommons={userCommons.data} /> ) }; export default CommonsCardBox; |