Apply prettier formatting

This commit is contained in:
Michael Weimann 2022-12-12 12:24:14 +01:00
parent 1cac306093
commit 526645c791
No known key found for this signature in database
GPG key ID: 53F535A266BB9584
1576 changed files with 65385 additions and 62478 deletions

View file

@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import React, { ReactNode } from 'react';
import { EventType } from 'matrix-js-sdk/src/@types/event';
import { JoinRule } from 'matrix-js-sdk/src/@types/partials';
import React, { ReactNode } from "react";
import { EventType } from "matrix-js-sdk/src/@types/event";
import { JoinRule } from "matrix-js-sdk/src/@types/partials";
import { _t } from "../../../languageHandler";
import SdkConfig from "../../../SdkConfig";
@ -24,11 +24,11 @@ import LabelledToggleSwitch from "../elements/LabelledToggleSwitch";
import { MatrixClientPeg } from "../../../MatrixClientPeg";
import Modal from "../../../Modal";
import { IDialogProps } from "./IDialogProps";
import BugReportDialog from './BugReportDialog';
import BugReportDialog from "./BugReportDialog";
import BaseDialog from "./BaseDialog";
import DialogButtons from "../elements/DialogButtons";
import ProgressBar from "../elements/ProgressBar";
import AccessibleButton from '../elements/AccessibleButton';
import AccessibleButton from "../elements/AccessibleButton";
export interface IFinishedOpts {
continue: boolean;
@ -58,7 +58,7 @@ export default class RoomUpgradeWarningDialog extends React.Component<IProps, IS
const room = MatrixClientPeg.get().getRoom(this.props.roomId);
const joinRules = room?.currentState.getStateEvents(EventType.RoomJoinRules, "");
this.isPrivate = joinRules?.getContent()['join_rule'] !== JoinRule.Public ?? true;
this.isPrivate = joinRules?.getContent()["join_rule"] !== JoinRule.Public ?? true;
this.currentVersion = room?.getVersion();
this.state = {
@ -109,7 +109,8 @@ export default class RoomUpgradeWarningDialog extends React.Component<IProps, IS
<LabelledToggleSwitch
value={this.state.inviteUsersToNewRoom}
onChange={this.onInviteUsersToggle}
label={_t("Automatically invite members from this room to the new one")} />
label={_t("Automatically invite members from this room to the new one")}
/>
);
}
@ -117,53 +118,58 @@ export default class RoomUpgradeWarningDialog extends React.Component<IProps, IS
let bugReports = (
<p>
{ _t(
{_t(
"This usually only affects how the room is processed on the server. If you're " +
"having problems with your %(brand)s, please report a bug.", { brand },
) }
"having problems with your %(brand)s, please report a bug.",
{ brand },
)}
</p>
);
if (SdkConfig.get().bug_report_endpoint_url) {
bugReports = (
<p>
{ _t(
{_t(
"This usually only affects how the room is processed on the server. If you're " +
"having problems with your %(brand)s, please <a>report a bug</a>.",
"having problems with your %(brand)s, please <a>report a bug</a>.",
{
brand,
},
{
"a": (sub) => {
return <AccessibleButton kind='link_inline' onClick={this.openBugReportDialog}>
{ sub }
</AccessibleButton>;
a: (sub) => {
return (
<AccessibleButton kind="link_inline" onClick={this.openBugReportDialog}>
{sub}
</AccessibleButton>
);
},
},
) }
)}
</p>
);
}
let footer: JSX.Element;
if (this.state.progressText) {
footer = <span className="mx_RoomUpgradeWarningDialog_progress">
<ProgressBar value={this.state.progress} max={this.state.total} />
<div className="mx_RoomUpgradeWarningDialog_progressText">
{ this.state.progressText }
</div>
</span>;
footer = (
<span className="mx_RoomUpgradeWarningDialog_progress">
<ProgressBar value={this.state.progress} max={this.state.total} />
<div className="mx_RoomUpgradeWarningDialog_progressText">{this.state.progressText}</div>
</span>
);
} else {
footer = <DialogButtons
primaryButton={_t("Upgrade")}
onPrimaryButtonClick={this.onContinue}
cancelButton={_t("Cancel")}
onCancel={this.onCancel}
/>;
footer = (
<DialogButtons
primaryButton={_t("Upgrade")}
onPrimaryButtonClick={this.onContinue}
cancelButton={_t("Cancel")}
onCancel={this.onCancel}
/>
);
}
return (
<BaseDialog
className='mx_RoomUpgradeWarningDialog'
className="mx_RoomUpgradeWarningDialog"
hasCancel={true}
fixedWidth={false}
onFinished={this.props.onFinished}
@ -171,33 +177,36 @@ export default class RoomUpgradeWarningDialog extends React.Component<IProps, IS
>
<div>
<p>
{ this.props.description || _t(
"Upgrading a room is an advanced action and is usually recommended when a room " +
"is unstable due to bugs, missing features or security vulnerabilities.",
) }
{this.props.description ||
_t(
"Upgrading a room is an advanced action and is usually recommended when a room " +
"is unstable due to bugs, missing features or security vulnerabilities.",
)}
</p>
<p>
{ _t(
{_t(
"<b>Please note upgrading will make a new version of the room</b>. " +
"All current messages will stay in this archived room.", {}, {
b: sub => <b>{ sub }</b>,
"All current messages will stay in this archived room.",
{},
{
b: (sub) => <b>{sub}</b>,
},
) }
)}
</p>
{ bugReports }
{bugReports}
<p>
{ _t(
{_t(
"You'll upgrade this room from <oldVersion /> to <newVersion />.",
{},
{
oldVersion: () => <code>{ this.currentVersion }</code>,
newVersion: () => <code>{ this.props.targetVersion }</code>,
oldVersion: () => <code>{this.currentVersion}</code>,
newVersion: () => <code>{this.props.targetVersion}</code>,
},
) }
)}
</p>
{ inviteToggle }
{inviteToggle}
</div>
{ footer }
{footer}
</BaseDialog>
);
}