diff --git a/src/SecurityManager.ts b/src/SecurityManager.ts index 7c65c38e0a..26649ba416 100644 --- a/src/SecurityManager.ts +++ b/src/SecurityManager.ts @@ -33,6 +33,7 @@ import { DeviceTrustLevel } from 'matrix-js-sdk/src/crypto/CrossSigning'; import { logger } from "matrix-js-sdk/src/logger"; import { ComponentType } from "react"; +import QuestionDialog from "./components/views/dialogs/QuestionDialog"; // This stores the secret storage private keys in memory for the JS SDK. This is // only meant to act as a cache to avoid prompting the user multiple times @@ -72,7 +73,6 @@ export class AccessCancelledError extends Error { } async function confirmToDismiss(): Promise { - const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); const [sure] = await Modal.createDialog(QuestionDialog, { title: _t("Cancel entering passphrase?"), description: _t("Are you sure you want to cancel entering passphrase?"), diff --git a/src/components/structures/GroupFilterPanel.tsx b/src/components/structures/GroupFilterPanel.tsx index b6d05efa87..be69b78d3a 100644 --- a/src/components/structures/GroupFilterPanel.tsx +++ b/src/components/structures/GroupFilterPanel.tsx @@ -21,7 +21,6 @@ import GroupFilterOrderStore from '../../stores/GroupFilterOrderStore'; import GroupActions from '../../actions/GroupActions'; -import * as sdk from '../../index'; import dis from '../../dispatcher/dispatcher'; import { _t } from '../../languageHandler'; @@ -32,6 +31,8 @@ import SettingsStore from "../../settings/SettingsStore"; import UserTagTile from "../views/elements/UserTagTile"; import { replaceableComponent } from "../../utils/replaceableComponent"; import UIStore from "../../stores/UIStore"; +import DNDTagTile from "../views/elements/DNDTagTile"; +import ActionButton from "../views/elements/ActionButton"; interface IGroupFilterPanelProps { @@ -129,9 +130,6 @@ class GroupFilterPanel extends React.Component { return void; @@ -58,8 +59,6 @@ export default class CompleteSecurity extends React.Component { } public render() { - const AuthPage = sdk.getComponent("auth.AuthPage"); - const CompleteSecurityBody = sdk.getComponent("auth.CompleteSecurityBody"); const { phase, lostKeys } = this.state; let icon; let title; diff --git a/src/components/structures/auth/ForgotPassword.tsx b/src/components/structures/auth/ForgotPassword.tsx index 66ade9e6ed..d5f5344eae 100644 --- a/src/components/structures/auth/ForgotPassword.tsx +++ b/src/components/structures/auth/ForgotPassword.tsx @@ -18,7 +18,6 @@ limitations under the License. import React from 'react'; import { _t, _td } from '../../../languageHandler'; -import * as sdk from '../../../index'; import Modal from "../../../Modal"; import PasswordReset from "../../../PasswordReset"; import AutoDiscoveryUtils, { ValidatedServerConfig } from "../../../utils/AutoDiscoveryUtils"; @@ -33,6 +32,12 @@ import { PASSWORD_MIN_SCORE } from '../../views/auth/RegistrationForm'; import { IValidationResult } from "../../views/elements/Validation"; import InlineSpinner from '../../views/elements/InlineSpinner'; import { logger } from "matrix-js-sdk/src/logger"; +import Spinner from "../../views/elements/Spinner"; +import QuestionDialog from "../../views/dialogs/QuestionDialog"; +import ErrorDialog from "../../views/dialogs/ErrorDialog"; +import Field from "../../views/elements/Field"; +import AuthHeader from "../../views/auth/AuthHeader"; +import AuthBody from "../../views/auth/AuthBody"; enum Phase { // Show the forgot password inputs @@ -184,7 +189,6 @@ export default class ForgotPassword extends React.Component { } else if (this.state.password !== this.state.password2) { this.showErrorDialog(_t('New passwords must match each other.')); } else { - const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); Modal.createTrackedDialog('Forgot Password Warning', '', QuestionDialog, { title: _t('Warning!'), description: @@ -219,7 +223,6 @@ export default class ForgotPassword extends React.Component { }; public showErrorDialog(description: string, title?: string) { - const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); Modal.createTrackedDialog('Forgot Password Error', '', ErrorDialog, { title, description, @@ -250,8 +253,6 @@ export default class ForgotPassword extends React.Component { } renderForgot() { - const Field = sdk.getComponent('elements.Field'); - let errorText = null; const err = this.state.errorText; if (err) { @@ -334,7 +335,6 @@ export default class ForgotPassword extends React.Component { } renderSendingEmail() { - const Spinner = sdk.getComponent("elements.Spinner"); return ; } @@ -371,9 +371,6 @@ export default class ForgotPassword extends React.Component { } render() { - const AuthHeader = sdk.getComponent("auth.AuthHeader"); - const AuthBody = sdk.getComponent("auth.AuthBody"); - let resetPasswordJsx; switch (this.state.phase) { case Phase.Forgot: diff --git a/src/components/views/dialogs/InfoDialog.tsx b/src/components/views/dialogs/InfoDialog.tsx index 9c74e08e98..ddcea275a9 100644 --- a/src/components/views/dialogs/InfoDialog.tsx +++ b/src/components/views/dialogs/InfoDialog.tsx @@ -44,6 +44,7 @@ export default class InfoDialog extends React.Component { }; render() { + // FIXME: Using a regular import will break the app const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog'); const DialogButtons = sdk.getComponent('views.elements.DialogButtons'); return ( diff --git a/src/components/views/dialogs/IntegrationsImpossibleDialog.tsx b/src/components/views/dialogs/IntegrationsImpossibleDialog.tsx index 52e3a2fbb8..cf783ef259 100644 --- a/src/components/views/dialogs/IntegrationsImpossibleDialog.tsx +++ b/src/components/views/dialogs/IntegrationsImpossibleDialog.tsx @@ -17,9 +17,10 @@ limitations under the License. import React from 'react'; import { _t } from "../../../languageHandler"; import SdkConfig from "../../../SdkConfig"; -import * as sdk from "../../../index"; import { replaceableComponent } from "../../../utils/replaceableComponent"; import { IDialogProps } from "./IDialogProps"; +import BaseDialog from "./BaseDialog"; +import DialogButtons from "../elements/DialogButtons"; interface IProps extends IDialogProps {} @@ -31,8 +32,6 @@ export default class IntegrationsImpossibleDialog extends React.Component void; @@ -133,8 +136,6 @@ export default class LogoutDialog extends React.Component { render() { if (this.state.shouldLoadBackupStatus) { - const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog'); - const description =

