@coorpacademy/app-review 0.8.10-alpha.1 → 0.9.0
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/index.js +3 -3
- package/es/types/common.d.ts +0 -6
- package/es/views/skills/index.d.ts +2 -1
- package/es/views/skills/index.js +16 -13
- package/es/views/slides/index.js +4 -6
- package/lib/index.js +3 -3
- package/lib/types/common.d.ts +0 -6
- package/lib/views/skills/index.d.ts +2 -1
- package/lib/views/skills/index.js +16 -13
- package/lib/views/slides/index.js +4 -6
- package/locales/.mtslconfig.json +1 -0
- package/package.json +4 -4
package/es/index.js
CHANGED
|
@@ -15,7 +15,7 @@ const ConnectedApp = (options) => {
|
|
|
15
15
|
const props = {
|
|
16
16
|
viewName: useSelector((state) => state.ui.navigation[state.ui.navigation.length - 1]),
|
|
17
17
|
slides: useSelector((state) => mapStateToSlidesProps(state, dispatch, options)),
|
|
18
|
-
skills: useSelector((state) => mapStateToSkillsProps(state)),
|
|
18
|
+
skills: useSelector((state) => mapStateToSkillsProps(state, options)),
|
|
19
19
|
navigateBack: () => dispatch(navigateBack),
|
|
20
20
|
onboarding: {}
|
|
21
21
|
};
|
|
@@ -24,7 +24,7 @@ const ConnectedApp = (options) => {
|
|
|
24
24
|
const AppReview = ({ options }) => {
|
|
25
25
|
const [store, setStore] = useState(null);
|
|
26
26
|
const [isProgressionCreated, setIsProgressionCreated] = useState(false);
|
|
27
|
-
const { translate, onQuitClick
|
|
27
|
+
const { translate, onQuitClick } = options;
|
|
28
28
|
useEffect(() => {
|
|
29
29
|
if (store)
|
|
30
30
|
return;
|
|
@@ -68,6 +68,6 @@ const AppReview = ({ options }) => {
|
|
|
68
68
|
if (!store)
|
|
69
69
|
return null;
|
|
70
70
|
return (React.createElement(Provider, { store: store },
|
|
71
|
-
React.createElement(ConnectedApp, { onQuitClick: onQuitClick, translate: translate
|
|
71
|
+
React.createElement(ConnectedApp, { onQuitClick: onQuitClick, translate: translate })));
|
|
72
72
|
};
|
|
73
73
|
export default AppReview;
|
package/es/types/common.d.ts
CHANGED
|
@@ -151,7 +151,6 @@ export declare type Options = {
|
|
|
151
151
|
export declare type ConnectedOptions = {
|
|
152
152
|
translate: Translate;
|
|
153
153
|
onQuitClick: () => void;
|
|
154
|
-
skin: PrimarySkin;
|
|
155
154
|
};
|
|
156
155
|
export declare type AppOptions = ConnectedOptions & {
|
|
157
156
|
token: string;
|
|
@@ -175,9 +174,4 @@ export declare type JWT = {
|
|
|
175
174
|
export declare type WithRequired<T, K extends keyof T> = T & {
|
|
176
175
|
[P in K]-?: T[P];
|
|
177
176
|
};
|
|
178
|
-
export declare type PrimarySkin = {
|
|
179
|
-
common: {
|
|
180
|
-
primary: string;
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
177
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { ReviewSkillsProps } from '@coorpacademy/components/es/template/app-review/skills/prop-types';
|
|
2
2
|
import { StoreState } from '../../reducers';
|
|
3
|
-
|
|
3
|
+
import type { ConnectedOptions } from '../../types/common';
|
|
4
|
+
export declare const mapStateToSkillsProps: (state: StoreState, options: ConnectedOptions) => ReviewSkillsProps;
|
package/es/views/skills/index.js
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
export const mapStateToSkillsProps = (state) => {
|
|
1
|
+
export const mapStateToSkillsProps = (state, options) => {
|
|
2
|
+
const { translate } = options;
|
|
2
3
|
return {
|
|
3
|
-
'aria-label': '
|
|
4
|
-
title: '
|
|
4
|
+
'aria-label': translate('list_aria_label'),
|
|
5
|
+
title: translate('list_title'),
|
|
5
6
|
isLoading: false,
|
|
6
|
-
isLoadingAriaLabel: '
|
|
7
|
+
isLoadingAriaLabel: 'Review skills container is loading',
|
|
7
8
|
listSkills: state.data.skills.map(skill => ({
|
|
8
|
-
'aria-label': '
|
|
9
|
+
'aria-label': translate('card.aria_label'),
|
|
9
10
|
isCustom: skill.custom,
|
|
10
11
|
skillTitle: skill.name,
|
|
11
|
-
skillAriaLabel:
|
|
12
|
-
buttonLabel: '
|
|
13
|
-
buttonAriaLabel: '
|
|
14
|
-
reviseLabel: '
|
|
15
|
-
reviseAriaLabel: '
|
|
12
|
+
skillAriaLabel: skill.name,
|
|
13
|
+
buttonLabel: translate('card.button_text'),
|
|
14
|
+
buttonAriaLabel: translate('card.button_text'),
|
|
15
|
+
reviseLabel: translate('card.text', { total: `${skill.slidesToReview}` }),
|
|
16
|
+
reviseAriaLabel: translate('card.text', {
|
|
17
|
+
total: `${skill.slidesToReview}`
|
|
18
|
+
}),
|
|
16
19
|
// eslint-disable-next-line no-console
|
|
17
20
|
onClick: () => console.log('@todo plug dispatcher select skill')
|
|
18
21
|
})),
|
|
19
|
-
titleNoSkills: '
|
|
20
|
-
textNoSkills: '
|
|
21
|
-
iconSkillAriaLabel: '
|
|
22
|
+
titleNoSkills: translate('no_skills.title'),
|
|
23
|
+
textNoSkills: translate('no_skills.text'),
|
|
24
|
+
iconSkillAriaLabel: 'Image without information'
|
|
22
25
|
};
|
|
23
26
|
};
|
package/es/views/slides/index.js
CHANGED
|
@@ -201,7 +201,7 @@ const getCorrectionPopinProps = (dispatch) => (isCorrect, correctAnswer, klf, tr
|
|
|
201
201
|
type: isCorrect ? 'right' : 'wrong'
|
|
202
202
|
};
|
|
203
203
|
};
|
|
204
|
-
const buildQuitPopinProps = (dispatch) => (onQuitClick, translate
|
|
204
|
+
const buildQuitPopinProps = (dispatch) => (onQuitClick, translate) => {
|
|
205
205
|
return {
|
|
206
206
|
content: translate('Quit Title'),
|
|
207
207
|
icon: `MoonRocket`,
|
|
@@ -211,7 +211,7 @@ const buildQuitPopinProps = (dispatch) => (onQuitClick, translate, skin) => {
|
|
|
211
211
|
label: translate('Stop learning'),
|
|
212
212
|
type: 'tertiary',
|
|
213
213
|
customStyle: {
|
|
214
|
-
color:
|
|
214
|
+
color: '#ED3436'
|
|
215
215
|
},
|
|
216
216
|
handleOnclick: onQuitClick,
|
|
217
217
|
'aria-label': translate('Stop learning')
|
|
@@ -312,7 +312,7 @@ const isEndOfProgression = (progression) => {
|
|
|
312
312
|
return progression.state.nextContent.ref === 'successExitNode';
|
|
313
313
|
};
|
|
314
314
|
export const mapStateToSlidesProps = (state, dispatch, options) => {
|
|
315
|
-
const { translate, onQuitClick
|
|
315
|
+
const { translate, onQuitClick } = options;
|
|
316
316
|
const currentSlideRef = getCurrentSlideRef(state);
|
|
317
317
|
const endReview = isEndOfProgression(state.data.progression);
|
|
318
318
|
const correction = get(['data', 'corrections', currentSlideRef], state);
|
|
@@ -345,8 +345,6 @@ export const mapStateToSlidesProps = (state, dispatch, options) => {
|
|
|
345
345
|
endReview: endReview && state.ui.showCongrats
|
|
346
346
|
},
|
|
347
347
|
congrats: buildCongratsProps(state, dispatch, options),
|
|
348
|
-
quitPopin: showQuitPopin
|
|
349
|
-
? buildQuitPopinProps(dispatch)(onQuitClick, translate, skin)
|
|
350
|
-
: undefined
|
|
348
|
+
quitPopin: showQuitPopin ? buildQuitPopinProps(dispatch)(onQuitClick, translate) : undefined
|
|
351
349
|
};
|
|
352
350
|
};
|
package/lib/index.js
CHANGED
|
@@ -43,7 +43,7 @@ const ConnectedApp = (options) => {
|
|
|
43
43
|
const props = {
|
|
44
44
|
viewName: (0, react_redux_1.useSelector)((state) => state.ui.navigation[state.ui.navigation.length - 1]),
|
|
45
45
|
slides: (0, react_redux_1.useSelector)((state) => (0, slides_1.mapStateToSlidesProps)(state, dispatch, options)),
|
|
46
|
-
skills: (0, react_redux_1.useSelector)((state) => (0, skills_1.mapStateToSkillsProps)(state)),
|
|
46
|
+
skills: (0, react_redux_1.useSelector)((state) => (0, skills_1.mapStateToSkillsProps)(state, options)),
|
|
47
47
|
navigateBack: () => dispatch(navigation_1.navigateBack),
|
|
48
48
|
onboarding: {}
|
|
49
49
|
};
|
|
@@ -52,7 +52,7 @@ const ConnectedApp = (options) => {
|
|
|
52
52
|
const AppReview = ({ options }) => {
|
|
53
53
|
const [store, setStore] = (0, react_1.useState)(null);
|
|
54
54
|
const [isProgressionCreated, setIsProgressionCreated] = (0, react_1.useState)(false);
|
|
55
|
-
const { translate, onQuitClick
|
|
55
|
+
const { translate, onQuitClick } = options;
|
|
56
56
|
(0, react_1.useEffect)(() => {
|
|
57
57
|
if (store)
|
|
58
58
|
return;
|
|
@@ -96,6 +96,6 @@ const AppReview = ({ options }) => {
|
|
|
96
96
|
if (!store)
|
|
97
97
|
return null;
|
|
98
98
|
return (react_1.default.createElement(react_redux_1.Provider, { store: store },
|
|
99
|
-
react_1.default.createElement(ConnectedApp, { onQuitClick: onQuitClick, translate: translate
|
|
99
|
+
react_1.default.createElement(ConnectedApp, { onQuitClick: onQuitClick, translate: translate })));
|
|
100
100
|
};
|
|
101
101
|
exports.default = AppReview;
|
package/lib/types/common.d.ts
CHANGED
|
@@ -151,7 +151,6 @@ export declare type Options = {
|
|
|
151
151
|
export declare type ConnectedOptions = {
|
|
152
152
|
translate: Translate;
|
|
153
153
|
onQuitClick: () => void;
|
|
154
|
-
skin: PrimarySkin;
|
|
155
154
|
};
|
|
156
155
|
export declare type AppOptions = ConnectedOptions & {
|
|
157
156
|
token: string;
|
|
@@ -175,9 +174,4 @@ export declare type JWT = {
|
|
|
175
174
|
export declare type WithRequired<T, K extends keyof T> = T & {
|
|
176
175
|
[P in K]-?: T[P];
|
|
177
176
|
};
|
|
178
|
-
export declare type PrimarySkin = {
|
|
179
|
-
common: {
|
|
180
|
-
primary: string;
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
177
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { ReviewSkillsProps } from '@coorpacademy/components/es/template/app-review/skills/prop-types';
|
|
2
2
|
import { StoreState } from '../../reducers';
|
|
3
|
-
|
|
3
|
+
import type { ConnectedOptions } from '../../types/common';
|
|
4
|
+
export declare const mapStateToSkillsProps: (state: StoreState, options: ConnectedOptions) => ReviewSkillsProps;
|
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mapStateToSkillsProps = void 0;
|
|
4
|
-
const mapStateToSkillsProps = (state) => {
|
|
4
|
+
const mapStateToSkillsProps = (state, options) => {
|
|
5
|
+
const { translate } = options;
|
|
5
6
|
return {
|
|
6
|
-
'aria-label': '
|
|
7
|
-
title: '
|
|
7
|
+
'aria-label': translate('list_aria_label'),
|
|
8
|
+
title: translate('list_title'),
|
|
8
9
|
isLoading: false,
|
|
9
|
-
isLoadingAriaLabel: '
|
|
10
|
+
isLoadingAriaLabel: 'Review skills container is loading',
|
|
10
11
|
listSkills: state.data.skills.map(skill => ({
|
|
11
|
-
'aria-label': '
|
|
12
|
+
'aria-label': translate('card.aria_label'),
|
|
12
13
|
isCustom: skill.custom,
|
|
13
14
|
skillTitle: skill.name,
|
|
14
|
-
skillAriaLabel:
|
|
15
|
-
buttonLabel: '
|
|
16
|
-
buttonAriaLabel: '
|
|
17
|
-
reviseLabel: '
|
|
18
|
-
reviseAriaLabel: '
|
|
15
|
+
skillAriaLabel: skill.name,
|
|
16
|
+
buttonLabel: translate('card.button_text'),
|
|
17
|
+
buttonAriaLabel: translate('card.button_text'),
|
|
18
|
+
reviseLabel: translate('card.text', { total: `${skill.slidesToReview}` }),
|
|
19
|
+
reviseAriaLabel: translate('card.text', {
|
|
20
|
+
total: `${skill.slidesToReview}`
|
|
21
|
+
}),
|
|
19
22
|
// eslint-disable-next-line no-console
|
|
20
23
|
onClick: () => console.log('@todo plug dispatcher select skill')
|
|
21
24
|
})),
|
|
22
|
-
titleNoSkills: '
|
|
23
|
-
textNoSkills: '
|
|
24
|
-
iconSkillAriaLabel: '
|
|
25
|
+
titleNoSkills: translate('no_skills.title'),
|
|
26
|
+
textNoSkills: translate('no_skills.text'),
|
|
27
|
+
iconSkillAriaLabel: 'Image without information'
|
|
25
28
|
};
|
|
26
29
|
};
|
|
27
30
|
exports.mapStateToSkillsProps = mapStateToSkillsProps;
|
|
@@ -208,7 +208,7 @@ const getCorrectionPopinProps = (dispatch) => (isCorrect, correctAnswer, klf, tr
|
|
|
208
208
|
type: isCorrect ? 'right' : 'wrong'
|
|
209
209
|
};
|
|
210
210
|
};
|
|
211
|
-
const buildQuitPopinProps = (dispatch) => (onQuitClick, translate
|
|
211
|
+
const buildQuitPopinProps = (dispatch) => (onQuitClick, translate) => {
|
|
212
212
|
return {
|
|
213
213
|
content: translate('Quit Title'),
|
|
214
214
|
icon: `MoonRocket`,
|
|
@@ -218,7 +218,7 @@ const buildQuitPopinProps = (dispatch) => (onQuitClick, translate, skin) => {
|
|
|
218
218
|
label: translate('Stop learning'),
|
|
219
219
|
type: 'tertiary',
|
|
220
220
|
customStyle: {
|
|
221
|
-
color:
|
|
221
|
+
color: '#ED3436'
|
|
222
222
|
},
|
|
223
223
|
handleOnclick: onQuitClick,
|
|
224
224
|
'aria-label': translate('Stop learning')
|
|
@@ -319,7 +319,7 @@ const isEndOfProgression = (progression) => {
|
|
|
319
319
|
return progression.state.nextContent.ref === 'successExitNode';
|
|
320
320
|
};
|
|
321
321
|
const mapStateToSlidesProps = (state, dispatch, options) => {
|
|
322
|
-
const { translate, onQuitClick
|
|
322
|
+
const { translate, onQuitClick } = options;
|
|
323
323
|
const currentSlideRef = getCurrentSlideRef(state);
|
|
324
324
|
const endReview = isEndOfProgression(state.data.progression);
|
|
325
325
|
const correction = (0, get_1.default)(['data', 'corrections', currentSlideRef], state);
|
|
@@ -352,9 +352,7 @@ const mapStateToSlidesProps = (state, dispatch, options) => {
|
|
|
352
352
|
endReview: endReview && state.ui.showCongrats
|
|
353
353
|
},
|
|
354
354
|
congrats: buildCongratsProps(state, dispatch, options),
|
|
355
|
-
quitPopin: showQuitPopin
|
|
356
|
-
? buildQuitPopinProps(dispatch)(onQuitClick, translate, skin)
|
|
357
|
-
: undefined
|
|
355
|
+
quitPopin: showQuitPopin ? buildQuitPopinProps(dispatch)(onQuitClick, translate) : undefined
|
|
358
356
|
};
|
|
359
357
|
};
|
|
360
358
|
exports.mapStateToSlidesProps = mapStateToSlidesProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"ignore_dirs":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/app-review",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.15.0"
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"main": "lib/index.js",
|
|
36
36
|
"module": "es/index.js",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@coorpacademy/components": "10.
|
|
38
|
+
"@coorpacademy/components": "10.29.0",
|
|
39
39
|
"@coorpacademy/redux-task": "1.1.6",
|
|
40
|
-
"@coorpacademy/translate": "6.
|
|
40
|
+
"@coorpacademy/translate": "6.2.0",
|
|
41
41
|
"cross-fetch": "^3.1.5",
|
|
42
42
|
"jwt-decode": "^3.1.2",
|
|
43
43
|
"react-redux": "^7.2.9",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"webpack-cli": "^4.10.0",
|
|
72
72
|
"webpack-dev-server": "^4.11.1"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "d86b61ca4d94a5e0c8691bc10bc5c8e67e45153d"
|
|
75
75
|
}
|