diff options
author | Ricardo Cino <ricardo@cino.io> | 2022-06-27 18:21:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-27 17:21:31 +0100 |
commit | 0bf13689d53bd493fb4d0a4213c1801013b5aa8a (patch) | |
tree | 2b5ae44e4f1aa73b49c011954ff1cb47e3959bad /src/containers/settings/ServicesScreen.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/ServicesScreen.tsx')
-rw-r--r-- | src/containers/settings/ServicesScreen.tsx | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/containers/settings/ServicesScreen.tsx b/src/containers/settings/ServicesScreen.tsx new file mode 100644 index 000000000..615747382 --- /dev/null +++ b/src/containers/settings/ServicesScreen.tsx | |||
@@ -0,0 +1,53 @@ | |||
1 | import { Component, ReactElement } from 'react'; | ||
2 | import { inject, observer } from 'mobx-react'; | ||
3 | |||
4 | import { StoresProps } from 'src/@types/ferdium-components.types'; | ||
5 | import ServicesDashboard from '../../components/settings/services/ServicesDashboard'; | ||
6 | import ErrorBoundary from '../../components/util/ErrorBoundary'; | ||
7 | |||
8 | class ServicesScreen extends Component<StoresProps> { | ||
9 | componentWillUnmount(): void { | ||
10 | this.props.actions.service.resetFilter(); | ||
11 | this.props.actions.service.resetStatus(); | ||
12 | } | ||
13 | |||
14 | deleteService(): void { | ||
15 | this.props.actions.service.deleteService(); | ||
16 | this.props.actions.service.resetFilter(); | ||
17 | } | ||
18 | |||
19 | render(): ReactElement { | ||
20 | const { user, services, router } = this.props.stores; | ||
21 | const { toggleService, filter, resetFilter } = this.props.actions.service; | ||
22 | const isLoading = services.allServicesRequest.isExecuting; | ||
23 | |||
24 | let allServices = services.all; | ||
25 | if (services.filterNeedle !== null) { | ||
26 | allServices = services.filtered; | ||
27 | } | ||
28 | |||
29 | return ( | ||
30 | <ErrorBoundary> | ||
31 | <ServicesDashboard | ||
32 | user={user.data} | ||
33 | services={allServices} | ||
34 | status={services.actionStatus} | ||
35 | deleteService={() => this.deleteService()} | ||
36 | toggleService={toggleService} | ||
37 | isLoading={isLoading} | ||
38 | filterServices={filter} | ||
39 | resetFilter={resetFilter} | ||
40 | goTo={router.push} | ||
41 | servicesRequestFailed={ | ||
42 | services.allServicesRequest.wasExecuted && | ||
43 | services.allServicesRequest.isError | ||
44 | } | ||
45 | retryServicesRequest={() => services.allServicesRequest.reload()} | ||
46 | searchNeedle={services.filterNeedle} | ||
47 | /> | ||
48 | </ErrorBoundary> | ||
49 | ); | ||
50 | } | ||
51 | } | ||
52 | |||
53 | export default inject('stores', 'actions')(observer(ServicesScreen)); | ||