mattermost-mobile/app/components/sidebars/main/index.js
Shaz Amjad 64223efafe
MM-28474: Custom Sidebar Categories (#5460)
* Further cleanup and fixes

Tests clean-up

Tests fixed?

Plays nicely with threads

Tests fixed

Fixes ESR and show experimental flags

Failing test fixed

DM Fix

WIP: Bottom bar UX

Fixes for unreads

Failing test

Always show current channel

Create a channel in a category!

* Unreads on top

* Various fixes

* Improves category collapsing

* Passes correct ID through

* Tests cleanup

* Redo unreads and unread-button

* Reverts to just using ids

* More unreads back to using ids

* Uses appropriate selectors for pref updates

* Unreads sorted by recency

* Fixes test for recency

* Fixes re-rendering bug

* Code review updates, websocket event debounced
2021-09-20 14:11:57 -04:00

47 lines
1.7 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {setChannelDisplayName, handleSelectChannel} from '@actions/views/channel';
import {makeDirectChannel} from '@actions/views/more_dms';
import {handleNotViewingGlobalThreadsScreen} from '@actions/views/threads';
import {setCategoryCollapsed} from '@mm-redux/actions/channel_categories';
import {joinChannel} from '@mm-redux/actions/channels';
import {getTeams} from '@mm-redux/actions/teams';
import {getTheme} from '@mm-redux/selectors/entities/preferences';
import {getCurrentTeamId, getMyTeamsCount} from '@mm-redux/selectors/entities/teams';
import {getCurrentUser} from '@mm-redux/selectors/entities/users';
import {getViewingGlobalThreads} from '@selectors/threads';
import MainSidebar from './main_sidebar';
function mapStateToProps(state) {
const currentUser = getCurrentUser(state);
return {
locale: currentUser?.locale,
currentTeamId: getCurrentTeamId(state),
currentUserId: currentUser?.id,
teamsCount: getMyTeamsCount(state),
theme: getTheme(state),
viewingGlobalThreads: getViewingGlobalThreads(state),
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
getTeams,
joinChannel,
makeDirectChannel,
setChannelDisplayName,
handleSelectChannel,
setCategoryCollapsed,
handleNotViewingGlobalThreadsScreen,
}, dispatch),
};
}
export default connect(mapStateToProps, mapDispatchToProps, null, {forwardRef: true})(MainSidebar);