1
1
/* eslint-disable max-len */
2
2
import { FC } from 'react'
3
- import { bind } from 'lodash'
4
3
import { toast } from 'react-toastify'
5
4
6
5
import { MemberEmailPreferenceAPI , updateMemberEmailPreferencesAsync , useMemberEmailPreferences , UserProfile } from '~/libs/core'
7
- import { Button , FormToggleSwitch , LoadingSpinner } from '~/libs/ui'
6
+ import { Button } from '~/libs/ui'
8
7
import { EnvironmentConfig } from '~/config'
9
8
10
- import { EmailIcon , ForumIcon , SettingSection , triggerSurvey } from '../../../lib'
9
+ import { ForumIcon , SettingSection , triggerSurvey } from '../../../lib'
11
10
12
- import { newsletters , programs , subscribeLink , unsubscribeLink } from './preferences.config'
11
+ import { subscribeLink , unsubscribeLink } from './preferences.config'
13
12
import styles from './PreferencesTab.module.scss'
14
13
15
14
interface PreferencesTabProps {
@@ -20,40 +19,14 @@ const PreferencesTab: FC<PreferencesTabProps> = (props: PreferencesTabProps) =>
20
19
const { data : emailPreferences , mutate : mutateEmailPreferencesData } : MemberEmailPreferenceAPI
21
20
= useMemberEmailPreferences ( props . profile . email )
22
21
23
- const mailChimpFormAction : string = emailPreferences ?. status === 'subscribed' ? unsubscribeLink : subscribeLink
24
-
25
22
function handleGoToForumPreferences ( ) : void {
26
23
window . open ( `https://${ EnvironmentConfig . ENV === 'prod' ? 'discussions' : 'vanilla' } .${ EnvironmentConfig . TC_DOMAIN } /profile/preferences` , '_blank' )
27
24
}
28
25
29
- function handleSubscribtionStatusChange ( ) : void {
30
- if ( emailPreferences ?. status === 'subscribed' ) {
31
- window . open ( unsubscribeLink , '_self' )
32
- } else {
33
- window . open ( subscribeLink , '_self' )
34
- }
35
- }
36
-
37
- function handleUserEmailPreferencesChange ( id : string ) : void {
38
- updateMemberEmailPreferencesAsync ( props . profile . email , {
39
- interests : {
40
- [ id ] : ! emailPreferences ?. interests [ id ] ,
41
- } ,
42
- } )
43
- . then ( ( ) => {
44
- toast . success ( 'Your email preferences ware updated.' )
45
- mutateEmailPreferencesData ( )
46
- triggerSurvey ( )
47
- } )
48
- . catch ( ( ) => {
49
- toast . error ( 'Something went wrong. Please try again later.' )
50
- } )
51
- }
52
-
53
26
return (
54
27
< div className = { styles . container } >
55
28
< h3 > PLATFORM PREFERENCES</ h3 >
56
-
29
+
57
30
< div className = { styles . content } >
58
31
< SettingSection
59
32
leftElement = { (
0 commit comments