import React from 'react' import PropTypes from 'prop-types' import { connect } from 'react-redux' import { Link, NavLink } from 'react-router-dom' import ImmutablePropTypes from 'react-immutable-proptypes' import ImmutablePureComponent from 'react-immutable-pure-component' import { injectIntl, defineMessages } from 'react-intl' import { CX } from '../constants' import Avatar from './avatar' import DisplayName from './display_name' import Button from './button' import Heading from './heading' import Text from './text' import List from './list' import { closeSidebar } from '../actions/sidebar' import { openModal } from '../actions/modal' import { shortNumberFormat } from '../utils/numbers' import { me } from '../initial_state' import { makeGetAccount } from '../selectors' import WrappedBundle from '../features/ui/util/wrapped_bundle' import { ProgressPanel, } from '../features/ui/util/async_components' class SidebarXS extends ImmutablePureComponent { componentDidUpdate () { if (!me) return if (this.props.sidebarOpen) { document.body.classList.add(_s.overflowYHidden) } else { document.body.classList.remove(_s.overflowYHidden) } } handleSidebarClose = () => { document.body.classList.remove(_s.overflowYHidden) this.props.onCloseSidebar() } render () { const { sidebarOpen, intl, account } = this.props if (!me || !account) return null const acct = account.get('acct') const isPro = account.get('is_pro') const mainItems = [ { to: `/${acct}`, onClick: this.handleSidebarClose, title: intl.formatMessage(messages.profile), }, { icon: 'list', to: '/lists', onClick: this.handleSidebarClose, title: intl.formatMessage(messages.lists), }, { icon: 'star', to: '/shortcuts', onClick: this.handleSidebarClose, title: intl.formatMessage(messages.shortcuts), }, { icon: 'pro', href: 'https://pro.gab.com', onClick: this.handleSidebarClose, title: intl.formatMessage(messages.pro), }, { icon: 'shop', href: 'https://shop.dissenter.com', onClick: this.handleSidebarClose, title: intl.formatMessage(messages.shop), }, { icon: 'search', to: '/search', onClick: this.handleSidebarClose, title: intl.formatMessage(messages.search), }, { icon: 'circle', to: '/timeline/pro', onClick: this.handleSidebarClose, title: intl.formatMessage(messages.proFeed), }, { icon: 'cog', href: '/settings/preferences', onClick: this.handleSidebarClose, title: intl.formatMessage(messages.preferences), }, // { // icon: 'group', // to: '/follow_requests', // onClick: this.handleSidebarClose, // title: intl.formatMessage(messages.follow_requests), // }, { icon: 'block', to: '/settings/blocks', onClick: this.handleSidebarClose, title: intl.formatMessage(messages.blocks), }, { icon: 'audio-mute', to: '/settings/mutes', onClick: this.handleSidebarClose, title: intl.formatMessage(messages.mutes), }, // { // icon: 'report', // to: '/filters', // onClick: this.handleSidebarClose, // title: intl.formatMessage(messages.filters), // }, { onClick: this.props.onOpenDisplayModel, //on open display model title: intl.formatMessage(messages.display), }, { href: 'https://help.gab.com', onClick: this.handleSidebarClose, title: intl.formatMessage(messages.help), }, { href: '/auth/sign_out', title: intl.formatMessage(messages.logout), }, ] const containerClasses = CX({ d: 1, posFixed: 1, top0: 1, left0: 1, right0: 1, bottom0: 1, z5: 1, displayNone: !sidebarOpen, }) return (