feat: added country disabling feature (#1084)

* feat: added country disabling feature

* fix: lint errors

* test: added test case for disabled countries

* refactor: combined test cases
This commit is contained in:
Awais Ansari
2024-09-17 17:54:14 +05:00
committed by Awais Ansari
parent 8498d9f04f
commit 776cd125a2
6 changed files with 4296 additions and 5 deletions

View File

@@ -22,6 +22,7 @@ export const initialState = {
drafts: {},
isLoadingProfile: true,
isAuthenticatedUserProfile: false,
disabledCountries: ['RU'],
};
const profilePage = (state = initialState, action = {}) => {

View File

@@ -23,6 +23,7 @@ export const isLoadingProfileSelector = state => state.profilePage.isLoadingProf
export const currentlyEditingFieldSelector = state => state.profilePage.currentlyEditingField;
export const accountErrorsSelector = state => state.profilePage.errors;
export const isAuthenticatedUserProfileSelector = state => state.profilePage.isAuthenticatedUserProfile;
export const disabledCountriesSelector = state => state.profilePage.disabledCountries;
export const editableFormModeSelector = createSelector(
profileAccountSelector,
@@ -130,10 +131,14 @@ export const countrySelector = createSelector(
editableFormSelector,
sortedCountriesSelector,
countryMessagesSelector,
(editableForm, sortedCountries, countryMessages) => ({
disabledCountriesSelector,
profileAccountSelector,
(editableForm, sortedCountries, countryMessages, disabledCountries, account) => ({
...editableForm,
sortedCountries,
countryMessages,
disabledCountries,
committedCountry: account.country,
}),
);