22
33import React from 'react'
44import { useTranslation } from 'react-i18next' ;
5- import Alert from '@mui/material/Alert' ;
6- import Collapse from '@mui/material/Collapse' ;
75import IconButton from '@mui/material/IconButton'
86import ListSubheader from '@mui/material/ListSubheader' ;
97import List from '@mui/material/List' ;
@@ -20,7 +18,6 @@ import Tooltip from '@mui/material/Tooltip'
2018
2119import ExpandLessIcon from '@mui/icons-material/ExpandLess' ;
2220import ExpandMoreIcon from '@mui/icons-material/ExpandMore' ;
23- import CloseIcon from '@mui/icons-material/Close' ;
2421import FilterListIcon from '@mui/icons-material/FilterList' ;
2522import RefreshIcon from '@mui/icons-material/Refresh' ;
2623import SortIcon from '@mui/icons-material/Sort' ;
@@ -411,7 +408,7 @@ const CandidateList = ({rowViews, header, rowIndex, sortBy, order, openConceptPa
411408// conceptCache — project-wide ConceptDefinition store, keyed by concept_key.
412409// algosSelected — algorithm definitions (for headers/grouping).
413410// (plans/unified-mapper-model.md "How the views map onto this model".)
414- const Candidates = ( { rowIndex, alert , setAlert , rowState, conceptCache, targetCanonical, targetRelativeUrl, openConceptPanel, showItem, isSelectedForMap, onMap, onFetchMore, isLoading, candidatesScore, repoVersion, analysis, onFetchRecommendation, appliedFacets, setAppliedFacets, filters, facets, columns, defaultFilters, locales, models, selectedModel, onModelChange, promptTemplates, promptTemplate, onPromptTemplateChange, onRefreshClick, rowStage, inAIAssistantGroup, algosSelected, isCoreUser} ) => {
411+ const Candidates = ( { rowIndex, rowState, conceptCache, targetCanonical, targetRelativeUrl, openConceptPanel, showItem, isSelectedForMap, onMap, onFetchMore, isLoading, candidatesScore, repoVersion, analysis, onFetchRecommendation, appliedFacets, setAppliedFacets, filters, facets, columns, defaultFilters, locales, models, selectedModel, onModelChange, promptTemplates, promptTemplate, onPromptTemplateChange, onRefreshClick, rowStage, inAIAssistantGroup, algosSelected, isCoreUser} ) => {
415412 const { t } = useTranslation ( ) ;
416413 const [ sortBy , setSortBy ] = React . useState ( 'rerank_score' )
417414 const [ groupBy , setGroupBy ] = React . useState ( 'quality' )
@@ -694,50 +691,32 @@ const Candidates = ({rowIndex, alert, setAlert, rowState, conceptCache, targetCa
694691
695692 return (
696693 < div className = 'col-xs-12 padding-0' >
697- < Collapse in = { Boolean ( alert ?. message ) } >
698- < Alert
699- severity = { alert ?. severity || 'error' }
700- action = {
701- < Button
702- aria-label = "close"
703- color = "inherit"
704- size = "small"
705- onClick = { ( ) => setAlert ( false ) }
706- >
707- < CloseIcon fontSize = "inherit" />
708- </ Button >
709- }
710- sx = { { mb : 2 } }
711- >
712- { alert . message }
713- </ Alert >
714- </ Collapse >
715- < div className = 'col-xs-12 padding-0' style = { { display : 'flex' } } >
716- {
717- ! isEmpty ( facets ) &&
718- < div className = 'col-xs-4 padding-0' style = { openFilters ? { borderRight : '1px solid lightgray' } : { width : 0 , display : 'none' } } >
719- < SearchFilters
720- open = { openFilters }
721- resource = 'concepts'
722- filters = { facets }
723- appliedFilters = { appliedFacets || { } }
724- onChange = { setAppliedFacets }
725- repoDefaultFilters = { filters }
726- defaultFilters = { defaultFilters }
727- properties = { repoVersion ?. meta ?. display ?. concept_summary_properties }
728- propertyFilters = { repoVersion ?. filters }
729- heightToSubtract = { 523 }
730- columns = { columns }
731- />
732- </ div >
733- }
734- < div className = { openFilters ? 'col-xs-8' : 'col-xs-12' } style = { { padding : 0 , paddingLeft : openFilters ? '8px' : 0 } } >
694+ < div className = 'col-xs-12 padding-0' style = { { display : 'flex' } } >
735695 {
736- noCandidatesFound &&
737- < NoResults text = 'We could not find any candidates for this row.' height = '300px' />
696+ ! isEmpty ( facets ) &&
697+ < div className = 'col-xs-4 padding-0' style = { openFilters ? { borderRight : '1px solid lightgray' } : { width : 0 , display : 'none' } } >
698+ < SearchFilters
699+ open = { openFilters }
700+ resource = 'concepts'
701+ filters = { facets }
702+ appliedFilters = { appliedFacets || { } }
703+ onChange = { setAppliedFacets }
704+ repoDefaultFilters = { filters }
705+ defaultFilters = { defaultFilters }
706+ properties = { repoVersion ?. meta ?. display ?. concept_summary_properties }
707+ propertyFilters = { repoVersion ?. filters }
708+ heightToSubtract = { 523 }
709+ columns = { columns }
710+ />
711+ </ div >
738712 }
739- < List
740- sx = { {
713+ < div className = { openFilters ? 'col-xs-8' : 'col-xs-12' } style = { { padding : 0 , paddingLeft : openFilters ? '8px' : 0 } } >
714+ {
715+ noCandidatesFound &&
716+ < NoResults text = 'We could not find any candidates for this row.' height = '300px' />
717+ }
718+ < List
719+ sx = { {
741720 marginTop : '4px' ,
742721 width : '100%' ,
743722 position : 'relative' ,
@@ -980,17 +959,17 @@ const Candidates = ({rowIndex, alert, setAlert, rowState, conceptCache, targetCa
980959 </ >
981960 }
982961 </ List >
983- {
984- onFetchMore && canFetchMore &&
985- < div className = 'col-xs-12 padding-0' style = { { textAlign : 'right' , marginTop : '4px' } } >
986- < Button disabled = { isLoading } size = 'small' variant = 'text' sx = { { textTransform : 'none' } } onClick = { onFetchMore } >
987- { isLoading ? t ( 'map_project.fetching' ) : t ( 'map_project.fetch_more' ) }
988- </ Button >
989- </ div >
990- }
962+ {
963+ onFetchMore && canFetchMore &&
964+ < div className = 'col-xs-12 padding-0' style = { { textAlign : 'right' , marginTop : '4px' } } >
965+ < Button disabled = { isLoading } size = 'small' variant = 'text' sx = { { textTransform : 'none' } } onClick = { onFetchMore } >
966+ { isLoading ? t ( 'map_project.fetching' ) : t ( 'map_project.fetch_more' ) }
967+ </ Button >
968+ </ div >
969+ }
970+ </ div >
991971 </ div >
992972 </ div >
993- </ div >
994973
995974 )
996975}
0 commit comments