Changeset View
Changeset View
Standalone View
Standalone View
web/sidebar/community-picker.react.js
// @flow | // @flow | ||||
import classNames from 'classnames'; | import classNames from 'classnames'; | ||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import { useDispatch } from 'react-redux'; | import { useDispatch } from 'react-redux'; | ||||
import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; | import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; | ||||
import CommunityDrawer from './community-drawer.react.js'; | import CommunityDrawer from './community-drawer.react.js'; | ||||
import css from './community-picker.css'; | import css from './community-picker.css'; | ||||
import { | import { | ||||
clearCalendarCommunityFilter, | clearCalendarCommunityFilter, | ||||
updateNavInfoActionType, | updateNavInfoActionType, | ||||
clearChatCommunityFilter, | |||||
} from '../redux/action-types.js'; | } from '../redux/action-types.js'; | ||||
import { useSelector } from '../redux/redux-utils.js'; | import { useSelector } from '../redux/redux-utils.js'; | ||||
function CommunityPicker(): React.Node { | function CommunityPicker(): React.Node { | ||||
const dispatch = useDispatch(); | const dispatch = useDispatch(); | ||||
const openAccountSettings = React.useCallback( | const openAccountSettings = React.useCallback( | ||||
(event: SyntheticEvent<HTMLButtonElement>) => { | (event: SyntheticEvent<HTMLButtonElement>) => { | ||||
Show All 14 Lines | (event: SyntheticEvent<HTMLAnchorElement>) => { | ||||
dispatch({ | dispatch({ | ||||
type: clearCalendarCommunityFilter, | type: clearCalendarCommunityFilter, | ||||
}); | }); | ||||
} else { | } else { | ||||
dispatch({ | dispatch({ | ||||
type: updateNavInfoActionType, | type: updateNavInfoActionType, | ||||
payload: { tab: 'chat' }, | payload: { tab: 'chat' }, | ||||
}); | }); | ||||
dispatch({ | |||||
type: clearChatCommunityFilter, | |||||
}); | |||||
} | } | ||||
}, | }, | ||||
[dispatch, isCalendarOpen], | [dispatch, isCalendarOpen], | ||||
); | ); | ||||
const inboxButtonTitle = isCalendarOpen ? 'All communities' : 'Inbox'; | const inboxButtonTitle = isCalendarOpen ? 'All communities' : 'Inbox'; | ||||
const isInboxOpen = useSelector( | const isInboxOpen = useSelector( | ||||
Show All 40 Lines |