diff --git a/web/sidebar/community-picker.react.js b/web/sidebar/community-picker.react.js index eba75a197..6ac921e31 100644 --- a/web/sidebar/community-picker.react.js +++ b/web/sidebar/community-picker.react.js @@ -1,111 +1,117 @@ // @flow import classNames from 'classnames'; import * as React from 'react'; import { useDispatch } from 'react-redux'; -import { clearCalendarCommunityFilter } from 'lib/actions/community-actions.js'; +import { + clearCalendarCommunityFilter, + clearChatCommunityFilter, +} from 'lib/actions/community-actions.js'; import { useModalContext } from 'lib/components/modal-provider.react.js'; import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; import CommunityCreationModal from './community-creation/community-creation-modal.react.js'; import CommunityDrawer from './community-drawer.react.js'; import css from './community-picker.css'; import { updateNavInfoActionType } from '../redux/action-types.js'; import { useSelector } from '../redux/redux-utils.js'; function CommunityPicker(): React.Node { const dispatch = useDispatch(); const modalContext = useModalContext(); const openAccountSettings = React.useCallback( (event: SyntheticEvent) => { event.preventDefault(); dispatch({ type: updateNavInfoActionType, payload: { tab: 'settings', settingsSection: 'account' }, }); }, [dispatch], ); const isCalendarOpen = useSelector(state => state.navInfo.tab === 'calendar'); const onPressInbox = React.useCallback( (event: SyntheticEvent) => { event.preventDefault(); if (isCalendarOpen) { dispatch({ type: clearCalendarCommunityFilter, }); } else { dispatch({ type: updateNavInfoActionType, payload: { tab: 'chat' }, }); + dispatch({ + type: clearChatCommunityFilter, + }); } }, [dispatch, isCalendarOpen], ); const inboxButtonTitle = isCalendarOpen ? 'All communities' : 'Inbox'; const isInboxOpen = useSelector( state => state.navInfo.tab === 'chat' || state.navInfo.tab === 'calendar', ); const isSettingsOpen = useSelector(state => state.navInfo.tab === 'settings'); const sideLineInbox = classNames({ [css.sideLine]: true, [css.sideLineActive]: isInboxOpen, }); const sideLineSettings = classNames({ [css.sideLine]: true, [css.sideLineActive]: isSettingsOpen, }); const onPressCommunityCreationButton = React.useCallback(() => { modalContext.pushModal(); }, [modalContext]); const isCommunityCreationButtonEnabled = false; let communityCreationButton; if (isCommunityCreationButtonEnabled) { communityCreationButton = (
Create community
); } return (
{communityCreationButton}
); } export default CommunityPicker;