@@ -7,6 +7,8 @@ import FormsyForm from 'appirio-tech-react-components/components/Formsy'
77const Formsy = FormsyForm . Formsy
88import { NOTIFICATION_SETTINGS_PERIODS } from '../../../../../config/constants'
99import SwitchButton from 'appirio-tech-react-components/components/SwitchButton/SwitchButton'
10+ import Tooltip from 'appirio-tech-react-components/components/Tooltip/Tooltip'
11+ import { TOOLTIP_DEFAULT_DELAY } from '../../../../../config/constants'
1012import BtnGroup from '../../../../../components/BtnGroup/BtnGroup'
1113import IconSettingsWeb from '../../../../../assets/icons/settings-icon-web.svg'
1214import IconSettingsEmail from '../../../../../assets/icons/settings-icon-mail.svg'
@@ -19,6 +21,7 @@ import _ from 'lodash'
1921const topics = [
2022 {
2123 title : 'New posts and replies' ,
24+ enabledMethods :[ 'web' , 'email' ] ,
2225 types : [
2326 'notifications.connect.project.topic.created' ,
2427 'notifications.connect.project.topic.deleted' ,
@@ -28,6 +31,7 @@ const topics = [
2831 ]
2932 } , {
3033 title : 'Project status changes' ,
34+ enabledMethods :[ 'web' ] ,
3135 types : [
3236 'notifications.connect.project.created' ,
3337 'notifications.connect.project.updated' ,
@@ -40,21 +44,25 @@ const topics = [
4044 ]
4145 } , {
4246 title : 'Project specification changes' ,
47+ enabledMethods :[ 'web' ] ,
4348 types : [
4449 'notifications.connect.project.specificationModified'
4550 ]
4651 } , {
4752 title : 'File uploads' ,
53+ enabledMethods :[ 'web' ] ,
4854 types : [
4955 'notifications.connect.project.fileUploaded'
5056 ]
5157 } , {
5258 title : 'New project links' ,
59+ enabledMethods :[ 'web' ] ,
5360 types : [
5461 'notifications.connect.project.linkCreated'
5562 ]
5663 } , {
5764 title : 'Team changes' ,
65+ enabledMethods :[ 'web' ] ,
5866 types : [
5967 'notifications.connect.project.member.joined' ,
6068 'notifications.connect.project.member.left' ,
@@ -182,18 +190,29 @@ class NotificationSettingsForm extends React.Component {
182190 // we toggle settings for all the types in one topic all together
183191 // so we can use values from the first type to get current value for the whole topic
184192 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' :''
185195 return (
186196 < tr key = { index } >
187197 < th > { topic . title } </ th >
188198 < td > < SwitchButton onChange = { ( ) => this . handleChange ( index , 'web' ) } defaultChecked = { notifications [ topicFirstType ] . web . enabled === 'yes' } /> </ td >
189- < td > < SwitchButton onChange = { ( ) => this . handleChange ( index , 'email' ) } defaultChecked = { notifications [ topicFirstType ] . email . enabled === 'yes' } /> </ td >
199+ < 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 >
208+ </ td >
190209 </ tr >
191210 )
192211 } ) }
193212 < tr >
194213 < td colSpan = "3" >
195214 < div className = "bundle-emails" >
196- < div className = "th" > Bundle emails:</ div >
215+ < div className = "th" > Bundle emails (beta) :</ div >
197216 < BtnGroup
198217 items = { NOTIFICATION_SETTINGS_PERIODS }
199218 onChange = { this . handleBundleEmailChange }
0 commit comments