@coorpacademy/app-review 0.7.2-alpha.4 → 0.7.2
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/views/slides/index.js +17 -16
- package/lib/views/slides/index.js +17 -16
- package/locales/en/review.json +14 -0
- package/package.json +5 -4
package/es/views/slides/index.js
CHANGED
|
@@ -166,22 +166,22 @@ export const buildStepItems = (state) => {
|
|
|
166
166
|
});
|
|
167
167
|
return steps;
|
|
168
168
|
};
|
|
169
|
-
const getCorrectionPopinProps = (dispatch) => (isCorrect, correctAnswer, klf) => {
|
|
169
|
+
const getCorrectionPopinProps = (dispatch) => (isCorrect, correctAnswer, klf, translate) => {
|
|
170
170
|
return {
|
|
171
171
|
klf: isCorrect
|
|
172
172
|
? undefined
|
|
173
173
|
: {
|
|
174
|
-
label: '
|
|
174
|
+
label: translate('KLF'),
|
|
175
175
|
tooltip: klf
|
|
176
176
|
},
|
|
177
|
-
resultLabel: isCorrect ? '
|
|
177
|
+
resultLabel: isCorrect ? translate('Correct Answer') : translate('Wrong Answer'),
|
|
178
178
|
information: {
|
|
179
|
-
label: isCorrect ? '
|
|
179
|
+
label: isCorrect ? translate('KLF') : translate('Correct Answer'),
|
|
180
180
|
message: isCorrect ? klf : join(',', correctAnswer)
|
|
181
181
|
},
|
|
182
182
|
next: {
|
|
183
|
-
'aria-label': '
|
|
184
|
-
label: '
|
|
183
|
+
'aria-label': translate('Next Question'),
|
|
184
|
+
label: translate('Next Question'),
|
|
185
185
|
onClick: () => {
|
|
186
186
|
dispatch(nextSlide);
|
|
187
187
|
}
|
|
@@ -214,7 +214,7 @@ const buildQuitPopinProps = (dispatch) => (onQuitClick) => {
|
|
|
214
214
|
}
|
|
215
215
|
};
|
|
216
216
|
};
|
|
217
|
-
const buildRankCard = (rank) => {
|
|
217
|
+
const buildRankCard = (rank, translate) => {
|
|
218
218
|
return {
|
|
219
219
|
'aria-label': 'Review Card Congrats Container',
|
|
220
220
|
'data-name': 'card-rank',
|
|
@@ -229,13 +229,13 @@ const buildRankCard = (rank) => {
|
|
|
229
229
|
cardType: 'card-rank',
|
|
230
230
|
iconAriaLabel: 'Image without information',
|
|
231
231
|
className: undefined,
|
|
232
|
-
reviewCardTitle: 'You are now',
|
|
232
|
+
reviewCardTitle: translate('You are now'),
|
|
233
233
|
reviewCardValue: `${rank}`,
|
|
234
234
|
rankSuffix: 'th',
|
|
235
235
|
timerAnimation: 200
|
|
236
236
|
};
|
|
237
237
|
};
|
|
238
|
-
const buildCongratsProps = (state) => {
|
|
238
|
+
const buildCongratsProps = (state, translate) => {
|
|
239
239
|
if (!state.ui.showCongrats)
|
|
240
240
|
return;
|
|
241
241
|
const progression = state.data.progression;
|
|
@@ -258,18 +258,18 @@ const buildCongratsProps = (state) => {
|
|
|
258
258
|
iconAriaLabel: 'Image without information',
|
|
259
259
|
className: undefined,
|
|
260
260
|
cardType: 'card-star',
|
|
261
|
-
reviewCardTitle: 'You have won',
|
|
261
|
+
reviewCardTitle: translate('You have won'),
|
|
262
262
|
reviewCardValue: `${stars}`,
|
|
263
263
|
timerAnimation: 200
|
|
264
264
|
};
|
|
265
265
|
const { start, end } = state.data.rank;
|
|
266
266
|
const newRank = start - end;
|
|
267
|
-
const cardCongratsRank = !Number.isNaN(newRank) && newRank > 0 ? buildRankCard(end) : undefined;
|
|
267
|
+
const cardCongratsRank = !Number.isNaN(newRank) && newRank > 0 ? buildRankCard(end, translate) : undefined;
|
|
268
268
|
return {
|
|
269
269
|
'aria-label': 'Review Congratulations',
|
|
270
270
|
'data-name': 'review-congrats',
|
|
271
271
|
animationLottie: confettiAnimation,
|
|
272
|
-
title: 'Congratulations!',
|
|
272
|
+
title: translate('Congratulations!'),
|
|
273
273
|
cardCongratsStar,
|
|
274
274
|
cardCongratsRank,
|
|
275
275
|
buttonRevising: undefined,
|
|
@@ -293,7 +293,7 @@ export const mapStateToSlidesProps = (state, dispatch, options) => {
|
|
|
293
293
|
return {
|
|
294
294
|
header: {
|
|
295
295
|
mode: translate('Review Title'),
|
|
296
|
-
skillName: '
|
|
296
|
+
skillName: translate('Content Parent Title'),
|
|
297
297
|
onQuitClick: () => dispatch(openQuitPopin),
|
|
298
298
|
'aria-label': 'aria-header-wrapper',
|
|
299
299
|
closeButtonAriaLabel: 'aria-close-button',
|
|
@@ -303,16 +303,17 @@ export const mapStateToSlidesProps = (state, dispatch, options) => {
|
|
|
303
303
|
stack: {
|
|
304
304
|
slides: buildStackSlides(state, dispatch),
|
|
305
305
|
validateButton: {
|
|
306
|
-
label: '
|
|
306
|
+
label: translate('Validate'),
|
|
307
307
|
disabled: !get(['ui', 'slide', currentSlideRef, 'validateButton'], state),
|
|
308
308
|
onClick: () => {
|
|
309
309
|
dispatch(postAnswer);
|
|
310
310
|
}
|
|
311
311
|
},
|
|
312
|
-
correctionPopinProps: correction &&
|
|
312
|
+
correctionPopinProps: correction &&
|
|
313
|
+
getCorrectionPopinProps(dispatch)(isCorrect, correction.correctAnswer, klf, translate),
|
|
313
314
|
endReview: endReview && state.ui.showCongrats
|
|
314
315
|
},
|
|
315
|
-
congrats: buildCongratsProps(state),
|
|
316
|
+
congrats: buildCongratsProps(state, translate),
|
|
316
317
|
quitPopin: showQuitPopin ? buildQuitPopinProps(dispatch)(onQuitClick) : undefined
|
|
317
318
|
};
|
|
318
319
|
};
|
|
@@ -173,22 +173,22 @@ const buildStepItems = (state) => {
|
|
|
173
173
|
return steps;
|
|
174
174
|
};
|
|
175
175
|
exports.buildStepItems = buildStepItems;
|
|
176
|
-
const getCorrectionPopinProps = (dispatch) => (isCorrect, correctAnswer, klf) => {
|
|
176
|
+
const getCorrectionPopinProps = (dispatch) => (isCorrect, correctAnswer, klf, translate) => {
|
|
177
177
|
return {
|
|
178
178
|
klf: isCorrect
|
|
179
179
|
? undefined
|
|
180
180
|
: {
|
|
181
|
-
label: '
|
|
181
|
+
label: translate('KLF'),
|
|
182
182
|
tooltip: klf
|
|
183
183
|
},
|
|
184
|
-
resultLabel: isCorrect ? '
|
|
184
|
+
resultLabel: isCorrect ? translate('Correct Answer') : translate('Wrong Answer'),
|
|
185
185
|
information: {
|
|
186
|
-
label: isCorrect ? '
|
|
186
|
+
label: isCorrect ? translate('KLF') : translate('Correct Answer'),
|
|
187
187
|
message: isCorrect ? klf : (0, join_1.default)(',', correctAnswer)
|
|
188
188
|
},
|
|
189
189
|
next: {
|
|
190
|
-
'aria-label': '
|
|
191
|
-
label: '
|
|
190
|
+
'aria-label': translate('Next Question'),
|
|
191
|
+
label: translate('Next Question'),
|
|
192
192
|
onClick: () => {
|
|
193
193
|
dispatch(next_slide_1.nextSlide);
|
|
194
194
|
}
|
|
@@ -221,7 +221,7 @@ const buildQuitPopinProps = (dispatch) => (onQuitClick) => {
|
|
|
221
221
|
}
|
|
222
222
|
};
|
|
223
223
|
};
|
|
224
|
-
const buildRankCard = (rank) => {
|
|
224
|
+
const buildRankCard = (rank, translate) => {
|
|
225
225
|
return {
|
|
226
226
|
'aria-label': 'Review Card Congrats Container',
|
|
227
227
|
'data-name': 'card-rank',
|
|
@@ -236,13 +236,13 @@ const buildRankCard = (rank) => {
|
|
|
236
236
|
cardType: 'card-rank',
|
|
237
237
|
iconAriaLabel: 'Image without information',
|
|
238
238
|
className: undefined,
|
|
239
|
-
reviewCardTitle: 'You are now',
|
|
239
|
+
reviewCardTitle: translate('You are now'),
|
|
240
240
|
reviewCardValue: `${rank}`,
|
|
241
241
|
rankSuffix: 'th',
|
|
242
242
|
timerAnimation: 200
|
|
243
243
|
};
|
|
244
244
|
};
|
|
245
|
-
const buildCongratsProps = (state) => {
|
|
245
|
+
const buildCongratsProps = (state, translate) => {
|
|
246
246
|
if (!state.ui.showCongrats)
|
|
247
247
|
return;
|
|
248
248
|
const progression = state.data.progression;
|
|
@@ -265,18 +265,18 @@ const buildCongratsProps = (state) => {
|
|
|
265
265
|
iconAriaLabel: 'Image without information',
|
|
266
266
|
className: undefined,
|
|
267
267
|
cardType: 'card-star',
|
|
268
|
-
reviewCardTitle: 'You have won',
|
|
268
|
+
reviewCardTitle: translate('You have won'),
|
|
269
269
|
reviewCardValue: `${stars}`,
|
|
270
270
|
timerAnimation: 200
|
|
271
271
|
};
|
|
272
272
|
const { start, end } = state.data.rank;
|
|
273
273
|
const newRank = start - end;
|
|
274
|
-
const cardCongratsRank = !Number.isNaN(newRank) && newRank > 0 ? buildRankCard(end) : undefined;
|
|
274
|
+
const cardCongratsRank = !Number.isNaN(newRank) && newRank > 0 ? buildRankCard(end, translate) : undefined;
|
|
275
275
|
return {
|
|
276
276
|
'aria-label': 'Review Congratulations',
|
|
277
277
|
'data-name': 'review-congrats',
|
|
278
278
|
animationLottie: confettiAnimation,
|
|
279
|
-
title: 'Congratulations!',
|
|
279
|
+
title: translate('Congratulations!'),
|
|
280
280
|
cardCongratsStar,
|
|
281
281
|
cardCongratsRank,
|
|
282
282
|
buttonRevising: undefined,
|
|
@@ -300,7 +300,7 @@ const mapStateToSlidesProps = (state, dispatch, options) => {
|
|
|
300
300
|
return {
|
|
301
301
|
header: {
|
|
302
302
|
mode: translate('Review Title'),
|
|
303
|
-
skillName: '
|
|
303
|
+
skillName: translate('Content Parent Title'),
|
|
304
304
|
onQuitClick: () => dispatch(quit_popin_1.openQuitPopin),
|
|
305
305
|
'aria-label': 'aria-header-wrapper',
|
|
306
306
|
closeButtonAriaLabel: 'aria-close-button',
|
|
@@ -310,16 +310,17 @@ const mapStateToSlidesProps = (state, dispatch, options) => {
|
|
|
310
310
|
stack: {
|
|
311
311
|
slides: buildStackSlides(state, dispatch),
|
|
312
312
|
validateButton: {
|
|
313
|
-
label: '
|
|
313
|
+
label: translate('Validate'),
|
|
314
314
|
disabled: !(0, get_1.default)(['ui', 'slide', currentSlideRef, 'validateButton'], state),
|
|
315
315
|
onClick: () => {
|
|
316
316
|
dispatch(post_answer_1.postAnswer);
|
|
317
317
|
}
|
|
318
318
|
},
|
|
319
|
-
correctionPopinProps: correction &&
|
|
319
|
+
correctionPopinProps: correction &&
|
|
320
|
+
getCorrectionPopinProps(dispatch)(isCorrect, correction.correctAnswer, klf, translate),
|
|
320
321
|
endReview: endReview && state.ui.showCongrats
|
|
321
322
|
},
|
|
322
|
-
congrats: buildCongratsProps(state),
|
|
323
|
+
congrats: buildCongratsProps(state, translate),
|
|
323
324
|
quitPopin: showQuitPopin ? buildQuitPopinProps(dispatch)(onQuitClick) : undefined
|
|
324
325
|
};
|
|
325
326
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Review Title": "Review Mode",
|
|
3
|
+
"Content Parent Title": "From `{{contentTitle}}` `{{contentType}}`",
|
|
4
|
+
"Validate": "Validate",
|
|
5
|
+
"Next Question": "Next Question",
|
|
6
|
+
"KLF": "Key point",
|
|
7
|
+
"Correct Answer": "Good Answer",
|
|
8
|
+
"Wrong Answer": "Wrong Answer",
|
|
9
|
+
"You have won": "You have won",
|
|
10
|
+
"You are now": "You are now",
|
|
11
|
+
"Revise another skill": "Review another skill",
|
|
12
|
+
"Continue reviewing": "Keep reviewing",
|
|
13
|
+
"Congratulations!": "Congratulations!"
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/app-review",
|
|
3
|
-
"version": "0.7.2
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.15.0"
|
|
@@ -29,14 +29,15 @@
|
|
|
29
29
|
"files": [
|
|
30
30
|
"lib",
|
|
31
31
|
"es",
|
|
32
|
+
"locales",
|
|
32
33
|
"readme.md"
|
|
33
34
|
],
|
|
34
35
|
"main": "lib/index.js",
|
|
35
36
|
"module": "es/index.js",
|
|
36
37
|
"dependencies": {
|
|
37
|
-
"@coorpacademy/components": "10.27.
|
|
38
|
+
"@coorpacademy/components": "10.27.1",
|
|
38
39
|
"@coorpacademy/redux-task": "1.1.6",
|
|
39
|
-
"@coorpacademy/translate": "6.1.5",
|
|
40
|
+
"@coorpacademy/translate": "^6.1.5",
|
|
40
41
|
"cross-fetch": "^3.1.5",
|
|
41
42
|
"jwt-decode": "^3.1.2",
|
|
42
43
|
"react-redux": "^7.2.9",
|
|
@@ -70,5 +71,5 @@
|
|
|
70
71
|
"webpack-cli": "^4.10.0",
|
|
71
72
|
"webpack-dev-server": "^4.11.1"
|
|
72
73
|
},
|
|
73
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "30f01e5fd98b051b3fe6f782bc302079f0dcfbf9"
|
|
74
75
|
}
|