36 lines
1.3 KiB
JavaScript
36 lines
1.3 KiB
JavaScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {connect} from 'react-redux';
|
|
|
|
import {handleRemoveLastFile, initUploadFiles} from '@actions/views/file_upload';
|
|
import {getCurrentChannelId} from '@mm-redux/selectors/entities/channels';
|
|
import {canUploadFilesOnMobile, getConfig, getServerVersion} from '@mm-redux/selectors/entities/general';
|
|
import {getDimensions} from '@selectors/device';
|
|
import {checkForFileUploadingInChannel} from '@selectors/file';
|
|
import {getAllowedServerMaxFileSize, getMaxFileCount} from '@utils/file';
|
|
|
|
import Uploads from './uploads';
|
|
|
|
function mapStateToProps(state, ownProps) {
|
|
const {deviceHeight} = getDimensions(state);
|
|
const channelId = getCurrentChannelId(state);
|
|
const config = getConfig(state);
|
|
|
|
return {
|
|
canUploadFiles: canUploadFilesOnMobile(state),
|
|
channelId,
|
|
channelIsLoading: state.views.channel.loading,
|
|
deviceHeight,
|
|
filesUploadingForCurrentChannel: checkForFileUploadingInChannel(state, channelId, ownProps.rootId),
|
|
maxFileSize: getAllowedServerMaxFileSize(config),
|
|
maxFileCount: getMaxFileCount(getServerVersion(state)),
|
|
};
|
|
}
|
|
|
|
const mapDispatchToProps = {
|
|
handleRemoveLastFile,
|
|
initUploadFiles,
|
|
};
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Uploads);
|