diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index d0b02da..92f1b05 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -5,8 +5,10 @@ import About from './components/About';
import Footer from './components/Footer';
import Products from './components/entity/product/Products';
import Login from './components/Login';
+import Cart from './components/Cart';
import { AuthProvider } from './context/AuthContext';
import { ThemeProvider } from './context/ThemeContext';
+import { CartProvider } from './context/CartContext';
import AdminProducts from './components/admin/AdminProducts';
import { useTheme } from './context/ThemeContext';
@@ -25,6 +27,7 @@ function ThemedApp() {
} />
} />
} />
+ } />
@@ -37,7 +40,9 @@ function App() {
return (
-
+
+
+
);
diff --git a/frontend/src/components/Cart.tsx b/frontend/src/components/Cart.tsx
new file mode 100644
index 0000000..be7a24f
--- /dev/null
+++ b/frontend/src/components/Cart.tsx
@@ -0,0 +1,116 @@
+import { Link } from 'react-router-dom';
+import { useTheme } from '../context/ThemeContext';
+import { useCart } from '../context/CartContext';
+
+export default function Cart() {
+ const { darkMode } = useTheme();
+ const { cartItems, removeFromCart, updateQuantity, clearCart } = useCart();
+
+ const total = cartItems.reduce((sum, item) => sum + item.price * item.quantity, 0);
+
+ return (
+
+
+
+ Shopping Cart
+
+
+ {cartItems.length === 0 ? (
+
+
+
Your cart is empty
+
+ Browse Products
+
+
+ ) : (
+
+
+ {cartItems.map((item, index) => (
+
+

+
+
+ {item.name}
+
+
${item.price.toFixed(2)}
+
+
+
+
+ {item.quantity}
+
+
+
+
+ ${(item.price * item.quantity).toFixed(2)}
+
+
+
+ ))}
+
+
+
+
+ Total
+ ${total.toFixed(2)}
+
+
+
+ Continue Shopping
+
+
+
+ Proceed to Checkout
+
+
+
+
+ )}
+
+
+ );
+}
diff --git a/frontend/src/components/Navigation.tsx b/frontend/src/components/Navigation.tsx
index d7b393b..0943f17 100644
--- a/frontend/src/components/Navigation.tsx
+++ b/frontend/src/components/Navigation.tsx
@@ -1,11 +1,13 @@
import { Link } from 'react-router-dom';
import { useAuth } from '../context/AuthContext';
import { useTheme } from '../context/ThemeContext';
+import { useCart } from '../context/CartContext';
import { useState } from 'react';
export default function Navigation() {
const { isLoggedIn, isAdmin, logout } = useAuth();
const { darkMode, toggleTheme } = useTheme();
+ const { totalItems } = useCart();
const [adminMenuOpen, setAdminMenuOpen] = useState(false);
return (
@@ -68,6 +70,20 @@ export default function Navigation() {
+
+
+ {totalItems > 0 && (
+
+ {totalItems > 99 ? '99+' : totalItems}
+
+ )}
+