This repository was archived by the owner on Mar 13, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -65,8 +65,43 @@ export default function EditFiltersPopup({ onCancel, onDone }) {
65
65
onDone ( selectedFilters ) ;
66
66
}
67
67
search . setFilters ( searchFilters ) ;
68
+ removeDataFromDisabledFilters ( searchFilters )
68
69
} ;
69
70
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
+
70
105
const handleFilterValueChanged = ( filter , newValue ) => {
71
106
var index = selectedFilters . indexOf ( filter ) ;
72
107
if ( newValue ) {
Original file line number Diff line number Diff line change @@ -94,6 +94,14 @@ function useProvideSearch() {
94
94
} ) ;
95
95
} ;
96
96
97
+ const clearSelectCompanyAttributes = ( ids ) => {
98
+ const selectedCmpAttr = { ...selectedCompanyAttributes } ;
99
+ for ( let id of ids ) {
100
+ selectedCmpAttr [ id ] = [ ] ;
101
+ }
102
+ setSelectedCompanyAttributes ( selectedCmpAttr )
103
+ }
104
+
97
105
const getCompanyAttrActiveFilter = ( ) => {
98
106
const companyAttrActiveFilters = [ ] ;
99
107
for ( const filter in filters ) {
@@ -120,6 +128,7 @@ function useProvideSearch() {
120
128
selectAvailability : setSelectedAvailability ,
121
129
selectedCompanyAttributes,
122
130
selectCompanyAttributes : setSelectedCompanyAttributes ,
131
+ clearSelectCompanyAttributes,
123
132
popupShown,
124
133
showPopup,
125
134
filters,
You can’t perform that action at this time.
0 commit comments