@coorpacademy/app-review 0.7.5-alpha.27 → 0.7.5
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/actions/api/post-progression.d.ts +3 -0
- package/es/reducers/data/corrections.d.ts +2 -1
- package/es/reducers/data/corrections.js +4 -0
- package/es/reducers/data/index.d.ts +1 -1
- package/es/reducers/data/progression.d.ts +2 -2
- package/es/reducers/data/progression.js +6 -2
- package/es/reducers/data/rank.d.ts +2 -2
- package/es/reducers/data/rank.js +2 -2
- package/es/reducers/data/skills.js +3 -1
- package/es/reducers/data/slides.d.ts +2 -1
- package/es/reducers/data/slides.js +6 -1
- package/es/reducers/index.d.ts +2 -1
- package/es/reducers/ui/answers.d.ts +2 -1
- package/es/reducers/ui/answers.js +4 -0
- package/es/reducers/ui/current-slide-ref.d.ts +2 -1
- package/es/reducers/ui/current-slide-ref.js +4 -0
- package/es/reducers/ui/index.d.ts +4 -1
- package/es/reducers/ui/index.js +2 -0
- package/es/reducers/ui/positions.d.ts +2 -2
- package/es/reducers/ui/positions.js +4 -1
- package/es/reducers/ui/show-button-revising.d.ts +5 -0
- package/es/reducers/ui/show-button-revising.js +17 -0
- package/es/reducers/ui/show-congrats.d.ts +2 -2
- package/es/reducers/ui/show-congrats.js +2 -2
- package/es/reducers/ui/slide.d.ts +2 -1
- package/es/reducers/ui/slide.js +4 -0
- package/es/views/slides/index.js +23 -4
- package/lib/actions/api/post-progression.d.ts +3 -0
- package/lib/reducers/data/corrections.d.ts +2 -1
- package/lib/reducers/data/corrections.js +4 -0
- package/lib/reducers/data/index.d.ts +1 -1
- package/lib/reducers/data/progression.d.ts +2 -2
- package/lib/reducers/data/progression.js +5 -1
- package/lib/reducers/data/rank.d.ts +2 -2
- package/lib/reducers/data/rank.js +1 -1
- package/lib/reducers/data/skills.js +3 -1
- package/lib/reducers/data/slides.d.ts +2 -1
- package/lib/reducers/data/slides.js +6 -1
- package/lib/reducers/index.d.ts +2 -1
- package/lib/reducers/ui/answers.d.ts +2 -1
- package/lib/reducers/ui/answers.js +4 -0
- package/lib/reducers/ui/current-slide-ref.d.ts +2 -1
- package/lib/reducers/ui/current-slide-ref.js +4 -0
- package/lib/reducers/ui/index.d.ts +4 -1
- package/lib/reducers/ui/index.js +2 -0
- package/lib/reducers/ui/positions.d.ts +2 -2
- package/lib/reducers/ui/positions.js +3 -0
- package/lib/reducers/ui/show-button-revising.d.ts +5 -0
- package/lib/reducers/ui/show-button-revising.js +19 -0
- package/lib/reducers/ui/show-congrats.d.ts +2 -2
- package/lib/reducers/ui/show-congrats.js +1 -1
- package/lib/reducers/ui/slide.d.ts +2 -1
- package/lib/reducers/ui/slide.js +4 -0
- package/lib/views/slides/index.js +23 -4
- package/locales/bs/review.json +12 -12
- package/locales/hy/review.json +12 -12
- package/locales/zh_TW/review.json +12 -12
- package/package.json +4 -4
|
@@ -4,6 +4,9 @@ import type { StoreState } from '../../reducers';
|
|
|
4
4
|
export declare const POST_PROGRESSION_REQUEST: "@@progression/POST_REQUEST";
|
|
5
5
|
export declare const POST_PROGRESSION_SUCCESS: "@@progression/POST_SUCCESS";
|
|
6
6
|
export declare const POST_PROGRESSION_FAILURE: "@@progression/POST_FAILURE";
|
|
7
|
+
export declare type FetchProgression = {
|
|
8
|
+
type: typeof POST_PROGRESSION_REQUEST;
|
|
9
|
+
};
|
|
7
10
|
export declare type ReceivedProgression = {
|
|
8
11
|
type: typeof POST_PROGRESSION_SUCCESS;
|
|
9
12
|
payload: ProgressionFromAPI;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CorrectionFromAPI } from '../../types/common';
|
|
2
2
|
import { ReceivedCorrection, FetchCorrection } from '../../actions/api/fetch-correction';
|
|
3
|
+
import { FetchProgression } from '../../actions/api/post-progression';
|
|
3
4
|
export declare type CorrectionsState = Record<string, CorrectionFromAPI>;
|
|
4
5
|
export declare type CorrectionsAction = ReceivedCorrection | FetchCorrection;
|
|
5
|
-
declare const reducer: (state: CorrectionsState | undefined, action: CorrectionsAction) => CorrectionsState;
|
|
6
|
+
declare const reducer: (state: CorrectionsState | undefined, action: CorrectionsAction | FetchProgression) => CorrectionsState;
|
|
6
7
|
export default reducer;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import set from 'lodash/fp/set';
|
|
2
2
|
import { CORRECTION_FETCH_SUCCESS, CORRECTION_FETCH_REQUEST } from '../../actions/api/fetch-correction';
|
|
3
|
+
import { POST_PROGRESSION_REQUEST } from '../../actions/api/post-progression';
|
|
3
4
|
const initialState = {};
|
|
4
5
|
const reducer = (
|
|
5
6
|
// eslint-disable-next-line default-param-last
|
|
@@ -14,6 +15,9 @@ state = initialState, action) => {
|
|
|
14
15
|
const correction = action.payload;
|
|
15
16
|
return set([meta.slideRef], correction, state);
|
|
16
17
|
}
|
|
18
|
+
case POST_PROGRESSION_REQUEST: {
|
|
19
|
+
return initialState;
|
|
20
|
+
}
|
|
17
21
|
default:
|
|
18
22
|
return state;
|
|
19
23
|
}
|
|
@@ -19,5 +19,5 @@ declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
|
19
19
|
slides: SlidesState;
|
|
20
20
|
token: string;
|
|
21
21
|
rank: RankState;
|
|
22
|
-
}>, import("
|
|
22
|
+
}>, import("../../actions/api/post-progression").FetchProgression | import("../../actions/api/post-progression").ReceivedProgression | import("./corrections").CorrectionsAction | import("../../actions/api/fetch-rank").RankAction | import("../../actions/api/post-answer").PostAnswerSuccessAction | import("../../actions/api/fetch-skills").ReceivedSkills | import("./slides").SlidesAction | import("../../actions/data/token").StoreToken>;
|
|
23
23
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PostAnswerSuccessAction } from '../../actions/api/post-answer';
|
|
2
|
-
import { ReceivedProgression } from '../../actions/api/post-progression';
|
|
2
|
+
import { FetchProgression, ReceivedProgression } from '../../actions/api/post-progression';
|
|
3
3
|
import { ProgressionFromAPI } from '../../types/common';
|
|
4
4
|
export declare type ProgressionState = ProgressionFromAPI | null;
|
|
5
|
-
declare const reducer: (state: ProgressionState | undefined, action: ReceivedProgression | PostAnswerSuccessAction) => ProgressionState;
|
|
5
|
+
declare const reducer: (state: ProgressionState | undefined, action: ReceivedProgression | PostAnswerSuccessAction | FetchProgression) => ProgressionState;
|
|
6
6
|
export default reducer;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { POST_ANSWER_SUCCESS } from '../../actions/api/post-answer';
|
|
2
|
-
import { POST_PROGRESSION_SUCCESS } from '../../actions/api/post-progression';
|
|
2
|
+
import { POST_PROGRESSION_REQUEST, POST_PROGRESSION_SUCCESS } from '../../actions/api/post-progression';
|
|
3
|
+
const initialState = null;
|
|
3
4
|
const reducer = (
|
|
4
5
|
// eslint-disable-next-line default-param-last
|
|
5
|
-
state =
|
|
6
|
+
state = initialState, action) => {
|
|
6
7
|
switch (action.type) {
|
|
7
8
|
case POST_ANSWER_SUCCESS:
|
|
8
9
|
case POST_PROGRESSION_SUCCESS: {
|
|
9
10
|
const progression = action.payload;
|
|
10
11
|
return progression;
|
|
11
12
|
}
|
|
13
|
+
case POST_PROGRESSION_REQUEST: {
|
|
14
|
+
return initialState;
|
|
15
|
+
}
|
|
12
16
|
default:
|
|
13
17
|
return state;
|
|
14
18
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type FetchProgression } from '../../actions/api/post-progression';
|
|
2
2
|
import { RankAction } from '../../actions/api/fetch-rank';
|
|
3
3
|
export declare type RankState = {
|
|
4
4
|
start: number;
|
|
5
5
|
end: number;
|
|
6
6
|
};
|
|
7
|
-
declare const reducer: (state: RankState | undefined, action: RankAction |
|
|
7
|
+
declare const reducer: (state: RankState | undefined, action: RankAction | FetchProgression) => RankState;
|
|
8
8
|
export default reducer;
|
package/es/reducers/data/rank.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import set from 'lodash/fp/set';
|
|
2
|
-
import {
|
|
2
|
+
import { POST_PROGRESSION_REQUEST } from '../../actions/api/post-progression';
|
|
3
3
|
import { RANK_FETCH_START_SUCCESS, RANK_FETCH_END_SUCCESS } from '../../actions/api/fetch-rank';
|
|
4
4
|
const initialState = {
|
|
5
5
|
start: Number.NaN,
|
|
@@ -9,7 +9,7 @@ const reducer = (
|
|
|
9
9
|
// eslint-disable-next-line default-param-last
|
|
10
10
|
state = initialState, action) => {
|
|
11
11
|
switch (action.type) {
|
|
12
|
-
case
|
|
12
|
+
case POST_PROGRESSION_REQUEST: {
|
|
13
13
|
return initialState;
|
|
14
14
|
}
|
|
15
15
|
case RANK_FETCH_START_SUCCESS: {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { SKILLS_FETCH_SUCCESS } from '../../actions/api/fetch-skills';
|
|
2
|
+
const initialState = [];
|
|
3
|
+
const reducer = (
|
|
2
4
|
// eslint-disable-next-line default-param-last
|
|
3
|
-
|
|
5
|
+
state = initialState, action) => {
|
|
4
6
|
switch (action.type) {
|
|
5
7
|
case SKILLS_FETCH_SUCCESS:
|
|
6
8
|
return action.payload;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ReceivedSlide, FetchSlide } from '../../actions/api/fetch-slide';
|
|
2
|
+
import { FetchProgression } from '../../actions/api/post-progression';
|
|
2
3
|
import { SlideFromAPI } from '../../types/common';
|
|
3
4
|
export declare type SlidesAction = FetchSlide | ReceivedSlide;
|
|
4
5
|
export declare type SlidesState = Record<string, SlideFromAPI | null>;
|
|
5
6
|
export declare const initialState: SlidesState;
|
|
6
|
-
declare const reducer: (state: SlidesState | undefined, action: SlidesAction) => SlidesState;
|
|
7
|
+
declare const reducer: (state: SlidesState | undefined, action: SlidesAction | FetchProgression) => SlidesState;
|
|
7
8
|
export default reducer;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import set from 'lodash/fp/set';
|
|
2
2
|
import { SLIDE_FETCH_REQUEST, SLIDE_FETCH_SUCCESS } from '../../actions/api/fetch-slide';
|
|
3
|
+
import { POST_PROGRESSION_REQUEST } from '../../actions/api/post-progression';
|
|
3
4
|
export const initialState = {};
|
|
5
|
+
const reducer = (
|
|
4
6
|
// eslint-disable-next-line default-param-last
|
|
5
|
-
|
|
7
|
+
state = initialState, action) => {
|
|
6
8
|
switch (action.type) {
|
|
7
9
|
case SLIDE_FETCH_REQUEST: {
|
|
8
10
|
const { meta } = action;
|
|
@@ -12,6 +14,9 @@ const reducer = (state = initialState, action) => {
|
|
|
12
14
|
const slide = action.payload;
|
|
13
15
|
return set([slide._id], slide, state);
|
|
14
16
|
}
|
|
17
|
+
case POST_PROGRESSION_REQUEST: {
|
|
18
|
+
return initialState;
|
|
19
|
+
}
|
|
15
20
|
default:
|
|
16
21
|
return state;
|
|
17
22
|
}
|
package/es/reducers/index.d.ts
CHANGED
|
@@ -20,9 +20,10 @@ declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
|
20
20
|
slide: import("./ui/slide").UISlideState;
|
|
21
21
|
positions: import("./ui/positions").UIPositionState;
|
|
22
22
|
showQuitPopin: boolean;
|
|
23
|
+
showButtonRevising: boolean;
|
|
23
24
|
showCongrats: boolean;
|
|
24
25
|
}>;
|
|
25
|
-
}>, import("
|
|
26
|
+
}>, import("../actions/ui/slides").SetCurrentSlideAction | import("../actions/api/post-progression").FetchProgression | import("../actions/api/post-progression").ReceivedProgression | import("./data/corrections").CorrectionsAction | import("../actions/api/fetch-rank").RankAction | import("../actions/api/fetch-slides-to-review-by-skill-ref").ReceivedSlidesToReviewBySkillRef | import("../actions/api/post-answer").PostAnswerRequestAction | import("../actions/api/post-answer").PostAnswerSuccessAction | import("../actions/api/fetch-skills").ReceivedSkills | import("./data/slides").SlidesAction | import("../actions/data/token").StoreToken | import("../actions/ui/next-slide").NextSlideAction | import("../actions/ui/navigation").NavigateToAction | import("../actions/ui/navigation").NavigateBackAction | import("../actions/ui/answers").EditAnswerAction | {
|
|
26
27
|
type: "@@ui/OPEN_POPIN";
|
|
27
28
|
} | {
|
|
28
29
|
type: "@@ui/CLOSE_POPIN";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { EditAnswerAction } from '../../actions/ui/answers';
|
|
2
2
|
import { NextSlideAction } from '../../actions/ui/next-slide';
|
|
3
|
+
import { FetchProgression } from '../../actions/api/post-progression';
|
|
3
4
|
export declare type UISlideAnswer = string[];
|
|
4
5
|
export declare type UIAnswerState = Record<string, UISlideAnswer>;
|
|
5
6
|
export declare const initialState: UIAnswerState;
|
|
6
|
-
declare const reducer: (state: UIAnswerState | undefined, action: EditAnswerAction | NextSlideAction) => UIAnswerState;
|
|
7
|
+
declare const reducer: (state: UIAnswerState | undefined, action: EditAnswerAction | NextSlideAction | FetchProgression) => UIAnswerState;
|
|
7
8
|
export default reducer;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { set } from 'lodash/fp';
|
|
2
2
|
import { EDIT_BASIC, EDIT_QCM, EDIT_QCM_DRAG, EDIT_QCM_GRAPHIC, EDIT_SLIDER, EDIT_TEMPLATE } from '../../actions/ui/answers';
|
|
3
3
|
import { NEXT_SLIDE } from '../../actions/ui/next-slide';
|
|
4
|
+
import { POST_PROGRESSION_REQUEST } from '../../actions/api/post-progression';
|
|
4
5
|
export const initialState = {};
|
|
5
6
|
const reducer = (
|
|
6
7
|
// eslint-disable-next-line default-param-last
|
|
@@ -17,6 +18,9 @@ state = initialState, action) => {
|
|
|
17
18
|
case NEXT_SLIDE: {
|
|
18
19
|
return set([action.payload.nextSlideRef], [], state);
|
|
19
20
|
}
|
|
21
|
+
case POST_PROGRESSION_REQUEST: {
|
|
22
|
+
return initialState;
|
|
23
|
+
}
|
|
20
24
|
default:
|
|
21
25
|
return state;
|
|
22
26
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NextSlideAction } from '../../actions/ui/next-slide';
|
|
2
2
|
import { SetCurrentSlideAction } from '../../actions/ui/slides';
|
|
3
|
+
import { FetchProgression } from '../../actions/api/post-progression';
|
|
3
4
|
export declare type CurrentSlideRefState = string;
|
|
4
|
-
declare const reducer: (state: string | undefined, action: SetCurrentSlideAction | NextSlideAction) => CurrentSlideRefState;
|
|
5
|
+
declare const reducer: (state: string | undefined, action: SetCurrentSlideAction | NextSlideAction | FetchProgression) => CurrentSlideRefState;
|
|
5
6
|
export default reducer;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NEXT_SLIDE } from '../../actions/ui/next-slide';
|
|
2
2
|
import { SET_CURRENT_SLIDE } from '../../actions/ui/slides';
|
|
3
|
+
import { POST_PROGRESSION_REQUEST } from '../../actions/api/post-progression';
|
|
3
4
|
const reducer = (
|
|
4
5
|
// eslint-disable-next-line default-param-last
|
|
5
6
|
state = '', action) => {
|
|
@@ -9,6 +10,9 @@ state = '', action) => {
|
|
|
9
10
|
case SET_CURRENT_SLIDE: {
|
|
10
11
|
return action.payload._id;
|
|
11
12
|
}
|
|
13
|
+
case POST_PROGRESSION_REQUEST: {
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
12
16
|
default:
|
|
13
17
|
return state;
|
|
14
18
|
}
|
|
@@ -4,6 +4,7 @@ import { UIAnswerState } from './answers';
|
|
|
4
4
|
import { UIPositionState } from './positions';
|
|
5
5
|
import { UISlideState } from './slide';
|
|
6
6
|
import { type ShowQuitPopinState } from './quit-popin';
|
|
7
|
+
import { UIShowButtonRevisingState } from './show-button-revising';
|
|
7
8
|
import { UIShowCongratsState } from './show-congrats';
|
|
8
9
|
export declare type UIState = {
|
|
9
10
|
currentSlideRef: CurrentSlideRefState;
|
|
@@ -12,6 +13,7 @@ export declare type UIState = {
|
|
|
12
13
|
slide: UISlideState;
|
|
13
14
|
positions: UIPositionState;
|
|
14
15
|
showQuitPopin: ShowQuitPopinState;
|
|
16
|
+
showButtonRevising: UIShowButtonRevisingState;
|
|
15
17
|
showCongrats: UIShowCongratsState;
|
|
16
18
|
};
|
|
17
19
|
declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
@@ -21,8 +23,9 @@ declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
|
21
23
|
slide: UISlideState;
|
|
22
24
|
positions: UIPositionState;
|
|
23
25
|
showQuitPopin: boolean;
|
|
26
|
+
showButtonRevising: boolean;
|
|
24
27
|
showCongrats: boolean;
|
|
25
|
-
}>, import("../../actions/api/fetch-correction").ReceivedCorrection | import("../../actions/ui/slides").SetCurrentSlideAction | import("../../actions/api/fetch-slide").FetchSlide | import("../../actions/api/post-
|
|
28
|
+
}>, import("../../actions/api/fetch-correction").ReceivedCorrection | import("../../actions/ui/slides").SetCurrentSlideAction | import("../../actions/api/fetch-slide").FetchSlide | import("../../actions/api/post-progression").FetchProgression | import("../../actions/api/post-progression").ReceivedProgression | import("../../actions/api/fetch-slides-to-review-by-skill-ref").ReceivedSlidesToReviewBySkillRef | import("../../actions/api/post-answer").PostAnswerRequestAction | import("../../actions/ui/next-slide").NextSlideAction | import("../../actions/ui/navigation").NavigateToAction | import("../../actions/ui/navigation").NavigateBackAction | import("../../actions/ui/answers").EditAnswerAction | {
|
|
26
29
|
type: "@@ui/OPEN_POPIN";
|
|
27
30
|
} | {
|
|
28
31
|
type: "@@ui/CLOSE_POPIN";
|
package/es/reducers/ui/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import answers from './answers';
|
|
|
5
5
|
import positions from './positions';
|
|
6
6
|
import slide from './slide';
|
|
7
7
|
import showQuitPopin from './quit-popin';
|
|
8
|
+
import showButtonRevising from './show-button-revising';
|
|
8
9
|
import showCongrats from './show-congrats';
|
|
9
10
|
export default combineReducers({
|
|
10
11
|
currentSlideRef,
|
|
@@ -13,5 +14,6 @@ export default combineReducers({
|
|
|
13
14
|
slide,
|
|
14
15
|
positions,
|
|
15
16
|
showQuitPopin,
|
|
17
|
+
showButtonRevising,
|
|
16
18
|
showCongrats
|
|
17
19
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReceivedProgression } from '../../actions/api/post-progression';
|
|
1
|
+
import { FetchProgression, ReceivedProgression } from '../../actions/api/post-progression';
|
|
2
2
|
import { NextSlideAction } from '../../actions/ui/next-slide';
|
|
3
3
|
export declare type UIPositionState = number[];
|
|
4
|
-
declare const reducer: (state: UIPositionState | undefined, action: NextSlideAction | ReceivedProgression) => UIPositionState;
|
|
4
|
+
declare const reducer: (state: UIPositionState | undefined, action: NextSlideAction | ReceivedProgression | FetchProgression) => UIPositionState;
|
|
5
5
|
export default reducer;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import findIndex from 'lodash/fp/findIndex';
|
|
2
2
|
import map from 'lodash/fp/map';
|
|
3
3
|
import set from 'lodash/fp/set';
|
|
4
|
-
import { POST_PROGRESSION_SUCCESS } from '../../actions/api/post-progression';
|
|
4
|
+
import { POST_PROGRESSION_REQUEST, POST_PROGRESSION_SUCCESS } from '../../actions/api/post-progression';
|
|
5
5
|
import { NEXT_SLIDE } from '../../actions/ui/next-slide';
|
|
6
6
|
const initialState = [0, 1, 2, 3, 4];
|
|
7
7
|
const reducer = (
|
|
@@ -20,6 +20,9 @@ state = initialState, action) => {
|
|
|
20
20
|
const newState = map(position => (position === -1 ? position : position - 1), state);
|
|
21
21
|
return set([`${currentSlideIndex}`], nextCurrentSlidePosition)(newState);
|
|
22
22
|
}
|
|
23
|
+
case POST_PROGRESSION_REQUEST: {
|
|
24
|
+
return initialState;
|
|
25
|
+
}
|
|
23
26
|
default:
|
|
24
27
|
return state;
|
|
25
28
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ReceivedSlidesToReviewBySkillRef } from '../../actions/api/fetch-slides-to-review-by-skill-ref';
|
|
2
|
+
import { FetchProgression } from '../../actions/api/post-progression';
|
|
3
|
+
export declare type UIShowButtonRevisingState = boolean;
|
|
4
|
+
declare const reducer: (state: boolean | undefined, action: ReceivedSlidesToReviewBySkillRef | FetchProgression) => UIShowButtonRevisingState;
|
|
5
|
+
export default reducer;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SLIDES_TO_REVIEW_FETCH_SUCCESS } from '../../actions/api/fetch-slides-to-review-by-skill-ref';
|
|
2
|
+
import { POST_PROGRESSION_REQUEST } from '../../actions/api/post-progression';
|
|
3
|
+
const reducer = (
|
|
4
|
+
// eslint-disable-next-line default-param-last
|
|
5
|
+
state = false, action) => {
|
|
6
|
+
switch (action.type) {
|
|
7
|
+
case SLIDES_TO_REVIEW_FETCH_SUCCESS: {
|
|
8
|
+
return action.payload.length === 5;
|
|
9
|
+
}
|
|
10
|
+
case POST_PROGRESSION_REQUEST: {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
default:
|
|
14
|
+
return state;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export default reducer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NextSlideAction } from '../../actions/ui/next-slide';
|
|
2
|
-
import {
|
|
2
|
+
import { FetchProgression } from '../../actions/api/post-progression';
|
|
3
3
|
export declare type UIShowCongratsState = boolean;
|
|
4
|
-
declare const reducer: (state: boolean | undefined, action: NextSlideAction |
|
|
4
|
+
declare const reducer: (state: boolean | undefined, action: NextSlideAction | FetchProgression) => UIShowCongratsState;
|
|
5
5
|
export default reducer;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { NEXT_SLIDE } from '../../actions/ui/next-slide';
|
|
2
|
-
import {
|
|
2
|
+
import { POST_PROGRESSION_REQUEST } from '../../actions/api/post-progression';
|
|
3
3
|
const reducer = (
|
|
4
4
|
// eslint-disable-next-line default-param-last
|
|
5
5
|
state = false, action) => {
|
|
6
6
|
switch (action.type) {
|
|
7
|
-
case
|
|
7
|
+
case POST_PROGRESSION_REQUEST: {
|
|
8
8
|
return false;
|
|
9
9
|
}
|
|
10
10
|
case NEXT_SLIDE: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EditAnswerAction } from '../../actions/ui/answers';
|
|
2
2
|
import { PostAnswerRequestAction } from '../../actions/api/post-answer';
|
|
3
3
|
import { ReceivedCorrection } from '../../actions/api/fetch-correction';
|
|
4
|
+
import { FetchProgression } from '../../actions/api/post-progression';
|
|
4
5
|
import { FetchSlide } from '../../actions/api/fetch-slide';
|
|
5
6
|
import { NextSlideAction } from '../../actions/ui/next-slide';
|
|
6
7
|
import { SlideUIAnimations } from '../../types/slides';
|
|
@@ -12,5 +13,5 @@ export declare type UISlide = {
|
|
|
12
13
|
};
|
|
13
14
|
export declare type UISlideState = Record<string, UISlide>;
|
|
14
15
|
export declare const initialState: UISlideState;
|
|
15
|
-
declare const reducer: (state: UISlideState | undefined, action: FetchSlide | PostAnswerRequestAction | EditAnswerAction | ReceivedCorrection | NextSlideAction) => UISlideState;
|
|
16
|
+
declare const reducer: (state: UISlideState | undefined, action: FetchSlide | PostAnswerRequestAction | EditAnswerAction | ReceivedCorrection | NextSlideAction | FetchProgression) => UISlideState;
|
|
16
17
|
export default reducer;
|
package/es/reducers/ui/slide.js
CHANGED
|
@@ -6,6 +6,7 @@ import unset from 'lodash/fp/unset';
|
|
|
6
6
|
import { EDIT_BASIC, EDIT_QCM, EDIT_QCM_DRAG, EDIT_QCM_GRAPHIC, EDIT_SLIDER, EDIT_TEMPLATE } from '../../actions/ui/answers';
|
|
7
7
|
import { POST_ANSWER_REQUEST } from '../../actions/api/post-answer';
|
|
8
8
|
import { CORRECTION_FETCH_SUCCESS } from '../../actions/api/fetch-correction';
|
|
9
|
+
import { POST_PROGRESSION_REQUEST } from '../../actions/api/post-progression';
|
|
9
10
|
import { SLIDE_FETCH_REQUEST } from '../../actions/api/fetch-slide';
|
|
10
11
|
import { NEXT_SLIDE } from '../../actions/ui/next-slide';
|
|
11
12
|
export const initialState = {};
|
|
@@ -40,6 +41,9 @@ state = initialState, action) => {
|
|
|
40
41
|
return state;
|
|
41
42
|
return pipe(set([currentSlideRef, 'animateCorrectionPopin'], false), set([currentSlideRef, 'animationType'], action.payload.animationType))(state);
|
|
42
43
|
}
|
|
44
|
+
case POST_PROGRESSION_REQUEST: {
|
|
45
|
+
return initialState;
|
|
46
|
+
}
|
|
43
47
|
default:
|
|
44
48
|
return state;
|
|
45
49
|
}
|
package/es/views/slides/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import join from 'lodash/fp/join';
|
|
|
9
9
|
import { closeQuitPopin, openQuitPopin } from '../../actions/ui/quit-popin';
|
|
10
10
|
import { getProgressionSlidesRefs } from '../../common';
|
|
11
11
|
import { postAnswer } from '../../actions/api/post-answer';
|
|
12
|
+
import { postProgression } from '../../actions/api/post-progression';
|
|
12
13
|
import { nextSlide } from '../../actions/ui/next-slide';
|
|
13
14
|
import { mapApiSlideToUi } from './map-api-slide-to-ui';
|
|
14
15
|
const ICON_VALUES = {
|
|
@@ -235,9 +236,10 @@ const buildRankCard = (rank, translate) => {
|
|
|
235
236
|
timerAnimation: 200
|
|
236
237
|
};
|
|
237
238
|
};
|
|
238
|
-
const buildCongratsProps = (state,
|
|
239
|
+
const buildCongratsProps = (state, dispatch, options) => {
|
|
239
240
|
if (!state.ui.showCongrats)
|
|
240
241
|
return;
|
|
242
|
+
const { translate, onQuitClick } = options;
|
|
241
243
|
const progression = state.data.progression;
|
|
242
244
|
const stars = progression.state.stars;
|
|
243
245
|
const cardCongratsStar = {
|
|
@@ -265,6 +267,23 @@ const buildCongratsProps = (state, translate) => {
|
|
|
265
267
|
const { start, end } = state.data.rank;
|
|
266
268
|
const newRank = start - end;
|
|
267
269
|
const cardCongratsRank = !Number.isNaN(newRank) && newRank > 0 ? buildRankCard(end, translate) : undefined;
|
|
270
|
+
const skillRef = progression.content.ref;
|
|
271
|
+
const buttonRevising = state.ui.showButtonRevising
|
|
272
|
+
? {
|
|
273
|
+
'aria-label': translate('Continue reviewing'),
|
|
274
|
+
label: translate('Continue reviewing'),
|
|
275
|
+
onClick: () => {
|
|
276
|
+
dispatch(postProgression(skillRef));
|
|
277
|
+
},
|
|
278
|
+
type: 'tertiary'
|
|
279
|
+
}
|
|
280
|
+
: undefined;
|
|
281
|
+
const buttonRevisingSkill = {
|
|
282
|
+
'aria-label': translate('Revise another skill'),
|
|
283
|
+
label: translate('Revise another skill'),
|
|
284
|
+
onClick: onQuitClick,
|
|
285
|
+
type: 'primary'
|
|
286
|
+
};
|
|
268
287
|
return {
|
|
269
288
|
'aria-label': 'Review Congratulations',
|
|
270
289
|
'data-name': 'review-congrats',
|
|
@@ -272,8 +291,8 @@ const buildCongratsProps = (state, translate) => {
|
|
|
272
291
|
title: translate('Congratulations!'),
|
|
273
292
|
cardCongratsStar,
|
|
274
293
|
cardCongratsRank,
|
|
275
|
-
buttonRevising
|
|
276
|
-
buttonRevisingSkill
|
|
294
|
+
buttonRevising,
|
|
295
|
+
buttonRevisingSkill
|
|
277
296
|
};
|
|
278
297
|
};
|
|
279
298
|
const isEndOfProgression = (progression) => {
|
|
@@ -313,7 +332,7 @@ export const mapStateToSlidesProps = (state, dispatch, options) => {
|
|
|
313
332
|
getCorrectionPopinProps(dispatch)(isCorrect, correction.correctAnswer, klf, translate),
|
|
314
333
|
endReview: endReview && state.ui.showCongrats
|
|
315
334
|
},
|
|
316
|
-
congrats: buildCongratsProps(state,
|
|
335
|
+
congrats: buildCongratsProps(state, dispatch, options),
|
|
317
336
|
quitPopin: showQuitPopin ? buildQuitPopinProps(dispatch)(onQuitClick, translate) : undefined
|
|
318
337
|
};
|
|
319
338
|
};
|
|
@@ -4,6 +4,9 @@ import type { StoreState } from '../../reducers';
|
|
|
4
4
|
export declare const POST_PROGRESSION_REQUEST: "@@progression/POST_REQUEST";
|
|
5
5
|
export declare const POST_PROGRESSION_SUCCESS: "@@progression/POST_SUCCESS";
|
|
6
6
|
export declare const POST_PROGRESSION_FAILURE: "@@progression/POST_FAILURE";
|
|
7
|
+
export declare type FetchProgression = {
|
|
8
|
+
type: typeof POST_PROGRESSION_REQUEST;
|
|
9
|
+
};
|
|
7
10
|
export declare type ReceivedProgression = {
|
|
8
11
|
type: typeof POST_PROGRESSION_SUCCESS;
|
|
9
12
|
payload: ProgressionFromAPI;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CorrectionFromAPI } from '../../types/common';
|
|
2
2
|
import { ReceivedCorrection, FetchCorrection } from '../../actions/api/fetch-correction';
|
|
3
|
+
import { FetchProgression } from '../../actions/api/post-progression';
|
|
3
4
|
export declare type CorrectionsState = Record<string, CorrectionFromAPI>;
|
|
4
5
|
export declare type CorrectionsAction = ReceivedCorrection | FetchCorrection;
|
|
5
|
-
declare const reducer: (state: CorrectionsState | undefined, action: CorrectionsAction) => CorrectionsState;
|
|
6
|
+
declare const reducer: (state: CorrectionsState | undefined, action: CorrectionsAction | FetchProgression) => CorrectionsState;
|
|
6
7
|
export default reducer;
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const set_1 = __importDefault(require("lodash/fp/set"));
|
|
7
7
|
const fetch_correction_1 = require("../../actions/api/fetch-correction");
|
|
8
|
+
const post_progression_1 = require("../../actions/api/post-progression");
|
|
8
9
|
const initialState = {};
|
|
9
10
|
const reducer = (
|
|
10
11
|
// eslint-disable-next-line default-param-last
|
|
@@ -19,6 +20,9 @@ state = initialState, action) => {
|
|
|
19
20
|
const correction = action.payload;
|
|
20
21
|
return (0, set_1.default)([meta.slideRef], correction, state);
|
|
21
22
|
}
|
|
23
|
+
case post_progression_1.POST_PROGRESSION_REQUEST: {
|
|
24
|
+
return initialState;
|
|
25
|
+
}
|
|
22
26
|
default:
|
|
23
27
|
return state;
|
|
24
28
|
}
|
|
@@ -19,5 +19,5 @@ declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
|
19
19
|
slides: SlidesState;
|
|
20
20
|
token: string;
|
|
21
21
|
rank: RankState;
|
|
22
|
-
}>, import("
|
|
22
|
+
}>, import("../../actions/api/post-progression").FetchProgression | import("../../actions/api/post-progression").ReceivedProgression | import("./corrections").CorrectionsAction | import("../../actions/api/fetch-rank").RankAction | import("../../actions/api/post-answer").PostAnswerSuccessAction | import("../../actions/api/fetch-skills").ReceivedSkills | import("./slides").SlidesAction | import("../../actions/data/token").StoreToken>;
|
|
23
23
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PostAnswerSuccessAction } from '../../actions/api/post-answer';
|
|
2
|
-
import { ReceivedProgression } from '../../actions/api/post-progression';
|
|
2
|
+
import { FetchProgression, ReceivedProgression } from '../../actions/api/post-progression';
|
|
3
3
|
import { ProgressionFromAPI } from '../../types/common';
|
|
4
4
|
export declare type ProgressionState = ProgressionFromAPI | null;
|
|
5
|
-
declare const reducer: (state: ProgressionState | undefined, action: ReceivedProgression | PostAnswerSuccessAction) => ProgressionState;
|
|
5
|
+
declare const reducer: (state: ProgressionState | undefined, action: ReceivedProgression | PostAnswerSuccessAction | FetchProgression) => ProgressionState;
|
|
6
6
|
export default reducer;
|
|
@@ -2,15 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const post_answer_1 = require("../../actions/api/post-answer");
|
|
4
4
|
const post_progression_1 = require("../../actions/api/post-progression");
|
|
5
|
+
const initialState = null;
|
|
5
6
|
const reducer = (
|
|
6
7
|
// eslint-disable-next-line default-param-last
|
|
7
|
-
state =
|
|
8
|
+
state = initialState, action) => {
|
|
8
9
|
switch (action.type) {
|
|
9
10
|
case post_answer_1.POST_ANSWER_SUCCESS:
|
|
10
11
|
case post_progression_1.POST_PROGRESSION_SUCCESS: {
|
|
11
12
|
const progression = action.payload;
|
|
12
13
|
return progression;
|
|
13
14
|
}
|
|
15
|
+
case post_progression_1.POST_PROGRESSION_REQUEST: {
|
|
16
|
+
return initialState;
|
|
17
|
+
}
|
|
14
18
|
default:
|
|
15
19
|
return state;
|
|
16
20
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type FetchProgression } from '../../actions/api/post-progression';
|
|
2
2
|
import { RankAction } from '../../actions/api/fetch-rank';
|
|
3
3
|
export declare type RankState = {
|
|
4
4
|
start: number;
|
|
5
5
|
end: number;
|
|
6
6
|
};
|
|
7
|
-
declare const reducer: (state: RankState | undefined, action: RankAction |
|
|
7
|
+
declare const reducer: (state: RankState | undefined, action: RankAction | FetchProgression) => RankState;
|
|
8
8
|
export default reducer;
|
|
@@ -14,7 +14,7 @@ const reducer = (
|
|
|
14
14
|
// eslint-disable-next-line default-param-last
|
|
15
15
|
state = initialState, action) => {
|
|
16
16
|
switch (action.type) {
|
|
17
|
-
case post_progression_1.
|
|
17
|
+
case post_progression_1.POST_PROGRESSION_REQUEST: {
|
|
18
18
|
return initialState;
|
|
19
19
|
}
|
|
20
20
|
case fetch_rank_1.RANK_FETCH_START_SUCCESS: {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const fetch_skills_1 = require("../../actions/api/fetch-skills");
|
|
4
|
+
const initialState = [];
|
|
5
|
+
const reducer = (
|
|
4
6
|
// eslint-disable-next-line default-param-last
|
|
5
|
-
|
|
7
|
+
state = initialState, action) => {
|
|
6
8
|
switch (action.type) {
|
|
7
9
|
case fetch_skills_1.SKILLS_FETCH_SUCCESS:
|
|
8
10
|
return action.payload;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ReceivedSlide, FetchSlide } from '../../actions/api/fetch-slide';
|
|
2
|
+
import { FetchProgression } from '../../actions/api/post-progression';
|
|
2
3
|
import { SlideFromAPI } from '../../types/common';
|
|
3
4
|
export declare type SlidesAction = FetchSlide | ReceivedSlide;
|
|
4
5
|
export declare type SlidesState = Record<string, SlideFromAPI | null>;
|
|
5
6
|
export declare const initialState: SlidesState;
|
|
6
|
-
declare const reducer: (state: SlidesState | undefined, action: SlidesAction) => SlidesState;
|
|
7
|
+
declare const reducer: (state: SlidesState | undefined, action: SlidesAction | FetchProgression) => SlidesState;
|
|
7
8
|
export default reducer;
|
|
@@ -6,9 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.initialState = void 0;
|
|
7
7
|
const set_1 = __importDefault(require("lodash/fp/set"));
|
|
8
8
|
const fetch_slide_1 = require("../../actions/api/fetch-slide");
|
|
9
|
+
const post_progression_1 = require("../../actions/api/post-progression");
|
|
9
10
|
exports.initialState = {};
|
|
11
|
+
const reducer = (
|
|
10
12
|
// eslint-disable-next-line default-param-last
|
|
11
|
-
|
|
13
|
+
state = exports.initialState, action) => {
|
|
12
14
|
switch (action.type) {
|
|
13
15
|
case fetch_slide_1.SLIDE_FETCH_REQUEST: {
|
|
14
16
|
const { meta } = action;
|
|
@@ -18,6 +20,9 @@ const reducer = (state = exports.initialState, action) => {
|
|
|
18
20
|
const slide = action.payload;
|
|
19
21
|
return (0, set_1.default)([slide._id], slide, state);
|
|
20
22
|
}
|
|
23
|
+
case post_progression_1.POST_PROGRESSION_REQUEST: {
|
|
24
|
+
return exports.initialState;
|
|
25
|
+
}
|
|
21
26
|
default:
|
|
22
27
|
return state;
|
|
23
28
|
}
|
package/lib/reducers/index.d.ts
CHANGED
|
@@ -20,9 +20,10 @@ declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
|
20
20
|
slide: import("./ui/slide").UISlideState;
|
|
21
21
|
positions: import("./ui/positions").UIPositionState;
|
|
22
22
|
showQuitPopin: boolean;
|
|
23
|
+
showButtonRevising: boolean;
|
|
23
24
|
showCongrats: boolean;
|
|
24
25
|
}>;
|
|
25
|
-
}>, import("
|
|
26
|
+
}>, import("../actions/ui/slides").SetCurrentSlideAction | import("../actions/api/post-progression").FetchProgression | import("../actions/api/post-progression").ReceivedProgression | import("./data/corrections").CorrectionsAction | import("../actions/api/fetch-rank").RankAction | import("../actions/api/fetch-slides-to-review-by-skill-ref").ReceivedSlidesToReviewBySkillRef | import("../actions/api/post-answer").PostAnswerRequestAction | import("../actions/api/post-answer").PostAnswerSuccessAction | import("../actions/api/fetch-skills").ReceivedSkills | import("./data/slides").SlidesAction | import("../actions/data/token").StoreToken | import("../actions/ui/next-slide").NextSlideAction | import("../actions/ui/navigation").NavigateToAction | import("../actions/ui/navigation").NavigateBackAction | import("../actions/ui/answers").EditAnswerAction | {
|
|
26
27
|
type: "@@ui/OPEN_POPIN";
|
|
27
28
|
} | {
|
|
28
29
|
type: "@@ui/CLOSE_POPIN";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { EditAnswerAction } from '../../actions/ui/answers';
|
|
2
2
|
import { NextSlideAction } from '../../actions/ui/next-slide';
|
|
3
|
+
import { FetchProgression } from '../../actions/api/post-progression';
|
|
3
4
|
export declare type UISlideAnswer = string[];
|
|
4
5
|
export declare type UIAnswerState = Record<string, UISlideAnswer>;
|
|
5
6
|
export declare const initialState: UIAnswerState;
|
|
6
|
-
declare const reducer: (state: UIAnswerState | undefined, action: EditAnswerAction | NextSlideAction) => UIAnswerState;
|
|
7
|
+
declare const reducer: (state: UIAnswerState | undefined, action: EditAnswerAction | NextSlideAction | FetchProgression) => UIAnswerState;
|
|
7
8
|
export default reducer;
|
|
@@ -4,6 +4,7 @@ exports.initialState = void 0;
|
|
|
4
4
|
const fp_1 = require("lodash/fp");
|
|
5
5
|
const answers_1 = require("../../actions/ui/answers");
|
|
6
6
|
const next_slide_1 = require("../../actions/ui/next-slide");
|
|
7
|
+
const post_progression_1 = require("../../actions/api/post-progression");
|
|
7
8
|
exports.initialState = {};
|
|
8
9
|
const reducer = (
|
|
9
10
|
// eslint-disable-next-line default-param-last
|
|
@@ -20,6 +21,9 @@ state = exports.initialState, action) => {
|
|
|
20
21
|
case next_slide_1.NEXT_SLIDE: {
|
|
21
22
|
return (0, fp_1.set)([action.payload.nextSlideRef], [], state);
|
|
22
23
|
}
|
|
24
|
+
case post_progression_1.POST_PROGRESSION_REQUEST: {
|
|
25
|
+
return exports.initialState;
|
|
26
|
+
}
|
|
23
27
|
default:
|
|
24
28
|
return state;
|
|
25
29
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NextSlideAction } from '../../actions/ui/next-slide';
|
|
2
2
|
import { SetCurrentSlideAction } from '../../actions/ui/slides';
|
|
3
|
+
import { FetchProgression } from '../../actions/api/post-progression';
|
|
3
4
|
export declare type CurrentSlideRefState = string;
|
|
4
|
-
declare const reducer: (state: string | undefined, action: SetCurrentSlideAction | NextSlideAction) => CurrentSlideRefState;
|
|
5
|
+
declare const reducer: (state: string | undefined, action: SetCurrentSlideAction | NextSlideAction | FetchProgression) => CurrentSlideRefState;
|
|
5
6
|
export default reducer;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const next_slide_1 = require("../../actions/ui/next-slide");
|
|
4
4
|
const slides_1 = require("../../actions/ui/slides");
|
|
5
|
+
const post_progression_1 = require("../../actions/api/post-progression");
|
|
5
6
|
const reducer = (
|
|
6
7
|
// eslint-disable-next-line default-param-last
|
|
7
8
|
state = '', action) => {
|
|
@@ -11,6 +12,9 @@ state = '', action) => {
|
|
|
11
12
|
case slides_1.SET_CURRENT_SLIDE: {
|
|
12
13
|
return action.payload._id;
|
|
13
14
|
}
|
|
15
|
+
case post_progression_1.POST_PROGRESSION_REQUEST: {
|
|
16
|
+
return '';
|
|
17
|
+
}
|
|
14
18
|
default:
|
|
15
19
|
return state;
|
|
16
20
|
}
|
|
@@ -4,6 +4,7 @@ import { UIAnswerState } from './answers';
|
|
|
4
4
|
import { UIPositionState } from './positions';
|
|
5
5
|
import { UISlideState } from './slide';
|
|
6
6
|
import { type ShowQuitPopinState } from './quit-popin';
|
|
7
|
+
import { UIShowButtonRevisingState } from './show-button-revising';
|
|
7
8
|
import { UIShowCongratsState } from './show-congrats';
|
|
8
9
|
export declare type UIState = {
|
|
9
10
|
currentSlideRef: CurrentSlideRefState;
|
|
@@ -12,6 +13,7 @@ export declare type UIState = {
|
|
|
12
13
|
slide: UISlideState;
|
|
13
14
|
positions: UIPositionState;
|
|
14
15
|
showQuitPopin: ShowQuitPopinState;
|
|
16
|
+
showButtonRevising: UIShowButtonRevisingState;
|
|
15
17
|
showCongrats: UIShowCongratsState;
|
|
16
18
|
};
|
|
17
19
|
declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
@@ -21,8 +23,9 @@ declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
|
21
23
|
slide: UISlideState;
|
|
22
24
|
positions: UIPositionState;
|
|
23
25
|
showQuitPopin: boolean;
|
|
26
|
+
showButtonRevising: boolean;
|
|
24
27
|
showCongrats: boolean;
|
|
25
|
-
}>, import("../../actions/api/fetch-correction").ReceivedCorrection | import("../../actions/ui/slides").SetCurrentSlideAction | import("../../actions/api/fetch-slide").FetchSlide | import("../../actions/api/post-
|
|
28
|
+
}>, import("../../actions/api/fetch-correction").ReceivedCorrection | import("../../actions/ui/slides").SetCurrentSlideAction | import("../../actions/api/fetch-slide").FetchSlide | import("../../actions/api/post-progression").FetchProgression | import("../../actions/api/post-progression").ReceivedProgression | import("../../actions/api/fetch-slides-to-review-by-skill-ref").ReceivedSlidesToReviewBySkillRef | import("../../actions/api/post-answer").PostAnswerRequestAction | import("../../actions/ui/next-slide").NextSlideAction | import("../../actions/ui/navigation").NavigateToAction | import("../../actions/ui/navigation").NavigateBackAction | import("../../actions/ui/answers").EditAnswerAction | {
|
|
26
29
|
type: "@@ui/OPEN_POPIN";
|
|
27
30
|
} | {
|
|
28
31
|
type: "@@ui/CLOSE_POPIN";
|
package/lib/reducers/ui/index.js
CHANGED
|
@@ -10,6 +10,7 @@ const answers_1 = __importDefault(require("./answers"));
|
|
|
10
10
|
const positions_1 = __importDefault(require("./positions"));
|
|
11
11
|
const slide_1 = __importDefault(require("./slide"));
|
|
12
12
|
const quit_popin_1 = __importDefault(require("./quit-popin"));
|
|
13
|
+
const show_button_revising_1 = __importDefault(require("./show-button-revising"));
|
|
13
14
|
const show_congrats_1 = __importDefault(require("./show-congrats"));
|
|
14
15
|
exports.default = (0, redux_1.combineReducers)({
|
|
15
16
|
currentSlideRef: current_slide_ref_1.default,
|
|
@@ -18,5 +19,6 @@ exports.default = (0, redux_1.combineReducers)({
|
|
|
18
19
|
slide: slide_1.default,
|
|
19
20
|
positions: positions_1.default,
|
|
20
21
|
showQuitPopin: quit_popin_1.default,
|
|
22
|
+
showButtonRevising: show_button_revising_1.default,
|
|
21
23
|
showCongrats: show_congrats_1.default
|
|
22
24
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReceivedProgression } from '../../actions/api/post-progression';
|
|
1
|
+
import { FetchProgression, ReceivedProgression } from '../../actions/api/post-progression';
|
|
2
2
|
import { NextSlideAction } from '../../actions/ui/next-slide';
|
|
3
3
|
export declare type UIPositionState = number[];
|
|
4
|
-
declare const reducer: (state: UIPositionState | undefined, action: NextSlideAction | ReceivedProgression) => UIPositionState;
|
|
4
|
+
declare const reducer: (state: UIPositionState | undefined, action: NextSlideAction | ReceivedProgression | FetchProgression) => UIPositionState;
|
|
5
5
|
export default reducer;
|
|
@@ -25,6 +25,9 @@ state = initialState, action) => {
|
|
|
25
25
|
const newState = (0, map_1.default)(position => (position === -1 ? position : position - 1), state);
|
|
26
26
|
return (0, set_1.default)([`${currentSlideIndex}`], nextCurrentSlidePosition)(newState);
|
|
27
27
|
}
|
|
28
|
+
case post_progression_1.POST_PROGRESSION_REQUEST: {
|
|
29
|
+
return initialState;
|
|
30
|
+
}
|
|
28
31
|
default:
|
|
29
32
|
return state;
|
|
30
33
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ReceivedSlidesToReviewBySkillRef } from '../../actions/api/fetch-slides-to-review-by-skill-ref';
|
|
2
|
+
import { FetchProgression } from '../../actions/api/post-progression';
|
|
3
|
+
export declare type UIShowButtonRevisingState = boolean;
|
|
4
|
+
declare const reducer: (state: boolean | undefined, action: ReceivedSlidesToReviewBySkillRef | FetchProgression) => UIShowButtonRevisingState;
|
|
5
|
+
export default reducer;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fetch_slides_to_review_by_skill_ref_1 = require("../../actions/api/fetch-slides-to-review-by-skill-ref");
|
|
4
|
+
const post_progression_1 = require("../../actions/api/post-progression");
|
|
5
|
+
const reducer = (
|
|
6
|
+
// eslint-disable-next-line default-param-last
|
|
7
|
+
state = false, action) => {
|
|
8
|
+
switch (action.type) {
|
|
9
|
+
case fetch_slides_to_review_by_skill_ref_1.SLIDES_TO_REVIEW_FETCH_SUCCESS: {
|
|
10
|
+
return action.payload.length === 5;
|
|
11
|
+
}
|
|
12
|
+
case post_progression_1.POST_PROGRESSION_REQUEST: {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
default:
|
|
16
|
+
return state;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.default = reducer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NextSlideAction } from '../../actions/ui/next-slide';
|
|
2
|
-
import {
|
|
2
|
+
import { FetchProgression } from '../../actions/api/post-progression';
|
|
3
3
|
export declare type UIShowCongratsState = boolean;
|
|
4
|
-
declare const reducer: (state: boolean | undefined, action: NextSlideAction |
|
|
4
|
+
declare const reducer: (state: boolean | undefined, action: NextSlideAction | FetchProgression) => UIShowCongratsState;
|
|
5
5
|
export default reducer;
|
|
@@ -6,7 +6,7 @@ const reducer = (
|
|
|
6
6
|
// eslint-disable-next-line default-param-last
|
|
7
7
|
state = false, action) => {
|
|
8
8
|
switch (action.type) {
|
|
9
|
-
case post_progression_1.
|
|
9
|
+
case post_progression_1.POST_PROGRESSION_REQUEST: {
|
|
10
10
|
return false;
|
|
11
11
|
}
|
|
12
12
|
case next_slide_1.NEXT_SLIDE: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EditAnswerAction } from '../../actions/ui/answers';
|
|
2
2
|
import { PostAnswerRequestAction } from '../../actions/api/post-answer';
|
|
3
3
|
import { ReceivedCorrection } from '../../actions/api/fetch-correction';
|
|
4
|
+
import { FetchProgression } from '../../actions/api/post-progression';
|
|
4
5
|
import { FetchSlide } from '../../actions/api/fetch-slide';
|
|
5
6
|
import { NextSlideAction } from '../../actions/ui/next-slide';
|
|
6
7
|
import { SlideUIAnimations } from '../../types/slides';
|
|
@@ -12,5 +13,5 @@ export declare type UISlide = {
|
|
|
12
13
|
};
|
|
13
14
|
export declare type UISlideState = Record<string, UISlide>;
|
|
14
15
|
export declare const initialState: UISlideState;
|
|
15
|
-
declare const reducer: (state: UISlideState | undefined, action: FetchSlide | PostAnswerRequestAction | EditAnswerAction | ReceivedCorrection | NextSlideAction) => UISlideState;
|
|
16
|
+
declare const reducer: (state: UISlideState | undefined, action: FetchSlide | PostAnswerRequestAction | EditAnswerAction | ReceivedCorrection | NextSlideAction | FetchProgression) => UISlideState;
|
|
16
17
|
export default reducer;
|
package/lib/reducers/ui/slide.js
CHANGED
|
@@ -12,6 +12,7 @@ const unset_1 = __importDefault(require("lodash/fp/unset"));
|
|
|
12
12
|
const answers_1 = require("../../actions/ui/answers");
|
|
13
13
|
const post_answer_1 = require("../../actions/api/post-answer");
|
|
14
14
|
const fetch_correction_1 = require("../../actions/api/fetch-correction");
|
|
15
|
+
const post_progression_1 = require("../../actions/api/post-progression");
|
|
15
16
|
const fetch_slide_1 = require("../../actions/api/fetch-slide");
|
|
16
17
|
const next_slide_1 = require("../../actions/ui/next-slide");
|
|
17
18
|
exports.initialState = {};
|
|
@@ -46,6 +47,9 @@ state = exports.initialState, action) => {
|
|
|
46
47
|
return state;
|
|
47
48
|
return (0, pipe_1.default)((0, set_1.default)([currentSlideRef, 'animateCorrectionPopin'], false), (0, set_1.default)([currentSlideRef, 'animationType'], action.payload.animationType))(state);
|
|
48
49
|
}
|
|
50
|
+
case post_progression_1.POST_PROGRESSION_REQUEST: {
|
|
51
|
+
return exports.initialState;
|
|
52
|
+
}
|
|
49
53
|
default:
|
|
50
54
|
return state;
|
|
51
55
|
}
|
|
@@ -15,6 +15,7 @@ const join_1 = __importDefault(require("lodash/fp/join"));
|
|
|
15
15
|
const quit_popin_1 = require("../../actions/ui/quit-popin");
|
|
16
16
|
const common_1 = require("../../common");
|
|
17
17
|
const post_answer_1 = require("../../actions/api/post-answer");
|
|
18
|
+
const post_progression_1 = require("../../actions/api/post-progression");
|
|
18
19
|
const next_slide_1 = require("../../actions/ui/next-slide");
|
|
19
20
|
const map_api_slide_to_ui_1 = require("./map-api-slide-to-ui");
|
|
20
21
|
const ICON_VALUES = {
|
|
@@ -242,9 +243,10 @@ const buildRankCard = (rank, translate) => {
|
|
|
242
243
|
timerAnimation: 200
|
|
243
244
|
};
|
|
244
245
|
};
|
|
245
|
-
const buildCongratsProps = (state,
|
|
246
|
+
const buildCongratsProps = (state, dispatch, options) => {
|
|
246
247
|
if (!state.ui.showCongrats)
|
|
247
248
|
return;
|
|
249
|
+
const { translate, onQuitClick } = options;
|
|
248
250
|
const progression = state.data.progression;
|
|
249
251
|
const stars = progression.state.stars;
|
|
250
252
|
const cardCongratsStar = {
|
|
@@ -272,6 +274,23 @@ const buildCongratsProps = (state, translate) => {
|
|
|
272
274
|
const { start, end } = state.data.rank;
|
|
273
275
|
const newRank = start - end;
|
|
274
276
|
const cardCongratsRank = !Number.isNaN(newRank) && newRank > 0 ? buildRankCard(end, translate) : undefined;
|
|
277
|
+
const skillRef = progression.content.ref;
|
|
278
|
+
const buttonRevising = state.ui.showButtonRevising
|
|
279
|
+
? {
|
|
280
|
+
'aria-label': translate('Continue reviewing'),
|
|
281
|
+
label: translate('Continue reviewing'),
|
|
282
|
+
onClick: () => {
|
|
283
|
+
dispatch((0, post_progression_1.postProgression)(skillRef));
|
|
284
|
+
},
|
|
285
|
+
type: 'tertiary'
|
|
286
|
+
}
|
|
287
|
+
: undefined;
|
|
288
|
+
const buttonRevisingSkill = {
|
|
289
|
+
'aria-label': translate('Revise another skill'),
|
|
290
|
+
label: translate('Revise another skill'),
|
|
291
|
+
onClick: onQuitClick,
|
|
292
|
+
type: 'primary'
|
|
293
|
+
};
|
|
275
294
|
return {
|
|
276
295
|
'aria-label': 'Review Congratulations',
|
|
277
296
|
'data-name': 'review-congrats',
|
|
@@ -279,8 +298,8 @@ const buildCongratsProps = (state, translate) => {
|
|
|
279
298
|
title: translate('Congratulations!'),
|
|
280
299
|
cardCongratsStar,
|
|
281
300
|
cardCongratsRank,
|
|
282
|
-
buttonRevising
|
|
283
|
-
buttonRevisingSkill
|
|
301
|
+
buttonRevising,
|
|
302
|
+
buttonRevisingSkill
|
|
284
303
|
};
|
|
285
304
|
};
|
|
286
305
|
const isEndOfProgression = (progression) => {
|
|
@@ -320,7 +339,7 @@ const mapStateToSlidesProps = (state, dispatch, options) => {
|
|
|
320
339
|
getCorrectionPopinProps(dispatch)(isCorrect, correction.correctAnswer, klf, translate),
|
|
321
340
|
endReview: endReview && state.ui.showCongrats
|
|
322
341
|
},
|
|
323
|
-
congrats: buildCongratsProps(state,
|
|
342
|
+
congrats: buildCongratsProps(state, dispatch, options),
|
|
324
343
|
quitPopin: showQuitPopin ? buildQuitPopinProps(dispatch)(onQuitClick, translate) : undefined
|
|
325
344
|
};
|
|
326
345
|
};
|
package/locales/bs/review.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
"Review Title": "
|
|
3
|
-
"Content Parent Title": "
|
|
4
|
-
"Validate": "
|
|
5
|
-
"Next
|
|
6
|
-
"KLF": "
|
|
7
|
-
"Correct Answer": "
|
|
8
|
-
"Wrong Answer": "
|
|
9
|
-
"You have won": "
|
|
10
|
-
"You are now": "
|
|
11
|
-
"Revise another skill": "
|
|
12
|
-
"Continue reviewing": "
|
|
13
|
-
"Congratulations!": "
|
|
2
|
+
"Review Title": "Recenzija Mode",
|
|
3
|
+
"Content Parent Title": "Od `{{contentTitle}}` `{{contentType}}`",
|
|
4
|
+
"Validate": "Potvrdi",
|
|
5
|
+
"Next question": "Sljedeće pitanje",
|
|
6
|
+
"KLF": "Ključni faktor učenja",
|
|
7
|
+
"Correct Answer": "Tačan odgovor",
|
|
8
|
+
"Wrong Answer": "Pogrešan odgovor",
|
|
9
|
+
"You have won": "Pobijedio si",
|
|
10
|
+
"You are now": "Sada jesi",
|
|
11
|
+
"Revise another skill": "Revidirajte drugu vještinu",
|
|
12
|
+
"Continue reviewing": "Nastavite sa pregledom",
|
|
13
|
+
"Congratulations!": "Čestitamo!",
|
|
14
14
|
"Quit Title": "Are you sure you want to quit ?",
|
|
15
15
|
"Quit Description Text": "You’re right on track! If you quit now, you’ll lose your progress.",
|
|
16
16
|
"Stop learning": "End session",
|
package/locales/hy/review.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
"Review Title": "
|
|
3
|
-
"Content Parent Title": "
|
|
4
|
-
"Validate": "
|
|
5
|
-
"Next
|
|
6
|
-
"KLF": "
|
|
7
|
-
"Correct Answer": "
|
|
8
|
-
"Wrong Answer": "
|
|
9
|
-
"You have won": "
|
|
10
|
-
"You are now": "
|
|
11
|
-
"Revise another skill": "
|
|
12
|
-
"Continue reviewing": "
|
|
13
|
-
"Congratulations!": "
|
|
2
|
+
"Review Title": "Վերանայման ռեժիմ",
|
|
3
|
+
"Content Parent Title": "'{{contentTitle}}՝ ՝{{contentType}}՝-ից",
|
|
4
|
+
"Validate": "Վավերացնել",
|
|
5
|
+
"Next question": "Հաջորդ Հարցը",
|
|
6
|
+
"KLF": "Հիմնական ուսուցման գործոնը",
|
|
7
|
+
"Correct Answer": "Ճիշտ պատասխան",
|
|
8
|
+
"Wrong Answer": "Սխալ պատասխանը",
|
|
9
|
+
"You have won": "Դու հաղթել ես",
|
|
10
|
+
"You are now": "Դուք հիմա եք",
|
|
11
|
+
"Revise another skill": "Վերանայեք մեկ այլ հմտություն",
|
|
12
|
+
"Continue reviewing": "Շարունակեք վերանայել",
|
|
13
|
+
"Congratulations!": "Շնորհավորում եմ:",
|
|
14
14
|
"Quit Title": "Are you sure you want to quit ?",
|
|
15
15
|
"Quit Description Text": "You’re right on track! If you quit now, you’ll lose your progress.",
|
|
16
16
|
"Stop learning": "End session",
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
"Review Title": "
|
|
3
|
-
"Content Parent Title": "
|
|
4
|
-
"Validate": "
|
|
5
|
-
"Next
|
|
6
|
-
"KLF": "
|
|
7
|
-
"Correct Answer": "
|
|
8
|
-
"Wrong Answer": "
|
|
9
|
-
"You have won": "
|
|
10
|
-
"You are now": "
|
|
11
|
-
"Revise another skill": "
|
|
12
|
-
"Continue reviewing": "
|
|
13
|
-
"Congratulations!": "
|
|
2
|
+
"Review Title": "檢閱模式",
|
|
3
|
+
"Content Parent Title": "來自 `{{contentTitle}}` `{{contentType}}`",
|
|
4
|
+
"Validate": "驗證",
|
|
5
|
+
"Next question": "下個問題",
|
|
6
|
+
"KLF": "關鍵學習因素",
|
|
7
|
+
"Correct Answer": "正確答案",
|
|
8
|
+
"Wrong Answer": "錯誤答案",
|
|
9
|
+
"You have won": "你贏了",
|
|
10
|
+
"You are now": "您現在是",
|
|
11
|
+
"Revise another skill": "修正其他技能",
|
|
12
|
+
"Continue reviewing": "繼續檢閱",
|
|
13
|
+
"Congratulations!": "恭喜!",
|
|
14
14
|
"Quit Title": "Are you sure you want to quit ?",
|
|
15
15
|
"Quit Description Text": "You’re right on track! If you quit now, you’ll lose your progress.",
|
|
16
16
|
"Stop learning": "End session",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/app-review",
|
|
3
|
-
"version": "0.7.5
|
|
3
|
+
"version": "0.7.5",
|
|
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.27.
|
|
38
|
+
"@coorpacademy/components": "10.27.4",
|
|
39
39
|
"@coorpacademy/redux-task": "1.1.6",
|
|
40
|
-
"@coorpacademy/translate": "6.1.5",
|
|
40
|
+
"@coorpacademy/translate": "^6.1.5",
|
|
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": "9c50f52f6f8d847aeb2fcb6fe072a6311a6a5e56"
|
|
75
75
|
}
|