@@ -12,27 +12,50 @@ import { Row } from '../primitives/Row';
12
12
import { TokenIcon } from '../primitives/TokenIcon' ;
13
13
import { getSymbolMap } from './IncentivesTooltipContent' ;
14
14
15
- const isCeloAction = ( action : MeritAction ) : boolean => action . startsWith ( 'celo-' ) ;
15
+ export enum CampaignType {
16
+ SELF_VERIFICATION = 'self_verification' ,
17
+ CELO_STANDARD = 'celo_standard' ,
18
+ STANDARD = 'standard' ,
19
+ }
20
+ interface CampaignConfig {
21
+ type : CampaignType ;
22
+ title : string ;
23
+ hasSpecialContent : boolean ;
24
+ }
25
+
26
+ const isCeloAction = ( action : MeritAction ) : boolean => {
27
+ return [
28
+ MeritAction . CELO_SUPPLY_CELO ,
29
+ MeritAction . CELO_SUPPLY_USDT ,
30
+ MeritAction . CELO_SUPPLY_USDC ,
31
+ MeritAction . CELO_SUPPLY_WETH ,
32
+ MeritAction . CELO_SUPPLY_MULTIPLE_BORROW_USDT ,
33
+ MeritAction . CELO_BORROW_CELO ,
34
+ MeritAction . CELO_BORROW_USDT ,
35
+ MeritAction . CELO_BORROW_USDC ,
36
+ MeritAction . CELO_BORROW_WETH ,
37
+ ] . includes ( action ) ;
38
+ } ;
16
39
const isSelfVerificationCampaign = ( action : MeritAction ) : boolean =>
17
40
action === MeritAction . CELO_SUPPLY_USDT ;
18
41
19
- const getCampaignConfig = ( action : MeritAction ) => {
42
+ const getCampaignConfig = ( action : MeritAction ) : CampaignConfig => {
20
43
if ( isSelfVerificationCampaign ( action ) ) {
21
44
return {
22
- type : 'self_verification' as const ,
45
+ type : CampaignType . SELF_VERIFICATION ,
23
46
title : 'Eligible for Merit program and Boosted Yield via Self.' ,
24
47
hasSpecialContent : true ,
25
48
} ;
26
49
}
27
50
if ( isCeloAction ( action ) ) {
28
51
return {
29
- type : 'celo_standard' as const ,
52
+ type : CampaignType . CELO_STANDARD ,
30
53
title : 'Eligible for Merit program.' ,
31
54
hasSpecialContent : true ,
32
55
} ;
33
56
}
34
57
return {
35
- type : 'standard' as const ,
58
+ type : CampaignType . STANDARD ,
36
59
title : 'Eligible for the Merit program.' ,
37
60
hasSpecialContent : false ,
38
61
} ;
@@ -93,7 +116,7 @@ export const MeritIncentivesTooltipContent = ({
93
116
</ Link >
94
117
</ Typography >
95
118
96
- { campaignConfig . type === 'self_verification' && (
119
+ { campaignConfig . type === CampaignType . SELF_VERIFICATION && (
97
120
< >
98
121
< Typography variant = "caption" color = "text.secondary" >
99
122
< Trans >
@@ -130,9 +153,11 @@ export const MeritIncentivesTooltipContent = ({
130
153
</ >
131
154
) }
132
155
{ /* Show if SpecialContent is needed */ }
133
- { /* {campaignConfig.type === 'self_verification' && campaignConfig.hasSpecialContent && ''} */ }
156
+ { /* {campaignConfig.type === CampaignType.SELF_VERIFICATION &&
157
+ campaignConfig.hasSpecialContent &&
158
+ ''} */ }
134
159
{ /* Show if SpecialContent is needed */ }
135
- { /* {campaignConfig.type === 'celo_standard' && campaignConfig.hasSpecialContent && ''} */ }
160
+ { /* {campaignConfig.type === CampaignType.CELO_STANDARD && campaignConfig.hasSpecialContent && ''} */ }
136
161
137
162
{ meritIncentives . customMessage ? (
138
163
< Typography variant = "caption" color = "text.secondary" >
0 commit comments