diff --git a/src/components/controls/filter.js b/src/components/controls/filter.js index 7249de186..90d74f3ac 100644 --- a/src/components/controls/filter.js +++ b/src/components/controls/filter.js @@ -77,7 +77,7 @@ class FilterData extends React.Component { const n = this.props.activeFilters[filterName].filter((f) => f.active).length; return { filterName, - displayName: (filterName===strainSymbol ? "samples" : filterName) + ` (n=${n})`, + displayName: `${n} x ${filterName===strainSymbol ? "samples" : filterName}`, remove: () => {this.props.dispatch(applyFilter("set", filterName, []));} }; }); @@ -102,12 +102,14 @@ class FilterData extends React.Component { {inUseFilters.length ? ( <> - {`${inUseFilters.length} type${inUseFilters.length===1?'':'s'} of filter${inUseFilters.length===1?'':'s'} currently active:`} + {`Currently selected filter categories:`} {inUseFilters.map((filter) => ( - - {filter.displayName} - +
+ + {filter.displayName} + +
))} ) : null} diff --git a/src/components/info/info.js b/src/components/info/info.js index 4fc698166..1912e5a43 100644 --- a/src/components/info/info.js +++ b/src/components/info/info.js @@ -176,7 +176,8 @@ class Info extends React.Component { } makeFilteredDatesButton() { - return ( + return ([ + 'timeFilter', {`${styliseDateRange(this.props.dateMin)} to ${styliseDateRange(this.props.dateMax)}`} - ); + ]); } createFilterBadges(filterName) { return this.props.filters[filterName] .sort((a, b) => a.value < b.value ? -1 : a.value > b.value ? 1 : 0) - .map((item) => ( + .map((item) => ([ + item.value, - )); + ])); } clearFilterButton(field) { return ( @@ -261,10 +263,10 @@ class Info extends React.Component { Reflect.ownKeys(this.props.filters) .filter((filterName) => this.props.filters[filterName].length > 0) .forEach((filterName) => { - filtersByCategory.push(this.createFilterBadges(filterName)); + filtersByCategory.push({name: filterName===strainSymbol?'strain':filterName, badges: this.createFilterBadges(filterName)}); }); if (!datesMaxed) { - filtersByCategory.push([this.makeFilteredDatesButton()]); + filtersByCategory.push({name: 'temporal', badges: [this.makeFilteredDatesButton()]}); } return ( @@ -280,8 +282,8 @@ class Info extends React.Component { {showExtended && filtersByCategory.length ? ( <> {t("Filtered to") + " "} - {filtersByCategory.map((filters, idx) => ( - + {filtersByCategory.map((filter, idx) => ( + ))} {". "} @@ -304,11 +306,11 @@ const Brackets = ({badges, idx}) => ( {idx!==0 && } {badges.length === 1 ? null : `{`} - {badges.map((b, i) => ( - <> - {b} + {badges.map(([name, badge], i) => ( + + {badge} {i!==badges.length-1 ? ", " : null} - + ))} {badges.length === 1 ? null : `}`}