@coorpacademy/app-review 0.1.13 → 0.1.15

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.
Files changed (174) hide show
  1. package/es/actions/api/fetch-slide.d.ts +3 -3
  2. package/es/actions/api/fetch-slide.js +22 -2
  3. package/es/actions/api/post-progression.js +1 -2
  4. package/es/actions/index.d.ts +1 -10
  5. package/es/actions/ui/is-fetching.js +0 -2
  6. package/es/actions/ui/slides.d.ts +26 -0
  7. package/es/actions/ui/slides.js +9 -0
  8. package/es/common/index.d.ts +3 -1
  9. package/es/common/index.js +3 -1
  10. package/es/fixtures/qcm-slide.d.ts +2 -2
  11. package/es/fixtures/temp-fixture.d.ts +2 -2
  12. package/es/helpers/map-api-slide-to-ui.d.ts +4 -1
  13. package/es/helpers/map-api-slide-to-ui.js +33 -15
  14. package/es/helpers/test/fixtures/free-text.d.ts +2 -3
  15. package/es/helpers/test/fixtures/free-text.js +10 -4
  16. package/es/helpers/test/fixtures/qcm-drag.d.ts +2 -3
  17. package/es/helpers/test/fixtures/qcm-drag.js +38 -32
  18. package/es/helpers/test/fixtures/qcm-graphic.d.ts +2 -3
  19. package/es/helpers/test/fixtures/qcm-graphic.js +20 -14
  20. package/es/helpers/test/fixtures/qcm.d.ts +2 -3
  21. package/es/helpers/test/fixtures/qcm.js +32 -26
  22. package/es/helpers/test/fixtures/select-template.d.ts +2 -3
  23. package/es/helpers/test/fixtures/select-template.js +38 -32
  24. package/es/helpers/test/fixtures/slider.d.ts +2 -3
  25. package/es/helpers/test/fixtures/slider.js +13 -7
  26. package/es/helpers/test/fixtures/text-template.d.ts +2 -3
  27. package/es/helpers/test/fixtures/text-template.js +16 -10
  28. package/es/index.js +14 -78
  29. package/es/reducers/data/index.d.ts +1 -1
  30. package/es/reducers/data/progression.d.ts +3 -16
  31. package/es/reducers/data/progression.js +3 -22
  32. package/es/reducers/data/slides.d.ts +5 -6
  33. package/es/reducers/data/slides.js +4 -107
  34. package/es/reducers/index.d.ts +3 -4
  35. package/es/reducers/ui/current-slide-ref.d.ts +4 -0
  36. package/es/reducers/ui/{review-status.js → current-slide-ref.js} +4 -4
  37. package/es/reducers/ui/index.d.ts +7 -10
  38. package/es/reducers/ui/index.js +4 -6
  39. package/es/reducers/ui/slides.d.ts +9 -0
  40. package/es/reducers/ui/slides.js +42 -0
  41. package/es/services/test/post-progression.test.js +6 -4
  42. package/es/test/util/services.mock.js +17 -5
  43. package/es/types/common.d.ts +40 -23
  44. package/es/types/common.js +0 -5
  45. package/es/types/slides.d.ts +0 -4
  46. package/es/types/views/slides.d.ts +41 -27
  47. package/es/types/views/slides.js +5 -0
  48. package/{lib/types/views/skills.d.ts → es/views/skills/index.d.ts} +2 -0
  49. package/es/views/skills/index.js +25 -0
  50. package/es/views/slides/index.d.ts +3 -0
  51. package/es/views/slides/index.js +85 -0
  52. package/lib/actions/api/fetch-slide.d.ts +3 -3
  53. package/lib/actions/api/fetch-slide.js +20 -2
  54. package/lib/actions/api/post-progression.js +1 -2
  55. package/lib/actions/index.d.ts +1 -10
  56. package/lib/actions/ui/is-fetching.js +0 -2
  57. package/lib/actions/ui/slides.d.ts +26 -0
  58. package/lib/actions/ui/slides.js +9 -0
  59. package/lib/common/index.d.ts +3 -1
  60. package/lib/common/index.js +3 -1
  61. package/lib/fixtures/qcm-slide.d.ts +2 -2
  62. package/lib/fixtures/temp-fixture.d.ts +2 -2
  63. package/lib/helpers/map-api-slide-to-ui.d.ts +4 -1
  64. package/lib/helpers/map-api-slide-to-ui.js +34 -14
  65. package/lib/helpers/test/fixtures/free-text.d.ts +2 -3
  66. package/lib/helpers/test/fixtures/free-text.js +10 -4
  67. package/lib/helpers/test/fixtures/qcm-drag.d.ts +2 -3
  68. package/lib/helpers/test/fixtures/qcm-drag.js +38 -32
  69. package/lib/helpers/test/fixtures/qcm-graphic.d.ts +2 -3
  70. package/lib/helpers/test/fixtures/qcm-graphic.js +20 -14
  71. package/lib/helpers/test/fixtures/qcm.d.ts +2 -3
  72. package/lib/helpers/test/fixtures/qcm.js +32 -26
  73. package/lib/helpers/test/fixtures/select-template.d.ts +2 -3
  74. package/lib/helpers/test/fixtures/select-template.js +38 -32
  75. package/lib/helpers/test/fixtures/slider.d.ts +2 -3
  76. package/lib/helpers/test/fixtures/slider.js +13 -7
  77. package/lib/helpers/test/fixtures/text-template.d.ts +2 -3
  78. package/lib/helpers/test/fixtures/text-template.js +16 -10
  79. package/lib/index.js +14 -78
  80. package/lib/reducers/data/index.d.ts +1 -1
  81. package/lib/reducers/data/progression.d.ts +3 -16
  82. package/lib/reducers/data/progression.js +3 -22
  83. package/lib/reducers/data/slides.d.ts +5 -6
  84. package/lib/reducers/data/slides.js +4 -113
  85. package/lib/reducers/index.d.ts +3 -4
  86. package/lib/reducers/ui/current-slide-ref.d.ts +4 -0
  87. package/lib/reducers/ui/{review-status.js → current-slide-ref.js} +4 -4
  88. package/lib/reducers/ui/index.d.ts +7 -10
  89. package/lib/reducers/ui/index.js +4 -6
  90. package/lib/reducers/ui/slides.d.ts +9 -0
  91. package/lib/reducers/ui/slides.js +43 -0
  92. package/lib/services/test/post-progression.test.js +6 -4
  93. package/lib/test/util/services.mock.js +17 -5
  94. package/lib/types/common.d.ts +40 -23
  95. package/lib/types/common.js +0 -5
  96. package/lib/types/slides.d.ts +0 -4
  97. package/lib/types/views/slides.d.ts +41 -27
  98. package/lib/types/views/slides.js +5 -0
  99. package/{es/types/views/skills.d.ts → lib/views/skills/index.d.ts} +2 -0
  100. package/lib/views/skills/index.js +25 -0
  101. package/lib/views/slides/index.d.ts +3 -0
  102. package/lib/views/slides/index.js +89 -0
  103. package/package.json +3 -3
  104. package/src/actions/api/fetch-slide.ts +26 -5
  105. package/src/actions/api/post-progression.ts +1 -2
  106. package/src/actions/index.ts +1 -10
  107. package/src/actions/ui/is-fetching.ts +0 -6
  108. package/src/actions/ui/slides.ts +35 -0
  109. package/src/common/index.ts +7 -1
  110. package/src/fixtures/qcm-slide.ts +2 -2
  111. package/src/fixtures/temp-fixture.ts +2 -2
  112. package/src/helpers/map-api-slide-to-ui.ts +43 -17
  113. package/src/helpers/test/fixtures/free-text.ts +12 -7
  114. package/src/helpers/test/fixtures/qcm-drag.ts +40 -35
  115. package/src/helpers/test/fixtures/qcm-graphic.ts +22 -17
  116. package/src/helpers/test/fixtures/qcm.ts +38 -32
  117. package/src/helpers/test/fixtures/select-template.ts +40 -35
  118. package/src/helpers/test/fixtures/slider.ts +15 -10
  119. package/src/helpers/test/fixtures/text-template.ts +18 -13
  120. package/src/helpers/test/map-api-slide-to-ui.test.ts +2 -11
  121. package/src/index.tsx +15 -84
  122. package/src/reducers/data/progression.ts +5 -40
  123. package/src/reducers/data/slides.ts +9 -126
  124. package/src/reducers/ui/current-slide-ref.ts +19 -0
  125. package/src/reducers/ui/index.ts +6 -9
  126. package/src/reducers/ui/slides.ts +58 -0
  127. package/src/services/test/post-progression.test.ts +6 -4
  128. package/src/test/util/services.mock.ts +17 -5
  129. package/src/types/common.ts +44 -27
  130. package/src/types/slides.ts +0 -5
  131. package/src/types/views/slides.ts +52 -27
  132. package/src/views/skills/index.ts +56 -0
  133. package/src/views/slides/index.ts +92 -0
  134. package/es/actions/data/slides.d.ts +0 -37
  135. package/es/actions/data/slides.js +0 -16
  136. package/es/actions/ui/finished-slides.d.ts +0 -10
  137. package/es/actions/ui/finished-slides.js +0 -8
  138. package/es/actions/ui/review-status.d.ts +0 -7
  139. package/es/actions/ui/review-status.js +0 -7
  140. package/es/actions/ui/step-items.d.ts +0 -24
  141. package/es/actions/ui/step-items.js +0 -11
  142. package/es/reducers/ui/finished-slides.d.ts +0 -7
  143. package/es/reducers/ui/finished-slides.js +0 -33
  144. package/es/reducers/ui/review-status.d.ts +0 -4
  145. package/es/reducers/ui/step-items.d.ts +0 -14
  146. package/es/reducers/ui/step-items.js +0 -74
  147. package/es/types/ui-progression.d.ts +0 -10
  148. package/es/types/ui-progression.js +0 -1
  149. package/es/types/views/skills.js +0 -1
  150. package/lib/actions/data/slides.d.ts +0 -37
  151. package/lib/actions/data/slides.js +0 -16
  152. package/lib/actions/ui/finished-slides.d.ts +0 -10
  153. package/lib/actions/ui/finished-slides.js +0 -8
  154. package/lib/actions/ui/review-status.d.ts +0 -7
  155. package/lib/actions/ui/review-status.js +0 -7
  156. package/lib/actions/ui/step-items.d.ts +0 -24
  157. package/lib/actions/ui/step-items.js +0 -11
  158. package/lib/reducers/ui/finished-slides.d.ts +0 -7
  159. package/lib/reducers/ui/finished-slides.js +0 -45
  160. package/lib/reducers/ui/review-status.d.ts +0 -4
  161. package/lib/reducers/ui/step-items.d.ts +0 -14
  162. package/lib/reducers/ui/step-items.js +0 -86
  163. package/lib/types/ui-progression.d.ts +0 -10
  164. package/lib/types/ui-progression.js +0 -1
  165. package/lib/types/views/skills.js +0 -1
  166. package/src/actions/data/slides.ts +0 -65
  167. package/src/actions/ui/finished-slides.ts +0 -21
  168. package/src/actions/ui/review-status.ts +0 -19
  169. package/src/actions/ui/step-items.ts +0 -45
  170. package/src/reducers/ui/finished-slides.ts +0 -52
  171. package/src/reducers/ui/review-status.ts +0 -19
  172. package/src/reducers/ui/step-items.ts +0 -116
  173. package/src/types/ui-progression.ts +0 -25
  174. package/src/types/views/skills.ts +0 -27
