Skip to content

Commit fad7680

Browse files
committed
Bug | always showing candidates controls
1 parent d7fa864 commit fad7680

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

src/components/map-projects/Candidates.jsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ const CandidateList = ({candidates, header, rowIndex, orderBy, order, onOrderCha
7070
return cols
7171
}
7272
const count = candidates.length
73+
const showHeader = count > 0
7374

74-
return count > 0 ? (
75+
return (
7576
<ul>
7677
<SearchResults
7778
id={rowIndex}
@@ -95,16 +96,22 @@ const CandidateList = ({candidates, header, rowIndex, orderBy, order, onOrderCha
9596
(showAnalysis && openAnalysis) ? (
9697
<div className='col-xs-12 padding-0' style={{display: 'inline-flex', flexDirection: 'column'}}>
9798
<AICandidatesAnalysis analysis={analysis} onClose={onCloseAnalysis} sx={{marginBottom: '4px'}}/>
99+
{
100+
showHeader &&
98101
<ListSubheader sx={{lineHeight: '28px', padding: '2px 8px', background: bgColor || 'rgb(229, 229, 229)', display: 'inline-flex', justifyContent: 'space-between', width: '100%', color: '#000', fontSize: '12px'}}>
99102
<b>{header}</b>
100103
<b>{count.toLocaleString()}</b>
101104
</ListSubheader>
105+
}
102106
</div>
103107
) :
104-
<ListSubheader sx={{lineHeight: '28px', padding: '2px 8px', background: bgColor || 'rgb(229, 229, 229)', display: 'inline-flex', justifyContent: 'space-between', width: '100%', color: '#000', fontSize: '12px', borderBottom: bridge ? `1px solid ${PRIMARY_COLORS.main}` : undefined}}>
105-
<b>{header}</b>
106-
<b>{count.toLocaleString()}</b>
107-
</ListSubheader>
108+
(
109+
showHeader &&
110+
<ListSubheader sx={{lineHeight: '28px', padding: '2px 8px', background: bgColor || 'rgb(229, 229, 229)', display: 'inline-flex', justifyContent: 'space-between', width: '100%', color: '#000', fontSize: '12px', borderBottom: bridge ? `1px solid ${PRIMARY_COLORS.main}` : undefined}}>
111+
<b>{header}</b>
112+
<b>{count.toLocaleString()}</b>
113+
</ListSubheader>
114+
)
108115
}
109116
title=' '
110117
renderer={props => <Concept {...props} key={`${bucketId}-${props?.concept?.uuid}`} onMap={onMap} isSelectedForMap={isSelectedForMap} setShowHighlights={setShowHighlights} repoVersion={repoVersion} isAIRecommended={AIRecommendedCandidateId === props?.concept?.id} AIRecommendedCandidateId={AIRecommendedCandidateId} locales={locales} bridge={bridge} />}
@@ -137,7 +144,7 @@ const CandidateList = ({candidates, header, rowIndex, orderBy, order, onOrderCha
137144
repoDefaultFilters={repoVersion?.meta?.display?.default_filter}
138145
/>
139146
</ul>
140-
): null
147+
)
141148
}
142149

143150
const Candidates = ({rowIndex, alert, setAlert, candidates, orderBy, order, onOrderChange, setShowItem, showItem, setShowHighlights, isSelectedForMap, onMap, onFetchMore, isLoading, candidatesScore, repoVersion, analysis, onFetchRecommendation, appliedFacets, setAppliedFacets, filters, facets, columns, defaultFilters, locales, bridgeCandidates, models, selectedModel, onModelChange, reranker}) => {
@@ -301,7 +308,8 @@ const Candidates = ({rowIndex, alert, setAlert, candidates, orderBy, order, onOr
301308
onFetchMore={onFetchMore}
302309
bgColor={sortRaw ? SCORES_COLOR.available : SCORES_COLOR.recommended}
303310
bucketId={`${rowIndex}-recommended`}
304-
noToolbar={false} onDisplayChange={setDisplay}
311+
noToolbar={false}
312+
onDisplayChange={setDisplay}
305313
toolbarControl={
306314
<IconButton color={(isEmpty(appliedFacets) && !openFilters) ? undefined : 'primary'} sx={{minWidth: 'auto'}} onClick={() => setOpenFilters(!openFilters)} disabled={isEmpty(facets)}>
307315
<Badge badgeContent={flatten(values(appliedFacets).map(v => values(v))).length} color='primary'>

0 commit comments

Comments
 (0)