diff --git a/web/sidebar/community-picker.css b/web/sidebar/community-picker.css --- a/web/sidebar/community-picker.css +++ b/web/sidebar/community-picker.css @@ -51,3 +51,11 @@ align-self: flex-start; width: 100%; } + +.inboxButtonTitle { + font-weight: 500; + font-size: var(--l-font-18); + line-height: 22px; + padding-left: 12px; + color: var(--fg); +} diff --git a/web/sidebar/community-picker.react.js b/web/sidebar/community-picker.react.js --- a/web/sidebar/community-picker.react.js +++ b/web/sidebar/community-picker.react.js @@ -8,7 +8,10 @@ import CommunityDrawer from './community-drawer.react.js'; import css from './community-picker.css'; -import { updateNavInfoActionType } from '../redux/action-types.js'; +import { + clearCalendarCommunityFilter, + updateNavInfoActionType, +} from '../redux/action-types.js'; import { useSelector } from '../redux/redux-utils.js'; function CommunityPicker(): React.Node { @@ -30,15 +33,23 @@ [css.inactiveContainer]: !isSettingsOpen, }); - const openChat = React.useCallback( + const isCalendarOpen = useSelector(state => state.navInfo.tab === 'calendar'); + + const onPressInbox = React.useCallback( (event: SyntheticEvent) => { event.preventDefault(); - dispatch({ - type: updateNavInfoActionType, - payload: { tab: 'chat' }, - }); + if (isCalendarOpen) { + dispatch({ + type: clearCalendarCommunityFilter, + }); + } else { + dispatch({ + type: updateNavInfoActionType, + payload: { tab: 'chat' }, + }); + } }, - [dispatch], + [dispatch, isCalendarOpen], ); const isInboxOpen = useSelector( state => @@ -51,10 +62,13 @@ [css.inactiveContainer]: !isInboxOpen, }); + const inboxButtonTitle = isCalendarOpen ? 'All communities' : 'Inbox'; + return (
- + +
{inboxButtonTitle}