- { topUnreadMessagesBar }
- { jumpToBottom }
- { messagePanel }
- { searchResultsPanel }
-
-
-
- { statusBar }
+
+
+
+
+ {auxPanel}
+
+ {topUnreadMessagesBar}
+ {jumpToBottom}
+ {messagePanel}
+ {searchResultsPanel}
+
+ {previewBar}
+ {messageComposer}
- { previewBar }
- { messageComposer }
-
-
+
+
);
},
diff --git a/src/components/views/elements/ErrorBoundary.js b/src/components/views/elements/ErrorBoundary.js
new file mode 100644
index 0000000000..630b369caa
--- /dev/null
+++ b/src/components/views/elements/ErrorBoundary.js
@@ -0,0 +1,104 @@
+/*
+Copyright 2019 The Matrix.org Foundation C.I.C.
+
+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.
+*/
+
+import React from 'react';
+import sdk from '../../../index';
+import { _t } from '../../../languageHandler';
+import MatrixClientPeg from '../../../MatrixClientPeg';
+import PlatformPeg from '../../../PlatformPeg';
+import Modal from '../../../Modal';
+
+/**
+ * This error boundary component can be used to wrap large content areas and
+ * catch exceptions during rendering in the component tree below them.
+ */
+export default class ErrorBoundary extends React.PureComponent {
+ constructor(props) {
+ super(props);
+
+ this.state = {
+ error: null,
+ };
+ }
+
+ static getDerivedStateFromError(error) {
+ // Side effects are not permitted here, so we only update the state so
+ // that the next render shows an error message.
+ return { error };
+ }
+
+ componentDidCatch(error, { componentStack }) {
+ // Browser consoles are better at formatting output when native errors are passed
+ // in their own `console.error` invocation.
+ console.error(error);
+ console.error(
+ "The above error occured while React was rendering the following components:",
+ componentStack,
+ );
+ }
+
+ _onClearCacheAndReload = () => {
+ if (!PlatformPeg.get()) return;
+
+ MatrixClientPeg.get().stopClient();
+ MatrixClientPeg.get().store.deleteAllData().done(() => {
+ PlatformPeg.get().reload();
+ });
+ };
+
+ _onBugReport = () => {
+ const BugReportDialog = sdk.getComponent("dialogs.BugReportDialog");
+ if (!BugReportDialog) {
+ return;
+ }
+ Modal.createTrackedDialog('Bug Report Dialog', '', BugReportDialog, {});
+ };
+
+ render() {
+ if (this.state.error) {
+ const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
+ const newIssueUrl = "https://github.com/vector-im/riot-web/issues/new";
+ return
+
+
{_t("Something went wrong!")}
+
{_t(
+ "Please create a new issue " +
+ "on GitHub so that we can investigate this bug.", {}, {
+ newIssueLink: (sub) => {
+ return { sub };
+ },
+ },
+ )}
+
{_t(
+ "If you've submitted a bug via GitHub, debug logs can help " +
+ "us track down the problem. Debug logs contain application " +
+ "usage data including your username, the IDs or aliases of " +
+ "the rooms or groups you have visited and the usernames of " +
+ "other users. They do not contain messages.",
+ )}
+
+ {_t("Submit debug logs")}
+
+
+ {_t("Clear cache and reload")}
+
+
+
;
+ }
+
+ return this.props.children;
+ }
+}
diff --git a/src/components/views/settings/tabs/user/HelpUserSettingsTab.js b/src/components/views/settings/tabs/user/HelpUserSettingsTab.js
index a50b26fed6..ccabee3ca8 100644
--- a/src/components/views/settings/tabs/user/HelpUserSettingsTab.js
+++ b/src/components/views/settings/tabs/user/HelpUserSettingsTab.js
@@ -226,7 +226,7 @@ export default class HelpUserSettingsTab extends React.Component {