@coorpacademy/components 10.22.4 → 10.22.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -5
- package/es/atom/choice/index.native.js +132 -0
- package/es/atom/choice/index.native.js.map +1 -0
- package/es/atom/gradient/index.native.js +46 -0
- package/es/atom/gradient/index.native.js.map +1 -0
- package/es/atom/html/index.native.js +9 -16
- package/es/atom/html/index.native.js.map +1 -1
- package/es/atom/image-background/index.native.js +90 -0
- package/es/atom/image-background/index.native.js.map +1 -0
- package/es/atom/input-switch/index.js +43 -6
- package/es/atom/input-switch/index.js.map +1 -1
- package/es/atom/input-switch/style.css +56 -6
- package/es/atom/select-modal/index.native.js +6 -6
- package/es/atom/select-modal/index.native.js.map +1 -1
- package/es/atom/text/index.native.js +3 -1
- package/es/atom/text/index.native.js.map +1 -1
- package/es/hoc/modal/select/index.native.js +4 -3
- package/es/hoc/modal/select/index.native.js.map +1 -1
- package/es/molecule/answer/index.js +39 -32
- package/es/molecule/answer/index.js.map +1 -1
- package/es/molecule/cm-popin/index.js +101 -14
- package/es/molecule/cm-popin/index.js.map +1 -1
- package/es/molecule/cm-popin/style.css +153 -9
- package/es/molecule/questions/free-text/index.native.js +8 -8
- package/es/molecule/questions/free-text/index.native.js.map +1 -1
- package/es/molecule/questions/mobile/template/index.native.js +222 -0
- package/es/molecule/questions/mobile/template/index.native.js.map +1 -0
- package/es/template/app-review/template-context.js +1 -0
- package/es/template/app-review/template-context.js.map +1 -1
- package/es/template/common/dashboard/index.js +6 -3
- package/es/template/common/dashboard/index.js.map +1 -1
- package/es/types/app-review.d.js +2 -0
- package/es/types/app-review.d.js.map +1 -0
- package/es/types/translations.js +2 -0
- package/es/types/translations.js.map +1 -0
- package/es/util/build-query-string.js +9 -0
- package/es/util/build-query-string.js.map +1 -0
- package/es/util/get-clean-uri.js +4 -0
- package/es/util/get-clean-uri.js.map +1 -0
- package/es/util/get-resized-image.js +39 -0
- package/es/util/get-resized-image.js.map +1 -0
- package/es/util/parse-template-string.js +4 -2
- package/es/util/parse-template-string.js.map +1 -1
- package/es/variables/colors.css +1 -0
- package/es/variables/theme.native.js.map +1 -1
- package/lib/atom/choice/index.native.js +150 -0
- package/lib/atom/choice/index.native.js.map +1 -0
- package/lib/atom/gradient/index.native.js +56 -0
- package/lib/atom/gradient/index.native.js.map +1 -0
- package/lib/atom/html/index.native.js +8 -15
- package/lib/atom/html/index.native.js.map +1 -1
- package/lib/atom/image-background/index.native.js +105 -0
- package/lib/atom/image-background/index.native.js.map +1 -0
- package/lib/atom/input-switch/index.js +43 -6
- package/lib/atom/input-switch/index.js.map +1 -1
- package/lib/atom/input-switch/style.css +56 -6
- package/lib/atom/select-modal/index.native.js +5 -5
- package/lib/atom/select-modal/index.native.js.map +1 -1
- package/lib/atom/text/index.native.js +3 -1
- package/lib/atom/text/index.native.js.map +1 -1
- package/lib/hoc/modal/select/index.native.js +7 -5
- package/lib/hoc/modal/select/index.native.js.map +1 -1
- package/lib/molecule/answer/index.js +39 -32
- package/lib/molecule/answer/index.js.map +1 -1
- package/lib/molecule/cm-popin/index.js +102 -13
- package/lib/molecule/cm-popin/index.js.map +1 -1
- package/lib/molecule/cm-popin/style.css +153 -9
- package/lib/molecule/questions/free-text/index.native.js +7 -7
- package/lib/molecule/questions/free-text/index.native.js.map +1 -1
- package/lib/molecule/questions/mobile/template/index.native.js +243 -0
- package/lib/molecule/questions/mobile/template/index.native.js.map +1 -0
- package/lib/template/app-review/template-context.js +1 -0
- package/lib/template/app-review/template-context.js.map +1 -1
- package/lib/template/common/dashboard/index.js +7 -3
- package/lib/template/common/dashboard/index.js.map +1 -1
- package/lib/types/app-review.d.js +2 -0
- package/lib/types/app-review.d.js.map +1 -0
- package/lib/types/translations.js +2 -0
- package/lib/types/translations.js.map +1 -0
- package/lib/util/build-query-string.js +17 -0
- package/lib/util/build-query-string.js.map +1 -0
- package/lib/util/get-clean-uri.js +10 -0
- package/lib/util/get-clean-uri.js.map +1 -0
- package/lib/util/get-resized-image.js +49 -0
- package/lib/util/get-resized-image.js.map +1 -0
- package/lib/util/parse-template-string.js +4 -2
- package/lib/util/parse-template-string.js.map +1 -1
- package/lib/variables/colors.css +1 -0
- package/lib/variables/theme.native.js.map +1 -1
- package/package.json +5 -3
|
@@ -15,6 +15,13 @@
|
|
|
15
15
|
@value cm_grey_200 from colors;
|
|
16
16
|
@value cm_blue_600 from colors;
|
|
17
17
|
@value cm_grey_500 from colors;
|
|
18
|
+
@value cm_grey_700 from colors;
|
|
19
|
+
@value white from colors;
|
|
20
|
+
@value cm_blue_50 from colors;
|
|
21
|
+
@value breakpoints: '../../variables/breakpoints.css';
|
|
22
|
+
@value mobile from breakpoints;
|
|
23
|
+
@value tablet from breakpoints;
|
|
24
|
+
@value cm_grey_75 from colors;
|
|
18
25
|
|
|
19
26
|
.background {
|
|
20
27
|
top: 0px;
|
|
@@ -28,7 +35,7 @@
|
|
|
28
35
|
box-sizing: border-box;
|
|
29
36
|
overflow: hidden;
|
|
30
37
|
display: flex;
|
|
31
|
-
position:fixed;
|
|
38
|
+
position: fixed;
|
|
32
39
|
z-index: 3;
|
|
33
40
|
}
|
|
34
41
|
|
|
@@ -60,7 +67,6 @@
|
|
|
60
67
|
justify-content: center;
|
|
61
68
|
align-items: center;
|
|
62
69
|
padding: 40px 40px 0px;
|
|
63
|
-
position: absolute;
|
|
64
70
|
background: xtraLightGrey;
|
|
65
71
|
font-family: 'Gilroy';
|
|
66
72
|
font-weight: 500;
|
|
@@ -72,10 +78,10 @@
|
|
|
72
78
|
margin: 10px 0px;
|
|
73
79
|
}
|
|
74
80
|
@keyframes popup {
|
|
75
|
-
0%{
|
|
81
|
+
0% {
|
|
76
82
|
transform: scale(0);
|
|
77
83
|
}
|
|
78
|
-
100%{
|
|
84
|
+
100% {
|
|
79
85
|
transform: scale(1);
|
|
80
86
|
}
|
|
81
87
|
}
|
|
@@ -85,7 +91,6 @@
|
|
|
85
91
|
flex-direction: column;
|
|
86
92
|
align-items: center;
|
|
87
93
|
justify-content: center;
|
|
88
|
-
width: 65%;
|
|
89
94
|
}
|
|
90
95
|
|
|
91
96
|
.content {
|
|
@@ -101,9 +106,9 @@
|
|
|
101
106
|
}
|
|
102
107
|
|
|
103
108
|
.buttonContainer {
|
|
104
|
-
|
|
105
|
-
height: 80px;
|
|
109
|
+
min-height: 80px;
|
|
106
110
|
display: flex;
|
|
111
|
+
width: 100%;
|
|
107
112
|
align-items: center;
|
|
108
113
|
justify-content: center;
|
|
109
114
|
}
|
|
@@ -114,7 +119,7 @@
|
|
|
114
119
|
}
|
|
115
120
|
|
|
116
121
|
.largeButton {
|
|
117
|
-
width:
|
|
122
|
+
width: 100%;
|
|
118
123
|
padding: 8px;
|
|
119
124
|
}
|
|
120
125
|
|
|
@@ -149,4 +154,143 @@
|
|
|
149
154
|
display: flex;
|
|
150
155
|
flex-direction: column;
|
|
151
156
|
width: 100%;
|
|
152
|
-
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.cookieHeader {
|
|
160
|
+
width: 100%;
|
|
161
|
+
background-color: cm_grey_700;
|
|
162
|
+
padding: 16px 24px;
|
|
163
|
+
border-radius: 10px 10px 0px 0px;
|
|
164
|
+
display: flex;
|
|
165
|
+
align-items: center;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.popinCookie {
|
|
169
|
+
max-width: 550px;
|
|
170
|
+
flex-grow: 0;
|
|
171
|
+
margin: 16px;
|
|
172
|
+
border-radius: 10px;
|
|
173
|
+
background-color: cm_grey_50;
|
|
174
|
+
animation: popup 0.7s;
|
|
175
|
+
position: fixed;
|
|
176
|
+
bottom: 32px;
|
|
177
|
+
left: 32px;
|
|
178
|
+
z-index: 2;
|
|
179
|
+
}
|
|
180
|
+
.cookieTitle {
|
|
181
|
+
font-family: "Gilroy";
|
|
182
|
+
font-style: normal;
|
|
183
|
+
font-weight: 700;
|
|
184
|
+
font-size: 24px;
|
|
185
|
+
line-height: 32px;
|
|
186
|
+
color: white;
|
|
187
|
+
padding-left: 16px;
|
|
188
|
+
width: 60%;
|
|
189
|
+
}
|
|
190
|
+
.cookieIcon {
|
|
191
|
+
height: 20px;
|
|
192
|
+
width: 20px;
|
|
193
|
+
}
|
|
194
|
+
.cookieIconContainer {
|
|
195
|
+
width: 39px;
|
|
196
|
+
height: 39px;
|
|
197
|
+
border-radius: 8px;
|
|
198
|
+
background-color: cm_blue_50;
|
|
199
|
+
display: flex;
|
|
200
|
+
justify-content: center;
|
|
201
|
+
align-items: center;
|
|
202
|
+
}
|
|
203
|
+
.popinCookie .button {
|
|
204
|
+
width: 100%;
|
|
205
|
+
padding: 0px 8px 0px 0px
|
|
206
|
+
}
|
|
207
|
+
.popinCookie .button span {
|
|
208
|
+
margin: 0
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.popinCookie .message {
|
|
212
|
+
padding: 24px 24px 40px 24px
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.descriptionBtn {
|
|
216
|
+
font-family: "Gilroy";
|
|
217
|
+
font-weight: 500;
|
|
218
|
+
font-size: 16px;
|
|
219
|
+
line-height: 22px;
|
|
220
|
+
color: cm_grey_500;
|
|
221
|
+
font-style: normal;
|
|
222
|
+
white-space: pre-line;
|
|
223
|
+
margin-top: 24px;
|
|
224
|
+
width: calc(100% - 24px);
|
|
225
|
+
padding-left: 24px;
|
|
226
|
+
margin-bottom: 24px;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
.firstBtnSwitchContainer {
|
|
231
|
+
height: 56px;
|
|
232
|
+
background-color: cm_grey_75;
|
|
233
|
+
width: 100%;
|
|
234
|
+
display: flex;
|
|
235
|
+
align-items: center;
|
|
236
|
+
}
|
|
237
|
+
.firstBtnSwitchContainer div:first-child {
|
|
238
|
+
margin-left: 9px;
|
|
239
|
+
}
|
|
240
|
+
.singleSwitchContainer div:first-child {
|
|
241
|
+
margin-left: 9px;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.lastBtnSwitchContainer {
|
|
245
|
+
composes: singleSwitchContainer;
|
|
246
|
+
margin-bottom: 28px;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.singleSwitchContainer {
|
|
250
|
+
width: 100%;
|
|
251
|
+
display: flex;
|
|
252
|
+
align-items: center;
|
|
253
|
+
width: 100%;
|
|
254
|
+
margin-top: 24px;
|
|
255
|
+
}
|
|
256
|
+
a {
|
|
257
|
+
color: cm_primary_blue;
|
|
258
|
+
text-decoration: none;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.popinCookie .buttonContainer {
|
|
262
|
+
min-height: 44px;
|
|
263
|
+
padding-bottom: 16px;
|
|
264
|
+
width: auto;
|
|
265
|
+
padding-left: 24px;
|
|
266
|
+
padding-right: 16px;
|
|
267
|
+
}
|
|
268
|
+
.popinCookie .largeButton {
|
|
269
|
+
padding: 0px 8px 0px 0px
|
|
270
|
+
}
|
|
271
|
+
@media tablet {
|
|
272
|
+
.popinCookie {
|
|
273
|
+
position: fixed;
|
|
274
|
+
bottom: 10px;
|
|
275
|
+
left: unset;
|
|
276
|
+
align-self: center;
|
|
277
|
+
max-height: calc(100vh - 50px);
|
|
278
|
+
overflow-x: hidden;
|
|
279
|
+
overflow-y: auto;
|
|
280
|
+
}
|
|
281
|
+
.popinCookie .button{
|
|
282
|
+
width: 100%;
|
|
283
|
+
padding: 0px 0px 8px 0px
|
|
284
|
+
}
|
|
285
|
+
.buttonContainer {
|
|
286
|
+
flex-wrap: wrap;
|
|
287
|
+
margin-top: 40px;
|
|
288
|
+
}
|
|
289
|
+
.popinCookie .largeButton {
|
|
290
|
+
padding: 8px 0px 0px 0px
|
|
291
|
+
}
|
|
292
|
+
.popinCookie .message {
|
|
293
|
+
padding: 24px 24px 0px 24px
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { View, StyleSheet, TextInput } from 'react-native';
|
|
2
|
-
import React, { useState, useEffect,
|
|
2
|
+
import React, { useState, useEffect, useCallback } from 'react';
|
|
3
3
|
import { useTemplateContext } from '../../../template/app-review/template-context';
|
|
4
4
|
import { ANALYTICS_EVENT_TYPE } from '../../../variables/analytics';
|
|
5
5
|
|
|
@@ -39,23 +39,23 @@ const FreeText = props => {
|
|
|
39
39
|
const [styleSheet, setStylesheet] = useState(null);
|
|
40
40
|
const {
|
|
41
41
|
brandTheme,
|
|
42
|
-
theme
|
|
42
|
+
theme,
|
|
43
|
+
translations
|
|
43
44
|
} = templateContext;
|
|
44
45
|
const PLACEHOLDER_COLOR = theme.colors.gray.medium; // ------------------------------------
|
|
45
46
|
|
|
46
47
|
const {
|
|
47
48
|
analytics,
|
|
48
49
|
questionType,
|
|
49
|
-
fullWitdh,
|
|
50
|
+
fullWitdh = false,
|
|
50
51
|
testID,
|
|
51
52
|
onChange,
|
|
52
53
|
isDisabled,
|
|
53
|
-
value
|
|
54
|
-
placeholder
|
|
54
|
+
value
|
|
55
55
|
} = props; // ------------------------------------
|
|
56
56
|
|
|
57
|
-
const handleFocus =
|
|
58
|
-
const handleBlur =
|
|
57
|
+
const handleFocus = useCallback(() => analytics && logEvent(ANALYTICS_EVENT_TYPE.INPUT_FOCUS, analytics, questionType), [analytics, questionType]);
|
|
58
|
+
const handleBlur = useCallback(() => analytics && logEvent(ANALYTICS_EVENT_TYPE.INPUT_BLUR, analytics, questionType), [analytics, questionType]); // ------------------------------------
|
|
59
59
|
|
|
60
60
|
useEffect(() => {
|
|
61
61
|
const _stylesheet = createStyleSheet(brandTheme, theme);
|
|
@@ -74,7 +74,7 @@ const FreeText = props => {
|
|
|
74
74
|
onFocus: handleFocus,
|
|
75
75
|
onBlur: handleBlur,
|
|
76
76
|
onChangeText: onChange,
|
|
77
|
-
placeholder:
|
|
77
|
+
placeholder: translations.typeHere,
|
|
78
78
|
placeholderTextColor: PLACEHOLDER_COLOR,
|
|
79
79
|
value: value,
|
|
80
80
|
testID: testID,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/molecule/questions/free-text/index.native.tsx"],"names":["View","StyleSheet","TextInput","React","useState","useEffect","
|
|
1
|
+
{"version":3,"sources":["../../../../src/molecule/questions/free-text/index.native.tsx"],"names":["View","StyleSheet","TextInput","React","useState","useEffect","useCallback","useTemplateContext","ANALYTICS_EVENT_TYPE","createStyleSheet","brandTheme","theme","create","input","padding","spacing","tiny","borderWidth","borderColor","colors","gray","lightMedium","borderRadius","radius","common","backgroundColor","white","minWidth","text","primary","color","medium","fontWeight","bold","fontSize","regular","textAlign","spaced","paddingVertical","fullWitdh","width","logEvent","eventName","analytics","questionType","id","FreeText","props","templateContext","styleSheet","setStylesheet","translations","PLACEHOLDER_COLOR","testID","onChange","isDisabled","value","handleFocus","INPUT_FOCUS","handleBlur","INPUT_BLUR","_stylesheet","typeHere"],"mappings":"AAAA,SAAQA,IAAR,EAAcC,UAAd,EAA0BC,SAA1B,QAA0C,cAA1C;AACA,OAAOC,KAAP,IAAeC,QAAf,EAAyBC,SAAzB,EAAoCC,WAApC,QAAsD,OAAtD;AACA,SAAQC,kBAAR,QAAiC,+CAAjC;AACA,SAAQC,oBAAR,QAA8C,8BAA9C;;AAiDA,MAAMC,gBAAgB,GAAG,CAACC,UAAD,EAAaC,KAAb,KACvBV,UAAU,CAACW,MAAX,CAAkB;AAChBC,EAAAA,KAAK,EAAE;AACLC,IAAAA,OAAO,EAAEH,KAAK,CAACI,OAAN,CAAcC,IADlB;AAELC,IAAAA,WAAW,EAAE,CAFR;AAGLC,IAAAA,WAAW,EAAEP,KAAK,CAACQ,MAAN,CAAaC,IAAb,CAAkBC,WAH1B;AAILC,IAAAA,YAAY,EAAEX,KAAK,CAACY,MAAN,CAAaC,MAJtB;AAKLC,IAAAA,eAAe,EAAEd,KAAK,CAACQ,MAAN,CAAaO,KALzB;AAMLC,IAAAA,QAAQ,EAAE;AANL,GADS;AAShBC,EAAAA,IAAI,EAAE;AACJV,IAAAA,WAAW,EA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AVtB,IADF,CADF;AAgBD,CAnDD;;AAqDA,eAAeT,QAAf","sourcesContent":["import {View, StyleSheet, TextInput} from 'react-native';\nimport React, {useState, useEffect, useCallback} from 'react';\nimport {useTemplateContext} from '../../../template/app-review/template-context';\nimport {ANALYTICS_EVENT_TYPE, Analytics} from '../../../variables/analytics';\n\ntype QuestionType = 'basic' | 'template';\n\ninterface Props {\n fullWitdh?: boolean;\n testID: string;\n questionType: QuestionType;\n analytics?: Analytics;\n onChange: (text: string) => void;\n isDisabled: boolean;\n value: string;\n}\n\ntype StyleSheetType = {\n input: {\n padding: string;\n borderWidth: number;\n borderColor: string;\n borderRadius: number;\n backgroundColor: string;\n minWidth: number;\n };\n text: {\n color: string;\n fontWeight:\n | 'normal'\n | 'bold'\n | '100'\n | '200'\n | '300'\n | '400'\n | '500'\n | '600'\n | '700'\n | '800'\n | '900'\n | undefined;\n fontSize: number;\n textAlign: 'auto' | 'left' | 'right' | 'center' | 'justify' | undefined;\n };\n spaced: {\n paddingVertical: number;\n };\n fullWitdh: {\n width: string;\n };\n};\n\nconst createStyleSheet = (brandTheme, theme) =>\n StyleSheet.create({\n input: {\n padding: theme.spacing.tiny,\n borderWidth: 1,\n borderColor: theme.colors.gray.lightMedium,\n borderRadius: theme.radius.common,\n backgroundColor: theme.colors.white,\n minWidth: 175\n },\n text: {\n borderColor: brandTheme?.colors.primary,\n color: brandTheme?.colors.primary || theme.colors.gray.medium,\n fontWeight: theme.fontWeight.bold,\n fontSize: theme.fontSize.regular,\n textAlign: 'center'\n },\n spaced: {\n paddingVertical: theme.spacing.tiny\n },\n fullWitdh: {\n width: '100%'\n }\n });\n\nconst logEvent = (eventName: string, analytics: Analytics, questionType: QuestionType) => {\n analytics &&\n analytics.logEvent(eventName, {\n id: `question-input-text`,\n questionType\n });\n};\n\nconst FreeText = (props: Props) => {\n const templateContext = useTemplateContext();\n const [styleSheet, setStylesheet] = useState<StyleSheetType | null>(null);\n const {brandTheme, theme, translations} = templateContext;\n const PLACEHOLDER_COLOR = theme.colors.gray.medium;\n\n // ------------------------------------\n\n const {analytics, questionType, fullWitdh = false, testID, onChange, isDisabled, value} = props;\n\n // ------------------------------------\n\n const handleFocus = useCallback(\n () => analytics && logEvent(ANALYTICS_EVENT_TYPE.INPUT_FOCUS, analytics, questionType),\n [analytics, questionType]\n );\n\n const handleBlur = useCallback(\n () => analytics && logEvent(ANALYTICS_EVENT_TYPE.INPUT_BLUR, analytics, questionType),\n [analytics, questionType]\n );\n\n // ------------------------------------\n\n useEffect(() => {\n const _stylesheet = createStyleSheet(brandTheme, theme);\n setStylesheet(_stylesheet);\n }, [brandTheme, theme]);\n\n // ------------------------------------\n\n if (!styleSheet) {\n return null;\n }\n\n return (\n <View style={[styleSheet.spaced, fullWitdh && styleSheet.fullWitdh]}>\n <TextInput\n style={[styleSheet.input, styleSheet.text]}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onChangeText={onChange}\n placeholder={translations.typeHere}\n placeholderTextColor={PLACEHOLDER_COLOR}\n value={value}\n testID={testID}\n editable={!isDisabled}\n selectTextOnFocus={!isDisabled}\n />\n </View>\n );\n};\n\nexport default FreeText;\n"],"file":"index.native.js"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import trim from 'lodash/fp/trim';
|
|
4
|
+
import last from 'lodash/fp/last';
|
|
5
|
+
import Html from '../../../../atom/html/index.native';
|
|
6
|
+
import Select from '../../../../atom/select-modal/index.native';
|
|
7
|
+
import Space from '../../../../atom/space/index.native';
|
|
8
|
+
import FreeText from '../../free-text/index.native';
|
|
9
|
+
import { useTemplateContext } from '../../../../template/app-review/template-context';
|
|
10
|
+
import parseTemplateString from '../../../../util/parse-template-string';
|
|
11
|
+
|
|
12
|
+
const createStyleSheet = theme => ({
|
|
13
|
+
section: {
|
|
14
|
+
width: '100%',
|
|
15
|
+
flexDirection: 'row',
|
|
16
|
+
flexWrap: 'wrap',
|
|
17
|
+
justifyContent: 'center',
|
|
18
|
+
alignItems: 'center'
|
|
19
|
+
},
|
|
20
|
+
spaced: {
|
|
21
|
+
paddingVertical: theme.spacing.tiny
|
|
22
|
+
},
|
|
23
|
+
input: {
|
|
24
|
+
padding: theme.spacing.tiny,
|
|
25
|
+
borderWidth: 1,
|
|
26
|
+
borderColor: theme.colors.gray.lightMedium,
|
|
27
|
+
borderRadius: theme.radius.common,
|
|
28
|
+
backgroundColor: theme.colors.white,
|
|
29
|
+
minWidth: 175
|
|
30
|
+
},
|
|
31
|
+
htmlText: {
|
|
32
|
+
padding: theme.spacing.tiny,
|
|
33
|
+
color: theme.colors.black,
|
|
34
|
+
fontWeight: theme.fontWeight.bold,
|
|
35
|
+
lineHeight: 30
|
|
36
|
+
},
|
|
37
|
+
text: {
|
|
38
|
+
color: theme.colors.gray.medium,
|
|
39
|
+
fontWeight: theme.fontWeight.bold,
|
|
40
|
+
fontSize: theme.fontSize.regular,
|
|
41
|
+
textAlign: 'center'
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const Section = ({
|
|
46
|
+
section,
|
|
47
|
+
items,
|
|
48
|
+
index,
|
|
49
|
+
focusedSelectId,
|
|
50
|
+
onInputChange,
|
|
51
|
+
userChoices,
|
|
52
|
+
handleBlur,
|
|
53
|
+
handleFocus,
|
|
54
|
+
isDisabled,
|
|
55
|
+
styles
|
|
56
|
+
}) => {
|
|
57
|
+
const prefix = `question-section-${index + 1}`;
|
|
58
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
59
|
+
style: styles.section,
|
|
60
|
+
key: `container-${prefix}`
|
|
61
|
+
}, section.map((part, id) => {
|
|
62
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
63
|
+
key: `${prefix}-${id}`,
|
|
64
|
+
style: {
|
|
65
|
+
flexDirection: 'row'
|
|
66
|
+
}
|
|
67
|
+
}, /*#__PURE__*/React.createElement(Item, {
|
|
68
|
+
prefix: prefix,
|
|
69
|
+
part: part,
|
|
70
|
+
items: items,
|
|
71
|
+
index: id,
|
|
72
|
+
focusedSelectId: focusedSelectId,
|
|
73
|
+
isDisabled: isDisabled,
|
|
74
|
+
userChoices: userChoices,
|
|
75
|
+
handleBlur: handleBlur,
|
|
76
|
+
handleFocus: handleFocus,
|
|
77
|
+
onInputChange: onInputChange,
|
|
78
|
+
styles: styles
|
|
79
|
+
}), /*#__PURE__*/React.createElement(Space, {
|
|
80
|
+
type: "micro"
|
|
81
|
+
}));
|
|
82
|
+
}));
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const Item = props => {
|
|
86
|
+
const {
|
|
87
|
+
part,
|
|
88
|
+
index,
|
|
89
|
+
prefix,
|
|
90
|
+
isDisabled = false,
|
|
91
|
+
focusedSelectId,
|
|
92
|
+
items,
|
|
93
|
+
userChoices,
|
|
94
|
+
onInputChange,
|
|
95
|
+
handleBlur,
|
|
96
|
+
handleFocus,
|
|
97
|
+
styles
|
|
98
|
+
} = props;
|
|
99
|
+
const templateContext = useTemplateContext();
|
|
100
|
+
const {
|
|
101
|
+
theme,
|
|
102
|
+
brandTheme,
|
|
103
|
+
translations
|
|
104
|
+
} = templateContext;
|
|
105
|
+
const inputNames = items.map(item => item.name);
|
|
106
|
+
const id = `${prefix}-part-${index + 1}`;
|
|
107
|
+
const isFocused = focusedSelectId === id;
|
|
108
|
+
const selectedStyle = brandTheme && {
|
|
109
|
+
borderColor: brandTheme.colors.primary,
|
|
110
|
+
color: brandTheme.colors.primary
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
if (part.type === 'answerField' && inputNames.includes(part.value)) {
|
|
114
|
+
const itemIndex = items.findIndex(_item => _item.name === part.value);
|
|
115
|
+
const item = items[itemIndex];
|
|
116
|
+
const value = userChoices[itemIndex];
|
|
117
|
+
|
|
118
|
+
if (!item || !item.type || !item.name) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const disabledSuffix = isDisabled ? '-disabled' : '';
|
|
123
|
+
const selectedSuffix = value ? '-selected' : '';
|
|
124
|
+
|
|
125
|
+
const handleInputChange = _item => _value => onInputChange(_item, _value);
|
|
126
|
+
|
|
127
|
+
if (item.type === 'text') {
|
|
128
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
129
|
+
style: styles.spaced,
|
|
130
|
+
testID: id
|
|
131
|
+
}, /*#__PURE__*/React.createElement(FreeText, {
|
|
132
|
+
key: id,
|
|
133
|
+
isDisabled: isDisabled,
|
|
134
|
+
onChange: handleInputChange(item),
|
|
135
|
+
value: value,
|
|
136
|
+
testID: `${id}-text${selectedSuffix}${disabledSuffix}`,
|
|
137
|
+
questionType: "template"
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (item.type === 'select') {
|
|
142
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
143
|
+
style: styles.spaced,
|
|
144
|
+
testID: id
|
|
145
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
146
|
+
isDisabled: isDisabled,
|
|
147
|
+
questionType: "template",
|
|
148
|
+
values: item.items,
|
|
149
|
+
value: value,
|
|
150
|
+
placeholder: translations.selectAnAnswer,
|
|
151
|
+
isFocused: isFocused,
|
|
152
|
+
onBlur: handleBlur,
|
|
153
|
+
onFocus: handleFocus(id),
|
|
154
|
+
onChange: handleInputChange(item),
|
|
155
|
+
textStyle: styles.text,
|
|
156
|
+
style: [styles.input, value && selectedStyle],
|
|
157
|
+
testID: `${id}-select${selectedSuffix}${disabledSuffix}`
|
|
158
|
+
}));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return /*#__PURE__*/React.createElement(Html, {
|
|
163
|
+
key: id,
|
|
164
|
+
fontSize: theme.fontSize.regular,
|
|
165
|
+
testID: id,
|
|
166
|
+
style: styles.htmlText
|
|
167
|
+
}, trim(part.value || ''));
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const QuestionTemplate = props => {
|
|
171
|
+
const {
|
|
172
|
+
template,
|
|
173
|
+
onInputChange,
|
|
174
|
+
userChoices,
|
|
175
|
+
items,
|
|
176
|
+
handleBlur,
|
|
177
|
+
handleFocus,
|
|
178
|
+
focusedSelectId,
|
|
179
|
+
isDisabled = false
|
|
180
|
+
} = props;
|
|
181
|
+
const templateContext = useTemplateContext();
|
|
182
|
+
const {
|
|
183
|
+
theme
|
|
184
|
+
} = templateContext;
|
|
185
|
+
const [styleSheet, setStylesheet] = useState(null);
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
const _stylesheet = createStyleSheet(theme);
|
|
188
|
+
|
|
189
|
+
setStylesheet(_stylesheet);
|
|
190
|
+
}, [theme]);
|
|
191
|
+
|
|
192
|
+
if (!template || !styleSheet) {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const parts = parseTemplateString(template);
|
|
197
|
+
const sections = parts.reduce((result, item) => {
|
|
198
|
+
const section = last(result) || [];
|
|
199
|
+
return result.slice(0, -1).concat([section.concat([item])]);
|
|
200
|
+
}, []);
|
|
201
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
202
|
+
style: {
|
|
203
|
+
flex: 1
|
|
204
|
+
},
|
|
205
|
+
testID: "question-template"
|
|
206
|
+
}, sections.map((section, index) => /*#__PURE__*/React.createElement(Section, {
|
|
207
|
+
key: index,
|
|
208
|
+
section: section,
|
|
209
|
+
items: items,
|
|
210
|
+
index: index,
|
|
211
|
+
handleBlur: handleBlur,
|
|
212
|
+
handleFocus: handleFocus,
|
|
213
|
+
focusedSelectId: focusedSelectId,
|
|
214
|
+
onInputChange: onInputChange,
|
|
215
|
+
userChoices: userChoices,
|
|
216
|
+
isDisabled: isDisabled,
|
|
217
|
+
styles: styleSheet
|
|
218
|
+
})));
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
export default QuestionTemplate;
|
|
222
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/molecule/questions/mobile/template/index.native.tsx"],"names":["React","useEffect","useState","View","trim","last","Html","Select","Space","FreeText","useTemplateContext","parseTemplateString","createStyleSheet","theme","section","width","flexDirection","flexWrap","justifyContent","alignItems","spaced","paddingVertical","spacing","tiny","input","padding","borderWidth","borderColor","colors","gray","lightMedium","borderRadius","radius","common","backgroundColor","white","minWidth","htmlText","color","black","fontWeight","bold","lineHeight","text","medium","fontSize","regular","textAlign","Section","items","index","focusedSelectId","onInputChange","userChoices","handleBlur","handleFocus","isDisabled","styles","prefix","map","part","id","Item","props","templateContext","brandTheme","translations","inputNames","item","name","isFocused","selectedStyle","primary","type","includes","value","itemIndex","findIndex","_item","disabledSuffix","selectedSuffix","handleInputChange","_value","selectAnAnswer","QuestionTemplate","template","styleSheet","setStylesheet","_stylesheet","parts","sections","reduce","result","slice","concat","flex"],"mappings":"AAAA,OAAOA,KAAP,IAAeC,SAAf,EAA0BC,QAA1B,QAAyC,OAAzC;AACA,SAAQC,IAAR,QAAmB,cAAnB;AAEA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AAEA,OAAOC,IAAP,MAAiB,oCAAjB;AACA,OAAOC,MAAP,MAAmB,4CAAnB;AACA,OAAOC,KAAP,MAAkB,qCAAlB;AAGA,OAAOC,QAAP,MAAqB,8BAArB;AACA,SAAQC,kBAAR,QAAiC,kDAAjC;AAEA,OAAOC,mBAAP,MAAgC,wCAAhC;;AAEA,MAAMC,gBAAgB,GAAIC,KAAD,KAAmB;AAC1CC,EAAAA,OAAO,EAAE;AACPC,IAAAA,KAAK,EAAE,MADA;AAEPC,IAAAA,aAAa,EAAE,KAFR;AAGPC,IAAAA,QAAQ,EAAE,MAHH;AAIPC,IAAAA,cAAc,EAAE,QAJT;AAKPC,IAAAA,UAAU,EAAE;AALL,GADiC;AAQ1CC,EAAAA,MAAM,EAAE;AACNC,IAAAA,eAAe,EAAER,KAAK,CAACS,OAAN,CAAcC;AADzB,G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C,OAAD,EAAUoC,KAAV,kBACZ,oBAAC,OAAD;AACE,IAAA,GAAG,EAAEA,KADP;AAEE,IAAA,OAAO,EAAEpC,OAFX;AAGE,IAAA,KAAK,EAAEmC,KAHT;AAIE,IAAA,KAAK,EAAEC,KAJT;AAKE,IAAA,UAAU,EAAEI,UALd;AAME,IAAA,WAAW,EAAEC,WANf;AAOE,IAAA,eAAe,EAAEJ,eAPnB;AAQE,IAAA,aAAa,EAAEC,aARjB;AASE,IAAA,WAAW,EAAEC,WATf;AAUE,IAAA,UAAU,EAAEG,UAVd;AAWE,IAAA,MAAM,EAAE8B;AAXV,IADD,CADH,CADF;AAmBD,CApDD;;AAsDA,eAAeF,gBAAf","sourcesContent":["import React, {useEffect, useState} from 'react';\nimport {View} from 'react-native';\n\nimport trim from 'lodash/fp/trim';\nimport last from 'lodash/fp/last';\n\nimport Html from '../../../../atom/html/index.native';\nimport Select from '../../../../atom/select-modal/index.native';\nimport Space from '../../../../atom/space/index.native';\nimport {FocusedSelectId, HandleBlur, HandleFocus} from '../../../../types/app-review.d';\nimport type {Choice} from '../../../../types/progression-engine.d';\nimport FreeText from '../../free-text/index.native';\nimport {useTemplateContext} from '../../../../template/app-review/template-context';\nimport {Theme} from '../../../../variables/theme.native';\nimport parseTemplateString from '../../../../util/parse-template-string';\n\nconst createStyleSheet = (theme: Theme) => ({\n section: {\n width: '100%',\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'center',\n alignItems: 'center'\n },\n spaced: {\n paddingVertical: theme.spacing.tiny\n },\n input: {\n padding: theme.spacing.tiny,\n borderWidth: 1,\n borderColor: theme.colors.gray.lightMedium,\n borderRadius: theme.radius.common,\n backgroundColor: theme.colors.white,\n minWidth: 175\n },\n htmlText: {\n padding: theme.spacing.tiny,\n color: theme.colors.black,\n fontWeight: theme.fontWeight.bold,\n lineHeight: 30\n },\n text: {\n color: theme.colors.gray.medium,\n fontWeight: theme.fontWeight.bold,\n fontSize: theme.fontSize.regular,\n textAlign: 'center'\n }\n});\n\ntype TemplatePart = {\n type: 'string' | 'answerField';\n value: string;\n};\n\ntype SectionProps = {\n isDisabled: boolean;\n userChoices: Array<string>;\n section: Array<TemplatePart>;\n items: Array<Choice>;\n index: number;\n onInputChange: (item: Choice, value: string) => void;\n focusedSelectId: FocusedSelectId;\n handleBlur: HandleBlur;\n handleFocus: HandleFocus;\n styles: any;\n};\n\nconst Section = ({\n section,\n items,\n index,\n focusedSelectId,\n onInputChange,\n userChoices,\n handleBlur,\n handleFocus,\n isDisabled,\n styles\n}: SectionProps) => {\n const prefix = `question-section-${index + 1}`;\n\n return (\n <View style={styles.section} key={`container-${prefix}`}>\n {section.map((part, id) => {\n return (\n <View key={`${prefix}-${id}`} style={{flexDirection: 'row'}}>\n <Item\n prefix={prefix}\n part={part}\n items={items}\n index={id}\n focusedSelectId={focusedSelectId}\n isDisabled={isDisabled}\n userChoices={userChoices}\n handleBlur={handleBlur}\n handleFocus={handleFocus}\n onInputChange={onInputChange}\n styles={styles}\n />\n <Space type=\"micro\" />\n </View>\n );\n })}\n </View>\n );\n};\n\ntype ItemProps = {\n part: TemplatePart;\n items: Array<Choice>;\n index: number;\n prefix: string;\n isDisabled?: boolean;\n userChoices: Array<string>;\n onInputChange: (item: Choice, value: string) => void;\n focusedSelectId: FocusedSelectId;\n handleBlur: HandleBlur;\n handleFocus: HandleFocus;\n styles: any;\n};\n\nconst Item = (props: ItemProps) => {\n const {\n part,\n index,\n prefix,\n isDisabled = false,\n focusedSelectId,\n items,\n userChoices,\n onInputChange,\n handleBlur,\n handleFocus,\n styles\n } = props;\n\n const templateContext = useTemplateContext();\n const {theme, brandTheme, translations} = templateContext;\n\n const inputNames = items.map(item => item.name);\n const id = `${prefix}-part-${index + 1}`;\n const isFocused = focusedSelectId === id;\n\n const selectedStyle = brandTheme && {\n borderColor: brandTheme.colors.primary,\n color: brandTheme.colors.primary\n };\n\n if (part.type === 'answerField' && inputNames.includes(part.value)) {\n const itemIndex = items.findIndex(_item => _item.name === part.value);\n const item = items[itemIndex];\n const value = userChoices[itemIndex];\n\n if (!item || !item.type || !item.name) {\n return null;\n }\n\n const disabledSuffix = isDisabled ? '-disabled' : '';\n const selectedSuffix = value ? '-selected' : '';\n\n const handleInputChange = (_item: Choice) => (_value: string) => onInputChange(_item, _value);\n\n if (item.type === 'text') {\n return (\n <View style={styles.spaced} testID={id}>\n <FreeText\n key={id}\n isDisabled={isDisabled}\n onChange={handleInputChange(item)}\n value={value}\n testID={`${id}-text${selectedSuffix}${disabledSuffix}`}\n questionType=\"template\"\n />\n </View>\n );\n }\n\n if (item.type === 'select') {\n return (\n <View style={styles.spaced} testID={id}>\n <Select\n isDisabled={isDisabled}\n questionType=\"template\"\n values={item.items}\n value={value}\n placeholder={translations.selectAnAnswer}\n isFocused={isFocused}\n onBlur={handleBlur}\n onFocus={handleFocus(id)}\n onChange={handleInputChange(item)}\n textStyle={styles.text}\n style={[styles.input, value && selectedStyle]}\n testID={`${id}-select${selectedSuffix}${disabledSuffix}`}\n />\n </View>\n );\n }\n }\n\n return (\n <Html key={id} fontSize={theme.fontSize.regular} testID={id} style={styles.htmlText}>\n {trim(part.value || '')}\n </Html>\n );\n};\n\nexport type Props = {\n isDisabled?: boolean;\n template: string;\n items: Array<Choice>;\n userChoices: Array<string>;\n onInputChange: (item: Choice, value: string) => void;\n focusedSelectId: FocusedSelectId;\n handleBlur: HandleBlur;\n handleFocus: HandleFocus;\n};\n\nconst QuestionTemplate = (props: Props) => {\n const {\n template,\n onInputChange,\n userChoices,\n items,\n handleBlur,\n handleFocus,\n focusedSelectId,\n isDisabled = false\n } = props;\n\n const templateContext = useTemplateContext();\n const {theme} = templateContext;\n\n const [styleSheet, setStylesheet] = useState<any | null>(null);\n\n useEffect(() => {\n const _stylesheet = createStyleSheet(theme);\n setStylesheet(_stylesheet);\n }, [theme]);\n\n if (!template || !styleSheet) {\n return null;\n }\n\n const parts = parseTemplateString(template);\n\n const sections: Array<Array<TemplatePart>> = parts.reduce((result, item) => {\n const section = last(result) || [];\n return result.slice(0, -1).concat([section.concat([item])]);\n }, []);\n\n return (\n <View style={{flex: 1}} testID=\"question-template\">\n {sections.map((section, index) => (\n <Section\n key={index}\n section={section}\n items={items}\n index={index}\n handleBlur={handleBlur}\n handleFocus={handleFocus}\n focusedSelectId={focusedSelectId}\n onInputChange={onInputChange}\n userChoices={userChoices}\n isDisabled={isDisabled}\n styles={styleSheet}\n />\n ))}\n </View>\n );\n};\n\nexport default QuestionTemplate;\n"],"file":"index.native.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/template/app-review/template-context.tsx"],"names":["React","createContext","useContext","defaultTheme","Context","theme","display","statusBarHeight","useTemplateContext","context","Error","TemplateContext","values","children"],"mappings":";;AAAA;AAEA,OAAOA,KAAP,IAAeC,aAAf,EAA8BC,UAA9B,QAA+C,OAA/C;
|
|
1
|
+
{"version":3,"sources":["../../../src/template/app-review/template-context.tsx"],"names":["React","createContext","useContext","defaultTheme","Context","theme","translations","display","statusBarHeight","useTemplateContext","context","Error","TemplateContext","values","children"],"mappings":";;AAAA;AAEA,OAAOA,KAAP,IAAeC,aAAf,EAA8BC,UAA9B,QAA+C,OAA/C;AAGA,OAAOC,YAAP,MAAkC,8BAAlC;AAgBA;AAEA,MAAMC,OAAO,GAAGH,aAAa,CAAC;AAC5BI,EAAAA,KAAK,EAAEF,YADqB;AAE5BG,EAAAA,YAAY,EAAE,EAFc;AAG5BC,EAAAA,OAAO,EAAE;AACPC,IAAAA,eAAe,EAAE;AADV;AAHmB,CAAD,CAA7B,C,CAQA;;AAEA,MAAMC,kBAAkB,GAAG,MAA6B;AACtD,QAAMC,OAAO,GAAGR,UAAU,CAACE,OAAD,CAA1B;;AAEA,MAAI,CAACM,OAAL,EAAc;AACZ,UAAM,IAAIC,KAAJ,CACH,yFADG,CAAN;AAGD;;AAED,SAAOD,OAAP;AACD,CAVD,C,CAYA;;;AAEA,MAAME,eAAe,GAAG,CAAC;AAACC,EAAAA,MAAD;AAASC,EAAAA;AAAT,CAAD,KAA+B;AACrD,sBAAO,oBAAC,OAAD,CAAS,QAAT;AAAkB,IAAA,KAAK,eAAMD,MAAN;AAAvB,KAAuCC,QAAvC,CAAP;AACD,CAFD,C,CAIA;;;AAEA,SAAQF,eAAR,EAAyBH,kBAAzB","sourcesContent":["// -----------------------------------------------------------------------------\n\nimport React, {createContext, useContext} from 'react';\nimport {Translations} from '../../types/translations';\nimport {Analytics} from '../../variables/analytics';\nimport defaultTheme, {Theme} from '../../variables/theme.native';\nimport {Vibration} from '../../variables/vibration';\n\nexport type TemplateContextValues = {\n analytics?: Analytics;\n brandTheme?: any;\n theme: Theme;\n translations: Translations;\n vibration?: Vibration;\n display: {\n statusBarHeight: number;\n };\n};\n\ntype Props = {values: TemplateContextValues; children: any};\n\n// -----------------------------------------------------------------------------\n\nconst Context = createContext({\n theme: defaultTheme,\n translations: {},\n display: {\n statusBarHeight: 42\n }\n});\n\n// -----------------------------------------------------------------------------\n\nconst useTemplateContext = (): TemplateContextValues => {\n const context = useContext(Context);\n\n if (!context) {\n throw new Error(\n `❌ [TemplateContext] useTemplateContext must be used within a provider <TemplateContext>`\n );\n }\n\n return context;\n};\n\n// -----------------------------------------------------------------------------\n\nconst TemplateContext = ({values, children}: Props) => {\n return <Context.Provider value={{...values}}>{children}</Context.Provider>;\n};\n\n// -----------------------------------------------------------------------------\n\nexport {TemplateContext, useTemplateContext};\n"],"file":"template-context.js"}
|
|
@@ -6,6 +6,7 @@ import BattleRequestList from '../../../molecule/dashboard/battle-request-list';
|
|
|
6
6
|
import CardsList from '../../../molecule/dashboard/cards-list';
|
|
7
7
|
import NewsList from '../../../molecule/dashboard/news-list';
|
|
8
8
|
import StartBattle from '../../../molecule/dashboard/start-battle';
|
|
9
|
+
import CMPopin from '../../../molecule/cm-popin';
|
|
9
10
|
import style from './style.css';
|
|
10
11
|
const Hero = React.memo(function Hero({
|
|
11
12
|
hero,
|
|
@@ -24,7 +25,8 @@ const Dashboard = props => {
|
|
|
24
25
|
const {
|
|
25
26
|
sections = [],
|
|
26
27
|
hero,
|
|
27
|
-
welcome
|
|
28
|
+
welcome,
|
|
29
|
+
cookie
|
|
28
30
|
} = props;
|
|
29
31
|
|
|
30
32
|
const buildSectionComponent = section => {
|
|
@@ -72,13 +74,14 @@ const Dashboard = props => {
|
|
|
72
74
|
return /*#__PURE__*/React.createElement("div", {
|
|
73
75
|
className: style.wrapper,
|
|
74
76
|
"data-name": "dashboard"
|
|
75
|
-
}, sectionsList);
|
|
77
|
+
}, sectionsList, cookie ? /*#__PURE__*/React.createElement(CMPopin, cookie) : null);
|
|
76
78
|
};
|
|
77
79
|
|
|
78
80
|
Dashboard.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
79
81
|
hero: Hero.propTypes.hero,
|
|
80
82
|
welcome: Hero.propTypes.welcome,
|
|
81
|
-
sections: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape(BattleRequestList.propTypes), PropTypes.shape(CardsList.propTypes), PropTypes.shape(NewsList.propTypes), PropTypes.shape(StartBattle.propTypes)]))
|
|
83
|
+
sections: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape(BattleRequestList.propTypes), PropTypes.shape(CardsList.propTypes), PropTypes.shape(NewsList.propTypes), PropTypes.shape(StartBattle.propTypes)])),
|
|
84
|
+
cookie: PropTypes.shape(CMPopin.propTypes)
|
|
82
85
|
} : {};
|
|
83
86
|
export default Dashboard;
|
|
84
87
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/template/common/dashboard/index.js"],"names":["React","PropTypes","Slide","HeroCard","BattleRequestList","CardsList","NewsList","StartBattle","style","Hero","memo","hero","welcome","propTypes","shape","Dashboard","props","sections","buildSectionComponent","section","type","buildSection","index","sectionView","sectionsList","key","map","wrapper","arrayOf","oneOfType"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,KAAP,MAAkB,qBAAlB;AACA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,iBAAP,MAA8B,iDAA9B;AACA,OAAOC,SAAP,MAAsB,wCAAtB;AACA,OAAOC,QAAP,MAAqB,uCAArB;AACA,OAAOC,WAAP,MAAwB,0CAAxB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,IAAI,
|
|
1
|
+
{"version":3,"sources":["../../../../src/template/common/dashboard/index.js"],"names":["React","PropTypes","Slide","HeroCard","BattleRequestList","CardsList","NewsList","StartBattle","CMPopin","style","Hero","memo","hero","welcome","propTypes","shape","Dashboard","props","sections","cookie","buildSectionComponent","section","type","buildSection","index","sectionView","sectionsList","key","map","wrapper","arrayOf","oneOfType"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,KAAP,MAAkB,qBAAlB;AACA,OAAOC,QAAP,MAAqB,wBAArB;AACA,OAAOC,iBAAP,MAA8B,iDAA9B;AACA,OAAOC,SAAP,MAAsB,wCAAtB;AACA,OAAOC,QAAP,MAAqB,uCAArB;AACA,OAAOC,WAAP,MAAwB,0CAAxB;AACA,OAAOC,OAAP,MAAoB,4BAApB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,IAAI,GAAGV,KAAK,CAACW,IAAN,CAAW,SAASD,IAAT,CAAc;AAACE,EAAAA,IAAD;AAAOC,EAAAA;AAAP,CAAd,EAA+B;AACrD,sBAAO;AAAK,IAAA,SAAS,EAAEJ,KAAK,CAACG;AAAtB,KAA6BA,IAAI,gBAAG,oBAAC,QAAD,EAAcA,IAAd,CAAH,gBAA4B,oBAAC,KAAD,EAAWC,OAAX,CAA7D,CAAP;AACD,CAFY,CAAb;AAIAH,IAAI,CAACI,SAAL,2CAAiB;AACfF,EAAAA,IAAI,EAAEX,SAAS,CAACc,KAAV,CAAgBZ,QAAQ,CAACW,SAAz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,sBACE;AAAK,IAAA,SAAS,EAAEZ,KAAK,CAACoB,OAAtB;AAA+B,iBAAU;AAAzC,KACGH,YADH,EAEGP,MAAM,gBAAG,oBAAC,OAAD,EAAaA,MAAb,CAAH,GAA6B,IAFtC,CADF;AAMD,CApCD;;AAsCAH,SAAS,CAACF,SAAV,2CAAsB;AACpBF,EAAAA,IAAI,EAAEF,IAAI,CAACI,SAAL,CAAeF,IADD;AAEpBC,EAAAA,OAAO,EAAEH,IAAI,CAACI,SAAL,CAAeD,OAFJ;AAGpBK,EAAAA,QAAQ,EAAEjB,SAAS,CAAC6B,OAAV,CACR7B,SAAS,CAAC8B,SAAV,CAAoB,CAClB9B,SAAS,CAACc,KAAV,CAAgBX,iBAAiB,CAACU,SAAlC,CADkB,EAElBb,SAAS,CAACc,KAAV,CAAgBV,SAAS,CAACS,SAA1B,CAFkB,EAGlBb,SAAS,CAACc,KAAV,CAAgBT,QAAQ,CAACQ,SAAzB,CAHkB,EAIlBb,SAAS,CAACc,KAAV,CAAgBR,WAAW,CAACO,SAA5B,CAJkB,CAApB,CADQ,CAHU;AAWpBK,EAAAA,MAAM,EAAElB,SAAS,CAACc,KAAV,CAAgBP,OAAO,CAACM,SAAxB;AAXY,CAAtB;AAaA,eAAeE,SAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Slide from '../../../atom/slide';\nimport HeroCard from '../../../molecule/hero';\nimport BattleRequestList from '../../../molecule/dashboard/battle-request-list';\nimport CardsList from '../../../molecule/dashboard/cards-list';\nimport NewsList from '../../../molecule/dashboard/news-list';\nimport StartBattle from '../../../molecule/dashboard/start-battle';\nimport CMPopin from '../../../molecule/cm-popin';\nimport style from './style.css';\n\nconst Hero = React.memo(function Hero({hero, welcome}) {\n return <div className={style.hero}>{hero ? <HeroCard {...hero} /> : <Slide {...welcome} />}</div>;\n});\n\nHero.propTypes = {\n hero: PropTypes.shape(HeroCard.propTypes),\n welcome: PropTypes.shape(Slide.propTypes)\n};\n\nconst Dashboard = props => {\n const {sections = [], hero, welcome, cookie} = props;\n\n const buildSectionComponent = section => {\n const {type} = section;\n switch (type) {\n case 'hero':\n return <Hero hero={hero} welcome={welcome} />;\n case 'battleRequests':\n return <BattleRequestList {...section} />;\n case 'cards':\n return <CardsList {...section} />;\n case 'news':\n return <NewsList {...section} />;\n case 'battle':\n return <StartBattle {...section} />;\n default:\n return null;\n }\n };\n\n const buildSection = (section, index) => {\n const sectionView = buildSectionComponent(section);\n\n return <div key={index}>{sectionView}</div>;\n };\n\n const sectionsList = [{type: 'hero', key: 'hero'}, ...sections].map(section => (\n <div key={section.key}>{buildSection(section)}</div>\n ));\n return (\n <div className={style.wrapper} data-name=\"dashboard\">\n {sectionsList}\n {cookie ? <CMPopin {...cookie} /> : null}\n </div>\n );\n};\n\nDashboard.propTypes = {\n hero: Hero.propTypes.hero,\n welcome: Hero.propTypes.welcome,\n sections: PropTypes.arrayOf(\n PropTypes.oneOfType([\n PropTypes.shape(BattleRequestList.propTypes),\n PropTypes.shape(CardsList.propTypes),\n PropTypes.shape(NewsList.propTypes),\n PropTypes.shape(StartBattle.propTypes)\n ])\n ),\n cookie: PropTypes.shape(CMPopin.propTypes)\n};\nexport default Dashboard;\n"],"file":"index.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"app-review.d.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"translations.js"}
|