@cuemath/leap 3.2.30 → 3.2.31
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/features/milestone/milestone-list-container/milestone-list/milestone-list.js +48 -46
- 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/goals/goal-action-ctas.js +39 -38
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/goals/goal-action-ctas.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-info.js +43 -41
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-info.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget.js +61 -59
- 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 +91 -89
- package/dist/features/milestone/milestone-list-container/milestone-list-container.js.map +1 -1
- package/dist/features/trial-session/comps/learning-plan/index.js +19 -18
- package/dist/features/trial-session/comps/learning-plan/index.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/package.json +2 -3
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { jsxs as r, Fragment as Q, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import Y, { memo as Z, useCallback as f } from "react";
|
|
3
|
+
import ee from "../../../hooks/use-lazy-ref.js";
|
|
4
|
+
import te from "../../../ui/arrow-tooltip/arrow-tooltip.js";
|
|
5
5
|
import h from "../../../ui/buttons/text-button/text-button.js";
|
|
6
6
|
import m from "../../../ui/layout/flex-view.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
7
|
+
import oe from "../../../ui/separator/separator.js";
|
|
8
|
+
import ne from "../../../ui/text/text.js";
|
|
9
|
+
import ie from "./milestone-widget/milestone-widget.js";
|
|
10
10
|
import re from "./no-active-milestone/no-active-milestone.js";
|
|
11
|
-
import
|
|
12
|
-
const
|
|
11
|
+
import se from "../../../../node_modules/uuid/dist/esm-browser/v4.js";
|
|
12
|
+
const Ce = Z(
|
|
13
13
|
({ milestones: t, studentId: A, milestoneType: s, ...u }) => {
|
|
14
14
|
const {
|
|
15
15
|
canCreatePlan: a,
|
|
16
16
|
isClassOngoing: g,
|
|
17
17
|
isFiltersAdded: C,
|
|
18
|
-
isStudentPresent:
|
|
19
|
-
onAddChapter:
|
|
18
|
+
isStudentPresent: T,
|
|
19
|
+
onAddChapter: M,
|
|
20
20
|
onAddOutcome: n,
|
|
21
21
|
onChapterClick: v,
|
|
22
|
-
onCreatePlan:
|
|
22
|
+
onCreatePlan: i,
|
|
23
23
|
onDelete: w,
|
|
24
24
|
onDraftPublish: N,
|
|
25
25
|
onEdit: b,
|
|
@@ -30,9 +30,9 @@ const ge = Y(
|
|
|
30
30
|
onNodeReattempt: I,
|
|
31
31
|
onNodeReset: P,
|
|
32
32
|
onNodeUnassign: F,
|
|
33
|
-
onAssignResources:
|
|
34
|
-
onTestPreview:
|
|
35
|
-
onTestReview:
|
|
33
|
+
onAssignResources: S,
|
|
34
|
+
onTestPreview: k,
|
|
35
|
+
onTestReview: E,
|
|
36
36
|
onTestStart: j,
|
|
37
37
|
activeMilestoneId: y,
|
|
38
38
|
activeTabId: G,
|
|
@@ -42,39 +42,40 @@ const ge = Y(
|
|
|
42
42
|
parentName: z,
|
|
43
43
|
userType: l,
|
|
44
44
|
courseStream: B,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
isTrialSession: H,
|
|
46
|
+
onNodeAssignAsHomework: L
|
|
47
|
+
} = u, d = s === "ACTIVE", O = s === "DRAFT", p = ee(se), W = f(() => {
|
|
48
|
+
i == null || i(p);
|
|
49
|
+
}, [i, p]), X = f(() => {
|
|
49
50
|
n == null || n();
|
|
50
51
|
}, [n]);
|
|
51
52
|
if (!t) return null;
|
|
52
|
-
const
|
|
53
|
+
const U = t.some(
|
|
53
54
|
(o) => o.milestone_state === "ACTIVE"
|
|
54
|
-
),
|
|
55
|
+
), q = t.some(
|
|
55
56
|
(o) => o.milestone_state === "DRAFT"
|
|
56
57
|
);
|
|
57
|
-
return /* @__PURE__ */
|
|
58
|
-
d && !
|
|
58
|
+
return /* @__PURE__ */ r(Q, { children: [
|
|
59
|
+
d && !U && /* @__PURE__ */ e(m, { $marginBottom: 40, children: /* @__PURE__ */ e(
|
|
59
60
|
re,
|
|
60
61
|
{
|
|
61
62
|
canCreatePlan: a,
|
|
62
|
-
isDraftMilestonePresent:
|
|
63
|
+
isDraftMilestonePresent: q,
|
|
63
64
|
isFiltersAdded: C,
|
|
64
|
-
onCreatePlan:
|
|
65
|
+
onCreatePlan: i,
|
|
65
66
|
studentName: c,
|
|
66
67
|
userType: l
|
|
67
68
|
}
|
|
68
69
|
) }),
|
|
69
|
-
d && /* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */
|
|
70
|
+
d && /* @__PURE__ */ r(m, { $flexDirection: "row", $justifyContent: "space-between", $marginBottom: 16, children: [
|
|
71
|
+
/* @__PURE__ */ r(ne, { $renderAs: "ac4", children: [
|
|
71
72
|
"Goals (",
|
|
72
73
|
t.length,
|
|
73
74
|
")"
|
|
74
75
|
] }),
|
|
75
|
-
l === "TEACHER" && /* @__PURE__ */
|
|
76
|
+
l === "TEACHER" && /* @__PURE__ */ r(m, { $flexDirection: "row", $flexGapX: 1, children: [
|
|
76
77
|
/* @__PURE__ */ e(
|
|
77
|
-
|
|
78
|
+
te,
|
|
78
79
|
{
|
|
79
80
|
renderAs: "primary",
|
|
80
81
|
tooltipItem: "Goals can only be added for students who have joined the class",
|
|
@@ -85,20 +86,20 @@ const ge = Y(
|
|
|
85
86
|
{
|
|
86
87
|
label: "Create Goal",
|
|
87
88
|
size: "small",
|
|
88
|
-
onClick:
|
|
89
|
+
onClick: W,
|
|
89
90
|
disabled: !a
|
|
90
91
|
}
|
|
91
92
|
)
|
|
92
93
|
}
|
|
93
94
|
),
|
|
94
|
-
/* @__PURE__ */ e(h, { label: "Add Milestone", size: "small", onClick:
|
|
95
|
+
/* @__PURE__ */ e(h, { label: "Add Milestone", size: "small", onClick: X })
|
|
95
96
|
] })
|
|
96
97
|
] }),
|
|
97
|
-
t.map((o,
|
|
98
|
-
const { id:
|
|
99
|
-
return /* @__PURE__ */
|
|
98
|
+
t.map((o, J) => {
|
|
99
|
+
const { id: K } = o;
|
|
100
|
+
return /* @__PURE__ */ r(Y.Fragment, { children: [
|
|
100
101
|
/* @__PURE__ */ e(
|
|
101
|
-
|
|
102
|
+
ie,
|
|
102
103
|
{
|
|
103
104
|
milestone: o,
|
|
104
105
|
studentId: A,
|
|
@@ -108,39 +109,40 @@ const ge = Y(
|
|
|
108
109
|
userType: l,
|
|
109
110
|
onAddOutcome: n,
|
|
110
111
|
onChapterClick: v,
|
|
111
|
-
isMilestoneActive: d ||
|
|
112
|
+
isMilestoneActive: d || O,
|
|
112
113
|
milestoneType: s,
|
|
113
114
|
onEdit: b,
|
|
114
115
|
onCreateMilestoneTest: R,
|
|
115
|
-
onAddChapter:
|
|
116
|
+
onAddChapter: M,
|
|
116
117
|
onDelete: w,
|
|
117
118
|
onDraftPublish: N,
|
|
118
119
|
isClassOngoing: g,
|
|
119
|
-
isStudentPresent:
|
|
120
|
-
onAssignResources:
|
|
120
|
+
isStudentPresent: T,
|
|
121
|
+
onAssignResources: S,
|
|
121
122
|
onNodeAttempt: x,
|
|
122
123
|
onNodeView: D,
|
|
123
124
|
onNodeReview: $,
|
|
124
125
|
onNodeReattempt: I,
|
|
125
126
|
onNodeReset: P,
|
|
126
127
|
onNodeUnassign: F,
|
|
127
|
-
onNodeAssignAsHomework:
|
|
128
|
-
onTestPreview:
|
|
129
|
-
onTestReview:
|
|
128
|
+
onNodeAssignAsHomework: L,
|
|
129
|
+
onTestPreview: k,
|
|
130
|
+
onTestReview: E,
|
|
130
131
|
onTestStart: j,
|
|
131
132
|
courseStream: B,
|
|
132
133
|
activeMilestoneId: y,
|
|
133
134
|
activeTabId: G,
|
|
134
|
-
onWidgetTabSelection: V
|
|
135
|
+
onWidgetTabSelection: V,
|
|
136
|
+
isTrialSession: H
|
|
135
137
|
}
|
|
136
138
|
),
|
|
137
|
-
|
|
138
|
-
] }, `milestone=${
|
|
139
|
+
J !== t.length - 1 && /* @__PURE__ */ e(oe, { heightX: 2 })
|
|
140
|
+
] }, `milestone=${K}`);
|
|
139
141
|
})
|
|
140
142
|
] });
|
|
141
143
|
}
|
|
142
144
|
);
|
|
143
145
|
export {
|
|
144
|
-
|
|
146
|
+
Ce as default
|
|
145
147
|
};
|
|
146
148
|
//# sourceMappingURL=milestone-list.js.map
|
package/dist/features/milestone/milestone-list-container/milestone-list/milestone-list.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"milestone-list.js","sources":["../../../../../src/features/milestone/milestone-list-container/milestone-list/milestone-list.tsx"],"sourcesContent":["import type { IMilestoneListProps } from './milestone-list-types';\n\nimport React, { memo, useCallback } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport useLazyRef from '../../../hooks/use-lazy-ref';\nimport ArrowTooltip from '../../../ui/arrow-tooltip/arrow-tooltip';\nimport TextButton from '../../../ui/buttons/text-button/text-button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport MilestoneWidget from './milestone-widget/milestone-widget';\nimport NoActiveMilestone from './no-active-milestone/no-active-milestone';\n\nconst MilestoneList: React.FC<IMilestoneListProps> = memo(\n ({ milestones, studentId, milestoneType, ...restMilestoneListProps }) => {\n const {\n canCreatePlan,\n isClassOngoing,\n isFiltersAdded,\n isStudentPresent,\n onAddChapter,\n onAddOutcome,\n onChapterClick,\n onCreatePlan,\n onDelete,\n onDraftPublish,\n onEdit,\n onCreateMilestoneTest,\n onNodeAttempt,\n onNodeView,\n onNodeReview,\n onNodeReattempt,\n onNodeReset,\n onNodeUnassign,\n onAssignResources,\n onTestPreview,\n onTestReview,\n onTestStart,\n activeMilestoneId,\n activeTabId,\n onWidgetTabSelection,\n studentName,\n teacherName,\n parentName,\n userType,\n courseStream,\n onNodeAssignAsHomework,\n } = restMilestoneListProps;\n\n const isMilestoneActive = milestoneType === 'ACTIVE';\n const isDraftMilestone = milestoneType === 'DRAFT';\n const temporaryMilestoneId = useLazyRef(uuidv4);\n\n const handleCreatePlan = useCallback(() => {\n onCreatePlan?.(temporaryMilestoneId);\n }, [onCreatePlan, temporaryMilestoneId]);\n\n const handleOnAddOutcome = useCallback(() => {\n onAddOutcome?.();\n }, [onAddOutcome]);\n\n if (!milestones) return null;\n\n const activeMilestonePresent = milestones.some(\n milestone => milestone.milestone_state === 'ACTIVE',\n );\n const draftMilestonePresent = milestones.some(\n milestone => milestone.milestone_state === 'DRAFT',\n );\n\n return (\n <>\n {isMilestoneActive && !activeMilestonePresent && (\n <FlexView $marginBottom={40}>\n <NoActiveMilestone\n canCreatePlan={canCreatePlan}\n isDraftMilestonePresent={draftMilestonePresent}\n isFiltersAdded={isFiltersAdded}\n onCreatePlan={onCreatePlan}\n studentName={studentName}\n userType={userType}\n />\n </FlexView>\n )}\n\n {isMilestoneActive && (\n <FlexView $flexDirection=\"row\" $justifyContent=\"space-between\" $marginBottom={16}>\n <Text $renderAs=\"ac4\">Goals ({milestones.length})</Text>\n\n {userType === 'TEACHER' && (\n <FlexView $flexDirection=\"row\" $flexGapX={1}>\n <ArrowTooltip\n renderAs=\"primary\"\n tooltipItem=\"Goals can only be added for students who have joined the class\"\n hidden={canCreatePlan}\n position=\"bottom\"\n >\n <TextButton\n label=\"Create Goal\"\n size=\"small\"\n onClick={handleCreatePlan}\n disabled={!canCreatePlan}\n />\n </ArrowTooltip>\n <TextButton label=\"Add Milestone\" size=\"small\" onClick={handleOnAddOutcome} />\n </FlexView>\n )}\n </FlexView>\n )}\n\n {milestones.map((milestone, idx) => {\n const { id: milestoneId } = milestone;\n\n return (\n <React.Fragment key={`milestone=${milestoneId}`}>\n <MilestoneWidget\n milestone={milestone}\n studentId={studentId}\n studentName={studentName}\n parentName={parentName}\n teacherName={teacherName}\n userType={userType}\n onAddOutcome={onAddOutcome}\n onChapterClick={onChapterClick}\n isMilestoneActive={isMilestoneActive || isDraftMilestone}\n milestoneType={milestoneType}\n onEdit={onEdit}\n onCreateMilestoneTest={onCreateMilestoneTest}\n onAddChapter={onAddChapter}\n onDelete={onDelete}\n onDraftPublish={onDraftPublish}\n isClassOngoing={isClassOngoing}\n isStudentPresent={isStudentPresent}\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 onTestPreview={onTestPreview}\n onTestReview={onTestReview}\n onTestStart={onTestStart}\n courseStream={courseStream}\n activeMilestoneId={activeMilestoneId}\n activeTabId={activeTabId}\n onWidgetTabSelection={onWidgetTabSelection}\n />\n {idx !== milestones.length - 1 && <Separator heightX={2} />}\n </React.Fragment>\n );\n })}\n </>\n );\n },\n);\n\nexport default MilestoneList;\n"],"names":["MilestoneList","memo","milestones","studentId","milestoneType","restMilestoneListProps","canCreatePlan","isClassOngoing","isFiltersAdded","isStudentPresent","onAddChapter","onAddOutcome","onChapterClick","onCreatePlan","onDelete","onDraftPublish","onEdit","onCreateMilestoneTest","onNodeAttempt","onNodeView","onNodeReview","onNodeReattempt","onNodeReset","onNodeUnassign","onAssignResources","onTestPreview","onTestReview","onTestStart","activeMilestoneId","activeTabId","onWidgetTabSelection","studentName","teacherName","parentName","userType","courseStream","onNodeAssignAsHomework","isMilestoneActive","isDraftMilestone","temporaryMilestoneId","useLazyRef","uuidv4","handleCreatePlan","useCallback","handleOnAddOutcome","activeMilestonePresent","milestone","draftMilestonePresent","jsxs","Fragment","jsx","FlexView","NoActiveMilestone","Text","ArrowTooltip","TextButton","idx","milestoneId","React","MilestoneWidget","Separator"],"mappings":";;;;;;;;;;;AAcA,MAAMA,KAA+CC;AAAA,EACnD,CAAC,EAAE,YAAAC,GAAY,WAAAC,GAAW,eAAAC,GAAe,GAAGC,QAA6B;AACjE,UAAA;AAAA,MACJ,eAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,cAAAC;AAAA,MACA,cAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,cAAAC;AAAA,MACA,UAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,QAAAC;AAAA,MACA,uBAAAC;AAAA,MACA,eAAAC;AAAA,MACA,YAAAC;AAAA,MACA,cAAAC;AAAA,MACA,iBAAAC;AAAA,MACA,aAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,eAAAC;AAAA,MACA,cAAAC;AAAA,MACA,aAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,aAAAC;AAAA,MACA,sBAAAC;AAAA,MACA,aAAAC;AAAA,MACA,aAAAC;AAAA,MACA,YAAAC;AAAA,MACA,UAAAC;AAAA,MACA,cAAAC;AAAA,MACA,wBAAAC;AAAA,IACE,
|
|
1
|
+
{"version":3,"file":"milestone-list.js","sources":["../../../../../src/features/milestone/milestone-list-container/milestone-list/milestone-list.tsx"],"sourcesContent":["import type { IMilestoneListProps } from './milestone-list-types';\n\nimport React, { memo, useCallback } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport useLazyRef from '../../../hooks/use-lazy-ref';\nimport ArrowTooltip from '../../../ui/arrow-tooltip/arrow-tooltip';\nimport TextButton from '../../../ui/buttons/text-button/text-button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport MilestoneWidget from './milestone-widget/milestone-widget';\nimport NoActiveMilestone from './no-active-milestone/no-active-milestone';\n\nconst MilestoneList: React.FC<IMilestoneListProps> = memo(\n ({ milestones, studentId, milestoneType, ...restMilestoneListProps }) => {\n const {\n canCreatePlan,\n isClassOngoing,\n isFiltersAdded,\n isStudentPresent,\n onAddChapter,\n onAddOutcome,\n onChapterClick,\n onCreatePlan,\n onDelete,\n onDraftPublish,\n onEdit,\n onCreateMilestoneTest,\n onNodeAttempt,\n onNodeView,\n onNodeReview,\n onNodeReattempt,\n onNodeReset,\n onNodeUnassign,\n onAssignResources,\n onTestPreview,\n onTestReview,\n onTestStart,\n activeMilestoneId,\n activeTabId,\n onWidgetTabSelection,\n studentName,\n teacherName,\n parentName,\n userType,\n courseStream,\n isTrialSession,\n onNodeAssignAsHomework,\n } = restMilestoneListProps;\n\n const isMilestoneActive = milestoneType === 'ACTIVE';\n const isDraftMilestone = milestoneType === 'DRAFT';\n const temporaryMilestoneId = useLazyRef(uuidv4);\n\n const handleCreatePlan = useCallback(() => {\n onCreatePlan?.(temporaryMilestoneId);\n }, [onCreatePlan, temporaryMilestoneId]);\n\n const handleOnAddOutcome = useCallback(() => {\n onAddOutcome?.();\n }, [onAddOutcome]);\n\n if (!milestones) return null;\n\n const activeMilestonePresent = milestones.some(\n milestone => milestone.milestone_state === 'ACTIVE',\n );\n const draftMilestonePresent = milestones.some(\n milestone => milestone.milestone_state === 'DRAFT',\n );\n\n return (\n <>\n {isMilestoneActive && !activeMilestonePresent && (\n <FlexView $marginBottom={40}>\n <NoActiveMilestone\n canCreatePlan={canCreatePlan}\n isDraftMilestonePresent={draftMilestonePresent}\n isFiltersAdded={isFiltersAdded}\n onCreatePlan={onCreatePlan}\n studentName={studentName}\n userType={userType}\n />\n </FlexView>\n )}\n\n {isMilestoneActive && (\n <FlexView $flexDirection=\"row\" $justifyContent=\"space-between\" $marginBottom={16}>\n <Text $renderAs=\"ac4\">Goals ({milestones.length})</Text>\n\n {userType === 'TEACHER' && (\n <FlexView $flexDirection=\"row\" $flexGapX={1}>\n <ArrowTooltip\n renderAs=\"primary\"\n tooltipItem=\"Goals can only be added for students who have joined the class\"\n hidden={canCreatePlan}\n position=\"bottom\"\n >\n <TextButton\n label=\"Create Goal\"\n size=\"small\"\n onClick={handleCreatePlan}\n disabled={!canCreatePlan}\n />\n </ArrowTooltip>\n <TextButton label=\"Add Milestone\" size=\"small\" onClick={handleOnAddOutcome} />\n </FlexView>\n )}\n </FlexView>\n )}\n\n {milestones.map((milestone, idx) => {\n const { id: milestoneId } = milestone;\n\n return (\n <React.Fragment key={`milestone=${milestoneId}`}>\n <MilestoneWidget\n milestone={milestone}\n studentId={studentId}\n studentName={studentName}\n parentName={parentName}\n teacherName={teacherName}\n userType={userType}\n onAddOutcome={onAddOutcome}\n onChapterClick={onChapterClick}\n isMilestoneActive={isMilestoneActive || isDraftMilestone}\n milestoneType={milestoneType}\n onEdit={onEdit}\n onCreateMilestoneTest={onCreateMilestoneTest}\n onAddChapter={onAddChapter}\n onDelete={onDelete}\n onDraftPublish={onDraftPublish}\n isClassOngoing={isClassOngoing}\n isStudentPresent={isStudentPresent}\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 onTestPreview={onTestPreview}\n onTestReview={onTestReview}\n onTestStart={onTestStart}\n courseStream={courseStream}\n activeMilestoneId={activeMilestoneId}\n activeTabId={activeTabId}\n onWidgetTabSelection={onWidgetTabSelection}\n isTrialSession={isTrialSession}\n />\n {idx !== milestones.length - 1 && <Separator heightX={2} />}\n </React.Fragment>\n );\n })}\n </>\n );\n },\n);\n\nexport default MilestoneList;\n"],"names":["MilestoneList","memo","milestones","studentId","milestoneType","restMilestoneListProps","canCreatePlan","isClassOngoing","isFiltersAdded","isStudentPresent","onAddChapter","onAddOutcome","onChapterClick","onCreatePlan","onDelete","onDraftPublish","onEdit","onCreateMilestoneTest","onNodeAttempt","onNodeView","onNodeReview","onNodeReattempt","onNodeReset","onNodeUnassign","onAssignResources","onTestPreview","onTestReview","onTestStart","activeMilestoneId","activeTabId","onWidgetTabSelection","studentName","teacherName","parentName","userType","courseStream","isTrialSession","onNodeAssignAsHomework","isMilestoneActive","isDraftMilestone","temporaryMilestoneId","useLazyRef","uuidv4","handleCreatePlan","useCallback","handleOnAddOutcome","activeMilestonePresent","milestone","draftMilestonePresent","jsxs","Fragment","jsx","FlexView","NoActiveMilestone","Text","ArrowTooltip","TextButton","idx","milestoneId","React","MilestoneWidget","Separator"],"mappings":";;;;;;;;;;;AAcA,MAAMA,KAA+CC;AAAA,EACnD,CAAC,EAAE,YAAAC,GAAY,WAAAC,GAAW,eAAAC,GAAe,GAAGC,QAA6B;AACjE,UAAA;AAAA,MACJ,eAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,cAAAC;AAAA,MACA,cAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,cAAAC;AAAA,MACA,UAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,QAAAC;AAAA,MACA,uBAAAC;AAAA,MACA,eAAAC;AAAA,MACA,YAAAC;AAAA,MACA,cAAAC;AAAA,MACA,iBAAAC;AAAA,MACA,aAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,eAAAC;AAAA,MACA,cAAAC;AAAA,MACA,aAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,aAAAC;AAAA,MACA,sBAAAC;AAAA,MACA,aAAAC;AAAA,MACA,aAAAC;AAAA,MACA,YAAAC;AAAA,MACA,UAAAC;AAAA,MACA,cAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,wBAAAC;AAAA,IACE,IAAAhC,GAEEiC,IAAoBlC,MAAkB,UACtCmC,IAAmBnC,MAAkB,SACrCoC,IAAuBC,GAAWC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
import { jsxs as A, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { memo as
|
|
3
|
-
import
|
|
2
|
+
import { memo as R, useState as V, useCallback as m } from "react";
|
|
3
|
+
import q from "../../../../../../assets/line-icons/icons/edit2.js";
|
|
4
4
|
import y from "../../../../../ui/arrow-tooltip/arrow-tooltip.js";
|
|
5
5
|
import I from "../../../../../ui/buttons/button/button.js";
|
|
6
|
-
import
|
|
7
|
-
import { useUIContext as
|
|
6
|
+
import B from "../../../../../ui/buttons/icon-button/icon-button.js";
|
|
7
|
+
import { useUIContext as H } from "../../../../../ui/context/context.js";
|
|
8
8
|
import w from "../../../../../ui/layout/flex-view.js";
|
|
9
|
-
import
|
|
10
|
-
import { EVENT_NAMES as
|
|
11
|
-
import { invalidateMilestonesData as
|
|
12
|
-
import { useDraftPublish as
|
|
13
|
-
const
|
|
9
|
+
import J from "../../../../../ui/text/text.js";
|
|
10
|
+
import { EVENT_NAMES as K } from "../../../../create/milestone-create-constants.js";
|
|
11
|
+
import { invalidateMilestonesData as Q } from "../../../api/get-milestones.js";
|
|
12
|
+
import { useDraftPublish as W } from "./use-goal-draft-publish.js";
|
|
13
|
+
const me = R((x) => {
|
|
14
14
|
const {
|
|
15
15
|
milestone: c,
|
|
16
16
|
studentId: p,
|
|
@@ -20,42 +20,43 @@ const de = L((x) => {
|
|
|
20
20
|
teacherName: N,
|
|
21
21
|
parentName: T,
|
|
22
22
|
onAddOutcome: s,
|
|
23
|
-
onDraftPublish:
|
|
24
|
-
onEdit:
|
|
25
|
-
courseStream: u
|
|
23
|
+
onDraftPublish: i,
|
|
24
|
+
onEdit: n,
|
|
25
|
+
courseStream: u,
|
|
26
|
+
isTrialSession: k
|
|
26
27
|
} = x, {
|
|
27
28
|
id: e,
|
|
28
29
|
milestone_name: h,
|
|
29
30
|
milestone_date_ts: f,
|
|
30
31
|
milestone_state: a,
|
|
31
|
-
permissions:
|
|
32
|
+
permissions: O,
|
|
32
33
|
goal_category: b,
|
|
33
|
-
goal_code:
|
|
34
|
+
goal_code: r
|
|
34
35
|
} = c, {
|
|
35
36
|
can_delete: _,
|
|
36
37
|
can_update_date: E,
|
|
37
38
|
can_update_plan: d
|
|
38
|
-
} =
|
|
39
|
-
(
|
|
40
|
-
const { id:
|
|
41
|
-
|
|
39
|
+
} = O, { onEvent: C } = H(), [D, g] = V(""), S = a === "OUTCOME_PENDING", X = r && a === "DRAFT", o = k ? !1 : !G || P, M = m(
|
|
40
|
+
(l, F) => {
|
|
41
|
+
const { id: L } = F || {};
|
|
42
|
+
l ? g(l) : (e && Q({
|
|
42
43
|
milestone_state_group: "LIVE",
|
|
43
44
|
course_stream: u,
|
|
44
45
|
student_id: p
|
|
45
|
-
}),
|
|
46
|
-
milestone_id: e ||
|
|
46
|
+
}), i == null || i(e, !0), C(K.DRAFT_EDIT.completed, {
|
|
47
|
+
milestone_id: e || L
|
|
47
48
|
}));
|
|
48
49
|
},
|
|
49
|
-
[e, p,
|
|
50
|
-
), { onPublish:
|
|
50
|
+
[e, p, i, g, C, u]
|
|
51
|
+
), { onPublish: j, isProcessing: v } = W({
|
|
51
52
|
handleGoalPublishComplete: M,
|
|
52
53
|
milestone: c,
|
|
53
54
|
milestoneId: e,
|
|
54
55
|
studentName: $,
|
|
55
56
|
parentName: T,
|
|
56
57
|
teacherName: N
|
|
57
|
-
}),
|
|
58
|
-
|
|
58
|
+
}), U = m(() => {
|
|
59
|
+
n == null || n({
|
|
59
60
|
milestoneId: e,
|
|
60
61
|
milestoneName: h,
|
|
61
62
|
milestoneDueDate: f,
|
|
@@ -64,7 +65,7 @@ const de = L((x) => {
|
|
|
64
65
|
milestoneState: a,
|
|
65
66
|
canDelete: _,
|
|
66
67
|
goalCategory: b,
|
|
67
|
-
goalCode:
|
|
68
|
+
goalCode: r
|
|
68
69
|
});
|
|
69
70
|
}, [
|
|
70
71
|
_,
|
|
@@ -72,12 +73,12 @@ const de = L((x) => {
|
|
|
72
73
|
d,
|
|
73
74
|
f,
|
|
74
75
|
b,
|
|
75
|
-
|
|
76
|
+
r,
|
|
76
77
|
e,
|
|
77
78
|
h,
|
|
78
79
|
a,
|
|
79
|
-
|
|
80
|
-
]),
|
|
80
|
+
n
|
|
81
|
+
]), z = m(() => {
|
|
81
82
|
s == null || s(e);
|
|
82
83
|
}, [s, e]);
|
|
83
84
|
return /* @__PURE__ */ A(w, { $justifyContent: "center", $flexGap: 8, children: [
|
|
@@ -88,9 +89,9 @@ const de = L((x) => {
|
|
|
88
89
|
$flexGapX: 1.5,
|
|
89
90
|
$alignItems: "center",
|
|
90
91
|
$width: "fit-content",
|
|
91
|
-
onClick: (
|
|
92
|
+
onClick: (l) => l.stopPropagation(),
|
|
92
93
|
children: [
|
|
93
|
-
|
|
94
|
+
S && /* @__PURE__ */ t(
|
|
94
95
|
I,
|
|
95
96
|
{
|
|
96
97
|
renderAs: "primary",
|
|
@@ -98,7 +99,7 @@ const de = L((x) => {
|
|
|
98
99
|
label: "Add outcome",
|
|
99
100
|
shape: "square",
|
|
100
101
|
widthX: 10,
|
|
101
|
-
onClick:
|
|
102
|
+
onClick: z
|
|
102
103
|
}
|
|
103
104
|
),
|
|
104
105
|
X && /* @__PURE__ */ t(
|
|
@@ -117,8 +118,8 @@ const de = L((x) => {
|
|
|
117
118
|
widthX: 10,
|
|
118
119
|
label: "Publish",
|
|
119
120
|
size: "small",
|
|
120
|
-
onClick:
|
|
121
|
-
busy:
|
|
121
|
+
onClick: j,
|
|
122
|
+
busy: v,
|
|
122
123
|
disabled: !o
|
|
123
124
|
}
|
|
124
125
|
)
|
|
@@ -132,12 +133,12 @@ const de = L((x) => {
|
|
|
132
133
|
widthX: o ? 5 : 15,
|
|
133
134
|
tooltipItem: o ? "Edit goal" : "Goals can only be edited for students in class.",
|
|
134
135
|
children: /* @__PURE__ */ t(
|
|
135
|
-
|
|
136
|
+
B,
|
|
136
137
|
{
|
|
137
138
|
renderAs: "secondary",
|
|
138
|
-
Icon:
|
|
139
|
+
Icon: q,
|
|
139
140
|
analyticsLabel: "Edit Goal",
|
|
140
|
-
onClick:
|
|
141
|
+
onClick: U,
|
|
141
142
|
size: "xsmall",
|
|
142
143
|
disabled: !o
|
|
143
144
|
}
|
|
@@ -147,10 +148,10 @@ const de = L((x) => {
|
|
|
147
148
|
]
|
|
148
149
|
}
|
|
149
150
|
),
|
|
150
|
-
D && /* @__PURE__ */ t(
|
|
151
|
+
D && /* @__PURE__ */ t(J, { $widthX: 12.5, $renderAs: "ub3-bold", $color: "RED", $align: "center", children: D })
|
|
151
152
|
] });
|
|
152
153
|
});
|
|
153
154
|
export {
|
|
154
|
-
|
|
155
|
+
me as default
|
|
155
156
|
};
|
|
156
157
|
//# sourceMappingURL=goal-action-ctas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"goal-action-ctas.js","sources":["../../../../../../../src/features/milestone/milestone-list-container/milestone-list/milestone-widget/goals/goal-action-ctas.tsx"],"sourcesContent":["import type { IGoalActionCtas } from './goal-action-ctas-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useState } from 'react';\n\nimport Edit2Icon from '../../../../../../assets/line-icons/icons/edit2';\nimport ArrowTooltip from '../../../../../ui/arrow-tooltip/arrow-tooltip';\nimport Button from '../../../../../ui/buttons/button/button';\nimport IconButton from '../../../../../ui/buttons/icon-button/icon-button';\nimport { useUIContext } from '../../../../../ui/context/context';\nimport FlexView from '../../../../../ui/layout/flex-view';\nimport Text from '../../../../../ui/text/text';\nimport { EVENT_NAMES } from '../../../../create/milestone-create-constants';\nimport { invalidateMilestonesData } from '../../../api/get-milestones';\nimport { useDraftPublish } from './use-goal-draft-publish';\n\nconst GoalActionCtas: FC<IGoalActionCtas> = memo(props => {\n const {\n milestone,\n studentId,\n isClassOngoing,\n isStudentPresent,\n studentName,\n teacherName,\n parentName,\n onAddOutcome,\n onDraftPublish,\n onEdit,\n courseStream,\n } = props;\n const {\n id: milestoneId,\n milestone_name: milestoneName,\n milestone_date_ts: dueDate,\n milestone_state: milestoneState,\n permissions: milestonePermissions,\n goal_category: goalCategory,\n goal_code: goalCode,\n } = milestone;\n\n const {\n can_delete: canDelete,\n can_update_date: canUpdateDate,\n can_update_plan: canUpdatePlan,\n } = milestonePermissions;\n\n const { onEvent: trackEvent } = useUIContext();\n const [error, setError] = useState('');\n\n const canAddOutcome = milestoneState === 'OUTCOME_PENDING';\n const isDraftMilestone = goalCode && milestoneState === 'DRAFT';\n const canPublishOrEditGoal = !isClassOngoing || isStudentPresent;\n\n const handleGoalPublishComplete = useCallback(\n (errorMessage: string | null, data?: { id: string }) => {\n const { id } = data || {};\n\n if (errorMessage) {\n setError(errorMessage);\n } else {\n if (milestoneId) {\n invalidateMilestonesData({\n milestone_state_group: 'LIVE',\n course_stream: courseStream,\n student_id: studentId,\n });\n }\n onDraftPublish?.(milestoneId, true);\n trackEvent(EVENT_NAMES.DRAFT_EDIT.completed, {\n milestone_id: milestoneId || id,\n });\n }\n },\n [milestoneId, studentId, onDraftPublish, setError, trackEvent, courseStream],\n );\n\n const { onPublish, isProcessing } = useDraftPublish({\n handleGoalPublishComplete,\n milestone,\n milestoneId,\n studentName,\n parentName,\n teacherName,\n });\n\n const handleGoalEdit = useCallback(() => {\n onEdit?.({\n milestoneId,\n milestoneName,\n milestoneDueDate: dueDate,\n isMilestoneChaptersListEditable: canUpdatePlan,\n isMilestoneDateEditable: canUpdateDate,\n milestoneState,\n canDelete,\n goalCategory,\n goalCode,\n });\n }, [\n canDelete,\n canUpdateDate,\n canUpdatePlan,\n dueDate,\n goalCategory,\n goalCode,\n milestoneId,\n milestoneName,\n milestoneState,\n onEdit,\n ]);\n\n const handleOnAddOutcome = useCallback(() => {\n onAddOutcome?.(milestoneId);\n }, [onAddOutcome, milestoneId]);\n\n return (\n <FlexView $justifyContent=\"center\" $flexGap={8}>\n <FlexView\n $flexDirection=\"row\"\n $flexGapX={1.5}\n $alignItems=\"center\"\n $width=\"fit-content\"\n onClick={e => e.stopPropagation()}\n >\n {canAddOutcome && (\n <Button\n renderAs=\"primary\"\n size=\"small\"\n label=\"Add outcome\"\n shape=\"square\"\n widthX={10}\n onClick={handleOnAddOutcome}\n />\n )}\n\n {isDraftMilestone && (\n <ArrowTooltip\n position=\"bottom\"\n renderAs=\"primary\"\n tooltipItem=\"Goals can only be added for students who have joined the class\"\n hidden={canPublishOrEditGoal}\n widthX={15}\n >\n <Button\n renderAs=\"primary\"\n shape=\"square\"\n widthX={10}\n label=\"Publish\"\n size=\"small\"\n onClick={onPublish}\n busy={isProcessing}\n disabled={!canPublishOrEditGoal}\n />\n </ArrowTooltip>\n )}\n\n {canUpdatePlan && (\n <ArrowTooltip\n position=\"bottom\"\n renderAs=\"primary\"\n widthX={!canPublishOrEditGoal ? 15 : 5}\n tooltipItem={\n !canPublishOrEditGoal\n ? 'Goals can only be edited for students in class.'\n : 'Edit goal'\n }\n >\n <IconButton\n renderAs=\"secondary\"\n Icon={Edit2Icon}\n analyticsLabel=\"Edit Goal\"\n onClick={handleGoalEdit}\n size=\"xsmall\"\n disabled={!canPublishOrEditGoal}\n />\n </ArrowTooltip>\n )}\n </FlexView>\n\n {error && (\n <Text $widthX={12.5} $renderAs=\"ub3-bold\" $color=\"RED\" $align=\"center\">\n {error}\n </Text>\n )}\n </FlexView>\n );\n});\n\nexport default GoalActionCtas;\n"],"names":["GoalActionCtas","memo","props","milestone","studentId","isClassOngoing","isStudentPresent","studentName","teacherName","parentName","onAddOutcome","onDraftPublish","onEdit","courseStream","milestoneId","milestoneName","dueDate","milestoneState","milestonePermissions","goalCategory","goalCode","canDelete","canUpdateDate","canUpdatePlan","trackEvent","useUIContext","error","setError","useState","canAddOutcome","isDraftMilestone","canPublishOrEditGoal","handleGoalPublishComplete","useCallback","errorMessage","data","id","invalidateMilestonesData","EVENT_NAMES","onPublish","isProcessing","useDraftPublish","handleGoalEdit","handleOnAddOutcome","jsxs","FlexView","e","jsx","Button","ArrowTooltip","IconButton","Edit2Icon","Text"],"mappings":";;;;;;;;;;;;AAgBM,MAAAA,KAAsCC,EAAK,CAASC,MAAA;AAClD,QAAA;AAAA,IACJ,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,QAAAC;AAAA,IACA,cAAAC;AAAA,EACE,
|
|
1
|
+
{"version":3,"file":"goal-action-ctas.js","sources":["../../../../../../../src/features/milestone/milestone-list-container/milestone-list/milestone-widget/goals/goal-action-ctas.tsx"],"sourcesContent":["import type { IGoalActionCtas } from './goal-action-ctas-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useState } from 'react';\n\nimport Edit2Icon from '../../../../../../assets/line-icons/icons/edit2';\nimport ArrowTooltip from '../../../../../ui/arrow-tooltip/arrow-tooltip';\nimport Button from '../../../../../ui/buttons/button/button';\nimport IconButton from '../../../../../ui/buttons/icon-button/icon-button';\nimport { useUIContext } from '../../../../../ui/context/context';\nimport FlexView from '../../../../../ui/layout/flex-view';\nimport Text from '../../../../../ui/text/text';\nimport { EVENT_NAMES } from '../../../../create/milestone-create-constants';\nimport { invalidateMilestonesData } from '../../../api/get-milestones';\nimport { useDraftPublish } from './use-goal-draft-publish';\n\nconst GoalActionCtas: FC<IGoalActionCtas> = memo(props => {\n const {\n milestone,\n studentId,\n isClassOngoing,\n isStudentPresent,\n studentName,\n teacherName,\n parentName,\n onAddOutcome,\n onDraftPublish,\n onEdit,\n courseStream,\n isTrialSession,\n } = props;\n const {\n id: milestoneId,\n milestone_name: milestoneName,\n milestone_date_ts: dueDate,\n milestone_state: milestoneState,\n permissions: milestonePermissions,\n goal_category: goalCategory,\n goal_code: goalCode,\n } = milestone;\n\n const {\n can_delete: canDelete,\n can_update_date: canUpdateDate,\n can_update_plan: canUpdatePlan,\n } = milestonePermissions;\n\n const { onEvent: trackEvent } = useUIContext();\n const [error, setError] = useState('');\n\n const canAddOutcome = milestoneState === 'OUTCOME_PENDING';\n const isDraftMilestone = goalCode && milestoneState === 'DRAFT';\n const canPublishOrEditGoal = isTrialSession ? false : !isClassOngoing || isStudentPresent;\n\n const handleGoalPublishComplete = useCallback(\n (errorMessage: string | null, data?: { id: string }) => {\n const { id } = data || {};\n\n if (errorMessage) {\n setError(errorMessage);\n } else {\n if (milestoneId) {\n invalidateMilestonesData({\n milestone_state_group: 'LIVE',\n course_stream: courseStream,\n student_id: studentId,\n });\n }\n onDraftPublish?.(milestoneId, true);\n trackEvent(EVENT_NAMES.DRAFT_EDIT.completed, {\n milestone_id: milestoneId || id,\n });\n }\n },\n [milestoneId, studentId, onDraftPublish, setError, trackEvent, courseStream],\n );\n\n const { onPublish, isProcessing } = useDraftPublish({\n handleGoalPublishComplete,\n milestone,\n milestoneId,\n studentName,\n parentName,\n teacherName,\n });\n\n const handleGoalEdit = useCallback(() => {\n onEdit?.({\n milestoneId,\n milestoneName,\n milestoneDueDate: dueDate,\n isMilestoneChaptersListEditable: canUpdatePlan,\n isMilestoneDateEditable: canUpdateDate,\n milestoneState,\n canDelete,\n goalCategory,\n goalCode,\n });\n }, [\n canDelete,\n canUpdateDate,\n canUpdatePlan,\n dueDate,\n goalCategory,\n goalCode,\n milestoneId,\n milestoneName,\n milestoneState,\n onEdit,\n ]);\n\n const handleOnAddOutcome = useCallback(() => {\n onAddOutcome?.(milestoneId);\n }, [onAddOutcome, milestoneId]);\n\n return (\n <FlexView $justifyContent=\"center\" $flexGap={8}>\n <FlexView\n $flexDirection=\"row\"\n $flexGapX={1.5}\n $alignItems=\"center\"\n $width=\"fit-content\"\n onClick={e => e.stopPropagation()}\n >\n {canAddOutcome && (\n <Button\n renderAs=\"primary\"\n size=\"small\"\n label=\"Add outcome\"\n shape=\"square\"\n widthX={10}\n onClick={handleOnAddOutcome}\n />\n )}\n\n {isDraftMilestone && (\n <ArrowTooltip\n position=\"bottom\"\n renderAs=\"primary\"\n tooltipItem=\"Goals can only be added for students who have joined the class\"\n hidden={canPublishOrEditGoal}\n widthX={15}\n >\n <Button\n renderAs=\"primary\"\n shape=\"square\"\n widthX={10}\n label=\"Publish\"\n size=\"small\"\n onClick={onPublish}\n busy={isProcessing}\n disabled={!canPublishOrEditGoal}\n />\n </ArrowTooltip>\n )}\n\n {canUpdatePlan && (\n <ArrowTooltip\n position=\"bottom\"\n renderAs=\"primary\"\n widthX={!canPublishOrEditGoal ? 15 : 5}\n tooltipItem={\n !canPublishOrEditGoal\n ? 'Goals can only be edited for students in class.'\n : 'Edit goal'\n }\n >\n <IconButton\n renderAs=\"secondary\"\n Icon={Edit2Icon}\n analyticsLabel=\"Edit Goal\"\n onClick={handleGoalEdit}\n size=\"xsmall\"\n disabled={!canPublishOrEditGoal}\n />\n </ArrowTooltip>\n )}\n </FlexView>\n\n {error && (\n <Text $widthX={12.5} $renderAs=\"ub3-bold\" $color=\"RED\" $align=\"center\">\n {error}\n </Text>\n )}\n </FlexView>\n );\n});\n\nexport default GoalActionCtas;\n"],"names":["GoalActionCtas","memo","props","milestone","studentId","isClassOngoing","isStudentPresent","studentName","teacherName","parentName","onAddOutcome","onDraftPublish","onEdit","courseStream","isTrialSession","milestoneId","milestoneName","dueDate","milestoneState","milestonePermissions","goalCategory","goalCode","canDelete","canUpdateDate","canUpdatePlan","trackEvent","useUIContext","error","setError","useState","canAddOutcome","isDraftMilestone","canPublishOrEditGoal","handleGoalPublishComplete","useCallback","errorMessage","data","id","invalidateMilestonesData","EVENT_NAMES","onPublish","isProcessing","useDraftPublish","handleGoalEdit","handleOnAddOutcome","jsxs","FlexView","e","jsx","Button","ArrowTooltip","IconButton","Edit2Icon","Text"],"mappings":";;;;;;;;;;;;AAgBM,MAAAA,KAAsCC,EAAK,CAASC,MAAA;AAClD,QAAA;AAAA,IACJ,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC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A,YAAA;AAAA,UACF;AAAA,UAGDR,KACC,gBAAAwB;AAAA,YAACE;AAAA,YAAA;AAAA,cACC,UAAS;AAAA,cACT,UAAS;AAAA,cACT,QAASlB,IAA4B,IAAL;AAAA,cAChC,aACGA,IAEG,cADA;AAAA,cAIN,UAAA,gBAAAgB;AAAA,gBAACG;AAAA,gBAAA;AAAA,kBACC,UAAS;AAAA,kBACT,MAAMC;AAAA,kBACN,gBAAe;AAAA,kBACf,SAAST;AAAA,kBACT,MAAK;AAAA,kBACL,UAAU,CAACX;AAAA,gBAAA;AAAA,cACb;AAAA,YAAA;AAAA,UACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAEJ;AAAA,IAECL,KACE,gBAAAqB,EAAAK,GAAA,EAAK,SAAS,MAAM,WAAU,YAAW,QAAO,OAAM,QAAO,UAC3D,UACH1B,EAAA,CAAA;AAAA,EAEJ,EAAA,CAAA;AAEJ,CAAC;"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { jsxs as t, jsx as e, Fragment as
|
|
2
|
-
import { memo as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { jsxs as t, jsx as e, Fragment as W } from "react/jsx-runtime";
|
|
2
|
+
import { memo as X, useRef as j, useState as H, useMemo as F, useLayoutEffect as K } from "react";
|
|
3
|
+
import V from "../../../../../assets/line-icons/icons/check2.js";
|
|
4
|
+
import v from "../../../../ui/arrow-tooltip/arrow-tooltip.js";
|
|
5
|
+
import U from "../../../../ui/image/image.js";
|
|
6
6
|
import r from "../../../../ui/layout/flex-view.js";
|
|
7
|
-
import
|
|
7
|
+
import Y from "../../../../ui/separator/separator.js";
|
|
8
8
|
import s from "../../../../ui/text/text.js";
|
|
9
|
-
import
|
|
10
|
-
import { GOAL_CATEGORY_BASED_IMAGES as
|
|
11
|
-
import { getRemainingDaysToCompleteGoal as
|
|
12
|
-
import { ChapterProgressSVG as
|
|
13
|
-
import
|
|
14
|
-
const
|
|
15
|
-
({ isClassOngoing: C, isStudentPresent: T, isExpanded:
|
|
9
|
+
import q from "./goals/goal-action-ctas.js";
|
|
10
|
+
import { GOAL_CATEGORY_BASED_IMAGES as z } from "./milestone-constants.js";
|
|
11
|
+
import { getRemainingDaysToCompleteGoal as J, getGoalCategoryBasedColorTheme as Q, getMilestoneWidgetStatusInfo as Z } from "./milestone-utils.js";
|
|
12
|
+
import { ChapterProgressSVG as ee, ChapterProgressSVGCircle as u, StyledCheckIconWrapper as te, MilestoneTitle as re } from "./milestone-widget-styled.js";
|
|
13
|
+
import oe from "./outcome/outcome.js";
|
|
14
|
+
const Ce = X(
|
|
15
|
+
({ isClassOngoing: C, isStudentPresent: T, isExpanded: ne, ...x }) => {
|
|
16
16
|
const {
|
|
17
17
|
milestone: d,
|
|
18
18
|
studentId: A,
|
|
@@ -22,19 +22,20 @@ const ue = W(
|
|
|
22
22
|
userType: y,
|
|
23
23
|
courseStream: G,
|
|
24
24
|
outcomes: i,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
isTrialSession: D,
|
|
26
|
+
onEdit: E,
|
|
27
|
+
onDraftPublish: b,
|
|
28
|
+
onAddOutcome: S
|
|
28
29
|
} = x, {
|
|
29
30
|
milestone_name: m,
|
|
30
|
-
milestone_date_ts:
|
|
31
|
+
milestone_date_ts: k,
|
|
31
32
|
milestone_state: o,
|
|
32
33
|
goal_category: l,
|
|
33
34
|
goal_code: g,
|
|
34
|
-
progress_stat:
|
|
35
|
-
} = d, { completed: p = 0, total: h = 0 } =
|
|
36
|
-
return
|
|
37
|
-
n.current && n.current.scrollHeight > n.current.clientHeight &&
|
|
35
|
+
progress_stat: B
|
|
36
|
+
} = d, { completed: p = 0, total: h = 0 } = B || {}, $ = o === "OUTCOME_PENDING", a = p > 0 ? Math.floor((p / h || 1) * 100) : 0, n = j(null), [O, N] = H(!1), { textColor: R, borderColor: f } = Q(l), c = Z(o), L = ($ ? c == null ? void 0 : c.progressBackgroundColor : f) || "WHITE_5", M = F(() => typeof g == "string", [g]), P = J(k);
|
|
37
|
+
return K(() => {
|
|
38
|
+
n.current && n.current.scrollHeight > n.current.clientHeight && N(!0);
|
|
38
39
|
}, [n]), l ? /* @__PURE__ */ t(
|
|
39
40
|
r,
|
|
40
41
|
{
|
|
@@ -55,7 +56,7 @@ const ue = W(
|
|
|
55
56
|
$alignItems: "center",
|
|
56
57
|
$borderRadiusX: 2,
|
|
57
58
|
children: [
|
|
58
|
-
/* @__PURE__ */ t(
|
|
59
|
+
/* @__PURE__ */ t(ee, { width: "64px", height: "64px", children: [
|
|
59
60
|
/* @__PURE__ */ e(u, { $progress: 0, r: "31", cx: "32", cy: "32" }),
|
|
60
61
|
/* @__PURE__ */ e(
|
|
61
62
|
u,
|
|
@@ -70,22 +71,22 @@ const ue = W(
|
|
|
70
71
|
)
|
|
71
72
|
] }),
|
|
72
73
|
/* @__PURE__ */ e(r, { $widthX: 4, $heightX: 4, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ e(
|
|
73
|
-
|
|
74
|
+
U,
|
|
74
75
|
{
|
|
75
|
-
src:
|
|
76
|
+
src: z[l],
|
|
76
77
|
withLoader: !0,
|
|
77
78
|
width: 40,
|
|
78
79
|
height: 40
|
|
79
80
|
}
|
|
80
81
|
) }),
|
|
81
|
-
a === 100 && /* @__PURE__ */ e(
|
|
82
|
+
a === 100 && /* @__PURE__ */ e(te, { children: /* @__PURE__ */ e(V, { width: 20, height: 20 }) })
|
|
82
83
|
]
|
|
83
84
|
}
|
|
84
85
|
),
|
|
85
86
|
/* @__PURE__ */ t(r, { $flexGap: 16, children: [
|
|
86
87
|
/* @__PURE__ */ t(r, { $flexGap: 4, children: [
|
|
87
88
|
/* @__PURE__ */ t(r, { $flexDirection: "row", $alignItems: "center", $flexGap: 4, children: [
|
|
88
|
-
/* @__PURE__ */ e(s, { $renderAs: "ac4-black", $color:
|
|
89
|
+
/* @__PURE__ */ e(s, { $renderAs: "ac4-black", $color: R, children: l.split("_").join(" ") }),
|
|
89
90
|
$ && /* @__PURE__ */ e(
|
|
90
91
|
r,
|
|
91
92
|
{
|
|
@@ -93,7 +94,7 @@ const ue = W(
|
|
|
93
94
|
$gap: 4,
|
|
94
95
|
$gutter: 4,
|
|
95
96
|
$alignItems: "center",
|
|
96
|
-
$background:
|
|
97
|
+
$background: L,
|
|
97
98
|
children: /* @__PURE__ */ e(s, { $renderAs: "ac4", $color: "WHITE", children: "Outcome pending" })
|
|
98
99
|
}
|
|
99
100
|
),
|
|
@@ -110,17 +111,17 @@ const ue = W(
|
|
|
110
111
|
)
|
|
111
112
|
] }),
|
|
112
113
|
/* @__PURE__ */ e(
|
|
113
|
-
|
|
114
|
+
v,
|
|
114
115
|
{
|
|
115
116
|
renderAs: "primary",
|
|
116
117
|
position: "bottom",
|
|
117
118
|
tooltipItem: m,
|
|
118
|
-
hidden: !
|
|
119
|
+
hidden: !O,
|
|
119
120
|
children: /* @__PURE__ */ e(
|
|
120
|
-
|
|
121
|
+
re,
|
|
121
122
|
{
|
|
122
123
|
ref: n,
|
|
123
|
-
$renderAs:
|
|
124
|
+
$renderAs: M ? "ah4" : "ab1",
|
|
124
125
|
$color: "BLACK_1",
|
|
125
126
|
children: m
|
|
126
127
|
}
|
|
@@ -129,29 +130,30 @@ const ue = W(
|
|
|
129
130
|
),
|
|
130
131
|
!!h && o !== "DRAFT" && /* @__PURE__ */ t(s, { $renderAs: "ub3", $color: "BLACK_T_60", children: [
|
|
131
132
|
`${a}% complete`,
|
|
132
|
-
o === "ACTIVE" &&
|
|
133
|
+
o === "ACTIVE" && P
|
|
133
134
|
] })
|
|
134
135
|
] }),
|
|
135
|
-
!!(i != null && i.length) && /* @__PURE__ */ t(
|
|
136
|
-
/* @__PURE__ */ e(
|
|
137
|
-
/* @__PURE__ */ e(
|
|
136
|
+
!!(i != null && i.length) && /* @__PURE__ */ t(W, { children: [
|
|
137
|
+
/* @__PURE__ */ e(Y, { width: 40, height: 1, background: "BLACK_T_15" }),
|
|
138
|
+
/* @__PURE__ */ e(oe, { outcomes: i })
|
|
138
139
|
] })
|
|
139
140
|
] })
|
|
140
141
|
] }),
|
|
141
142
|
y === "TEACHER" && /* @__PURE__ */ e(
|
|
142
|
-
|
|
143
|
+
q,
|
|
143
144
|
{
|
|
144
145
|
milestone: d,
|
|
145
146
|
studentId: A,
|
|
146
147
|
studentName: _,
|
|
147
148
|
teacherName: I ?? "",
|
|
148
149
|
parentName: w ?? "",
|
|
149
|
-
onAddOutcome:
|
|
150
|
+
onAddOutcome: S,
|
|
150
151
|
isClassOngoing: !!C,
|
|
151
152
|
isStudentPresent: !!T,
|
|
152
|
-
onDraftPublish:
|
|
153
|
-
onEdit:
|
|
154
|
-
courseStream: G
|
|
153
|
+
onDraftPublish: b,
|
|
154
|
+
onEdit: E,
|
|
155
|
+
courseStream: G,
|
|
156
|
+
isTrialSession: D
|
|
155
157
|
}
|
|
156
158
|
)
|
|
157
159
|
]
|
|
@@ -160,6 +162,6 @@ const ue = W(
|
|
|
160
162
|
}
|
|
161
163
|
);
|
|
162
164
|
export {
|
|
163
|
-
|
|
165
|
+
Ce as default
|
|
164
166
|
};
|
|
165
167
|
//# sourceMappingURL=milestone-info.js.map
|