diff options
author | 2022-11-19 15:21:09 +0530 | |
---|---|---|
committer | 2022-11-19 09:51:09 +0000 | |
commit | a051331680b21f20201a47601d69505a4cfa9e40 (patch) | |
tree | f98dd4bc668c9814d58c0e49170aeeb19c2fe1de /src/components/settings/services/ServiceError.tsx | |
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/components/settings/services/ServiceError.tsx')
-rw-r--r-- | src/components/settings/services/ServiceError.tsx | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/components/settings/services/ServiceError.tsx b/src/components/settings/services/ServiceError.tsx new file mode 100644 index 000000000..87efdeb96 --- /dev/null +++ b/src/components/settings/services/ServiceError.tsx | |||
@@ -0,0 +1,64 @@ | |||
1 | import { Component, ReactElement } from 'react'; | ||
2 | import { observer } from 'mobx-react'; | ||
3 | import { Link } from 'react-router-dom'; | ||
4 | import { defineMessages, injectIntl, WrappedComponentProps } from 'react-intl'; | ||
5 | import Infobox from '../../ui/Infobox'; | ||
6 | import Button from '../../ui/button'; | ||
7 | |||
8 | const messages = defineMessages({ | ||
9 | headline: { | ||
10 | id: 'settings.service.error.headline', | ||
11 | defaultMessage: 'Error', | ||
12 | }, | ||
13 | goBack: { | ||
14 | id: 'settings.service.error.goBack', | ||
15 | defaultMessage: 'Back to services', | ||
16 | }, | ||
17 | availableServices: { | ||
18 | id: 'settings.service.form.availableServices', | ||
19 | defaultMessage: 'Available services', | ||
20 | }, | ||
21 | errorMessage: { | ||
22 | id: 'settings.service.error.message', | ||
23 | defaultMessage: 'Could not load service recipe.', | ||
24 | }, | ||
25 | }); | ||
26 | |||
27 | interface IProps extends WrappedComponentProps {} | ||
28 | |||
29 | @observer | ||
30 | class ServiceError extends Component<IProps> { | ||
31 | render(): ReactElement { | ||
32 | const { intl } = this.props; | ||
33 | |||
34 | return ( | ||
35 | <div className="settings__main"> | ||
36 | <div className="settings__header"> | ||
37 | <span className="settings__header-item"> | ||
38 | <Link to="/settings/recipes"> | ||
39 | {intl.formatMessage(messages.availableServices)} | ||
40 | </Link> | ||
41 | </span> | ||
42 | <span className="separator" /> | ||
43 | <span className="settings__header-item"> | ||
44 | {intl.formatMessage(messages.headline)} | ||
45 | </span> | ||
46 | </div> | ||
47 | <div className="settings__body"> | ||
48 | <Infobox type="danger" icon="alert"> | ||
49 | {intl.formatMessage(messages.errorMessage)} | ||
50 | </Infobox> | ||
51 | </div> | ||
52 | <div className="settings__controls"> | ||
53 | <Button | ||
54 | label={intl.formatMessage(messages.goBack)} | ||
55 | htmlForm="form" | ||
56 | onClick={() => window.history.back()} | ||
57 | /> | ||
58 | </div> | ||
59 | </div> | ||
60 | ); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | export default injectIntl(ServiceError); | ||