@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.
- package/dist/commonjs/features/pmProgress/components/header/PmProgressHeader.js +34 -48
- package/dist/commonjs/features/pmProgress/components/header/PmProgressHeader.js.map +1 -1
- package/dist/commonjs/features/pmProgress/components/header/StartButton.js +114 -0
- package/dist/commonjs/features/pmProgress/components/header/StartButton.js.map +1 -0
- package/dist/commonjs/features/pmProgress/components/list/Fluency.js +5 -1
- package/dist/commonjs/features/pmProgress/components/list/Fluency.js.map +1 -1
- package/dist/commonjs/features/pmProgress/components/list/ListCard.js +3 -1
- package/dist/commonjs/features/pmProgress/components/list/ListCard.js.map +1 -1
- package/dist/commonjs/features/pmProgress/components/list/ListItem.js +33 -14
- package/dist/commonjs/features/pmProgress/components/list/ListItem.js.map +1 -1
- package/dist/commonjs/features/pmProgress/components/list/PmDomainList.js +5 -1
- package/dist/commonjs/features/pmProgress/components/list/PmDomainList.js.map +1 -1
- package/dist/commonjs/features/pmProgress/components/recs/PmTeacherRecs.js +10 -2
- package/dist/commonjs/features/pmProgress/components/recs/PmTeacherRecs.js.map +1 -1
- package/dist/commonjs/features/pmProgress/model/PmSolvingFlowModel.js +2 -0
- package/dist/commonjs/features/pmProgress/model/PmSolvingFlowModel.js.map +1 -1
- package/dist/commonjs/features/pmProgress/shared/pmProgress.constants.js +6 -1
- package/dist/commonjs/features/pmProgress/shared/pmProgress.constants.js.map +1 -1
- package/dist/commonjs/shared/translation/localization/ca.json +2 -1
- package/dist/commonjs/shared/translation/localization/de.json +2 -1
- package/dist/commonjs/shared/translation/localization/en.json +2 -1
- package/dist/commonjs/shared/translation/localization/gb.json +2 -1
- package/dist/commonjs/shared/translation/localization/sct.json +2 -1
- package/dist/commonjs/shared/translation/localization/sw.json +2 -1
- package/dist/module/features/pmProgress/components/header/PmProgressHeader.js +38 -52
- package/dist/module/features/pmProgress/components/header/PmProgressHeader.js.map +1 -1
- package/dist/module/features/pmProgress/components/header/StartButton.js +107 -0
- package/dist/module/features/pmProgress/components/header/StartButton.js.map +1 -0
- package/dist/module/features/pmProgress/components/list/Fluency.js +5 -1
- package/dist/module/features/pmProgress/components/list/Fluency.js.map +1 -1
- package/dist/module/features/pmProgress/components/list/ListCard.js +3 -1
- package/dist/module/features/pmProgress/components/list/ListCard.js.map +1 -1
- package/dist/module/features/pmProgress/components/list/ListItem.js +35 -16
- package/dist/module/features/pmProgress/components/list/ListItem.js.map +1 -1
- package/dist/module/features/pmProgress/components/list/PmDomainList.js +5 -1
- package/dist/module/features/pmProgress/components/list/PmDomainList.js.map +1 -1
- package/dist/module/features/pmProgress/components/recs/PmTeacherRecs.js +12 -4
- package/dist/module/features/pmProgress/components/recs/PmTeacherRecs.js.map +1 -1
- package/dist/module/features/pmProgress/model/PmSolvingFlowModel.js +2 -0
- package/dist/module/features/pmProgress/model/PmSolvingFlowModel.js.map +1 -1
- package/dist/module/features/pmProgress/shared/pmProgress.constants.js +5 -0
- package/dist/module/features/pmProgress/shared/pmProgress.constants.js.map +1 -1
- package/dist/module/shared/translation/localization/ca.json +2 -1
- package/dist/module/shared/translation/localization/de.json +2 -1
- package/dist/module/shared/translation/localization/en.json +2 -1
- package/dist/module/shared/translation/localization/gb.json +2 -1
- package/dist/module/shared/translation/localization/sct.json +2 -1
- package/dist/module/shared/translation/localization/sw.json +2 -1
- package/dist/typescript/commonjs/features/pmProgress/components/header/PmProgressHeader.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/pmProgress/components/header/StartButton.d.ts +11 -0
- package/dist/typescript/commonjs/features/pmProgress/components/header/StartButton.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/components/list/Fluency.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/pmProgress/components/list/ListCard.d.ts +2 -1
- package/dist/typescript/commonjs/features/pmProgress/components/list/ListCard.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/pmProgress/components/list/ListItem.d.ts +2 -1
- package/dist/typescript/commonjs/features/pmProgress/components/list/ListItem.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/pmProgress/components/list/PmDomainList.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/pmProgress/components/recs/PmTeacherRecs.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/pmProgress/model/PmSolvingFlowModel.d.ts +2 -0
- package/dist/typescript/commonjs/features/pmProgress/model/PmSolvingFlowModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/pmProgress/shared/pmProgress.constants.d.ts +4 -0
- package/dist/typescript/commonjs/features/pmProgress/shared/pmProgress.constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/constants.d.ts +6 -0
- package/dist/typescript/commonjs/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/model.d.ts +2 -0
- package/dist/typescript/commonjs/shared/translation/model.d.ts.map +1 -1
- package/dist/typescript/module/features/pmProgress/components/header/PmProgressHeader.d.ts.map +1 -1
- package/dist/typescript/module/features/pmProgress/components/header/StartButton.d.ts +11 -0
- package/dist/typescript/module/features/pmProgress/components/header/StartButton.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/components/list/Fluency.d.ts.map +1 -1
- package/dist/typescript/module/features/pmProgress/components/list/ListCard.d.ts +2 -1
- package/dist/typescript/module/features/pmProgress/components/list/ListCard.d.ts.map +1 -1
- package/dist/typescript/module/features/pmProgress/components/list/ListItem.d.ts +2 -1
- package/dist/typescript/module/features/pmProgress/components/list/ListItem.d.ts.map +1 -1
- package/dist/typescript/module/features/pmProgress/components/list/PmDomainList.d.ts.map +1 -1
- package/dist/typescript/module/features/pmProgress/components/recs/PmTeacherRecs.d.ts.map +1 -1
- package/dist/typescript/module/features/pmProgress/model/PmSolvingFlowModel.d.ts +2 -0
- package/dist/typescript/module/features/pmProgress/model/PmSolvingFlowModel.d.ts.map +1 -1
- package/dist/typescript/module/features/pmProgress/shared/pmProgress.constants.d.ts +4 -0
- package/dist/typescript/module/features/pmProgress/shared/pmProgress.constants.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/constants.d.ts +6 -0
- package/dist/typescript/module/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/model.d.ts +2 -0
- package/dist/typescript/module/shared/translation/model.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/pmProgress/components/header/PmProgressHeader.tsx +36 -43
- package/src/features/pmProgress/components/header/StartButton.tsx +141 -0
- package/src/features/pmProgress/components/list/Fluency.tsx +5 -1
- package/src/features/pmProgress/components/list/ListCard.tsx +3 -0
- package/src/features/pmProgress/components/list/ListItem.tsx +38 -13
- package/src/features/pmProgress/components/list/PmDomainList.tsx +5 -1
- package/src/features/pmProgress/components/recs/PmTeacherRecs.tsx +12 -4
- package/src/features/pmProgress/model/PmSolvingFlowModel.ts +3 -0
- package/src/features/pmProgress/shared/pmProgress.constants.ts +5 -0
- package/src/shared/translation/localization/ca.json +2 -1
- package/src/shared/translation/localization/de.json +2 -1
- package/src/shared/translation/localization/en.json +2 -1
- package/src/shared/translation/localization/gb.json +2 -1
- package/src/shared/translation/localization/sct.json +2 -1
- 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
|
-
|
|
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
|
-
{
|
|
67
|
-
<
|
|
68
|
-
{
|
|
69
|
-
|
|
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 {
|
|
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',
|