From 0bf13689d53bd493fb4d0a4213c1801013b5aa8a Mon Sep 17 00:00:00 2001
From: Ricardo Cino <ricardo@cino.io>
Date: Mon, 27 Jun 2022 18:21:31 +0200
Subject: chore: transform containers/settings from js to tsx (#384)

---
 src/containers/settings/TeamScreen.tsx | 48 ++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 src/containers/settings/TeamScreen.tsx

(limited to 'src/containers/settings/TeamScreen.tsx')

diff --git a/src/containers/settings/TeamScreen.tsx b/src/containers/settings/TeamScreen.tsx
new file mode 100644
index 000000000..5e5223f67
--- /dev/null
+++ b/src/containers/settings/TeamScreen.tsx
@@ -0,0 +1,48 @@
+import { Component, ReactElement } from 'react';
+import { inject, observer } from 'mobx-react';
+
+import { StoresProps } from 'src/@types/ferdium-components.types';
+
+import TeamDashboard from '../../components/settings/team/TeamDashboard';
+import ErrorBoundary from '../../components/util/ErrorBoundary';
+import { DEV_API_FRANZ_WEBSITE } from '../../config';
+
+class TeamScreen extends Component<StoresProps> {
+  handleWebsiteLink(route: string): void {
+    const { actions, stores } = this.props;
+
+    const url = `${DEV_API_FRANZ_WEBSITE}/${route}?authToken=${stores.user.authToken}&utm_source=app&utm_medium=account_dashboard`;
+
+    actions.app.openExternalUrl({ url });
+  }
+
+  reloadData(): void {
+    const { user } = this.props.stores;
+
+    user.getUserInfoRequest.reload();
+  }
+
+  render(): ReactElement {
+    const { user, settings } = this.props.stores;
+
+    const isLoadingUserInfo = user.getUserInfoRequest.isExecuting;
+    const { server } = settings.app;
+
+    return (
+      <ErrorBoundary>
+        <TeamDashboard
+          isLoading={isLoadingUserInfo}
+          userInfoRequestFailed={
+            user.getUserInfoRequest.wasExecuted &&
+            user.getUserInfoRequest.isError
+          }
+          retryUserInfoRequest={() => this.reloadData()}
+          openTeamManagement={() => this.handleWebsiteLink('/user/team')}
+          server={server}
+        />
+      </ErrorBoundary>
+    );
+  }
+}
+
+export default inject('stores', 'actions')(observer(TeamScreen));
-- 
cgit v1.2.3-70-g09d2