{ _t( "Encrypted messages are secured with end-to-end encryption. " + @@ -145,11 +146,8 @@ export default class LogoutDialog extends React.Component { let dialogContent; if (this.state.loading) { - const Spinner = sdk.getComponent('views.elements.Spinner'); - dialogContent = ; } else { - const DialogButtons = sdk.getComponent('views.elements.DialogButtons'); let setupButtonCaption; if (this.state.backupInfo) { setupButtonCaption = _t("Connect this session to Key Backup"); @@ -192,7 +190,6 @@ export default class LogoutDialog extends React.Component { { dialogContent } ); } else { - const QuestionDialog = sdk.getComponent('views.dialogs.QuestionDialog'); return (

; diff --git a/src/components/views/messages/MessageActionBar.tsx b/src/components/views/messages/MessageActionBar.tsx index ced829be02..d30cc2d168 100644 --- a/src/components/views/messages/MessageActionBar.tsx +++ b/src/components/views/messages/MessageActionBar.tsx @@ -21,7 +21,6 @@ import { EventStatus, MatrixEvent } from 'matrix-js-sdk/src/models/event'; import type { Relations } from 'matrix-js-sdk/src/models/relations'; import { _t } from '../../../languageHandler'; -import * as sdk from '../../../index'; import dis from '../../../dispatcher/dispatcher'; import { Action } from '../../../dispatcher/actions'; import { aboveLeftOf, ContextMenu, ContextMenuTooltipButton, useContextMenu } from '../../structures/ContextMenu'; @@ -42,6 +41,7 @@ import SettingsStore from '../../../settings/SettingsStore'; import { RoomPermalinkCreator } from '../../../utils/permalinks/Permalinks'; import ReplyChain from '../elements/ReplyChain'; import { dispatchShowThreadEvent } from '../../../dispatcher/dispatch-actions/threads'; +import ReactionPicker from "../emojipicker/ReactionPicker"; interface IOptionsButtonProps { mxEvent: MatrixEvent; @@ -107,7 +107,6 @@ const ReactButton: React.FC = ({ mxEvent, reactions, onFocusC let contextMenu; if (menuDisplayed) { const buttonRect = button.current.getBoundingClientRect(); - const ReactionPicker = sdk.getComponent('emojipicker.ReactionPicker'); contextMenu = ; diff --git a/src/components/views/rooms/AppsDrawer.tsx b/src/components/views/rooms/AppsDrawer.tsx index 4c6b8db02e..e4bbd3a288 100644 --- a/src/components/views/rooms/AppsDrawer.tsx +++ b/src/components/views/rooms/AppsDrawer.tsx @@ -21,7 +21,6 @@ import { Resizable } from "re-resizable"; import AppTile from '../elements/AppTile'; import dis from '../../../dispatcher/dispatcher'; -import * as sdk from '../../../index'; import * as ScalarMessaging from '../../../ScalarMessaging'; import WidgetUtils from '../../../utils/WidgetUtils'; import WidgetEchoStore from "../../../stores/WidgetEchoStore"; @@ -37,6 +36,7 @@ import UIStore from "../../../stores/UIStore"; import { Room } from "matrix-js-sdk/src/models/room"; import { IApp } from "../../../stores/WidgetStore"; import { ActionPayload } from "../../../dispatcher/payloads"; +import Spinner from "../elements/Spinner"; interface IProps { userId: string; @@ -237,8 +237,7 @@ export default class AppsDrawer extends React.Component { WidgetUtils.getRoomWidgets(this.props.room), ) ) { - const Loader = sdk.getComponent("elements.Spinner"); - spinner = ; + spinner = ; } const classes = classNames({ diff --git a/src/components/views/rooms/RoomPreviewBar.tsx b/src/components/views/rooms/RoomPreviewBar.tsx index 82437a5c14..7ff7b6416d 100644 --- a/src/components/views/rooms/RoomPreviewBar.tsx +++ b/src/components/views/rooms/RoomPreviewBar.tsx @@ -21,7 +21,6 @@ import { EventType, RoomType } from "matrix-js-sdk/src/@types/event"; import { IJoinRuleEventContent, JoinRule } from "matrix-js-sdk/src/@types/partials"; import { RoomMember } from "matrix-js-sdk/src/models/room-member"; -import * as sdk from '../../../index'; import { MatrixClientPeg } from '../../../MatrixClientPeg'; import dis from '../../../dispatcher/dispatcher'; import classNames from 'classnames'; @@ -37,6 +36,7 @@ import Spinner from "../elements/Spinner"; import AccessibleButton from "../elements/AccessibleButton"; import { UIFeature } from "../../../settings/UIFeature"; import SettingsStore from "../../../settings/SettingsStore"; +import RoomAvatar from "../avatars/RoomAvatar"; const MemberEventHtmlReasonField = "io.element.html_reason"; @@ -465,7 +465,6 @@ export default class RoomPreviewBar extends React.Component { break; } case MessageCase.Invite: { - const RoomAvatar = sdk.getComponent("views.avatars.RoomAvatar"); const oobData = Object.assign({}, this.props.oobData, { avatarUrl: this.communityProfile().avatarMxc, }); diff --git a/src/components/views/settings/CrossSigningPanel.tsx b/src/components/views/settings/CrossSigningPanel.tsx index bb46e84d70..a01e3c4101 100644 --- a/src/components/views/settings/CrossSigningPanel.tsx +++ b/src/components/views/settings/CrossSigningPanel.tsx @@ -18,7 +18,6 @@ import React from 'react'; import { MatrixClientPeg } from '../../../MatrixClientPeg'; import { _t } from '../../../languageHandler'; -import * as sdk from '../../../index'; import Modal from '../../../Modal'; import Spinner from '../elements/Spinner'; import InteractiveAuthDialog from '../dialogs/InteractiveAuthDialog'; @@ -29,6 +28,7 @@ import SetupEncryptionDialog from '../dialogs/security/SetupEncryptionDialog'; import { accessSecretStorage } from '../../../SecurityManager'; import { logger } from "matrix-js-sdk/src/logger"; +import AccessibleButton from "../elements/AccessibleButton"; interface IState { error?: Error; @@ -165,7 +165,6 @@ export default class CrossSigningPanel extends React.PureComponent<{}, IState> { }; public render() { - const AccessibleButton = sdk.getComponent("elements.AccessibleButton"); const { error, crossSigningPublicKeysOnDevice, diff --git a/src/components/views/terms/InlineTermsAgreement.tsx b/src/components/views/terms/InlineTermsAgreement.tsx index 80ccf49ee9..3276e85731 100644 --- a/src/components/views/terms/InlineTermsAgreement.tsx +++ b/src/components/views/terms/InlineTermsAgreement.tsx @@ -16,10 +16,10 @@ limitations under the License. import React from "react"; import { _t, pickBestLanguage } from "../../../languageHandler"; -import * as sdk from "../../.."; import { objectClone } from "../../../utils/objects"; import StyledCheckbox from "../elements/StyledCheckbox"; import { replaceableComponent } from "../../../utils/replaceableComponent"; +import AccessibleButton from "../elements/AccessibleButton"; interface IProps { policiesAndServicePairs: any[]; @@ -113,7 +113,6 @@ export default class InlineTermsAgreement extends React.Component !p.checked); return ( diff --git a/src/components/views/verification/VerificationCancelled.tsx b/src/components/views/verification/VerificationCancelled.tsx index c8c068f5eb..01909efdfa 100644 --- a/src/components/views/verification/VerificationCancelled.tsx +++ b/src/components/views/verification/VerificationCancelled.tsx @@ -15,9 +15,9 @@ limitations under the License. */ import React from 'react'; -import * as sdk from '../../../index'; import { _t } from '../../../languageHandler'; import { replaceableComponent } from "../../../utils/replaceableComponent"; +import DialogButtons from "../elements/DialogButtons"; interface IProps { onDone: () => void; @@ -26,7 +26,6 @@ interface IProps { @replaceableComponent("views.verification.VerificationCancelled") export default class VerificationCancelled extends React.Component { public render(): React.ReactNode { - const DialogButtons = sdk.getComponent('views.elements.DialogButtons'); return

{ _t( "The other party cancelled the verification.", diff --git a/src/components/views/verification/VerificationComplete.tsx b/src/components/views/verification/VerificationComplete.tsx index 99cbab8d73..93d0aac341 100644 --- a/src/components/views/verification/VerificationComplete.tsx +++ b/src/components/views/verification/VerificationComplete.tsx @@ -15,9 +15,9 @@ limitations under the License. */ import React from 'react'; -import * as sdk from '../../../index'; import { _t } from '../../../languageHandler'; import { replaceableComponent } from "../../../utils/replaceableComponent"; +import DialogButtons from "../elements/DialogButtons"; interface IProps { onDone: () => void; @@ -26,7 +26,6 @@ interface IProps { @replaceableComponent("views.verification.VerificationComplete") export default class VerificationComplete extends React.Component { public render(): React.ReactNode { - const DialogButtons = sdk.getComponent('views.elements.DialogButtons'); return

{ _t("Verified!") }

{ _t("You've successfully verified this user.") }