diff --git a/src/components/Empty/index.js b/src/components/Empty/index.js
index a300bcb..c16bc91 100644
--- a/src/components/Empty/index.js
+++ b/src/components/Empty/index.js
@@ -5,9 +5,12 @@ export const Empty = ({ text, buttonText, buttonAction }) => {
return (
{text}
+ {buttonText && (
+
+ )}
);
};
diff --git a/src/views/ShoppingCart/index.js b/src/views/ShoppingCart/index.js
index 9e34388..6dc71e8 100644
--- a/src/views/ShoppingCart/index.js
+++ b/src/views/ShoppingCart/index.js
@@ -5,6 +5,7 @@ import {
publicApi,
dialog,
} from "../../redux/actions";
+import { useNavigate } from "react-router-dom";
import separate from "../../utils/separate";
import { toast } from "react-toastify";
import DeliveryForm from "../DeliveryForm";
@@ -12,6 +13,7 @@ import Product from "./Product";
import Address from "../Address";
import Code from "./Code";
import Button from "../../components/Button";
+import Empty from "../../components/Empty";
//assets
import dropdownIcon from "../../assets/icons/dropdown-blue.svg";
@@ -36,7 +38,7 @@ function ShoppingCart({
setDialog,
}) {
const [phase, setPhase] = useState("products");
-
+ const navigation = useNavigate();
useEffect(() => {
getList();
getFactorInfo({ userId: user?.id });
@@ -165,18 +167,14 @@ function ShoppingCart({
const layouts = {
products: isMobile ? (
<>
- {productsLength ? (
- list
- .sort((a, b) => a?.id - b?.id)
- .map(
- (product, index) =>
- product.condition < 2 && (
-
- )
- )
- ) : (
- سبد خرید شما خالی است.
- )}
+ {list
+ .sort((a, b) => a?.id - b?.id)
+ .map(
+ (product, index) =>
+ product.condition < 2 && (
+
+ )
+ )}
>
) : productsLength ? (
@@ -190,65 +188,76 @@ function ShoppingCart({
return isMobile ? (
-
{layouts[phase]}
- {phase !== "address" && (
+ {productsLength ? (
<>
-
-
-
- جمع کل سبد خرید
-
-
- {separate(factorInfo?.payPrice) + " " + "تومان"}
-
-
-
-
-
- هزینه ارسال کالا پس از تعیین محل آدرس مشخص میشود
-
-
-
- {phase !== "products" && (
-
+ {phase !== "address" && (
+ <>
+
+
+
+ جمع کل سبد خرید
+
+
+ {separate(factorInfo?.payPrice) + " " + "تومان"}
+
+
+
+
+
+ هزینه ارسال کالا پس از تعیین محل آدرس مشخص میشود
+
+
+
-
+ {phase !== "products" && (
+
+ )}
+ >
)}
>
+ ) : (
+ navigation('/products')}
+ />
)}
) : (