-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JacobW scale cow sale price #25
Changes from all commits
a9fd7e5
65a94f8
105ac5d
c036a0f
df0bddc
702b0ea
b1671e9
1438e62
c9a49fe
5072482
886c4fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,16 @@ import React from "react"; | |
import { Card, Button, Row, Col } from "react-bootstrap"; | ||
import cowHead from "./../../../assets/CowHead.png"; | ||
|
||
// add parameters | ||
const ManageCows = ({userCommons,commons, onBuy, onSell}) => { | ||
|
||
// add parameters | ||
const ManageCows = ({userCommons, commons, onBuy, onSell}) => { | ||
// update cowPrice from fixture | ||
// Stryker disable ArithmeticOperator : line 24: not very important and unsure of how to test this | ||
return ( | ||
<Card> | ||
<Card.Header as="h5">Manage Cows</Card.Header> | ||
<Card.Body> | ||
{/* change $10 to info from fixture */} | ||
{/* why does removing the optional chaining question mark turn the entire page white? */} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does this comment keep showing up? I've called it out in several code reviews. Comments like this are fine while you are developing, but they need to be removed before code is ready to merge to main. And I've answered this question before. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is because it is outdated. I was waiting for BuySellMultipleCows to be approved before merging all the changes into other branches. |
||
<Card.Title>Market Cow Price: ${commons?.cowPrice}</Card.Title> | ||
<Card.Title>Number of Cows: {userCommons.numOfCows}</Card.Title> | ||
<Row> | ||
|
@@ -19,16 +21,32 @@ const ManageCows = ({userCommons,commons, onBuy, onSell}) => { | |
</Card.Text> | ||
</Col> | ||
<Col> | ||
<Button variant="outline-danger" onClick={()=>{onBuy(userCommons)}} data-testid={"buy-cow-button"}>Buy cow</Button> | ||
<Button variant="outline-danger" onClick={()=>{onBuy(userCommons, parseInt(userCommons.totalWealth/commons.cowPrice))}} data-testid={"buy-max-cows-button"}>Buy Max Cows</Button> | ||
<br/> | ||
<br/> | ||
<Button variant="outline-danger" onClick={()=>{onBuy(userCommons, 10)}} data-testid={"buy-10-cows-button"}>Buy 10 Cows</Button> | ||
<br/> | ||
<br/> | ||
<Button variant="outline-danger" onClick={()=>{onBuy(userCommons, 1)}} data-testid={"buy-a-cow-button"}>Buy a Cow</Button> | ||
<br/> | ||
<br/> | ||
<Button variant="outline-danger" onClick={()=>{onSell(userCommons, 1)}} data-testid={"sell-a-cow-button"}>Sell a Cow</Button> | ||
<br/> | ||
<br/> | ||
<Button variant="outline-danger" onClick={()=>{onSell(userCommons, 10)}} data-testid={"sell-10-cows-button"}>Sell 10 Cows</Button> | ||
<br/> | ||
<br/> | ||
<Button variant="outline-danger" onClick={()=>{onSell(userCommons)}} data-testid={"sell-cow-button"}>Sell cow</Button> | ||
<Button variant="outline-danger" onClick={()=>{onSell(userCommons, userCommons.numOfCows)}} data-testid={"sell-all-cows-button"}>Sell All Cows</Button> | ||
<br/> | ||
<br/> | ||
</Col> | ||
</Row> | ||
{!!commons?.scaleCowSalePrice && | ||
<Card.Text> | ||
Note: Buying cows buys at current cow price, but selling cows sells at current cow price | ||
times the average health of cows as a percentage! | ||
</Card.Text> | ||
} | ||
</Card.Body> | ||
</Card> | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this here? This keeps showing up in this team's PRs, and I'm skeptical. I need to be convinced that this is necessary, especially since "line 24" seems to be misleading.