Skip to content

Commit 099590c

Browse files
author
Vikas Agarwal
committed
Quick fix for empty tooltip on enabled email setting switch.
1 parent cb83ec6 commit 099590c

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/routes/settings/routes/notifications/components/NotificationSettingsForm.jsx

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -190,21 +190,26 @@ class NotificationSettingsForm extends React.Component {
190190
// we toggle settings for all the types in one topic all together
191191
// so we can use values from the first type to get current value for the whole topic
192192
const topicFirstType = topic.types[0]
193-
const emailStatus = topic.enabledMethods.indexOf('email')<0?'disabled':null
194-
const emailTooltip = topic.enabledMethods.indexOf('email')<0?'Emails are not yet supported for this event type':''
193+
const emailStatus = topic.enabledMethods.indexOf('email') < 0 ? 'disabled' : null
194+
const emailTooltip = topic.enabledMethods.indexOf('email') < 0 ? 'Emails are not yet supported for this event type' : null
195195
return (
196196
<tr key={index}>
197197
<th>{topic.title}</th>
198198
<td><SwitchButton onChange={() => this.handleChange(index, 'web')} defaultChecked={notifications[topicFirstType].web.enabled === 'yes'} /></td>
199199
<td>
200-
<Tooltip theme="light" tooltipDelay={TOOLTIP_DEFAULT_DELAY}>
201-
<div className="tooltip-target">
202-
<SwitchButton onChange={() => this.handleChange(index, 'email')} defaultChecked={notifications[topicFirstType].email.enabled === 'yes' && emailStatus===null} disabled={emailStatus}/>
203-
</div>
204-
<div className="tooltip-body">
205-
{emailTooltip}
206-
</div>
207-
</Tooltip>
200+
{ !!emailTooltip &&
201+
<Tooltip theme="light" tooltipDelay={TOOLTIP_DEFAULT_DELAY}>
202+
<div className="tooltip-target">
203+
<SwitchButton onChange={() => this.handleChange(index, 'email')} defaultChecked={notifications[topicFirstType].email.enabled === 'yes' && emailStatus===null} disabled={emailStatus}/>
204+
</div>
205+
<div className="tooltip-body">
206+
{emailTooltip}
207+
</div>
208+
</Tooltip>
209+
}
210+
{
211+
!emailTooltip && <SwitchButton onChange={() => this.handleChange(index, 'email')} defaultChecked={notifications[topicFirstType].email.enabled === 'yes' && emailStatus===null} disabled={emailStatus}/>
212+
}
208213
</td>
209214
</tr>
210215
)

0 commit comments

Comments
 (0)