diff options
author | 2022-11-19 15:21:09 +0530 | |
---|---|---|
committer | 2022-11-19 09:51:09 +0000 | |
commit | a051331680b21f20201a47601d69505a4cfa9e40 (patch) | |
tree | f98dd4bc668c9814d58c0e49170aeeb19c2fe1de /src/containers/settings | |
parent | 6.2.1-nightly.46 [skip ci] (diff) | |
download | ferdium-app-a051331680b21f20201a47601d69505a4cfa9e40.tar.gz ferdium-app-a051331680b21f20201a47601d69505a4cfa9e40.tar.zst ferdium-app-a051331680b21f20201a47601d69505a4cfa9e40.zip |
Transform service components to ts (#778)
Diffstat (limited to 'src/containers/settings')
-rw-r--r-- | src/containers/settings/ServicesScreen.tsx | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/src/containers/settings/ServicesScreen.tsx b/src/containers/settings/ServicesScreen.tsx index affe965e9..780b7331e 100644 --- a/src/containers/settings/ServicesScreen.tsx +++ b/src/containers/settings/ServicesScreen.tsx | |||
@@ -1,39 +1,48 @@ | |||
1 | import { Component, ReactElement } from 'react'; | 1 | import { Component, ReactElement } from 'react'; |
2 | import { inject, observer } from 'mobx-react'; | 2 | import { inject, observer } from 'mobx-react'; |
3 | |||
4 | import { StoresProps } from '../../@types/ferdium-components.types'; | 3 | import { StoresProps } from '../../@types/ferdium-components.types'; |
5 | import ServicesDashboard from '../../components/settings/services/ServicesDashboard'; | 4 | import ServicesDashboard from '../../components/settings/services/ServicesDashboard'; |
6 | import ErrorBoundary from '../../components/util/ErrorBoundary'; | 5 | import ErrorBoundary from '../../components/util/ErrorBoundary'; |
7 | 6 | ||
8 | class ServicesScreen extends Component<StoresProps> { | 7 | interface IProps extends StoresProps {} |
8 | |||
9 | @inject('stores', 'actions') | ||
10 | @observer | ||
11 | class ServicesScreen extends Component<IProps> { | ||
9 | componentWillUnmount(): void { | 12 | componentWillUnmount(): void { |
10 | this.props.actions.service.resetFilter(); | 13 | this.props.actions.service.resetFilter(); |
11 | this.props.actions.service.resetStatus(); | 14 | this.props.actions.service.resetStatus(); |
12 | } | 15 | } |
13 | 16 | ||
14 | deleteService(): void { | 17 | // TODO - [TECH DEBT] need to check it |
15 | this.props.actions.service.deleteService(); | 18 | // deleteService(): void { |
16 | this.props.actions.service.resetFilter(); | 19 | // this.props.actions.service.deleteService(); |
17 | } | 20 | // this.props.actions.service.resetFilter(); |
21 | // } | ||
18 | 22 | ||
19 | render(): ReactElement { | 23 | render(): ReactElement { |
20 | const { user, services, router } = this.props.stores; | 24 | const { |
21 | const { toggleService, filter, resetFilter } = this.props.actions.service; | 25 | // user, |
26 | services, | ||
27 | router, | ||
28 | } = this.props.stores; | ||
29 | const { | ||
30 | // toggleService, | ||
31 | filter, | ||
32 | resetFilter, | ||
33 | } = this.props.actions.service; | ||
22 | const isLoading = services.allServicesRequest.isExecuting; | 34 | const isLoading = services.allServicesRequest.isExecuting; |
23 | 35 | const allServices = | |
24 | let allServices = services.all; | 36 | services.filterNeedle !== null ? services.filtered : services.all; |
25 | if (services.filterNeedle !== null) { | ||
26 | allServices = services.filtered; | ||
27 | } | ||
28 | 37 | ||
29 | return ( | 38 | return ( |
30 | <ErrorBoundary> | 39 | <ErrorBoundary> |
31 | <ServicesDashboard | 40 | <ServicesDashboard |
32 | user={user.data} | 41 | // user={user.data} // TODO - [TECH DEBT][PROPS NOT EXIST IN COMPONENT] check it later |
33 | services={allServices} | 42 | services={allServices} |
34 | status={services.actionStatus} | 43 | status={services.actionStatus} |
35 | deleteService={() => this.deleteService()} | 44 | // deleteService={() => this.deleteService()} // TODO - [TECH DEBT][PROPS NOT EXIST IN COMPONENT] check it later |
36 | toggleService={toggleService} | 45 | // toggleService={toggleService} // TODO - [TECH DEBT][PROPS NOT USED IN COMPONENT] check it later |
37 | isLoading={isLoading} | 46 | isLoading={isLoading} |
38 | filterServices={filter} | 47 | filterServices={filter} |
39 | resetFilter={resetFilter} | 48 | resetFilter={resetFilter} |
@@ -50,4 +59,4 @@ class ServicesScreen extends Component<StoresProps> { | |||
50 | } | 59 | } |
51 | } | 60 | } |
52 | 61 | ||
53 | export default inject('stores', 'actions')(observer(ServicesScreen)); | 62 | export default ServicesScreen; |