Skip to content

Commit

Permalink
changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
dzonidoo committed Oct 17, 2024
1 parent dcf0209 commit 64abecb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions assets/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions assets/search/components/SearchResultsBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ interface IOwnProps {
showTotalLabel?: boolean;
showSaveTopic?: boolean;
showSortDropdown?: boolean;
showDefaultTimeframeLabel?: boolean;
totalItems?: number;
activeTopic: ITopic;
topicType: ITopic['topic_type'];
Expand Down Expand Up @@ -210,14 +211,15 @@ class SearchResultsBarComponent extends React.Component<IProps, IState> {
})
}
</div>
{(() => {
{this.props.showDefaultTimeframeLabel && (() => {
if (!(this.props.activeDateFilter?.date_filter == null && defaultDateFilter?.name != null)) {
return null;
}
const dateFilterName = defaultDateFilter.name;

return (
<span className='d-flex align-items-center'>
<span className='popup-text--label'>{gettext('{{dateFilterName}}', {dateFilterName: dateFilterName})}</span>
<span className='popup-text--label'>{dateFilterName}</span>

<Popup
placement='right'
Expand Down
4 changes: 2 additions & 2 deletions assets/ui/components/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ interface IState {
}

export class Popup extends React.PureComponent<IProps, IState> {
elem: any;
referenceElem: any;
elem: HTMLElement | undefined;
referenceElem: HTMLElement | undefined;
constructor(props: any) {
super(props);

Expand Down
3 changes: 2 additions & 1 deletion assets/wire/components/WireApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -224,6 +224,7 @@ class WireApp extends SearchBase<any> {
refresh={this.props.fetchItems}
setSortQuery={this.props.setSortQuery}
setQuery={this.props.setQuery}
showDefaultTimeframeLabel={getConfig('show_default_time_frame_label') ?? true}
/>
)
}
Expand Down

0 comments on commit 64abecb

Please sign in to comment.