From eb7b2481f631cec5953265eef4ebc3f2fa7e496a Mon Sep 17 00:00:00 2001 From: muhamedsalih-tw <104364298+muhamedsalih-tw@users.noreply.github.com> Date: Wed, 16 Nov 2022 23:30:39 +0530 Subject: Transform JSX components to TSX (#755) * color picker types * Import * SetupAssistant * Services & appear * ServiceWebView * SettingsLayout * ImportantScreen * WorkspaceDrawer * SetupAssistant * chore: update vscode settings * chore: removed stale Import screen component & its tree --- src/containers/auth/ImportScreen.tsx | 25 ----- src/containers/auth/SetupAssistantScreen.tsx | 133 ++++++++++++++------------- 2 files changed, 69 insertions(+), 89 deletions(-) delete mode 100644 src/containers/auth/ImportScreen.tsx (limited to 'src/containers') diff --git a/src/containers/auth/ImportScreen.tsx b/src/containers/auth/ImportScreen.tsx deleted file mode 100644 index 91e985ad5..000000000 --- a/src/containers/auth/ImportScreen.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { Component, ReactElement } from 'react'; -import { inject, observer } from 'mobx-react'; -import { StoresProps } from '../../@types/ferdium-components.types'; -import Import from '../../components/auth/Import'; - -class ImportScreen extends Component { - render(): ReactElement { - const { actions, stores } = this.props; - - if (stores.user.isImportLegacyServicesCompleted) { - stores.router.push(stores.user.inviteRoute); - } - - return ( - - ); - } -} - -export default inject('stores', 'actions')(observer(ImportScreen)); diff --git a/src/containers/auth/SetupAssistantScreen.tsx b/src/containers/auth/SetupAssistantScreen.tsx index 661d688aa..0d4c3feec 100644 --- a/src/containers/auth/SetupAssistantScreen.tsx +++ b/src/containers/auth/SetupAssistantScreen.tsx @@ -1,88 +1,93 @@ -/* eslint-disable no-await-in-loop */ import { Component, ReactElement } from 'react'; import { inject, observer } from 'mobx-react'; - import { StoresProps } from '../../@types/ferdium-components.types'; import sleep from '../../helpers/async-helpers'; import SetupAssistant from '../../components/auth/SetupAssistant'; +import { ILegacyServices } from '../../@types/legacy-types'; + +interface IProps extends StoresProps {} + +interface IState { + isSettingUpServices: boolean; +} + +@inject('stores', 'actions') +@observer +class SetupAssistantScreen extends Component { + services: ILegacyServices; + + constructor(props: IProps) { + super(props); -class SetupAssistantScreen extends Component { - state = { - isSettingUpServices: false, - }; + this.state = { + isSettingUpServices: false, + }; - // TODO: Why are these hardcoded here? Do they need to conform to specific services in the packaged recipes? If so, its more important to fix this - services = { - whatsapp: { - name: 'WhatsApp', - hasTeamId: false, - }, - messenger: { - name: 'Messenger', - hasTeamId: false, - }, - gmail: { - name: 'Gmail', - hasTeamId: false, - }, - skype: { - name: 'Skype', - hasTeamId: false, - }, - telegram: { - name: 'Telegram', - hasTeamId: false, - }, - instagram: { - name: 'Instagram', - hasTeamId: false, - }, - slack: { - name: 'Slack', - hasTeamId: true, - }, - hangouts: { - name: 'Hangouts', - hasTeamId: false, - }, - linkedin: { - name: 'LinkedIn', - hasTeamId: false, - }, - }; + // TODO: Why are these hardcoded here? Do they need to conform to specific services in the packaged recipes? If so, its more important to fix this + this.services = { + whatsapp: { + name: 'WhatsApp', + hasTeamId: false, + }, + messenger: { + name: 'Messenger', + hasTeamId: false, + }, + gmail: { + name: 'Gmail', + hasTeamId: false, + }, + skype: { + name: 'Skype', + hasTeamId: false, + }, + telegram: { + name: 'Telegram', + hasTeamId: false, + }, + instagram: { + name: 'Instagram', + hasTeamId: false, + }, + slack: { + name: 'Slack', + hasTeamId: true, + }, + hangouts: { + name: 'Hangouts', + hasTeamId: false, + }, + linkedin: { + name: 'LinkedIn', + hasTeamId: false, + }, + }; + } async setupServices(serviceConfig: any): Promise { - const { - stores: { services, router }, - } = this.props; + const { services, router } = this.props.stores; - this.setState({ - isSettingUpServices: true, - }); + this.setState({ isSettingUpServices: true }); // The store requests are not build for parallel requests so we need to finish one request after another for (const config of serviceConfig) { - const serviceData = { - name: this.services[config.id].name, - team: config.team, - }; - + // eslint-disable-next-line no-await-in-loop await services._createService({ recipeId: config.id, - serviceData, + serviceData: { + name: this.services[config.id].name, + team: config.team, + }, redirect: false, skipCleanup: true, }); + // eslint-disable-next-line no-await-in-loop await sleep(100); } - this.setState({ - isSettingUpServices: false, - }); - + this.setState({ isSettingUpServices: false }); await sleep(100); - router.push('/'); } @@ -91,11 +96,11 @@ class SetupAssistantScreen extends Component { this.setupServices(config)} services={this.services} - embed={false} + // embed={false} // TODO - [TS DEBT][PROP NOT USED IN COMPONENT] check legacy services type isSettingUpServices={this.state.isSettingUpServices} /> ); } } -export default inject('stores', 'actions')(observer(SetupAssistantScreen)); +export default SetupAssistantScreen; -- cgit v1.2.3-70-g09d2