diff options
author | 2022-05-08 21:00:17 -0500 | |
---|---|---|
committer | 2022-05-08 22:19:29 -0400 | |
commit | db25991927e9b74eda2f3a9df5d01908abc04208 (patch) | |
tree | 28b82e6e50512ceecdae4e6d2ddec50f0c7835b5 | |
parent | New Crowdin updates (#119) [skip ci] (diff) | |
download | ferdium-app-db25991927e9b74eda2f3a9df5d01908abc04208.tar.gz ferdium-app-db25991927e9b74eda2f3a9df5d01908abc04208.tar.zst ferdium-app-db25991927e9b74eda2f3a9df5d01908abc04208.zip |
Converted some javascript files to typescript
-rw-r--r-- | src/containers/auth/ImportScreen.tsx (renamed from src/containers/auth/ImportScreen.js) | 23 | ||||
-rw-r--r-- | src/containers/auth/LockedScreen.tsx (renamed from src/containers/auth/LockedScreen.js) | 23 | ||||
-rw-r--r-- | src/containers/auth/PasswordScreen.tsx (renamed from src/containers/auth/PasswordScreen.js) | 21 | ||||
-rw-r--r-- | src/containers/auth/SetupAssistantScreen.tsx (renamed from src/containers/auth/SetupAssistantScreen.js) | 45 | ||||
-rw-r--r-- | src/containers/auth/WelcomeScreen.tsx (renamed from src/containers/auth/WelcomeScreen.js) | 17 |
5 files changed, 59 insertions, 70 deletions
diff --git a/src/containers/auth/ImportScreen.js b/src/containers/auth/ImportScreen.tsx index c01c3d355..756a2e59c 100644 --- a/src/containers/auth/ImportScreen.js +++ b/src/containers/auth/ImportScreen.tsx | |||
@@ -1,11 +1,20 @@ | |||
1 | import { Component } from 'react'; | 1 | import { Component } from 'react'; |
2 | import PropTypes from 'prop-types'; | ||
3 | import { inject, observer } from 'mobx-react'; | 2 | import { inject, observer } from 'mobx-react'; |
4 | import { RouterStore } from 'mobx-react-router'; | 3 | import { RouterStore } from 'mobx-react-router'; |
5 | import Import from '../../components/auth/Import'; | 4 | import Import from '../../components/auth/Import'; |
6 | import UserStore from '../../stores/UserStore'; | 5 | import UserStore from '../../stores/UserStore'; |
7 | 6 | ||
8 | class ImportScreen extends Component { | 7 | interface IProps { |
8 | actions: { | ||
9 | user: UserStore, | ||
10 | }, | ||
11 | stores: { | ||
12 | user: UserStore, | ||
13 | router: RouterStore, | ||
14 | } | ||
15 | } | ||
16 | |||
17 | class ImportScreen extends Component<IProps> { | ||
9 | render() { | 18 | render() { |
10 | const { actions, stores } = this.props; | 19 | const { actions, stores } = this.props; |
11 | 20 | ||
@@ -24,14 +33,4 @@ class ImportScreen extends Component { | |||
24 | } | 33 | } |
25 | } | 34 | } |
26 | 35 | ||
27 | ImportScreen.propTypes = { | ||
28 | actions: PropTypes.shape({ | ||
29 | user: PropTypes.instanceOf(UserStore).isRequired, | ||
30 | }).isRequired, | ||
31 | stores: PropTypes.shape({ | ||
32 | user: PropTypes.instanceOf(UserStore).isRequired, | ||
33 | router: PropTypes.instanceOf(RouterStore).isRequired, | ||
34 | }).isRequired, | ||
35 | }; | ||
36 | |||
37 | export default inject('stores', 'actions')(observer(ImportScreen)); | 36 | export default inject('stores', 'actions')(observer(ImportScreen)); |
diff --git a/src/containers/auth/LockedScreen.js b/src/containers/auth/LockedScreen.tsx index d99a4051b..e6bb5e8e4 100644 --- a/src/containers/auth/LockedScreen.js +++ b/src/containers/auth/LockedScreen.tsx | |||
@@ -1,5 +1,4 @@ | |||
1 | import { Component } from 'react'; | 1 | import { Component } from 'react'; |
2 | import PropTypes from 'prop-types'; | ||
3 | import { inject, observer } from 'mobx-react'; | 2 | import { inject, observer } from 'mobx-react'; |
4 | import Locked from '../../components/auth/Locked'; | 3 | import Locked from '../../components/auth/Locked'; |
5 | import SettingsStore from '../../stores/SettingsStore'; | 4 | import SettingsStore from '../../stores/SettingsStore'; |
@@ -7,7 +6,17 @@ import SettingsStore from '../../stores/SettingsStore'; | |||
7 | import { hash } from '../../helpers/password-helpers'; | 6 | import { hash } from '../../helpers/password-helpers'; |
8 | import UserStore from '../../stores/UserStore'; | 7 | import UserStore from '../../stores/UserStore'; |
9 | 8 | ||
10 | class LockedScreen extends Component { | 9 | interface IProps { |
10 | actions: { | ||
11 | settings: SettingsStore, | ||
12 | }, | ||
13 | stores: { | ||
14 | settings: SettingsStore, | ||
15 | user: UserStore, | ||
16 | } | ||
17 | }; | ||
18 | |||
19 | class LockedScreen extends Component<IProps> { | ||
11 | state = { | 20 | state = { |
12 | error: false, | 21 | error: false, |
13 | }; | 22 | }; |
@@ -72,14 +81,4 @@ class LockedScreen extends Component { | |||
72 | } | 81 | } |
73 | } | 82 | } |
74 | 83 | ||
75 | LockedScreen.propTypes = { | ||
76 | actions: PropTypes.shape({ | ||
77 | settings: PropTypes.instanceOf(SettingsStore).isRequired, | ||
78 | }).isRequired, | ||
79 | stores: PropTypes.shape({ | ||
80 | settings: PropTypes.instanceOf(SettingsStore).isRequired, | ||
81 | user: PropTypes.instanceOf(UserStore).isRequired, | ||
82 | }).isRequired, | ||
83 | }; | ||
84 | |||
85 | export default inject('stores', 'actions')(observer(LockedScreen)); | 84 | export default inject('stores', 'actions')(observer(LockedScreen)); |
diff --git a/src/containers/auth/PasswordScreen.js b/src/containers/auth/PasswordScreen.tsx index 4b2c1b4a2..864a11fa7 100644 --- a/src/containers/auth/PasswordScreen.js +++ b/src/containers/auth/PasswordScreen.tsx | |||
@@ -1,10 +1,18 @@ | |||
1 | import { Component } from 'react'; | 1 | import { Component } from 'react'; |
2 | import PropTypes from 'prop-types'; | ||
3 | import { inject, observer } from 'mobx-react'; | 2 | import { inject, observer } from 'mobx-react'; |
4 | import Password from '../../components/auth/Password'; | 3 | import Password from '../../components/auth/Password'; |
5 | import UserStore from '../../stores/UserStore'; | 4 | import UserStore from '../../stores/UserStore'; |
6 | 5 | ||
7 | class PasswordScreen extends Component { | 6 | interface IProps { |
7 | actions: { | ||
8 | user: UserStore, | ||
9 | }, | ||
10 | stores: { | ||
11 | user: UserStore, | ||
12 | } | ||
13 | }; | ||
14 | |||
15 | class PasswordScreen extends Component<IProps> { | ||
8 | render() { | 16 | render() { |
9 | const { actions, stores } = this.props; | 17 | const { actions, stores } = this.props; |
10 | 18 | ||
@@ -20,13 +28,4 @@ class PasswordScreen extends Component { | |||
20 | } | 28 | } |
21 | } | 29 | } |
22 | 30 | ||
23 | PasswordScreen.propTypes = { | ||
24 | actions: PropTypes.shape({ | ||
25 | user: PropTypes.instanceOf(UserStore).isRequired, | ||
26 | }).isRequired, | ||
27 | stores: PropTypes.shape({ | ||
28 | user: PropTypes.instanceOf(UserStore).isRequired, | ||
29 | }).isRequired, | ||
30 | }; | ||
31 | |||
32 | export default inject('stores', 'actions')(observer(PasswordScreen)); | 31 | export default inject('stores', 'actions')(observer(PasswordScreen)); |
diff --git a/src/containers/auth/SetupAssistantScreen.js b/src/containers/auth/SetupAssistantScreen.tsx index 42c3d6019..44bd32772 100644 --- a/src/containers/auth/SetupAssistantScreen.js +++ b/src/containers/auth/SetupAssistantScreen.tsx | |||
@@ -1,6 +1,5 @@ | |||
1 | /* eslint-disable no-await-in-loop */ | 1 | /* eslint-disable no-await-in-loop */ |
2 | import { Component } from 'react'; | 2 | import { Component } from 'react'; |
3 | import PropTypes from 'prop-types'; | ||
4 | import { inject, observer } from 'mobx-react'; | 3 | import { inject, observer } from 'mobx-react'; |
5 | 4 | ||
6 | import { RouterStore } from 'mobx-react-router'; | 5 | import { RouterStore } from 'mobx-react-router'; |
@@ -10,12 +9,23 @@ import ServicesStore from '../../stores/ServicesStore'; | |||
10 | import RecipesStore from '../../stores/RecipesStore'; | 9 | import RecipesStore from '../../stores/RecipesStore'; |
11 | import UserStore from '../../stores/UserStore'; | 10 | import UserStore from '../../stores/UserStore'; |
12 | 11 | ||
13 | class SetupAssistantScreen extends Component { | 12 | interface IProps { |
14 | constructor(props) { | 13 | stores: { |
15 | super(props); | 14 | services?: ServicesStore, |
16 | this.state = { | 15 | router: RouterStore, |
17 | isSettingUpServices: false, | 16 | recipes?: RecipesStore, |
18 | }; | 17 | user?: UserStore, |
18 | }, | ||
19 | actions: { | ||
20 | user: UserStore, | ||
21 | service: ServicesStore, | ||
22 | recipe: RecipesStore, | ||
23 | }, | ||
24 | }; | ||
25 | |||
26 | class SetupAssistantScreen extends Component<IProps> { | ||
27 | state = { | ||
28 | isSettingUpServices: false, | ||
19 | } | 29 | } |
20 | 30 | ||
21 | // 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 | 31 | // 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 |
@@ -69,12 +79,9 @@ class SetupAssistantScreen extends Component { | |||
69 | for (const config of serviceConfig) { | 79 | for (const config of serviceConfig) { |
70 | const serviceData = { | 80 | const serviceData = { |
71 | name: this.services[config.id].name, | 81 | name: this.services[config.id].name, |
82 | team: config.team | ||
72 | }; | 83 | }; |
73 | 84 | ||
74 | if (config.team) { | ||
75 | serviceData.team = config.team; | ||
76 | } | ||
77 | |||
78 | await services._createService({ | 85 | await services._createService({ |
79 | recipeId: config.id, | 86 | recipeId: config.id, |
80 | serviceData, | 87 | serviceData, |
@@ -91,7 +98,7 @@ class SetupAssistantScreen extends Component { | |||
91 | 98 | ||
92 | await sleep(100); | 99 | await sleep(100); |
93 | 100 | ||
94 | router.push("/"); | 101 | router.push('/'); |
95 | } | 102 | } |
96 | 103 | ||
97 | render() { | 104 | render() { |
@@ -106,18 +113,4 @@ class SetupAssistantScreen extends Component { | |||
106 | } | 113 | } |
107 | } | 114 | } |
108 | 115 | ||
109 | SetupAssistantScreen.propTypes = { | ||
110 | stores: PropTypes.shape({ | ||
111 | services: PropTypes.instanceOf(ServicesStore), | ||
112 | router: PropTypes.instanceOf(RouterStore).isRequired, | ||
113 | recipes: PropTypes.instanceOf(RecipesStore), | ||
114 | user: PropTypes.instanceOf(UserStore), | ||
115 | }).isRequired, | ||
116 | actions: PropTypes.shape({ | ||
117 | user: PropTypes.instanceOf(UserStore).isRequired, | ||
118 | service: PropTypes.instanceOf(ServicesStore).isRequired, | ||
119 | recipe: PropTypes.instanceOf(RecipesStore).isRequired, | ||
120 | }).isRequired, | ||
121 | }; | ||
122 | |||
123 | export default inject('stores', 'actions')(observer(SetupAssistantScreen)); | 116 | export default inject('stores', 'actions')(observer(SetupAssistantScreen)); |
diff --git a/src/containers/auth/WelcomeScreen.js b/src/containers/auth/WelcomeScreen.tsx index 7e1a7a83e..944d288ad 100644 --- a/src/containers/auth/WelcomeScreen.js +++ b/src/containers/auth/WelcomeScreen.tsx | |||
@@ -1,12 +1,18 @@ | |||
1 | import { Component } from 'react'; | 1 | import { Component } from 'react'; |
2 | import PropTypes from 'prop-types'; | ||
3 | import { inject, observer } from 'mobx-react'; | 2 | import { inject, observer } from 'mobx-react'; |
4 | 3 | ||
5 | import Welcome from '../../components/auth/Welcome'; | 4 | import Welcome from '../../components/auth/Welcome'; |
6 | import UserStore from '../../stores/UserStore'; | 5 | import UserStore from '../../stores/UserStore'; |
7 | import RecipePreviewsStore from '../../stores/RecipePreviewsStore'; | 6 | import RecipePreviewsStore from '../../stores/RecipePreviewsStore'; |
8 | 7 | ||
9 | class WelcomeScreen extends Component { | 8 | interface IProps { |
9 | stores: { | ||
10 | user: UserStore, | ||
11 | recipePreviews: RecipePreviewsStore, | ||
12 | }, | ||
13 | }; | ||
14 | |||
15 | class WelcomeScreen extends Component<IProps> { | ||
10 | render() { | 16 | render() { |
11 | const { user, recipePreviews } = this.props.stores; | 17 | const { user, recipePreviews } = this.props.stores; |
12 | 18 | ||
@@ -21,11 +27,4 @@ class WelcomeScreen extends Component { | |||
21 | } | 27 | } |
22 | } | 28 | } |
23 | 29 | ||
24 | WelcomeScreen.propTypes = { | ||
25 | stores: PropTypes.shape({ | ||
26 | user: PropTypes.instanceOf(UserStore).isRequired, | ||
27 | recipePreviews: PropTypes.instanceOf(RecipePreviewsStore).isRequired, | ||
28 | }).isRequired, | ||
29 | }; | ||
30 | |||
31 | export default inject('stores', 'actions')(observer(WelcomeScreen)); | 30 | export default inject('stores', 'actions')(observer(WelcomeScreen)); |