@cuemath/leap 3.5.50 → 3.5.51-as10
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/assets/illustrations/illustrations.js +4 -0
- package/dist/assets/illustrations/illustrations.js.map +1 -1
- package/dist/features/chapters-v2/comps/node-card/node-card-styled.js +27 -31
- package/dist/features/chapters-v2/comps/node-card/node-card-styled.js.map +1 -1
- package/dist/features/chapters-v2/comps/node-card/node-card-tags.js +21 -13
- package/dist/features/chapters-v2/comps/node-card/node-card-tags.js.map +1 -1
- package/dist/features/chapters-v2/constants/node-constants.js +1 -1
- package/dist/features/chapters-v2/constants/node-constants.js.map +1 -1
- package/dist/features/chapters-v2/utils/node-card-utils.js +86 -79
- package/dist/features/chapters-v2/utils/node-card-utils.js.map +1 -1
- package/dist/features/homework/homework-card-view.js +125 -98
- package/dist/features/homework/homework-card-view.js.map +1 -1
- package/dist/features/homework/homework-card.js +196 -161
- package/dist/features/homework/homework-card.js.map +1 -1
- package/dist/features/homework/hw-card-list/api/get-homeworks.js +1 -1
- package/dist/features/homework/hw-card-list/api/get-homeworks.js.map +1 -1
- package/dist/features/homework/hw-card-list/hw-card-list-types.js +5 -0
- package/dist/features/homework/hw-card-list/hw-card-list-types.js.map +1 -0
- package/dist/features/homework/hw-card-list/hw-card-list-view.js +96 -86
- package/dist/features/homework/hw-card-list/hw-card-list-view.js.map +1 -1
- package/dist/features/homework/hw-card-list/hw-card-list.js +45 -43
- package/dist/features/homework/hw-card-list/hw-card-list.js.map +1 -1
- package/dist/features/homework/styles.js +0 -1
- package/dist/features/homework/styles.js.map +1 -1
- package/dist/features/homework/utils.js +18 -15
- package/dist/features/homework/utils.js.map +1 -1
- package/dist/features/journey/hooks/use-home-page-journey/home-page-homeworks-mock.js +325 -201
- package/dist/features/journey/hooks/use-home-page-journey/home-page-homeworks-mock.js.map +1 -1
- package/dist/features/journey/hooks/use-home-page-journey/use-home-page-journey.js +59 -56
- package/dist/features/journey/hooks/use-home-page-journey/use-home-page-journey.js.map +1 -1
- package/dist/features/journey/hooks/use-puzzles-journey/use-puzzle-assigned.js +17 -15
- package/dist/features/journey/hooks/use-puzzles-journey/use-puzzle-assigned.js.map +1 -1
- package/dist/features/math-fit/api/get-mathfit-assessment.js +10 -0
- package/dist/features/math-fit/api/get-mathfit-assessment.js.map +1 -0
- package/dist/features/math-fit/math-fit/math-fit.js +37 -0
- package/dist/features/math-fit/math-fit/math-fit.js.map +1 -0
- package/dist/features/math-fit/math-fit-card/math-fit-card-styled.js +22 -0
- package/dist/features/math-fit/math-fit-card/math-fit-card-styled.js.map +1 -0
- package/dist/features/math-fit/math-fit-card/math-fit-card.js +80 -0
- package/dist/features/math-fit/math-fit-card/math-fit-card.js.map +1 -0
- package/dist/features/math-fit/math-fit-overview/comps/section-card/section-card-styled.js +24 -0
- package/dist/features/math-fit/math-fit-overview/comps/section-card/section-card-styled.js.map +1 -0
- package/dist/features/math-fit/math-fit-overview/comps/section-card/section-card-types.js +5 -0
- package/dist/features/math-fit/math-fit-overview/comps/section-card/section-card-types.js.map +1 -0
- package/dist/features/math-fit/math-fit-overview/comps/section-card/section-card.js +99 -0
- package/dist/features/math-fit/math-fit-overview/comps/section-card/section-card.js.map +1 -0
- package/dist/features/math-fit/math-fit-overview/comps/stat-item/stat-item-styled.js +9 -0
- package/dist/features/math-fit/math-fit-overview/comps/stat-item/stat-item-styled.js.map +1 -0
- package/dist/features/math-fit/math-fit-overview/comps/stat-item/stat-item.js +26 -0
- package/dist/features/math-fit/math-fit-overview/comps/stat-item/stat-item.js.map +1 -0
- package/dist/features/math-fit/math-fit-overview/math-fit-overview-helpers.js +63 -0
- package/dist/features/math-fit/math-fit-overview/math-fit-overview-helpers.js.map +1 -0
- package/dist/features/math-fit/math-fit-overview/math-fit-overview-styled.js +9 -0
- package/dist/features/math-fit/math-fit-overview/math-fit-overview-styled.js.map +1 -0
- package/dist/features/math-fit/math-fit-overview/math-fit-overview-types.js +7 -0
- package/dist/features/math-fit/math-fit-overview/math-fit-overview-types.js.map +1 -0
- package/dist/features/math-fit/math-fit-overview/math-fit-overview.js +71 -0
- package/dist/features/math-fit/math-fit-overview/math-fit-overview.js.map +1 -0
- package/dist/features/math-fit/math-fit-report/comps/report-header/report-header-styled.js +38 -0
- package/dist/features/math-fit/math-fit-report/comps/report-header/report-header-styled.js.map +1 -0
- package/dist/features/math-fit/math-fit-report/comps/report-header/report-header.js +58 -0
- package/dist/features/math-fit/math-fit-report/comps/report-header/report-header.js.map +1 -0
- package/dist/features/math-fit/math-fit-report/comps/score-badge/score-badge-styled.js +28 -0
- package/dist/features/math-fit/math-fit-report/comps/score-badge/score-badge-styled.js.map +1 -0
- package/dist/features/math-fit/math-fit-report/comps/score-badge/score-badge.js +30 -0
- package/dist/features/math-fit/math-fit-report/comps/score-badge/score-badge.js.map +1 -0
- package/dist/features/math-fit/math-fit-report/comps/score-section/score-section-styled.js +9 -0
- package/dist/features/math-fit/math-fit-report/comps/score-section/score-section-styled.js.map +1 -0
- package/dist/features/math-fit/math-fit-report/comps/score-section/score-section.js +82 -0
- package/dist/features/math-fit/math-fit-report/comps/score-section/score-section.js.map +1 -0
- package/dist/features/math-fit/math-fit-report/math-fit-report-helpers.js +42 -0
- package/dist/features/math-fit/math-fit-report/math-fit-report-helpers.js.map +1 -0
- package/dist/features/math-fit/math-fit-report/math-fit-report.js +68 -0
- package/dist/features/math-fit/math-fit-report/math-fit-report.js.map +1 -0
- package/dist/features/milestone/milestone-list-container/api/get-tests-list.js +1 -1
- package/dist/features/milestone/milestone-list-container/api/get-tests-list.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-list.js +38 -36
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-list.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-tabs/milestone-tabs.js +57 -55
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-tabs/milestone-tabs.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget.js +59 -57
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list-container.js +54 -52
- package/dist/features/milestone/milestone-list-container/milestone-list-container.js.map +1 -1
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-container.js +39 -37
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-container.js.map +1 -1
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-view.js +48 -56
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-view.js.map +1 -1
- package/dist/features/sheet-v2/resource-list/resource-list.js +27 -23
- package/dist/features/sheet-v2/resource-list/resource-list.js.map +1 -1
- package/dist/index.d.ts +132 -7
- package/dist/index.js +131 -121
- package/dist/index.js.map +1 -1
- package/dist/static/clock-green.020570d3.svg +1 -0
- package/dist/static/math-fit-bg.4bfa3244.svg +1 -0
- package/dist/static/math-fit-card-bg.20c826bb.svg +1 -0
- package/dist/static/question-mark-blue.b6a7f37d.svg +1 -0
- package/package.json +1 -1
|
@@ -1,57 +1,58 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import
|
|
4
|
-
import { useUIContext as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { getGoalCategoryBasedColorTheme as
|
|
9
|
-
import { NoPlanCardWrapper as
|
|
10
|
-
const
|
|
1
|
+
import { jsx as t, jsxs as V, Fragment as X } from "react/jsx-runtime";
|
|
2
|
+
import { memo as q, useState as z, useCallback as J } from "react";
|
|
3
|
+
import K from "../../../../../chapters/chapters-list/chapters-list.js";
|
|
4
|
+
import { useUIContext as Q } from "../../../../../ui/context/context.js";
|
|
5
|
+
import Y from "../../../../../ui/text/text.js";
|
|
6
|
+
import Z from "../../../../milestone-resources/resources-list/resources-list.js";
|
|
7
|
+
import ee from "../../../../milestone-tests/test-list-v2/test-list-container.js";
|
|
8
|
+
import { getGoalCategoryBasedColorTheme as te } from "../milestone-utils.js";
|
|
9
|
+
import { NoPlanCardWrapper as oe, TabsWrapper as ne, TabsText as se, TabComponentWrapper as re } from "./milestone-tabs-styled.js";
|
|
10
|
+
const Ce = q(function(h) {
|
|
11
11
|
var v;
|
|
12
12
|
const {
|
|
13
13
|
goalCategory: k,
|
|
14
14
|
isDraftMilestone: r,
|
|
15
|
-
isGoalCreation:
|
|
15
|
+
isGoalCreation: M,
|
|
16
16
|
isMilestoneActive: l,
|
|
17
17
|
userMilestoneId: e,
|
|
18
18
|
chapters: c,
|
|
19
19
|
userType: d,
|
|
20
20
|
canUpdatePlan: m,
|
|
21
|
-
studentId:
|
|
22
|
-
milestoneState:
|
|
21
|
+
studentId: u,
|
|
22
|
+
milestoneState: I,
|
|
23
23
|
milestonePermissions: R,
|
|
24
24
|
activeMilestoneId: p,
|
|
25
25
|
activeTabId: $
|
|
26
|
-
} =
|
|
26
|
+
} = h, {
|
|
27
27
|
onAddChapter: x,
|
|
28
28
|
onAssignResources: w,
|
|
29
29
|
onChapterClick: P,
|
|
30
30
|
onCreateMilestoneTest: U,
|
|
31
31
|
onNodeAttempt: j,
|
|
32
32
|
onNodeView: E,
|
|
33
|
-
onNodeReview:
|
|
34
|
-
onNodeReattempt:
|
|
35
|
-
onNodeReset:
|
|
36
|
-
onNodeUnassign:
|
|
37
|
-
onNodeAssignAsHomework:
|
|
38
|
-
onTestPreview:
|
|
39
|
-
onTestReview:
|
|
40
|
-
onTestStart:
|
|
41
|
-
onWidgetTabSelection: a
|
|
42
|
-
|
|
33
|
+
onNodeReview: F,
|
|
34
|
+
onNodeReattempt: C,
|
|
35
|
+
onNodeReset: S,
|
|
36
|
+
onNodeUnassign: W,
|
|
37
|
+
onNodeAssignAsHomework: T,
|
|
38
|
+
onTestPreview: _,
|
|
39
|
+
onTestReview: y,
|
|
40
|
+
onTestStart: B,
|
|
41
|
+
onWidgetTabSelection: a,
|
|
42
|
+
onMathFitClick: D
|
|
43
|
+
} = h, { visible_tabs: g } = R, { onEvent: f } = Q(), { backgroundColor: G } = te(k, r), b = {
|
|
43
44
|
chapters: {
|
|
44
45
|
label: "Chapters",
|
|
45
46
|
component: /* @__PURE__ */ t(
|
|
46
|
-
|
|
47
|
+
K,
|
|
47
48
|
{
|
|
48
49
|
milestoneId: e,
|
|
49
50
|
chapters: c,
|
|
50
51
|
userType: d,
|
|
51
|
-
isGoalCreation:
|
|
52
|
+
isGoalCreation: M,
|
|
52
53
|
onChapterClick: P,
|
|
53
54
|
onAddChapter: x,
|
|
54
|
-
canUpdatePlan: !!(
|
|
55
|
+
canUpdatePlan: !!(I !== "DRAFT" && m),
|
|
55
56
|
isMilestoneActive: l
|
|
56
57
|
}
|
|
57
58
|
)
|
|
@@ -59,79 +60,80 @@ const he = X(function(u) {
|
|
|
59
60
|
tests: {
|
|
60
61
|
label: "Tests",
|
|
61
62
|
component: /* @__PURE__ */ t(
|
|
62
|
-
|
|
63
|
+
ee,
|
|
63
64
|
{
|
|
64
65
|
isDraftMilestone: r,
|
|
65
66
|
isChaptersAvailable: c.length > 0,
|
|
66
67
|
isMilestoneActive: l,
|
|
67
|
-
studentId:
|
|
68
|
+
studentId: u,
|
|
68
69
|
userMilestoneId: e,
|
|
69
70
|
userType: d,
|
|
70
71
|
canUpdatePlan: m,
|
|
71
72
|
onCreateMilestoneTest: U,
|
|
72
|
-
onNodeReattempt:
|
|
73
|
-
onTestPreview:
|
|
74
|
-
onTestStart:
|
|
75
|
-
onTestReview:
|
|
76
|
-
onNodeAssignAsHomework:
|
|
73
|
+
onNodeReattempt: C,
|
|
74
|
+
onTestPreview: _,
|
|
75
|
+
onTestStart: B,
|
|
76
|
+
onTestReview: y,
|
|
77
|
+
onNodeAssignAsHomework: T,
|
|
78
|
+
onMathFitClick: D
|
|
77
79
|
}
|
|
78
80
|
)
|
|
79
81
|
},
|
|
80
82
|
resources: {
|
|
81
83
|
label: "Resources",
|
|
82
84
|
component: /* @__PURE__ */ t(
|
|
83
|
-
|
|
85
|
+
Z,
|
|
84
86
|
{
|
|
85
87
|
isDraftMilestone: r,
|
|
86
88
|
isMilestoneActive: l,
|
|
87
89
|
userMilestoneId: e,
|
|
88
90
|
canUpdatePlan: m,
|
|
89
|
-
studentId:
|
|
91
|
+
studentId: u,
|
|
90
92
|
userType: d,
|
|
91
93
|
onAssignResources: w,
|
|
92
94
|
onNodeAttempt: j,
|
|
93
95
|
onNodeView: E,
|
|
94
|
-
onNodeReview:
|
|
95
|
-
onNodeReattempt:
|
|
96
|
-
onNodeReset:
|
|
97
|
-
onNodeUnassign:
|
|
98
|
-
onNodeAssignAsHomework:
|
|
96
|
+
onNodeReview: F,
|
|
97
|
+
onNodeReattempt: C,
|
|
98
|
+
onNodeReset: S,
|
|
99
|
+
onNodeUnassign: W,
|
|
100
|
+
onNodeAssignAsHomework: T
|
|
99
101
|
}
|
|
100
102
|
)
|
|
101
103
|
}
|
|
102
|
-
},
|
|
104
|
+
}, n = (g ?? []).length === 0 ? Object.entries(b) : Object.entries(b).filter(
|
|
103
105
|
([o]) => (g ?? []).includes(o.toUpperCase())
|
|
104
|
-
), [i,
|
|
105
|
-
e === p ? $ : ((v =
|
|
106
|
-
),
|
|
107
|
-
(o,
|
|
106
|
+
), [i, O] = z(
|
|
107
|
+
e === p ? $ : ((v = n == null ? void 0 : n[0]) == null ? void 0 : v[0]) || "chapters"
|
|
108
|
+
), H = J(
|
|
109
|
+
(o, s) => {
|
|
108
110
|
if (p === e && o === i) return null;
|
|
109
|
-
|
|
110
|
-
cta:
|
|
111
|
+
O(o), a == null || a(e, o), f("clicked", {
|
|
112
|
+
cta: s,
|
|
111
113
|
milestone_id: e
|
|
112
114
|
});
|
|
113
115
|
},
|
|
114
116
|
[p, e, i, a, f]
|
|
115
117
|
);
|
|
116
|
-
return r && c.length === 0 ? /* @__PURE__ */ t(
|
|
117
|
-
/* @__PURE__ */ t(
|
|
118
|
-
const [
|
|
118
|
+
return r && c.length === 0 ? /* @__PURE__ */ t(oe, { $gutterX: 2, $background: "WHITE_3", children: /* @__PURE__ */ t(Y, { $renderAs: "ab2", $color: "RED", children: "No chapter has been assigned" }) }) : /* @__PURE__ */ V(X, { children: [
|
|
119
|
+
/* @__PURE__ */ t(ne, { $backgroundColor: G, $frames: n.length, children: n.map((o) => {
|
|
120
|
+
const [s, L] = o, { label: A } = L, N = s === i;
|
|
119
121
|
return /* @__PURE__ */ t(
|
|
120
122
|
se,
|
|
121
123
|
{
|
|
122
124
|
$renderAs: N ? "ub3-bold" : "ub3",
|
|
123
125
|
$align: "center",
|
|
124
126
|
$selected: N,
|
|
125
|
-
onClick: () =>
|
|
127
|
+
onClick: () => H(s, A),
|
|
126
128
|
children: A
|
|
127
129
|
},
|
|
128
|
-
|
|
130
|
+
s
|
|
129
131
|
);
|
|
130
132
|
}) }),
|
|
131
|
-
/* @__PURE__ */ t(
|
|
133
|
+
/* @__PURE__ */ t(re, { children: b[i].component })
|
|
132
134
|
] });
|
|
133
135
|
});
|
|
134
136
|
export {
|
|
135
|
-
|
|
137
|
+
Ce as default
|
|
136
138
|
};
|
|
137
139
|
//# sourceMappingURL=milestone-tabs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"milestone-tabs.js","sources":["../../../../../../../src/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-tabs/milestone-tabs.tsx"],"sourcesContent":["import { memo, useCallback, useState, type FC } from 'react';\n\nimport ChaptersList from '../../../../../chapters/chapters-list/chapters-list';\nimport { useUIContext } from '../../../../../ui/context/context';\nimport Text from '../../../../../ui/text/text';\nimport MilestoneWidgetResources from '../../../../milestone-resources/resources-list/resources-list';\nimport MilestoneTestsList from '../../../../milestone-tests/test-list-v2/test-list-container';\nimport { getGoalCategoryBasedColorTheme } from '../milestone-utils';\nimport * as Styled from './milestone-tabs-styled';\nimport type { IMilestoneTabConfig, IMilestoneTabsProps } from './milestone-tabs-types';\n\nconst MilestoneTabs: FC<IMilestoneTabsProps> = memo(function MilestoneTabs(props) {\n const {\n goalCategory,\n isDraftMilestone,\n isGoalCreation,\n isMilestoneActive,\n userMilestoneId,\n chapters,\n userType,\n canUpdatePlan,\n studentId,\n milestoneState,\n milestonePermissions,\n activeMilestoneId,\n activeTabId,\n } = props;\n const {\n onAddChapter,\n onAssignResources,\n onChapterClick,\n onCreateMilestoneTest,\n onNodeAttempt,\n onNodeView,\n onNodeReview,\n onNodeReattempt,\n onNodeReset,\n onNodeUnassign,\n onNodeAssignAsHomework,\n onTestPreview,\n onTestReview,\n onTestStart,\n onWidgetTabSelection,\n } = props;\n const { visible_tabs: visibleTabs } = milestonePermissions;\n const { onEvent: trackEvent } = useUIContext();\n\n const { backgroundColor } = getGoalCategoryBasedColorTheme(goalCategory, isDraftMilestone);\n\n const TAB_CONFIG: IMilestoneTabConfig = {\n chapters: {\n label: 'Chapters',\n component: (\n <ChaptersList\n milestoneId={userMilestoneId}\n chapters={chapters}\n userType={userType}\n isGoalCreation={isGoalCreation}\n onChapterClick={onChapterClick}\n onAddChapter={onAddChapter}\n canUpdatePlan={Boolean(milestoneState !== 'DRAFT' && canUpdatePlan)}\n isMilestoneActive={isMilestoneActive}\n />\n ),\n },\n tests: {\n label: 'Tests',\n component: (\n <MilestoneTestsList\n isDraftMilestone={isDraftMilestone}\n isChaptersAvailable={chapters.length > 0}\n isMilestoneActive={isMilestoneActive}\n studentId={studentId}\n userMilestoneId={userMilestoneId}\n userType={userType}\n canUpdatePlan={canUpdatePlan}\n onCreateMilestoneTest={onCreateMilestoneTest}\n onNodeReattempt={onNodeReattempt}\n onTestPreview={onTestPreview}\n onTestStart={onTestStart}\n onTestReview={onTestReview}\n onNodeAssignAsHomework={onNodeAssignAsHomework}\n />\n ),\n },\n resources: {\n label: 'Resources',\n component: (\n <MilestoneWidgetResources\n isDraftMilestone={isDraftMilestone}\n isMilestoneActive={isMilestoneActive}\n userMilestoneId={userMilestoneId}\n canUpdatePlan={canUpdatePlan}\n studentId={studentId}\n userType={userType}\n onAssignResources={onAssignResources}\n onNodeAttempt={onNodeAttempt}\n onNodeView={onNodeView}\n onNodeReview={onNodeReview}\n onNodeReattempt={onNodeReattempt}\n onNodeReset={onNodeReset}\n onNodeUnassign={onNodeUnassign}\n onNodeAssignAsHomework={onNodeAssignAsHomework}\n />\n ),\n },\n };\n\n const filteredTabConfig =\n (visibleTabs ?? []).length === 0\n ? Object.entries(TAB_CONFIG)\n : Object.entries(TAB_CONFIG).filter(([tabName]) =>\n (visibleTabs ?? []).includes(tabName.toUpperCase()),\n );\n const [selectedTabName, setSelectedTabName] = useState(\n userMilestoneId === activeMilestoneId ? activeTabId : filteredTabConfig?.[0]?.[0] || 'chapters',\n );\n\n const handleTabChange = useCallback(\n (tabName: keyof IMilestoneTabConfig, ctaLabel: string) => {\n if (activeMilestoneId === userMilestoneId && tabName === selectedTabName) return null;\n\n setSelectedTabName(tabName);\n\n onWidgetTabSelection?.(userMilestoneId, tabName);\n\n trackEvent('clicked', {\n cta: ctaLabel,\n milestone_id: userMilestoneId,\n });\n },\n [activeMilestoneId, userMilestoneId, selectedTabName, onWidgetTabSelection, trackEvent],\n );\n\n if (isDraftMilestone && chapters.length === 0) {\n return (\n <Styled.NoPlanCardWrapper $gutterX={2} $background=\"WHITE_3\">\n <Text $renderAs=\"ab2\" $color=\"RED\">\n No chapter has been assigned\n </Text>\n </Styled.NoPlanCardWrapper>\n );\n }\n\n return (\n <>\n <Styled.TabsWrapper $backgroundColor={backgroundColor} $frames={filteredTabConfig.length}>\n {filteredTabConfig.map(tabConfig => {\n const [tabName, tabInfo] = tabConfig;\n const { label } = tabInfo;\n const isSelected = tabName === selectedTabName;\n\n return (\n <Styled.TabsText\n $renderAs={isSelected ? 'ub3-bold' : 'ub3'}\n $align=\"center\"\n key={tabName}\n $selected={isSelected}\n onClick={() => handleTabChange(tabName as keyof IMilestoneTabConfig, label)}\n >\n {label}\n </Styled.TabsText>\n );\n })}\n </Styled.TabsWrapper>\n\n <Styled.TabComponentWrapper>\n {TAB_CONFIG[selectedTabName as keyof typeof TAB_CONFIG].component}\n </Styled.TabComponentWrapper>\n </>\n );\n});\n\nexport default MilestoneTabs;\n"],"names":["MilestoneTabs","memo","props","goalCategory","isDraftMilestone","isGoalCreation","isMilestoneActive","userMilestoneId","chapters","userType","canUpdatePlan","studentId","milestoneState","milestonePermissions","activeMilestoneId","activeTabId","onAddChapter","onAssignResources","onChapterClick","onCreateMilestoneTest","onNodeAttempt","onNodeView","onNodeReview","onNodeReattempt","onNodeReset","onNodeUnassign","onNodeAssignAsHomework","onTestPreview","onTestReview","onTestStart","onWidgetTabSelection","visibleTabs","trackEvent","useUIContext","backgroundColor","getGoalCategoryBasedColorTheme","TAB_CONFIG","jsx","ChaptersList","MilestoneTestsList","MilestoneWidgetResources","filteredTabConfig","tabName","selectedTabName","setSelectedTabName","useState","_a","handleTabChange","useCallback","ctaLabel","Styled.NoPlanCardWrapper","Text","jsxs","Fragment","Styled.TabsWrapper","tabConfig","tabInfo","label","isSelected","Styled.TabsText","Styled.TabComponentWrapper"],"mappings":";;;;;;;;;AAWA,MAAMA,KAAyCC,EAAK,SAAuBC,GAAO;;AAC1E,QAAA;AAAA,IACJ,cAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,eAAAC;AAAA,IACA,WAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,aAAAC;AAAA,EACE,IAAAb,GACE;AAAA,IACJ,cAAAc;AAAA,IACA,mBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,sBAAAC;AAAA,EACE,
|
|
1
|
+
{"version":3,"file":"milestone-tabs.js","sources":["../../../../../../../src/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-tabs/milestone-tabs.tsx"],"sourcesContent":["import { memo, useCallback, useState, type FC } from 'react';\n\nimport ChaptersList from '../../../../../chapters/chapters-list/chapters-list';\nimport { useUIContext } from '../../../../../ui/context/context';\nimport Text from '../../../../../ui/text/text';\nimport MilestoneWidgetResources from '../../../../milestone-resources/resources-list/resources-list';\nimport MilestoneTestsList from '../../../../milestone-tests/test-list-v2/test-list-container';\nimport { getGoalCategoryBasedColorTheme } from '../milestone-utils';\nimport * as Styled from './milestone-tabs-styled';\nimport type { IMilestoneTabConfig, IMilestoneTabsProps } from './milestone-tabs-types';\n\nconst MilestoneTabs: FC<IMilestoneTabsProps> = memo(function MilestoneTabs(props) {\n const {\n goalCategory,\n isDraftMilestone,\n isGoalCreation,\n isMilestoneActive,\n userMilestoneId,\n chapters,\n userType,\n canUpdatePlan,\n studentId,\n milestoneState,\n milestonePermissions,\n activeMilestoneId,\n activeTabId,\n } = props;\n const {\n onAddChapter,\n onAssignResources,\n onChapterClick,\n onCreateMilestoneTest,\n onNodeAttempt,\n onNodeView,\n onNodeReview,\n onNodeReattempt,\n onNodeReset,\n onNodeUnassign,\n onNodeAssignAsHomework,\n onTestPreview,\n onTestReview,\n onTestStart,\n onWidgetTabSelection,\n onMathFitClick,\n } = props;\n const { visible_tabs: visibleTabs } = milestonePermissions;\n const { onEvent: trackEvent } = useUIContext();\n\n const { backgroundColor } = getGoalCategoryBasedColorTheme(goalCategory, isDraftMilestone);\n\n const TAB_CONFIG: IMilestoneTabConfig = {\n chapters: {\n label: 'Chapters',\n component: (\n <ChaptersList\n milestoneId={userMilestoneId}\n chapters={chapters}\n userType={userType}\n isGoalCreation={isGoalCreation}\n onChapterClick={onChapterClick}\n onAddChapter={onAddChapter}\n canUpdatePlan={Boolean(milestoneState !== 'DRAFT' && canUpdatePlan)}\n isMilestoneActive={isMilestoneActive}\n />\n ),\n },\n tests: {\n label: 'Tests',\n component: (\n <MilestoneTestsList\n isDraftMilestone={isDraftMilestone}\n isChaptersAvailable={chapters.length > 0}\n isMilestoneActive={isMilestoneActive}\n studentId={studentId}\n userMilestoneId={userMilestoneId}\n userType={userType}\n canUpdatePlan={canUpdatePlan}\n onCreateMilestoneTest={onCreateMilestoneTest}\n onNodeReattempt={onNodeReattempt}\n onTestPreview={onTestPreview}\n onTestStart={onTestStart}\n onTestReview={onTestReview}\n onNodeAssignAsHomework={onNodeAssignAsHomework}\n onMathFitClick={onMathFitClick}\n />\n ),\n },\n resources: {\n label: 'Resources',\n component: (\n <MilestoneWidgetResources\n isDraftMilestone={isDraftMilestone}\n isMilestoneActive={isMilestoneActive}\n userMilestoneId={userMilestoneId}\n canUpdatePlan={canUpdatePlan}\n studentId={studentId}\n userType={userType}\n onAssignResources={onAssignResources}\n onNodeAttempt={onNodeAttempt}\n onNodeView={onNodeView}\n onNodeReview={onNodeReview}\n onNodeReattempt={onNodeReattempt}\n onNodeReset={onNodeReset}\n onNodeUnassign={onNodeUnassign}\n onNodeAssignAsHomework={onNodeAssignAsHomework}\n />\n ),\n },\n };\n\n const filteredTabConfig =\n (visibleTabs ?? []).length === 0\n ? Object.entries(TAB_CONFIG)\n : Object.entries(TAB_CONFIG).filter(([tabName]) =>\n (visibleTabs ?? []).includes(tabName.toUpperCase()),\n );\n const [selectedTabName, setSelectedTabName] = useState(\n userMilestoneId === activeMilestoneId ? activeTabId : filteredTabConfig?.[0]?.[0] || 'chapters',\n );\n\n const handleTabChange = useCallback(\n (tabName: keyof IMilestoneTabConfig, ctaLabel: string) => {\n if (activeMilestoneId === userMilestoneId && tabName === selectedTabName) return null;\n\n setSelectedTabName(tabName);\n\n onWidgetTabSelection?.(userMilestoneId, tabName);\n\n trackEvent('clicked', {\n cta: ctaLabel,\n milestone_id: userMilestoneId,\n });\n },\n [activeMilestoneId, userMilestoneId, selectedTabName, onWidgetTabSelection, trackEvent],\n );\n\n if (isDraftMilestone && chapters.length === 0) {\n return (\n <Styled.NoPlanCardWrapper $gutterX={2} $background=\"WHITE_3\">\n <Text $renderAs=\"ab2\" $color=\"RED\">\n No chapter has been assigned\n </Text>\n </Styled.NoPlanCardWrapper>\n );\n }\n\n return (\n <>\n <Styled.TabsWrapper $backgroundColor={backgroundColor} $frames={filteredTabConfig.length}>\n {filteredTabConfig.map(tabConfig => {\n const [tabName, tabInfo] = tabConfig;\n const { label } = tabInfo;\n const isSelected = tabName === selectedTabName;\n\n return (\n <Styled.TabsText\n $renderAs={isSelected ? 'ub3-bold' : 'ub3'}\n $align=\"center\"\n key={tabName}\n $selected={isSelected}\n onClick={() => handleTabChange(tabName as keyof IMilestoneTabConfig, label)}\n >\n {label}\n </Styled.TabsText>\n );\n })}\n </Styled.TabsWrapper>\n\n <Styled.TabComponentWrapper>\n {TAB_CONFIG[selectedTabName as keyof typeof TAB_CONFIG].component}\n </Styled.TabComponentWrapper>\n </>\n );\n});\n\nexport default MilestoneTabs;\n"],"names":["MilestoneTabs","memo","props","goalCategory","isDraftMilestone","isGoalCreation","isMilestoneActive","userMilestoneId","chapters","userType","canUpdatePlan","studentId","milestoneState","milestonePermissions","activeMilestoneId","activeTabId","onAddChapter","onAssignResources","onChapterClick","onCreateMilestoneTest","onNodeAttempt","onNodeView","onNodeReview","onNodeReattempt","onNodeReset","onNodeUnassign","onNodeAssignAsHomework","onTestPreview","onTestReview","onTestStart","onWidgetTabSelection","onMathFitClick","visibleTabs","trackEvent","useUIContext","backgroundColor","getGoalCategoryBasedColorTheme","TAB_CONFIG","jsx","ChaptersList","MilestoneTestsList","MilestoneWidgetResources","filteredTabConfig","tabName","selectedTabName","setSelectedTabName","useState","_a","handleTabChange","useCallback","ctaLabel","Styled.NoPlanCardWrapper","Text","jsxs","Fragment","Styled.TabsWrapper","tabConfig","tabInfo","label","isSelected","Styled.TabsText","Styled.T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;AAAA,MAAA,CACf;AAAA,IACH;AAAA,IACA,CAACO,GAAmBP,GAAiBqC,GAAiBd,GAAsBG,CAAU;AAAA,EAAA;AAGpF,SAAA7B,KAAoBI,EAAS,WAAW,IAEvC,gBAAA8B,EAAAa,IAAA,EAAyB,UAAU,GAAG,aAAY,WACjD,UAAA,gBAAAb,EAACc,KAAK,WAAU,OAAM,QAAO,OAAM,0CAEnC,EACF,CAAA,IAMA,gBAAAC,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAC,gBAAAhB,EAAAiB,IAAA,EAAmB,kBAAkBpB,GAAiB,SAASO,EAAkB,QAC/E,UAAkBA,EAAA,IAAI,CAAac,MAAA;AAC5B,YAAA,CAACb,GAASc,CAAO,IAAID,GACrB,EAAE,OAAAE,EAAU,IAAAD,GACZE,IAAahB,MAAYC;AAG7B,aAAA,gBAAAN;AAAA,QAACsB;AAAAA,QAAA;AAAA,UACC,WAAWD,IAAa,aAAa;AAAA,UACrC,QAAO;AAAA,UAEP,WAAWA;AAAA,UACX,SAAS,MAAMX,EAAgBL,GAAsCe,CAAK;AAAA,UAEzE,UAAAA;AAAA,QAAA;AAAA,QAJIf;AAAA,MAAA;AAAA,IAOV,CAAA,GACH;AAAA,sBAECkB,IAAA,EACE,UAAWxB,EAAAO,CAA0C,EAAE,WAC1D;AAAA,EACF,EAAA,CAAA;AAEJ,CAAC;"}
|
|
@@ -1,132 +1,134 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { jsxs as te, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { memo as ne, useState as se, useCallback as f, useEffect as ae } from "react";
|
|
3
|
+
import ie from "../../../../ui/layout/flex-view.js";
|
|
4
|
+
import re from "./milestone-info.js";
|
|
5
|
+
import le from "./milestone-tabs/milestone-tabs.js";
|
|
6
6
|
import { getGoalCategoryBasedColorTheme as de } from "./milestone-utils.js";
|
|
7
|
-
import { MainContainer as
|
|
8
|
-
const
|
|
7
|
+
import { MainContainer as ce, Wrapper as me, ContentWrapper as pe, Content as ge } from "./milestone-widget-styled.js";
|
|
8
|
+
const Ne = ne(function(h) {
|
|
9
9
|
const { milestone: s, studentId: a, isMilestoneActive: i, ...T } = h, {
|
|
10
|
-
isStudentPresent:
|
|
11
|
-
isClassOngoing:
|
|
10
|
+
isStudentPresent: M,
|
|
11
|
+
isClassOngoing: A,
|
|
12
12
|
userType: r,
|
|
13
13
|
studentName: E,
|
|
14
14
|
parentName: N,
|
|
15
15
|
teacherName: x,
|
|
16
16
|
courseStream: _,
|
|
17
|
-
activeMilestoneId:
|
|
17
|
+
activeMilestoneId: l,
|
|
18
18
|
activeTabId: b,
|
|
19
19
|
isTrialSession: D,
|
|
20
20
|
onAddOutcome: I,
|
|
21
21
|
onChapterClick: W,
|
|
22
|
-
onEdit:
|
|
23
|
-
onCreateMilestoneTest:
|
|
24
|
-
onDraftPublish:
|
|
25
|
-
onAddChapter:
|
|
26
|
-
onAssignResources:
|
|
27
|
-
onNodeAttempt:
|
|
22
|
+
onEdit: k,
|
|
23
|
+
onCreateMilestoneTest: w,
|
|
24
|
+
onDraftPublish: P,
|
|
25
|
+
onAddChapter: R,
|
|
26
|
+
onAssignResources: S,
|
|
27
|
+
onNodeAttempt: $,
|
|
28
28
|
onNodeView: v,
|
|
29
29
|
onNodeReview: y,
|
|
30
30
|
onNodeReattempt: O,
|
|
31
31
|
onNodeReset: B,
|
|
32
|
-
onNodeUnassign:
|
|
33
|
-
onNodeAssignAsHomework:
|
|
34
|
-
onWidgetTabSelection:
|
|
32
|
+
onNodeUnassign: F,
|
|
33
|
+
onNodeAssignAsHomework: G,
|
|
34
|
+
onWidgetTabSelection: V,
|
|
35
35
|
//* Test sheet callbacks
|
|
36
36
|
onTestPreview: U,
|
|
37
37
|
onTestReview: j,
|
|
38
38
|
onTestStart: X,
|
|
39
|
-
|
|
39
|
+
onMathFitClick: H,
|
|
40
|
+
milestoneType: Y
|
|
40
41
|
} = T, {
|
|
41
|
-
id:
|
|
42
|
+
id: d,
|
|
42
43
|
user_milestone_plan: c,
|
|
43
|
-
outcome_data:
|
|
44
|
+
outcome_data: q,
|
|
44
45
|
milestone_state: t,
|
|
45
46
|
permissions: m,
|
|
46
47
|
goal_code: p,
|
|
47
48
|
goal_category: g
|
|
48
|
-
} = s, [u, n] =
|
|
49
|
-
i && t === "ACTIVE" ||
|
|
50
|
-
),
|
|
49
|
+
} = s, [u, n] = se(
|
|
50
|
+
i && t === "ACTIVE" || Y === "DRAFT"
|
|
51
|
+
), z = !!c, { can_update_plan: J } = m, { outcomes: K } = q || {}, { user_chapters: L = [] } = c || {}, Q = f(() => {
|
|
51
52
|
n((e) => !e);
|
|
52
|
-
}, []), C = t === "DRAFT",
|
|
53
|
+
}, []), C = t === "DRAFT", Z = t === "OUTCOME_ADDED", { backgroundColor: ee } = de(
|
|
53
54
|
g,
|
|
54
55
|
C
|
|
55
|
-
),
|
|
56
|
+
), oe = f(() => {
|
|
56
57
|
n((e) => !e);
|
|
57
58
|
}, [n]);
|
|
58
|
-
return
|
|
59
|
-
const e = document.getElementById(`milestone-${
|
|
59
|
+
return ae(() => {
|
|
60
|
+
const e = document.getElementById(`milestone-${l}`);
|
|
60
61
|
e && e.scrollIntoView();
|
|
61
|
-
}, []), /* @__PURE__ */
|
|
62
|
+
}, []), /* @__PURE__ */ te(ce, { id: `milestone-${d}`, children: [
|
|
62
63
|
/* @__PURE__ */ o(
|
|
63
|
-
|
|
64
|
+
me,
|
|
64
65
|
{
|
|
65
|
-
onClick:
|
|
66
|
-
$background:
|
|
66
|
+
onClick: oe,
|
|
67
|
+
$background: ee,
|
|
67
68
|
$gapX: 1.5,
|
|
68
69
|
$borderColor: "GREY_2",
|
|
69
|
-
children: /* @__PURE__ */ o(
|
|
70
|
-
|
|
70
|
+
children: /* @__PURE__ */ o(ie, { $flexGapX: p ? 1.5 : 1, children: /* @__PURE__ */ o(
|
|
71
|
+
re,
|
|
71
72
|
{
|
|
72
73
|
milestone: s,
|
|
73
|
-
onEdit:
|
|
74
|
+
onEdit: k,
|
|
74
75
|
isExpanded: u,
|
|
75
|
-
toggleExpand:
|
|
76
|
+
toggleExpand: Q,
|
|
76
77
|
userType: r,
|
|
77
|
-
isClassOngoing:
|
|
78
|
-
isStudentPresent:
|
|
78
|
+
isClassOngoing: A,
|
|
79
|
+
isStudentPresent: M,
|
|
79
80
|
onAddOutcome: I,
|
|
80
81
|
studentId: a,
|
|
81
82
|
studentName: E,
|
|
82
83
|
teacherName: x ?? "",
|
|
83
84
|
parentName: N ?? "",
|
|
84
|
-
onDraftPublish:
|
|
85
|
+
onDraftPublish: P,
|
|
85
86
|
courseStream: _,
|
|
86
|
-
outcomes:
|
|
87
|
+
outcomes: K,
|
|
87
88
|
isTrialSession: D
|
|
88
89
|
}
|
|
89
90
|
) })
|
|
90
91
|
}
|
|
91
92
|
),
|
|
92
|
-
/* @__PURE__ */ o(
|
|
93
|
-
|
|
93
|
+
/* @__PURE__ */ o(pe, { $expanded: u, children: /* @__PURE__ */ o(ge, { children: /* @__PURE__ */ o(
|
|
94
|
+
le,
|
|
94
95
|
{
|
|
95
96
|
goalCategory: g,
|
|
96
97
|
isGoalCreation: !!p,
|
|
97
98
|
isDraftMilestone: C,
|
|
98
|
-
isOutcomeAdded:
|
|
99
|
+
isOutcomeAdded: Z,
|
|
99
100
|
isMilestoneActive: i,
|
|
100
|
-
isPlanAvailable:
|
|
101
|
-
userMilestoneId:
|
|
102
|
-
chapters:
|
|
101
|
+
isPlanAvailable: z,
|
|
102
|
+
userMilestoneId: d,
|
|
103
|
+
chapters: L,
|
|
103
104
|
userType: r,
|
|
104
|
-
canUpdatePlan:
|
|
105
|
+
canUpdatePlan: J,
|
|
105
106
|
milestoneState: t,
|
|
106
107
|
studentId: a,
|
|
107
|
-
onAddChapter:
|
|
108
|
-
onAssignResources:
|
|
108
|
+
onAddChapter: R,
|
|
109
|
+
onAssignResources: S,
|
|
109
110
|
onChapterClick: W,
|
|
110
|
-
onCreateMilestoneTest:
|
|
111
|
+
onCreateMilestoneTest: w,
|
|
111
112
|
onTestPreview: U,
|
|
112
113
|
onTestReview: j,
|
|
113
114
|
onTestStart: X,
|
|
114
|
-
onNodeAttempt:
|
|
115
|
+
onNodeAttempt: $,
|
|
115
116
|
onNodeView: v,
|
|
116
117
|
onNodeReview: y,
|
|
117
118
|
onNodeReattempt: O,
|
|
118
119
|
onNodeReset: B,
|
|
119
|
-
onNodeUnassign:
|
|
120
|
-
onNodeAssignAsHomework:
|
|
120
|
+
onNodeUnassign: F,
|
|
121
|
+
onNodeAssignAsHomework: G,
|
|
121
122
|
milestonePermissions: m,
|
|
122
|
-
activeMilestoneId:
|
|
123
|
+
activeMilestoneId: l,
|
|
123
124
|
activeTabId: b,
|
|
124
|
-
onWidgetTabSelection:
|
|
125
|
+
onWidgetTabSelection: V,
|
|
126
|
+
onMathFitClick: H
|
|
125
127
|
}
|
|
126
128
|
) }) })
|
|
127
129
|
] });
|
|
128
130
|
});
|
|
129
131
|
export {
|
|
130
|
-
|
|
132
|
+
Ne as default
|
|
131
133
|
};
|
|
132
134
|
//# sourceMappingURL=milestone-widget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"milestone-widget.js","sources":["../../../../../../src/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget.tsx"],"sourcesContent":["import { memo, useCallback, useEffect, useState, type FC } from 'react';\n\nimport FlexView from '../../../../ui/layout/flex-view';\nimport MilestoneInfoWrapper from './milestone-info';\nimport MilestoneTabs from './milestone-tabs/milestone-tabs';\nimport { getGoalCategoryBasedColorTheme } from './milestone-utils';\nimport * as Styled from './milestone-widget-styled';\nimport type { IMilestoneWidgetProps } from './milestone-widget-types';\n\nconst MilestoneWidget: FC<IMilestoneWidgetProps> = memo(function MilestoneWidget(props) {\n const { milestone, studentId, isMilestoneActive, ...restMilestoneWidgetProps } = props;\n const {\n isStudentPresent,\n isClassOngoing,\n userType,\n studentName,\n parentName,\n teacherName,\n courseStream,\n activeMilestoneId,\n activeTabId,\n isTrialSession,\n onAddOutcome,\n onChapterClick,\n onEdit,\n onCreateMilestoneTest,\n onDraftPublish,\n onAddChapter,\n onAssignResources,\n onNodeAttempt,\n onNodeView,\n onNodeReview,\n onNodeReattempt,\n onNodeReset,\n onNodeUnassign,\n onNodeAssignAsHomework,\n onWidgetTabSelection,\n //* Test sheet callbacks\n onTestPreview,\n onTestReview,\n onTestStart,\n milestoneType,\n } = restMilestoneWidgetProps;\n\n const {\n id: milestoneId,\n user_milestone_plan: userMileStonePlan,\n outcome_data: outcomeData,\n milestone_state: milestoneState,\n permissions: milestonePermissions,\n goal_code: goalCode,\n goal_category: goalCategory,\n } = milestone;\n\n const [widgetExpanded, setWidgetExpanded] = useState(\n (isMilestoneActive && milestoneState === 'ACTIVE') || milestoneType === 'DRAFT',\n );\n\n const isPlanAvailable = Boolean(userMileStonePlan);\n\n const { can_update_plan: canUpdatePlan } = milestonePermissions;\n const { outcomes } = outcomeData || {};\n\n const { user_chapters: chaptersData = [] } = userMileStonePlan || {};\n\n const toggleExpand = useCallback(() => {\n setWidgetExpanded(prev => !prev);\n }, []);\n\n const isDraftMilestone = milestoneState === 'DRAFT';\n const isOutcomeAdded = milestoneState === 'OUTCOME_ADDED';\n\n const { backgroundColor: goalBackgroundColor } = getGoalCategoryBasedColorTheme(\n goalCategory,\n isDraftMilestone,\n );\n\n const handleOnWidgetExpand = useCallback(() => {\n setWidgetExpanded(prev => !prev);\n }, [setWidgetExpanded]);\n\n useEffect(() => {\n const $element = document.getElementById(`milestone-${activeMilestoneId}`);\n\n if ($element) {\n $element.scrollIntoView();\n }\n //* Disabling the exhaustive-deps rule as we want to run this effect only once\n //* We don't want this to run when activeMilestoneId changes, as it will cause component to scroll into the view every time.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <Styled.MainContainer id={`milestone-${milestoneId}`}>\n <Styled.Wrapper\n onClick={handleOnWidgetExpand}\n $background={goalBackgroundColor}\n $gapX={1.5}\n $borderColor=\"GREY_2\"\n >\n <FlexView $flexGapX={goalCode ? 1.5 : 1}>\n <MilestoneInfoWrapper\n milestone={milestone}\n onEdit={onEdit}\n isExpanded={widgetExpanded}\n toggleExpand={toggleExpand}\n userType={userType}\n isClassOngoing={isClassOngoing}\n isStudentPresent={isStudentPresent}\n onAddOutcome={onAddOutcome}\n studentId={studentId}\n studentName={studentName}\n teacherName={teacherName ?? ''}\n parentName={parentName ?? ''}\n onDraftPublish={onDraftPublish}\n courseStream={courseStream}\n outcomes={outcomes}\n isTrialSession={isTrialSession}\n />\n </FlexView>\n </Styled.Wrapper>\n\n <Styled.ContentWrapper $expanded={widgetExpanded}>\n <Styled.Content>\n <MilestoneTabs\n goalCategory={goalCategory}\n isGoalCreation={!!goalCode}\n isDraftMilestone={isDraftMilestone}\n isOutcomeAdded={isOutcomeAdded}\n isMilestoneActive={isMilestoneActive}\n isPlanAvailable={isPlanAvailable}\n userMilestoneId={milestoneId}\n chapters={chaptersData}\n userType={userType}\n canUpdatePlan={canUpdatePlan}\n milestoneState={milestoneState}\n studentId={studentId}\n onAddChapter={onAddChapter}\n onAssignResources={onAssignResources}\n onChapterClick={onChapterClick}\n onCreateMilestoneTest={onCreateMilestoneTest}\n onTestPreview={onTestPreview}\n onTestReview={onTestReview}\n onTestStart={onTestStart}\n onNodeAttempt={onNodeAttempt}\n onNodeView={onNodeView}\n onNodeReview={onNodeReview}\n onNodeReattempt={onNodeReattempt}\n onNodeReset={onNodeReset}\n onNodeUnassign={onNodeUnassign}\n onNodeAssignAsHomework={onNodeAssignAsHomework}\n milestonePermissions={milestonePermissions}\n activeMilestoneId={activeMilestoneId}\n activeTabId={activeTabId}\n onWidgetTabSelection={onWidgetTabSelection}\n />\n </Styled.Content>\n </Styled.ContentWrapper>\n </Styled.MainContainer>\n );\n});\n\nexport default MilestoneWidget;\n"],"names":["MilestoneWidget","memo","props","milestone","studentId","isMilestoneActive","restMilestoneWidgetProps","isStudentPresent","isClassOngoing","userType","studentName","parentName","teacherName","courseStream","activeMilestoneId","activeTabId","isTrialSession","onAddOutcome","onChapterClick","onEdit","onCreateMilestoneTest","onDraftPublish","onAddChapter","onAssignResources","onNodeAttempt","onNodeView","onNodeReview","onNodeReattempt","onNodeReset","onNodeUnassign","onNodeAssignAsHomework","onWidgetTabSelection","onTestPreview","onTestReview","onTestStart","milestoneType","milestoneId","userMileStonePlan","outcomeData","milestoneState","milestonePermissions","goalCode","goalCategory","widgetExpanded","setWidgetExpanded","useState","isPlanAvailable","canUpdatePlan","outcomes","chaptersData","toggleExpand","useCallback","prev","isDraftMilestone","isOutcomeAdded","goalBackgroundColor","getGoalCategoryBasedColorTheme","handleOnWidgetExpand","useEffect","$element","Styled.MainContainer","jsx","Styled.Wrapper","FlexView","MilestoneInfoWrapper","Styled.ContentWrapper","Styled.Content","MilestoneTabs"],"mappings":";;;;;;;AASA,MAAMA,KAA6CC,GAAK,SAAyBC,GAAO;AACtF,QAAM,EAAE,WAAAC,GAAW,WAAAC,GAAW,mBAAAC,GAAmB,GAAGC,EAA6B,IAAAJ,GAC3E;AAAA,IACJ,kBAAAK;AAAA,IACA,gBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,YAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,QAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,sBAAAC;AAAA;AAAA,IAEA,eAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,eAAAC;AAAA,EACE,
|
|
1
|
+
{"version":3,"file":"milestone-widget.js","sources":["../../../../../../src/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget.tsx"],"sourcesContent":["import { memo, useCallback, useEffect, useState, type FC } from 'react';\n\nimport FlexView from '../../../../ui/layout/flex-view';\nimport MilestoneInfoWrapper from './milestone-info';\nimport MilestoneTabs from './milestone-tabs/milestone-tabs';\nimport { getGoalCategoryBasedColorTheme } from './milestone-utils';\nimport * as Styled from './milestone-widget-styled';\nimport type { IMilestoneWidgetProps } from './milestone-widget-types';\n\nconst MilestoneWidget: FC<IMilestoneWidgetProps> = memo(function MilestoneWidget(props) {\n const { milestone, studentId, isMilestoneActive, ...restMilestoneWidgetProps } = props;\n const {\n isStudentPresent,\n isClassOngoing,\n userType,\n studentName,\n parentName,\n teacherName,\n courseStream,\n activeMilestoneId,\n activeTabId,\n isTrialSession,\n onAddOutcome,\n onChapterClick,\n onEdit,\n onCreateMilestoneTest,\n onDraftPublish,\n onAddChapter,\n onAssignResources,\n onNodeAttempt,\n onNodeView,\n onNodeReview,\n onNodeReattempt,\n onNodeReset,\n onNodeUnassign,\n onNodeAssignAsHomework,\n onWidgetTabSelection,\n //* Test sheet callbacks\n onTestPreview,\n onTestReview,\n onTestStart,\n onMathFitClick,\n milestoneType,\n } = restMilestoneWidgetProps;\n\n const {\n id: milestoneId,\n user_milestone_plan: userMileStonePlan,\n outcome_data: outcomeData,\n milestone_state: milestoneState,\n permissions: milestonePermissions,\n goal_code: goalCode,\n goal_category: goalCategory,\n } = milestone;\n\n const [widgetExpanded, setWidgetExpanded] = useState(\n (isMilestoneActive && milestoneState === 'ACTIVE') || milestoneType === 'DRAFT',\n );\n\n const isPlanAvailable = Boolean(userMileStonePlan);\n\n const { can_update_plan: canUpdatePlan } = milestonePermissions;\n const { outcomes } = outcomeData || {};\n\n const { user_chapters: chaptersData = [] } = userMileStonePlan || {};\n\n const toggleExpand = useCallback(() => {\n setWidgetExpanded(prev => !prev);\n }, []);\n\n const isDraftMilestone = milestoneState === 'DRAFT';\n const isOutcomeAdded = milestoneState === 'OUTCOME_ADDED';\n\n const { backgroundColor: goalBackgroundColor } = getGoalCategoryBasedColorTheme(\n goalCategory,\n isDraftMilestone,\n );\n\n const handleOnWidgetExpand = useCallback(() => {\n setWidgetExpanded(prev => !prev);\n }, [setWidgetExpanded]);\n\n useEffect(() => {\n const $element = document.getElementById(`milestone-${activeMilestoneId}`);\n\n if ($element) {\n $element.scrollIntoView();\n }\n //* Disabling the exhaustive-deps rule as we want to run this effect only once\n //* We don't want this to run when activeMilestoneId changes, as it will cause component to scroll into the view every time.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <Styled.MainContainer id={`milestone-${milestoneId}`}>\n <Styled.Wrapper\n onClick={handleOnWidgetExpand}\n $background={goalBackgroundColor}\n $gapX={1.5}\n $borderColor=\"GREY_2\"\n >\n <FlexView $flexGapX={goalCode ? 1.5 : 1}>\n <MilestoneInfoWrapper\n milestone={milestone}\n onEdit={onEdit}\n isExpanded={widgetExpanded}\n toggleExpand={toggleExpand}\n userType={userType}\n isClassOngoing={isClassOngoing}\n isStudentPresent={isStudentPresent}\n onAddOutcome={onAddOutcome}\n studentId={studentId}\n studentName={studentName}\n teacherName={teacherName ?? ''}\n parentName={parentName ?? ''}\n onDraftPublish={onDraftPublish}\n courseStream={courseStream}\n outcomes={outcomes}\n isTrialSession={isTrialSession}\n />\n </FlexView>\n </Styled.Wrapper>\n\n <Styled.ContentWrapper $expanded={widgetExpanded}>\n <Styled.Content>\n <MilestoneTabs\n goalCategory={goalCategory}\n isGoalCreation={!!goalCode}\n isDraftMilestone={isDraftMilestone}\n isOutcomeAdded={isOutcomeAdded}\n isMilestoneActive={isMilestoneActive}\n isPlanAvailable={isPlanAvailable}\n userMilestoneId={milestoneId}\n chapters={chaptersData}\n userType={userType}\n canUpdatePlan={canUpdatePlan}\n milestoneState={milestoneState}\n studentId={studentId}\n onAddChapter={onAddChapter}\n onAssignResources={onAssignResources}\n onChapterClick={onChapterClick}\n onCreateMilestoneTest={onCreateMilestoneTest}\n onTestPreview={onTestPreview}\n onTestReview={onTestReview}\n onTestStart={onTestStart}\n onNodeAttempt={onNodeAttempt}\n onNodeView={onNodeView}\n onNodeReview={onNodeReview}\n onNodeReattempt={onNodeReattempt}\n onNodeReset={onNodeReset}\n onNodeUnassign={onNodeUnassign}\n onNodeAssignAsHomework={onNodeAssignAsHomework}\n milestonePermissions={milestonePermissions}\n activeMilestoneId={activeMilestoneId}\n activeTabId={activeTabId}\n onWidgetTabSelection={onWidgetTabSelection}\n onMathFitClick={onMathFitClick}\n />\n </Styled.Content>\n </Styled.ContentWrapper>\n </Styled.MainContainer>\n );\n});\n\nexport default MilestoneWidget;\n"],"names":["MilestoneWidget","memo","props","milestone","studentId","isMilestoneActive","restMilestoneWidgetProps","isStudentPresent","isClassOngoing","userType","studentName","parentName","teacherName","courseStream","activeMilestoneId","activeTabId","isTrialSession","onAddOutcome","onChapterClick","onEdit","onCreateMilestoneTest","onDraftPublish","onAddChapter","onAssignResources","onNodeAttempt","onNodeView","onNodeReview","onNodeReattempt","onNodeReset","onNodeUnassign","onNodeAssignAsHomework","onWidgetTabSelection","onTestPreview","onTestReview","onTestStart","onMathFitClick","milestoneType","milestoneId","userMileStonePlan","outcomeData","milestoneState","milestonePermissions","goalCode","goalCategory","widgetExpanded","setWidgetExpanded","useState","isPlanAvailable","canUpdatePlan","outcomes","chaptersData","toggleExpand","useCallback","prev","isDraftMilestone","isOutcomeAdded","goalBackgroundColor","getGoalCategoryBasedColorTheme","handleOnWidgetExpand","useEffect","$element","Styled.MainContainer","jsx","Styled.Wrapper","FlexView","MilestoneInfoWrapper","Styled.ContentWrapper","Styled.Content","MilestoneTabs"],"mappings":";;;;;;;AASA,MAAMA,KAA6CC,GAAK,SAAyBC,GAAO;AACtF,QAAM,EAAE,WAAAC,GAAW,WAAAC,GAAW,mBAAAC,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