From 6b01b6ac6c59d488b3e9bd085ef81a47fbf2e8ab Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 15 Oct 2020 16:13:16 +0100 Subject: [PATCH 1/2] Discard all mx_fadable legacy cruft which is totally useless Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- res/css/_common.scss | 6 --- src/components/structures/GroupView.js | 10 +--- src/components/structures/LoggedInView.tsx | 53 -------------------- src/components/structures/MatrixChat.tsx | 13 ----- src/components/structures/RightPanel.js | 8 +-- src/components/structures/RoomView.tsx | 8 +-- src/components/views/rooms/ForwardMessage.js | 10 ---- 7 files changed, 4 insertions(+), 104 deletions(-) diff --git a/res/css/_common.scss b/res/css/_common.scss index 3346394edd..666129af34 100644 --- a/res/css/_common.scss +++ b/res/css/_common.scss @@ -208,12 +208,6 @@ input[type=text]:focus, input[type=password]:focus, textarea:focus { border: 0; } -/* applied to side-panels and messagepanel when in RoomSettings */ -.mx_fadable { - opacity: 1; - transition: opacity 0.2s ease-in-out; -} - // These are magic constants which are excluded from tinting, to let themes // (which only have CSS, unlike skins) tell the app what their non-tinted // colourscheme is by inspecting the stylesheet DOM. diff --git a/src/components/structures/GroupView.js b/src/components/structures/GroupView.js index adf79935e3..482b9f6da2 100644 --- a/src/components/structures/GroupView.js +++ b/src/components/structures/GroupView.js @@ -649,7 +649,6 @@ export default class GroupView extends React.Component { editing: false, summary: null, }); - dis.dispatch({action: 'panel_disable'}); this._initGroupStore(this.props.groupId); if (this.state.avatarChanged) { @@ -870,10 +869,7 @@ export default class GroupView extends React.Component { { _t('Add rooms to this community') } ) :
; - const roomDetailListClassName = classnames({ - "mx_fadable": true, - "mx_fadable_faded": this.state.editing, - }); + return

@@ -884,9 +880,7 @@ export default class GroupView extends React.Component {

{ this.state.groupRoomsLoading ? : - + }
; } diff --git a/src/components/structures/LoggedInView.tsx b/src/components/structures/LoggedInView.tsx index 2063d542e1..15ea20618e 100644 --- a/src/components/structures/LoggedInView.tsx +++ b/src/components/structures/LoggedInView.tsx @@ -71,9 +71,6 @@ interface IProps { viaServers?: string[]; hideToSRUsers: boolean; resizeNotifier: ResizeNotifier; - middleDisabled: boolean; - leftDisabled: boolean; - rightDisabled: boolean; // eslint-disable-next-line camelcase page_type: string; autoJoin: boolean; @@ -100,10 +97,6 @@ interface IUsageLimit { } interface IState { - mouseDown?: { - x: number; - y: number; - }; syncErrorData?: { error: { data: IUsageLimit; @@ -151,7 +144,6 @@ class LoggedInView extends React.Component { super(props, context); this.state = { - mouseDown: undefined, syncErrorData: undefined, // use compact timeline view useCompactLayout: SettingsStore.getValue('useCompactLayout'), @@ -549,48 +541,6 @@ class LoggedInView extends React.Component { ), true); }; - _onMouseDown = (ev) => { - // When the panels are disabled, clicking on them results in a mouse event - // which bubbles to certain elements in the tree. When this happens, close - // any settings page that is currently open (user/room/group). - if (this.props.leftDisabled && this.props.rightDisabled) { - const targetClasses = new Set(ev.target.className.split(' ')); - if ( - targetClasses.has('mx_MatrixChat') || - targetClasses.has('mx_MatrixChat_middlePanel') || - targetClasses.has('mx_RoomView') - ) { - this.setState({ - mouseDown: { - x: ev.pageX, - y: ev.pageY, - }, - }); - } - } - }; - - _onMouseUp = (ev) => { - if (!this.state.mouseDown) return; - - const deltaX = ev.pageX - this.state.mouseDown.x; - const deltaY = ev.pageY - this.state.mouseDown.y; - const distance = Math.sqrt((deltaX * deltaX) + (deltaY + deltaY)); - const maxRadius = 5; // People shouldn't be straying too far, hopefully - - // Note: we track how far the user moved their mouse to help - // combat against https://github.com/vector-im/element-web/issues/7158 - - if (distance < maxRadius) { - // This is probably a real click, and not a drag - dis.dispatch({ action: 'close_settings' }); - } - - // Always clear the mouseDown state to ensure we don't accidentally - // use stale values due to the mouseDown checks. - this.setState({mouseDown: null}); - }; - render() { const RoomView = sdk.getComponent('structures.RoomView'); const UserView = sdk.getComponent('structures.UserView'); @@ -610,7 +560,6 @@ class LoggedInView extends React.Component { oobData={this.props.roomOobData} viaServers={this.props.viaServers} key={this.props.currentRoomId || 'roomview'} - disabled={this.props.middleDisabled} resizeNotifier={this.props.resizeNotifier} />; break; @@ -658,8 +607,6 @@ class LoggedInView extends React.Component { onKeyDown={this._onReactKeyDown} className='mx_MatrixChat_wrapper' aria-hidden={this.props.hideToSRUsers} - onMouseDown={this._onMouseDown} - onMouseUp={this._onMouseUp} > diff --git a/src/components/structures/MatrixChat.tsx b/src/components/structures/MatrixChat.tsx index 4f5489d796..f7665fea8a 100644 --- a/src/components/structures/MatrixChat.tsx +++ b/src/components/structures/MatrixChat.tsx @@ -181,9 +181,6 @@ interface IState { currentUserId?: string; // this is persisted as mx_lhs_size, loaded in LoggedInView collapseLhs: boolean; - leftDisabled: boolean; - middleDisabled: boolean; - // the right panel's disabled state is tracked in its store. // Parameters used in the registration dance with the IS // eslint-disable-next-line camelcase register_client_secret?: string; @@ -236,8 +233,6 @@ export default class MatrixChat extends React.PureComponent { this.state = { view: Views.LOADING, collapseLhs: false, - leftDisabled: false, - middleDisabled: false, hideToSRUsers: false, @@ -710,14 +705,6 @@ export default class MatrixChat extends React.PureComponent { this.state.resizeNotifier.notifyLeftHandleResized(); }); break; - case 'panel_disable': { - this.setState({ - leftDisabled: payload.leftDisabled || payload.sideDisabled || false, - middleDisabled: payload.middleDisabled || false, - // We don't track the right panel being disabled here - it's tracked in the store. - }); - break; - } case 'on_logged_in': if ( !Lifecycle.isSoftLogout() && diff --git a/src/components/structures/RightPanel.js b/src/components/structures/RightPanel.js index 021cdb438d..80be32ecd8 100644 --- a/src/components/structures/RightPanel.js +++ b/src/components/structures/RightPanel.js @@ -304,14 +304,8 @@ export default class RightPanel extends React.Component { break; } - const classes = classNames("mx_RightPanel", "mx_fadable", { - "collapsed": this.props.collapsed, - "mx_fadable_faded": this.props.disabled, - "dark-panel": true, - }); - return ( -