@@ -7,15 +7,17 @@ const skillRef = '_skill-ref';
7
7
  const result: ProgressionFromAPI = {
8
8
  _id: '123456123456',
9
9
  state: {
10
+ allAnswers: [],
10
11
  isCorrect: true,
11
- step: {
12
- current: 1
13
- },
14
12
  nextContent: {
15
13
  type: 'slide',
16
14
  ref: 'sli_NJ3m5KtWh'
17
15
  },
18
- pendingSlides: []
16
+ pendingSlides: [],
17
+ slides: [],
18
+ step: {
19
+ current: 1
20
+ }
19
21
  }
20
22
  };
21
23
 
@@ -9,12 +9,15 @@ export const services: Services = {
9
9
  slidesToReview: 2,
10
10
  name: 'skill-test',
11
11
  custom: false
12
+ // TODO parentContentTitle
12
13
  },
13
14
  {
14
15
  skillRef: '_skill-ref-2',
15
16
  slidesToReview: 2,
16
17
  name: 'skill-test-2',
17
- custom: true
18
+ custom: true,
19
+ parentContentTitle: 'parentContentTitle 2'
20
+ // TODO parentContentTitle
18
21
  }
19
22
  ]);
20
23
  },
@@ -24,15 +27,24 @@ export const services: Services = {
24
27
  postProgression: () => {
25
28
  return Promise.resolve({
26
29
  _id: '62b1d1087aa12f00253f40ee',
30
+ content: {
31
+ ref: '_skill-ref',
32
+ type: 'skill'
33
+ },
34
+ engine: {
35
+ ref: 'review'
36
+ },
27
37
  state: {
28
- pendingSlides: [],
29
- step: {
30
- current: 1
31
- },
38
+ allAnswers: [],
32
39
  isCorrect: true,
33
40
  nextContent: {
34
41
  ref: 'sli_N1XACJobn',
35
42
  type: 'slide'
43
+ },
44
+ pendingSlides: [],
45
+ slides: [],
46
+ step: {
47
+ current: 1
36
48
  }
37
49
  }
38
50
  });
@@ -1,4 +1,5 @@
1
- import {UISlide} from './slides';
1
+ import {SlideIndexes} from '../common';
2
+ import {AnswerUI} from './slides';
2
3
 
3
4
  // TODO use type from components
4
5
  type TemplateContextValues = {
@@ -83,22 +84,36 @@ export type SlideFromAPI = {
83
84
  tips?: string;
84
85
  clue?: string;
85
86
  hasClue?: boolean;
86
- id?: string;
87
+ id: string;
88
+ };
89
+
90
+ type ProgressionAnswerItem = {
91
+ isCorrect: boolean;
92
+ slideRef: string;
93
+ answer: string[];
94
+ };
95
+
96
+ export type ProgressionState = {
97
+ allAnswers: ProgressionAnswerItem[];
98
+ content?: {
99
+ ref: string;
100
+ type: string;
101
+ };
102
+ isCorrect: boolean;
103
+ nextContent: {
104
+ type: 'success' | 'slide';
105
+ ref: 'successExitNode' | string;
106
+ };
107
+ pendingSlides: string[];
108
+ slides: string[];
109
+ step: {
110
+ current: number;
111
+ };
87
112
  };
88
113
 
89
114
  export type ProgressionFromAPI = {
90
115
  _id: string;
91
- state: {
92
- isCorrect: boolean;
93
- step: {
94
- current: number;
95
- };
96
- nextContent: {
97
- type: 'success' | 'slide';
98
- ref: 'successExitNode' | string;
99
- };
100
- pendingSlides: [];
101
- };
116
+ state: ProgressionState;
102
117
  };
103
118
 
104
119
  export type Skill = {
@@ -137,31 +152,33 @@ export type JWT = {
137
152
  host: string;
138
153
  };
139
154
 
140
- // -----------------------------------------------------------------------------
141
155
  type SlideUIAnimations = 'unstack' | 'restack';
142
- export type Slide = UISlide & {
156
+
157
+ export type NextUISlide = {
158
+ questionText?: string;
159
+ answerUI?: AnswerUI;
143
160
  hidden?: boolean;
144
- position: number;
161
+ position?: number;
145
162
  animationType?: SlideUIAnimations;
146
163
  isCorrect?: boolean;
147
164
  endReview?: boolean;
148
- nextContent?: Omit<Slide, 'endReview' | 'hidden' | 'position' | 'nextContent'>;
149
165
  };
150
166
 
151
- const ICON_VALUES = {
152
- right: 'right',
153
- wrong: 'wrong',
154
- 'no-answer': 'no-answer'
155
- } as const;
167
+ export type UISlide = {
168
+ questionText?: string;
169
+ answerUI?: AnswerUI;
170
+ hidden?: boolean;
171
+ position: number;
172
+ animationType?: SlideUIAnimations;
173
+ isCorrect?: boolean;
174
+ endReview?: boolean;
175
+ nextContent?: NextUISlide;
176
+ };
156
177
 
157
- export type IconValue = keyof typeof ICON_VALUES;
158
178
  export type FinishedSlides = {
159
- slideNumbers: number[];
160
- [key: number]: true;
179
+ [key in SlideIndexes]?: true;
161
180
  };
162
181
 
163
- // -----------------------------------------------------------------------------
164
-
165
182
  export type WithRequired<T, K extends keyof T> = T & {
166
183
  // the "-" is a Mapping Modifier, removes optionality from a prop
167
184
  [P in K]-?: T[P];
@@ -94,8 +94,3 @@ export type AnswerUI = {
94
94
  };
95
95
 
96
96
  export type SlideUIAnimations = 'unstack' | 'restack';
97
-
98
- export type UISlide = {
99
- questionText?: string;
100
- answerUI?: AnswerUI;
101
- };
@@ -2,21 +2,58 @@
2
2
  import type {StoreState} from '../../reducers';
3
3
  import {Dispatchers} from '../../actions';
4
4
 
5
+ const ICON_VALUES = {
6
+ right: 'right',
7
+ wrong: 'wrong',
8
+ 'no-answer': 'no-answer'
9
+ } as const;
10
+
11
+ type IconValue = keyof typeof ICON_VALUES;
12
+
13
+ type StepItem = {
14
+ current: boolean;
15
+ icon: IconValue;
16
+ value: string;
17
+ };
18
+
19
+ type CorrectionPopinProps = {
20
+ klf: {
21
+ label: string;
22
+ onClick: Function;
23
+ tooltip: string;
24
+ };
25
+ information: {
26
+ label: string;
27
+ message: string;
28
+ };
29
+ next: {
30
+ label: string;
31
+ ariaLabel: string;
32
+ };
33
+ successLabel: string;
34
+ failureLabel: string;
35
+ };
36
+
5
37
  type SlidesViewStaticProps = {
6
- slides: StoreState['data']['slides'];
7
- headerProps: {
38
+ header: {
8
39
  mode: string;
9
40
  skillName: string;
10
41
  onQuitClick: Function;
11
42
  'aria-label'?: string;
12
43
  closeButtonAriaLabel: string;
44
+ steps: StepItem[];
13
45
  };
14
- finishedSlides: StoreState['ui']['finishedSlides'];
15
- stepItems: StoreState['ui']['stepItems'];
16
- reviewStatus: StoreState['ui']['reviewStatus'];
17
- validate: {
18
- label: string;
46
+ stack: {
47
+ slides: StoreState['ui']['slides'];
48
+ validateButton: {
49
+ label: string;
50
+ disabled: boolean;
51
+ onClick: Function;
52
+ };
53
+ correctionPopinProps?: CorrectionPopinProps;
54
+ endReview: boolean;
19
55
  };
56
+ reviewBackgroundAriaLabel?: string;
20
57
  congratsProps?: {
21
58
  'aria-label'?: string;
22
59
  'data-name'?: string;
@@ -37,29 +74,17 @@ type SlidesViewStaticProps = {
37
74
  type: string;
38
75
  };
39
76
  };
40
- correctionPopinProps?: {
41
- klf: {
42
- label: string;
43
- onClick: Function;
44
- tooltip: string;
45
- };
46
- information: {
47
- label: string;
48
- message: string;
49
- };
50
- next: {
51
- label: string;
52
- ariaLabel: string;
53
- };
54
- successLabel: string;
55
- failureLabel: string;
56
- };
57
- reviewBackgroundAriaLabel?: string;
58
- progression: StoreState['data']['progression'];
59
77
  };
60
78
 
61
79
  type SlidesViewDispatcherProps = Omit<Dispatchers, 'navigateTo' | 'navigateBack'>;
62
80
 
63
81
  type SlidesViewProps = SlidesViewStaticProps & SlidesViewDispatcherProps;
64
82
 
65
- export {SlidesViewStaticProps, SlidesViewDispatcherProps, SlidesViewProps};
83
+ export {
84
+ CorrectionPopinProps,
85
+ IconValue,
86
+ SlidesViewStaticProps,
87
+ SlidesViewDispatcherProps,
88
+ SlidesViewProps,
89
+ StepItem
90
+ };
@@ -0,0 +1,56 @@
1
+ import {StoreState} from '../../reducers';
2
+
3
+ type SkillCard = {
4
+ 'aria-label': string;
5
+ skillTitle: string;
6
+ skillAriaLabel: string;
7
+ buttonLabel: string;
8
+ buttonAriaLabel: string;
9
+ reviseLabel: string;
10
+ reviseAriaLabel: string;
11
+ isCustom: boolean;
12
+ onClick: Function;
13
+ };
14
+
15
+ type NoSkillsProps = {
16
+ titleNoSkills: string;
17
+ textNoSkills: string;
18
+ iconSkillAriaLabel: string;
19
+ };
20
+
21
+ type SkillsProps = NoSkillsProps & {
22
+ 'aria-label'?: string;
23
+ title: string;
24
+ isLoading?: boolean;
25
+ isLoadingAriaLabel: string;
26
+ listSkills: SkillCard[];
27
+ };
28
+
29
+ export {SkillsProps};
30
+
31
+ export const mapStateToSkillsProps = (state: StoreState): SkillsProps | null => {
32
+ if (!state.data.skills) {
33
+ return null;
34
+ }
35
+
36
+ return {
37
+ title: '@todo title',
38
+ titleNoSkills: '@todo titleNoSkills',
39
+ textNoSkills: '@todo textNoSkills',
40
+ iconSkillAriaLabel: '@todo iconSkillAriaLabel',
41
+ isLoading: false,
42
+ isLoadingAriaLabel: '@todo loading',
43
+ listSkills: state.data.skills.map(skill => ({
44
+ 'aria-label': '',
45
+ isCustom: skill.custom,
46
+ skillTitle: skill.name,
47
+ skillAriaLabel: '@todo skill aria label',
48
+ buttonLabel: '@todo button',
49
+ buttonAriaLabel: '@todo button aria label',
50
+ reviseLabel: '@todo revise',
51
+ reviseAriaLabel: '@todo revise aria label',
52
+ // eslint-disable-next-line no-console
53
+ onClick: () => console.log('@todo plug dispatcher select skill')
54
+ }))
55
+ };
56
+ };
@@ -0,0 +1,92 @@
1
+ import isEmpty from 'lodash/fp/isEmpty';
2
+ import {StoreState} from '../../reducers';
3
+ import {SlidesViewStaticProps, StepItem} from '../../types/views/slides';
4
+
5
+ const buildStepItemps = (state: StoreState): StepItem[] => {
6
+ const {progression} = state.data;
7
+ const {currentSlideRef} = state.ui;
8
+ if (!progression) return [];
9
+
10
+ const defaultProps: StepItem[] = [
11
+ {
12
+ icon: 'no-answer',
13
+ current: true,
14
+ value: '1'
15
+ },
16
+ {
17
+ icon: 'no-answer',
18
+ current: false,
19
+ value: '2'
20
+ },
21
+ {
22
+ icon: 'no-answer',
23
+ current: false,
24
+ value: '3'
25
+ },
26
+ {
27
+ icon: 'no-answer',
28
+ current: false,
29
+ value: '4'
30
+ },
31
+ {
32
+ icon: 'no-answer',
33
+ current: false,
34
+ value: '5'
35
+ }
36
+ ];
37
+
38
+ const allAnswers = progression.state.allAnswers;
39
+ const step = progression.state.step;
40
+ if (isEmpty(allAnswers)) return defaultProps;
41
+
42
+ const steps = defaultProps.map((stepItem, index): StepItem => {
43
+ const givenAnswer = allAnswers[index];
44
+ if (!givenAnswer) {
45
+ return {
46
+ ...stepItem,
47
+ current: step.current === index + 1
48
+ };
49
+ }
50
+
51
+ return {
52
+ ...stepItem,
53
+ icon: givenAnswer.isCorrect ? 'right' : 'wrong',
54
+ current: givenAnswer.slideRef === currentSlideRef
55
+ };
56
+ });
57
+ return steps;
58
+ };
59
+
60
+ export const mapStateToSlidesProps = (state: StoreState): SlidesViewStaticProps | null => {
61
+ if (!state.data.slides) {
62
+ return null;
63
+ }
64
+
65
+ return {
66
+ header: {
67
+ mode: '__revision_mode',
68
+ skillName: '__agility',
69
+ onQuitClick: (): void => {
70
+ // eslint-disable-next-line no-console
71
+ console.log('onQuitClick');
72
+ },
73
+ 'aria-label': 'aria-header-wrapper',
74
+ closeButtonAriaLabel: 'aria-close-button',
75
+ steps: buildStepItemps(state)
76
+ },
77
+ stack: {
78
+ slides: state.ui.slides,
79
+ validateButton: {
80
+ label: '__validate',
81
+ disabled: true,
82
+ onClick: (): void => {
83
+ // eslint-disable-next-line no-console
84
+ console.log('TODO: validate question');
85
+ }
86
+ },
87
+ correctionPopinProps: undefined,
88
+ endReview: false
89
+ },
90
+ congratsProps: undefined
91
+ };
92
+ };
@@ -1,37 +0,0 @@
1
- import { UISlide } from '../../types/slides';
2
- import { ReceivedSlide } from '../api/fetch-slide';
3
- export declare const UPDATE_SLIDES_ON_VALIDATION = "@@slide/UPDATE_SLIDES_ON_VALIDATION";
4
- export declare const UPDATE_SLIDES_ON_NEXT = "@@slide/UPDATE_SLIDES_ON_NEXT";
5
- export declare const VALIDATE_SLIDE = "@@slide/VALIDATE";
6
- declare type SlideUIAnimations = 'unstack' | 'restack';
7
- export declare type Slide = UISlide & {
8
- hidden?: boolean;
9
- position: number;
10
- animationType?: SlideUIAnimations;
11
- isCorrect?: boolean;
12
- endReview?: boolean;
13
- nextContent?: Omit<Slide, 'endReview' | 'hidden' | 'position' | 'nextContent'>;
14
- };
15
- export declare type ValidationPayload = {
16
- slideNumber: number;
17
- newSlideContent: Slide;
18
- numberOfFinishedSlides: number;
19
- nextContent: Slide;
20
- };
21
- export declare type OnNextPayload = Omit<ValidationPayload, 'nextContent'>;
22
- export declare type UpdateSlidesOnValidation = {
23
- type: typeof UPDATE_SLIDES_ON_VALIDATION;
24
- payload: ValidationPayload;
25
- };
26
- export declare type UpdateSlidesOnNext = {
27
- type: typeof UPDATE_SLIDES_ON_NEXT;
28
- payload: OnNextPayload;
29
- };
30
- export declare type ValidateSlide = {
31
- type: typeof VALIDATE_SLIDE;
32
- };
33
- export declare type SlidesAction = ReceivedSlide | UpdateSlidesOnValidation | UpdateSlidesOnNext;
34
- export declare const updateSlidesOnValidation: (payload: ValidationPayload) => UpdateSlidesOnValidation;
35
- export declare const updateSlidesOnNext: (payload: OnNextPayload) => UpdateSlidesOnNext;
36
- export declare const validateSlide: () => ValidateSlide;
37
- export {};
@@ -1,16 +0,0 @@
1
- // -----------------------------------------------------------------------------
2
- export const UPDATE_SLIDES_ON_VALIDATION = '@@slide/UPDATE_SLIDES_ON_VALIDATION';
3
- export const UPDATE_SLIDES_ON_NEXT = '@@slide/UPDATE_SLIDES_ON_NEXT';
4
- export const VALIDATE_SLIDE = '@@slide/VALIDATE';
5
- // -----------------------------------------------------------------------------
6
- export const updateSlidesOnValidation = (payload) => ({
7
- type: UPDATE_SLIDES_ON_VALIDATION,
8
- payload
9
- });
10
- export const updateSlidesOnNext = (payload) => ({
11
- type: UPDATE_SLIDES_ON_NEXT,
12
- payload
13
- });
14
- export const validateSlide = () => ({
15
- type: VALIDATE_SLIDE
16
- });
@@ -1,10 +0,0 @@
1
- export declare type FinishedSlide = {
2
- slideNumber: number;
3
- value: true;
4
- };
5
- export declare const UPDATE_FINISHED_SLIDES = "@@finished-slides/UPDATE_FINISHED_SLIDES";
6
- export declare type UpdateFinishedSlides = {
7
- type: typeof UPDATE_FINISHED_SLIDES;
8
- payload: FinishedSlide;
9
- };
10
- export declare const updateFinishedSlides: (payload: FinishedSlide) => UpdateFinishedSlides;
@@ -1,8 +0,0 @@
1
- // Stores only successful slides
2
- // -----------------------------------------------------------------------------
3
- export const UPDATE_FINISHED_SLIDES = '@@finished-slides/UPDATE_FINISHED_SLIDES';
4
- // -----------------------------------------------------------------------------
5
- export const updateFinishedSlides = (payload) => ({
6
- type: UPDATE_FINISHED_SLIDES,
7
- payload
8
- });
@@ -1,7 +0,0 @@
1
- export declare const UPDATE_REVIEW_STATUS = "@@review-status/UPDATE_REVIEW_STATUS";
2
- export declare type FinishedStatus = 'finished';
3
- export declare type UpdateReviewStatus = {
4
- type: typeof UPDATE_REVIEW_STATUS;
5
- payload: FinishedStatus;
6
- };
7
- export declare const updateReviewStatus: (payload: FinishedStatus) => UpdateReviewStatus;
@@ -1,7 +0,0 @@
1
- // -----------------------------------------------------------------------------
2
- export const UPDATE_REVIEW_STATUS = '@@review-status/UPDATE_REVIEW_STATUS';
3
- // -----------------------------------------------------------------------------
4
- export const updateReviewStatus = (payload) => ({
5
- type: UPDATE_REVIEW_STATUS,
6
- payload
7
- });
@@ -1,24 +0,0 @@
1
- import { FinishedSlides, IconValue } from '../../types/common';
2
- export declare const UPDATE_STEP_ITEMS_ON_VALIDATION = "@@step-items/UPDATE_STEP_ITEMS_ON_VALIDATION";
3
- export declare const UPDATE_STEP_ITEMS_ON_NEXT = "@@step-items/UPDATE_STEP_ITEMS_ON_NEXT";
4
- declare type UpdateStepItemsOnValidationClickPayload = {
5
- stepNumber: number;
6
- icon: IconValue;
7
- };
8
- declare type UpdateStepItemsOnNextClickPayload = {
9
- stepNumber: number;
10
- finishedSlides: FinishedSlides;
11
- current: boolean;
12
- };
13
- export declare type UpdateStepItemsOnValidation = {
14
- type: typeof UPDATE_STEP_ITEMS_ON_VALIDATION;
15
- payload: UpdateStepItemsOnValidationClickPayload;
16
- };
17
- export declare type UpdateStepItemsOnNext = {
18
- type: typeof UPDATE_STEP_ITEMS_ON_NEXT;
19
- payload: UpdateStepItemsOnNextClickPayload;
20
- };
21
- export declare type StepItemsAction = UpdateStepItemsOnValidation | UpdateStepItemsOnNext;
22
- export declare const updateStepItemsOnValidation: (payload: UpdateStepItemsOnValidationClickPayload) => UpdateStepItemsOnValidation;
23
- export declare const updateStepItemsOnNext: (payload: UpdateStepItemsOnNextClickPayload) => UpdateStepItemsOnNext;
24
- export {};
@@ -1,11 +0,0 @@
1
- export const UPDATE_STEP_ITEMS_ON_VALIDATION = '@@step-items/UPDATE_STEP_ITEMS_ON_VALIDATION';
2
- export const UPDATE_STEP_ITEMS_ON_NEXT = '@@step-items/UPDATE_STEP_ITEMS_ON_NEXT';
3
- // -----------------------------------------------------------------------------
4
- export const updateStepItemsOnValidation = (payload) => ({
5
- type: UPDATE_STEP_ITEMS_ON_VALIDATION,
6
- payload
7
- });
8
- export const updateStepItemsOnNext = (payload) => ({
9
- type: UPDATE_STEP_ITEMS_ON_NEXT,
10
- payload
11
- });
@@ -1,7 +0,0 @@
1
- import { UpdateFinishedSlides } from '../../actions/ui/finished-slides';
2
- export declare type FinishedSlidesState = {
3
- slideNumbers: number[];
4
- [key: number]: true;
5
- };
6
- declare const reducer: (state: FinishedSlidesState | undefined, action: UpdateFinishedSlides) => FinishedSlidesState;
7
- export default reducer;
@@ -1,33 +0,0 @@
1
- import forEach from 'lodash/fp/forEach';
2
- import { UPDATE_FINISHED_SLIDES } from '../../actions/ui/finished-slides';
3
- import { slideNumbers } from '../../common';
4
- const initialState = {
5
- slideNumbers
6
- };
7
- const _forEach = forEach.convert({
8
- cap: false
9
- });
10
- // -----------------------------------------------------------------------------
11
- const reducer = (
12
- // eslint-disable-next-line default-param-last
13
- state = initialState, action) => {
14
- switch (action.type) {
15
- case UPDATE_FINISHED_SLIDES: {
16
- const { slideNumbers: _slideNumbers, ...rest } = state;
17
- const { slideNumber, value } = action.payload;
18
- const _state = {
19
- slideNumbers: _slideNumbers
20
- };
21
- _forEach((finishedSlide, index) => {
22
- const previousValue = finishedSlide;
23
- _state[index] = previousValue;
24
- }, rest);
25
- _state[slideNumber] = value;
26
- return _state;
27
- }
28
- default:
29
- return state;
30
- }
31
- };
32
- // -----------------------------------------------------------------------------
33
- export default reducer;
@@ -1,4 +0,0 @@
1
- import { UpdateReviewStatus } from '../../actions/ui/review-status';
2
- export declare type ReviewStatusState = 'finished' | 'ongoing';
3
- declare const reducer: (state: ReviewStatusState | undefined, action: UpdateReviewStatus) => ReviewStatusState;
4
- export default reducer;
@@ -1,14 +0,0 @@
1
- import { IconValue } from '../../types/common';
2
- import { StepItemsAction } from '../../actions/ui/step-items';
3
- export declare type StepItem = {
4
- current: boolean;
5
- icon: IconValue;
6
- value: string;
7
- };
8
- export declare type StepItemsState = {
9
- slideNumbers: number[];
10
- [key: number]: StepItem;
11
- };
12
- export declare const initialState: StepItemsState;
13
- declare const reducer: (state: StepItemsState | undefined, action: StepItemsAction) => StepItemsState;
14
- export default reducer;