import PropTypes from 'prop-types'; import { injectIntl, defineMessages } from 'react-intl'; import { Link } from 'react-router-dom'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { Icon } from 'flavours/glitch/components/icon'; import { signOutLink } from 'flavours/glitch/utils/backend_links'; import { conditionalRender } from 'flavours/glitch/utils/react_helpers'; import PeopleIcon from 'mastodon/../material-icons/400-24px/group.svg?react'; import HomeIcon from 'mastodon/../material-icons/400-24px/home-fill.svg?react'; import LogoutIcon from 'mastodon/../material-icons/400-24px/logout.svg?react'; import ManufacturingIcon from 'mastodon/../material-icons/400-24px/manufacturing.svg?react'; import MenuIcon from 'mastodon/../material-icons/400-24px/menu.svg?react'; import NotificationsIcon from 'mastodon/../material-icons/400-24px/notifications-fill.svg?react'; import PublicIcon from 'mastodon/../material-icons/400-24px/public.svg?react'; const messages = defineMessages({ community: { defaultMessage: 'Local timeline', id: 'navigation_bar.community_timeline', }, home_timeline: { defaultMessage: 'Home', id: 'tabs_bar.home', }, logout: { defaultMessage: 'Logout', id: 'navigation_bar.logout', }, notifications: { defaultMessage: 'Notifications', id: 'tabs_bar.notifications', }, public: { defaultMessage: 'Federated timeline', id: 'navigation_bar.public_timeline', }, settings: { defaultMessage: 'App settings', id: 'navigation_bar.app_settings', }, start: { defaultMessage: 'Getting started', id: 'getting_started.heading', }, }); class Header extends ImmutablePureComponent { static propTypes = { columns: ImmutablePropTypes.list, unreadNotifications: PropTypes.number, showNotificationsBadge: PropTypes.bool, intl: PropTypes.object, onSettingsClick: PropTypes.func, onLogout: PropTypes.func.isRequired, }; handleLogoutClick = e => { e.preventDefault(); e.stopPropagation(); this.props.onLogout(); return false; }; render () { const { intl, columns, unreadNotifications, showNotificationsBadge, onSettingsClick } = this.props; // Only renders the component if the column isn't being shown. const renderForColumn = conditionalRender.bind(null, columnId => !columns || !columns.some( column => column.get('id') === columnId, ), ); // The result. return ( ); } } export default injectIntl(Header);