import React from 'react'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import Column from 'flavours/glitch/components/column'; import ColumnHeader from 'flavours/glitch/components/column_header'; import { NavLink, Switch, Route } from 'react-router-dom'; import Links from './links'; import Tags from './tags'; import Statuses from './statuses'; import Suggestions from './suggestions'; import Search from 'flavours/glitch/features/compose/containers/search_container'; import SearchResults from './results'; import { showTrends } from 'flavours/glitch/util/initial_state'; import { Helmet } from 'react-helmet'; import { title } from 'flavours/glitch/util/initial_state'; const messages = defineMessages({ title: { id: 'explore.title', defaultMessage: 'Explore' }, searchResults: { id: 'explore.search_results', defaultMessage: 'Search results' }, }); const mapStateToProps = state => ({ layout: state.getIn(['meta', 'layout']), isSearching: state.getIn(['search', 'submitted']) || !showTrends, }); export default @connect(mapStateToProps) @injectIntl class Explore extends React.PureComponent { static contextTypes = { router: PropTypes.object, }; static propTypes = { intl: PropTypes.object.isRequired, multiColumn: PropTypes.bool, isSearching: PropTypes.bool, layout: PropTypes.string, }; handleHeaderClick = () => { this.column.scrollTop(); } setRef = c => { this.column = c; } render () { const { intl, multiColumn, isSearching, layout } = this.props; return ( {layout === 'mobile' ? (
) : ( )}
{isSearching ? ( ) : (
{intl.formatMessage(messages.title)} - {title}
)}
); } }