worked | 30

temp
mahdi andalib 3 years ago
parent 1465ee1c99
commit c3240e3c67
  1. 19
      src/views/Address/index.js
  2. 11
      src/views/Dashboard/layouts/Main/Addresses/index.js
  3. 2
      src/views/DeliveryForm/Address/index.js

@ -2,6 +2,7 @@ import React, { useState, useEffect } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { useNavigate, useLocation } from "react-router-dom"; import { useNavigate, useLocation } from "react-router-dom";
import { publicApi, userAddress, dialog, user } from "../../redux/actions"; import { publicApi, userAddress, dialog, user } from "../../redux/actions";
import onInput from "../../utils/onInput"; import onInput from "../../utils/onInput";
import location from "../../utils/location"; import location from "../../utils/location";
import Input from "../../components/Input"; import Input from "../../components/Input";
@ -624,24 +625,6 @@ export const Address = ({
)} )}
</div> </div>
</div> </div>
{/* {isMobile && (
<div
className="fixed top-0 left-0 flex justify-between items-center py-3 px-4 w-full"
style={{
backgroundColor: isDark ? "#061B30" : "white",
}}
>
<strong className="text-green4F text-lg font-semibold dark:text-white">
آدرس جدید
</strong>
<img
src={isDark ? arrowWhiteIcon : arrowBlueIcon}
alt="back"
className={`w-6 transform ${isDark ? " rotate-0" : "rotate-180"}`}
onClick={() => setPhase("deliveryForm")}
/>
</div>
)} */}
</div> </div>
); );
}; };

@ -7,11 +7,11 @@ import {
menu, menu,
} from "../../../../../redux/actions"; } from "../../../../../redux/actions";
import Loading from "../../../../../components/Loading";
//components //components
import Button from "../../../../../components/Button"; import Button from "../../../../../components/Button";
import { Link, useNavigate } from "react-router-dom"; import { Link, useNavigate } from "react-router-dom";
import editButton from "../../../../../assets/icons/edit.svg"; import editButton from "../../../../../assets/icons/edit.svg";
import trash from "../../../../../assets/icons/trash.svg"; import trash from "../../../../../assets/icons/trash.svg";
@ -81,6 +81,8 @@ const Location = ({
setMenu, setMenu,
setDialog, setDialog,
deleteAddress, deleteAddress,
userAddressId,
loading,
}) => { }) => {
const [locationMenu, setLocationMenu] = React.useState(false); const [locationMenu, setLocationMenu] = React.useState(false);
@ -123,6 +125,9 @@ const Location = ({
} }
> >
<div className="w-full flex items-center justify-between"> <div className="w-full flex items-center justify-between">
{loading && userAddressId !== address?.id ? (
<Loading size={2} color="bg-red-400" />
) : (
<div className="w-4 h-4 flex flex-col items-center justify-center ml-1 bg-gray-200 rounded-full"> <div className="w-4 h-4 flex flex-col items-center justify-center ml-1 bg-gray-200 rounded-full">
<div <div
className={`w-2 h-2 rounded-full ${ className={`w-2 h-2 rounded-full ${
@ -130,6 +135,7 @@ const Location = ({
}`} }`}
></div> ></div>
</div> </div>
)}
<div className="flex flex-col flex-1 mr-2"> <div className="flex flex-col flex-1 mr-2">
{active && ( {active && (
<div className="w-full flex justify-between mb-3"> <div className="w-full flex justify-between mb-3">
@ -192,6 +198,7 @@ const mapStateToProps = (state) => ({
addresses: state.userAddress.list, addresses: state.userAddress.list,
isMobile: state.publicApi.isMobile, isMobile: state.publicApi.isMobile,
isDark: state.publicApi.isDark, isDark: state.publicApi.isDark,
loading: state.userFactor.loading,
}); });
const mapDispatchToProps = { const mapDispatchToProps = {

@ -89,7 +89,7 @@ function Address({
: update({ userAddressId: address.id, userId }) : update({ userAddressId: address.id, userId })
} }
> >
<div className="flex flex-1 gap-x-4 "> <div className="flex flex-1 items-center gap-x-4 ">
{loading && userAddressId !== address?.id ? ( {loading && userAddressId !== address?.id ? (
<Loading size={2} color="bg-gray-400" /> <Loading size={2} color="bg-gray-400" />
) : ( ) : (

Loading…
Cancel
Save