From 596fb774e33ac0adda0eb0ca26feaa04fd2269f6 Mon Sep 17 00:00:00 2001 From: Germain Souquet Date: Tue, 20 Jul 2021 12:22:32 +0200 Subject: [PATCH] Remove sdk.getComponent instructions --- src/components/views/auth/AuthHeader.tsx | 6 ++---- src/components/views/auth/AuthPage.tsx | 4 +--- src/components/views/auth/CountryDropdown.tsx | 5 +---- src/components/views/auth/LanguageSelector.tsx | 6 ++---- src/components/views/auth/Welcome.tsx | 6 ++---- 5 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/components/views/auth/AuthHeader.tsx b/src/components/views/auth/AuthHeader.tsx index 6f071c8f61..cab7da1468 100644 --- a/src/components/views/auth/AuthHeader.tsx +++ b/src/components/views/auth/AuthHeader.tsx @@ -16,8 +16,9 @@ limitations under the License. */ import React from 'react'; -import * as sdk from '../../../index'; import { replaceableComponent } from "../../../utils/replaceableComponent"; +import AuthHeaderLogo from "./AuthHeaderLogo"; +import LanguageSelector from "./LanguageSelector"; interface IProps { disableLanguageSelector?: boolean; @@ -26,9 +27,6 @@ interface IProps { @replaceableComponent("views.auth.AuthHeader") export default class AuthHeader extends React.Component { public render(): React.ReactNode { - const AuthHeaderLogo = sdk.getComponent('auth.AuthHeaderLogo'); - const LanguageSelector = sdk.getComponent('views.auth.LanguageSelector'); - return (
diff --git a/src/components/views/auth/AuthPage.tsx b/src/components/views/auth/AuthPage.tsx index 9957c1d6d0..68f3255c2c 100644 --- a/src/components/views/auth/AuthPage.tsx +++ b/src/components/views/auth/AuthPage.tsx @@ -17,14 +17,12 @@ limitations under the License. */ import React from 'react'; -import * as sdk from '../../../index'; import { replaceableComponent } from "../../../utils/replaceableComponent"; +import AuthFooter from "./AuthFooter"; @replaceableComponent("views.auth.AuthPage") export default class AuthPage extends React.PureComponent { public render(): React.ReactNode { - const AuthFooter = sdk.getComponent('auth.AuthFooter'); - return (
diff --git a/src/components/views/auth/CountryDropdown.tsx b/src/components/views/auth/CountryDropdown.tsx index a97222b5e4..bc97956653 100644 --- a/src/components/views/auth/CountryDropdown.tsx +++ b/src/components/views/auth/CountryDropdown.tsx @@ -16,12 +16,11 @@ limitations under the License. import React from 'react'; -import * as sdk from '../../../index'; - import { COUNTRIES, getEmojiFlag, PhoneNumberCountryDefinition } from '../../../phonenumber'; import SdkConfig from "../../../SdkConfig"; import { _t } from "../../../languageHandler"; import { replaceableComponent } from "../../../utils/replaceableComponent"; +import Dropdown from "../elements/Dropdown"; const COUNTRIES_BY_ISO2 = {}; for (const c of COUNTRIES) { @@ -110,8 +109,6 @@ export default class CountryDropdown extends React.Component { }; public render(): React.ReactNode { - const Dropdown = sdk.getComponent('elements.Dropdown'); - let displayedCountries; if (this.state.searchQuery) { displayedCountries = COUNTRIES.filter( diff --git a/src/components/views/auth/LanguageSelector.tsx b/src/components/views/auth/LanguageSelector.tsx index fc4f4ba5ca..c26b4797f3 100644 --- a/src/components/views/auth/LanguageSelector.tsx +++ b/src/components/views/auth/LanguageSelector.tsx @@ -18,9 +18,9 @@ import SdkConfig from "../../../SdkConfig"; import { getCurrentLanguage } from "../../../languageHandler"; import SettingsStore from "../../../settings/SettingsStore"; import PlatformPeg from "../../../PlatformPeg"; -import * as sdk from '../../../index'; import React from 'react'; import { SettingLevel } from "../../../settings/SettingLevel"; +import LanguageDropdown from "../elements/LanguageDropdown"; function onChange(newLang: string): void { if (getCurrentLanguage() !== newLang) { @@ -33,10 +33,8 @@ interface IProps { disabled?: boolean; } -export default function LanguageSelector({ disabled }: IProps): React.ReactNode { +export default function LanguageSelector({ disabled }: IProps): JSX.Element { if (SdkConfig.get()['disable_login_language_selector']) return
; - - const LanguageDropdown = sdk.getComponent('views.elements.LanguageDropdown'); return { } public render(): React.ReactNode { - const EmbeddedPage = sdk.getComponent('structures.EmbeddedPage'); - const LanguageSelector = sdk.getComponent('auth.LanguageSelector'); - const pagesConfig = SdkConfig.get().embeddedPages; let pageUrl = null; if (pagesConfig) {