@magmamath/students-features 1.2.1-rc.21 → 1.2.1-rc.23

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 (100) hide show
  1. package/dist/commonjs/features/pmProgress/components/header/PmProgressHeader.js +34 -48
  2. package/dist/commonjs/features/pmProgress/components/header/PmProgressHeader.js.map +1 -1
  3. package/dist/commonjs/features/pmProgress/components/header/StartButton.js +114 -0
  4. package/dist/commonjs/features/pmProgress/components/header/StartButton.js.map +1 -0
  5. package/dist/commonjs/features/pmProgress/components/list/Fluency.js +5 -1
  6. package/dist/commonjs/features/pmProgress/components/list/Fluency.js.map +1 -1
  7. package/dist/commonjs/features/pmProgress/components/list/ListCard.js +3 -1
  8. package/dist/commonjs/features/pmProgress/components/list/ListCard.js.map +1 -1
  9. package/dist/commonjs/features/pmProgress/components/list/ListItem.js +33 -14
  10. package/dist/commonjs/features/pmProgress/components/list/ListItem.js.map +1 -1
  11. package/dist/commonjs/features/pmProgress/components/list/PmDomainList.js +5 -1
  12. package/dist/commonjs/features/pmProgress/components/list/PmDomainList.js.map +1 -1
  13. package/dist/commonjs/features/pmProgress/components/recs/PmTeacherRecs.js +10 -2
  14. package/dist/commonjs/features/pmProgress/components/recs/PmTeacherRecs.js.map +1 -1
  15. package/dist/commonjs/features/pmProgress/model/PmSolvingFlowModel.js +2 -0
  16. package/dist/commonjs/features/pmProgress/model/PmSolvingFlowModel.js.map +1 -1
  17. package/dist/commonjs/features/pmProgress/shared/pmProgress.constants.js +6 -1
  18. package/dist/commonjs/features/pmProgress/shared/pmProgress.constants.js.map +1 -1
  19. package/dist/commonjs/shared/translation/localization/ca.json +2 -1
  20. package/dist/commonjs/shared/translation/localization/de.json +2 -1
  21. package/dist/commonjs/shared/translation/localization/en.json +2 -1
  22. package/dist/commonjs/shared/translation/localization/gb.json +2 -1
  23. package/dist/commonjs/shared/translation/localization/sct.json +2 -1
  24. package/dist/commonjs/shared/translation/localization/sw.json +2 -1
  25. package/dist/module/features/pmProgress/components/header/PmProgressHeader.js +38 -52
  26. package/dist/module/features/pmProgress/components/header/PmProgressHeader.js.map +1 -1
  27. package/dist/module/features/pmProgress/components/header/StartButton.js +107 -0
  28. package/dist/module/features/pmProgress/components/header/StartButton.js.map +1 -0
  29. package/dist/module/features/pmProgress/components/list/Fluency.js +5 -1
  30. package/dist/module/features/pmProgress/components/list/Fluency.js.map +1 -1
  31. package/dist/module/features/pmProgress/components/list/ListCard.js +3 -1
  32. package/dist/module/features/pmProgress/components/list/ListCard.js.map +1 -1
  33. package/dist/module/features/pmProgress/components/list/ListItem.js +35 -16
  34. package/dist/module/features/pmProgress/components/list/ListItem.js.map +1 -1
  35. package/dist/module/features/pmProgress/components/list/PmDomainList.js +5 -1
  36. package/dist/module/features/pmProgress/components/list/PmDomainList.js.map +1 -1
  37. package/dist/module/features/pmProgress/components/recs/PmTeacherRecs.js +12 -4
  38. package/dist/module/features/pmProgress/components/recs/PmTeacherRecs.js.map +1 -1
  39. package/dist/module/features/pmProgress/model/PmSolvingFlowModel.js +2 -0
  40. package/dist/module/features/pmProgress/model/PmSolvingFlowModel.js.map +1 -1
  41. package/dist/module/features/pmProgress/shared/pmProgress.constants.js +5 -0
  42. package/dist/module/features/pmProgress/shared/pmProgress.constants.js.map +1 -1
  43. package/dist/module/shared/translation/localization/ca.json +2 -1
  44. package/dist/module/shared/translation/localization/de.json +2 -1
  45. package/dist/module/shared/translation/localization/en.json +2 -1
  46. package/dist/module/shared/translation/localization/gb.json +2 -1
  47. package/dist/module/shared/translation/localization/sct.json +2 -1
  48. package/dist/module/shared/translation/localization/sw.json +2 -1
  49. package/dist/typescript/commonjs/features/pmProgress/components/header/PmProgressHeader.d.ts.map +1 -1
  50. package/dist/typescript/commonjs/features/pmProgress/components/header/StartButton.d.ts +11 -0
  51. package/dist/typescript/commonjs/features/pmProgress/components/header/StartButton.d.ts.map +1 -0
  52. package/dist/typescript/commonjs/features/pmProgress/components/list/Fluency.d.ts.map +1 -1
  53. package/dist/typescript/commonjs/features/pmProgress/components/list/ListCard.d.ts +2 -1
  54. package/dist/typescript/commonjs/features/pmProgress/components/list/ListCard.d.ts.map +1 -1
  55. package/dist/typescript/commonjs/features/pmProgress/components/list/ListItem.d.ts +2 -1
  56. package/dist/typescript/commonjs/features/pmProgress/components/list/ListItem.d.ts.map +1 -1
  57. package/dist/typescript/commonjs/features/pmProgress/components/list/PmDomainList.d.ts.map +1 -1
  58. package/dist/typescript/commonjs/features/pmProgress/components/recs/PmTeacherRecs.d.ts.map +1 -1
  59. package/dist/typescript/commonjs/features/pmProgress/model/PmSolvingFlowModel.d.ts +2 -0
  60. package/dist/typescript/commonjs/features/pmProgress/model/PmSolvingFlowModel.d.ts.map +1 -1
  61. package/dist/typescript/commonjs/features/pmProgress/shared/pmProgress.constants.d.ts +4 -0
  62. package/dist/typescript/commonjs/features/pmProgress/shared/pmProgress.constants.d.ts.map +1 -1
  63. package/dist/typescript/commonjs/shared/translation/constants.d.ts +6 -0
  64. package/dist/typescript/commonjs/shared/translation/constants.d.ts.map +1 -1
  65. package/dist/typescript/commonjs/shared/translation/model.d.ts +2 -0
  66. package/dist/typescript/commonjs/shared/translation/model.d.ts.map +1 -1
  67. package/dist/typescript/module/features/pmProgress/components/header/PmProgressHeader.d.ts.map +1 -1
  68. package/dist/typescript/module/features/pmProgress/components/header/StartButton.d.ts +11 -0
  69. package/dist/typescript/module/features/pmProgress/components/header/StartButton.d.ts.map +1 -0
  70. package/dist/typescript/module/features/pmProgress/components/list/Fluency.d.ts.map +1 -1
  71. package/dist/typescript/module/features/pmProgress/components/list/ListCard.d.ts +2 -1
  72. package/dist/typescript/module/features/pmProgress/components/list/ListCard.d.ts.map +1 -1
  73. package/dist/typescript/module/features/pmProgress/components/list/ListItem.d.ts +2 -1
  74. package/dist/typescript/module/features/pmProgress/components/list/ListItem.d.ts.map +1 -1
  75. package/dist/typescript/module/features/pmProgress/components/list/PmDomainList.d.ts.map +1 -1
  76. package/dist/typescript/module/features/pmProgress/components/recs/PmTeacherRecs.d.ts.map +1 -1
  77. package/dist/typescript/module/features/pmProgress/model/PmSolvingFlowModel.d.ts +2 -0
  78. package/dist/typescript/module/features/pmProgress/model/PmSolvingFlowModel.d.ts.map +1 -1
  79. package/dist/typescript/module/features/pmProgress/shared/pmProgress.constants.d.ts +4 -0
  80. package/dist/typescript/module/features/pmProgress/shared/pmProgress.constants.d.ts.map +1 -1
  81. package/dist/typescript/module/shared/translation/constants.d.ts +6 -0
  82. package/dist/typescript/module/shared/translation/constants.d.ts.map +1 -1
  83. package/dist/typescript/module/shared/translation/model.d.ts +2 -0
  84. package/dist/typescript/module/shared/translation/model.d.ts.map +1 -1
  85. package/package.json +1 -1
  86. package/src/features/pmProgress/components/header/PmProgressHeader.tsx +36 -43
  87. package/src/features/pmProgress/components/header/StartButton.tsx +141 -0
  88. package/src/features/pmProgress/components/list/Fluency.tsx +5 -1
  89. package/src/features/pmProgress/components/list/ListCard.tsx +3 -0
  90. package/src/features/pmProgress/components/list/ListItem.tsx +38 -13
  91. package/src/features/pmProgress/components/list/PmDomainList.tsx +5 -1
  92. package/src/features/pmProgress/components/recs/PmTeacherRecs.tsx +12 -4
  93. package/src/features/pmProgress/model/PmSolvingFlowModel.ts +3 -0
  94. package/src/features/pmProgress/shared/pmProgress.constants.ts +5 -0
  95. package/src/shared/translation/localization/ca.json +2 -1
  96. package/src/shared/translation/localization/de.json +2 -1
  97. package/src/shared/translation/localization/en.json +2 -1
  98. package/src/shared/translation/localization/gb.json +2 -1
  99. package/src/shared/translation/localization/sct.json +2 -1
  100. package/src/shared/translation/localization/sw.json +2 -1
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react'
2
- import { View, Pressable, StyleSheet } from 'react-native'
2
+ import { ActivityIndicator, View, Pressable, StyleSheet, Text } from 'react-native'
3
3
  import {
4
4
  ArrowRightIcon,
5
5
  CheckIcon,
@@ -24,6 +24,7 @@ export type ListItemProps = {
24
24
  subtitle: string
25
25
  skillsLeft: number
26
26
  isFinished?: boolean
27
+ isLoading?: boolean
27
28
  onPress?: () => void
28
29
  isSkillsLeftHidden?: boolean
29
30
  }
@@ -33,6 +34,7 @@ export const ListItem = ({
33
34
  subtitle,
34
35
  skillsLeft,
35
36
  isFinished = false,
37
+ isLoading = false,
36
38
  onPress,
37
39
  isSkillsLeftHidden = false,
38
40
  }: ListItemProps) => {
@@ -43,7 +45,13 @@ export const ListItem = ({
43
45
  return (
44
46
  <Pressable
45
47
  onPress={onPress}
46
- style={[styles.card, isFinished && styles.finished, isHovered && styles.hovered]}
48
+ disabled={isLoading}
49
+ style={[
50
+ styles.card,
51
+ isFinished && styles.finished,
52
+ isHovered && styles.hovered,
53
+ isLoading && styles.loading,
54
+ ]}
47
55
  onHoverIn={() => setIsHovered(true)}
48
56
  onHoverOut={() => setIsHovered(false)}
49
57
  >
@@ -63,18 +71,28 @@ export const ListItem = ({
63
71
  </Typography>
64
72
  </View>
65
73
  <View style={styles.trailing}>
66
- {isSkillsLeftVisible && (
67
- <Typography variant={HeadingVariants.H10} style={styles.skills}>
68
- {skillsLeft} {skillsLeft === 1 ? t('pmProgress.skillLeft') : t('pmProgress.skillsLeft')}
69
- </Typography>
74
+ {isLoading ? (
75
+ <View style={styles.loadingIndicator}>
76
+ <Text>{t('pmProgress.loading')} </Text>
77
+ <ActivityIndicator size="small" color={COLORS.NEUTRAL_7} />
78
+ </View>
79
+ ) : (
80
+ <>
81
+ {isSkillsLeftVisible && (
82
+ <Typography variant={HeadingVariants.H10} style={styles.skills}>
83
+ {skillsLeft}{' '}
84
+ {skillsLeft === 1 ? t('pmProgress.skillLeft') : t('pmProgress.skillsLeft')}
85
+ </Typography>
86
+ )}
87
+ <View style={styles.icon}>
88
+ {isFinished ? (
89
+ <CheckIcon color={FINISHED_ICON} />
90
+ ) : (
91
+ <ArrowRightIcon color={COLORS.NEUTRAL_9} />
92
+ )}
93
+ </View>
94
+ </>
70
95
  )}
71
- <View style={styles.icon}>
72
- {isFinished ? (
73
- <CheckIcon color={FINISHED_ICON} />
74
- ) : (
75
- <ArrowRightIcon color={COLORS.NEUTRAL_9} />
76
- )}
77
- </View>
78
96
  </View>
79
97
  </Pressable>
80
98
  )
@@ -133,4 +151,11 @@ const styles = StyleSheet.create({
133
151
  justifyContent: 'center',
134
152
  alignItems: 'center',
135
153
  },
154
+ loading: {
155
+ opacity: 0.5,
156
+ },
157
+ loadingIndicator: {
158
+ flexDirection: 'row',
159
+ gap: 8,
160
+ },
136
161
  })
@@ -14,6 +14,7 @@ export const PmDomainList = () => {
14
14
  const domains = useUnit(model.tree.$domains)
15
15
  const expandedId = useUnit(model.highlight.$expandedId)
16
16
  const hoveredId = useUnit(model.highlight.$hoveredId)
17
+ const loaderOpeningId = useUnit(model.solving.$loaderOpeningId)
17
18
 
18
19
  const fluency = domains.find(({ title }) => isFluencyDomain(title))
19
20
  const list = fluency ? domains.filter(({ title }) => !isFluencyDomain(title)) : domains
@@ -37,12 +38,15 @@ export const PmDomainList = () => {
37
38
  onHoverIn={() => model.highlight.hover(item.domainId)}
38
39
  onHoverOut={() => model.highlight.hover(null)}
39
40
  onItemPress={async (item) => {
41
+ model.solving.setLoaderOpeningId(item.id)
40
42
  const skill = await model.solving.start({
41
43
  type: SolvingFlow.STANDARD,
42
44
  standardId: item.standardId,
43
45
  })
44
- onStandardPress?.(skill)
46
+ await onStandardPress?.(skill)
47
+ model.solving.setLoaderOpeningId(null)
45
48
  }}
49
+ loadingItemId={loaderOpeningId}
46
50
  isLast={index === list.length - 1}
47
51
  isFirst={index === 0}
48
52
  isExpanded={expandedId === item.domainId}
@@ -11,14 +11,15 @@ import {
11
11
  SPACING,
12
12
  } from '@magmamath/react-native-ui'
13
13
  import { useText } from '../../../../shared/translation'
14
- import { useStoreMap, useUnit } from 'effector-react'
15
- import { CustomDomain, SolvingFlow } from '../../shared/pmProgress.constants'
14
+ import { useUnit, useStoreMap } from 'effector-react'
15
+ import { CustomDomain, OpeningLoaderId, SolvingFlow } from '../../shared/pmProgress.constants'
16
16
  import { usePmProgress } from '../../context/PmProgressContext'
17
17
 
18
18
  export const PmTeacherRecs = () => {
19
19
  const t = useText()
20
20
  const { model, onPracticePress, onTeacherRecommendationPress } = usePmProgress()
21
21
  const expandedId = useUnit(model.highlight.$expandedId)
22
+ const loaderOpeningId = useUnit(model.solving.$loaderOpeningId)
22
23
 
23
24
  // TODO: rework this, probably split and pass renderer to ListCard
24
25
  const recommendations = useStoreMap(model.recommendations.$teacher, ({ items }) =>
@@ -44,12 +45,15 @@ export const PmTeacherRecs = () => {
44
45
  expandedColor={COLORS.YELLOW_1}
45
46
  onPress={() => model.highlight.expand(CustomDomain.TEACHER)}
46
47
  onItemPress={async (item) => {
48
+ model.solving.setLoaderOpeningId(item.id)
47
49
  const skill = await model.solving.start({
48
50
  type: SolvingFlow.TEACHER,
49
51
  skillId: item.skillId,
50
52
  })
51
- onPracticePress?.(skill)
53
+ await onPracticePress?.(skill)
54
+ model.solving.setLoaderOpeningId(null)
52
55
  }}
56
+ loadingItemId={loaderOpeningId}
53
57
  isLast
54
58
  isFirst
55
59
  isSkillsLeftHidden
@@ -59,9 +63,13 @@ export const PmTeacherRecs = () => {
59
63
  rightContent={
60
64
  <Button
61
65
  onPress={async () => {
66
+ model.solving.setLoaderOpeningId(OpeningLoaderId.PRACTICE_BUTTON)
62
67
  const skill = await model.solving.start({ type: SolvingFlow.TEACHER })
63
- onTeacherRecommendationPress?.(skill)
68
+ await onTeacherRecommendationPress?.(skill)
69
+ model.solving.setLoaderOpeningId(null)
64
70
  }}
71
+ disabled={loaderOpeningId !== null}
72
+ isLoading={loaderOpeningId === OpeningLoaderId.PRACTICE_BUTTON}
65
73
  size={ButtonSize.SMALL}
66
74
  variant={ButtonVariant.SECONDARY}
67
75
  >
@@ -30,6 +30,9 @@ export class PmSolvingFlowModel {
30
30
 
31
31
  public readonly setQueue = createEvent<Skill[]>()
32
32
  public readonly advance = createEvent()
33
+ public readonly setLoaderOpeningId = createEvent<string | null>()
34
+
35
+ public readonly $loaderOpeningId = restore(this.setLoaderOpeningId, null)
33
36
 
34
37
  public readonly $queue = restore(this.setQueue, [])
35
38
  .on(this.advance, (queue) => queue.slice(1))
@@ -21,6 +21,11 @@ export enum SolvingFlow {
21
21
  STANDARD = 'STANDARD',
22
22
  }
23
23
 
24
+ export enum OpeningLoaderId {
25
+ START_BUTTON = 'START_BUTTON',
26
+ PRACTICE_BUTTON = 'PRACTICE_BUTTON',
27
+ }
28
+
24
29
  export enum SessionStorageKeys {
25
30
  SOLVING_QUEUE = 'PM_SOLVING_QUEUE',
26
31
  GRADE = 'PM_GRADE',
@@ -75,6 +75,7 @@
75
75
  "skillLeft": "skill left",
76
76
  "grade": "Grade",
77
77
  "gradeK": "K",
78
- "gradeOther": "Other"
78
+ "gradeOther": "Other",
79
+ "loading": "Loading..."
79
80
  }
80
81
  }
@@ -75,6 +75,7 @@
75
75
  "skillLeft": "",
76
76
  "grade": "",
77
77
  "gradeK": "",
78
- "gradeOther": ""
78
+ "gradeOther": "",
79
+ "loading": ""
79
80
  }
80
81
  }
@@ -75,6 +75,7 @@
75
75
  "skillLeft": "skill left",
76
76
  "grade": "Grade",
77
77
  "gradeK": "K",
78
- "gradeOther": "Other"
78
+ "gradeOther": "Other",
79
+ "loading": "Loading..."
79
80
  }
80
81
  }
@@ -75,6 +75,7 @@
75
75
  "skillLeft": "skill left",
76
76
  "grade": "Grade",
77
77
  "gradeK": "K",
78
- "gradeOther": "Other"
78
+ "gradeOther": "Other",
79
+ "loading": "Loading..."
79
80
  }
80
81
  }
@@ -75,6 +75,7 @@
75
75
  "skillLeft": "skill left",
76
76
  "grade": "Grade",
77
77
  "gradeK": "K",
78
- "gradeOther": "Other"
78
+ "gradeOther": "Other",
79
+ "loading": "Loading..."
79
80
  }
80
81
  }
@@ -75,6 +75,7 @@
75
75
  "skillLeft": "",
76
76
  "grade": "",
77
77
  "gradeK": "",
78
- "gradeOther": ""
78
+ "gradeOther": "",
79
+ "loading": ""
79
80
  }
80
81
  }