Skip to content
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

IEEE-249: Issues with negative stock number and blank datasheet and m… #33

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface ItemProps {

const Item = ({ image, title, total, currentStock }: ItemProps): ReactElement => {
const userType = useSelector(userTypeSelector);
const stock = !currentStock
const stock = !currentStock || currentStock < 0
? "OUT OF STOCK"
: userType === "participant"
? currentStock + " IN STOCK"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,21 +230,29 @@ export const DetailInfoSection = ({
Manufacturer
</Typography>
<Typography>{manufacturer}</Typography>
<Typography variant="body2" className={styles.heading}>
Model Number
</Typography>
<Typography>{modelNumber}</Typography>
<Typography variant="body2" className={styles.heading}>
Datasheet
</Typography>
<Button
href={datasheet}
rel="noopener"
target="_blank"
startIcon={<LaunchIcon />}
>
Link
</Button>
{modelNumber && (
<>
<Typography variant="body2" className={styles.heading}>
Model Number
</Typography>
<Typography>{modelNumber}</Typography>
</>
)}
{datasheet && (
<>
<Typography variant="body2" className={styles.heading}>
Datasheet
</Typography>
<Button
href={datasheet}
rel="noopener"
target="_blank"
startIcon={<LaunchIcon />}
>
Link
</Button>
</>
)}
{notes && (
<>
<Typography variant="body2" className={styles.heading}>
Expand Down Expand Up @@ -279,11 +287,11 @@ const MainSection = ({
<Typography color="secondary">OUT OF STOCK</Typography>
) : userType === "participant" ? (
<Typography className={styles.quantityAvailable}>
{quantityRemaining} IN STOCK
{Math.max(quantityRemaining, 0)} IN STOCK
</Typography>
) : (
<Typography className={styles.quantityAvailable}>
{quantityRemaining} OF {quantityAvailable} IN STOCK
{Math.max(quantityRemaining, 0)} OF {quantityAvailable} IN STOCK
</Typography>
);

Expand Down