diff options
author | 2022-06-27 18:21:31 +0200 | |
---|---|---|
committer | 2022-06-27 17:21:31 +0100 | |
commit | 0bf13689d53bd493fb4d0a4213c1801013b5aa8a (patch) | |
tree | 2b5ae44e4f1aa73b49c011954ff1cb47e3959bad /src/containers/settings/TeamScreen.tsx | |
parent | chore: recommend specific vscode extensions to setup development [skip ci] (#... (diff) | |
download | ferdium-app-0bf13689d53bd493fb4d0a4213c1801013b5aa8a.tar.gz ferdium-app-0bf13689d53bd493fb4d0a4213c1801013b5aa8a.tar.zst ferdium-app-0bf13689d53bd493fb4d0a4213c1801013b5aa8a.zip |
chore: transform containers/settings from js to tsx (#384)
Diffstat (limited to 'src/containers/settings/TeamScreen.tsx')
-rw-r--r-- | src/containers/settings/TeamScreen.tsx | 48 |
1 files changed, 48 insertions, 0 deletions
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 @@ | |||
1 | import { Component, ReactElement } from 'react'; | ||
2 | import { inject, observer } from 'mobx-react'; | ||
3 | |||
4 | import { StoresProps } from 'src/@types/ferdium-components.types'; | ||
5 | |||
6 | import TeamDashboard from '../../components/settings/team/TeamDashboard'; | ||
7 | import ErrorBoundary from '../../components/util/ErrorBoundary'; | ||
8 | import { DEV_API_FRANZ_WEBSITE } from '../../config'; | ||
9 | |||
10 | class TeamScreen extends Component<StoresProps> { | ||
11 | handleWebsiteLink(route: string): void { | ||
12 | const { actions, stores } = this.props; | ||
13 | |||
14 | const url = `${DEV_API_FRANZ_WEBSITE}/${route}?authToken=${stores.user.authToken}&utm_source=app&utm_medium=account_dashboard`; | ||
15 | |||
16 | actions.app.openExternalUrl({ url }); | ||
17 | } | ||
18 | |||
19 | reloadData(): void { | ||
20 | const { user } = this.props.stores; | ||
21 | |||
22 | user.getUserInfoRequest.reload(); | ||
23 | } | ||
24 | |||
25 | render(): ReactElement { | ||
26 | const { user, settings } = this.props.stores; | ||
27 | |||
28 | const isLoadingUserInfo = user.getUserInfoRequest.isExecuting; | ||
29 | const { server } = settings.app; | ||
30 | |||
31 | return ( | ||
32 | <ErrorBoundary> | ||
33 | <TeamDashboard | ||
34 | isLoading={isLoadingUserInfo} | ||
35 | userInfoRequestFailed={ | ||
36 | user.getUserInfoRequest.wasExecuted && | ||
37 | user.getUserInfoRequest.isError | ||
38 | } | ||
39 | retryUserInfoRequest={() => this.reloadData()} | ||
40 | openTeamManagement={() => this.handleWebsiteLink('/user/team')} | ||
41 | server={server} | ||
42 | /> | ||
43 | </ErrorBoundary> | ||
44 | ); | ||
45 | } | ||
46 | } | ||
47 | |||
48 | export default inject('stores', 'actions')(observer(TeamScreen)); | ||