diff --git a/src/views/Address/index.js b/src/views/Address/index.js index 9f9d66c..aa10839 100644 --- a/src/views/Address/index.js +++ b/src/views/Address/index.js @@ -44,12 +44,15 @@ export const Address = ({ getAddress, addressInfo, updateAddress, + isDashboard, }) => { const [addressFields, setAddressFields] = useState({}); const [mapAddress, setMapAddress] = useState(null); const navigation = useNavigate(); useEffect(() => { - setHeaderOptions(headerOptions); + if (!isDashboard) { + setHeaderOptions(headerOptions); + } if (province.length <= 1) { getProvince(); } @@ -464,11 +467,7 @@ export const Address = ({ ? profileFields.cellphone || user.cellphone : addressFields?.cellphone } - onChange={(name, value) => - profilePage - ? setProfileFields({ ...profileFields, cellphone: value }) - : onChange(name, value) - } + onChange={(name, value) => onChange(name, value)} align="text-right" direction="ltr" maxLength={11} @@ -496,25 +495,6 @@ export const Address = ({ ) : null} - {profilePage && ( - onInput.phonenumber(val)} - name="nationalId" - onChange={(name, value) => - setProfileFields({ ...profileFields, nationalId: value }) - } - value={profileFields.nationalId || user.nationalId} - align="text-right" - direction="ltr" - /> - )} - - {!isMobile && <>} - - {!isMobile && <>} -
({ loading: state.userAddress.loading, user: state.user.status, cityLoading: state.publicApi.loading, - isMobile: state.publicApi.isMobile, + isMobile: state.config.device === "mobile", isDark: state.publicApi.isDark, profileFields: state.user.profileFields, addressInfo: state.userAddress.info, diff --git a/src/views/Dashboard/layouts/Main/Addresses/index.js b/src/views/Dashboard/layouts/Main/Addresses/index.js index aa8db18..9cd3f8c 100644 --- a/src/views/Dashboard/layouts/Main/Addresses/index.js +++ b/src/views/Dashboard/layouts/Main/Addresses/index.js @@ -1,11 +1,11 @@ import React, { useEffect } from "react"; import { connect } from "react-redux"; - import { userAddress, userFactor, dialog, menu, + dashboard, } from "../../../../../redux/actions"; //components @@ -33,7 +33,8 @@ const ProfileAddress = ({ setMenu, setDialog, deleteAddress, - isDashboard + isDashboard, + setDashboardPage, }) => { const navigation = useNavigate(); @@ -59,7 +60,9 @@ const ProfileAddress = ({ isDark ? "text-white" : "text-gray70" } items-center w-full`} onClick={() => - navigation("/createAddress", { state: { panel: true } }) + isDashboard + ? setDashboardPage("addressForm") + : navigation("/createAddress", { state: { panel: true } }) } style={{ border: `1px solid ${isDark ? "#DBDBDB22" : "#DBDBDB"}`, @@ -223,7 +226,7 @@ const mapStateToProps = (state) => ({ userId: state.user.status?.id, userAddressId: state.userFactor.info?.userAddressId, addresses: state.userAddress.list, - isMobile: state.config.device === 'mobile', + isMobile: state.config.device === "mobile", isDark: state.publicApi.isDark, loading: state.userFactor.loading, }); @@ -235,6 +238,7 @@ const mapDispatchToProps = { deleteAddress: userAddress.del, setMenu: menu.set, setDialog: dialog.set, + setDashboardPage: dashboard.setPage, }; export default connect(mapStateToProps, mapDispatchToProps)(ProfileAddress); diff --git a/src/views/Dashboard/layouts/Main/index.js b/src/views/Dashboard/layouts/Main/index.js index fb98b27..fa7cfa2 100644 --- a/src/views/Dashboard/layouts/Main/index.js +++ b/src/views/Dashboard/layouts/Main/index.js @@ -25,7 +25,7 @@ const views = { favorites: , addresses: , profile: , - addressForm:
, + addressForm:
, }; export const Main = ({ page }) => {