From be51112398b020a70129c23e11dff78da02e55f0 Mon Sep 17 00:00:00 2001 From: Imanuel Raditya <16521421@mahasiswa.itb.ac.id> Date: Mon, 27 Nov 2023 20:35:21 +0700 Subject: [PATCH] fix: fix bugs in merge with develop --- frontend/package.json | 3 --- frontend/src/components/ProductCard.tsx | 20 +------------- frontend/src/components/Sidebar.tsx | 36 ++++++++++++++++++++++--- frontend/src/components/TenantCard.tsx | 3 ++- frontend/src/pages/OrderSummary.tsx | 4 --- 5 files changed, 35 insertions(+), 31 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 35fedbd..ba8a98f 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -29,15 +29,12 @@ "react-toastify": "^9.1.3" }, "devDependencies": { -<<<<<<< HEAD "@babel/preset-typescript": "^7.23.3", "@jest/globals": "^29.7.0", "@testing-library/jest-dom": "^6.1.4", "@testing-library/react": "^14.1.2", "@types/jest": "^29.5.10", -======= "@types/crypto-js": "^4.2.1", ->>>>>>> cd14ccc80038e5ec620f4f13cc1d5420599e0ed5 "@types/react": "^18.2.15", "@types/react-dom": "^18.2.7", "@typescript-eslint/eslint-plugin": "^6.0.0", diff --git a/frontend/src/components/ProductCard.tsx b/frontend/src/components/ProductCard.tsx index d60b3fe..013db6f 100644 --- a/frontend/src/components/ProductCard.tsx +++ b/frontend/src/components/ProductCard.tsx @@ -1,11 +1,7 @@ -import { useEffect } from 'react' +import { useState, useEffect } from 'react' import { useShoppingCart } from '../contexts/ShoppingCartContext'; import { useLocalStorage } from '../hooks/useLocalStorage'; -<<<<<<< HEAD -======= -import ShoppingCart from '../pages/ShoppingCart'; import Axios from "axios"; ->>>>>>> cd14ccc80038e5ec620f4f13cc1d5420599e0ed5 type ProductCardProps = { id: number; @@ -13,16 +9,6 @@ type ProductCardProps = { name: string; description: string; price: number; -<<<<<<< HEAD -} - -export default function ProductCard({ data }: { data: ProductCardProps[] }) { - const productlist = data.map(({ id, image, name, description, price }) => { - const { getItemQuantity, increaseItemQuantity, removeItem } = useShoppingCart(); - - const [isAdded, setIsAdded] = useLocalStorage<boolean>(`product-${id}`, false); - -======= id_tenant: number; } @@ -63,15 +49,12 @@ export default function ProductCard({ data }: { data: ProductCardProps[] }) { console.log(productData); ->>>>>>> cd14ccc80038e5ec620f4f13cc1d5420599e0ed5 useEffect(() => { const quantity = getItemQuantity(id); setIsAdded(quantity > 0); }, [getItemQuantity, id, setIsAdded]); const handleClick = () => { -<<<<<<< HEAD -======= if (cartItems.length > 0) { const cartItem = cartItems[0]; const cartTenantId = cartItem && productData.find((product: Product) => product.id === cartItem.id)?.id_tenant; @@ -80,7 +63,6 @@ export default function ProductCard({ data }: { data: ProductCardProps[] }) { return; } } ->>>>>>> cd14ccc80038e5ec620f4f13cc1d5420599e0ed5 if (isAdded) { removeItem(id); } else { diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx index 7efbeae..c701ded 100644 --- a/frontend/src/components/Sidebar.tsx +++ b/frontend/src/components/Sidebar.tsx @@ -137,20 +137,48 @@ export default function Sidebar(props: any) { </div> {props.customer === true ? ( <a onClick={logout}> - <div className="flex flex-col px-10 py-3.5 mt-auto mb-10"> + <div className="flex flex-col px-10 py-3.5 mt-auto mb-8"> <button type="button" className="flex text-mealshub-red bg-white hover:bg-mealshub-red hover:text-white font-medium rounded-2xl p-4 inline-flex group" > - <div className="flex flex-col w-52"> - <span className="flex whitespace-nowrap text-lg text-left"> + <div className="flex flex-col justify-center w-52"> + <div className="absolute group text-mealshub-red"> + <svg + xmlns="http://www.w3.org/2000/svg" + viewBox="0 0 28 33" + className="h-auto w-7 text-mealshub-red group-hover:hidden" + > + <path + fillRule="evenodd" + clipRule="evenodd" + d="M15.5554 24.0346L17.7292 26.2083L25.4375 18.5L17.7292 10.7917L15.5554 12.9654L19.5329 16.9583H4.625V20.0417H19.5329L15.5554 24.0346ZM29.2917 4.625H7.70833C6.89058 4.625 6.10632 4.94985 5.52809 5.52809C4.94985 6.10632 4.625 6.89058 4.625 7.70833V13.875H7.70833V7.70833H29.2917V29.2917H7.70833V23.125H4.625V29.2917C4.625 30.1094 4.94985 30.8937 5.52809 31.4719C6.10632 32.0501 6.89058 32.375 7.70833 32.375H29.2917C30.9875 32.375 32.375 30.9875 32.375 29.2917V7.70833C32.375 6.0125 30.9875 4.625 29.2917 4.625Z" + fill="currentcolor" + /> + </svg> + <svg + xmlns="http://www.w3.org/2000/svg" + viewBox="0 0 28 33" + className="h-auto w-7 text-white hidden group-hover:block group-hover:shadow-xl" + > + <path + fillRule="evenodd" + clipRule="evenodd" + d="M15.5554 24.0346L17.7292 26.2083L25.4375 18.5L17.7292 10.7917L15.5554 12.9654L19.5329 16.9583H4.625V20.0417H19.5329L15.5554 24.0346ZM29.2917 4.625H7.70833C6.89058 4.625 6.10632 4.94985 5.52809 5.52809C4.94985 6.10632 4.625 6.89058 4.625 7.70833V13.875H7.70833V7.70833H29.2917V29.2917H7.70833V23.125H4.625V29.2917C4.625 30.1094 4.94985 30.8937 5.52809 31.4719C6.10632 32.0501 6.89058 32.375 7.70833 32.375H29.2917C30.9875 32.375 32.375 30.9875 32.375 29.2917V7.70833C32.375 6.0125 30.9875 4.625 29.2917 4.625Z" + fill="currentcolor" + /> + </svg> + </div> + <span className="flex ms-14 whitespace-nowrap text-lg text-left"> Log Out </span> </div> </button> </div> </a> - ) : null} + ) : ( + null + )} </div> </div> ); diff --git a/frontend/src/components/TenantCard.tsx b/frontend/src/components/TenantCard.tsx index 0d0d92d..dbb4072 100644 --- a/frontend/src/components/TenantCard.tsx +++ b/frontend/src/components/TenantCard.tsx @@ -39,7 +39,8 @@ export default function TenantCard({ data }: { data: TenantCardProps[] }) { <span className="px-3 font-light">Rp.{lowestpriceidr} - Rp.{highestpriceidr}</span> </div> </div> - </a> + </div> + </a> ); }, ); diff --git a/frontend/src/pages/OrderSummary.tsx b/frontend/src/pages/OrderSummary.tsx index 3e9d820..ba6ba40 100644 --- a/frontend/src/pages/OrderSummary.tsx +++ b/frontend/src/pages/OrderSummary.tsx @@ -154,9 +154,6 @@ export default function OrderSummary() { <div className="ms-20 py-12 bg-white rounded-3xl"> <h2 className="text-mealshub-red text-3xl font-bold ms-16">Order Summary</h2> <OrderDetailsCard data={joinedOrderDetailsData} /> -<<<<<<< HEAD - <OrderSummaryCard data={joinedOrderSummaryData} /> -======= <OrderSummaryCard data={joinedOrderSummaryData} customer={true} /> {joinedOrderDetailsData.map((order) => { if (order.paymentstatus === "Waiting for Confirmation") { @@ -170,7 +167,6 @@ export default function OrderSummary() { } return null; })} ->>>>>>> cd14ccc80038e5ec620f4f13cc1d5420599e0ed5 </div> </div> </div> -- GitLab