Skip to content

Commit 8233dd8

Browse files
committed
OpenConceptLab/ocl_issues#2242 | No results view for candidates
1 parent 39f294c commit 8233dd8

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/components/map-projects/Candidates.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import get from 'lodash/get'
1616
import { highlightTexts, hasAuthGroup, getCurrentUser } from '../../common/utils';
1717
import { SCORES_COLOR } from './constants'
1818
import SearchResults from '../search/SearchResults';
19+
import NoResults from '../search/NoResults';
1920
import Mappings from './Mappings'
2021
import Concept from './Concept'
2122
import IncludeRetired from './IncludeRetired'
@@ -184,6 +185,8 @@ const Candidates = ({rowIndex, alert, setAlert, candidates, orderBy, order, onOr
184185
setOpenAIAnalysis(false)
185186
}, [rowIndex])
186187

188+
const noCandidatesFound = !isLoading && !isNoneLoaded && results?.length === 0
189+
187190
return (
188191
<div className='col-xs-12 padding-0'>
189192
<Collapse in={Boolean(alert?.message)}>
@@ -205,6 +208,10 @@ const Candidates = ({rowIndex, alert, setAlert, candidates, orderBy, order, onOr
205208
</Alert>
206209
</Collapse>
207210
<div className='col-xs-12 padding-0'>
211+
{
212+
noCandidatesFound &&
213+
<NoResults text='We could not find any candidates for this row.' height='300px' />
214+
}
208215
<List
209216
sx={{
210217
marginTop: '4px',

src/components/search/NoResults.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import SvgIcon from '@mui/material/SvgIcon';
33
import { useTranslation } from 'react-i18next'
44

5-
const NoResults = ({searchedText, height}) => {
5+
const NoResults = ({searchedText, height, text}) => {
66
const { t } = useTranslation()
77
return (
88
<div className='col-xs-12' style={{display: 'flex', height: height, alignItems: 'center', justifyContent: 'center', textAlign: 'center', flexDirection: 'column'}}>
@@ -17,7 +17,9 @@ const NoResults = ({searchedText, height}) => {
1717
</defs>
1818
</SvgIcon>
1919
<div className='col-xs-12' style={{marginTop: '16px'}}>
20-
{t('search.no_results')} <b>{searchedText}</b>.
20+
{
21+
text ? text : <>{t('search.no_results')} <b>{searchedText}</b>.</>
22+
}
2123
</div>
2224
</div>
2325
)

0 commit comments

Comments
 (0)