From cf03702349e1f60b725cd22d3dabdfbf7a9c4a0a Mon Sep 17 00:00:00 2001 From: Buyankhuu Tsolmonkhuu Date: Sun, 21 Apr 2024 14:02:17 -0700 Subject: [PATCH] preRebase --- src/api/supabase/queries/product_queries.ts | 2 +- src/app/orderConfirmationDelivery/page.tsx | 4 +++- src/app/pickup/page.tsx | 1 + src/app/pickup/styles.ts | 2 +- src/app/profileScreen/individualItem.tsx | 24 ++++++++++----------- src/app/profileScreen/page.tsx | 8 +++++++ 6 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/api/supabase/queries/product_queries.ts b/src/api/supabase/queries/product_queries.ts index 85ec9fbb..67396986 100644 --- a/src/api/supabase/queries/product_queries.ts +++ b/src/api/supabase/queries/product_queries.ts @@ -64,7 +64,7 @@ export async function fetchProductByID(productId: number): Promise { if (error) { throw new Error(`Error fetching product: ${error.message}`); } - + return product; } diff --git a/src/app/orderConfirmationDelivery/page.tsx b/src/app/orderConfirmationDelivery/page.tsx index bacfca1d..1652742e 100644 --- a/src/app/orderConfirmationDelivery/page.tsx +++ b/src/app/orderConfirmationDelivery/page.tsx @@ -93,7 +93,9 @@ export default function OrderConfirmationDelivery() { 'November', 'December', ]; - const dateStr = `${months[parseInt(date[1], 10)]} ${date[2]}, ${date[0]}`; + const dateStr = `${months[parseInt(date[1], 10) - 1]} ${date[2]}, ${ + date[0] + }`; return `${dateStr}`; } diff --git a/src/app/pickup/page.tsx b/src/app/pickup/page.tsx index 6ea5a83a..bd8d8ea3 100644 --- a/src/app/pickup/page.tsx +++ b/src/app/pickup/page.tsx @@ -183,6 +183,7 @@ export default function PickUp() { } if (selectedPickupIndex === 0) { toast(`You must select a pick-up date!`); + toast.clearWaitingQueue(); } }} > diff --git a/src/app/pickup/styles.ts b/src/app/pickup/styles.ts index 78adbb49..3c984c57 100644 --- a/src/app/pickup/styles.ts +++ b/src/app/pickup/styles.ts @@ -269,5 +269,5 @@ export const ToastPopUP = styled(ToastContainer)` position: fixed; z-index: 100; transform: translatey(90px); - background-color: ${COLORS.lightRed}; + `; diff --git a/src/app/profileScreen/individualItem.tsx b/src/app/profileScreen/individualItem.tsx index f7de722e..457c23d4 100644 --- a/src/app/profileScreen/individualItem.tsx +++ b/src/app/profileScreen/individualItem.tsx @@ -18,19 +18,19 @@ export default function IndividualItem(props: { const { favorite, Favorites, setFavorites } = props; const [hovering, setHovering] = useState(false); - useEffect(() => { - async function changeCategory() { - try { - favorite.category = await convertButtonNumberToCategory( - favorite.category, - ); - } catch (error) { - // console.error(error); - } - } + // useEffect(() => { + // // async function changeCategory() { + // // try { + // // favorite.category = await convertButtonNumberToCategory( + // // favorite.category, + // // ); + // // } catch (error) { + // // // console.error(error); + // // } + // // } - changeCategory(); - }, [favorite]); + // // changeCategory(); + // }, []); async function clickFunctions(props2: { fav: Product }) { const { fav } = props2; diff --git a/src/app/profileScreen/page.tsx b/src/app/profileScreen/page.tsx index 49c95de6..42f5a064 100644 --- a/src/app/profileScreen/page.tsx +++ b/src/app/profileScreen/page.tsx @@ -12,6 +12,7 @@ import { Body2Bold, Body2, } from '@/styles/fonts'; +import { convertButtonNumberToCategory } from '@/api/supabase/queries/button_queries'; import { arrayOfFavorites, fetchUser, @@ -363,6 +364,13 @@ export default function Profile() { async function fetchProducts() { const data = (await arrayOfFavorites()) as Product[]; + data.forEach( + async product => + (product.category = await convertButtonNumberToCategory( + product.category, + )), + ); + console.log(data); setFavorites(data); }