diff options
author | 2021-10-14 23:32:05 +0200 | |
---|---|---|
committer | 2021-10-15 03:02:05 +0530 | |
commit | 137555821f172e4eadc7cf099d4270ae8fc1374e (patch) | |
tree | 693882bbf7a6b2a24b5a727091d09586d0371007 /src/features/workspaces/containers | |
parent | New translations en-US.json (Spanish) (#2072) (diff) | |
download | ferdium-app-137555821f172e4eadc7cf099d4270ae8fc1374e.tar.gz ferdium-app-137555821f172e4eadc7cf099d4270ae8fc1374e.tar.zst ferdium-app-137555821f172e4eadc7cf099d4270ae8fc1374e.zip |
chore: convert components to tsx (#2071)
Diffstat (limited to 'src/features/workspaces/containers')
-rw-r--r-- | src/features/workspaces/containers/EditWorkspaceScreen.tsx (renamed from src/features/workspaces/containers/EditWorkspaceScreen.js) | 34 | ||||
-rw-r--r-- | src/features/workspaces/containers/WorkspacesScreen.tsx (renamed from src/features/workspaces/containers/WorkspacesScreen.js) | 20 |
2 files changed, 28 insertions, 26 deletions
diff --git a/src/features/workspaces/containers/EditWorkspaceScreen.js b/src/features/workspaces/containers/EditWorkspaceScreen.tsx index bd9e235e3..8e8f8179d 100644 --- a/src/features/workspaces/containers/EditWorkspaceScreen.js +++ b/src/features/workspaces/containers/EditWorkspaceScreen.tsx | |||
@@ -1,26 +1,26 @@ | |||
1 | import { Component } from 'react'; | 1 | import { Component } from 'react'; |
2 | import { inject, observer } from 'mobx-react'; | 2 | import { inject, observer } from 'mobx-react'; |
3 | import PropTypes from 'prop-types'; | ||
4 | 3 | ||
5 | import ErrorBoundary from '../../../components/util/ErrorBoundary'; | 4 | import ErrorBoundary from '../../../components/util/ErrorBoundary'; |
6 | import EditWorkspaceForm from '../components/EditWorkspaceForm'; | 5 | import EditWorkspaceForm from '../components/EditWorkspaceForm'; |
7 | import ServicesStore from '../../../stores/ServicesStore'; | ||
8 | import Workspace from '../models/Workspace'; | 6 | import Workspace from '../models/Workspace'; |
9 | import { workspaceStore } from '../index'; | 7 | import { workspaceStore } from '../index'; |
10 | import { deleteWorkspaceRequest, updateWorkspaceRequest } from '../api'; | 8 | import { deleteWorkspaceRequest, updateWorkspaceRequest } from '../api'; |
11 | import WorkspacesStore from '../store'; | 9 | import { ServicesStore, WorkspacesStore } from '../../../stores.types'; |
12 | 10 | ||
13 | @inject('stores', 'actions') @observer | 11 | type Props = { |
14 | class EditWorkspaceScreen extends Component { | 12 | actions: { |
15 | static propTypes = { | 13 | workspaces: WorkspacesStore; |
16 | actions: PropTypes.shape({ | ||
17 | workspaces: PropTypes.instanceOf(WorkspacesStore), | ||
18 | }).isRequired, | ||
19 | stores: PropTypes.shape({ | ||
20 | services: PropTypes.instanceOf(ServicesStore).isRequired, | ||
21 | }).isRequired, | ||
22 | }; | 14 | }; |
15 | stores: { | ||
16 | services: ServicesStore; | ||
17 | }; | ||
18 | }; | ||
23 | 19 | ||
20 | @inject('stores', 'actions') | ||
21 | @observer | ||
22 | class EditWorkspaceScreen extends Component<Props> { | ||
23 | // @ts-expect-error Not all code paths return a value. | ||
24 | onDelete = () => { | 24 | onDelete = () => { |
25 | const { workspaceBeingEdited } = workspaceStore; | 25 | const { workspaceBeingEdited } = workspaceStore; |
26 | const { actions } = this.props; | 26 | const { actions } = this.props; |
@@ -28,12 +28,14 @@ class EditWorkspaceScreen extends Component { | |||
28 | actions.workspaces.delete({ workspace: workspaceBeingEdited }); | 28 | actions.workspaces.delete({ workspace: workspaceBeingEdited }); |
29 | }; | 29 | }; |
30 | 30 | ||
31 | onSave = (values) => { | 31 | onSave = values => { |
32 | const { workspaceBeingEdited } = workspaceStore; | 32 | const { workspaceBeingEdited } = workspaceStore; |
33 | const { actions } = this.props; | 33 | const { actions } = this.props; |
34 | const workspace = new Workspace( | 34 | const workspace = new Workspace({ |
35 | ({ saving: true, ...workspaceBeingEdited, ...values }), | 35 | saving: true, |
36 | ); | 36 | ...workspaceBeingEdited, |
37 | ...values, | ||
38 | }); | ||
37 | actions.workspaces.update({ workspace }); | 39 | actions.workspaces.update({ workspace }); |
38 | }; | 40 | }; |
39 | 41 | ||
diff --git a/src/features/workspaces/containers/WorkspacesScreen.js b/src/features/workspaces/containers/WorkspacesScreen.tsx index 2ba3784cb..a07e92439 100644 --- a/src/features/workspaces/containers/WorkspacesScreen.js +++ b/src/features/workspaces/containers/WorkspacesScreen.tsx | |||
@@ -1,6 +1,5 @@ | |||
1 | import { Component } from 'react'; | 1 | import { Component } from 'react'; |
2 | import { inject, observer } from 'mobx-react'; | 2 | import { inject, observer } from 'mobx-react'; |
3 | import PropTypes from 'prop-types'; | ||
4 | import WorkspacesDashboard from '../components/WorkspacesDashboard'; | 3 | import WorkspacesDashboard from '../components/WorkspacesDashboard'; |
5 | import ErrorBoundary from '../../../components/util/ErrorBoundary'; | 4 | import ErrorBoundary from '../../../components/util/ErrorBoundary'; |
6 | import { workspaceStore } from '../index'; | 5 | import { workspaceStore } from '../index'; |
@@ -10,16 +9,17 @@ import { | |||
10 | getUserWorkspacesRequest, | 9 | getUserWorkspacesRequest, |
11 | updateWorkspaceRequest, | 10 | updateWorkspaceRequest, |
12 | } from '../api'; | 11 | } from '../api'; |
13 | import WorkspacesStore from '../store'; | 12 | import { WorkspacesStore } from '../../../stores.types'; |
14 | 13 | ||
15 | @inject('stores', 'actions') @observer | 14 | type Props = { |
16 | class WorkspacesScreen extends Component { | 15 | actions: { |
17 | static propTypes = { | 16 | workspaces: WorkspacesStore; |
18 | actions: PropTypes.shape({ | ||
19 | workspaces: PropTypes.instanceOf(WorkspacesStore), | ||
20 | }).isRequired, | ||
21 | }; | 17 | }; |
18 | }; | ||
22 | 19 | ||
20 | @inject('stores', 'actions') | ||
21 | @observer | ||
22 | class WorkspacesScreen extends Component<Props> { | ||
23 | render() { | 23 | render() { |
24 | const { actions } = this.props; | 24 | const { actions } = this.props; |
25 | return ( | 25 | return ( |
@@ -30,8 +30,8 @@ class WorkspacesScreen extends Component { | |||
30 | createWorkspaceRequest={createWorkspaceRequest} | 30 | createWorkspaceRequest={createWorkspaceRequest} |
31 | deleteWorkspaceRequest={deleteWorkspaceRequest} | 31 | deleteWorkspaceRequest={deleteWorkspaceRequest} |
32 | updateWorkspaceRequest={updateWorkspaceRequest} | 32 | updateWorkspaceRequest={updateWorkspaceRequest} |
33 | onCreateWorkspaceSubmit={(data) => actions.workspaces.create(data)} | 33 | onCreateWorkspaceSubmit={data => actions.workspaces.create(data)} |
34 | onWorkspaceClick={(w) => actions.workspaces.edit({ workspace: w })} | 34 | onWorkspaceClick={w => actions.workspaces.edit({ workspace: w })} |
35 | /> | 35 | /> |
36 | </ErrorBoundary> | 36 | </ErrorBoundary> |
37 | ); | 37 | ); |