Skip to content
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
24 changes: 24 additions & 0 deletions src/Pages/Shop.js
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,12 @@ function Shop() {
ref.current.scrollIntoView({ behavior: "smooth", block: "start" });
}
};


const handleAddToCart = (product) => {
dispatch(addToCart(product));
toast.success(`₹{product.name} added to cart!`);


const toggleHeart = (product) => {
const isInWishlist = wishlistItems.some(item => item.id === product.id);
Expand All @@ -824,6 +830,7 @@ function Shop() {
dispatch(addToWishlist(product));
toast.success(`${product.name} added to wishlist!`, { autoClose: 2000 });
}

};


Expand Down Expand Up @@ -969,10 +976,17 @@ function Shop() {
}}
>
<i

className={`fa-heart ₹{
likedProducts[product.id] ? "fas" : "far"
}`}
></i>

className={`fa-heart ${
wishlistItems.some(item => item.id === product.id) ? "fas" : "far"
}`}
></i>

</div>
<Overlay
className="overlay"
Expand All @@ -990,8 +1004,18 @@ function Shop() {
</div>
<ProductInfo>
<ProductName>{product.name}</ProductName>

<ProductPrice>₹{product.price.toFixed(2)}</ProductPrice>
<Button onClick={() => handleAddToCart(product)}>
Add to Cart
</Button>
<Button onClick={() => handleAddToCart(product)}>
Buy Now
</Button>

<ProductPrice>${product.price.toFixed(2)}</ProductPrice>
<EnhancedAddToCartButton product={product} />

</ProductInfo>
</ProductCard>
))}
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/cake.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ function Cake() {
</div>
<ProductInfo>
<ProductName>{product.name}</ProductName>
<ProductPrice>${product.price.toFixed(2)}</ProductPrice>
<ProductPrice>{product.price.toFixed(2)}</ProductPrice>
{!quantities[product.id] ? (
<>
<Button onClick={() => handleAddToCart(product)}>
Expand Down
10 changes: 5 additions & 5 deletions src/Pages/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ function Cart() {
<ItemInfo>
<ItemImage src={item.image} alt={item.name} />
<ItemName>{item.name}</ItemName>
<ItemPrice>${item.price.toFixed(2)}</ItemPrice>
<ItemPrice>{item.price.toFixed(2)}</ItemPrice>
</ItemInfo>
<QuantityInput
type="number"
Expand All @@ -206,19 +206,19 @@ function Cart() {
<tbody>
<SummaryRow>
<SummaryCell>Total:</SummaryCell>
<SummaryCell>${totalPrice.toFixed(2)}</SummaryCell>
<SummaryCell>{totalPrice.toFixed(2)}</SummaryCell>
</SummaryRow>
<SummaryRow>
<SummaryCell>SGST (9%):</SummaryCell>
<SummaryCell>${SGST.toFixed(2)}</SummaryCell>
<SummaryCell>{SGST.toFixed(2)}</SummaryCell>
</SummaryRow>
<SummaryRow>
<SummaryCell>CGST (9%):</SummaryCell>
<SummaryCell>${CGST.toFixed(2)}</SummaryCell>
<SummaryCell>{CGST.toFixed(2)}</SummaryCell>
</SummaryRow>
<SummaryRow>
<SummaryCell>Final Price:</SummaryCell>
<SummaryCell>${finalPrice.toFixed(2)}</SummaryCell>
<SummaryCell>{finalPrice.toFixed(2)}</SummaryCell>
</SummaryRow>
</tbody>
</SummaryTable>
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/checkOut.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function Checkout() {
{cartItems.map((item) => (
<div key={item.id}>
<p>{item.name} x {item.quantity}</p>
<p>${(item.price * item.quantity).toFixed(2)}</p>
<p>{(item.price * item.quantity).toFixed(2)}</p>
</div>
))}
<h3>Total: ${totalPrice.toFixed(2)}</h3>
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/coffee.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ function Coffee() {
</div>
<ProductInfo>
<ProductName>{product.name}</ProductName>
<ProductPrice>${product.price.toFixed(2)}</ProductPrice>
<ProductPrice>{product.price.toFixed(2)}</ProductPrice>
{!quantities[product.id] ? (
<Button onClick={() => handleAddToCart(product)}>
Add to Cart
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/favorites.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function Favorites() {
<FavoriteCard key={item.id}>
<img src={item.image} alt={item.name} />
<h3>{item.name}</h3>
<p className="price">${item.price}</p>
<p className="price">{item.price}</p>
<button
className="remove-btn"
onClick={() => removeFromFavorites(item.id)}
Expand Down
4 changes: 2 additions & 2 deletions src/Pages/milkshake.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,14 @@ function Milkshake() {
}}
>
<i
className={`fa-heart ${likedProducts[product.id] ? 'fas' : 'far'
className={`fa-heart {likedProducts[product.id] ? 'fas' : 'far'
}`}
></i>
</div>
</div>
<ProductInfo>
<ProductName>{product.name}</ProductName>
<ProductPrice>${product.price.toFixed(2)}</ProductPrice>
<ProductPrice>{product.price.toFixed(2)}</ProductPrice>
{!quantities[product.id] ? (
<Button onClick={() => handleAddToCart(product)}>
Add to Cart
Expand Down
4 changes: 2 additions & 2 deletions src/Pages/soup.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,14 @@ function Soup() {
}}
>
<i
className={`fa-heart ${likedProducts[product.id] ? 'fas' : 'far'
className={`fa-heart {likedProducts[product.id] ? 'fas' : 'far'
}`}
></i>
</div>
</div>
<ProductInfo>
<ProductName>{product.name}</ProductName>
<ProductPrice>${product.price.toFixed(2)}</ProductPrice>
<ProductPrice>{product.price.toFixed(2)}</ProductPrice>
{!quantities[product.id] ? (
<Button onClick={() => handleAddToCart(product)}>
Add to Cart
Expand Down