Rewritten filesharing to move responsability of filesharing to RoomClient. Removed and rewrote some code to clean up.

This commit is contained in:
Håvar Aambø Fosstveit
2018-12-17 15:13:22 +01:00
parent 60fb9c735e
commit db9d423feb
21 changed files with 608 additions and 918 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ import * as stateActions from '../../redux/stateActions';
import ParticipantList from '../ParticipantList/ParticipantList';
import Chat from '../Chat/Chat';
import Settings from '../Settings';
import FileSharing from '../FileSharing';
import FileSharing from '../FileSharing/FileSharing';
import TabHeader from './TabHeader';
class ToolArea extends React.Component
@@ -1,77 +0,0 @@
import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import * as stateActions from '../../redux/stateActions';
class ToolAreaButton extends React.Component
{
render()
{
const {
toolAreaOpen,
toggleToolArea,
unread,
visible
} = this.props;
return (
<div
data-component='ToolAreaButton'
className={classnames('room-controls', {
on : toolAreaOpen,
visible
})}
>
<div
className={classnames('button toolarea-button', {
on : toolAreaOpen
})}
data-tip='Open tools'
data-type='dark'
onClick={() => toggleToolArea()}
/>
{!toolAreaOpen && unread > 0 && (
<span className={classnames('badge', { long: unread >= 10 })}>
{unread}
</span>
)}
</div>
);
}
}
ToolAreaButton.propTypes =
{
toolAreaOpen : PropTypes.bool.isRequired,
toggleToolArea : PropTypes.func.isRequired,
unread : PropTypes.number.isRequired,
visible : PropTypes.bool.isRequired
};
const mapStateToProps = (state) =>
{
return {
toolAreaOpen : state.toolarea.toolAreaOpen,
visible : state.room.toolbarsVisible,
unread : state.toolarea.unreadMessages + state.toolarea.unreadFiles
};
};
const mapDispatchToProps = (dispatch) =>
{
return {
toggleToolArea : () =>
{
dispatch(stateActions.toggleToolArea());
}
};
};
const ToolAreaButtonContainer = connect(
mapStateToProps,
mapDispatchToProps
)(ToolAreaButton);
export default ToolAreaButtonContainer;