From b31dd8a8d3fc1b2ec74c61cc053c4dbfc266663b Mon Sep 17 00:00:00 2001 From: Samir Gondzetovic Date: Wed, 23 May 2018 21:47:20 +0100 Subject: [PATCH] disable unsupported email settings --- .../components/NotificationSettingsForm.jsx | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/routes/settings/routes/notifications/components/NotificationSettingsForm.jsx b/src/routes/settings/routes/notifications/components/NotificationSettingsForm.jsx index 62c7554f0..750fb8baf 100644 --- a/src/routes/settings/routes/notifications/components/NotificationSettingsForm.jsx +++ b/src/routes/settings/routes/notifications/components/NotificationSettingsForm.jsx @@ -7,6 +7,8 @@ import FormsyForm from 'appirio-tech-react-components/components/Formsy' const Formsy = FormsyForm.Formsy import { NOTIFICATION_SETTINGS_PERIODS } from '../../../../../config/constants' import SwitchButton from 'appirio-tech-react-components/components/SwitchButton/SwitchButton' +import Tooltip from 'appirio-tech-react-components/components/Tooltip/Tooltip' +import { TOOLTIP_DEFAULT_DELAY } from '../../../../../config/constants' import BtnGroup from '../../../../../components/BtnGroup/BtnGroup' import IconSettingsWeb from '../../../../../assets/icons/settings-icon-web.svg' import IconSettingsEmail from '../../../../../assets/icons/settings-icon-mail.svg' @@ -19,6 +21,7 @@ import _ from 'lodash' const topics = [ { title: 'New posts and replies', + enabledMethods:['web', 'email'], types: [ 'notifications.connect.project.topic.created', 'notifications.connect.project.topic.deleted', @@ -28,6 +31,7 @@ const topics = [ ] }, { title: 'Project status changes', + enabledMethods:['web'], types: [ 'notifications.connect.project.created', 'notifications.connect.project.updated', @@ -40,21 +44,25 @@ const topics = [ ] }, { title: 'Project specification changes', + enabledMethods:['web'], types: [ 'notifications.connect.project.specificationModified' ] }, { title: 'File uploads', + enabledMethods:['web'], types: [ 'notifications.connect.project.fileUploaded' ] }, { title: 'New project links', + enabledMethods:['web'], types: [ 'notifications.connect.project.linkCreated' ] }, { title: 'Team changes', + enabledMethods:['web'], types: [ 'notifications.connect.project.member.joined', 'notifications.connect.project.member.left', @@ -182,18 +190,29 @@ class NotificationSettingsForm extends React.Component { // we toggle settings for all the types in one topic all together // so we can use values from the first type to get current value for the whole topic const topicFirstType = topic.types[0] + const emailStatus = topic.enabledMethods.indexOf('email')<0?'disabled':null + const emailTooltip = topic.enabledMethods.indexOf('email')<0?'Emails are not yet supported for this event type':'' return ( {topic.title} this.handleChange(index, 'web')} defaultChecked={notifications[topicFirstType].web.enabled === 'yes'} /> - this.handleChange(index, 'email')} defaultChecked={notifications[topicFirstType].email.enabled === 'yes'} /> + + +
+ this.handleChange(index, 'email')} defaultChecked={notifications[topicFirstType].email.enabled === 'yes' && emailStatus===null} disabled={emailStatus}/> +
+
+ {emailTooltip} +
+
+ ) })}
-
Bundle emails:
+
Bundle emails (beta):