Faceted Filter controls (GUI) - render SearchResults without SplitPanel if !filters
@@ -421,19 +421,45 @@ class FacetedSearch extends React.Component {
this.props.router.push(item.url);
}
- render () {
- const {systemDictionaries} = this.props;
+ renderSearchResults = () => {
const {
- activeFilters,
documents,
documentsOffset,
error,
- facetsLoaded,
offset,
pageSize,
pending,
presentationMode,
showResults,
+ totalHits
+ } = this.state;
+ return (
+ <SearchResults
+ key="search-results"
+ className={classNames(styles.panel, styles.searchResults)}
+ documents={documents}
+ documentsOffset={documentsOffset}
+ disabled={pending}
+ error={error}
+ offset={offset}
+ pageSize={pageSize}
+ onChangeOffset={this.onChangeOffset}
+ onNavigate={this.onNavigate}
+ showResults={showResults}
+ total={totalHits}
+ onChangeDocumentType={this.onChangeFilter(DocumentTypeFilterName)}
+ mode={presentationMode}
+ />
+ );
+ }
+
+ render () {
+ const {systemDictionaries} = this.props;
+ const {
+ activeFilters,
+ facetsLoaded,
+ pageSize,
+ presentationMode,
totalHits,
query
} = this.state;
@@ -447,6 +473,7 @@ class FacetedSearch extends React.Component {
<Alert message={systemDictionaries.error} type="error" />
);
}
+ const noFilters = this.filters.filter(f => f.name !== DocumentTypeFilterName).length === 0;
return (
<div
className={styles.container}
@@ -491,6 +518,7 @@ class FacetedSearch extends React.Component {
/>
</div>
<div className={styles.content}>
+ {!noFilters ? (
<SplitPanel
contentInfo={[{
key: 'faceted-filter',
@@ -522,23 +550,12 @@ class FacetedSearch extends React.Component {
))
}
</div>
- <SearchResults
- key="search-results"
- className={classNames(styles.panel, styles.searchResults)}
- documents={documents}
- documentsOffset={documentsOffset}
- disabled={pending}
- error={error}
- offset={offset}
- pageSize={pageSize}
- onChangeOffset={this.onChangeOffset}
- onNavigate={this.onNavigate}
- showResults={showResults}
- total={totalHits}
- onChangeDocumentType={this.onChangeFilter(DocumentTypeFilterName)}
- mode={presentationMode}
- />
+ {this.renderSearchResults()}
</SplitPanel>
+ ) : (
+ this.renderSearchResults()
+ )
+ }
</div>
</div>
);
