// @flow import * as React from 'react'; import { connect } from 'react-redux'; import compose from 'recompose/compose'; import { Route, withRouter } from 'react-router-dom'; import Icon from 'src/components/icon'; import Tooltip from 'src/components/tooltip'; import viewNetworkHandler from 'src/components/viewNetworkHandler'; import { getAccessibilityActiveState } from './accessibility'; import { NavigationContext } from 'src/helpers/navigation-context'; import { withCurrentUser } from 'src/components/withCurrentUser'; import { MIN_WIDTH_TO_EXPAND_NAVIGATION } from 'src/components/layout'; import { AvatarGrid, AvatarLink, Label, IconWrapper, RedDot } from './style'; type Props = { count: number, isActive: boolean, dispatch: Function, refetch: Function, currentUser?: Object, }; const DirectMessagesTab = (props: Props) => { const { count } = props; const isWideViewport = window && window.innerWidth > MIN_WIDTH_TO_EXPAND_NAVIGATION; return ( {({ setNavigationIsOpen }) => ( {({ match }) => ( setNavigationIsOpen(false)} {...getAccessibilityActiveState( match && match.url.includes('/messages') )} > {count > 0 && ( )} )} )} ); }; const map = state => ({ networkOnline: state.connectionStatus.networkOnline, websocketConnection: state.connectionStatus.websocketConnection, }); export default compose( // $FlowIssue connect(map), viewNetworkHandler, withRouter, withCurrentUser )(DirectMessagesTab);