@magmamath/students-features 1.2.1-rc.11 → 1.2.1-rc.13
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/chart/components/SlicesPaths.js +13 -5
- package/dist/commonjs/features/pmProgress/components/chart/components/SlicesPaths.js.map +1 -1
- package/dist/commonjs/features/pmProgress/components/list/Fluency.js +3 -3
- package/dist/commonjs/features/pmProgress/components/list/Fluency.js.map +1 -1
- package/dist/commonjs/features/pmProgress/components/list/ListCard.js +13 -4
- package/dist/commonjs/features/pmProgress/components/list/ListCard.js.map +1 -1
- package/dist/commonjs/features/pmProgress/components/list/PmDomainList.js +7 -3
- package/dist/commonjs/features/pmProgress/components/list/PmDomainList.js.map +1 -1
- package/dist/commonjs/features/pmProgress/components/recs/PmTeacherRecs.js +3 -3
- package/dist/commonjs/features/pmProgress/components/recs/PmTeacherRecs.js.map +1 -1
- package/dist/commonjs/features/pmProgress/components/standard/StandardTag.js +202 -0
- package/dist/commonjs/features/pmProgress/components/standard/StandardTag.js.map +1 -0
- package/dist/commonjs/features/pmProgress/index.js +21 -1
- package/dist/commonjs/features/pmProgress/index.js.map +1 -1
- package/dist/commonjs/features/pmProgress/model/PmHighlightModel.js +15 -0
- package/dist/commonjs/features/pmProgress/model/PmHighlightModel.js.map +1 -0
- package/dist/commonjs/features/pmProgress/model/PmProgressModel.js +2 -0
- package/dist/commonjs/features/pmProgress/model/PmProgressModel.js.map +1 -1
- package/dist/commonjs/features/pmProgress/model/PmTreeModel.js +4 -2
- package/dist/commonjs/features/pmProgress/model/PmTreeModel.js.map +1 -1
- package/dist/commonjs/features/pmProgress/shared/pmProgress.constants.js +1 -0
- package/dist/commonjs/features/pmProgress/shared/pmProgress.constants.js.map +1 -1
- package/dist/module/features/pmProgress/components/chart/components/SlicesPaths.js +13 -5
- package/dist/module/features/pmProgress/components/chart/components/SlicesPaths.js.map +1 -1
- package/dist/module/features/pmProgress/components/list/Fluency.js +3 -3
- package/dist/module/features/pmProgress/components/list/Fluency.js.map +1 -1
- package/dist/module/features/pmProgress/components/list/ListCard.js +13 -4
- package/dist/module/features/pmProgress/components/list/ListCard.js.map +1 -1
- package/dist/module/features/pmProgress/components/list/PmDomainList.js +7 -3
- package/dist/module/features/pmProgress/components/list/PmDomainList.js.map +1 -1
- package/dist/module/features/pmProgress/components/recs/PmTeacherRecs.js +3 -3
- package/dist/module/features/pmProgress/components/recs/PmTeacherRecs.js.map +1 -1
- package/dist/module/features/pmProgress/components/standard/StandardTag.js +196 -0
- package/dist/module/features/pmProgress/components/standard/StandardTag.js.map +1 -0
- package/dist/module/features/pmProgress/index.js +2 -0
- package/dist/module/features/pmProgress/index.js.map +1 -1
- package/dist/module/features/pmProgress/model/PmHighlightModel.js +10 -0
- package/dist/module/features/pmProgress/model/PmHighlightModel.js.map +1 -0
- package/dist/module/features/pmProgress/model/PmProgressModel.js +2 -0
- package/dist/module/features/pmProgress/model/PmProgressModel.js.map +1 -1
- package/dist/module/features/pmProgress/model/PmTreeModel.js +4 -2
- package/dist/module/features/pmProgress/model/PmTreeModel.js.map +1 -1
- package/dist/module/features/pmProgress/shared/pmProgress.constants.js +1 -0
- package/dist/module/features/pmProgress/shared/pmProgress.constants.js.map +1 -1
- package/dist/typescript/commonjs/features/pmProgress/components/chart/components/SlicesPaths.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/pmProgress/components/list/ListCard.d.ts +4 -1
- package/dist/typescript/commonjs/features/pmProgress/components/list/ListCard.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/standard/StandardTag.d.ts +9 -0
- package/dist/typescript/commonjs/features/pmProgress/components/standard/StandardTag.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/index.d.ts +2 -0
- package/dist/typescript/commonjs/features/pmProgress/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/pmProgress/model/PmHighlightModel.d.ts +7 -0
- package/dist/typescript/commonjs/features/pmProgress/model/PmHighlightModel.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/model/PmProgressModel.d.ts +2 -0
- package/dist/typescript/commonjs/features/pmProgress/model/PmProgressModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/pmProgress/model/PmTreeModel.d.ts +0 -2
- package/dist/typescript/commonjs/features/pmProgress/model/PmTreeModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/pmProgress/shared/pmProgress.constants.d.ts +2 -1
- package/dist/typescript/commonjs/features/pmProgress/shared/pmProgress.constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/pmProgress/shared/pmProgress.types.d.ts +2 -1
- package/dist/typescript/commonjs/features/pmProgress/shared/pmProgress.types.d.ts.map +1 -1
- package/dist/typescript/module/features/pmProgress/components/chart/components/SlicesPaths.d.ts.map +1 -1
- package/dist/typescript/module/features/pmProgress/components/list/ListCard.d.ts +4 -1
- package/dist/typescript/module/features/pmProgress/components/list/ListCard.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/standard/StandardTag.d.ts +9 -0
- package/dist/typescript/module/features/pmProgress/components/standard/StandardTag.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/index.d.ts +2 -0
- package/dist/typescript/module/features/pmProgress/index.d.ts.map +1 -1
- package/dist/typescript/module/features/pmProgress/model/PmHighlightModel.d.ts +7 -0
- package/dist/typescript/module/features/pmProgress/model/PmHighlightModel.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/model/PmProgressModel.d.ts +2 -0
- package/dist/typescript/module/features/pmProgress/model/PmProgressModel.d.ts.map +1 -1
- package/dist/typescript/module/features/pmProgress/model/PmTreeModel.d.ts +0 -2
- package/dist/typescript/module/features/pmProgress/model/PmTreeModel.d.ts.map +1 -1
- package/dist/typescript/module/features/pmProgress/shared/pmProgress.constants.d.ts +2 -1
- package/dist/typescript/module/features/pmProgress/shared/pmProgress.constants.d.ts.map +1 -1
- package/dist/typescript/module/features/pmProgress/shared/pmProgress.types.d.ts +2 -1
- package/dist/typescript/module/features/pmProgress/shared/pmProgress.types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/pmProgress/components/chart/components/SlicesPaths.tsx +16 -5
- package/src/features/pmProgress/components/list/Fluency.tsx +3 -3
- package/src/features/pmProgress/components/list/ListCard.tsx +16 -4
- package/src/features/pmProgress/components/list/PmDomainList.tsx +7 -3
- package/src/features/pmProgress/components/recs/PmTeacherRecs.tsx +3 -3
- package/src/features/pmProgress/components/standard/StandardTag.tsx +177 -0
- package/src/features/pmProgress/index.ts +2 -0
- package/src/features/pmProgress/model/PmHighlightModel.ts +11 -0
- package/src/features/pmProgress/model/PmProgressModel.ts +3 -0
- package/src/features/pmProgress/model/PmTreeModel.ts +1 -6
- package/src/features/pmProgress/shared/pmProgress.constants.ts +1 -0
- package/src/features/pmProgress/shared/pmProgress.types.ts +3 -1
|
@@ -16,7 +16,7 @@ type FluencyProps = {
|
|
|
16
16
|
export const Fluency = ({ data }: FluencyProps) => {
|
|
17
17
|
const t = useText()
|
|
18
18
|
const { model, onStandardPress } = usePmProgress()
|
|
19
|
-
const
|
|
19
|
+
const expandedId = useUnit(model.highlight.$expandedId)
|
|
20
20
|
|
|
21
21
|
if (!data) return null
|
|
22
22
|
|
|
@@ -28,7 +28,7 @@ export const Fluency = ({ data }: FluencyProps) => {
|
|
|
28
28
|
items={data.standards.map((standard) => ({ ...standard, id: standard.standardId }))}
|
|
29
29
|
progress={data.scorePercentage}
|
|
30
30
|
color={COLORS.PRIMARY_ORANGE}
|
|
31
|
-
onPress={() => model.
|
|
31
|
+
onPress={() => model.highlight.expand(CustomDomain.FLUENCY)}
|
|
32
32
|
onItemPress={async (item) => {
|
|
33
33
|
const skill = await model.solving.start({
|
|
34
34
|
type: SolvingFlow.STANDARD,
|
|
@@ -38,7 +38,7 @@ export const Fluency = ({ data }: FluencyProps) => {
|
|
|
38
38
|
}}
|
|
39
39
|
isFirst
|
|
40
40
|
isLast
|
|
41
|
-
isExpanded={
|
|
41
|
+
isExpanded={expandedId === CustomDomain.FLUENCY}
|
|
42
42
|
icon={<SliceDiamondIcon color={COLORS.PRIMARY_ORANGE} />}
|
|
43
43
|
/>
|
|
44
44
|
</View>
|
|
@@ -38,6 +38,8 @@ type ListCardProps<T extends ListCardItem> = {
|
|
|
38
38
|
onItemPress?: (item: T) => void
|
|
39
39
|
isExpanded?: boolean
|
|
40
40
|
onPress?: () => void
|
|
41
|
+
onHoverIn?: () => void
|
|
42
|
+
onHoverOut?: () => void
|
|
41
43
|
progress?: number
|
|
42
44
|
rightContent?: React.ReactNode
|
|
43
45
|
isFirst?: boolean
|
|
@@ -45,6 +47,7 @@ type ListCardProps<T extends ListCardItem> = {
|
|
|
45
47
|
maxItems?: number
|
|
46
48
|
expandedColor?: string
|
|
47
49
|
isSkillsLeftHidden?: boolean
|
|
50
|
+
isHighlighted?: boolean
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
export const ListCard = <T extends ListCardItem>({
|
|
@@ -53,7 +56,10 @@ export const ListCard = <T extends ListCardItem>({
|
|
|
53
56
|
color,
|
|
54
57
|
items,
|
|
55
58
|
isExpanded = false,
|
|
59
|
+
isHighlighted = false,
|
|
56
60
|
onPress,
|
|
61
|
+
onHoverIn,
|
|
62
|
+
onHoverOut,
|
|
57
63
|
onItemPress,
|
|
58
64
|
progress = 0,
|
|
59
65
|
rightContent,
|
|
@@ -67,7 +73,7 @@ export const ListCard = <T extends ListCardItem>({
|
|
|
67
73
|
const [isHovered, setIsHovered] = useState(false)
|
|
68
74
|
|
|
69
75
|
const { visible, remainingCount } = getVisibleItems(items, maxItems)
|
|
70
|
-
const
|
|
76
|
+
const withHighlight = isHovered || isExpanded || isHighlighted
|
|
71
77
|
|
|
72
78
|
const Caret = isExpanded ? CaretDownIcon : CaretRightIcon
|
|
73
79
|
|
|
@@ -78,7 +84,7 @@ export const ListCard = <T extends ListCardItem>({
|
|
|
78
84
|
!isFirst && styles.containerCollapsed,
|
|
79
85
|
isFirst && styles.containerFirst,
|
|
80
86
|
isLast && styles.containerLast,
|
|
81
|
-
|
|
87
|
+
withHighlight && { backgroundColor: expandedColor },
|
|
82
88
|
]}
|
|
83
89
|
>
|
|
84
90
|
<Pressable
|
|
@@ -89,8 +95,14 @@ export const ListCard = <T extends ListCardItem>({
|
|
|
89
95
|
isHighlighted && { backgroundColor: expandedColor },
|
|
90
96
|
]}
|
|
91
97
|
onPress={onPress}
|
|
92
|
-
onHoverIn={() =>
|
|
93
|
-
|
|
98
|
+
onHoverIn={() => {
|
|
99
|
+
setIsHovered(true)
|
|
100
|
+
onHoverIn?.()
|
|
101
|
+
}}
|
|
102
|
+
onHoverOut={() => {
|
|
103
|
+
setIsHovered(false)
|
|
104
|
+
onHoverOut?.()
|
|
105
|
+
}}
|
|
94
106
|
>
|
|
95
107
|
{icon}
|
|
96
108
|
<View style={styles.caret}>
|
|
@@ -12,7 +12,8 @@ import { SolvingFlow } from '../../shared/pmProgress.constants'
|
|
|
12
12
|
export const PmDomainList = () => {
|
|
13
13
|
const { model, onStandardPress } = usePmProgress()
|
|
14
14
|
const domains = useUnit(model.tree.$domains)
|
|
15
|
-
const
|
|
15
|
+
const expandedId = useUnit(model.highlight.$expandedId)
|
|
16
|
+
const hoveredId = useUnit(model.highlight.$hoveredId)
|
|
16
17
|
|
|
17
18
|
const fluency = domains.find(({ title }) => isFluencyDomain(title))
|
|
18
19
|
const list = fluency ? domains.filter(({ title }) => !isFluencyDomain(title)) : domains
|
|
@@ -32,7 +33,9 @@ export const PmDomainList = () => {
|
|
|
32
33
|
items={item.standards.map((standard) => ({ ...standard, id: standard.standardId }))}
|
|
33
34
|
progress={item.scorePercentage}
|
|
34
35
|
color={item.color}
|
|
35
|
-
onPress={() => model.
|
|
36
|
+
onPress={() => model.highlight.expand(item.domainId)}
|
|
37
|
+
onHoverIn={() => model.highlight.hover(item.domainId)}
|
|
38
|
+
onHoverOut={() => model.highlight.hover(null)}
|
|
36
39
|
onItemPress={async (item) => {
|
|
37
40
|
const skill = await model.solving.start({
|
|
38
41
|
type: SolvingFlow.STANDARD,
|
|
@@ -42,7 +45,8 @@ export const PmDomainList = () => {
|
|
|
42
45
|
}}
|
|
43
46
|
isLast={index === list.length - 1}
|
|
44
47
|
isFirst={index === 0}
|
|
45
|
-
isExpanded={
|
|
48
|
+
isExpanded={expandedId === item.domainId}
|
|
49
|
+
isHighlighted={hoveredId === item.domainId || expandedId === item.domainId}
|
|
46
50
|
icon={<SliceDiamondIcon color={item.color} />}
|
|
47
51
|
/>
|
|
48
52
|
)}
|
|
@@ -18,7 +18,7 @@ import { usePmProgress } from '../../context/PmProgressContext'
|
|
|
18
18
|
export const PmTeacherRecs = () => {
|
|
19
19
|
const t = useText()
|
|
20
20
|
const { model, onPracticePress, onTeacherRecommendationPress } = usePmProgress()
|
|
21
|
-
const
|
|
21
|
+
const expandedId = useUnit(model.highlight.$expandedId)
|
|
22
22
|
|
|
23
23
|
// TODO: rework this, probably split and pass renderer to ListCard
|
|
24
24
|
const recommendations = useStoreMap(model.recommendations.$teacher, ({ items }) =>
|
|
@@ -40,7 +40,7 @@ export const PmTeacherRecs = () => {
|
|
|
40
40
|
maxItems={3}
|
|
41
41
|
color={COLORS.PRIMARY_YELLOW}
|
|
42
42
|
expandedColor={COLORS.YELLOW_1}
|
|
43
|
-
onPress={() => model.
|
|
43
|
+
onPress={() => model.highlight.expand(CustomDomain.TEACHER)}
|
|
44
44
|
onItemPress={async (item) => {
|
|
45
45
|
const skill = await model.solving.start({
|
|
46
46
|
type: SolvingFlow.TEACHER,
|
|
@@ -51,7 +51,7 @@ export const PmTeacherRecs = () => {
|
|
|
51
51
|
isLast
|
|
52
52
|
isFirst
|
|
53
53
|
isSkillsLeftHidden
|
|
54
|
-
isExpanded={
|
|
54
|
+
isExpanded={expandedId === CustomDomain.TEACHER}
|
|
55
55
|
icon={<PentagonIcon color={COLORS.PRIMARY_YELLOW} />}
|
|
56
56
|
rightContent={
|
|
57
57
|
<Button
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { StyleSheet, View, Text } from 'react-native'
|
|
3
|
+
import { DomainColor, PmProgressModel } from '@magmamath/students-features'
|
|
4
|
+
import { SliceDiamondIcon } from '../../../../shared/icons/SliceDiamondIcon'
|
|
5
|
+
import { COLORS, FONT_FAMILY } from '@magmamath/react-native-ui'
|
|
6
|
+
import { usePmProgress } from '../../context/PmProgressContext'
|
|
7
|
+
import { useStoreMap } from 'effector-react'
|
|
8
|
+
|
|
9
|
+
type ColorPreset = {
|
|
10
|
+
background: string
|
|
11
|
+
titleColor: string
|
|
12
|
+
tagColor: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const DOMAIN_COLOR_PRESETS: Record<DomainColor, ColorPreset> = {
|
|
16
|
+
[COLORS.PRIMARY_RED]: {
|
|
17
|
+
background: COLORS.RED_1,
|
|
18
|
+
titleColor: COLORS.RED_6,
|
|
19
|
+
tagColor: COLORS.PRIMARY_RED,
|
|
20
|
+
},
|
|
21
|
+
[COLORS.PRIMARY_MAGENTA]: {
|
|
22
|
+
background: COLORS.MAGENTA_1,
|
|
23
|
+
titleColor: COLORS.MAGENTA_6,
|
|
24
|
+
tagColor: COLORS.PRIMARY_MAGENTA,
|
|
25
|
+
},
|
|
26
|
+
[COLORS.PRIMARY_PURPLE]: {
|
|
27
|
+
background: COLORS.PURPLE_1,
|
|
28
|
+
titleColor: COLORS.PURPLE_6,
|
|
29
|
+
tagColor: COLORS.PRIMARY_PURPLE,
|
|
30
|
+
},
|
|
31
|
+
[COLORS.PRIMARY_INDIGO]: {
|
|
32
|
+
background: COLORS.INDIGO_1,
|
|
33
|
+
titleColor: COLORS.INDIGO_6,
|
|
34
|
+
tagColor: COLORS.PRIMARY_INDIGO,
|
|
35
|
+
},
|
|
36
|
+
[COLORS.PRIMARY_TURQUOISE]: {
|
|
37
|
+
background: COLORS.TURQUOISE_1,
|
|
38
|
+
titleColor: COLORS.TURQUOISE_6,
|
|
39
|
+
tagColor: COLORS.PRIMARY_TURQUOISE,
|
|
40
|
+
},
|
|
41
|
+
[COLORS.PRIMARY_GREEN]: {
|
|
42
|
+
background: COLORS.GREEN_1,
|
|
43
|
+
titleColor: COLORS.GREEN_6,
|
|
44
|
+
tagColor: COLORS.PRIMARY_GREEN,
|
|
45
|
+
},
|
|
46
|
+
[COLORS.PRIMARY_ORANGE]: {
|
|
47
|
+
background: COLORS.ORANGE_1,
|
|
48
|
+
titleColor: COLORS.ORANGE_6,
|
|
49
|
+
tagColor: COLORS.PRIMARY_ORANGE,
|
|
50
|
+
},
|
|
51
|
+
[COLORS.RED_4]: { background: COLORS.RED_1, titleColor: COLORS.RED_6, tagColor: COLORS.RED_4 },
|
|
52
|
+
[COLORS.MAGENTA_4]: {
|
|
53
|
+
background: COLORS.MAGENTA_1,
|
|
54
|
+
titleColor: COLORS.MAGENTA_6,
|
|
55
|
+
tagColor: COLORS.MAGENTA_4,
|
|
56
|
+
},
|
|
57
|
+
[COLORS.PURPLE_4]: {
|
|
58
|
+
background: COLORS.PURPLE_1,
|
|
59
|
+
titleColor: COLORS.PURPLE_6,
|
|
60
|
+
tagColor: COLORS.PURPLE_4,
|
|
61
|
+
},
|
|
62
|
+
[COLORS.INDIGO_4]: {
|
|
63
|
+
background: COLORS.INDIGO_1,
|
|
64
|
+
titleColor: COLORS.INDIGO_6,
|
|
65
|
+
tagColor: COLORS.INDIGO_4,
|
|
66
|
+
},
|
|
67
|
+
[COLORS.TURQUOISE_4]: {
|
|
68
|
+
background: COLORS.TURQUOISE_1,
|
|
69
|
+
titleColor: COLORS.TURQUOISE_6,
|
|
70
|
+
tagColor: COLORS.TURQUOISE_4,
|
|
71
|
+
},
|
|
72
|
+
[COLORS.GREEN_4]: {
|
|
73
|
+
background: COLORS.GREEN_1,
|
|
74
|
+
titleColor: COLORS.GREEN_6,
|
|
75
|
+
tagColor: COLORS.GREEN_4,
|
|
76
|
+
},
|
|
77
|
+
[COLORS.ORANGE_4]: {
|
|
78
|
+
background: COLORS.ORANGE_1,
|
|
79
|
+
titleColor: COLORS.ORANGE_6,
|
|
80
|
+
tagColor: COLORS.ORANGE_4,
|
|
81
|
+
},
|
|
82
|
+
[COLORS.RED_6]: { background: COLORS.RED_1, titleColor: COLORS.RED_6, tagColor: COLORS.RED_6 },
|
|
83
|
+
[COLORS.MAGENTA_6]: {
|
|
84
|
+
background: COLORS.MAGENTA_1,
|
|
85
|
+
titleColor: COLORS.MAGENTA_6,
|
|
86
|
+
tagColor: COLORS.MAGENTA_6,
|
|
87
|
+
},
|
|
88
|
+
[COLORS.PURPLE_6]: {
|
|
89
|
+
background: COLORS.PURPLE_1,
|
|
90
|
+
titleColor: COLORS.PURPLE_6,
|
|
91
|
+
tagColor: COLORS.PURPLE_6,
|
|
92
|
+
},
|
|
93
|
+
[COLORS.INDIGO_6]: {
|
|
94
|
+
background: COLORS.INDIGO_1,
|
|
95
|
+
titleColor: COLORS.INDIGO_6,
|
|
96
|
+
tagColor: COLORS.INDIGO_6,
|
|
97
|
+
},
|
|
98
|
+
[COLORS.TURQUOISE_6]: {
|
|
99
|
+
background: COLORS.TURQUOISE_1,
|
|
100
|
+
titleColor: COLORS.TURQUOISE_6,
|
|
101
|
+
tagColor: COLORS.TURQUOISE_6,
|
|
102
|
+
},
|
|
103
|
+
[COLORS.GREEN_6]: {
|
|
104
|
+
background: COLORS.GREEN_1,
|
|
105
|
+
titleColor: COLORS.GREEN_6,
|
|
106
|
+
tagColor: COLORS.GREEN_6,
|
|
107
|
+
},
|
|
108
|
+
[COLORS.ORANGE_6]: {
|
|
109
|
+
background: COLORS.ORANGE_1,
|
|
110
|
+
titleColor: COLORS.ORANGE_6,
|
|
111
|
+
tagColor: COLORS.ORANGE_6,
|
|
112
|
+
},
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
type StandardTagProps = {
|
|
116
|
+
skillId: string
|
|
117
|
+
model: PmProgressModel
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const StandardTag = ({ skillId, model }: StandardTagProps) => {
|
|
121
|
+
const standardInfo = useStoreMap({
|
|
122
|
+
store: model.tree.$domains,
|
|
123
|
+
keys: [skillId],
|
|
124
|
+
fn: (domains, [skillId]) => {
|
|
125
|
+
const domain = domains.find((d) => d.standards.some((s) => s.skillIds.includes(skillId)))
|
|
126
|
+
const standard = domain?.standards.find(({ skillIds }) => skillIds.includes(skillId))
|
|
127
|
+
if (!standard || !domain) return null
|
|
128
|
+
return { title: standard.title, tag: standard.subtitle, color: domain.color }
|
|
129
|
+
},
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
if (!standardInfo) return null
|
|
133
|
+
|
|
134
|
+
const preset = DOMAIN_COLOR_PRESETS[standardInfo.color as DomainColor]
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<View style={[styles.container, { backgroundColor: preset.background }]}>
|
|
138
|
+
<SliceDiamondIcon color={preset.tagColor} />
|
|
139
|
+
<View style={styles.textContainer}>
|
|
140
|
+
<Text numberOfLines={1} style={[styles.title, { color: preset.titleColor }]}>{standardInfo.title}</Text>
|
|
141
|
+
<Text numberOfLines={1} style={[styles.tag, { color: preset.tagColor }]}>{standardInfo.tag}</Text>
|
|
142
|
+
</View>
|
|
143
|
+
</View>
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const styles = StyleSheet.create({
|
|
148
|
+
container: {
|
|
149
|
+
minWidth: 175,
|
|
150
|
+
maxWidth: 200,
|
|
151
|
+
paddingHorizontal: 8,
|
|
152
|
+
paddingVertical: 4,
|
|
153
|
+
borderRadius: 12,
|
|
154
|
+
flexDirection: 'row',
|
|
155
|
+
alignItems: 'center',
|
|
156
|
+
gap: 8,
|
|
157
|
+
alignSelf: 'flex-start',
|
|
158
|
+
shadowColor: '#333333',
|
|
159
|
+
shadowOffset: { width: 0, height: 1 },
|
|
160
|
+
shadowOpacity: 0.1,
|
|
161
|
+
shadowRadius: 3,
|
|
162
|
+
elevation: 2,
|
|
163
|
+
},
|
|
164
|
+
textContainer: {
|
|
165
|
+
flexDirection: 'column',
|
|
166
|
+
justifyContent: 'center',
|
|
167
|
+
alignItems: 'flex-start',
|
|
168
|
+
},
|
|
169
|
+
title: {
|
|
170
|
+
fontSize: 13,
|
|
171
|
+
fontFamily: FONT_FAMILY.buenosAires,
|
|
172
|
+
},
|
|
173
|
+
tag: {
|
|
174
|
+
fontSize: 10,
|
|
175
|
+
fontFamily: FONT_FAMILY.buenosAires,
|
|
176
|
+
},
|
|
177
|
+
})
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { PmProgress } from './PmProgress'
|
|
2
2
|
export { PmProgressModel } from './model/PmProgressModel'
|
|
3
|
+
export { StandardTag } from './components/standard/StandardTag'
|
|
3
4
|
export * from './shared/pmProgress.types'
|
|
5
|
+
export * from './shared/pmProgress.constants'
|
|
4
6
|
|
|
5
7
|
// TODO:
|
|
6
8
|
// !!! case when card is failed and easier card suggested !!!
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createEvent, createStore, restore } from 'effector'
|
|
2
|
+
|
|
3
|
+
export class PmHighlightModel {
|
|
4
|
+
public readonly expand = createEvent<string>()
|
|
5
|
+
public readonly hover = createEvent<string | null>()
|
|
6
|
+
|
|
7
|
+
public readonly $hoveredId = restore(this.hover, null)
|
|
8
|
+
public readonly $expandedId = createStore<string | null>(null).on(this.expand, (current, id) =>
|
|
9
|
+
current === id ? null : id,
|
|
10
|
+
)
|
|
11
|
+
}
|
|
@@ -6,6 +6,7 @@ import { PmTreeModel } from './PmTreeModel'
|
|
|
6
6
|
import { PmInsightsModel } from './PmInsightsModel'
|
|
7
7
|
import { PmRecommendationsModel } from './PmRecommendationsModel'
|
|
8
8
|
import { PmSolvingFlowModel } from './PmSolvingFlowModel'
|
|
9
|
+
import { PmHighlightModel } from './PmHighlightModel'
|
|
9
10
|
|
|
10
11
|
type PmProgressModelProps = {
|
|
11
12
|
api: PmProgressApiProps
|
|
@@ -16,12 +17,14 @@ export class PmProgressModel {
|
|
|
16
17
|
|
|
17
18
|
public readonly api: PmProgressApi
|
|
18
19
|
public readonly tree: PmTreeModel
|
|
20
|
+
public readonly highlight: PmHighlightModel
|
|
19
21
|
public readonly insights: PmInsightsModel
|
|
20
22
|
public readonly recommendations: PmRecommendationsModel
|
|
21
23
|
public readonly solving: PmSolvingFlowModel
|
|
22
24
|
|
|
23
25
|
constructor({ api }: PmProgressModelProps) {
|
|
24
26
|
this.api = new PmProgressApi(api)
|
|
27
|
+
this.highlight = new PmHighlightModel()
|
|
25
28
|
this.insights = new PmInsightsModel(this.api)
|
|
26
29
|
this.tree = new PmTreeModel(this.api)
|
|
27
30
|
this.recommendations = new PmRecommendationsModel(this.api)
|
|
@@ -29,18 +29,13 @@ export class PmTreeModel {
|
|
|
29
29
|
private readonly setupInitialGrade = createEvent<SetupInitialGradeProps>()
|
|
30
30
|
private readonly setDomains = createEvent<Domain[]>()
|
|
31
31
|
public readonly setGrade = createEvent<number | null>()
|
|
32
|
-
public readonly setHighlightedId = createEvent<string>()
|
|
33
|
-
|
|
34
32
|
public readonly $grade = restore(this.setGrade, null)
|
|
35
33
|
public readonly $domains = restore(this.setDomains, [])
|
|
36
34
|
public readonly $grades = createStore<Grade[]>([])
|
|
37
|
-
public readonly $highlightedId = createStore<string | null>(null).on(
|
|
38
|
-
this.setHighlightedId,
|
|
39
|
-
(highlightedId, idToHighlight) => (highlightedId === idToHighlight ? null : idToHighlight),
|
|
40
|
-
)
|
|
41
35
|
|
|
42
36
|
constructor(private readonly api: PmProgressApi) {
|
|
43
37
|
persist({ key: SessionStorageKeys.GRADE, store: this.$grade })
|
|
38
|
+
persist({ key: SessionStorageKeys.DOMAINS, store: this.$domains })
|
|
44
39
|
|
|
45
40
|
createAction(this.initTreeFx.done, {
|
|
46
41
|
target: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SolvingFlow } from './pmProgress.constants'
|
|
1
|
+
import { DOMAIN_COLORS, SolvingFlow } from './pmProgress.constants'
|
|
2
2
|
import type { SkillsToPracticeDto } from '@matteappen/skills-utils/enhanceProgressData/types'
|
|
3
3
|
|
|
4
4
|
type StatsSkill = {
|
|
@@ -205,3 +205,5 @@ export type StartSolvingStandard = {
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
export type StartSolvingProps = StartSolvingTeacher | StartSolvingMagma | StartSolvingStandard
|
|
208
|
+
|
|
209
|
+
export type DomainColor = (typeof DOMAIN_COLORS)[number]
|