Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit a2328f0

Browse files
Merge pull request #587 from topcoder-platform/issue-386
issue 386 fix
2 parents 2908d64 + 91eb772 commit a2328f0

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

client/src/components/editFiltersPopup/index.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,43 @@ export default function EditFiltersPopup({ onCancel, onDone }) {
6565
onDone(selectedFilters);
6666
}
6767
search.setFilters(searchFilters);
68+
removeDataFromDisabledFilters(searchFilters)
6869
};
6970

71+
const removeDataFromDisabledFilters = (searchFilters) => {
72+
const companyAttrIdsToBeRemoved = []
73+
for (const [key, value] of Object.entries(searchFilters)) {
74+
if(value.group === "General attributes") {
75+
if(!value.active) {
76+
removeGeneralAttr(value.text);
77+
}
78+
} else {
79+
if(!value.active) {
80+
companyAttrIdsToBeRemoved.push(key);
81+
}
82+
}
83+
}
84+
search.clearSelectCompanyAttributes(companyAttrIdsToBeRemoved)
85+
}
86+
87+
const removeGeneralAttr = (text) => {
88+
if (text === "Location") {
89+
search.selectLocations([])
90+
}
91+
if (text === "Skills") {
92+
search.selectSkills([])
93+
}
94+
if (text === "Achievements") {
95+
search.selectAchievements([])
96+
}
97+
if (text === "Availability") {
98+
search.selectAvailability({
99+
isAvailableSelected: false,
100+
isUnavailableSelected: false
101+
})
102+
}
103+
}
104+
70105
const handleFilterValueChanged = (filter, newValue) => {
71106
var index = selectedFilters.indexOf(filter);
72107
if (newValue) {

client/src/lib/search.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ function useProvideSearch() {
9494
});
9595
};
9696

97+
const clearSelectCompanyAttributes = (ids) => {
98+
const selectedCmpAttr = {...selectedCompanyAttributes};
99+
for (let id of ids) {
100+
selectedCmpAttr[id] = [];
101+
}
102+
setSelectedCompanyAttributes(selectedCmpAttr)
103+
}
104+
97105
const getCompanyAttrActiveFilter = () => {
98106
const companyAttrActiveFilters = [];
99107
for (const filter in filters) {
@@ -120,6 +128,7 @@ function useProvideSearch() {
120128
selectAvailability: setSelectedAvailability,
121129
selectedCompanyAttributes,
122130
selectCompanyAttributes: setSelectedCompanyAttributes,
131+
clearSelectCompanyAttributes,
123132
popupShown,
124133
showPopup,
125134
filters,

0 commit comments

Comments
 (0)