2016-11-03 21:42:26 +03:00
|
|
|
/*
|
|
|
|
Copyright 2015, 2016 OpenMarket Ltd
|
2017-04-26 15:48:03 +03:00
|
|
|
Copyright 2017 Vector Creations Ltd
|
2020-04-13 16:13:27 +03:00
|
|
|
Copyright 2017, 2018, 2020 New Vector Ltd
|
2016-11-03 21:42:26 +03:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2020-04-13 16:29:00 +03:00
|
|
|
import * as React from 'react';
|
|
|
|
import * as PropTypes from 'prop-types';
|
|
|
|
import { MatrixClient } from 'matrix-js-sdk/src/client';
|
2018-02-14 19:40:58 +03:00
|
|
|
import { DragDropContext } from 'react-beautiful-dnd';
|
2016-11-03 21:42:26 +03:00
|
|
|
|
2020-09-27 00:21:16 +03:00
|
|
|
import {Key, isOnlyCtrlOrCmdKeyEvent, isOnlyCtrlOrCmdIgnoreShiftKeyEvent, isMac} from '../../Keyboard';
|
2016-11-03 21:42:26 +03:00
|
|
|
import PageTypes from '../../PageTypes';
|
2017-04-28 20:21:22 +03:00
|
|
|
import CallMediaHandler from '../../CallMediaHandler';
|
2020-04-16 12:25:18 +03:00
|
|
|
import { fixupColorFonts } from '../../utils/FontManager';
|
2019-12-20 04:19:56 +03:00
|
|
|
import * as sdk from '../../index';
|
2020-05-14 05:41:41 +03:00
|
|
|
import dis from '../../dispatcher/dispatcher';
|
2020-05-26 00:59:15 +03:00
|
|
|
import {MatrixClientPeg, IMatrixClientCreds} from '../../MatrixClientPeg';
|
2017-10-29 10:43:52 +03:00
|
|
|
import SettingsStore from "../../settings/SettingsStore";
|
2016-11-03 21:42:26 +03:00
|
|
|
|
2018-02-14 19:40:58 +03:00
|
|
|
import TagOrderActions from '../../actions/TagOrderActions';
|
|
|
|
import RoomListActions from '../../actions/RoomListActions';
|
2018-09-24 18:07:42 +03:00
|
|
|
import ResizeHandle from '../views/elements/ResizeHandle';
|
2019-01-21 22:32:57 +03:00
|
|
|
import {Resizer, CollapseDistributor} from '../../resizer';
|
2019-12-17 20:26:12 +03:00
|
|
|
import MatrixClientContext from "../../contexts/MatrixClientContext";
|
2020-03-18 19:40:21 +03:00
|
|
|
import * as KeyboardShortcuts from "../../accessibility/KeyboardShortcuts";
|
2020-04-07 12:48:56 +03:00
|
|
|
import HomePage from "./HomePage";
|
2020-04-13 16:29:00 +03:00
|
|
|
import ResizeNotifier from "../../utils/ResizeNotifier";
|
2020-04-11 20:57:59 +03:00
|
|
|
import PlatformPeg from "../../PlatformPeg";
|
2020-03-20 23:38:20 +03:00
|
|
|
import { DefaultTagID } from "../../stores/room-list/models";
|
2020-05-23 00:27:19 +03:00
|
|
|
import {
|
|
|
|
showToast as showServerLimitToast,
|
2020-08-29 03:11:08 +03:00
|
|
|
hideToast as hideServerLimitToast,
|
2020-05-23 00:27:19 +03:00
|
|
|
} from "../../toasts/ServerLimitToast";
|
2020-06-03 04:07:46 +03:00
|
|
|
import { Action } from "../../dispatcher/actions";
|
2020-07-18 00:22:18 +03:00
|
|
|
import LeftPanel from "./LeftPanel";
|
2020-07-07 00:42:46 +03:00
|
|
|
import CallContainer from '../views/voip/CallContainer';
|
2020-07-06 19:57:40 +03:00
|
|
|
import { ViewRoomDeltaPayload } from "../../dispatcher/payloads/ViewRoomDeltaPayload";
|
2020-07-18 00:11:34 +03:00
|
|
|
import RoomListStore from "../../stores/room-list/RoomListStore";
|
2020-07-29 21:43:35 +03:00
|
|
|
import NonUrgentToastContainer from "./NonUrgentToastContainer";
|
2020-07-18 14:08:20 +03:00
|
|
|
import { ToggleRightPanelPayload } from "../../dispatcher/payloads/ToggleRightPanelPayload";
|
2020-09-12 04:49:48 +03:00
|
|
|
import { IThreepidInvite } from "../../stores/ThreepidInviteStore";
|
2020-10-13 19:26:48 +03:00
|
|
|
import Modal from "../../Modal";
|
2020-10-20 13:03:03 +03:00
|
|
|
import { ICollapseConfig } from "../../resizer/distributors/collapse";
|
2021-01-14 12:53:20 +03:00
|
|
|
import HostSignupContainer from '../views/host_signup/HostSignupContainer';
|
2021-03-01 20:54:53 +03:00
|
|
|
import { IOpts } from "../../createRoom";
|
2020-05-23 00:15:22 +03:00
|
|
|
|
2018-08-07 19:04:37 +03:00
|
|
|
// We need to fetch each pinned message individually (if we don't already have it)
|
|
|
|
// so each pinned message may trigger a request. Limit the number per room for sanity.
|
|
|
|
// NB. this is just for server notices rather than pinned messages in general.
|
|
|
|
const MAX_PINNED_NOTICES_PER_ROOM = 2;
|
|
|
|
|
2019-07-19 18:49:04 +03:00
|
|
|
function canElementReceiveInput(el) {
|
|
|
|
return el.tagName === "INPUT" ||
|
|
|
|
el.tagName === "TEXTAREA" ||
|
|
|
|
el.tagName === "SELECT" ||
|
|
|
|
!!el.getAttribute("contenteditable");
|
|
|
|
}
|
|
|
|
|
2020-04-13 16:29:00 +03:00
|
|
|
interface IProps {
|
|
|
|
matrixClient: MatrixClient;
|
2020-05-26 00:59:15 +03:00
|
|
|
onRegistered: (credentials: IMatrixClientCreds) => Promise<MatrixClient>;
|
2020-04-13 16:29:00 +03:00
|
|
|
viaServers?: string[];
|
|
|
|
hideToSRUsers: boolean;
|
|
|
|
resizeNotifier: ResizeNotifier;
|
2020-08-29 03:11:08 +03:00
|
|
|
// eslint-disable-next-line camelcase
|
2020-04-13 16:29:00 +03:00
|
|
|
page_type: string;
|
|
|
|
autoJoin: boolean;
|
2020-09-12 04:49:48 +03:00
|
|
|
threepidInvite?: IThreepidInvite;
|
2020-04-13 16:29:00 +03:00
|
|
|
roomOobData?: object;
|
|
|
|
currentRoomId: string;
|
|
|
|
collapseLhs: boolean;
|
|
|
|
config: {
|
|
|
|
piwik: {
|
|
|
|
policyUrl: string;
|
|
|
|
},
|
|
|
|
[key: string]: any,
|
|
|
|
};
|
|
|
|
currentUserId?: string;
|
|
|
|
currentGroupId?: string;
|
|
|
|
currentGroupIsNew?: boolean;
|
2020-11-02 20:24:47 +03:00
|
|
|
justRegistered?: boolean;
|
2021-03-01 20:54:53 +03:00
|
|
|
roomJustCreatedOpts?: IOpts;
|
2020-04-13 16:29:00 +03:00
|
|
|
}
|
2020-05-23 01:08:45 +03:00
|
|
|
|
2020-06-03 18:17:31 +03:00
|
|
|
interface IUsageLimit {
|
2021-03-05 18:01:48 +03:00
|
|
|
// "hs_disabled" is NOT a specced string, but is used in Synapse
|
|
|
|
// This is tracked over at https://github.com/matrix-org/synapse/issues/9237
|
2020-08-29 03:11:08 +03:00
|
|
|
// eslint-disable-next-line camelcase
|
2021-01-27 14:39:57 +03:00
|
|
|
limit_type: "monthly_active_user" | "hs_disabled" | string;
|
2020-08-29 03:11:08 +03:00
|
|
|
// eslint-disable-next-line camelcase
|
2020-06-03 18:17:31 +03:00
|
|
|
admin_contact?: string;
|
|
|
|
}
|
|
|
|
|
2020-04-13 16:29:00 +03:00
|
|
|
interface IState {
|
2020-06-03 18:17:31 +03:00
|
|
|
syncErrorData?: {
|
|
|
|
error: {
|
2021-03-05 18:01:48 +03:00
|
|
|
// This is not specced, but used in Synapse. See
|
|
|
|
// https://github.com/matrix-org/synapse/issues/9237#issuecomment-768238922
|
2020-06-03 18:17:31 +03:00
|
|
|
data: IUsageLimit;
|
|
|
|
errcode: string;
|
|
|
|
};
|
|
|
|
};
|
2021-02-23 15:51:47 +03:00
|
|
|
usageLimitDismissed: boolean;
|
2020-06-03 18:17:31 +03:00
|
|
|
usageLimitEventContent?: IUsageLimit;
|
2021-02-23 15:51:17 +03:00
|
|
|
usageLimitEventTs?: number;
|
2020-04-13 16:29:00 +03:00
|
|
|
useCompactLayout: boolean;
|
|
|
|
}
|
|
|
|
|
2016-11-03 21:42:26 +03:00
|
|
|
/**
|
|
|
|
* This is what our MatrixChat shows when we are logged in. The precise view is
|
|
|
|
* determined by the page_type property.
|
|
|
|
*
|
|
|
|
* Currently it's very tightly coupled with MatrixChat. We should try to do
|
|
|
|
* something about that.
|
2016-11-03 21:54:30 +03:00
|
|
|
*
|
|
|
|
* Components mounted below us can access the matrix client via the react context.
|
2016-11-03 21:42:26 +03:00
|
|
|
*/
|
2020-06-25 16:14:02 +03:00
|
|
|
class LoggedInView extends React.Component<IProps, IState> {
|
2020-04-13 16:13:27 +03:00
|
|
|
static displayName = 'LoggedInView';
|
2016-11-03 21:42:26 +03:00
|
|
|
|
2020-04-13 16:13:27 +03:00
|
|
|
static propTypes = {
|
2019-08-06 16:04:33 +03:00
|
|
|
matrixClient: PropTypes.instanceOf(MatrixClient).isRequired,
|
2017-12-26 04:03:18 +03:00
|
|
|
page_type: PropTypes.string.isRequired,
|
|
|
|
onRoomCreated: PropTypes.func,
|
2016-11-03 21:42:26 +03:00
|
|
|
|
2017-04-28 15:22:55 +03:00
|
|
|
// Called with the credentials of a registered user (if they were a ROU that
|
|
|
|
// transitioned to PWLU)
|
2017-12-26 04:03:18 +03:00
|
|
|
onRegistered: PropTypes.func,
|
2017-02-03 14:48:24 +03:00
|
|
|
|
2018-10-19 22:30:38 +03:00
|
|
|
// Used by the RoomView to handle joining rooms
|
|
|
|
viaServers: PropTypes.arrayOf(PropTypes.string),
|
|
|
|
|
2016-11-03 21:42:26 +03:00
|
|
|
// and lots and lots of other stuff.
|
2020-04-13 16:13:27 +03:00
|
|
|
};
|
2016-11-03 21:42:26 +03:00
|
|
|
|
2020-04-13 16:30:52 +03:00
|
|
|
protected readonly _matrixClient: MatrixClient;
|
|
|
|
protected readonly _roomView: React.RefObject<any>;
|
|
|
|
protected readonly _resizeContainer: React.RefObject<ResizeHandle>;
|
2021-01-15 14:42:30 +03:00
|
|
|
protected compactLayoutWatcherRef: string;
|
2020-04-13 16:30:52 +03:00
|
|
|
protected resizer: Resizer;
|
2020-04-13 16:29:00 +03:00
|
|
|
|
2020-04-13 16:13:27 +03:00
|
|
|
constructor(props, context) {
|
|
|
|
super(props, context);
|
|
|
|
|
|
|
|
this.state = {
|
2020-04-13 16:29:00 +03:00
|
|
|
syncErrorData: undefined,
|
2017-06-01 05:00:30 +03:00
|
|
|
// use compact timeline view
|
2017-10-29 10:43:52 +03:00
|
|
|
useCompactLayout: SettingsStore.getValue('useCompactLayout'),
|
2021-02-23 15:51:47 +03:00
|
|
|
usageLimitDismissed: false,
|
2017-06-01 05:00:30 +03:00
|
|
|
};
|
2018-09-24 18:07:42 +03:00
|
|
|
|
2016-11-03 21:54:30 +03:00
|
|
|
// stash the MatrixClient in case we log out before we are unmounted
|
|
|
|
this._matrixClient = this.props.matrixClient;
|
|
|
|
|
2017-05-25 03:01:40 +03:00
|
|
|
CallMediaHandler.loadDevices();
|
2017-04-28 20:21:22 +03:00
|
|
|
|
2021-01-15 14:42:30 +03:00
|
|
|
fixupColorFonts();
|
|
|
|
|
|
|
|
this._roomView = React.createRef();
|
|
|
|
this._resizeContainer = React.createRef();
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
2019-07-17 17:50:05 +03:00
|
|
|
document.addEventListener('keydown', this._onNativeKeyDown, false);
|
2017-05-15 16:56:05 +03:00
|
|
|
|
2018-08-07 19:04:37 +03:00
|
|
|
this._updateServerNoticeEvents();
|
|
|
|
|
2017-06-01 05:00:30 +03:00
|
|
|
this._matrixClient.on("accountData", this.onAccountData);
|
2018-08-03 16:54:52 +03:00
|
|
|
this._matrixClient.on("sync", this.onSync);
|
2021-01-15 14:42:30 +03:00
|
|
|
// Call `onSync` with the current state as well
|
|
|
|
this.onSync(
|
|
|
|
this._matrixClient.getSyncState(),
|
|
|
|
null,
|
|
|
|
this._matrixClient.getSyncStateData(),
|
|
|
|
);
|
2018-08-07 19:04:37 +03:00
|
|
|
this._matrixClient.on("RoomState.events", this.onRoomStateEvents);
|
2019-05-22 04:31:24 +03:00
|
|
|
|
2021-01-15 14:42:30 +03:00
|
|
|
this.compactLayoutWatcherRef = SettingsStore.watchSetting(
|
2020-07-03 14:06:00 +03:00
|
|
|
"useCompactLayout", null, this.onCompactLayoutChanged,
|
|
|
|
);
|
|
|
|
|
2020-04-13 16:13:27 +03:00
|
|
|
this.resizer = this._createResizer();
|
|
|
|
this.resizer.attach();
|
|
|
|
this._loadResizerPreferences();
|
|
|
|
}
|
2016-11-03 21:42:26 +03:00
|
|
|
|
2020-04-13 16:13:27 +03:00
|
|
|
componentWillUnmount() {
|
2019-07-17 17:50:05 +03:00
|
|
|
document.removeEventListener('keydown', this._onNativeKeyDown, false);
|
2017-06-01 05:00:30 +03:00
|
|
|
this._matrixClient.removeListener("accountData", this.onAccountData);
|
2018-08-07 19:04:37 +03:00
|
|
|
this._matrixClient.removeListener("sync", this.onSync);
|
|
|
|
this._matrixClient.removeListener("RoomState.events", this.onRoomStateEvents);
|
2021-01-15 14:42:30 +03:00
|
|
|
SettingsStore.unwatchSetting(this.compactLayoutWatcherRef);
|
2018-10-16 19:43:40 +03:00
|
|
|
this.resizer.detach();
|
2020-04-13 16:13:27 +03:00
|
|
|
}
|
2016-11-03 21:42:26 +03:00
|
|
|
|
2017-05-31 17:13:27 +03:00
|
|
|
// Child components assume that the client peg will not be null, so give them some
|
|
|
|
// sort of assurance here by only allowing a re-render if the client is truthy.
|
|
|
|
//
|
|
|
|
// This is required because `LoggedInView` maintains its own state and if this state
|
|
|
|
// updates after the client peg has been made null (during logout), then it will
|
|
|
|
// attempt to re-render and the children will throw errors.
|
2020-04-13 16:13:27 +03:00
|
|
|
shouldComponentUpdate() {
|
2017-05-31 17:13:27 +03:00
|
|
|
return Boolean(MatrixClientPeg.get());
|
2020-04-13 16:13:27 +03:00
|
|
|
}
|
2016-11-03 21:42:26 +03:00
|
|
|
|
2020-04-13 16:13:27 +03:00
|
|
|
canResetTimelineInRoom = (roomId) => {
|
2019-12-08 15:16:17 +03:00
|
|
|
if (!this._roomView.current) {
|
2017-03-22 18:06:52 +03:00
|
|
|
return true;
|
|
|
|
}
|
2019-12-08 15:16:17 +03:00
|
|
|
return this._roomView.current.canResetTimeline();
|
2020-04-13 16:13:27 +03:00
|
|
|
};
|
2017-03-22 18:06:52 +03:00
|
|
|
|
2018-10-16 19:43:40 +03:00
|
|
|
_createResizer() {
|
2020-10-13 12:30:52 +03:00
|
|
|
let size;
|
2021-01-29 15:19:09 +03:00
|
|
|
let collapsed;
|
2020-10-20 13:03:03 +03:00
|
|
|
const collapseConfig: ICollapseConfig = {
|
2021-03-02 17:02:03 +03:00
|
|
|
// TODO: the space panel currently does not have a fixed width,
|
|
|
|
// just the headers at each level have a max-width of 150px
|
|
|
|
// Taking 222px for the space panel for now,
|
|
|
|
// so this will look slightly off for now,
|
|
|
|
// depending on the depth of your space tree.
|
|
|
|
// To fix this, we'll need to turn toggleSize
|
|
|
|
// into a callback so it can be measured when starting the resize operation
|
|
|
|
toggleSize: 222 + 68,
|
2021-01-29 15:19:09 +03:00
|
|
|
onCollapsed: (_collapsed) => {
|
|
|
|
collapsed = _collapsed;
|
|
|
|
if (_collapsed) {
|
2019-01-31 12:15:27 +03:00
|
|
|
dis.dispatch({action: "hide_left_panel"}, true);
|
2018-11-26 18:45:55 +03:00
|
|
|
window.localStorage.setItem("mx_lhs_size", '0');
|
2019-01-31 12:15:27 +03:00
|
|
|
} else {
|
|
|
|
dis.dispatch({action: "show_left_panel"}, true);
|
2018-10-16 19:43:40 +03:00
|
|
|
}
|
|
|
|
},
|
2020-10-13 12:30:52 +03:00
|
|
|
onResized: (_size) => {
|
|
|
|
size = _size;
|
2019-03-12 18:36:12 +03:00
|
|
|
this.props.resizeNotifier.notifyLeftHandleResized();
|
2018-10-16 19:43:40 +03:00
|
|
|
},
|
2020-09-02 14:00:35 +03:00
|
|
|
onResizeStart: () => {
|
|
|
|
this.props.resizeNotifier.startResizing();
|
|
|
|
},
|
|
|
|
onResizeStop: () => {
|
2021-01-29 15:19:09 +03:00
|
|
|
if (!collapsed) window.localStorage.setItem("mx_lhs_size", '' + size);
|
2020-09-02 14:00:35 +03:00
|
|
|
this.props.resizeNotifier.stopResizing();
|
|
|
|
},
|
2021-03-02 17:02:03 +03:00
|
|
|
isItemCollapsed: domNode => {
|
|
|
|
return domNode.classList.contains("mx_LeftPanel_minimized");
|
|
|
|
},
|
2018-10-16 19:43:40 +03:00
|
|
|
};
|
2020-10-13 12:30:52 +03:00
|
|
|
const resizer = new Resizer(this._resizeContainer.current, CollapseDistributor, collapseConfig);
|
2020-10-20 13:03:03 +03:00
|
|
|
resizer.setClassNames({
|
|
|
|
handle: "mx_ResizeHandle",
|
|
|
|
vertical: "mx_ResizeHandle_vertical",
|
|
|
|
reverse: "mx_ResizeHandle_reverse",
|
|
|
|
});
|
2018-10-16 19:43:40 +03:00
|
|
|
return resizer;
|
2020-04-13 16:13:27 +03:00
|
|
|
}
|
2018-10-16 19:43:40 +03:00
|
|
|
|
|
|
|
_loadResizerPreferences() {
|
2020-04-13 16:29:00 +03:00
|
|
|
let lhsSize = parseInt(window.localStorage.getItem("mx_lhs_size"), 10);
|
|
|
|
if (isNaN(lhsSize)) {
|
2019-01-22 18:40:11 +03:00
|
|
|
lhsSize = 350;
|
2018-10-16 19:43:40 +03:00
|
|
|
}
|
2019-01-22 18:40:11 +03:00
|
|
|
this.resizer.forHandleAt(0).resize(lhsSize);
|
2020-04-13 16:13:27 +03:00
|
|
|
}
|
2018-10-16 19:43:40 +03:00
|
|
|
|
2020-04-13 16:13:27 +03:00
|
|
|
onAccountData = (event) => {
|
2017-09-15 05:16:56 +03:00
|
|
|
if (event.getType() === "m.ignored_user_list") {
|
|
|
|
dis.dispatch({action: "ignore_state_changed"});
|
|
|
|
}
|
2020-04-13 16:13:27 +03:00
|
|
|
};
|
2017-06-01 05:00:30 +03:00
|
|
|
|
2020-07-03 14:06:00 +03:00
|
|
|
onCompactLayoutChanged = (setting, roomId, level, valueAtLevel, newValue) => {
|
|
|
|
this.setState({
|
|
|
|
useCompactLayout: valueAtLevel,
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2020-04-13 16:13:27 +03:00
|
|
|
onSync = (syncState, oldSyncState, data) => {
|
2019-01-21 22:32:57 +03:00
|
|
|
const oldErrCode = (
|
|
|
|
this.state.syncErrorData &&
|
|
|
|
this.state.syncErrorData.error &&
|
|
|
|
this.state.syncErrorData.error.errcode
|
|
|
|
);
|
2018-08-03 20:02:09 +03:00
|
|
|
const newErrCode = data && data.error && data.error.errcode;
|
|
|
|
if (syncState === oldSyncState && oldErrCode === newErrCode) return;
|
2018-08-03 16:54:52 +03:00
|
|
|
|
|
|
|
if (syncState === 'ERROR') {
|
|
|
|
this.setState({
|
|
|
|
syncErrorData: data,
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
this.setState({
|
|
|
|
syncErrorData: null,
|
|
|
|
});
|
|
|
|
}
|
2018-08-07 19:04:37 +03:00
|
|
|
|
|
|
|
if (oldSyncState === 'PREPARED' && syncState === 'SYNCING') {
|
|
|
|
this._updateServerNoticeEvents();
|
2020-05-23 00:27:19 +03:00
|
|
|
} else {
|
2020-06-03 18:17:31 +03:00
|
|
|
this._calculateServerLimitToast(this.state.syncErrorData, this.state.usageLimitEventContent);
|
2018-08-07 19:04:37 +03:00
|
|
|
}
|
2020-04-13 16:13:27 +03:00
|
|
|
};
|
2018-08-03 16:54:52 +03:00
|
|
|
|
2020-04-13 16:13:27 +03:00
|
|
|
onRoomStateEvents = (ev, state) => {
|
2020-07-17 23:25:09 +03:00
|
|
|
const serverNoticeList = RoomListStore.instance.orderedLists[DefaultTagID.ServerNotice];
|
|
|
|
if (serverNoticeList && serverNoticeList.some(r => r.roomId === ev.getRoomId())) {
|
2018-08-07 19:04:37 +03:00
|
|
|
this._updateServerNoticeEvents();
|
|
|
|
}
|
2020-04-13 16:13:27 +03:00
|
|
|
};
|
2018-08-07 19:04:37 +03:00
|
|
|
|
2021-02-24 20:32:00 +03:00
|
|
|
private onUsageLimitDismissed = () => {
|
2021-02-23 15:51:47 +03:00
|
|
|
this.setState({
|
|
|
|
usageLimitDismissed: true,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-08-29 03:11:08 +03:00
|
|
|
_calculateServerLimitToast(syncError: IState["syncErrorData"], usageLimitEventContent?: IUsageLimit) {
|
|
|
|
const error = syncError && syncError.error && syncError.error.errcode === "M_RESOURCE_LIMIT_EXCEEDED";
|
2020-05-23 00:27:19 +03:00
|
|
|
if (error) {
|
2020-08-29 03:11:08 +03:00
|
|
|
usageLimitEventContent = syncError.error.data;
|
2020-05-23 00:27:19 +03:00
|
|
|
}
|
|
|
|
|
2021-02-23 15:51:47 +03:00
|
|
|
// usageLimitDismissed is true when the user has explicitly hidden the toast
|
|
|
|
// and it will be reset to false if a *new* usage alert comes in.
|
|
|
|
if (usageLimitEventContent && this.state.usageLimitDismissed) {
|
|
|
|
showServerLimitToast(
|
|
|
|
usageLimitEventContent.limit_type,
|
2021-02-24 20:32:00 +03:00
|
|
|
this.onUsageLimitDismissed,
|
2021-02-23 15:51:47 +03:00
|
|
|
usageLimitEventContent.admin_contact,
|
|
|
|
error,
|
|
|
|
);
|
2020-05-23 00:27:19 +03:00
|
|
|
} else {
|
|
|
|
hideServerLimitToast();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-13 16:13:27 +03:00
|
|
|
_updateServerNoticeEvents = async () => {
|
2020-07-17 23:25:09 +03:00
|
|
|
const serverNoticeList = RoomListStore.instance.orderedLists[DefaultTagID.ServerNotice];
|
|
|
|
if (!serverNoticeList) return [];
|
2018-09-24 18:07:42 +03:00
|
|
|
|
2020-05-23 00:27:19 +03:00
|
|
|
const events = [];
|
2021-02-23 16:00:05 +03:00
|
|
|
let pinnedEventTs = 0;
|
2020-07-17 23:25:09 +03:00
|
|
|
for (const room of serverNoticeList) {
|
2018-08-07 19:04:37 +03:00
|
|
|
const pinStateEvent = room.currentState.getStateEvents("m.room.pinned_events", "");
|
|
|
|
|
|
|
|
if (!pinStateEvent || !pinStateEvent.getContent().pinned) continue;
|
2021-02-23 16:00:05 +03:00
|
|
|
pinnedEventTs = pinStateEvent.getTs();
|
2018-09-24 18:07:42 +03:00
|
|
|
|
2018-08-07 19:04:37 +03:00
|
|
|
const pinnedEventIds = pinStateEvent.getContent().pinned.slice(0, MAX_PINNED_NOTICES_PER_ROOM);
|
|
|
|
for (const eventId of pinnedEventIds) {
|
|
|
|
const timeline = await this._matrixClient.getEventTimeline(room.getUnfilteredTimelineSet(), eventId, 0);
|
2020-04-13 16:33:45 +03:00
|
|
|
const event = timeline.getEvents().find(ev => ev.getId() === eventId);
|
2020-05-23 00:27:19 +03:00
|
|
|
if (event) events.push(event);
|
2018-08-07 19:04:37 +03:00
|
|
|
}
|
|
|
|
}
|
2020-05-23 00:27:19 +03:00
|
|
|
|
2021-02-23 16:00:05 +03:00
|
|
|
if (pinnedEventTs && this.state.usageLimitEventTs > pinnedEventTs) {
|
|
|
|
// We've processed a newer event than this one, so ignore it.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-05-23 00:27:19 +03:00
|
|
|
const usageLimitEvent = events.find((e) => {
|
|
|
|
return (
|
|
|
|
e && e.getType() === 'm.room.message' &&
|
|
|
|
e.getContent()['server_notice_type'] === 'm.server_notice.usage_limit_reached'
|
|
|
|
);
|
2018-08-07 19:04:37 +03:00
|
|
|
});
|
2020-06-03 18:17:31 +03:00
|
|
|
const usageLimitEventContent = usageLimitEvent && usageLimitEvent.getContent();
|
|
|
|
this._calculateServerLimitToast(this.state.syncErrorData, usageLimitEventContent);
|
2021-02-23 15:51:17 +03:00
|
|
|
this.setState({
|
|
|
|
usageLimitEventContent,
|
2021-02-23 16:00:05 +03:00
|
|
|
usageLimitEventTs: pinnedEventTs,
|
2021-02-23 15:51:17 +03:00
|
|
|
// This is a fresh toast, we can show toasts again
|
|
|
|
usageLimitDismissed: false,
|
|
|
|
});
|
2020-04-13 16:13:27 +03:00
|
|
|
};
|
2018-09-24 18:07:42 +03:00
|
|
|
|
2020-04-13 16:13:27 +03:00
|
|
|
_onPaste = (ev) => {
|
2019-07-19 18:49:04 +03:00
|
|
|
let canReceiveInput = false;
|
|
|
|
let element = ev.target;
|
|
|
|
// test for all parents because the target can be a child of a contenteditable element
|
|
|
|
while (!canReceiveInput && element) {
|
|
|
|
canReceiveInput = canElementReceiveInput(element);
|
|
|
|
element = element.parentElement;
|
|
|
|
}
|
|
|
|
if (!canReceiveInput) {
|
2019-07-23 10:44:17 +03:00
|
|
|
// refocusing during a paste event will make the
|
|
|
|
// paste end up in the newly focused element,
|
|
|
|
// so dispatch synchronously before paste happens
|
2020-06-03 04:07:46 +03:00
|
|
|
dis.fire(Action.FocusComposer, true);
|
2019-07-19 18:49:04 +03:00
|
|
|
}
|
2020-04-13 16:13:27 +03:00
|
|
|
};
|
2019-07-19 18:49:04 +03:00
|
|
|
|
2019-07-17 17:50:05 +03:00
|
|
|
/*
|
|
|
|
SOME HACKERY BELOW:
|
|
|
|
React optimizes event handlers, by always attaching only 1 handler to the document for a given type.
|
|
|
|
It then internally determines the order in which React event handlers should be called,
|
|
|
|
emulating the capture and bubbling phases the DOM also has.
|
|
|
|
|
|
|
|
But, as the native handler for React is always attached on the document,
|
|
|
|
it will always run last for bubbling (first for capturing) handlers,
|
|
|
|
and thus React basically has its own event phases, and will always run
|
|
|
|
after (before for capturing) any native other event handlers (as they tend to be attached last).
|
|
|
|
|
|
|
|
So ideally one wouldn't mix React and native event handlers to have bubbling working as expected,
|
|
|
|
but we do need a native event handler here on the document,
|
|
|
|
to get keydown events when there is no focused element (target=body).
|
|
|
|
|
|
|
|
We also do need bubbling here to give child components a chance to call `stopPropagation()`,
|
|
|
|
for keydown events it can handle itself, and shouldn't be redirected to the composer.
|
|
|
|
|
|
|
|
So we listen with React on this component to get any events on focused elements, and get bubbling working as expected.
|
|
|
|
We also listen with a native listener on the document to get keydown events when no element is focused.
|
|
|
|
Bubbling is irrelevant here as the target is the body element.
|
|
|
|
*/
|
2020-04-13 16:13:27 +03:00
|
|
|
_onReactKeyDown = (ev) => {
|
2019-07-17 17:50:05 +03:00
|
|
|
// events caught while bubbling up on the root element
|
|
|
|
// of this component, so something must be focused.
|
|
|
|
this._onKeyDown(ev);
|
2020-04-13 16:13:27 +03:00
|
|
|
};
|
2019-07-17 17:50:05 +03:00
|
|
|
|
2020-04-13 16:13:27 +03:00
|
|
|
_onNativeKeyDown = (ev) => {
|
2019-07-17 17:50:05 +03:00
|
|
|
// only pass this if there is no focused element.
|
|
|
|
// if there is, _onKeyDown will be called by the
|
|
|
|
// react keydown handler that respects the react bubbling order.
|
|
|
|
if (ev.target === document.body) {
|
|
|
|
this._onKeyDown(ev);
|
|
|
|
}
|
2020-04-13 16:13:27 +03:00
|
|
|
};
|
2018-08-07 19:04:37 +03:00
|
|
|
|
2020-04-13 16:13:27 +03:00
|
|
|
_onKeyDown = (ev) => {
|
2017-07-12 19:12:57 +03:00
|
|
|
let handled = false;
|
2017-12-01 13:44:00 +03:00
|
|
|
const ctrlCmdOnly = isOnlyCtrlOrCmdKeyEvent(ev);
|
2020-03-14 01:21:34 +03:00
|
|
|
const hasModifier = ev.altKey || ev.ctrlKey || ev.metaKey || ev.shiftKey;
|
|
|
|
const isModifier = ev.key === Key.ALT || ev.key === Key.CONTROL || ev.key === Key.META || ev.key === Key.SHIFT;
|
2020-09-27 00:21:16 +03:00
|
|
|
const modKey = isMac ? ev.metaKey : ev.ctrlKey;
|
2016-11-03 21:42:26 +03:00
|
|
|
|
2019-09-30 18:04:06 +03:00
|
|
|
switch (ev.key) {
|
|
|
|
case Key.PAGE_UP:
|
|
|
|
case Key.PAGE_DOWN:
|
2020-03-14 01:21:34 +03:00
|
|
|
if (!hasModifier && !isModifier) {
|
2017-04-23 02:49:14 +03:00
|
|
|
this._onScrollKeyPressed(ev);
|
|
|
|
handled = true;
|
|
|
|
}
|
2016-11-03 21:42:26 +03:00
|
|
|
break;
|
|
|
|
|
2019-09-30 18:04:06 +03:00
|
|
|
case Key.HOME:
|
|
|
|
case Key.END:
|
2017-04-23 02:49:14 +03:00
|
|
|
if (ev.ctrlKey && !ev.shiftKey && !ev.altKey && !ev.metaKey) {
|
2016-11-03 21:42:26 +03:00
|
|
|
this._onScrollKeyPressed(ev);
|
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
break;
|
2019-09-30 18:04:06 +03:00
|
|
|
case Key.K:
|
2017-07-12 19:12:57 +03:00
|
|
|
if (ctrlCmdOnly) {
|
2017-07-12 15:51:55 +03:00
|
|
|
dis.dispatch({
|
|
|
|
action: 'focus_room_filter',
|
|
|
|
});
|
2017-07-12 19:12:57 +03:00
|
|
|
handled = true;
|
2017-07-12 15:51:55 +03:00
|
|
|
}
|
|
|
|
break;
|
2021-01-17 10:28:52 +03:00
|
|
|
case Key.F:
|
2021-01-17 18:44:29 +03:00
|
|
|
if (ctrlCmdOnly && SettingsStore.getValue("ctrlFForSearch")) {
|
2021-01-17 10:28:52 +03:00
|
|
|
dis.dispatch({
|
|
|
|
action: 'focus_search',
|
|
|
|
});
|
|
|
|
handled = true;
|
2017-07-12 15:51:55 +03:00
|
|
|
}
|
|
|
|
break;
|
2019-09-30 18:04:06 +03:00
|
|
|
case Key.BACKTICK:
|
2019-05-21 05:41:48 +03:00
|
|
|
// Ideally this would be CTRL+P for "Profile", but that's
|
|
|
|
// taken by the print dialog. CTRL+I for "Information"
|
2019-06-07 02:08:51 +03:00
|
|
|
// was previously chosen but conflicted with italics in
|
|
|
|
// composer, so CTRL+` it is
|
2019-05-21 05:41:48 +03:00
|
|
|
|
2019-05-18 00:28:12 +03:00
|
|
|
if (ctrlCmdOnly) {
|
2020-06-08 07:06:41 +03:00
|
|
|
dis.fire(Action.ToggleUserMenu);
|
2019-05-18 00:28:12 +03:00
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
break;
|
2020-03-18 19:40:21 +03:00
|
|
|
|
|
|
|
case Key.SLASH:
|
2020-04-01 12:14:15 +03:00
|
|
|
if (isOnlyCtrlOrCmdIgnoreShiftKeyEvent(ev)) {
|
2020-03-18 19:40:21 +03:00
|
|
|
KeyboardShortcuts.toggleDialog();
|
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
break;
|
2020-03-20 03:18:24 +03:00
|
|
|
|
2020-09-27 00:21:16 +03:00
|
|
|
case Key.H:
|
|
|
|
if (ev.altKey && modKey) {
|
|
|
|
dis.dispatch({
|
|
|
|
action: 'view_home_page',
|
|
|
|
});
|
2020-10-13 19:26:48 +03:00
|
|
|
Modal.closeCurrentModal("homeKeyboardShortcut");
|
2020-09-27 00:21:16 +03:00
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2020-03-19 22:07:33 +03:00
|
|
|
case Key.ARROW_UP:
|
|
|
|
case Key.ARROW_DOWN:
|
|
|
|
if (ev.altKey && !ev.ctrlKey && !ev.metaKey) {
|
2020-07-06 19:57:40 +03:00
|
|
|
dis.dispatch<ViewRoomDeltaPayload>({
|
|
|
|
action: Action.ViewRoomDelta,
|
2020-03-19 22:07:33 +03:00
|
|
|
delta: ev.key === Key.ARROW_UP ? -1 : 1,
|
|
|
|
unread: ev.shiftKey,
|
|
|
|
});
|
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
break;
|
2020-03-20 19:10:27 +03:00
|
|
|
|
2020-03-20 03:18:24 +03:00
|
|
|
case Key.PERIOD:
|
|
|
|
if (ctrlCmdOnly && (this.props.page_type === "room_view" || this.props.page_type === "group_view")) {
|
2020-07-18 14:08:20 +03:00
|
|
|
dis.dispatch<ToggleRightPanelPayload>({
|
|
|
|
action: Action.ToggleRightPanel,
|
2020-03-20 03:18:24 +03:00
|
|
|
type: this.props.page_type === "room_view" ? "room" : "group",
|
|
|
|
});
|
|
|
|
handled = true;
|
|
|
|
}
|
2020-04-11 20:57:59 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
// if we do not have a handler for it, pass it to the platform which might
|
|
|
|
handled = PlatformPeg.get().onKeyDown(ev);
|
2016-11-03 21:42:26 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (handled) {
|
|
|
|
ev.stopPropagation();
|
|
|
|
ev.preventDefault();
|
2020-03-14 01:21:34 +03:00
|
|
|
} else if (!isModifier && !ev.altKey && !ev.ctrlKey && !ev.metaKey) {
|
|
|
|
// The above condition is crafted to _allow_ characters with Shift
|
|
|
|
// already pressed (but not the Shift key down itself).
|
|
|
|
|
2019-07-17 17:53:12 +03:00
|
|
|
const isClickShortcut = ev.target !== document.body &&
|
2019-10-04 13:47:33 +03:00
|
|
|
(ev.key === Key.SPACE || ev.key === Key.ENTER);
|
2019-07-17 17:53:12 +03:00
|
|
|
|
2019-12-02 13:01:08 +03:00
|
|
|
// Do not capture the context menu key to improve keyboard accessibility
|
|
|
|
if (ev.key === Key.CONTEXT_MENU) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-10-10 16:13:29 +03:00
|
|
|
if (!isClickShortcut && ev.key !== Key.TAB && !canElementReceiveInput(ev.target)) {
|
2019-07-23 10:44:17 +03:00
|
|
|
// synchronous dispatch so we focus before key generates input
|
2020-06-03 04:07:46 +03:00
|
|
|
dis.fire(Action.FocusComposer, true);
|
2019-07-15 19:12:45 +03:00
|
|
|
ev.stopPropagation();
|
|
|
|
// we should *not* preventDefault() here as
|
|
|
|
// that would prevent typing in the now-focussed composer
|
|
|
|
}
|
2016-11-03 21:42:26 +03:00
|
|
|
}
|
2020-04-13 16:13:27 +03:00
|
|
|
};
|
2016-11-03 21:42:26 +03:00
|
|
|
|
2019-01-21 22:32:57 +03:00
|
|
|
/**
|
|
|
|
* dispatch a page-up/page-down/etc to the appropriate component
|
|
|
|
* @param {Object} ev The key event
|
|
|
|
*/
|
2020-04-13 16:13:27 +03:00
|
|
|
_onScrollKeyPressed = (ev) => {
|
2019-12-08 15:16:17 +03:00
|
|
|
if (this._roomView.current) {
|
|
|
|
this._roomView.current.handleScrollKey(ev);
|
2017-04-23 03:00:44 +03:00
|
|
|
}
|
2020-04-13 16:13:27 +03:00
|
|
|
};
|
2016-11-03 21:42:26 +03:00
|
|
|
|
2020-04-13 16:13:27 +03:00
|
|
|
_onDragEnd = (result) => {
|
2018-02-14 19:40:58 +03:00
|
|
|
// Dragged to an invalid destination, not onto a droppable
|
|
|
|
if (!result.destination) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const dest = result.destination.droppableId;
|
|
|
|
|
|
|
|
if (dest === 'tag-panel-droppable') {
|
|
|
|
// Could be "GroupTile +groupId:domain"
|
|
|
|
const draggableId = result.draggableId.split(' ').pop();
|
|
|
|
|
2020-10-10 15:30:06 +03:00
|
|
|
// Dispatch synchronously so that the GroupFilterPanel receives an
|
2020-10-10 15:32:58 +03:00
|
|
|
// optimistic update from GroupFilterOrderStore before the previous
|
2018-02-14 19:40:58 +03:00
|
|
|
// state is shown.
|
|
|
|
dis.dispatch(TagOrderActions.moveTag(
|
|
|
|
this._matrixClient,
|
|
|
|
draggableId,
|
|
|
|
result.destination.index,
|
|
|
|
), true);
|
|
|
|
} else if (dest.startsWith('room-sub-list-droppable_')) {
|
|
|
|
this._onRoomTileEndDrag(result);
|
|
|
|
}
|
2020-04-13 16:13:27 +03:00
|
|
|
};
|
2018-02-14 19:40:58 +03:00
|
|
|
|
2020-04-13 16:13:27 +03:00
|
|
|
_onRoomTileEndDrag = (result) => {
|
2018-02-14 19:40:58 +03:00
|
|
|
let newTag = result.destination.droppableId.split('_')[1];
|
|
|
|
let prevTag = result.source.droppableId.split('_')[1];
|
|
|
|
if (newTag === 'undefined') newTag = undefined;
|
|
|
|
if (prevTag === 'undefined') prevTag = undefined;
|
|
|
|
|
|
|
|
const roomId = result.draggableId.split('_')[1];
|
|
|
|
|
|
|
|
const oldIndex = result.source.index;
|
|
|
|
const newIndex = result.destination.index;
|
|
|
|
|
|
|
|
dis.dispatch(RoomListActions.tagRoom(
|
|
|
|
this._matrixClient,
|
|
|
|
this._matrixClient.getRoom(roomId),
|
|
|
|
prevTag, newTag,
|
|
|
|
oldIndex, newIndex,
|
|
|
|
), true);
|
2020-04-13 16:13:27 +03:00
|
|
|
};
|
2018-02-14 19:40:58 +03:00
|
|
|
|
2020-04-13 16:13:27 +03:00
|
|
|
render() {
|
2017-04-26 15:48:03 +03:00
|
|
|
const RoomView = sdk.getComponent('structures.RoomView');
|
2019-02-20 14:45:55 +03:00
|
|
|
const UserView = sdk.getComponent('structures.UserView');
|
2017-06-05 18:51:50 +03:00
|
|
|
const GroupView = sdk.getComponent('structures.GroupView');
|
2017-06-28 15:56:18 +03:00
|
|
|
const MyGroups = sdk.getComponent('structures.MyGroups');
|
2019-11-20 18:18:28 +03:00
|
|
|
const ToastContainer = sdk.getComponent('structures.ToastContainer');
|
2017-04-26 15:48:03 +03:00
|
|
|
|
2019-01-21 22:32:57 +03:00
|
|
|
let pageElement;
|
2016-11-03 21:42:26 +03:00
|
|
|
|
|
|
|
switch (this.props.page_type) {
|
|
|
|
case PageTypes.RoomView:
|
2019-01-21 22:32:57 +03:00
|
|
|
pageElement = <RoomView
|
2020-08-29 03:11:08 +03:00
|
|
|
ref={this._roomView}
|
|
|
|
autoJoin={this.props.autoJoin}
|
|
|
|
onRegistered={this.props.onRegistered}
|
2020-09-12 04:49:48 +03:00
|
|
|
threepidInvite={this.props.threepidInvite}
|
2020-08-29 03:11:08 +03:00
|
|
|
oobData={this.props.roomOobData}
|
|
|
|
viaServers={this.props.viaServers}
|
|
|
|
key={this.props.currentRoomId || 'roomview'}
|
|
|
|
resizeNotifier={this.props.resizeNotifier}
|
2021-03-01 20:54:53 +03:00
|
|
|
justCreatedOpts={this.props.roomJustCreatedOpts}
|
2020-08-29 03:11:08 +03:00
|
|
|
/>;
|
2016-11-03 21:42:26 +03:00
|
|
|
break;
|
2019-01-17 12:29:37 +03:00
|
|
|
|
2017-06-28 15:56:18 +03:00
|
|
|
case PageTypes.MyGroups:
|
2019-01-21 22:32:57 +03:00
|
|
|
pageElement = <MyGroups />;
|
2017-06-28 15:56:18 +03:00
|
|
|
break;
|
|
|
|
|
2016-11-03 21:42:26 +03:00
|
|
|
case PageTypes.RoomDirectory:
|
2019-01-29 17:34:58 +03:00
|
|
|
// handled by MatrixChat for now
|
2016-11-03 21:42:26 +03:00
|
|
|
break;
|
2016-11-13 17:10:46 +03:00
|
|
|
|
|
|
|
case PageTypes.HomePage:
|
2020-11-02 20:24:47 +03:00
|
|
|
pageElement = <HomePage justRegistered={this.props.justRegistered} />;
|
2016-11-13 17:10:46 +03:00
|
|
|
break;
|
|
|
|
|
2016-11-03 21:42:26 +03:00
|
|
|
case PageTypes.UserView:
|
2020-09-02 14:00:35 +03:00
|
|
|
pageElement = <UserView userId={this.props.currentUserId} resizeNotifier={this.props.resizeNotifier} />;
|
2016-11-03 21:42:26 +03:00
|
|
|
break;
|
2017-06-05 18:51:50 +03:00
|
|
|
case PageTypes.GroupView:
|
2019-01-21 22:32:57 +03:00
|
|
|
pageElement = <GroupView
|
2017-06-05 18:51:50 +03:00
|
|
|
groupId={this.props.currentGroupId}
|
2017-11-06 21:02:50 +03:00
|
|
|
isNew={this.props.currentGroupIsNew}
|
2020-09-02 14:00:35 +03:00
|
|
|
resizeNotifier={this.props.resizeNotifier}
|
2017-06-27 12:05:05 +03:00
|
|
|
/>;
|
2017-06-05 18:51:50 +03:00
|
|
|
break;
|
2016-11-03 21:42:26 +03:00
|
|
|
}
|
|
|
|
|
2017-10-11 19:56:17 +03:00
|
|
|
let bodyClasses = 'mx_MatrixChat';
|
2017-06-01 05:00:30 +03:00
|
|
|
if (this.state.useCompactLayout) {
|
|
|
|
bodyClasses += ' mx_MatrixChat_useCompactLayout';
|
|
|
|
}
|
2016-11-03 21:42:26 +03:00
|
|
|
|
2020-07-17 23:02:51 +03:00
|
|
|
const leftPanel = (
|
2020-07-18 00:22:18 +03:00
|
|
|
<LeftPanel
|
2020-07-17 23:02:51 +03:00
|
|
|
isMinimized={this.props.collapseLhs || false}
|
2020-06-03 04:26:07 +03:00
|
|
|
resizeNotifier={this.props.resizeNotifier}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
|
2016-11-03 21:42:26 +03:00
|
|
|
return (
|
2019-12-17 20:26:12 +03:00
|
|
|
<MatrixClientContext.Provider value={this._matrixClient}>
|
|
|
|
<div
|
|
|
|
onPaste={this._onPaste}
|
|
|
|
onKeyDown={this._onReactKeyDown}
|
|
|
|
className='mx_MatrixChat_wrapper'
|
|
|
|
aria-hidden={this.props.hideToSRUsers}
|
|
|
|
>
|
|
|
|
<ToastContainer />
|
|
|
|
<DragDropContext onDragEnd={this._onDragEnd}>
|
2020-04-13 16:29:00 +03:00
|
|
|
<div ref={this._resizeContainer} className={bodyClasses}>
|
2020-06-03 04:26:07 +03:00
|
|
|
{ leftPanel }
|
2019-12-17 20:26:12 +03:00
|
|
|
<ResizeHandle />
|
|
|
|
{ pageElement }
|
|
|
|
</div>
|
|
|
|
</DragDropContext>
|
|
|
|
</div>
|
2020-07-07 00:42:46 +03:00
|
|
|
<CallContainer />
|
2020-07-29 21:43:35 +03:00
|
|
|
<NonUrgentToastContainer />
|
2021-01-14 12:53:20 +03:00
|
|
|
<HostSignupContainer />
|
2019-12-17 20:26:12 +03:00
|
|
|
</MatrixClientContext.Provider>
|
2016-11-03 21:42:26 +03:00
|
|
|
);
|
2020-04-13 16:13:27 +03:00
|
|
|
}
|
|
|
|
}
|
2017-12-06 18:01:16 +03:00
|
|
|
|
2018-01-19 16:34:56 +03:00
|
|
|
export default LoggedInView;
|