sdk.getComponent shall die

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-07-20 12:42:21 +02:00
parent 73187156d4
commit 333608c4c4
No known key found for this signature in database
GPG key ID: 55C211A1226CB17D
5 changed files with 10 additions and 20 deletions

View file

@ -21,7 +21,6 @@ import React, { createRef } from 'react';
import { sleep } from "matrix-js-sdk/src/utils"; import { sleep } from "matrix-js-sdk/src/utils";
import { _t, _td } from '../../../languageHandler'; import { _t, _td } from '../../../languageHandler';
import * as sdk from '../../../index';
import { MatrixClientPeg } from '../../../MatrixClientPeg'; import { MatrixClientPeg } from '../../../MatrixClientPeg';
import dis from '../../../dispatcher/dispatcher'; import dis from '../../../dispatcher/dispatcher';
import { AddressType, addressTypes, getAddressType, IUserAddress } from '../../../UserAddress'; import { AddressType, addressTypes, getAddressType, IUserAddress } from '../../../UserAddress';
@ -34,6 +33,9 @@ import { Key } from "../../../Keyboard";
import { Action } from "../../../dispatcher/actions"; import { Action } from "../../../dispatcher/actions";
import { replaceableComponent } from "../../../utils/replaceableComponent"; import { replaceableComponent } from "../../../utils/replaceableComponent";
import AddressSelector from '../elements/AddressSelector'; import AddressSelector from '../elements/AddressSelector';
import AddressTile from '../elements/AddressTile';
import BaseDialog from "./BaseDialog";
import DialogButtons from "../elements/DialogButtons";
const TRUNCATE_QUERY_LIST = 40; const TRUNCATE_QUERY_LIST = 40;
const QUERY_USER_DIRECTORY_DEBOUNCE_MS = 200; const QUERY_USER_DIRECTORY_DEBOUNCE_MS = 200;
@ -621,10 +623,6 @@ export default class AddressPickerDialog extends React.Component<IProps, IState>
}; };
render() { render() {
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
const AddressSelector = sdk.getComponent("elements.AddressSelector");
let inputLabel; let inputLabel;
if (this.props.description) { if (this.props.description) {
inputLabel = <div className="mx_AddressPickerDialog_label"> inputLabel = <div className="mx_AddressPickerDialog_label">
@ -635,7 +633,6 @@ export default class AddressPickerDialog extends React.Component<IProps, IState>
const query = []; const query = [];
// create the invite list // create the invite list
if (this.state.selectedList.length > 0) { if (this.state.selectedList.length > 0) {
const AddressTile = sdk.getComponent("elements.AddressTile");
for (let i = 0; i < this.state.selectedList.length; i++) { for (let i = 0; i < this.state.selectedList.length; i++) {
query.push( query.push(
<AddressTile <AddressTile

View file

@ -17,9 +17,9 @@ limitations under the License.
import React from 'react'; import React from 'react';
import AccessibleButton from './AccessibleButton'; import AccessibleButton from './AccessibleButton';
import dis from '../../../dispatcher/dispatcher'; import dis from '../../../dispatcher/dispatcher';
import * as sdk from '../../../index';
import Analytics from '../../../Analytics'; import Analytics from '../../../Analytics';
import { replaceableComponent } from "../../../utils/replaceableComponent"; import { replaceableComponent } from "../../../utils/replaceableComponent";
import Tooltip from './Tooltip';
interface IProps { interface IProps {
size?: string; size?: string;
@ -71,7 +71,6 @@ export default class ActionButton extends React.Component<IProps, IState> {
render() { render() {
let tooltip; let tooltip;
if (this.state.showTooltip) { if (this.state.showTooltip) {
const Tooltip = sdk.getComponent("elements.Tooltip");
tooltip = <Tooltip className="mx_RoleButton_tooltip" label={this.props.label} />; tooltip = <Tooltip className="mx_RoleButton_tooltip" label={this.props.label} />;
} }

View file

@ -16,10 +16,10 @@ limitations under the License.
*/ */
import React, { createRef } from 'react'; import React, { createRef } from 'react';
import * as sdk from '../../../index';
import classNames from 'classnames'; import classNames from 'classnames';
import { replaceableComponent } from "../../../utils/replaceableComponent"; import { replaceableComponent } from "../../../utils/replaceableComponent";
import { IUserAddress } from '../../../UserAddress'; import { IUserAddress } from '../../../UserAddress';
import AddressTile from './AddressTile';
interface IProps { interface IProps {
onSelected: (index: number) => void; onSelected: (index: number) => void;
@ -128,7 +128,6 @@ export default class AddressSelector extends React.Component<IProps, IState> {
}; };
private createAddressListTiles(): JSX.Element[] { private createAddressListTiles(): JSX.Element[] {
const AddressTile = sdk.getComponent("elements.AddressTile");
const maxSelected = this.maxSelected(this.props.addressList); const maxSelected = this.maxSelected(this.props.addressList);
const addressList = []; const addressList = [];
@ -156,8 +155,6 @@ export default class AddressSelector extends React.Component<IProps, IState> {
address={this.props.addressList[i]} address={this.props.addressList[i]}
showAddress={this.props.showAddress} showAddress={this.props.showAddress}
justified={true} justified={true}
networkName="vector"
networkUrl={require("../../../../res/img/search-icon-vector.svg")}
/> />
</div>, </div>,
); );

View file

@ -17,11 +17,11 @@ limitations under the License.
import React from 'react'; import React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import * as sdk from "../../../index";
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import { replaceableComponent } from "../../../utils/replaceableComponent"; import { replaceableComponent } from "../../../utils/replaceableComponent";
import { mediaFromMxc } from "../../../customisations/Media"; import { mediaFromMxc } from "../../../customisations/Media";
import { IUserAddress } from '../../../UserAddress'; import { IUserAddress } from '../../../UserAddress';
import BaseAvatar from '../avatars/BaseAvatar';
interface IProps { interface IProps {
address: IUserAddress; address: IUserAddress;
@ -53,8 +53,6 @@ export default class AddressTile extends React.Component<IProps> {
imgUrls.push(require("../../../../res/img/icon-email-user.svg")); imgUrls.push(require("../../../../res/img/icon-email-user.svg"));
} }
const BaseAvatar = sdk.getComponent('avatars.BaseAvatar');
const nameClasses = classNames({ const nameClasses = classNames({
"mx_AddressTile_name": true, "mx_AddressTile_name": true,
"mx_AddressTile_justified": this.props.justified, "mx_AddressTile_justified": this.props.justified,

View file

@ -18,13 +18,16 @@ limitations under the License.
import React from 'react'; import React from 'react';
import url from 'url'; import url from 'url';
import * as sdk from '../../../index';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import SdkConfig from '../../../SdkConfig'; import SdkConfig from '../../../SdkConfig';
import WidgetUtils from "../../../utils/WidgetUtils"; import WidgetUtils from "../../../utils/WidgetUtils";
import { MatrixClientPeg } from "../../../MatrixClientPeg"; import { MatrixClientPeg } from "../../../MatrixClientPeg";
import { replaceableComponent } from "../../../utils/replaceableComponent"; import { replaceableComponent } from "../../../utils/replaceableComponent";
import { RoomMember } from 'matrix-js-sdk/src/models/room-member'; import { RoomMember } from 'matrix-js-sdk/src/models/room-member';
import MemberAvatar from '../avatars/MemberAvatar';
import BaseAvatar from '../avatars/BaseAvatar';
import AccessibleButton from './AccessibleButton';
import TextWithTooltip from "./TextWithTooltip";
interface IProps { interface IProps {
url: string; url: string;
@ -88,10 +91,6 @@ export default class AppPermission extends React.Component<IProps, IState> {
render() { render() {
const brand = SdkConfig.get().brand; const brand = SdkConfig.get().brand;
const AccessibleButton = sdk.getComponent("views.elements.AccessibleButton");
const MemberAvatar = sdk.getComponent("views.avatars.MemberAvatar");
const BaseAvatar = sdk.getComponent("views.avatars.BaseAvatar");
const TextWithTooltip = sdk.getComponent("views.elements.TextWithTooltip");
const displayName = this.state.roomMember ? this.state.roomMember.name : this.props.creatorUserId; const displayName = this.state.roomMember ? this.state.roomMember.name : this.props.creatorUserId;
const userId = displayName === this.props.creatorUserId ? null : this.props.creatorUserId; const userId = displayName === this.props.creatorUserId ? null : this.props.creatorUserId;