From 64abecb37b309d4c8429b22a94408778303e986e Mon Sep 17 00:00:00 2001 From: dzonidoo Date: Thu, 17 Oct 2024 14:11:28 +0200 Subject: [PATCH] changes after review --- assets/globals.d.ts | 1 + assets/search/components/SearchResultsBar/index.tsx | 6 ++++-- assets/ui/components/Popover.tsx | 4 ++-- assets/wire/components/WireApp.tsx | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/assets/globals.d.ts b/assets/globals.d.ts index 8618de643..2015be61b 100644 --- a/assets/globals.d.ts +++ b/assets/globals.d.ts @@ -64,6 +64,7 @@ interface IClientConfig { collapsed_search_by_default?: boolean; show_user_register?: boolean; multimedia_website_search_url?: string; + show_default_time_frame_label?: boolean; } interface Window { diff --git a/assets/search/components/SearchResultsBar/index.tsx b/assets/search/components/SearchResultsBar/index.tsx index 867ce3174..2f0951e41 100644 --- a/assets/search/components/SearchResultsBar/index.tsx +++ b/assets/search/components/SearchResultsBar/index.tsx @@ -75,6 +75,7 @@ interface IOwnProps { showTotalLabel?: boolean; showSaveTopic?: boolean; showSortDropdown?: boolean; + showDefaultTimeframeLabel?: boolean; totalItems?: number; activeTopic: ITopic; topicType: ITopic['topic_type']; @@ -210,14 +211,15 @@ class SearchResultsBarComponent extends React.Component { }) } - {(() => { + {this.props.showDefaultTimeframeLabel && (() => { if (!(this.props.activeDateFilter?.date_filter == null && defaultDateFilter?.name != null)) { return null; } const dateFilterName = defaultDateFilter.name; + return ( - {gettext('{{dateFilterName}}', {dateFilterName: dateFilterName})} + {dateFilterName} { - elem: any; - referenceElem: any; + elem: HTMLElement | undefined; + referenceElem: HTMLElement | undefined; constructor(props: any) { super(props); diff --git a/assets/wire/components/WireApp.tsx b/assets/wire/components/WireApp.tsx index bef9762c9..e386c59b2 100644 --- a/assets/wire/components/WireApp.tsx +++ b/assets/wire/components/WireApp.tsx @@ -5,7 +5,7 @@ import {connect} from 'react-redux'; import {get, isEqual} from 'lodash'; import {ISearchSortValue} from 'interfaces'; -import {gettext, DISPLAY_NEWS_ONLY, DISPLAY_ALL_VERSIONS_TOGGLE} from 'utils'; +import {gettext, DISPLAY_NEWS_ONLY, DISPLAY_ALL_VERSIONS_TOGGLE, getConfig} from 'utils'; import {getSingleFilterValue, searchParamsUpdated} from 'search/utils'; import { @@ -224,6 +224,7 @@ class WireApp extends SearchBase { refresh={this.props.fetchItems} setSortQuery={this.props.setSortQuery} setQuery={this.props.setQuery} + showDefaultTimeframeLabel={getConfig('show_default_time_frame_label') ?? true} /> ) }