diff --git a/App/pelagia-portal/app/(portal)/inventory/cart/cart-view.tsx b/App/pelagia-portal/app/(portal)/inventory/cart/cart-view.tsx
index 43f6c36..aa8cfef 100644
--- a/App/pelagia-portal/app/(portal)/inventory/cart/cart-view.tsx
+++ b/App/pelagia-portal/app/(portal)/inventory/cart/cart-view.tsx
@@ -31,8 +31,9 @@ export function CartView() {
}
function createPO() {
- // Encode cart into query params and navigate to new PO with prefill
const encoded = encodeURIComponent(JSON.stringify(items));
+ clearCart();
+ setItems([]);
router.push(`/po/new?cart=${encoded}`);
}
@@ -45,8 +46,8 @@ export function CartView() {
-
+
+ Add more items
-
+
);
}
diff --git a/App/pelagia-portal/components/layout/cart-icon.tsx b/App/pelagia-portal/components/layout/cart-icon.tsx
new file mode 100644
index 0000000..18fd948
--- /dev/null
+++ b/App/pelagia-portal/components/layout/cart-icon.tsx
@@ -0,0 +1,33 @@
+"use client";
+
+import { useEffect, useState } from "react";
+import { useRouter } from "next/navigation";
+import { ShoppingCart } from "lucide-react";
+import { getCart } from "@/lib/cart";
+
+export function CartIcon() {
+ const router = useRouter();
+ const [count, setCount] = useState(0);
+
+ useEffect(() => {
+ const update = () => setCount(getCart().reduce((s, i) => s + i.quantity, 0));
+ update();
+ window.addEventListener("cart-updated", update);
+ return () => window.removeEventListener("cart-updated", update);
+ }, []);
+
+ return (
+