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/ServiceItem.js | |
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/ServiceItem.js')
-rw-r--r-- | src/components/settings/services/ServiceItem.js | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/src/components/settings/services/ServiceItem.js b/src/components/settings/services/ServiceItem.js deleted file mode 100644 index c666b7dd2..000000000 --- a/src/components/settings/services/ServiceItem.js +++ /dev/null | |||
@@ -1,93 +0,0 @@ | |||
1 | import { Component } from 'react'; | ||
2 | import PropTypes from 'prop-types'; | ||
3 | import { defineMessages, injectIntl } from 'react-intl'; | ||
4 | import ReactTooltip from 'react-tooltip'; | ||
5 | import { observer } from 'mobx-react'; | ||
6 | import classnames from 'classnames'; | ||
7 | |||
8 | import { mdiBellOff, mdiMessageBulletedOff, mdiPower } from '@mdi/js'; | ||
9 | import ServiceModel from '../../../models/Service'; | ||
10 | import Icon from '../../ui/icon'; | ||
11 | |||
12 | const messages = defineMessages({ | ||
13 | tooltipIsDisabled: { | ||
14 | id: 'settings.services.tooltip.isDisabled', | ||
15 | defaultMessage: 'Service is disabled', | ||
16 | }, | ||
17 | tooltipNotificationsDisabled: { | ||
18 | id: 'settings.services.tooltip.notificationsDisabled', | ||
19 | defaultMessage: 'Notifications are disabled', | ||
20 | }, | ||
21 | tooltipIsMuted: { | ||
22 | id: 'settings.services.tooltip.isMuted', | ||
23 | defaultMessage: 'All sounds are muted', | ||
24 | }, | ||
25 | }); | ||
26 | |||
27 | class ServiceItem extends Component { | ||
28 | static propTypes = { | ||
29 | service: PropTypes.instanceOf(ServiceModel).isRequired, | ||
30 | goToServiceForm: PropTypes.func.isRequired, | ||
31 | }; | ||
32 | |||
33 | render() { | ||
34 | const { | ||
35 | service, | ||
36 | // toggleAction, | ||
37 | goToServiceForm, | ||
38 | } = this.props; | ||
39 | const { intl } = this.props; | ||
40 | |||
41 | return ( | ||
42 | <tr | ||
43 | className={classnames({ | ||
44 | 'service-table__row': true, | ||
45 | 'service-table__row--disabled': !service.isEnabled, | ||
46 | })} | ||
47 | > | ||
48 | <td className="service-table__column-icon" onClick={goToServiceForm}> | ||
49 | <img | ||
50 | src={service.icon} | ||
51 | className={classnames({ | ||
52 | 'service-table__icon': true, | ||
53 | 'has-custom-icon': service.hasCustomIcon, | ||
54 | })} | ||
55 | alt="" | ||
56 | /> | ||
57 | </td> | ||
58 | <td className="service-table__column-name" onClick={goToServiceForm}> | ||
59 | {service.name !== '' ? service.name : service.recipe.name} | ||
60 | </td> | ||
61 | <td className="service-table__column-info" onClick={goToServiceForm}> | ||
62 | {service.isMuted && ( | ||
63 | <Icon | ||
64 | icon={mdiBellOff} | ||
65 | data-tip={intl.formatMessage(messages.tooltipIsMuted)} | ||
66 | /> | ||
67 | )} | ||
68 | </td> | ||
69 | <td className="service-table__column-info" onClick={goToServiceForm}> | ||
70 | {!service.isEnabled && ( | ||
71 | <Icon | ||
72 | icon={mdiPower} | ||
73 | data-tip={intl.formatMessage(messages.tooltipIsDisabled)} | ||
74 | /> | ||
75 | )} | ||
76 | </td> | ||
77 | <td className="service-table__column-info" onClick={goToServiceForm}> | ||
78 | {!service.isNotificationEnabled && ( | ||
79 | <Icon | ||
80 | icon={mdiMessageBulletedOff} | ||
81 | data-tip={intl.formatMessage( | ||
82 | messages.tooltipNotificationsDisabled, | ||
83 | )} | ||
84 | /> | ||
85 | )} | ||
86 | <ReactTooltip place="top" type="dark" effect="solid" /> | ||
87 | </td> | ||
88 | </tr> | ||
89 | ); | ||
90 | } | ||
91 | } | ||
92 | |||
93 | export default injectIntl(observer(ServiceItem)); | ||