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