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 SearchIcon from '@material-symbols/svg-600/outlined/search.svg?react'; import TagIcon from '@material-symbols/svg-600/outlined/tag.svg?react'; import Column from 'mastodon/components/column'; import ColumnHeader from 'mastodon/components/column_header'; import Search from 'mastodon/features/compose/containers/search_container'; import { trendsEnabled } from 'mastodon/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));