Skip to content

Commit

Permalink
Merge pull request #66 from AAISS/finished-events-flag
Browse files Browse the repository at this point in the history
feat: disabled 'add to cart' button for finished workshops and presen…
  • Loading branch information
AlirezaYousefpourM authored Dec 6, 2023
2 parents d878416 + 3a237e3 commit 5f5030e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions frontend/src/components/item-card/item-card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const ItemCard = ({
switch (purchaseState) {
case 0:
return (
<Button variant="outlined" size="small" disabled={isFull} onClick={onClickAddToCart}>
<Button variant="outlined" size="small" disabled={isFull || finished} onClick={onClickAddToCart}>
Add to Cart
</Button>
);
Expand Down Expand Up @@ -117,6 +117,7 @@ const ItemCard = ({
purchaseState={purchaseState}
description={description}
level={level}
finished={finished}
hasProject={hasProject}
prerequisites={prerequisites}
syllabus={syllabus}
Expand Down Expand Up @@ -171,7 +172,7 @@ const ItemCard = ({
{!hasBought && <Cost cost={cost} />}
{!hasBought && shouldShowFullCapacity && <FullCapacityChip />}
{finished && <div style={{
backgroundColor: "grey",
backgroundColor: "#ec6803",
borderRadius: "5px",
display: "inline-block",
padding: "2px 5px 2px 5px"
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/item-card/more-info-modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const Syllabus = ({ syllabus }) => (
const MoreInfoModal = ({
visibility,
onVisibilityChange,
finished,
title,
presenterName,
cost,
Expand Down Expand Up @@ -124,7 +125,7 @@ const MoreInfoModal = ({
<DialogActions>
<Button onClick={onVisibilityChange}>Close</Button>
{purchaseState === 0 ? (
<Button disabled={isFull} onClick={handleClickAddToCart}>
<Button disabled={finished || isFull} onClick={handleClickAddToCart}>
Add To Cart
</Button>
) : purchaseState === 1 ? (
Expand All @@ -150,6 +151,7 @@ MoreInfoModal.propTypes = {
description: PropTypes.string,
onClickAddToCart: PropTypes.func,
onClickRemoveFromCart: PropTypes.func,
finished: PropTypes.bool,
};

export default MoreInfoModal;

0 comments on commit 5f5030e

Please sign in to comment.