Skip to content

Commit

Permalink
fix: selected disapears when 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Apoorva64 committed Nov 3, 2024
1 parent 7a344a1 commit 468cb42
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions libs/ui/common/src/lib/commandsR/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ export function Item(props: Readonly<ItemProps>) {
const currentTableCart: Cart =
useCarts((state) => state.carts)[props.tableNumber] || [];
const updateItem = useCarts((state) => state.updateItem);

const count =
currentTableCart.find(
(element) => element.shortName === props.item.shortName
)?.quantity ?? 0;

return (
<Card sx={{ maxWidth: 250, minWidth: 150, maxHeight: 600 }}>
<CardMedia
Expand All @@ -48,7 +48,7 @@ export function Item(props: Readonly<ItemProps>) {
</Typography>
<Typography variant="body2" color="text.secondary" sx={{ fontSize: '1.2rem' }}>

{props.onTable ? `Selected: ${(props.remaining ?? 0) - props.onTable}` : ''}
{props.onTable !== undefined ? `Selected: ${(props.remaining ?? 0) - props.onTable}` : ''}
</Typography>

</CardContent>
Expand All @@ -74,7 +74,6 @@ export function Item(props: Readonly<ItemProps>) {
value as number
);
}}

/>
)}
</CardActions>
Expand Down

0 comments on commit 468cb42

Please sign in to comment.