From 0aef10f69cc66d017eb72947367010bb6cb49bd4 Mon Sep 17 00:00:00 2001 From: Jake Kasper Date: Thu, 28 Aug 2025 08:27:55 -0500 Subject: [PATCH] history --- frontend/src/pages/History/History.js | 124 ++++++++++++++++++++++++-- 1 file changed, 115 insertions(+), 9 deletions(-) diff --git a/frontend/src/pages/History/History.js b/frontend/src/pages/History/History.js index 4b0691a..3ac932e 100644 --- a/frontend/src/pages/History/History.js +++ b/frontend/src/pages/History/History.js @@ -66,6 +66,20 @@ const History = () => { fetchHistoryData(); }, []); + // Close dropdown when clicking outside + useEffect(() => { + const handleClickOutside = (event) => { + if (showProductDropdown && !event.target.closest('.relative')) { + setShowProductDropdown(false); + } + }; + + document.addEventListener('mousedown', handleClickOutside); + return () => { + document.removeEventListener('mousedown', handleClickOutside); + }; + }, [showProductDropdown]); + const fetchHistoryData = async () => { try { setLoading(true); @@ -248,7 +262,7 @@ const History = () => { {showFilters && (
-
+
@@ -298,17 +337,80 @@ const History = () => {
+
+ + + {showProductDropdown && ( +
+ {uniqueProducts.length === 0 ? ( +
No products available
+ ) : ( + <> +
+ +
+ {uniqueProducts.map(product => ( + + ))} + + )} +
+ )} +
+
+ +
+
@@ -332,10 +434,14 @@ const History = () => {