- {tAddressManagement('addressConfirmationMessage', {
+ {tAddressManagement('setAddressConfirmation', {
addressType: tAddressManagement(`addressType.${addressType}`),
- isAddressSet: !!userAddress,
})}
+ {userAddress &&
+ tAddressManagement('replaceAddressWarning', {
+ addressType: tAddressManagement(`addressType.${addressType}`),
+ })}
{userAddress !== undefined && (
From b64c57f9b37a0706c5b587a415255b8a6119c172 Mon Sep 17 00:00:00 2001
From: mohitb35 <44917347+mohitb35@users.noreply.github.com>
Date: Wed, 4 Dec 2024 15:14:10 +0530
Subject: [PATCH 81/88] fix: corrects import path for ADDRESS_ACTIONS while
creating AddressAction type
---
src/features/common/types/profile.d.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/features/common/types/profile.d.ts b/src/features/common/types/profile.d.ts
index 88aa9a940c..532583abdc 100644
--- a/src/features/common/types/profile.d.ts
+++ b/src/features/common/types/profile.d.ts
@@ -1,7 +1,7 @@
import type { User, UserPublicProfile } from '@planet-sdk/common';
import type { SetState } from './common';
import type { PublicUser } from './user';
-import type { ADDRESS_ACTIONS } from '../../user/Settings/EditProfile/AddressManagment/microComponents/AddressActionMenu';
+import type { ADDRESS_ACTIONS } from '../../../utils/addressManagement';
export interface UserFeaturesProps {
handleShare: () => void;
From 8ade0d7d8d7b74de348c8f27594e3e77cb032e5b Mon Sep 17 00:00:00 2001
From: sunilsabatp <101264823+sunilsabatp@users.noreply.github.com>
Date: Wed, 4 Dec 2024 17:29:49 +0530
Subject: [PATCH 82/88] refactor: replace SCSS variables with direct values
---
.../AddressManagement.module.scss | 43 +++++++++++++------
1 file changed, 29 insertions(+), 14 deletions(-)
diff --git a/src/features/user/Settings/EditProfile/AddressManagment/AddressManagement.module.scss b/src/features/user/Settings/EditProfile/AddressManagment/AddressManagement.module.scss
index c15b23d3fd..6407a604f7 100644
--- a/src/features/user/Settings/EditProfile/AddressManagment/AddressManagement.module.scss
+++ b/src/features/user/Settings/EditProfile/AddressManagment/AddressManagement.module.scss
@@ -1,9 +1,5 @@
@import '../../../../../theme/theme';
-$border-radius-sm: 8px;
-$border-radius-lg: 16px;
-$padding-standard: 24px;
-
@mixin flex-container($direction: row, $justify: space-between) {
display: flex;
flex-direction: $direction;
@@ -16,16 +12,16 @@ $padding-standard: 24px;
top: 50%;
transform: translate(-50%, -50%);
padding: 20px;
- border-radius: $border-radius-lg;
+ border-radius: 16px;
background: rgba(255, 255, 255, 1);
}
// Base Components
-
.addressManagement {
@include flex-container(column);
margin-top: 40px;
gap: 20px;
+
.maxAddress {
font-size: $fontXSmall;
color: #6c757d;
@@ -47,10 +43,11 @@ $padding-standard: 24px;
@include flex-container;
width: 100%;
background: rgba(242, 242, 242, 0.5);
- border-radius: $border-radius-sm;
+ border-radius: 8px;
font-size: $fontSmall;
font-weight: 400;
- padding: $padding-standard 10px $padding-standard $padding-standard;
+ padding: 24px 10px 24px 24px;
+
.kebabMenuButton {
display: flex;
justify-content: center;
@@ -60,10 +57,12 @@ $padding-standard: 24px;
border-radius: 50%;
background-color: transparent;
cursor: pointer;
+
svg {
height: 20px;
width: 12px;
}
+
&:hover {
background-color: rgba(120, 120, 120, 0.1);
}
@@ -73,6 +72,7 @@ $padding-standard: 24px;
.addressDetails {
@include flex-container(column, center);
gap: 16px;
+
span {
padding: 5px 10px;
max-width: fit-content;
@@ -83,6 +83,7 @@ $padding-standard: 24px;
line-height: 16px;
font-weight: 600;
}
+
p {
margin-top: 2px;
}
@@ -103,12 +104,15 @@ $padding-standard: 24px;
cursor: pointer;
padding: 2px 12px;
list-style: none;
+
.action {
font-size: $fontXSmall;
font-weight: 400;
}
+
li {
- padding: 8px 0px;
+ padding: 8px 0;
+
&:not(:last-child) {
border-bottom: 1px solid rgba(189, 189, 189, 1);
}
@@ -116,75 +120,86 @@ $padding-standard: 24px;
}
// Modal Forms
-
.header {
font-weight: 700;
font-size: $fontSixteen;
}
+
.addressFormLayout {
@include flex-container(column);
@include modal-container;
min-width: 565px;
gap: 40px;
+
.addressForm {
@include flex-container(column);
gap: 23px;
}
+
.buttonContainer {
@include flex-container;
gap: 8px;
margin-top: 25px;
+
button {
flex: 1 1;
}
}
}
+
.addressActionContainer {
@include flex-container(column);
@include modal-container;
width: 468px;
gap: 10px;
+
.address {
width: 100%;
background: rgba(242, 242, 242, 0.5);
- border-radius: $border-radius-sm;
+ border-radius: 8px;
font-size: $fontSmall;
font-weight: 400;
- padding: $padding-standard;
+ padding: 24px;
}
+
.buttonContainer {
@include flex-container;
gap: 8px;
margin-top: 40px;
+
button {
flex: 1 1;
}
}
}
-// Mobile style
+// Mobile Style
@include xsPhoneView {
.addressFormLayout {
min-width: fit-content;
width: 95%;
+
.buttonContainer {
@include flex-container(column);
+
button {
width: 100%;
}
}
}
+
.addressActionContainer {
width: 95%;
min-width: fit-content;
+
.buttonContainer {
flex-direction: column;
gap: 8px;
}
}
}
-// Form spinner
+// Form Spinner
.addressMgmtSpinner {
@include flex-container(row, center);
}
From 2e3127663c867eacc0258fbf268d9821ee12fe1d Mon Sep 17 00:00:00 2001
From: sunilsabatp <101264823+sunilsabatp@users.noreply.github.com>
Date: Thu, 5 Dec 2024 10:42:20 +0530
Subject: [PATCH 83/88] refactor: group the addressManagement translation
resources. - move addressManagement translation resources (profile.json ->
editProfile.json).
---
public/static/locales/en/editProfile.json | 33 +++++++++++++++++++
public/static/locales/en/profile.json | 27 ---------------
.../AddressManagment/AddAddress.tsx | 2 +-
.../AddressManagment/DeleteAddress.tsx | 12 ++++---
.../AddressManagment/EditAddress.tsx | 2 +-
.../AddressManagment/UpdateAddressType.tsx | 8 ++---
.../EditProfile/AddressManagment/index.tsx | 6 ++--
.../microComponents/AddressActionMenu.tsx | 2 +-
.../microComponents/AddressDetails.tsx | 2 +-
.../microComponents/AddressForm.tsx | 3 +-
10 files changed, 53 insertions(+), 44 deletions(-)
diff --git a/public/static/locales/en/editProfile.json b/public/static/locales/en/editProfile.json
index 6d03eac1df..9f274e25d5 100644
--- a/public/static/locales/en/editProfile.json
+++ b/public/static/locales/en/editProfile.json
@@ -68,6 +68,39 @@
"websiteInvalid": "Please enter valid Website URL",
"countryRequired": "Country is required",
"companyRequired": "Company Name is required"
+ },
+ "addressManagement": {
+ "addressManagementTitle": "Address",
+ "addressType": {
+ "primary": "Primary Address",
+ "mailing": "Billing Address"
+ },
+ "actions": {
+ "edit": "Edit",
+ "delete": "Delete",
+ "setAsPrimaryAddress": "Set as Primary Address",
+ "setAsBillingAddress": "Set as Billing Address",
+ "addAddress": "Add New Address"
+ },
+ "deleteAction": {
+ "deleteAddress": "Delete Address",
+ "delete": "Delete",
+ "deleteAddressConfirmationMessage": "Are you sure you want to delete this address? If you want to use it again, please add it as a new address."
+ },
+ "addressPrompts": {
+ "setAddressConfirmation": "Are you sure you want to set this address as your {addressType}?",
+ "confirm": "Confirm"
+ },
+ "addressNotifications": {
+ "maxAddressesMessage": "You have reached the maximum number of addresses! Remove one to add a new address.",
+ "replaceAddressWarning": "This will replace your current {addressType}."
+ },
+ "addressForm": {
+ "addAddress": "Add Address",
+ "editAddress": "Edit Address",
+ "saveChanges": "Save Changes",
+ "address2": "Address 2(optional)"
+ }
}
}
}
diff --git a/public/static/locales/en/profile.json b/public/static/locales/en/profile.json
index fdbf4c196e..2bddb971aa 100644
--- a/public/static/locales/en/profile.json
+++ b/public/static/locales/en/profile.json
@@ -134,33 +134,6 @@
"lifeOnLand": "Life on land",
"partnership": "Partnerships for the goals"
}
- },
- "addressManagement": {
- "addressManagementTitle": "Address",
- "addressType": {
- "primary": "Primary Address",
- "mailing": "Billing Address"
- },
- "actions": {
- "edit": "Edit",
- "delete": "Delete",
- "setAsPrimaryAddress": "Set as Primary Address",
- "setAsBillingAddress": "Set as Billing Address"
- },
- "deleteAddress": "Delete Address",
- "delete": "Delete",
- "setAddressConfirmation": "Are you sure you want to set this address as your {addressType}?",
- "replaceAddressWarning": " This will replace your current {addressType}.",
- "deleteAddressConfirmationMessage": "Are you sure you want to delete this address? If you want to use it again, please add it as a new address.",
- "maxAddressesMessage": "You have reached the maximum number of addresses! Remove one to add a new address.",
- "confirm": "Confirm",
- "addAddress": "Add New Address",
- "addressForm": {
- "addAddress": "Add Address",
- "editAddress": "Edit Address",
- "saveChanges": "Save Changes",
- "address2": "Address 2(optional)"
- }
}
}
}
diff --git a/src/features/user/Settings/EditProfile/AddressManagment/AddAddress.tsx b/src/features/user/Settings/EditProfile/AddressManagment/AddAddress.tsx
index bdffb022db..bada5fb106 100644
--- a/src/features/user/Settings/EditProfile/AddressManagment/AddAddress.tsx
+++ b/src/features/user/Settings/EditProfile/AddressManagment/AddAddress.tsx
@@ -42,7 +42,7 @@ const AddAddress = ({
setUserAddresses,
setAddressAction,
}: Props) => {
- const tAddressManagement = useTranslations('Profile.addressManagement');
+ const tAddressManagement = useTranslations('EditProfile.addressManagement');
const { contextLoaded, user, token, logoutUser } = useUserProps();
const configCountry = getStoredConfig('country');
const defaultCountry = user?.country || configCountry || 'DE';
diff --git a/src/features/user/Settings/EditProfile/AddressManagment/DeleteAddress.tsx b/src/features/user/Settings/EditProfile/AddressManagment/DeleteAddress.tsx
index 884daeaee2..5752c0645b 100644
--- a/src/features/user/Settings/EditProfile/AddressManagment/DeleteAddress.tsx
+++ b/src/features/user/Settings/EditProfile/AddressManagment/DeleteAddress.tsx
@@ -26,7 +26,7 @@ const DeleteAddress = ({
updateUserAddresses,
setAddressAction,
}: Props) => {
- const tAddressManagement = useTranslations('Profile.addressManagement');
+ const tAddressManagement = useTranslations('EditProfile.addressManagement');
const tCommon = useTranslations('Common');
const { contextLoaded, user, token, logoutUser } = useUserProps();
const { tenantConfig } = useTenant();
@@ -58,8 +58,12 @@ const DeleteAddress = ({
};
return (
-