Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 84111a2

Browse files
authored
Merge pull request #5326 from matrix-org/t3chguy/fix/11195
Discard all mx_fadable legacy cruft which is totally useless
2 parents 0c87df4 + 916c78d commit 84111a2

File tree

7 files changed

+4
-105
lines changed

7 files changed

+4
-105
lines changed

res/css/_common.scss

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,6 @@ input[type=text]:focus, input[type=password]:focus, textarea:focus {
208208
border: 0;
209209
}
210210

211-
/* applied to side-panels and messagepanel when in RoomSettings */
212-
.mx_fadable {
213-
opacity: 1;
214-
transition: opacity 0.2s ease-in-out;
215-
}
216-
217211
// These are magic constants which are excluded from tinting, to let themes
218212
// (which only have CSS, unlike skins) tell the app what their non-tinted
219213
// colourscheme is by inspecting the stylesheet DOM.

src/components/structures/GroupView.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,6 @@ export default class GroupView extends React.Component {
649649
editing: false,
650650
summary: null,
651651
});
652-
dis.dispatch({action: 'panel_disable'});
653652
this._initGroupStore(this.props.groupId);
654653

655654
if (this.state.avatarChanged) {
@@ -870,10 +869,7 @@ export default class GroupView extends React.Component {
870869
{ _t('Add rooms to this community') }
871870
</div>
872871
</AccessibleButton>) : <div />;
873-
const roomDetailListClassName = classnames({
874-
"mx_fadable": true,
875-
"mx_fadable_faded": this.state.editing,
876-
});
872+
877873
return <div className="mx_GroupView_rooms">
878874
<div className="mx_GroupView_rooms_header">
879875
<h3>
@@ -884,9 +880,7 @@ export default class GroupView extends React.Component {
884880
</div>
885881
{ this.state.groupRoomsLoading ?
886882
<Spinner /> :
887-
<RoomDetailList
888-
rooms={this.state.groupRooms}
889-
className={roomDetailListClassName} />
883+
<RoomDetailList rooms={this.state.groupRooms} />
890884
}
891885
</div>;
892886
}

src/components/structures/LoggedInView.tsx

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ interface IProps {
7171
viaServers?: string[];
7272
hideToSRUsers: boolean;
7373
resizeNotifier: ResizeNotifier;
74-
middleDisabled: boolean;
75-
leftDisabled: boolean;
76-
rightDisabled: boolean;
7774
// eslint-disable-next-line camelcase
7875
page_type: string;
7976
autoJoin: boolean;
@@ -100,10 +97,6 @@ interface IUsageLimit {
10097
}
10198

10299
interface IState {
103-
mouseDown?: {
104-
x: number;
105-
y: number;
106-
};
107100
syncErrorData?: {
108101
error: {
109102
data: IUsageLimit;
@@ -151,7 +144,6 @@ class LoggedInView extends React.Component<IProps, IState> {
151144
super(props, context);
152145

153146
this.state = {
154-
mouseDown: undefined,
155147
syncErrorData: undefined,
156148
// use compact timeline view
157149
useCompactLayout: SettingsStore.getValue('useCompactLayout'),
@@ -549,48 +541,6 @@ class LoggedInView extends React.Component<IProps, IState> {
549541
), true);
550542
};
551543

552-
_onMouseDown = (ev) => {
553-
// When the panels are disabled, clicking on them results in a mouse event
554-
// which bubbles to certain elements in the tree. When this happens, close
555-
// any settings page that is currently open (user/room/group).
556-
if (this.props.leftDisabled && this.props.rightDisabled) {
557-
const targetClasses = new Set(ev.target.className.split(' '));
558-
if (
559-
targetClasses.has('mx_MatrixChat') ||
560-
targetClasses.has('mx_MatrixChat_middlePanel') ||
561-
targetClasses.has('mx_RoomView')
562-
) {
563-
this.setState({
564-
mouseDown: {
565-
x: ev.pageX,
566-
y: ev.pageY,
567-
},
568-
});
569-
}
570-
}
571-
};
572-
573-
_onMouseUp = (ev) => {
574-
if (!this.state.mouseDown) return;
575-
576-
const deltaX = ev.pageX - this.state.mouseDown.x;
577-
const deltaY = ev.pageY - this.state.mouseDown.y;
578-
const distance = Math.sqrt((deltaX * deltaX) + (deltaY + deltaY));
579-
const maxRadius = 5; // People shouldn't be straying too far, hopefully
580-
581-
// Note: we track how far the user moved their mouse to help
582-
// combat against https://github.com/vector-im/element-web/issues/7158
583-
584-
if (distance < maxRadius) {
585-
// This is probably a real click, and not a drag
586-
dis.dispatch({ action: 'close_settings' });
587-
}
588-
589-
// Always clear the mouseDown state to ensure we don't accidentally
590-
// use stale values due to the mouseDown checks.
591-
this.setState({mouseDown: null});
592-
};
593-
594544
render() {
595545
const RoomView = sdk.getComponent('structures.RoomView');
596546
const UserView = sdk.getComponent('structures.UserView');
@@ -610,7 +560,6 @@ class LoggedInView extends React.Component<IProps, IState> {
610560
oobData={this.props.roomOobData}
611561
viaServers={this.props.viaServers}
612562
key={this.props.currentRoomId || 'roomview'}
613-
disabled={this.props.middleDisabled}
614563
resizeNotifier={this.props.resizeNotifier}
615564
/>;
616565
break;
@@ -658,8 +607,6 @@ class LoggedInView extends React.Component<IProps, IState> {
658607
onKeyDown={this._onReactKeyDown}
659608
className='mx_MatrixChat_wrapper'
660609
aria-hidden={this.props.hideToSRUsers}
661-
onMouseDown={this._onMouseDown}
662-
onMouseUp={this._onMouseUp}
663610
>
664611
<ToastContainer />
665612
<DragDropContext onDragEnd={this._onDragEnd}>

src/components/structures/MatrixChat.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,6 @@ interface IState {
181181
currentUserId?: string;
182182
// this is persisted as mx_lhs_size, loaded in LoggedInView
183183
collapseLhs: boolean;
184-
leftDisabled: boolean;
185-
middleDisabled: boolean;
186-
// the right panel's disabled state is tracked in its store.
187184
// Parameters used in the registration dance with the IS
188185
// eslint-disable-next-line camelcase
189186
register_client_secret?: string;
@@ -236,8 +233,6 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
236233
this.state = {
237234
view: Views.LOADING,
238235
collapseLhs: false,
239-
leftDisabled: false,
240-
middleDisabled: false,
241236

242237
hideToSRUsers: false,
243238

@@ -710,14 +705,6 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
710705
this.state.resizeNotifier.notifyLeftHandleResized();
711706
});
712707
break;
713-
case 'panel_disable': {
714-
this.setState({
715-
leftDisabled: payload.leftDisabled || payload.sideDisabled || false,
716-
middleDisabled: payload.middleDisabled || false,
717-
// We don't track the right panel being disabled here - it's tracked in the store.
718-
});
719-
break;
720-
}
721708
case 'on_logged_in':
722709
if (
723710
!Lifecycle.isSoftLogout() &&

src/components/structures/RightPanel.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717

1818
import React from 'react';
1919
import PropTypes from 'prop-types';
20-
import classNames from 'classnames';
2120
import {Room} from "matrix-js-sdk/src/models/room";
2221

2322
import * as sdk from '../../index';
@@ -304,14 +303,8 @@ export default class RightPanel extends React.Component {
304303
break;
305304
}
306305

307-
const classes = classNames("mx_RightPanel", "mx_fadable", {
308-
"collapsed": this.props.collapsed,
309-
"mx_fadable_faded": this.props.disabled,
310-
"dark-panel": true,
311-
});
312-
313306
return (
314-
<aside className={classes} id="mx_RightPanel">
307+
<aside className="mx_RightPanel dark-panel" id="mx_RightPanel">
315308
{ panel }
316309
</aside>
317310
);

src/components/structures/RoomView.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ interface IProps {
105105
viaServers?: string[];
106106

107107
autoJoin?: boolean;
108-
disabled?: boolean;
109108
resizeNotifier: ResizeNotifier;
110109

111110
// Called with the credentials of a registered user (if they were a ROU that transitioned to PWLU)
@@ -1871,7 +1870,6 @@ export default class RoomView extends React.Component<IProps, IState> {
18711870
<MessageComposer
18721871
room={this.state.room}
18731872
callState={this.state.callState}
1874-
disabled={this.props.disabled}
18751873
showApps={this.state.showApps}
18761874
e2eStatus={this.state.e2eStatus}
18771875
resizeNotifier={this.props.resizeNotifier}
@@ -2027,10 +2025,6 @@ export default class RoomView extends React.Component<IProps, IState> {
20272025
"mx_RoomView_statusArea_expanded": isStatusAreaExpanded,
20282026
});
20292027

2030-
const fadableSectionClasses = classNames("mx_RoomView_body", "mx_fadable", {
2031-
"mx_fadable_faded": this.props.disabled,
2032-
});
2033-
20342028
const showRightPanel = this.state.room && this.state.showRightPanel;
20352029
const rightPanel = showRightPanel
20362030
? <RightPanel room={this.state.room} resizeNotifier={this.props.resizeNotifier} />
@@ -2062,7 +2056,7 @@ export default class RoomView extends React.Component<IProps, IState> {
20622056
e2eStatus={this.state.e2eStatus}
20632057
/>
20642058
<MainSplit panel={rightPanel} resizeNotifier={this.props.resizeNotifier}>
2065-
<div className={fadableSectionClasses}>
2059+
<div className="mx_RoomView_body">
20662060
{auxPanel}
20672061
<div className={timelineClasses}>
20682062
{topUnreadMessagesBar}

src/components/views/rooms/ForwardMessage.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import React from 'react';
1919
import PropTypes from 'prop-types';
2020
import { _t } from '../../../languageHandler';
21-
import dis from '../../../dispatcher/dispatcher';
2221
import {Key} from '../../../Keyboard';
2322

2423

@@ -28,19 +27,10 @@ export default class ForwardMessage extends React.Component {
2827
};
2928

3029
componentDidMount() {
31-
dis.dispatch({
32-
action: 'panel_disable',
33-
middleDisabled: true,
34-
});
35-
3630
document.addEventListener('keydown', this._onKeyDown);
3731
}
3832

3933
componentWillUnmount() {
40-
dis.dispatch({
41-
action: 'panel_disable',
42-
middleDisabled: false,
43-
});
4434
document.removeEventListener('keydown', this._onKeyDown);
4535
}
4636

0 commit comments

Comments
 (0)