Skip to content

Commit 116245e

Browse files
committed
OpenConceptLab/ocl_issues#2211 | fixing search filters reload
1 parent dd02ab0 commit 116245e

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/components/search/SearchFilters.jsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import Checkbox from '@mui/material/Checkbox';
1616
import Divider from '@mui/material/Divider';
1717
import CircularProgress from '@mui/material/CircularProgress';
1818
import { URIToParentParams, currentUserHasAccess } from '../../common/utils'
19-
import { PRIMARY_COLORS } from '../../common/colors'
2019
import { FACET_ORDER } from './ResultConstants';
2120

2221

@@ -102,9 +101,9 @@ const SearchFilters = ({filters, resource, onChange, kwargs, bgColor, appliedFil
102101
const formattedListSubheader = field => {
103102
if(field.startsWith('properties__')){
104103
const fields = field.split('__')
105-
return `Property: ${startCase(fields[1])}`
104+
return startCase(fields[1])
106105
} else if (isFixedConceptField(field)) {
107-
return `Property: ${startCase(field)}`
106+
return startCase(field)
108107
}
109108
return startCase(field)
110109
}
@@ -212,18 +211,17 @@ const SearchFilters = ({filters, resource, onChange, kwargs, bgColor, appliedFil
212211
}
213212
</div>
214213
{
215-
loading &&
214+
loading && isEmpty(uiFilters) &&
216215
<div className='col-xs-12' style={{textAlign: 'center', padding: '16px'}}>
217216
<CircularProgress />
218217
</div>
219218
}
220219
{
221-
!loading && map(uiFilters, (fieldFilters, field) => {
220+
map(uiFilters, (fieldFilters, field) => {
222221
const shouldShowExpand = fieldFilters.length > 4
223222
const isExpanded = expanded.includes(field)
224-
const isProperty = field?.startsWith('properties__') || isFixedConceptField(field)
225223
return (
226-
<div className='col-xs-12 padding-0' style={isProperty ? {border: `4px solid ${PRIMARY_COLORS['90']}`, borderTopWidth: 0, borderBottomWidth: 0} : {}} key={field}>
224+
<div className='col-xs-12 padding-0' key={field}>
227225
<List
228226
dense
229227
sx={{
@@ -235,7 +233,7 @@ const SearchFilters = ({filters, resource, onChange, kwargs, bgColor, appliedFil
235233
>
236234
{
237235
!noSubheader &&
238-
<ListSubheader sx={{padding: isProperty ? '0 4px 2px 4px' : '0 8px', fontWeight: 'bold', backgroundColor: isProperty ? 'primary.90' : bgColor, lineHeight: '30px'}}>
236+
<ListSubheader sx={{padding: '0 8px', fontWeight: 'bold', backgroundColor: bgColor, lineHeight: '30px'}}>
239237
{formattedListSubheader(field)}
240238
</ListSubheader>
241239
}
@@ -245,7 +243,7 @@ const SearchFilters = ({filters, resource, onChange, kwargs, bgColor, appliedFil
245243
const key = `${field}-${value[0]}`
246244

247245
return (
248-
<ListItemButton key={key} onClick={handleToggle(field, value)} sx={{p: isProperty ? '0 12px 0 8px' : '0 12px', paddingTop: index === 0 ? '4px': undefined}} disabled={value[3] === true || (disabledZero && value[1] === 0)}>
246+
<ListItemButton key={key} onClick={handleToggle(field, value)} sx={{p: '0 12px', paddingTop: index === 0 ? '4px': undefined}} disabled={value[3] === true || (disabledZero && value[1] === 0)}>
249247
<ListItemIcon sx={{minWidth: '25px'}}>
250248
<Checkbox
251249
size="small"
@@ -285,7 +283,7 @@ const SearchFilters = ({filters, resource, onChange, kwargs, bgColor, appliedFil
285283
}
286284
{
287285
!noSubheader &&
288-
<Divider sx={isProperty ? {backgroundColor: 'primary.90', borderWidth: '2px', borderColor: 'primary.90'} : {}} />
286+
<Divider />
289287
}
290288
</div>
291289
)

0 commit comments

Comments
 (0)