remove unused code in connection-status modal

This commit is contained in:
Ramón Souza 2023-02-17 09:58:24 -03:00
parent 7c4a455d6c
commit 981909fe6c
4 changed files with 5 additions and 184 deletions

View File

@ -3,7 +3,6 @@ import { FormattedTime, defineMessages, injectIntl } from 'react-intl';
import PropTypes from 'prop-types';
import UserAvatar from '/imports/ui/components/user-avatar/component';
import Icon from '/imports/ui/components/connection-status/icon/component';
import Switch from '/imports/ui/components/common/switch/component';
import Service from '../service';
import Styled from './styles';
import ConnectionStatusHelper from '../status-helper/container';
@ -163,7 +162,6 @@ class ConnectionStatusComponent extends PureComponent {
this.help = Service.getHelp();
this.state = {
selectedTab: 0,
dataSaving: props.dataSaving,
hasNetworkData: false,
copyButtonText: intl.formatMessage(intlMessages.copy),
networkData: {
@ -183,7 +181,6 @@ class ConnectionStatusComponent extends PureComponent {
},
},
};
this.displaySettingsStatus = this.displaySettingsStatus.bind(this);
this.setButtonMessage = this.setButtonMessage.bind(this);
this.rateInterval = null;
this.audioUploadLabel = intl.formatMessage(intlMessages.audioUploadRate);
@ -207,12 +204,6 @@ class ConnectionStatusComponent extends PureComponent {
});
}
handleDataSavingChange(key) {
const { dataSaving } = this.state;
dataSaving[key] = !dataSaving[key];
this.setState(dataSaving);
}
setButtonMessage(msg) {
this.setState({
copyButtonText: msg,
@ -278,17 +269,6 @@ class ConnectionStatusComponent extends PureComponent {
}, NETWORK_MONITORING_INTERVAL_MS);
}
displaySettingsStatus(status) {
const { intl } = this.props;
return (
<Styled.ToggleLabel>
{status ? intl.formatMessage(intlMessages.on)
: intl.formatMessage(intlMessages.off)}
</Styled.ToggleLabel>
);
}
/**
* Copy network data to clipboard
* @return {Promise} A Promise that is resolved after data is copied.
@ -403,74 +383,6 @@ class ConnectionStatusComponent extends PureComponent {
});
}
renderDataSaving() {
const {
intl,
dataSaving,
} = this.props;
const {
viewParticipantsWebcams,
viewScreenshare,
} = dataSaving;
return (
<Styled.DataSaving>
<Styled.Description>
{intl.formatMessage(intlMessages.dataSaving)}
</Styled.Description>
<Styled.Row>
<Styled.Col aria-hidden="true">
<Styled.FormElement>
<Styled.Label>
{intl.formatMessage(intlMessages.webcam)}
</Styled.Label>
</Styled.FormElement>
</Styled.Col>
<Styled.Col>
<Styled.FormElementRight>
{this.displaySettingsStatus(viewParticipantsWebcams)}
<Switch
icons={false}
defaultChecked={viewParticipantsWebcams}
onChange={() => this.handleDataSavingChange('viewParticipantsWebcams')}
ariaLabelledBy="webcam"
ariaLabel={intl.formatMessage(intlMessages.webcam)}
data-test="dataSavingWebcams"
showToggleLabel={false}
/>
</Styled.FormElementRight>
</Styled.Col>
</Styled.Row>
<Styled.Row>
<Styled.Col aria-hidden="true">
<Styled.FormElement>
<Styled.Label>
{intl.formatMessage(intlMessages.screenshare)}
</Styled.Label>
</Styled.FormElement>
</Styled.Col>
<Styled.Col>
<Styled.FormElementRight>
{this.displaySettingsStatus(viewScreenshare)}
<Switch
icons={false}
defaultChecked={viewScreenshare}
onChange={() => this.handleDataSavingChange('viewScreenshare')}
ariaLabelledBy="screenshare"
ariaLabel={intl.formatMessage(intlMessages.screenshare)}
data-test="dataSavingScreenshare"
showToggleLabel={false}
/>
</Styled.FormElementRight>
</Styled.Col>
</Styled.Row>
</Styled.DataSaving>
);
}
/**
* Render network data , containing information abount current upload and
* download rates
@ -492,7 +404,7 @@ class ConnectionStatusComponent extends PureComponent {
const { intl, closeModal } = this.props;
const { networkData, dataSaving, dataPage } = this.state;
const { networkData } = this.state;
const {
audioCurrentUploadRate,
@ -529,7 +441,7 @@ class ConnectionStatusComponent extends PureComponent {
>
<Styled.HelperWrapper>
<Styled.Helper>
<ConnectionStatusHelper closeModal={() => closeModal(dataSaving, intl)} />
<ConnectionStatusHelper closeModal={() => closeModal()} />
</Styled.Helper>
</Styled.HelperWrapper>
<Styled.NetworkDataContent>
@ -609,11 +521,11 @@ class ConnectionStatusComponent extends PureComponent {
intl,
} = this.props;
const { dataSaving, selectedTab } = this.state;
const { selectedTab } = this.state;
return (
<Styled.ConnectionStatusModal
onRequestClose={() => closeModal(dataSaving, intl)}
onRequestClose={() => closeModal()}
hideBorder
contentLabel={intl.formatMessage(intlMessages.ariaTitle)}
data-test="connectionStatusModal"

View File

@ -1,18 +1,14 @@
import React from 'react';
import _ from 'lodash';
import { withTracker } from 'meteor/react-meteor-data';
import { withModalMounter } from '/imports/ui/components/common/modal/service';
import Settings from '/imports/ui/services/settings';
import ConnectionStatusService from '../service';
import ConnectionStatusComponent from './component';
const connectionStatusContainer = props => <ConnectionStatusComponent {...props} />;
export default withModalMounter(withTracker(({ mountModal }) => ({
closeModal: (dataSaving, intl) => {
ConnectionStatusService.updateDataSavingSettings(dataSaving, intl);
closeModal: () => {
mountModal(null);
},
connectionStatus: ConnectionStatusService.getConnectionStatus(),
dataSaving: _.clone(Settings.dataSaving),
}))(connectionStatusContainer));

View File

@ -2,9 +2,7 @@ import styled from 'styled-components';
import Modal from '/imports/ui/components/common/modal/simple/component';
import {
colorOffWhite,
colorGray,
colorGrayDark,
colorGrayLabel,
colorGrayLightest,
colorPrimary,
colorWhite,
@ -101,14 +99,6 @@ const Text = styled.div`
}
`;
const ToggleLabel = styled.span`
margin-right: ${smPaddingX};
[dir="rtl"] & {
margin: 0 0 0 ${smPaddingX};
}
`;
const Avatar = styled.div`
display: flex;
height: 100%;
@ -135,64 +125,6 @@ const Time = styled.div`
justify-content: flex-end;
`;
const DataSaving = styled.div`
background-color: ${colorOffWhite};
box-sizing: border-box;
display: flex;
flex-direction: column;
padding: 1rem;
width: 100%;
`;
const Description = styled.div`
text-align: center;
color: ${colorGray};
margin-bottom: ${smPaddingY};
`;
const Row = styled.div`
display: flex;
flex-flow: row;
flex-grow: 1;
justify-content: space-between;
margin-bottom: 0.7rem;
`;
const Col = styled.div`
display: flex;
flex-grow: 1;
flex-basis: 0;
&:last-child {
padding-right: 0;
padding-left: 1rem;
[dir="rtl"] & {
padding-right: 0.1rem;
padding-left: 0;
}
}
`;
const FormElement = styled.div`
position: relative;
display: flex;
flex-flow: column;
flex-grow: 1;
`;
const FormElementRight = styled(FormElement)`
display: flex;
justify-content: flex-end;
flex-flow: row;
`;
const Label = styled.span`
color: ${colorGrayLabel};
font-size: ${fontSizeSmall};
margin-bottom: ${lgPaddingY};
`;
const NetworkDataContainer = styled(ScrollboxVertical)`
width: 100%;
height: 100%;
@ -453,18 +385,10 @@ export default {
Left,
Name,
Text,
ToggleLabel,
Avatar,
Icon,
Right,
Time,
DataSaving,
Description,
Row,
Col,
FormElement,
Label,
FormElementRight,
NetworkDataContainer,
NetworkData,
CopyContainer,

View File

@ -3,8 +3,6 @@ import ConnectionStatus from '/imports/api/connection-status';
import Users from '/imports/api/users';
import UsersPersistentData from '/imports/api/users-persistent-data';
import Auth from '/imports/ui/services/auth';
import Settings from '/imports/ui/services/settings';
import _ from 'lodash';
import { Session } from 'meteor/session';
import { notify } from '/imports/ui/services/notification';
import { makeCall } from '/imports/ui/services/api';
@ -265,14 +263,6 @@ if (STATS.enabled) {
window.addEventListener('socketstats', handleSocketStatsEvent);
}
const updateDataSavingSettings = (dataSaving, intl) => {
if (!_.isEqual(Settings.dataSaving, dataSaving)) {
Settings.dataSaving = dataSaving;
Settings.save();
if (intl) notify(intl.formatMessage(intlMessages.saved), 'info', 'settings');
}
};
const getNotified = () => {
const notified = Session.get('connectionStatusNotified');
@ -564,7 +554,6 @@ export default {
notification,
startRoundTripTime,
stopRoundTripTime,
updateDataSavingSettings,
getNetworkData,
calculateBitsPerSecond,
calculateBitsPerSecondFromMultipleData,