import PropTypes from 'prop-types'; import { PureComponent } from 'react'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { Helmet } from 'react-helmet'; import { NavLink, Switch, Route } from 'react-router-dom'; import { connect } from 'react-redux'; import { ReactComponent as SearchIcon } from '@material-symbols/svg-600/outlined/search.svg'; import { ReactComponent as TagIcon } from '@material-symbols/svg-600/outlined/tag.svg'; import Column from 'flavours/glitch/components/column'; import ColumnHeader from 'flavours/glitch/components/column_header'; import Search from 'flavours/glitch/features/compose/containers/search_container'; import { trendsEnabled } from 'flavours/glitch/initial_state'; import Links from './links'; import SearchResults from './results'; import Statuses from './statuses'; import Suggestions from './suggestions'; import Tags from './tags'; 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']) || !trendsEnabled, }); class Explore extends PureComponent { static contextTypes = { identity: PropTypes.object, }; static propTypes = { intl: PropTypes.object.isRequired, multiColumn: PropTypes.bool, isSearching: PropTypes.bool, }; handleHeaderClick = () => { this.column.scrollTop(); }; setRef = c => { this.column = c; }; render() { const { intl, multiColumn, isSearching } = this.props; const { signedIn } = this.context.identity; return (
{isSearching ? ( ) : ( <>
{signedIn && ( )}
{intl.formatMessage(messages.title)} )}
); } } export default connect(mapStateToProps)(injectIntl(Explore));