@@ -18,59 +18,41 @@ import PathSelector from 'components/MemberPath/PathSelector';
18
18
const { fireErrorMessage } = errors ;
19
19
20
20
export function AppComponentSwitch ( appComponent ) {
21
- const {
22
- fields : {
23
- type,
24
- theme,
25
- props,
26
- props : {
27
- leaderboardApiUrl,
28
- title,
29
- podiumSpots,
30
- isCopilot,
31
- hasChallengeHistory,
32
- tcoPointsApiUrl,
33
- memberLimit,
34
- isAlgo,
35
- } ,
36
- } ,
37
- sys : { id } ,
38
- } = appComponent ;
39
- if ( type === 'TCO-Leaderboard' ) {
21
+ if ( appComponent . fields . type === 'TCO-Leaderboard' ) {
40
22
return (
41
23
< Leaderboard
42
- id = { id }
43
- apiUrl = { leaderboardApiUrl }
44
- title = { title }
45
- podiumSpots = { podiumSpots }
46
- isCopilot = { isCopilot }
47
- hasChallengeHistory = { hasChallengeHistory }
48
- tcoPointsApiUrl = { tcoPointsApiUrl }
49
- memberLimit = { memberLimit }
50
- isAlgo = { isAlgo }
51
- key = { id }
52
- themeName = { theme }
24
+ id = { appComponent . sys . id }
25
+ apiUrl = { appComponent . fields . props . leaderboardApiUrl }
26
+ title = { appComponent . fields . props . title }
27
+ podiumSpots = { appComponent . fields . props . podiumSpots }
28
+ isCopilot = { appComponent . fields . props . isCopilot }
29
+ hasChallengeHistory = { appComponent . fields . props . hasChallengeHistory }
30
+ tcoPointsApiUrl = { appComponent . fields . props . tcoPointsApiUrl }
31
+ memberLimit = { appComponent . fields . props . memberLimit }
32
+ isAlgo = { appComponent . fields . props . isAlgo }
33
+ key = { appComponent . sys . id }
34
+ themeName = { appComponent . fields . theme }
53
35
/>
54
36
) ;
55
37
}
56
- if ( type === 'RecruitCRM-Jobs' ) {
57
- return < RecruitCRMJobs { ...props } key = { id } /> ;
38
+ if ( appComponent . fields . type === 'RecruitCRM-Jobs' ) {
39
+ return < RecruitCRMJobs { ...appComponent . fields . props } key = { appComponent . sys . id } /> ;
58
40
}
59
- if ( type === 'EmailSubscribeForm' ) {
60
- return < EmailSubscribeForm { ...props } key = { id } /> ;
41
+ if ( appComponent . fields . type === 'EmailSubscribeForm' ) {
42
+ return < EmailSubscribeForm { ...appComponent . fields . props } key = { appComponent . sys . id } /> ;
61
43
}
62
- if ( type === 'GSheet' ) {
63
- return < GSheet { ...props } key = { id } /> ;
44
+ if ( appComponent . fields . type === 'GSheet' ) {
45
+ return < GSheet { ...appComponent . fields . props } key = { appComponent . sys . id } /> ;
64
46
}
65
- if ( type === 'MemberPath' ) {
47
+ if ( appComponent . fields . type === 'MemberPath' ) {
66
48
return (
67
49
< PathSelector
68
- { ...props }
69
- key = { id }
50
+ { ...appComponent . fields . props }
51
+ key = { appComponent . sys . id }
70
52
/>
71
53
) ;
72
54
}
73
- fireErrorMessage ( `Unsupported app component type ${ type } ` , '' ) ;
55
+ fireErrorMessage ( `Unsupported app component type ${ appComponent . fields . type } ` , '' ) ;
74
56
return null ;
75
57
}
76
58
0 commit comments