-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'async' into release/3.0
- Loading branch information
Showing
219 changed files
with
5,114 additions
and
3,841 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,54 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import AgendaFeaturedStoriesToogle from './AgendaFeaturedStoriesToogle'; | ||
import {DISPLAY_AGENDA_FEATURED_STORIES_ONLY} from 'utils'; | ||
import {DISPLAY_AGENDA_FEATURED_STORIES_ONLY, isMobilePhoneScreen} from 'utils'; | ||
import ListViewOptions from 'components/ListViewOptions'; | ||
import NewItemsIcon from 'search/components/NewItemsIcon'; | ||
import {WithScreenSizeObserver} from '@sourcefabric/common'; | ||
import {IAgendaItem, IEvent} from 'interfaces'; | ||
|
||
function AgendaListViewControls({activeView, setView, hideFeaturedToggle, toggleFeaturedFilter, featuredFilter, hasAgendaFeaturedItems}: any) { | ||
return ( | ||
<div className="navbar navbar--flex navbar--small navbar--list-controls "> | ||
<div className="navbar__inner navbar__inner--end"> | ||
{!hideFeaturedToggle && hasAgendaFeaturedItems && DISPLAY_AGENDA_FEATURED_STORIES_ONLY && | ||
<AgendaFeaturedStoriesToogle onChange={toggleFeaturedFilter} featuredFilter={featuredFilter}/> | ||
} | ||
<ListViewOptions setView={setView} activeView={activeView} /> | ||
</div> | ||
</div> | ||
); | ||
interface IProps { | ||
activeView?: string; | ||
hideFeaturedToggle?: boolean; | ||
featuredFilter?: boolean; | ||
hasAgendaFeaturedItems?: boolean; | ||
newItems?: Array<IAgendaItem['_id']>; | ||
setView: (view: {type: string, label: string}) => void; | ||
toggleFeaturedFilter: (event: IEvent) => void; | ||
fetchItems: () => void; | ||
} | ||
|
||
function AgendaListViewControls({activeView, setView, hideFeaturedToggle, toggleFeaturedFilter, featuredFilter, hasAgendaFeaturedItems, newItems, fetchItems}: IProps) { | ||
const renderRefreshButton = (newItems || []).length > 0 && ( | ||
<div className="navbar__inner navbar__inner--icon"> | ||
<NewItemsIcon | ||
newItems={newItems} | ||
refresh={fetchItems} | ||
/> | ||
</div> | ||
); | ||
|
||
AgendaListViewControls.propTypes = { | ||
activeView: PropTypes.string, | ||
setView: PropTypes.func.isRequired, | ||
toggleFeaturedFilter: PropTypes.func.isRequired, | ||
hideFeaturedToggle: PropTypes.bool, | ||
featuredFilter: PropTypes.bool, | ||
hasAgendaFeaturedItems: PropTypes.bool, | ||
}; | ||
return ( | ||
<WithScreenSizeObserver> | ||
{(dimensions) => ( | ||
<div className="navbar navbar--flex navbar--small navbar--list-controls"> | ||
{isMobilePhoneScreen(dimensions.width) | ||
? renderRefreshButton | ||
: ( | ||
<> | ||
{renderRefreshButton} | ||
<div className="navbar__inner navbar__inner--end navbar__inner--buttons"> | ||
{!hideFeaturedToggle && hasAgendaFeaturedItems && DISPLAY_AGENDA_FEATURED_STORIES_ONLY && | ||
<AgendaFeaturedStoriesToogle onChange={toggleFeaturedFilter} featuredFilter={featuredFilter}/> | ||
} | ||
<ListViewOptions setView={setView} activeView={activeView} /> | ||
</div> | ||
</> | ||
) | ||
} | ||
</div> | ||
)} | ||
</WithScreenSizeObserver> | ||
); | ||
} | ||
|
||
export default AgendaListViewControls; |
Oops, something went wrong.