From 2b4bccbdb95dbb7586d8c389953fb30077f099b6 Mon Sep 17 00:00:00 2001 From: hozayves Date: Mon, 1 Jul 2024 22:00:38 +0200 Subject: [PATCH] ft checkout page --- src/App.tsx | 5 + .../authentication/LoginComponent.tsx | 6 +- .../authentication/RegisterSection.tsx | 11 +- src/components/checkout/Checkout.tsx | 272 ++++++++++++++++++ src/components/common/Button.tsx | 5 +- src/components/common/Input.tsx | 6 +- src/components/common/Select.tsx | 25 +- src/components/navbar/cartNav/CartNav.tsx | 2 +- src/services/cartApi.ts | 10 +- src/services/orderApi.ts | 19 ++ src/services/paymentApi.ts | 15 + src/utils/schemas.ts | 22 ++ 12 files changed, 371 insertions(+), 27 deletions(-) create mode 100644 src/components/checkout/Checkout.tsx create mode 100644 src/services/orderApi.ts create mode 100644 src/services/paymentApi.ts diff --git a/src/App.tsx b/src/App.tsx index 4404ac7..af9af49 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -12,6 +12,7 @@ import { ProductResponse, Product } from './types/Types'; import { useEffect, useRef } from 'react'; import { useGetProductsQuery } from './services/productApi'; import { setError, setIsLoading, setProductFetched, setProductsDataList } from './redux/slices/productsSlice'; +import Checkout from './components/checkout/Checkout'; import RestrictedRoute from './components/dashboard/RestrictedRoute'; import AdminPage from './pages/admin'; import Category from './pages/admin/Category'; @@ -106,6 +107,10 @@ const App = () => { path: 'products/:id', element: , }, + { + path: "/checkoutbag", + element: + }, ], }, { diff --git a/src/components/authentication/LoginComponent.tsx b/src/components/authentication/LoginComponent.tsx index 9c3490b..21931ac 100644 --- a/src/components/authentication/LoginComponent.tsx +++ b/src/components/authentication/LoginComponent.tsx @@ -97,7 +97,7 @@ const LoginComponent = () => { return (
-
+

Existing Customer?

Sign in to continue

{errors.root && ( @@ -123,7 +123,7 @@ const LoginComponent = () => {

Forget password

@@ -131,7 +131,7 @@ const LoginComponent = () => { or
+
+ )} +
+ +
+
+
+
+

Total (Excl. Delivery)

+ ${totalPrice.toFixed(2)} +
+ {addressAvailable ? ( + <> +
+

Delivery To

+

{shippingAddress.address}, {shippingAddress.city}, {shippingAddress.country}

+ +
+
+

Choose your preferred delivery method

+
+
+ + +
+
+
+ + ) : ( +
+

Delivery To

+ +
+ )} +
+
+
+

I accept Mavericks terms and conditions

+ +
+
+
+
+
+

Your Order

+ + + +
+
+
+
    +
  • Item
  • +
  • Size
  • +
  • Quantity
  • +
  • Price
  • +
+
+ {content} +
+
+
+
+
+

Order Value

+ ${totalPrice.toFixed(2)} +
+
+

Total (Excl.. Delivery)

+ ${totalPrice.toFixed(2)} +
+
+
+
+
+
+ ); +}; + +export default Checkout; diff --git a/src/components/common/Button.tsx b/src/components/common/Button.tsx index 472efaf..dc9c114 100644 --- a/src/components/common/Button.tsx +++ b/src/components/common/Button.tsx @@ -13,10 +13,7 @@ const Button = ({ text, type, className, disabled, onClick }: ButtonProps) => {