Apply prettier formatting

This commit is contained in:
Michael Weimann
2022-12-12 12:24:14 +01:00
parent 1cac306093
commit 526645c791
1576 changed files with 65384 additions and 62477 deletions
@@ -17,21 +17,21 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import React from 'react';
import React from "react";
import SdkConfig from '../../../SdkConfig';
import Modal from '../../../Modal';
import { _t } from '../../../languageHandler';
import sendBugReport, { downloadBugReport } from '../../../rageshake/submit-rageshake';
import SdkConfig from "../../../SdkConfig";
import Modal from "../../../Modal";
import { _t } from "../../../languageHandler";
import sendBugReport, { downloadBugReport } from "../../../rageshake/submit-rageshake";
import AccessibleButton from "../elements/AccessibleButton";
import QuestionDialog from "./QuestionDialog";
import BaseDialog from "./BaseDialog";
import Field from '../elements/Field';
import Field from "../elements/Field";
import Spinner from "../elements/Spinner";
import DialogButtons from "../elements/DialogButtons";
import { sendSentryReport } from "../../../sentry";
import defaultDispatcher from '../../../dispatcher/dispatcher';
import { Action } from '../../../dispatcher/actions';
import defaultDispatcher from "../../../dispatcher/dispatcher";
import { Action } from "../../../dispatcher/actions";
interface IProps {
onFinished: (success: boolean) => void;
@@ -96,8 +96,9 @@ export default class BugReportDialog extends React.Component<IProps, IState> {
}
const userText =
(this.state.text.length > 0 ? this.state.text + '\n\n': '') + 'Issue: ' +
(this.state.issueUrl.length > 0 ? this.state.issueUrl : 'No issue link given');
(this.state.text.length > 0 ? this.state.text + "\n\n" : "") +
"Issue: " +
(this.state.issueUrl.length > 0 ? this.state.issueUrl : "No issue link given");
this.setState({ busy: true, progress: null, err: null });
this.sendProgressCallback(_t("Preparing to send logs"));
@@ -107,24 +108,27 @@ export default class BugReportDialog extends React.Component<IProps, IState> {
sendLogs: true,
progressCallback: this.sendProgressCallback,
labels: this.props.label ? [this.props.label] : [],
}).then(() => {
if (!this.unmounted) {
this.props.onFinished(false);
Modal.createDialog(QuestionDialog, {
title: _t('Logs sent'),
description: _t('Thank you!'),
hasCancelButton: false,
});
}
}, (err) => {
if (!this.unmounted) {
this.setState({
busy: false,
progress: null,
err: _t("Failed to send logs: ") + `${err.message}`,
});
}
});
}).then(
() => {
if (!this.unmounted) {
this.props.onFinished(false);
Modal.createDialog(QuestionDialog, {
title: _t("Logs sent"),
description: _t("Thank you!"),
hasCancelButton: false,
});
}
},
(err) => {
if (!this.unmounted) {
this.setState({
busy: false,
progress: null,
err: _t("Failed to send logs: ") + `${err.message}`,
});
}
},
);
sendSentryReport(this.state.text, this.state.issueUrl, this.props.error);
};
@@ -179,9 +183,7 @@ export default class BugReportDialog extends React.Component<IProps, IState> {
public render() {
let error = null;
if (this.state.err) {
error = <div className="error">
{ this.state.err }
</div>;
error = <div className="error">{this.state.err}</div>;
}
let progress = null;
@@ -189,55 +191,61 @@ export default class BugReportDialog extends React.Component<IProps, IState> {
progress = (
<div className="progress">
<Spinner />
{ this.state.progress } ...
{this.state.progress} ...
</div>
);
}
let warning;
if (window.Modernizr && Object.values(window.Modernizr).some(support => support === false)) {
warning = <p><b>
{ _t("Reminder: Your browser is unsupported, so your experience may be unpredictable.") }
</b></p>;
if (window.Modernizr && Object.values(window.Modernizr).some((support) => support === false)) {
warning = (
<p>
<b>{_t("Reminder: Your browser is unsupported, so your experience may be unpredictable.")}</b>
</p>
);
}
return (
<BaseDialog
className="mx_BugReportDialog"
onFinished={this.onCancel}
title={_t('Submit debug logs')}
contentId='mx_Dialog_content'
title={_t("Submit debug logs")}
contentId="mx_Dialog_content"
>
<div className="mx_Dialog_content" id='mx_Dialog_content'>
{ warning }
<div className="mx_Dialog_content" id="mx_Dialog_content">
{warning}
<p>
{ _t(
{_t(
"Debug logs contain application usage data including your " +
"username, the IDs or aliases of the rooms you " +
"have visited, which UI elements you last interacted with, " +
"and the usernames of other users. They do not contain messages.",
) }
"username, the IDs or aliases of the rooms you " +
"have visited, which UI elements you last interacted with, " +
"and the usernames of other users. They do not contain messages.",
)}
</p>
<p>
<b>
{_t(
"Before submitting logs, you must <a>create a GitHub issue</a> to describe your problem.",
{},
{
a: (sub) => (
<a
target="_blank"
href="https://github.com/vector-im/element-web/issues/new/choose"
>
{sub}
</a>
),
},
)}
</b>
</p>
<p><b>
{ _t(
"Before submitting logs, you must <a>create a GitHub issue</a> to describe your problem.",
{},
{
a: (sub) => <a
target="_blank"
href="https://github.com/vector-im/element-web/issues/new/choose"
>
{ sub }
</a>,
},
) }
</b></p>
<div className="mx_BugReportDialog_download">
<AccessibleButton onClick={this.onDownload} kind="link" disabled={this.state.downloadBusy}>
{ _t("Download logs") }
{_t("Download logs")}
</AccessibleButton>
{ this.state.downloadProgress && <span>{ this.state.downloadProgress } ...</span> }
{this.state.downloadProgress && <span>{this.state.downloadProgress} ...</span>}
</div>
<Field
@@ -257,15 +265,16 @@ export default class BugReportDialog extends React.Component<IProps, IState> {
value={this.state.text}
placeholder={_t(
"If there is additional context that would help in " +
"analysing the issue, such as what you were doing at " +
"the time, room IDs, user IDs, etc., " +
"please include those things here.",
"analysing the issue, such as what you were doing at " +
"the time, room IDs, user IDs, etc., " +
"please include those things here.",
)}
/>
{ progress }
{ error }
{progress}
{error}
</div>
<DialogButtons primaryButton={_t("Send logs")}
<DialogButtons
primaryButton={_t("Send logs")}
onPrimaryButtonClick={this.onSubmit}
focus={true}
onCancel={this.onCancel}