@coorpacademy/components 10.19.12 → 10.19.13-alpha.8
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/es/organism/review-skills/index.js +2 -0
- package/es/organism/review-skills/index.js.map +1 -1
- package/es/template/app-review/index.js +35 -0
- package/es/template/app-review/index.js.map +1 -0
- package/es/template/app-review/{root-view/root-view.native.js → index.native.js} +2 -3
- package/es/template/app-review/index.native.js.map +1 -0
- package/es/template/app-review/onboarding/index.js +3 -0
- package/es/template/app-review/onboarding/index.js.map +1 -0
- package/es/template/app-review/onboarding/index.native.js +84 -0
- package/es/template/app-review/onboarding/index.native.js.map +1 -0
- package/es/template/app-review/{root-view/prop-types.js → prop-types.js} +11 -7
- package/es/template/app-review/prop-types.js.map +1 -0
- package/es/template/app-review/skills/index.js +3 -0
- package/es/template/app-review/skills/index.js.map +1 -0
- package/es/template/app-review/skills/index.native.js +179 -0
- package/es/template/app-review/skills/index.native.js.map +1 -0
- package/es/template/app-review/skills/stories.js +15 -0
- package/es/template/app-review/skills/stories.js.map +1 -0
- package/es/template/app-review/slides/index.js +338 -0
- package/es/template/app-review/slides/index.js.map +1 -0
- package/es/template/app-review/slides/index.native.js +212 -0
- package/es/template/app-review/slides/index.native.js.map +1 -0
- package/es/template/app-review/slides/prop-types.js +67 -0
- package/es/template/app-review/slides/prop-types.js.map +1 -0
- package/es/template/app-review/{slides-review → slides}/style.css +0 -0
- package/lib/organism/review-skills/index.js +5 -1
- package/lib/organism/review-skills/index.js.map +1 -1
- package/lib/template/app-review/index.js +52 -0
- package/lib/template/app-review/index.js.map +1 -0
- package/lib/template/app-review/{root-view/root-view.native.js → index.native.js} +5 -9
- package/lib/template/app-review/index.native.js.map +1 -0
- package/lib/template/app-review/onboarding/index.js +12 -0
- package/lib/template/app-review/onboarding/index.js.map +1 -0
- package/lib/template/app-review/onboarding/index.native.js +100 -0
- package/lib/template/app-review/onboarding/index.native.js.map +1 -0
- package/lib/template/app-review/prop-types.js +33 -0
- package/lib/template/app-review/prop-types.js.map +1 -0
- package/lib/template/app-review/skills/index.js +12 -0
- package/lib/template/app-review/skills/index.js.map +1 -0
- package/lib/template/app-review/skills/index.native.js +197 -0
- package/lib/template/app-review/skills/index.native.js.map +1 -0
- package/lib/template/app-review/skills/stories.js +16 -0
- package/lib/template/app-review/skills/stories.js.map +1 -0
- package/lib/template/app-review/slides/index.js +367 -0
- package/lib/template/app-review/slides/index.js.map +1 -0
- package/lib/template/app-review/slides/index.native.js +229 -0
- package/lib/template/app-review/slides/index.native.js.map +1 -0
- package/lib/template/app-review/slides/prop-types.js +84 -0
- package/lib/template/app-review/slides/prop-types.js.map +1 -0
- package/lib/template/app-review/{slides-review → slides}/style.css +0 -0
- package/package.json +2 -2
- package/es/template/app-review/root-view/common.js +0 -6
- package/es/template/app-review/root-view/common.js.map +0 -1
- package/es/template/app-review/root-view/prop-types.js.map +0 -1
- package/es/template/app-review/root-view/root-view.js +0 -14
- package/es/template/app-review/root-view/root-view.js.map +0 -1
- package/es/template/app-review/root-view/root-view.modules.css +0 -8
- package/es/template/app-review/root-view/root-view.native.js.map +0 -1
- package/es/template/app-review/slides-review/index.js +0 -427
- package/es/template/app-review/slides-review/index.js.map +0 -1
- package/lib/template/app-review/root-view/common.js +0 -11
- package/lib/template/app-review/root-view/common.js.map +0 -1
- package/lib/template/app-review/root-view/prop-types.js +0 -28
- package/lib/template/app-review/root-view/prop-types.js.map +0 -1
- package/lib/template/app-review/root-view/root-view.js +0 -25
- package/lib/template/app-review/root-view/root-view.js.map +0 -1
- package/lib/template/app-review/root-view/root-view.modules.css +0 -8
- package/lib/template/app-review/root-view/root-view.native.js.map +0 -1
- package/lib/template/app-review/slides-review/index.js +0 -453
- package/lib/template/app-review/slides-review/index.js.map +0 -1
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
import React, { useState, useMemo, useEffect } from 'react';
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
import get from 'lodash/fp/get';
|
|
6
|
+
import getOr from 'lodash/fp/getOr';
|
|
7
|
+
import isNil from 'lodash/fp/isNil';
|
|
8
|
+
import { ICON_VALUES } from '../../../atom/review-header-step-item';
|
|
9
|
+
import ReviewBackground from '../../../atom/review-background';
|
|
10
|
+
import ReviewCongrats from '../../../organism/review-congrats';
|
|
11
|
+
import ReviewHeader from '../../../organism/review-header';
|
|
12
|
+
import ReviewCorrectionPopin from '../../../molecule/review-correction-popin';
|
|
13
|
+
import Answer from '../../../molecule/answer';
|
|
14
|
+
import ButtonLink from '../../../atom/button-link';
|
|
15
|
+
import style from './style.css';
|
|
16
|
+
import { SlidesReviewPropTypes, SlidePropTypes, StackedSlidesPropTypes } from './prop-types';
|
|
17
|
+
const stylesByPosition = {
|
|
18
|
+
0: style.position0,
|
|
19
|
+
1: style.position1,
|
|
20
|
+
2: style.position2,
|
|
21
|
+
3: style.position3,
|
|
22
|
+
4: style.position4
|
|
23
|
+
};
|
|
24
|
+
export const TOTAL_SLIDES_STACK = 5;
|
|
25
|
+
export const HIGHEST_INDEX = TOTAL_SLIDES_STACK - 1;
|
|
26
|
+
|
|
27
|
+
const getSlideAnimation = (action, position, hidden) => {
|
|
28
|
+
switch (action) {
|
|
29
|
+
case 'unstack':
|
|
30
|
+
return style.slideOutHideAndIn;
|
|
31
|
+
|
|
32
|
+
case 'restack':
|
|
33
|
+
return style.slideOutAndIn;
|
|
34
|
+
|
|
35
|
+
default:
|
|
36
|
+
return hidden ? style.hiddenSlide : stylesByPosition[position];
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const Slide = ({
|
|
41
|
+
slideNumber,
|
|
42
|
+
slidesState,
|
|
43
|
+
primarySkinColor,
|
|
44
|
+
validate,
|
|
45
|
+
validateSlide,
|
|
46
|
+
finishedSlides,
|
|
47
|
+
updateSlidesOnValidation,
|
|
48
|
+
updateSlidesOnNext,
|
|
49
|
+
updateReviewStatus,
|
|
50
|
+
updateStepItemsOnValidation,
|
|
51
|
+
updateStepItemsOnNext,
|
|
52
|
+
updateFinishedSlides,
|
|
53
|
+
slideValidationResult,
|
|
54
|
+
correctionPopinProps = {}
|
|
55
|
+
}) => {
|
|
56
|
+
const result = get('result', slideValidationResult);
|
|
57
|
+
const exitNode = get('exitNode', slideValidationResult);
|
|
58
|
+
const nextSlide = get('nextSlide', slideValidationResult); // const validatedSlideNumber = get('slideNumber', slideValidationResult);
|
|
59
|
+
|
|
60
|
+
const {
|
|
61
|
+
hidden,
|
|
62
|
+
endReview,
|
|
63
|
+
position,
|
|
64
|
+
animationType,
|
|
65
|
+
validationResult,
|
|
66
|
+
questionText,
|
|
67
|
+
answerUI
|
|
68
|
+
} = slidesState.get(slideNumber);
|
|
69
|
+
const {
|
|
70
|
+
label: validateLabel
|
|
71
|
+
} = validate;
|
|
72
|
+
const validateButtonProps = {
|
|
73
|
+
customStyle: {
|
|
74
|
+
backgroundColor: primarySkinColor
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
/*
|
|
78
|
+
slide validation action, this will trigger the correction popin but will not trigger any
|
|
79
|
+
animations unless the endReview signal is received (all slides will disappear),
|
|
80
|
+
if there is a nextSlide content, it will be loaded here
|
|
81
|
+
if it is the last slide and the content needs to be different, then that update will
|
|
82
|
+
be handled on the next slide logic but the content will be carried from here.
|
|
83
|
+
*/
|
|
84
|
+
onClick: async () => {
|
|
85
|
+
// result: 'success' | 'failure'
|
|
86
|
+
// endReview based on nextContent ref exit node values: 'successExitNode' : 'failExitNode'
|
|
87
|
+
await validateSlide();
|
|
88
|
+
updateSlidesOnValidation({
|
|
89
|
+
slideNumber,
|
|
90
|
+
newSlideContent: {
|
|
91
|
+
hidden,
|
|
92
|
+
position,
|
|
93
|
+
validationResult: result,
|
|
94
|
+
endReview: !!exitNode
|
|
95
|
+
},
|
|
96
|
+
numberOfFinishedSlides: finishedSlides.size,
|
|
97
|
+
nextSlide
|
|
98
|
+
});
|
|
99
|
+
updateStepItemsOnValidation({
|
|
100
|
+
stepNumber: slideNumber,
|
|
101
|
+
icon: result === 'success' ? ICON_VALUES.right : ICON_VALUES.wrong
|
|
102
|
+
});
|
|
103
|
+
if (result === 'success') updateFinishedSlides([slideNumber, true]);
|
|
104
|
+
|
|
105
|
+
if (endReview) {
|
|
106
|
+
updateReviewStatus('finished');
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
'aria-label': validateLabel,
|
|
110
|
+
label: validateLabel,
|
|
111
|
+
'data-name': `slide-validate-button-${slideNumber}`,
|
|
112
|
+
className: style.validateButton,
|
|
113
|
+
disabled: !isNil(validationResult)
|
|
114
|
+
};
|
|
115
|
+
const {
|
|
116
|
+
klf = {},
|
|
117
|
+
information = {
|
|
118
|
+
label: '',
|
|
119
|
+
message: ''
|
|
120
|
+
},
|
|
121
|
+
next,
|
|
122
|
+
successLabel = '',
|
|
123
|
+
failureLabel = ''
|
|
124
|
+
} = correctionPopinProps;
|
|
125
|
+
const _correctionPopinProps = {
|
|
126
|
+
next: {
|
|
127
|
+
/*
|
|
128
|
+
next slide action, this will trigger the slides animations
|
|
129
|
+
if it is the last slide AND the content needs to be different, then that update
|
|
130
|
+
of the content will be handled here (and in the validate as it happens normally )
|
|
131
|
+
from the content carried from the validate action.
|
|
132
|
+
*/
|
|
133
|
+
onClick: () => {
|
|
134
|
+
updateSlidesOnNext({
|
|
135
|
+
slideNumber,
|
|
136
|
+
newSlideContent: {
|
|
137
|
+
hidden: validationResult === 'success',
|
|
138
|
+
position: HIGHEST_INDEX - finishedSlides.size,
|
|
139
|
+
animationType: validationResult === 'success' ? 'unstack' : 'restack',
|
|
140
|
+
validationResult,
|
|
141
|
+
endReview: !!exitNode,
|
|
142
|
+
answerUI,
|
|
143
|
+
questionText
|
|
144
|
+
},
|
|
145
|
+
numberOfFinishedSlides: finishedSlides.size
|
|
146
|
+
});
|
|
147
|
+
updateStepItemsOnNext({
|
|
148
|
+
stepNumber: slideNumber,
|
|
149
|
+
finishedSlides,
|
|
150
|
+
current: finishedSlides.size === HIGHEST_INDEX && validationResult !== 'success'
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
if (finishedSlides.size === TOTAL_SLIDES_STACK) {
|
|
154
|
+
updateReviewStatus('finished');
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
label: next && next.label,
|
|
158
|
+
'data-name': `next-question-button-${slideNumber}`,
|
|
159
|
+
'aria-label': next && next['aria-label']
|
|
160
|
+
},
|
|
161
|
+
klf,
|
|
162
|
+
information,
|
|
163
|
+
type: validationResult === 'success' ? 'right' : 'wrong',
|
|
164
|
+
resultLabel: validationResult === 'success' ? successLabel : failureLabel
|
|
165
|
+
};
|
|
166
|
+
const questionOrigin = 'From "Master Design Thinking to become more agile" course';
|
|
167
|
+
const answerProps = get(['model', 'choices'], answerUI) ? _extends(_extends({}, answerUI), {}, {
|
|
168
|
+
model: _extends(_extends({}, answerUI.model), {}, {
|
|
169
|
+
answers: answerUI.model.choices
|
|
170
|
+
})
|
|
171
|
+
}) : answerUI;
|
|
172
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
173
|
+
key: `slide-${slideNumber}`,
|
|
174
|
+
"data-name": `slide-${slideNumber}`,
|
|
175
|
+
className: classnames(style.slideBase, getSlideAnimation(animationType, position, hidden), endReview ? style.endReview : null)
|
|
176
|
+
}, answerUI && questionText ? /*#__PURE__*/React.createElement("div", {
|
|
177
|
+
key: "content-container",
|
|
178
|
+
className: style.slideContentContainer
|
|
179
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
180
|
+
key: "from-course",
|
|
181
|
+
className: style.questionOrigin
|
|
182
|
+
}, questionOrigin), /*#__PURE__*/React.createElement("div", {
|
|
183
|
+
key: "title",
|
|
184
|
+
className: style.question
|
|
185
|
+
}, questionText), /*#__PURE__*/React.createElement("div", {
|
|
186
|
+
key: "help",
|
|
187
|
+
className: style.help
|
|
188
|
+
}, answerUI.help), /*#__PURE__*/React.createElement("div", {
|
|
189
|
+
key: "answer-container",
|
|
190
|
+
className: style.answerContainer
|
|
191
|
+
}, /*#__PURE__*/React.createElement(Answer, _extends({}, answerProps, {
|
|
192
|
+
key: "answer"
|
|
193
|
+
})))) : null, /*#__PURE__*/React.createElement("div", {
|
|
194
|
+
key: "button-wrapper",
|
|
195
|
+
className: style.validateButtonWrapper
|
|
196
|
+
}, /*#__PURE__*/React.createElement(ButtonLink, validateButtonProps)), /*#__PURE__*/React.createElement("div", {
|
|
197
|
+
className: validationResult ? style.correctionPopinWrapper : style.hiddenCorrectionPopinWrapper,
|
|
198
|
+
style: _extends({}, finishedSlides.size !== HIGHEST_INDEX && !validationResult && {
|
|
199
|
+
display: 'none'
|
|
200
|
+
})
|
|
201
|
+
}, /*#__PURE__*/React.createElement(ReviewCorrectionPopin, _correctionPopinProps)));
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
Slide.propTypes = process.env.NODE_ENV !== "production" ? SlidePropTypes : {};
|
|
205
|
+
|
|
206
|
+
const StackedSlides = ({
|
|
207
|
+
slides,
|
|
208
|
+
primarySkinColor,
|
|
209
|
+
validate,
|
|
210
|
+
validateSlide,
|
|
211
|
+
finishedSlides,
|
|
212
|
+
updateSlidesOnValidation,
|
|
213
|
+
updateSlidesOnNext,
|
|
214
|
+
updateReviewStatus,
|
|
215
|
+
updateStepItemsOnValidation,
|
|
216
|
+
updateStepItemsOnNext,
|
|
217
|
+
updateFinishedSlides,
|
|
218
|
+
slideValidationResult,
|
|
219
|
+
correctionPopinProps
|
|
220
|
+
}) => {
|
|
221
|
+
const stackedSlides = []; // eslint-disable-next-line fp/no-loops
|
|
222
|
+
|
|
223
|
+
for (let slideNumber = 0; slideNumber < TOTAL_SLIDES_STACK; slideNumber++) {
|
|
224
|
+
const slide = /*#__PURE__*/React.createElement(Slide, _extends({
|
|
225
|
+
slideNumber,
|
|
226
|
+
slides,
|
|
227
|
+
primarySkinColor,
|
|
228
|
+
validate,
|
|
229
|
+
validateSlide,
|
|
230
|
+
finishedSlides,
|
|
231
|
+
updateSlidesOnValidation,
|
|
232
|
+
updateSlidesOnNext,
|
|
233
|
+
updateReviewStatus,
|
|
234
|
+
updateStepItemsOnValidation,
|
|
235
|
+
updateStepItemsOnNext,
|
|
236
|
+
updateFinishedSlides,
|
|
237
|
+
slideValidationResult,
|
|
238
|
+
correctionPopinProps
|
|
239
|
+
}, {
|
|
240
|
+
key: slideNumber
|
|
241
|
+
}));
|
|
242
|
+
stackedSlides.push(slide);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return stackedSlides;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
StackedSlides.propTypes = process.env.NODE_ENV !== "production" ? StackedSlidesPropTypes : {};
|
|
249
|
+
|
|
250
|
+
const SlidesReview = ({
|
|
251
|
+
headerProps,
|
|
252
|
+
reviewBackgroundAriaLabel,
|
|
253
|
+
validate,
|
|
254
|
+
correctionPopinProps,
|
|
255
|
+
slides,
|
|
256
|
+
finishedSlides,
|
|
257
|
+
stepItems,
|
|
258
|
+
reviewStatus,
|
|
259
|
+
congratsProps,
|
|
260
|
+
validateSlide,
|
|
261
|
+
updateSlidesOnValidation,
|
|
262
|
+
updateSlidesOnNext,
|
|
263
|
+
updateReviewStatus,
|
|
264
|
+
updateStepItemsOnValidation,
|
|
265
|
+
updateStepItemsOnNext,
|
|
266
|
+
updateFinishedSlides,
|
|
267
|
+
slideValidationResult = {}
|
|
268
|
+
}, context) => {
|
|
269
|
+
const {
|
|
270
|
+
skin
|
|
271
|
+
} = context;
|
|
272
|
+
const primarySkinColor = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);
|
|
273
|
+
/*
|
|
274
|
+
||-------> the slides have an slightly longer lifespan than the "ongoing" review State,
|
|
275
|
+
after reviewState changes to "finished" the slides don't have to unmount until the last
|
|
276
|
+
slide-out animation is finished, the slides have to be unmounted to be RGAA complaint
|
|
277
|
+
(if they are only invisible but still mounted, then they will be found the assisting tools & clutter it)
|
|
278
|
+
*/
|
|
279
|
+
|
|
280
|
+
const [shouldMountSlides, updateShouldMountSlides] = useState(true);
|
|
281
|
+
useEffect(() => {
|
|
282
|
+
if (reviewStatus === 'finished' || finishedSlides.size === TOTAL_SLIDES_STACK) {
|
|
283
|
+
setTimeout(() => updateShouldMountSlides(false), 2000);
|
|
284
|
+
}
|
|
285
|
+
}, [finishedSlides.size, reviewStatus, updateReviewStatus]); // ||-------> transform the step items state (Map structure) to an Array
|
|
286
|
+
|
|
287
|
+
const stepItemsArray = useMemo(() => {
|
|
288
|
+
// eslint-disable-next-line unicorn/prefer-spread
|
|
289
|
+
return Array.from(stepItems.values());
|
|
290
|
+
}, [stepItems]);
|
|
291
|
+
|
|
292
|
+
const _headerProps = _extends(_extends({}, headerProps), {}, {
|
|
293
|
+
steps: stepItemsArray,
|
|
294
|
+
key: 'review-header',
|
|
295
|
+
hiddenSteps: reviewStatus !== 'ongoing'
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
299
|
+
key: "slides-revision-container",
|
|
300
|
+
"data-name": "slides-revision-container",
|
|
301
|
+
className: style.slidesRevisionContainer
|
|
302
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
303
|
+
key: "player-background-container",
|
|
304
|
+
className: style.playerBackground
|
|
305
|
+
}, /*#__PURE__*/React.createElement(ReviewBackground, {
|
|
306
|
+
"aria-label": reviewBackgroundAriaLabel
|
|
307
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
308
|
+
key: "review-header-wrapper",
|
|
309
|
+
className: style.reviewHeaderContainer
|
|
310
|
+
}, /*#__PURE__*/React.createElement(ReviewHeader, _headerProps)), shouldMountSlides ? /*#__PURE__*/React.createElement("div", {
|
|
311
|
+
key: "stacked-slides-container-y-overflow",
|
|
312
|
+
className: style.stackedSlidesYAxisOverflowContainer
|
|
313
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
314
|
+
key: "stacked-slides-container",
|
|
315
|
+
"data-name": "stacked-slides-container",
|
|
316
|
+
className: style.stackedSlidesContainer
|
|
317
|
+
}, /*#__PURE__*/React.createElement(StackedSlides, {
|
|
318
|
+
slides,
|
|
319
|
+
primarySkinColor,
|
|
320
|
+
validate,
|
|
321
|
+
validateSlide,
|
|
322
|
+
finishedSlides,
|
|
323
|
+
updateSlidesOnValidation,
|
|
324
|
+
updateSlidesOnNext,
|
|
325
|
+
updateReviewStatus,
|
|
326
|
+
updateStepItemsOnValidation,
|
|
327
|
+
updateStepItemsOnNext,
|
|
328
|
+
updateFinishedSlides,
|
|
329
|
+
slideValidationResult,
|
|
330
|
+
correctionPopinProps
|
|
331
|
+
}))) : null, reviewStatus === 'finished' ? /*#__PURE__*/React.createElement("div", {
|
|
332
|
+
className: style.congrats
|
|
333
|
+
}, /*#__PURE__*/React.createElement(ReviewCongrats, congratsProps)) : null);
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
SlidesReview.propTypes = process.env.NODE_ENV !== "production" ? SlidesReviewPropTypes : {};
|
|
337
|
+
export default SlidesReview;
|
|
338
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/template/app-review/slides/index.js"],"names":["React","useState","useMemo","useEffect","classnames","get","getOr","isNil","ICON_VALUES","ReviewBackground","ReviewCongrats","ReviewHeader","ReviewCorrectionPopin","Answer","ButtonLink","style","SlidesReviewPropTypes","SlidePropTypes","StackedSlidesPropTypes","stylesByPosition","position0","position1","position2","position3","position4","TOTAL_SLIDES_STACK","HIGHEST_INDEX","getSlideAnimation","action","position","hidden","slideOutHideAndIn","slideOutAndIn","hiddenSlide","Slide","slideNumber","slidesState","primarySkinColor","validate","validateSlide","finishedSlides","updateSlidesOnValidation","updateSlidesOnNext","updateReviewStatus","updateStepItemsOnValidation","updateStepItemsOnNext","updateFinishedSlides","slideValidationResult","correctionPopinProps","result","exitNode","nextSlide","endReview","animationType","validationResult","questionText","answerUI","label","validateLabel","validateButtonProps","customStyle","backgroundColor","onClick","newSlideContent","numberOfFinishedSlides","size","stepNumber","icon","right","wrong","className","validateButton","disabled","klf","information","message","next","successLabel","failureLabel","_correctionPopinProps","current","type","resultLabel","questionOrigin","answerProps","model","answers","choices","slideBase","slideContentContainer","question","help","answerContainer","validateButtonWrapper","correctionPopinWrapper","hiddenCorrectionPopinWrapper","display","propTypes","StackedSlides","slides","stackedSlides","slide","push","SlidesReview","headerProps","reviewBackgroundAriaLabel","stepItems","reviewStatus","congratsProps","context","skin","shouldMountSlides","updateShouldMountSlides","setTimeout","stepItemsArray","Array","from","values","_headerProps","steps","key","hiddenSteps","slidesRevisionContainer","playerBackground","reviewHeaderContainer","stackedSlidesYAxisOverflowContainer","stackedSlidesContainer","congrats"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,QAAf,EAAyBC,OAAzB,EAAkCC,SAAlC,QAAkD,OAAlD;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,OAAOC,KAAP,MAAkB,iBAAlB;AACA,SAAQC,WAAR,QAA0B,uCAA1B;AACA,OAAOC,gBAAP,MAA6B,iCAA7B;AACA,OAAOC,cAAP,MAA2B,mCAA3B;AACA,OAAOC,YAAP,MAAyB,iCAAzB;AACA,OAAOC,qBAAP,MAAkC,2CAAlC;AACA,OAAOC,MAAP,MAAmB,0BAAnB;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,SAAQC,qBAAR,EAA+BC,cAA/B,EAA+CC,sBAA/C,QAA4E,cAA5E;AAEA,MAAMC,gBAAgB,GAAG;AACvB,KAAGJ,KAAK,CAACK,SADc;AAEvB,KAAGL,KAAK,CAACM,SAFc;A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A,wBANE;AAOFC,IAAAA,kBAPE;AAQFC,IAAAA,kBARE;AASFC,IAAAA,2BATE;AAUFC,IAAAA,qBAVE;AAWFC,IAAAA,oBAXE;AAYFC,IAAAA,qBAZE;AAaFC,IAAAA;AAbE,GADN,CALF,CAJF,CADgB,GA6Bd,IA1CN,EA4CG2D,YAAY,KAAK,UAAjB,gBACC;AAAK,IAAA,SAAS,EAAE5F,KAAK,CAACgH;AAAtB,kBACE,oBAAC,cAAD,EAAoBnB,aAApB,CADF,CADD,GAIG,IAhDN,CADF;AAoDD,CAxGD;;AA0GAL,YAAY,CAACN,SAAb,2CAAyBjF,qBAAzB;AAEA,eAAeuF,YAAf","sourcesContent":["import React, {useState, useMemo, useEffect} from 'react';\nimport classnames from 'classnames';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport isNil from 'lodash/fp/isNil';\nimport {ICON_VALUES} from '../../../atom/review-header-step-item';\nimport ReviewBackground from '../../../atom/review-background';\nimport ReviewCongrats from '../../../organism/review-congrats';\nimport ReviewHeader from '../../../organism/review-header';\nimport ReviewCorrectionPopin from '../../../molecule/review-correction-popin';\nimport Answer from '../../../molecule/answer';\nimport ButtonLink from '../../../atom/button-link';\nimport style from './style.css';\nimport {SlidesReviewPropTypes, SlidePropTypes, StackedSlidesPropTypes} from './prop-types';\n\nconst stylesByPosition = {\n 0: style.position0,\n 1: style.position1,\n 2: style.position2,\n 3: style.position3,\n 4: style.position4\n};\n\nexport const TOTAL_SLIDES_STACK = 5;\nexport const HIGHEST_INDEX = TOTAL_SLIDES_STACK - 1;\n\nconst getSlideAnimation = (action, position, hidden) => {\n switch (action) {\n case 'unstack':\n return style.slideOutHideAndIn;\n case 'restack':\n return style.slideOutAndIn;\n default:\n return hidden ? style.hiddenSlide : stylesByPosition[position];\n }\n};\n\nconst Slide = ({\n slideNumber,\n slidesState,\n primarySkinColor,\n validate,\n validateSlide,\n finishedSlides,\n updateSlidesOnValidation,\n updateSlidesOnNext,\n updateReviewStatus,\n updateStepItemsOnValidation,\n updateStepItemsOnNext,\n updateFinishedSlides,\n slideValidationResult,\n correctionPopinProps = {}\n}) => {\n const result = get('result', slideValidationResult);\n const exitNode = get('exitNode', slideValidationResult);\n const nextSlide = get('nextSlide', slideValidationResult);\n // const validatedSlideNumber = get('slideNumber', slideValidationResult);\n\n const {\n hidden,\n endReview,\n position,\n animationType,\n validationResult,\n questionText,\n answerUI\n } = slidesState.get(slideNumber);\n\n const {label: validateLabel} = validate;\n\n const validateButtonProps = {\n customStyle: {\n backgroundColor: primarySkinColor\n },\n /*\n slide validation action, this will trigger the correction popin but will not trigger any\n animations unless the endReview signal is received (all slides will disappear),\n if there is a nextSlide content, it will be loaded here\n if it is the last slide and the content needs to be different, then that update will\n be handled on the next slide logic but the content will be carried from here.\n */\n onClick: async () => {\n // result: 'success' | 'failure'\n // endReview based on nextContent ref exit node values: 'successExitNode' : 'failExitNode'\n await validateSlide();\n updateSlidesOnValidation({\n slideNumber,\n newSlideContent: {\n hidden,\n position,\n validationResult: result,\n endReview: !!exitNode\n },\n numberOfFinishedSlides: finishedSlides.size,\n nextSlide\n });\n updateStepItemsOnValidation({\n stepNumber: slideNumber,\n icon: result === 'success' ? ICON_VALUES.right : ICON_VALUES.wrong\n });\n if (result === 'success') updateFinishedSlides([slideNumber, true]);\n if (endReview) {\n updateReviewStatus('finished');\n }\n },\n 'aria-label': validateLabel,\n label: validateLabel,\n 'data-name': `slide-validate-button-${slideNumber}`,\n className: style.validateButton,\n disabled: !isNil(validationResult)\n };\n\n const {\n klf = {},\n information = {label: '', message: ''},\n next,\n successLabel = '',\n failureLabel = ''\n } = correctionPopinProps;\n\n const _correctionPopinProps = {\n next: {\n /*\n next slide action, this will trigger the slides animations\n if it is the last slide AND the content needs to be different, then that update\n of the content will be handled here (and in the validate as it happens normally )\n from the content carried from the validate action.\n */\n onClick: () => {\n updateSlidesOnNext({\n slideNumber,\n newSlideContent: {\n hidden: validationResult === 'success',\n position: HIGHEST_INDEX - finishedSlides.size,\n animationType: validationResult === 'success' ? 'unstack' : 'restack',\n validationResult,\n endReview: !!exitNode,\n answerUI,\n questionText\n },\n numberOfFinishedSlides: finishedSlides.size\n });\n updateStepItemsOnNext({\n stepNumber: slideNumber,\n finishedSlides,\n current: finishedSlides.size === HIGHEST_INDEX && validationResult !== 'success'\n });\n if (finishedSlides.size === TOTAL_SLIDES_STACK) {\n updateReviewStatus('finished');\n }\n },\n label: next && next.label,\n 'data-name': `next-question-button-${slideNumber}`,\n 'aria-label': next && next['aria-label']\n },\n klf,\n information,\n type: validationResult === 'success' ? 'right' : 'wrong',\n resultLabel: validationResult === 'success' ? successLabel : failureLabel\n };\n\n const questionOrigin = 'From \"Master Design Thinking to become more agile\" course';\n const answerProps = get(['model', 'choices'], answerUI)\n ? {\n ...answerUI,\n model: {\n ...answerUI.model,\n answers: answerUI.model.choices\n }\n }\n : answerUI;\n\n return (\n <div\n key={`slide-${slideNumber}`}\n data-name={`slide-${slideNumber}`}\n className={classnames(\n style.slideBase,\n getSlideAnimation(animationType, position, hidden),\n endReview ? style.endReview : null\n )}\n >\n {answerUI && questionText ? (\n <div key=\"content-container\" className={style.slideContentContainer}>\n <div key=\"from-course\" className={style.questionOrigin}>\n {questionOrigin}\n </div>\n <div key=\"title\" className={style.question}>\n {questionText}\n </div>\n <div key=\"help\" className={style.help}>\n {answerUI.help}\n </div>\n <div key=\"answer-container\" className={style.answerContainer}>\n <Answer {...answerProps} key=\"answer\" />\n </div>\n </div>\n ) : null}\n\n <div key=\"button-wrapper\" className={style.validateButtonWrapper}>\n <ButtonLink {...validateButtonProps} />\n </div>\n <div\n className={\n validationResult ? style.correctionPopinWrapper : style.hiddenCorrectionPopinWrapper\n }\n style={{\n ...(finishedSlides.size !== HIGHEST_INDEX &&\n !validationResult && {\n display: 'none'\n })\n }}\n >\n <ReviewCorrectionPopin {..._correctionPopinProps} />\n </div>\n </div>\n );\n};\n\nSlide.propTypes = SlidePropTypes;\n\nconst StackedSlides = ({\n slides,\n primarySkinColor,\n validate,\n validateSlide,\n finishedSlides,\n updateSlidesOnValidation,\n updateSlidesOnNext,\n updateReviewStatus,\n updateStepItemsOnValidation,\n updateStepItemsOnNext,\n updateFinishedSlides,\n slideValidationResult,\n correctionPopinProps\n}) => {\n const stackedSlides = [];\n // eslint-disable-next-line fp/no-loops\n for (let slideNumber = 0; slideNumber < TOTAL_SLIDES_STACK; slideNumber++) {\n const slide = (\n <Slide\n {...{\n slideNumber,\n slides,\n primarySkinColor,\n validate,\n validateSlide,\n finishedSlides,\n updateSlidesOnValidation,\n updateSlidesOnNext,\n updateReviewStatus,\n updateStepItemsOnValidation,\n updateStepItemsOnNext,\n updateFinishedSlides,\n slideValidationResult,\n correctionPopinProps\n }}\n key={slideNumber}\n />\n );\n stackedSlides.push(slide);\n }\n\n return stackedSlides;\n};\n\nStackedSlides.propTypes = StackedSlidesPropTypes;\n\nconst SlidesReview = (\n {\n headerProps,\n reviewBackgroundAriaLabel,\n validate,\n correctionPopinProps,\n slides,\n finishedSlides,\n stepItems,\n reviewStatus,\n congratsProps,\n validateSlide,\n updateSlidesOnValidation,\n updateSlidesOnNext,\n updateReviewStatus,\n updateStepItemsOnValidation,\n updateStepItemsOnNext,\n updateFinishedSlides,\n slideValidationResult = {}\n },\n context\n) => {\n const {skin} = context;\n const primarySkinColor = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);\n\n /*\n ||-------> the slides have an slightly longer lifespan than the \"ongoing\" review State,\n after reviewState changes to \"finished\" the slides don't have to unmount until the last\n slide-out animation is finished, the slides have to be unmounted to be RGAA complaint\n (if they are only invisible but still mounted, then they will be found the assisting tools & clutter it)\n */\n const [shouldMountSlides, updateShouldMountSlides] = useState(true);\n\n useEffect(() => {\n if (reviewStatus === 'finished' || finishedSlides.size === TOTAL_SLIDES_STACK) {\n setTimeout(() => updateShouldMountSlides(false), 2000);\n }\n }, [finishedSlides.size, reviewStatus, updateReviewStatus]);\n\n // ||-------> transform the step items state (Map structure) to an Array\n const stepItemsArray = useMemo(() => {\n // eslint-disable-next-line unicorn/prefer-spread\n return Array.from(stepItems.values());\n }, [stepItems]);\n\n const _headerProps = {\n ...headerProps,\n steps: stepItemsArray,\n key: 'review-header',\n hiddenSteps: reviewStatus !== 'ongoing'\n };\n\n return (\n <div\n key=\"slides-revision-container\"\n data-name=\"slides-revision-container\"\n className={style.slidesRevisionContainer}\n >\n <div key=\"player-background-container\" className={style.playerBackground}>\n <ReviewBackground aria-label={reviewBackgroundAriaLabel} />\n </div>\n\n <div key=\"review-header-wrapper\" className={style.reviewHeaderContainer}>\n <ReviewHeader {..._headerProps} />\n </div>\n\n {shouldMountSlides ? (\n <div\n key=\"stacked-slides-container-y-overflow\"\n className={style.stackedSlidesYAxisOverflowContainer}\n >\n <div\n key=\"stacked-slides-container\"\n data-name=\"stacked-slides-container\"\n className={style.stackedSlidesContainer}\n >\n <StackedSlides\n {...{\n slides,\n primarySkinColor,\n validate,\n validateSlide,\n finishedSlides,\n updateSlidesOnValidation,\n updateSlidesOnNext,\n updateReviewStatus,\n updateStepItemsOnValidation,\n updateStepItemsOnNext,\n updateFinishedSlides,\n slideValidationResult,\n correctionPopinProps\n }}\n />\n </div>\n </div>\n ) : null}\n\n {reviewStatus === 'finished' ? (\n <div className={style.congrats}>\n <ReviewCongrats {...congratsProps} />\n </div>\n ) : null}\n </div>\n );\n};\n\nSlidesReview.propTypes = SlidesReviewPropTypes;\n\nexport default SlidesReview;\n"],"file":"index.js"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { View, StyleSheet, Text, useWindowDimensions, Button } from 'react-native';
|
|
4
|
+
import propTypes from './prop-types'; // import theme from '../../../modules/theme';
|
|
5
|
+
// import translations from '../../../translations';
|
|
6
|
+
// import {BrandThemeContext} from '../../../app-shared/components/brand-theme-provider';
|
|
7
|
+
// import Button from '../../../app-shared/components/button';
|
|
8
|
+
// import {HEADER_HEIGHT} from '../../../app-shared/components/header-v2';
|
|
9
|
+
// export type _Choice_ = {
|
|
10
|
+
// text?: string,
|
|
11
|
+
// selected: boolean
|
|
12
|
+
// };
|
|
13
|
+
// export type _Slide_ = {
|
|
14
|
+
// category: string,
|
|
15
|
+
// question: string,
|
|
16
|
+
// instruction: string,
|
|
17
|
+
// type: 'multiSelection' | 'singleSelection' | 'trueOrFalse',
|
|
18
|
+
// choices?: _Choice_[]
|
|
19
|
+
// };
|
|
20
|
+
// interface Props {
|
|
21
|
+
// slide: _Slide_;
|
|
22
|
+
// num: number;
|
|
23
|
+
// }
|
|
24
|
+
|
|
25
|
+
const quizzerStyle = StyleSheet.create({
|
|
26
|
+
container: {
|
|
27
|
+
flex: 1,
|
|
28
|
+
padding: 20,
|
|
29
|
+
// paddingTop: HEADER_HEIGHT + 20, @todo with props
|
|
30
|
+
// backgroundColor: theme.colors.white, @todo with props
|
|
31
|
+
justifyContent: 'space-between',
|
|
32
|
+
alignItems: 'center'
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const SLIDE_HEIGHT = () => useWindowDimensions().height * 0.75; // const creatSlideStyle = (num: number) =>
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
const creatSlideStyle = (num, width, height) => StyleSheet.create({
|
|
40
|
+
slide: {
|
|
41
|
+
position: 'absolute',
|
|
42
|
+
// backgroundColor: theme.colors.white, @todo with props
|
|
43
|
+
top: height / 2 - SLIDE_HEIGHT() / 2 - num * 4,
|
|
44
|
+
flex: 1,
|
|
45
|
+
height: SLIDE_HEIGHT(),
|
|
46
|
+
width: width - 40 - num * 8,
|
|
47
|
+
justifyContent: 'space-between',
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
padding: 25,
|
|
50
|
+
shadowColor: '#000',
|
|
51
|
+
shadowOffset: {
|
|
52
|
+
width: 0,
|
|
53
|
+
height: -1
|
|
54
|
+
},
|
|
55
|
+
shadowOpacity: 0.05,
|
|
56
|
+
shadowRadius: 16,
|
|
57
|
+
elevation: 10 - num * 1,
|
|
58
|
+
borderRadius: 16
|
|
59
|
+
},
|
|
60
|
+
category: {
|
|
61
|
+
fontSize: 12,
|
|
62
|
+
lineHeight: 16,
|
|
63
|
+
// color: theme.colors.text.primary, @todo with props
|
|
64
|
+
// marginBottom: theme.spacing.tiny, @todo with props
|
|
65
|
+
// marginTop: theme.spacing.small, @todo with props
|
|
66
|
+
textAlign: 'center'
|
|
67
|
+
},
|
|
68
|
+
question: {
|
|
69
|
+
fontSize: 16,
|
|
70
|
+
lineHeight: 22,
|
|
71
|
+
fontWeight: '700',
|
|
72
|
+
// color: theme.colors.text.primary, @todo with props
|
|
73
|
+
textAlign: 'center'
|
|
74
|
+
},
|
|
75
|
+
instruction: {
|
|
76
|
+
fontSize: 12,
|
|
77
|
+
lineHeight: 16,
|
|
78
|
+
// color: theme.colors.gray.medium, @todo with props
|
|
79
|
+
// marginBottom: theme.spacing.base, @todo with props
|
|
80
|
+
// marginTop: theme.spacing.small, @todo with props
|
|
81
|
+
textAlign: 'center'
|
|
82
|
+
},
|
|
83
|
+
button: {
|
|
84
|
+
width: 287,
|
|
85
|
+
height: 52,
|
|
86
|
+
borderRadius: 7 // marginTop: theme.spacing.base @todo with props
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const createOptionStyle = selected => {
|
|
92
|
+
// const brandTheme = React.useContext(BrandThemeContext); @todo with props
|
|
93
|
+
return StyleSheet.create({
|
|
94
|
+
box: {
|
|
95
|
+
width: '100%',
|
|
96
|
+
// https://stackoverflow.com/a/66561995/959219
|
|
97
|
+
shadowColor: '#000',
|
|
98
|
+
shadowOffset: {
|
|
99
|
+
width: 0,
|
|
100
|
+
height: -1
|
|
101
|
+
},
|
|
102
|
+
shadowOpacity: 0.2,
|
|
103
|
+
shadowRadius: 16,
|
|
104
|
+
elevation: 8,
|
|
105
|
+
// backgroundColor: selected ? brandTheme.colors.primary : theme.colors.white, @todo with props
|
|
106
|
+
padding: 12,
|
|
107
|
+
marginTop: 4,
|
|
108
|
+
marginBottom: 4,
|
|
109
|
+
borderRadius: 8
|
|
110
|
+
},
|
|
111
|
+
text: {
|
|
112
|
+
fontSize: 15,
|
|
113
|
+
fontWeight: 'bold',
|
|
114
|
+
lineHeight: 24,
|
|
115
|
+
// color: selected ? theme.colors.white : theme.colors.text.primary, @todo with props
|
|
116
|
+
textAlign: 'center'
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const choicesStyle = StyleSheet.create({
|
|
122
|
+
container: {
|
|
123
|
+
flex: 1,
|
|
124
|
+
width: '100%',
|
|
125
|
+
justifyContent: 'center',
|
|
126
|
+
alignItems: 'center'
|
|
127
|
+
}
|
|
128
|
+
}); // -----------------------------------------------------------------------------
|
|
129
|
+
|
|
130
|
+
/* {choices.map(({text, selected = false}: _Choice_) => { */
|
|
131
|
+
|
|
132
|
+
const Choices = ({
|
|
133
|
+
choices
|
|
134
|
+
}) => /*#__PURE__*/React.createElement(View, {
|
|
135
|
+
style: choicesStyle.container
|
|
136
|
+
}, choices.map(({
|
|
137
|
+
text,
|
|
138
|
+
selected = false
|
|
139
|
+
}, index) => {
|
|
140
|
+
const optionStyle = createOptionStyle(selected);
|
|
141
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
142
|
+
style: optionStyle.box,
|
|
143
|
+
key: `choice-${index}`
|
|
144
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
145
|
+
style: optionStyle.text
|
|
146
|
+
}, text, " ", selected));
|
|
147
|
+
}));
|
|
148
|
+
|
|
149
|
+
Choices.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
150
|
+
choices: PropTypes.arrayOf({
|
|
151
|
+
text: PropTypes.text,
|
|
152
|
+
selected: PropTypes.bool
|
|
153
|
+
})
|
|
154
|
+
} : {}; // -----------------------------------------------------------------------------
|
|
155
|
+
// const Slide = ({slide, num}: Props) => {
|
|
156
|
+
|
|
157
|
+
const Slide = ({
|
|
158
|
+
validateSlide,
|
|
159
|
+
slide,
|
|
160
|
+
num
|
|
161
|
+
}) => {
|
|
162
|
+
const {
|
|
163
|
+
width,
|
|
164
|
+
height
|
|
165
|
+
} = useWindowDimensions();
|
|
166
|
+
const slideStyle = creatSlideStyle(num, width, height);
|
|
167
|
+
const validateLabel = '__validate'; // translations.validate
|
|
168
|
+
// TODO replace choices with <Answer>; move mobile answers in the package..
|
|
169
|
+
|
|
170
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
171
|
+
style: slideStyle.slide
|
|
172
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
173
|
+
style: slideStyle.category
|
|
174
|
+
}, slide.category, " ", num), /*#__PURE__*/React.createElement(Text, {
|
|
175
|
+
style: slideStyle.question
|
|
176
|
+
}, slide.question), /*#__PURE__*/React.createElement(Text, {
|
|
177
|
+
style: slideStyle.instruction
|
|
178
|
+
}, slide.instruction), /*#__PURE__*/React.createElement(Choices, {
|
|
179
|
+
choices: slide.choices
|
|
180
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
181
|
+
style: slideStyle.button,
|
|
182
|
+
onPress: validateSlide,
|
|
183
|
+
testID: `button-quizzer-validate`
|
|
184
|
+
}, validateLabel));
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
Slide.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
188
|
+
slide: propTypes.slide,
|
|
189
|
+
validateSlide: propTypes.validateSlide,
|
|
190
|
+
num: PropTypes.number
|
|
191
|
+
} : {}; // -----------------------------------------------------------------------------
|
|
192
|
+
// const Slides = ({slide}: Props) => {
|
|
193
|
+
|
|
194
|
+
const Slides = ({
|
|
195
|
+
slide,
|
|
196
|
+
validateSlide
|
|
197
|
+
}) => {
|
|
198
|
+
const slides = [slide, slide, slide, slide, slide];
|
|
199
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
200
|
+
style: quizzerStyle.container
|
|
201
|
+
}, slides.reverse().map((_slide, index) => /*#__PURE__*/React.createElement(Slide, {
|
|
202
|
+
validateSlide: validateSlide,
|
|
203
|
+
slide: _slide,
|
|
204
|
+
num: slides.length - index,
|
|
205
|
+
key: `slide-${index}`
|
|
206
|
+
})));
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
Slides.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {}; // -----------------------------------------------------------------------------
|
|
210
|
+
|
|
211
|
+
export default Slides;
|
|
212
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/template/app-review/slides/index.native.js"],"names":["React","PropTypes","View","StyleSheet","Text","useWindowDimensions","Button","propTypes","quizzerStyle","create","container","flex","padding","justifyContent","alignItems","SLIDE_HEIGHT","height","creatSlideStyle","num","width","slide","position","top","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","borderRadius","category","fontSize","lineHeight","textAlign","question","fontWeight","instruction","button","createOptionStyle","selected","box","marginTop","marginBottom","text","choicesStyle","Choices","choices","map","index","optionStyle","arrayOf","bool","Slide","validateSlide","slideStyle","validateLabel","number","Slides","slides","reverse","_slide","length"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAAQC,IAAR,EAAcC,UAAd,EAA0BC,IAA1B,EAAgCC,mBAAhC,EAAqDC,MAArD,QAAkE,cAAlE;AAEA,OAAOC,SAAP,MAAsB,cAAtB,C,CAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;;AAEA,MAAMC,YAAY,GAAGL,UAAU,CAACM,MAAX,CAAkB;AACrCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,IAAI,EAAE,CADG;AAETC,IAAAA,OAAO,EAAE,EAFA;AAGT;AACA;AACAC,IAAAA,cAAc,EAAE,eALP;AAMTC,IAAAA,U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,MAAM,CAACjD,SAAP,2CAAmBA,SAAnB,M,CAEA;;AAEA,eAAeiD,MAAf","sourcesContent":["import * as React from 'react';\nimport PropTypes from 'prop-types';\nimport {View, StyleSheet, Text, useWindowDimensions, Button} from 'react-native';\n\nimport propTypes from './prop-types';\n\n// import theme from '../../../modules/theme';\n// import translations from '../../../translations';\n// import {BrandThemeContext} from '../../../app-shared/components/brand-theme-provider';\n// import Button from '../../../app-shared/components/button';\n// import {HEADER_HEIGHT} from '../../../app-shared/components/header-v2';\n\n// export type _Choice_ = {\n// text?: string,\n// selected: boolean\n// };\n\n// export type _Slide_ = {\n// category: string,\n// question: string,\n// instruction: string,\n// type: 'multiSelection' | 'singleSelection' | 'trueOrFalse',\n// choices?: _Choice_[]\n// };\n\n// interface Props {\n// slide: _Slide_;\n// num: number;\n// }\n\nconst quizzerStyle = StyleSheet.create({\n container: {\n flex: 1,\n padding: 20,\n // paddingTop: HEADER_HEIGHT + 20, @todo with props\n // backgroundColor: theme.colors.white, @todo with props\n justifyContent: 'space-between',\n alignItems: 'center'\n }\n});\n\nconst SLIDE_HEIGHT = () => useWindowDimensions().height * 0.75;\n\n// const creatSlideStyle = (num: number) =>\nconst creatSlideStyle = (num, width, height) =>\n StyleSheet.create({\n slide: {\n position: 'absolute',\n // backgroundColor: theme.colors.white, @todo with props\n top: height / 2 - SLIDE_HEIGHT() / 2 - num * 4,\n flex: 1,\n height: SLIDE_HEIGHT(),\n width: width - 40 - num * 8,\n justifyContent: 'space-between',\n alignItems: 'center',\n padding: 25,\n shadowColor: '#000',\n shadowOffset: {width: 0, height: -1},\n shadowOpacity: 0.05,\n shadowRadius: 16,\n elevation: 10 - num * 1,\n borderRadius: 16\n },\n category: {\n fontSize: 12,\n lineHeight: 16,\n // color: theme.colors.text.primary, @todo with props\n // marginBottom: theme.spacing.tiny, @todo with props\n // marginTop: theme.spacing.small, @todo with props\n textAlign: 'center'\n },\n question: {\n fontSize: 16,\n lineHeight: 22,\n fontWeight: '700',\n // color: theme.colors.text.primary, @todo with props\n textAlign: 'center'\n },\n instruction: {\n fontSize: 12,\n lineHeight: 16,\n // color: theme.colors.gray.medium, @todo with props\n // marginBottom: theme.spacing.base, @todo with props\n // marginTop: theme.spacing.small, @todo with props\n textAlign: 'center'\n },\n button: {\n width: 287,\n height: 52,\n borderRadius: 7\n // marginTop: theme.spacing.base @todo with props\n }\n });\n\nconst createOptionStyle = selected => {\n // const brandTheme = React.useContext(BrandThemeContext); @todo with props\n\n return StyleSheet.create({\n box: {\n width: '100%',\n // https://stackoverflow.com/a/66561995/959219\n shadowColor: '#000',\n shadowOffset: {width: 0, height: -1},\n shadowOpacity: 0.2,\n shadowRadius: 16,\n elevation: 8,\n // backgroundColor: selected ? brandTheme.colors.primary : theme.colors.white, @todo with props\n padding: 12,\n marginTop: 4,\n marginBottom: 4,\n borderRadius: 8\n },\n text: {\n fontSize: 15,\n fontWeight: 'bold',\n lineHeight: 24,\n // color: selected ? theme.colors.white : theme.colors.text.primary, @todo with props\n textAlign: 'center'\n }\n });\n};\n\nconst choicesStyle = StyleSheet.create({\n container: {\n flex: 1,\n width: '100%',\n justifyContent: 'center',\n alignItems: 'center'\n }\n});\n\n// -----------------------------------------------------------------------------\n\n/* {choices.map(({text, selected = false}: _Choice_) => { */\nconst Choices = ({choices}) => (\n <View style={choicesStyle.container}>\n {choices.map(({text, selected = false}, index) => {\n const optionStyle = createOptionStyle(selected);\n return (\n <View style={optionStyle.box} key={`choice-${index}`}>\n <Text style={optionStyle.text}>\n {text} {selected}\n </Text>\n </View>\n );\n })}\n </View>\n);\n\nChoices.propTypes = {\n choices: PropTypes.arrayOf({\n text: PropTypes.text,\n selected: PropTypes.bool\n })\n};\n\n// -----------------------------------------------------------------------------\n\n// const Slide = ({slide, num}: Props) => {\nconst Slide = ({validateSlide, slide, num}) => {\n const {width, height} = useWindowDimensions();\n const slideStyle = creatSlideStyle(num, width, height);\n const validateLabel = '__validate'; // translations.validate\n\n // TODO replace choices with <Answer>; move mobile answers in the package..\n return (\n <View style={slideStyle.slide}>\n <Text style={slideStyle.category}>\n {slide.category} {num}\n </Text>\n <Text style={slideStyle.question}>{slide.question}</Text>\n <Text style={slideStyle.instruction}>{slide.instruction}</Text>\n\n <Choices choices={slide.choices} />\n\n <Button style={slideStyle.button} onPress={validateSlide} testID={`button-quizzer-validate`}>\n {validateLabel}\n </Button>\n </View>\n );\n};\n\nSlide.propTypes = {\n slide: propTypes.slide,\n validateSlide: propTypes.validateSlide,\n num: PropTypes.number\n};\n\n// -----------------------------------------------------------------------------\n\n// const Slides = ({slide}: Props) => {\nconst Slides = ({slide, validateSlide}) => {\n const slides = [slide, slide, slide, slide, slide];\n return (\n <View style={quizzerStyle.container}>\n {slides.reverse().map((_slide, index) => (\n <Slide\n validateSlide={validateSlide}\n slide={_slide}\n num={slides.length - index}\n key={`slide-${index}`}\n />\n ))}\n </View>\n );\n};\n\nSlides.propTypes = propTypes;\n\n// -----------------------------------------------------------------------------\n\nexport default Slides;\n"],"file":"index.native.js"}
|