@cuemath/leap 2.9.9-as1 → 2.9.9-as2
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/chapters/chapters-list/chapter-item/chapter-item.js +5 -5
- package/dist/features/chapters/chapters-list/chapter-item/chapter-item.js.map +1 -1
- package/dist/features/chapters-v2/chapter-details/block-sections/block-section-view.js +1 -1
- package/dist/features/chapters-v2/chapter-details/block-sections/block-section-view.js.map +1 -1
- package/dist/features/chapters-v2/chapter-details/block-sections/block-sections-styled.js +16 -7
- package/dist/features/chapters-v2/chapter-details/block-sections/block-sections-styled.js.map +1 -1
- package/dist/features/chapters-v2/chapter-details/block-sections/block-sections.js +57 -64
- package/dist/features/chapters-v2/chapter-details/block-sections/block-sections.js.map +1 -1
- package/dist/features/chapters-v2/comps/node-card/node-card-tags.js +8 -8
- package/dist/features/chapters-v2/comps/node-card/node-card-tags.js.map +1 -1
- package/dist/features/chapters-v2/comps/node-card/node-menu-options/node-menu-option.js +31 -0
- package/dist/features/chapters-v2/comps/node-card/node-menu-options/node-menu-option.js.map +1 -0
- package/dist/features/chapters-v2/comps/node-card/node-menu-options/node-menu-options.js +6 -28
- package/dist/features/chapters-v2/comps/node-card/node-menu-options/node-menu-options.js.map +1 -1
- package/dist/features/chapters-v2/comps/node-card/student-actions/student-actions.js +100 -91
- package/dist/features/chapters-v2/comps/node-card/student-actions/student-actions.js.map +1 -1
- package/dist/features/chapters-v2/comps/node-card/teacher-actions/teacher-actions.js +94 -92
- package/dist/features/chapters-v2/comps/node-card/teacher-actions/teacher-actions.js.map +1 -1
- package/dist/features/chapters-v2/comps/tag/tag.js +2 -2
- package/dist/features/chapters-v2/comps/tag/tag.js.map +1 -1
- package/dist/features/chapters-v2/utils/index.js +2 -5
- package/dist/features/chapters-v2/utils/index.js.map +1 -1
- package/dist/features/homework/card-menu-option.js +28 -0
- package/dist/features/homework/card-menu-option.js.map +1 -0
- package/dist/features/homework/card-menu-options.js +12 -28
- package/dist/features/homework/card-menu-options.js.map +1 -1
- package/dist/features/homework/card-title.js +10 -9
- package/dist/features/homework/card-title.js.map +1 -1
- package/dist/features/homework/homework-card-view.js +51 -49
- package/dist/features/homework/homework-card-view.js.map +1 -1
- package/dist/features/homework/hw-card-list/hw-card-list.js +78 -72
- package/dist/features/homework/hw-card-list/hw-card-list.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-list.js +32 -31
- 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-info.js +14 -14
- 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/outcome/outcome-styled.js +2 -6
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/outcome/outcome-styled.js.map +1 -1
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-view.js +30 -29
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-view.js.map +1 -1
- package/dist/features/ui/lottie-animation/lottie-animation.js +19 -13
- package/dist/features/ui/lottie-animation/lottie-animation.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
@@ -1,19 +1,19 @@
|
|
1
1
|
import { jsxs as c, jsx as t } from "react/jsx-runtime";
|
2
|
-
import {
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import { useJourney as
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import { useGetHomeworks as
|
10
|
-
import { ContentWrapper as
|
11
|
-
const
|
2
|
+
import { memo as q, useRef as z, useState as H, useEffect as f, useCallback as s, useMemo as U } from "react";
|
3
|
+
import Z from "../../../assets/line-icons/icons/chevron-left.js";
|
4
|
+
import J from "../../../assets/line-icons/icons/chevron-right.js";
|
5
|
+
import { useJourney as D } from "../../journey/use-journey/use-journey.js";
|
6
|
+
import h from "../../ui/layout/flex-view.js";
|
7
|
+
import C from "../../ui/text/text.js";
|
8
|
+
import ee from "../homework-card.js";
|
9
|
+
import { useGetHomeworks as re } from "./api/get-homeworks.js";
|
10
|
+
import { ContentWrapper as oe, ScrollButton as x, ScrollContainer as te, QueueWrapper as ne, QueueText as ie } from "./hw-card-list-styled.js";
|
11
|
+
const le = ({
|
12
12
|
userType: a,
|
13
13
|
studentId: i,
|
14
14
|
stream: d,
|
15
|
-
onTestStart:
|
16
|
-
onNodeAttempt:
|
15
|
+
onTestStart: R,
|
16
|
+
onNodeAttempt: w,
|
17
17
|
onTestPreview: E,
|
18
18
|
onNodeView: B,
|
19
19
|
onTestReview: W,
|
@@ -22,19 +22,19 @@ const ne = ({
|
|
22
22
|
homeworkRef: T,
|
23
23
|
individualHomeworkRef: y,
|
24
24
|
startHomePageJourney: $,
|
25
|
-
canStartJourney:
|
25
|
+
canStartJourney: k
|
26
26
|
}) => {
|
27
|
-
const
|
28
|
-
get:
|
27
|
+
const o = z(null), [K, m] = H(!1), [j, L] = H(!1), {
|
28
|
+
get: _,
|
29
29
|
data: e,
|
30
30
|
isProcessingFailed: G,
|
31
|
-
isProcessing:
|
31
|
+
isProcessing: p,
|
32
32
|
isStale: b
|
33
|
-
} =
|
33
|
+
} = re(i), { isJourneyActive: A } = D();
|
34
34
|
f(() => {
|
35
|
-
e != null && e.length && $ && !A &&
|
35
|
+
e != null && e.length && $ && !A && k && $({ hwDetails: e, studentId: i, stream: d, userType: a });
|
36
36
|
}, [
|
37
|
-
|
37
|
+
k,
|
38
38
|
e,
|
39
39
|
A,
|
40
40
|
$,
|
@@ -42,62 +42,68 @@ const ne = ({
|
|
42
42
|
i,
|
43
43
|
a
|
44
44
|
]);
|
45
|
-
const
|
46
|
-
if (
|
47
|
-
const { scrollLeft:
|
48
|
-
|
45
|
+
const n = s(() => {
|
46
|
+
if (o.current) {
|
47
|
+
const { scrollLeft: r, scrollWidth: l, clientWidth: g } = o.current;
|
48
|
+
r > 1 && m(!0), r < l - g - 1 && L(!0);
|
49
49
|
}
|
50
50
|
}, []), N = s(() => {
|
51
|
-
|
52
|
-
}, [
|
53
|
-
|
54
|
-
}, [
|
55
|
-
|
56
|
-
}, [
|
57
|
-
|
51
|
+
o.current && (o.current.scrollBy({ left: -200, behavior: "smooth" }), n());
|
52
|
+
}, [n]), F = s(() => {
|
53
|
+
o.current && (o.current.scrollBy({ left: 200, behavior: "smooth" }), n());
|
54
|
+
}, [n]), M = s(() => {
|
55
|
+
o.current && n();
|
56
|
+
}, [n]), Q = s(() => {
|
57
|
+
m(!1), L(!1);
|
58
58
|
}, []);
|
59
59
|
f(() => {
|
60
|
-
const
|
61
|
-
if (
|
62
|
-
return
|
63
|
-
|
60
|
+
const r = o.current;
|
61
|
+
if (r)
|
62
|
+
return r.addEventListener("scroll", n), () => {
|
63
|
+
r.removeEventListener("scroll", n);
|
64
64
|
};
|
65
|
-
}, [
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
}, [
|
65
|
+
}, [n]), f(() => {
|
66
|
+
if (e && (e == null ? void 0 : e.length) > 3 && o.current) {
|
67
|
+
const { scrollLeft: r } = o.current;
|
68
|
+
r > 1 && m(!0);
|
69
|
+
}
|
70
|
+
}, [e]);
|
71
|
+
const u = s(() => {
|
72
|
+
_(i, void 0, { stream: d });
|
73
|
+
}, [_, d, i]);
|
71
74
|
f(() => {
|
72
|
-
!
|
73
|
-
}, [
|
74
|
-
|
75
|
-
}, [
|
76
|
-
const
|
77
|
-
|
78
|
-
|
75
|
+
!p && b && u();
|
76
|
+
}, [u, p, b]), f(() => {
|
77
|
+
u();
|
78
|
+
}, [u]);
|
79
|
+
const X = U(
|
80
|
+
() => ((e == null ? void 0 : e.filter((r) => r.state === "WAIT_FOR_REVIEW")) || []).length,
|
81
|
+
[e]
|
82
|
+
);
|
83
|
+
return e && e.length === 0 ? /* @__PURE__ */ c(h, { $flexRowGapX: 1, children: [
|
84
|
+
/* @__PURE__ */ c(C, { $renderAs: "ac4-black", $color: "BLACK_T_60", children: [
|
79
85
|
"Homework (",
|
80
86
|
e == null ? void 0 : e.length,
|
81
87
|
")"
|
82
88
|
] }),
|
83
|
-
/* @__PURE__ */ t(
|
84
|
-
] }) : G ? null : /* @__PURE__ */ c(
|
85
|
-
/* @__PURE__ */ c(
|
89
|
+
/* @__PURE__ */ t(C, { $renderAs: "ab2", $color: "BLACK_T_60", children: "No Homework assigned yet" })
|
90
|
+
] }) : G ? null : /* @__PURE__ */ c(oe, { ref: T, $flexRowGapX: 1, $disablePointerEvents: p, children: [
|
91
|
+
/* @__PURE__ */ c(C, { $renderAs: "ac4-black", $color: "BLACK_T_60", children: [
|
86
92
|
"Homework (",
|
87
|
-
|
93
|
+
X,
|
88
94
|
"/",
|
89
95
|
e == null ? void 0 : e.length,
|
90
96
|
")"
|
91
97
|
] }),
|
92
98
|
/* @__PURE__ */ c(
|
93
|
-
|
99
|
+
h,
|
94
100
|
{
|
95
101
|
$position: "relative",
|
96
|
-
onMouseEnter:
|
97
|
-
onMouseLeave:
|
102
|
+
onMouseEnter: M,
|
103
|
+
onMouseLeave: Q,
|
98
104
|
children: [
|
99
105
|
/* @__PURE__ */ t(
|
100
|
-
|
106
|
+
x,
|
101
107
|
{
|
102
108
|
$position: "absolute",
|
103
109
|
$background: "BLACK_T_60",
|
@@ -108,58 +114,58 @@ const ne = ({
|
|
108
114
|
$visible: K,
|
109
115
|
left: "0px",
|
110
116
|
right: "auto",
|
111
|
-
children: /* @__PURE__ */ t(
|
117
|
+
children: /* @__PURE__ */ t(Z, { width: 24, height: 24 })
|
112
118
|
}
|
113
119
|
),
|
114
|
-
/* @__PURE__ */ t(
|
120
|
+
/* @__PURE__ */ t(te, { ref: o, children: /* @__PURE__ */ t(h, { $flexDirection: "row", $flexGapX: 1, children: e == null ? void 0 : e.map((r, l) => {
|
115
121
|
const {
|
116
|
-
node_id:
|
122
|
+
node_id: g,
|
117
123
|
worksheet_id: O,
|
118
124
|
node_type: V,
|
119
125
|
title: P,
|
120
126
|
subtext: Y
|
121
|
-
} =
|
127
|
+
} = r, v = V === "DYNAMIC";
|
122
128
|
return /* @__PURE__ */ c(
|
123
|
-
|
129
|
+
h,
|
124
130
|
{
|
125
131
|
ref: l === 0 ? y : void 0,
|
126
132
|
$flexDirection: "row",
|
127
133
|
$flexGapX: 1,
|
128
134
|
children: [
|
129
135
|
e.length > 10 && l === 10 && /* @__PURE__ */ t(
|
130
|
-
|
136
|
+
ne,
|
131
137
|
{
|
132
138
|
$background: "BLACK_4",
|
133
139
|
$justifyContent: "center",
|
134
140
|
$gutter: 4,
|
135
141
|
$gap: 8,
|
136
|
-
children: /* @__PURE__ */ t(
|
142
|
+
children: /* @__PURE__ */ t(ie, { $renderAs: "ac3", $color: "WHITE", children: "In Queue" })
|
137
143
|
}
|
138
144
|
),
|
139
145
|
/* @__PURE__ */ t(
|
140
|
-
|
146
|
+
ee,
|
141
147
|
{
|
142
148
|
isInQueue: e.length > 10 && l > 9,
|
143
149
|
userType: a,
|
144
150
|
header: P,
|
145
151
|
subHeader: Y || "",
|
146
|
-
nodeData:
|
152
|
+
nodeData: r,
|
147
153
|
renderAs: "homework",
|
148
154
|
studentId: i,
|
149
|
-
onNodeAttempt:
|
155
|
+
onNodeAttempt: v ? R : w,
|
150
156
|
shouldOpenOnRight: !0,
|
151
|
-
onNodeView:
|
152
|
-
onNodeReview:
|
157
|
+
onNodeView: v ? E : B,
|
158
|
+
onNodeReview: v ? W : I,
|
153
159
|
onNodeUnassign: S
|
154
160
|
}
|
155
161
|
)
|
156
162
|
]
|
157
163
|
},
|
158
|
-
`${O}_${
|
164
|
+
`${O}_${g}_${l}`
|
159
165
|
);
|
160
166
|
}) }) }),
|
161
167
|
/* @__PURE__ */ t(
|
162
|
-
|
168
|
+
x,
|
163
169
|
{
|
164
170
|
$position: "absolute",
|
165
171
|
$width: "60px",
|
@@ -171,15 +177,15 @@ const ne = ({
|
|
171
177
|
$visible: j,
|
172
178
|
left: "auto",
|
173
179
|
right: "0px",
|
174
|
-
children: /* @__PURE__ */ t(
|
180
|
+
children: /* @__PURE__ */ t(J, { width: 24, height: 24 })
|
175
181
|
}
|
176
182
|
)
|
177
183
|
]
|
178
184
|
}
|
179
185
|
)
|
180
186
|
] });
|
181
|
-
},
|
187
|
+
}, ge = q(le);
|
182
188
|
export {
|
183
|
-
|
189
|
+
ge as default
|
184
190
|
};
|
185
191
|
//# sourceMappingURL=hw-card-list.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"hw-card-list.js","sources":["../../../../src/features/homework/hw-card-list/hw-card-list.tsx"],"sourcesContent":["import type {\n INodeCardCallbacks,\n INodeDataProps,\n} from '../../chapters-v2/comps/node-card/node-card-types';\nimport type { IHomepageStartJourneyProps } from '../../journey/types/homepage-journey-types';\nimport type { TUserTypes } from '../../ui/types';\n\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\n\nimport ChevronLeftIcon from '../../../assets/line-icons/icons/chevron-left';\nimport ChevronRightIcon from '../../../assets/line-icons/icons/chevron-right';\nimport { useJourney } from '../../journey/use-journey/use-journey';\nimport FlexView from '../../ui/layout/flex-view';\nimport Text from '../../ui/text/text';\nimport HomeworkCard from '../homework-card';\nimport { useGetHomeworks } from './api/get-homeworks';\nimport * as Styled from './hw-card-list-styled';\n\ninterface HWCardListProps extends INodeCardCallbacks {\n userType: TUserTypes;\n studentId: string;\n stream: string;\n onTestPreview?: (sheetData: INodeDataProps, milestoneId?: string) => void;\n onTestStart?: (sheetData: INodeDataProps, homeworkId?: string) => void;\n onTestReview?: (sheetData: INodeDataProps, milestoneId?: string) => void;\n homeworkRef?: React.RefObject<HTMLDivElement>;\n individualHomeworkRef?: React.RefObject<HTMLDivElement>;\n startHomePageJourney?: ({\n hwDetails,\n studentId,\n stream,\n userType,\n }: IHomepageStartJourneyProps) => void;\n canStartJourney?: boolean;\n}\n\nconst HWCardList: React.FC<HWCardListProps> = ({\n userType,\n studentId,\n stream,\n onTestStart,\n onNodeAttempt,\n onTestPreview,\n onNodeView,\n onTestReview,\n onNodeReview,\n onNodeUnassign,\n homeworkRef,\n individualHomeworkRef,\n startHomePageJourney,\n canStartJourney,\n}) => {\n const scrollRef = useRef<HTMLDivElement>(null);\n const [isLeftHovered, setIsLeftHovered] = useState(false);\n const [isRightHovered, setIsRightHovered] = useState(false);\n const {\n get: getHomeworks,\n data: hwDetails,\n isProcessingFailed,\n isProcessing,\n isStale,\n } = useGetHomeworks(studentId);\n const { isJourneyActive } = useJourney();\n\n useEffect(() => {\n if (hwDetails?.length && startHomePageJourney && !isJourneyActive && canStartJourney) {\n startHomePageJourney({ hwDetails, studentId, stream, userType });\n }\n }, [\n canStartJourney,\n hwDetails,\n isJourneyActive,\n startHomePageJourney,\n stream,\n studentId,\n userType,\n ]);\n\n const updatedCanScroll = useCallback(() => {\n if (scrollRef.current) {\n const { scrollLeft, scrollWidth, clientWidth } = scrollRef.current;\n\n if (scrollLeft > 1) {\n setIsLeftHovered(true);\n }\n\n if (scrollLeft < scrollWidth - clientWidth - 1) {\n setIsRightHovered(true);\n }\n }\n }, []);\n\n const handleScrollLeft = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: -200, behavior: 'smooth' });\n updatedCanScroll();\n }\n }, [updatedCanScroll]);\n\n const handleScrollRight = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: 200, behavior: 'smooth' });\n updatedCanScroll();\n }\n }, [updatedCanScroll]);\n\n const handleHoverEnter = useCallback(() => {\n if (!scrollRef.current) return;\n\n updatedCanScroll();\n }, [updatedCanScroll]);\n\n const handleHoverLeave = useCallback(() => {\n setIsLeftHovered(false);\n setIsRightHovered(false);\n }, []);\n\n useEffect(() => {\n const scrollElement = scrollRef.current;\n\n if (scrollElement) {\n scrollElement.addEventListener('scroll', updatedCanScroll);\n updatedCanScroll();\n\n return () => {\n scrollElement.removeEventListener('scroll', updatedCanScroll);\n };\n }\n }, [updatedCanScroll]);\n\n useEffect(() => {\n updatedCanScroll();\n }, [hwDetails, updatedCanScroll]);\n\n const fetchHomeworks = useCallback(() => {\n getHomeworks(studentId, undefined, { stream });\n }, [getHomeworks, stream, studentId]);\n\n useEffect(() => {\n if (!isProcessing && isStale) {\n fetchHomeworks();\n }\n }, [fetchHomeworks, isProcessing, isStale]);\n\n useEffect(() => {\n fetchHomeworks();\n }, [fetchHomeworks]);\n\n const waitForReviewSheets = (hwDetails?.filter(sheet => sheet.state === 'WAIT_FOR_REVIEW') || [])\n .length;\n\n if (hwDetails && hwDetails.length === 0) {\n return (\n <FlexView $flexRowGapX={1}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Homework ({hwDetails?.length})\n </Text>\n <Text $renderAs=\"ab2\" $color=\"BLACK_T_60\">\n No Homework assigned yet\n </Text>\n </FlexView>\n );\n }\n\n if (isProcessingFailed) {\n return null;\n }\n\n return (\n <Styled.ContentWrapper ref={homeworkRef} $flexRowGapX={1} $disablePointerEvents={isProcessing}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Homework ({waitForReviewSheets}/{hwDetails?.length})\n </Text>\n <FlexView\n $position=\"relative\"\n onMouseEnter={handleHoverEnter}\n onMouseLeave={handleHoverLeave}\n >\n <Styled.ScrollButton\n $position=\"absolute\"\n $background=\"BLACK_T_60\"\n $justifyContent=\"center\"\n $alignItems=\"center\"\n $height=\"100%\"\n onClick={handleScrollLeft}\n $visible={isLeftHovered}\n left=\"0px\"\n right=\"auto\"\n >\n <ChevronLeftIcon width={24} height={24} />\n </Styled.ScrollButton>\n\n <Styled.ScrollContainer ref={scrollRef}>\n <FlexView $flexDirection=\"row\" $flexGapX={1}>\n {hwDetails?.map((sheet, idx) => {\n const {\n node_id: nodeId,\n worksheet_id: worksheetId,\n node_type: nodeType,\n title,\n subtext,\n } = sheet;\n const isDynamicSheet = nodeType === 'DYNAMIC';\n\n return (\n <FlexView\n ref={idx === 0 ? individualHomeworkRef : undefined}\n key={`${worksheetId}_${nodeId}_${idx}`}\n $flexDirection=\"row\"\n $flexGapX={1}\n >\n {hwDetails.length > 10 && idx === 10 && (\n <Styled.QueueWrapper\n $background=\"BLACK_4\"\n $justifyContent=\"center\"\n $gutter={4}\n $gap={8}\n >\n <Styled.QueueText $renderAs=\"ac3\" $color=\"WHITE\">\n In Queue\n </Styled.QueueText>\n </Styled.QueueWrapper>\n )}\n <HomeworkCard\n isInQueue={hwDetails.length > 10 && idx > 9}\n userType={userType}\n header={title}\n subHeader={subtext || ''}\n nodeData={sheet}\n renderAs=\"homework\"\n studentId={studentId}\n onNodeAttempt={isDynamicSheet ? onTestStart : onNodeAttempt}\n shouldOpenOnRight={true}\n onNodeView={isDynamicSheet ? onTestPreview : onNodeView}\n onNodeReview={isDynamicSheet ? onTestReview : onNodeReview}\n onNodeUnassign={onNodeUnassign}\n />\n </FlexView>\n );\n })}\n </FlexView>\n </Styled.ScrollContainer>\n <Styled.ScrollButton\n $position=\"absolute\"\n $width=\"60px\"\n $height=\"100%\"\n $background=\"BLACK_T_60\"\n $justifyContent=\"center\"\n $alignItems=\"center\"\n onClick={handleScrollRight}\n $visible={isRightHovered}\n left=\"auto\"\n right=\"0px\"\n >\n <ChevronRightIcon width={24} height={24} />\n </Styled.ScrollButton>\n </FlexView>\n </Styled.ContentWrapper>\n );\n};\n\nexport default HWCardList;\n"],"names":["HWCardList","userType","studentId","stream","onTestStart","onNodeAttempt","onTestPreview","onNodeView","onTestReview","onNodeReview","onNodeUnassign","homeworkRef","individualHomeworkRef","startHomePageJourney","canStartJourney","scrollRef","useRef","isLeftHovered","setIsLeftHovered","useState","isRightHovered","setIsRightHovered","getHomeworks","hwDetails","isProcessingFailed","isProcessing","isStale","useGetHomeworks","isJourneyActive","useJourney","useEffect","updatedCanScroll","useCallback","scrollLeft","scrollWidth","clientWidth","handleScrollLeft","handleScrollRight","handleHoverEnter","handleHoverLeave","scrollElement","fetchHomeworks","waitForReviewSheets","sheet","jsxs","FlexView","Text","Styled.ContentWrapper","jsx","Styled.ScrollButton","ChevronLeftIcon","Styled.ScrollContainer","idx","nodeId","worksheetId","nodeType","title","subtext","isDynamicSheet","Styled.QueueWrapper","Styled.QueueText","HomeworkCard","ChevronRightIcon","HWCardList$1"],"mappings":";;;;;;;;;;AAoCA,MAAMA,KAAwC,CAAC;AAAA,EAC7C,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,iBAAAC;AACF,MAAM;AACE,QAAAC,IAAYC,EAAuB,IAAI,GACvC,CAACC,GAAeC,CAAgB,IAAIC,EAAS,EAAK,GAClD,CAACC,GAAgBC,CAAiB,IAAIF,EAAS,EAAK,GACpD;AAAA,IACJ,KAAKG;AAAA,IACL,MAAMC;AAAA,IACN,oBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,SAAAC;AAAA,EAAA,IACEC,EAAgBzB,CAAS,GACvB,EAAE,iBAAA0B,MAAoBC;AAE5B,EAAAC,EAAU,MAAM;AACd,IAAIP,KAAA,QAAAA,EAAW,UAAUV,KAAwB,CAACe,KAAmBd,KACnED,EAAqB,EAAE,WAAAU,GAAW,WAAArB,GAAW,QAAAC,GAAQ,UAAAF,EAAU,CAAA;AAAA,EACjE,GACC;AAAA,IACDa;AAAA,IACAS;AAAA,IACAK;AAAA,IACAf;AAAA,IACAV;AAAA,IACAD;AAAA,IACAD;AAAA,EAAA,CACD;AAEK,QAAA8B,IAAmBC,EAAY,MAAM;AACzC,QAAIjB,EAAU,SAAS;AACrB,YAAM,EAAE,YAAAkB,GAAY,aAAAC,GAAa,aAAAC,EAAA,IAAgBpB,EAAU;AAE3D,MAAIkB,IAAa,KACff,EAAiB,EAAI,GAGnBe,IAAaC,IAAcC,IAAc,KAC3Cd,EAAkB,EA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MAAK;AAAA,cACL,OAAM;AAAA,cAEN,UAAC,gBAAA4B,EAAAc,GAAA,EAAiB,OAAO,IAAI,QAAQ,IAAI;AAAA,YAAA;AAAA,UAC3C;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EACF,EAAA,CAAA;AAEJ,GAEAC,KAAe/D;"}
|
1
|
+
{"version":3,"file":"hw-card-list.js","sources":["../../../../src/features/homework/hw-card-list/hw-card-list.tsx"],"sourcesContent":["import type {\n INodeCardCallbacks,\n INodeDataProps,\n} from '../../chapters-v2/comps/node-card/node-card-types';\nimport type { IHomepageStartJourneyProps } from '../../journey/types/homepage-journey-types';\nimport type { TUserTypes } from '../../ui/types';\n\nimport React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport ChevronLeftIcon from '../../../assets/line-icons/icons/chevron-left';\nimport ChevronRightIcon from '../../../assets/line-icons/icons/chevron-right';\nimport { useJourney } from '../../journey/use-journey/use-journey';\nimport FlexView from '../../ui/layout/flex-view';\nimport Text from '../../ui/text/text';\nimport HomeworkCard from '../homework-card';\nimport { useGetHomeworks } from './api/get-homeworks';\nimport * as Styled from './hw-card-list-styled';\n\ninterface HWCardListProps extends INodeCardCallbacks {\n userType: TUserTypes;\n studentId: string;\n stream: string;\n onTestPreview?: (sheetData: INodeDataProps, milestoneId?: string) => void;\n onTestStart?: (sheetData: INodeDataProps, homeworkId?: string) => void;\n onTestReview?: (sheetData: INodeDataProps, milestoneId?: string) => void;\n homeworkRef?: React.RefObject<HTMLDivElement>;\n individualHomeworkRef?: React.RefObject<HTMLDivElement>;\n startHomePageJourney?: ({\n hwDetails,\n studentId,\n stream,\n userType,\n }: IHomepageStartJourneyProps) => void;\n canStartJourney?: boolean;\n}\n\nconst HWCardList: React.FC<HWCardListProps> = ({\n userType,\n studentId,\n stream,\n onTestStart,\n onNodeAttempt,\n onTestPreview,\n onNodeView,\n onTestReview,\n onNodeReview,\n onNodeUnassign,\n homeworkRef,\n individualHomeworkRef,\n startHomePageJourney,\n canStartJourney,\n}) => {\n const scrollRef = useRef<HTMLDivElement>(null);\n const [isLeftHovered, setIsLeftHovered] = useState(false);\n const [isRightHovered, setIsRightHovered] = useState(false);\n const {\n get: getHomeworks,\n data: hwDetails,\n isProcessingFailed,\n isProcessing,\n isStale,\n } = useGetHomeworks(studentId);\n const { isJourneyActive } = useJourney();\n\n useEffect(() => {\n if (hwDetails?.length && startHomePageJourney && !isJourneyActive && canStartJourney) {\n startHomePageJourney({ hwDetails, studentId, stream, userType });\n }\n }, [\n canStartJourney,\n hwDetails,\n isJourneyActive,\n startHomePageJourney,\n stream,\n studentId,\n userType,\n ]);\n\n const updatedCanScroll = useCallback(() => {\n if (scrollRef.current) {\n const { scrollLeft, scrollWidth, clientWidth } = scrollRef.current;\n\n if (scrollLeft > 1) {\n setIsLeftHovered(true);\n }\n\n if (scrollLeft < scrollWidth - clientWidth - 1) {\n setIsRightHovered(true);\n }\n }\n }, []);\n\n const handleScrollLeft = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: -200, behavior: 'smooth' });\n updatedCanScroll();\n }\n }, [updatedCanScroll]);\n\n const handleScrollRight = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: 200, behavior: 'smooth' });\n updatedCanScroll();\n }\n }, [updatedCanScroll]);\n\n const handleHoverEnter = useCallback(() => {\n if (!scrollRef.current) return;\n\n updatedCanScroll();\n }, [updatedCanScroll]);\n\n const handleHoverLeave = useCallback(() => {\n setIsLeftHovered(false);\n setIsRightHovered(false);\n }, []);\n\n useEffect(() => {\n const scrollElement = scrollRef.current;\n\n if (scrollElement) {\n scrollElement.addEventListener('scroll', updatedCanScroll);\n\n return () => {\n scrollElement.removeEventListener('scroll', updatedCanScroll);\n };\n }\n }, [updatedCanScroll]);\n\n useEffect(() => {\n if (hwDetails && hwDetails?.length > 3 && scrollRef.current) {\n const { scrollLeft } = scrollRef.current;\n\n if (scrollLeft > 1) {\n setIsLeftHovered(true);\n }\n }\n }, [hwDetails]);\n\n const fetchHomeworks = useCallback(() => {\n getHomeworks(studentId, undefined, { stream });\n }, [getHomeworks, stream, studentId]);\n\n useEffect(() => {\n if (!isProcessing && isStale) {\n fetchHomeworks();\n }\n }, [fetchHomeworks, isProcessing, isStale]);\n\n useEffect(() => {\n fetchHomeworks();\n }, [fetchHomeworks]);\n\n const waitForReviewSheets = useMemo(\n () => (hwDetails?.filter(sheet => sheet.state === 'WAIT_FOR_REVIEW') || []).length,\n [hwDetails],\n );\n\n if (hwDetails && hwDetails.length === 0) {\n return (\n <FlexView $flexRowGapX={1}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Homework ({hwDetails?.length})\n </Text>\n <Text $renderAs=\"ab2\" $color=\"BLACK_T_60\">\n No Homework assigned yet\n </Text>\n </FlexView>\n );\n }\n\n if (isProcessingFailed) {\n return null;\n }\n\n return (\n <Styled.ContentWrapper ref={homeworkRef} $flexRowGapX={1} $disablePointerEvents={isProcessing}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Homework ({waitForReviewSheets}/{hwDetails?.length})\n </Text>\n <FlexView\n $position=\"relative\"\n onMouseEnter={handleHoverEnter}\n onMouseLeave={handleHoverLeave}\n >\n <Styled.ScrollButton\n $position=\"absolute\"\n $background=\"BLACK_T_60\"\n $justifyContent=\"center\"\n $alignItems=\"center\"\n $height=\"100%\"\n onClick={handleScrollLeft}\n $visible={isLeftHovered}\n left=\"0px\"\n right=\"auto\"\n >\n <ChevronLeftIcon width={24} height={24} />\n </Styled.ScrollButton>\n\n <Styled.ScrollContainer ref={scrollRef}>\n <FlexView $flexDirection=\"row\" $flexGapX={1}>\n {hwDetails?.map((sheet, idx) => {\n const {\n node_id: nodeId,\n worksheet_id: worksheetId,\n node_type: nodeType,\n title,\n subtext,\n } = sheet;\n const isDynamicSheet = nodeType === 'DYNAMIC';\n\n return (\n <FlexView\n ref={idx === 0 ? individualHomeworkRef : undefined}\n key={`${worksheetId}_${nodeId}_${idx}`}\n $flexDirection=\"row\"\n $flexGapX={1}\n >\n {hwDetails.length > 10 && idx === 10 && (\n <Styled.QueueWrapper\n $background=\"BLACK_4\"\n $justifyContent=\"center\"\n $gutter={4}\n $gap={8}\n >\n <Styled.QueueText $renderAs=\"ac3\" $color=\"WHITE\">\n In Queue\n </Styled.QueueText>\n </Styled.QueueWrapper>\n )}\n <HomeworkCard\n isInQueue={hwDetails.length > 10 && idx > 9}\n userType={userType}\n header={title}\n subHeader={subtext || ''}\n nodeData={sheet}\n renderAs=\"homework\"\n studentId={studentId}\n onNodeAttempt={isDynamicSheet ? onTestStart : onNodeAttempt}\n shouldOpenOnRight={true}\n onNodeView={isDynamicSheet ? onTestPreview : onNodeView}\n onNodeReview={isDynamicSheet ? onTestReview : onNodeReview}\n onNodeUnassign={onNodeUnassign}\n />\n </FlexView>\n );\n })}\n </FlexView>\n </Styled.ScrollContainer>\n <Styled.ScrollButton\n $position=\"absolute\"\n $width=\"60px\"\n $height=\"100%\"\n $background=\"BLACK_T_60\"\n $justifyContent=\"center\"\n $alignItems=\"center\"\n onClick={handleScrollRight}\n $visible={isRightHovered}\n left=\"auto\"\n right=\"0px\"\n >\n <ChevronRightIcon width={24} height={24} />\n </Styled.ScrollButton>\n </FlexView>\n </Styled.ContentWrapper>\n );\n};\n\nexport default memo(HWCardList);\n"],"names":["HWCardList","userType","studentId","stream","onTestStart","onNodeAttempt","onTestPreview","onNodeView","onTestReview","onNodeReview","onNodeUnassign","homeworkRef","individualHomeworkRef","startHomePageJourney","canStartJourney","scrollRef","useRef","isLeftHovered","setIsLeftHovered","useState","isRightHovered","setIsRightHovered","getHomeworks","hwDetails","isProcessingFailed","isProcessing","isStale","useGetHomeworks","isJourneyActive","useJourney","useEffect","updatedCanScroll","useCallback","scrollLeft","scrollWidth","clientWidth","handleScrollLeft","handleScrollRight","handleHoverEnter","handleHoverLeave","scrollElement","fetchHomeworks","waitForReviewSheets","useMemo","sheet","jsxs","FlexView","Text","Styled.ContentWrapper","jsx","Styled.ScrollButton","ChevronLeftIcon","Styled.ScrollContainer","idx","nodeId","worksheetId","nodeType","title","subtext","isDynamicSheet","Styled.QueueWrapper","Styled.QueueText","HomeworkCard","ChevronRightIcon","HWCardList$1","memo"],"mappings":";;;;;;;;;;AAoCA,MAAMA,KAAwC,CAAC;AAAA,EAC7C,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,iBAAAC;AACF,MAAM;AACE,QAAAC,IAAYC,EAAuB,IAAI,GACvC,CAACC,GAAeC,CAAgB,IAAIC,EAAS,EAAK,GAClD,CAACC,GAAgBC,CAAiB,IAAIF,EAAS,EAAK,GACpD;AAAA,IACJ,KAAKG;AAAA,IACL,MAAMC;AAAA,IACN,oBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,SAAAC;AAAA,EAAA,IACEC,GAAgBzB,CAAS,GACvB,EAAE,iBAAA0B,MAAoBC;AAE5B,EAAAC,EAAU,MAAM;AACd,IAAIP,KAAA,QAAAA,EAAW,UAAUV,KAAwB,CAACe,KAAmBd,KACnED,EAAqB,EAAE,WAAAU,GAAW,WAAArB,GAAW,QAAAC,GAAQ,UAAAF,EAAU,CAAA;AAAA,EACjE,GACC;AAAA,IACDa;AAAA,IACAS;AAAA,IACAK;AAAA,IACAf;AAAA,IACAV;AAAA,IACAD;AAAA,IACAD;AAAA,EAAA,CACD;AAEK,QAAA8B,IAAmBC,EAAY,MAAM;AACzC,QAAIjB,EAAU,SAAS;AACrB,YAAM,EAAE,YAAAkB,GAAY,aAAAC,GAAa,aAAAC,EAAA,IAAgBpB,EAAU;AAE3D,MAAIkB,IAAa,KACff,EAAiB,EAAI,GAGnBe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AAA;AAAA,UA8BtC,IAGN,EACF,CAAA;AAAA,UACA,gBAAAJ;AAAA,YAACC;AAAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,QAAO;AAAA,cACP,SAAQ;AAAA,cACR,aAAY;AAAA,cACZ,iBAAgB;AAAA,cAChB,aAAY;AAAA,cACZ,SAASb;AAAA,cACT,UAAUjB;AAAA,cACV,MAAK;AAAA,cACL,OAAM;AAAA,cAEN,UAAC,gBAAA6B,EAAAc,GAAA,EAAiB,OAAO,IAAI,QAAQ,IAAI;AAAA,YAAA;AAAA,UAC3C;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EACF,EAAA,CAAA;AAEJ,GAEeC,KAAAC,EAAKjE,EAAU;"}
|
@@ -2,18 +2,19 @@ import { jsxs as t, Fragment as ee, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import te, { memo as ne, useState as oe, useCallback as A } from "react";
|
3
3
|
import ie from "../../../hooks/use-lazy-ref.js";
|
4
4
|
import u from "../../../ui/buttons/text-button/text-button.js";
|
5
|
-
import
|
5
|
+
import c from "../../../ui/layout/flex-view.js";
|
6
|
+
import re from "../../../ui/separator/separator.js";
|
6
7
|
import C from "../../../ui/text/text.js";
|
7
|
-
import
|
8
|
-
import { StyledDownIcon as
|
9
|
-
import
|
10
|
-
import
|
11
|
-
const
|
12
|
-
({ milestones: e, studentId: M, milestoneType:
|
13
|
-
const [
|
8
|
+
import se from "./milestone-widget/milestone-widget.js";
|
9
|
+
import { StyledDownIcon as ae } from "./milestone-widget/milestone-widget-styled.js";
|
10
|
+
import le from "./no-active-milestone/no-active-milestone.js";
|
11
|
+
import ce from "../../../../node_modules/uuid/dist/esm-browser/v4.js";
|
12
|
+
const Ne = ne(
|
13
|
+
({ milestones: e, studentId: M, milestoneType: s, ...x }) => {
|
14
|
+
const [a, N] = oe(!1), {
|
14
15
|
canCreatePlan: m,
|
15
|
-
isClassOngoing:
|
16
|
-
isFiltersAdded:
|
16
|
+
isClassOngoing: T,
|
17
|
+
isFiltersAdded: $,
|
17
18
|
isStudentPresent: I,
|
18
19
|
onAddChapter: v,
|
19
20
|
onAddOutcome: i,
|
@@ -24,8 +25,8 @@ const Me = ne(
|
|
24
25
|
onEdit: D,
|
25
26
|
onExpandPastMilestones: f,
|
26
27
|
onCreateMilestoneTest: P,
|
27
|
-
onNodeAttempt:
|
28
|
-
onNodeView:
|
28
|
+
onNodeAttempt: S,
|
29
|
+
onNodeView: b,
|
29
30
|
onNodeReview: F,
|
30
31
|
onNodeReattempt: k,
|
31
32
|
onNodeReset: B,
|
@@ -42,10 +43,10 @@ const Me = ne(
|
|
42
43
|
parentName: U,
|
43
44
|
userType: d,
|
44
45
|
courseStream: W
|
45
|
-
} = x,
|
46
|
+
} = x, l = s === "ACTIVE", h = s === "DRAFT", g = ie(ce), H = A(() => {
|
46
47
|
r == null || r(g);
|
47
48
|
}, [r, g]), q = () => {
|
48
|
-
!
|
49
|
+
!a && f && f(), N(!a);
|
49
50
|
}, J = A(() => {
|
50
51
|
i == null || i();
|
51
52
|
}, [i]);
|
@@ -56,24 +57,24 @@ const Me = ne(
|
|
56
57
|
(o) => o.milestone_state === "DRAFT"
|
57
58
|
);
|
58
59
|
return /* @__PURE__ */ t(ee, { children: [
|
59
|
-
|
60
|
-
|
60
|
+
l && !K && /* @__PURE__ */ n(c, { $marginBottom: 40, children: /* @__PURE__ */ n(
|
61
|
+
le,
|
61
62
|
{
|
62
63
|
canCreatePlan: m,
|
63
64
|
isDraftMilestonePresent: Q,
|
64
|
-
isFiltersAdded:
|
65
|
+
isFiltersAdded: $,
|
65
66
|
onCreatePlan: r,
|
66
67
|
studentName: p,
|
67
68
|
userType: d
|
68
69
|
}
|
69
70
|
) }),
|
70
|
-
|
71
|
+
l && /* @__PURE__ */ t(c, { $flexDirection: "row", $justifyContent: "space-between", $marginBottom: 16, children: [
|
71
72
|
/* @__PURE__ */ t(C, { $renderAs: "ac4", children: [
|
72
73
|
"Goals (",
|
73
74
|
e.length,
|
74
75
|
")"
|
75
76
|
] }),
|
76
|
-
d === "TEACHER" && /* @__PURE__ */ t(
|
77
|
+
d === "TEACHER" && /* @__PURE__ */ t(c, { $flexDirection: "row", $flexGapX: 1, children: [
|
77
78
|
/* @__PURE__ */ n(
|
78
79
|
u,
|
79
80
|
{
|
@@ -86,8 +87,8 @@ const Me = ne(
|
|
86
87
|
/* @__PURE__ */ n(u, { label: "Add Milestone", size: "small", onClick: J })
|
87
88
|
] })
|
88
89
|
] }),
|
89
|
-
|
90
|
-
|
90
|
+
s === "INACTIVE" && !!e.length && /* @__PURE__ */ t(
|
91
|
+
c,
|
91
92
|
{
|
92
93
|
$flexDirection: "row",
|
93
94
|
$alignItems: "center",
|
@@ -99,15 +100,15 @@ const Me = ne(
|
|
99
100
|
e.length,
|
100
101
|
")"
|
101
102
|
] }),
|
102
|
-
/* @__PURE__ */ n(
|
103
|
+
/* @__PURE__ */ n(ae, { onClick: q, $expanded: a })
|
103
104
|
]
|
104
105
|
}
|
105
106
|
),
|
106
|
-
(h ||
|
107
|
+
(h || l || a) && e.map((o, Y) => {
|
107
108
|
const { id: Z } = o;
|
108
109
|
return /* @__PURE__ */ t(te.Fragment, { children: [
|
109
110
|
/* @__PURE__ */ n(
|
110
|
-
|
111
|
+
se,
|
111
112
|
{
|
112
113
|
milestone: o,
|
113
114
|
studentId: M,
|
@@ -117,18 +118,18 @@ const Me = ne(
|
|
117
118
|
userType: d,
|
118
119
|
onAddOutcome: i,
|
119
120
|
onChapterClick: w,
|
120
|
-
isMilestoneActive:
|
121
|
-
milestoneType:
|
121
|
+
isMilestoneActive: l || h,
|
122
|
+
milestoneType: s,
|
122
123
|
onEdit: D,
|
123
124
|
onCreateMilestoneTest: P,
|
124
125
|
onAddChapter: v,
|
125
126
|
onDelete: E,
|
126
127
|
onDraftPublish: R,
|
127
|
-
isClassOngoing:
|
128
|
+
isClassOngoing: T,
|
128
129
|
isStudentPresent: I,
|
129
130
|
onAssignResources: j,
|
130
|
-
onNodeAttempt:
|
131
|
-
onNodeView:
|
131
|
+
onNodeAttempt: S,
|
132
|
+
onNodeView: b,
|
132
133
|
onNodeReview: F,
|
133
134
|
onNodeReattempt: k,
|
134
135
|
onNodeReset: B,
|
@@ -142,13 +143,13 @@ const Me = ne(
|
|
142
143
|
onWidgetTabSelection: z
|
143
144
|
}
|
144
145
|
),
|
145
|
-
Y !== e.length - 1 && /* @__PURE__ */ n(
|
146
|
+
Y !== e.length - 1 && /* @__PURE__ */ n(re, { heightX: 2 })
|
146
147
|
] }, `milestone=${Z}`);
|
147
148
|
})
|
148
149
|
] });
|
149
150
|
}
|
150
151
|
);
|
151
152
|
export {
|
152
|
-
|
153
|
+
Ne as default
|
153
154
|
};
|
154
155
|
//# 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, useState } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport useLazyRef from '../../../hooks/use-lazy-ref';\nimport TextButton from '../../../ui/buttons/text-button/text-button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Text from '../../../ui/text/text';\nimport MilestoneWidget from './milestone-widget/milestone-widget';\nimport { StyledDownIcon } from './milestone-widget/milestone-widget-styled';\nimport NoActiveMilestone from './no-active-milestone/no-active-milestone';\n\nconst MilestoneList: React.FC<IMilestoneListProps> = memo(\n ({ milestones, studentId, milestoneType, ...restMilestoneListProps }) => {\n const [expandInactiveMilestones, setExpandInactiveMilestones] = useState(false);\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 onExpandPastMilestones,\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 } = 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 toggleExpand = () => {\n if (!expandInactiveMilestones && onExpandPastMilestones) {\n onExpandPastMilestones();\n }\n setExpandInactiveMilestones(!expandInactiveMilestones);\n };\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={32}>\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 <TextButton\n label=\"Create Goal\"\n size=\"small\"\n onClick={handleCreatePlan}\n disabled={!canCreatePlan}\n />\n <TextButton label=\"Add Milestone\" size=\"small\" onClick={handleOnAddOutcome} />\n </FlexView>\n )}\n </FlexView>\n )}\n\n {milestoneType === 'INACTIVE' && Boolean(milestones.length) && (\n <FlexView\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $justifyContent=\"space-between\"\n $marginBottomX={1}\n >\n <Text $renderAs=\"ac4\">PAST LEARNING PLANS & OUTCOMES ({milestones.length})</Text>\n <StyledDownIcon onClick={toggleExpand} $expanded={expandInactiveMilestones} />\n </FlexView>\n )}\n\n {(isDraftMilestone || isMilestoneActive || expandInactiveMilestones) &&\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 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 && <FlexView $heightX={2} />}\n </React.Fragment>\n );\n })}\n </>\n );\n },\n);\n\nexport default MilestoneList;\n"],"names":["MilestoneList","memo","milestones","studentId","milestoneType","restMilestoneListProps","expandInactiveMilestones","setExpandInactiveMilestones","useState","canCreatePlan","isClassOngoing","isFiltersAdded","isStudentPresent","onAddChapter","onAddOutcome","onChapterClick","onCreatePlan","onDelete","onDraftPublish","onEdit","onExpandPastMilestones","onCreateMilestoneTest","onNodeAttempt","onNodeView","onNodeReview","onNodeReattempt","onNodeReset","onNodeUnassign","onAssignResources","onTestPreview","onTestReview","onTestStart","activeMilestoneId","activeTabId","onWidgetTabSelection","studentName","teacherName","parentName","userType","courseStream","isMilestoneActive","isDraftMilestone","temporaryMilestoneId","useLazyRef","uuidv4","handleCreatePlan","useCallback","toggleExpand","handleOnAddOutcome","activeMilestonePresent","milestone","draftMilestonePresent","jsxs","Fragment","jsx","FlexView","NoActiveMilestone","Text","TextButton","StyledDownIcon","idx","milestoneId","React","MilestoneWidget"],"mappings":";;;;;;;;;;AAaA,MAAMA,KAA+CC;AAAA,EACnD,CAAC,EAAE,YAAAC,GAAY,WAAAC,GAAW,eAAAC,GAAe,GAAGC,QAA6B;AACvE,UAAM,CAACC,GAA0BC,CAA2B,IAAIC,GAAS,EAAK,GACxE;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,wBAAAC;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,IACE,IAAAlC,GAEEmC,IAAoBpC,MAAkB,UACtCqC,IAAmBrC,MAAkB,SACrCsC,IAAuBC,GAAWC,EAAM,GAExCC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ACA,cAAAQ;AAAA,cACA,mBAAAP;AAAA,cACA,aAAAC;AAAA,cACA,sBAAAC;AAAA,YAAA;AAAA,UACF;AAAA,UACC0B,MAAQ1D,EAAW,SAAS,KAAM,gBAAAoD,EAAAC,GAAA,EAAS,UAAU,GAAG;AAAA,QAlCtC,EAAA,GAAA,aAAaM,CAAW,EAmC7C;AAAA,MAAA,CAEH;AAAA,IACL,EAAA,CAAA;AAAA,EAEJ;AACF;"}
|
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, useState } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport useLazyRef from '../../../hooks/use-lazy-ref';\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 { StyledDownIcon } from './milestone-widget/milestone-widget-styled';\nimport NoActiveMilestone from './no-active-milestone/no-active-milestone';\n\nconst MilestoneList: React.FC<IMilestoneListProps> = memo(\n ({ milestones, studentId, milestoneType, ...restMilestoneListProps }) => {\n const [expandInactiveMilestones, setExpandInactiveMilestones] = useState(false);\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 onExpandPastMilestones,\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 } = 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 toggleExpand = () => {\n if (!expandInactiveMilestones && onExpandPastMilestones) {\n onExpandPastMilestones();\n }\n setExpandInactiveMilestones(!expandInactiveMilestones);\n };\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 <TextButton\n label=\"Create Goal\"\n size=\"small\"\n onClick={handleCreatePlan}\n disabled={!canCreatePlan}\n />\n <TextButton label=\"Add Milestone\" size=\"small\" onClick={handleOnAddOutcome} />\n </FlexView>\n )}\n </FlexView>\n )}\n\n {milestoneType === 'INACTIVE' && Boolean(milestones.length) && (\n <FlexView\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $justifyContent=\"space-between\"\n $marginBottomX={1}\n >\n <Text $renderAs=\"ac4\">PAST LEARNING PLANS & OUTCOMES ({milestones.length})</Text>\n <StyledDownIcon onClick={toggleExpand} $expanded={expandInactiveMilestones} />\n </FlexView>\n )}\n\n {(isDraftMilestone || isMilestoneActive || expandInactiveMilestones) &&\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 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","expandInactiveMilestones","setExpandInactiveMilestones","useState","canCreatePlan","isClassOngoing","isFiltersAdded","isStudentPresent","onAddChapter","onAddOutcome","onChapterClick","onCreatePlan","onDelete","onDraftPublish","onEdit","onExpandPastMilestones","onCreateMilestoneTest","onNodeAttempt","onNodeView","onNodeReview","onNodeReattempt","onNodeReset","onNodeUnassign","onAssignResources","onTestPreview","onTestReview","onTestStart","activeMilestoneId","activeTabId","onWidgetTabSelection","studentName","teacherName","parentName","userType","courseStream","isMilestoneActive","isDraftMilestone","temporaryMilestoneId","useLazyRef","uuidv4","handleCreatePlan","useCallback","toggleExpand","handleOnAddOutcome","activeMilestonePresent","milestone","draftMilestonePresent","jsxs","Fragment","jsx","FlexView","NoActiveMilestone","Text","TextButton","StyledDownIcon","idx","milestoneId","React","MilestoneWidget","Separator"],"mappings":";;;;;;;;;;;AAcA,MAAMA,KAA+CC;AAAA,EACnD,CAAC,EAAE,YAAAC,GAAY,WAAAC,GAAW,eAAAC,GAAe,GAAGC,QAA6B;AACvE,UAAM,CAACC,GAA0BC,CAA2B,IAAIC,GAAS,EAAK,GACxE;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,wBAAAC;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,IACE,IAAAlC,GAEEmC,IAAoBpC,MAAkB,UACtCqC,IAAmBrC,MAAkB,SACrCsC,IAAuBC,GAAWC,EAAM,GAExCC,IAAmBC,EAAY,MAAM;AACzC,MAAA9B,KAAA,QAAAA,EAAe0B;AAAA,IAAoB,GAClC,CAAC1B,GAAc0B,CAAoB,CAAC,GAEjCK,IAAe,MAAM;AACrB,MAAA,CAACzC,KAA4Bc,KACRA,KAEzBb,EAA4B,CAACD,CAAwB;AAAA,IAAA,GAGjD0C,IAAqBF,EAAY,MAAM;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CAEH;AAAA,IACL,EAAA,CAAA;AAAA,EAEJ;AACF;"}
|
@@ -14,7 +14,7 @@ import re from "./outcome/outcome.js";
|
|
14
14
|
const ue = W(
|
15
15
|
({ isClassOngoing: C, isStudentPresent: T, isExpanded: oe, ...x }) => {
|
16
16
|
const {
|
17
|
-
milestone:
|
17
|
+
milestone: d,
|
18
18
|
studentId: A,
|
19
19
|
studentName: _,
|
20
20
|
teacherName: I,
|
@@ -26,13 +26,13 @@ const ue = W(
|
|
26
26
|
onDraftPublish: E,
|
27
27
|
onAddOutcome: b
|
28
28
|
} = x, {
|
29
|
-
milestone_name:
|
29
|
+
milestone_name: m,
|
30
30
|
milestone_date_ts: S,
|
31
31
|
milestone_state: o,
|
32
32
|
goal_category: l,
|
33
|
-
goal_code:
|
33
|
+
goal_code: g,
|
34
34
|
progress_stat: k
|
35
|
-
} =
|
35
|
+
} = d, { completed: p = 0, total: h = 0 } = k || {}, $ = o === "OUTCOME_PENDING", a = p > 0 ? Math.floor((p / h || 1) * 100) : 0, n = X(null), [B, O] = j(!1), { textColor: N, borderColor: f } = J(l), c = Q(o), R = ($ ? c == null ? void 0 : c.progressBackgroundColor : f) || "WHITE_5", L = H(() => typeof g == "string", [g]), M = z(S);
|
36
36
|
return F(() => {
|
37
37
|
n.current && n.current.scrollHeight > n.current.clientHeight && O(!0);
|
38
38
|
}, [n]), l ? /* @__PURE__ */ t(
|
@@ -62,7 +62,7 @@ const ue = W(
|
|
62
62
|
{
|
63
63
|
$progressCircle: !0,
|
64
64
|
$progressBackground: "BLACK_1",
|
65
|
-
$progress:
|
65
|
+
$progress: a * 2,
|
66
66
|
r: "31",
|
67
67
|
cx: "32",
|
68
68
|
cy: "32"
|
@@ -78,7 +78,7 @@ const ue = W(
|
|
78
78
|
height: 40
|
79
79
|
}
|
80
80
|
) }),
|
81
|
-
|
81
|
+
a === 100 && /* @__PURE__ */ e(ee, { children: /* @__PURE__ */ e(K, { width: 20, height: 20 }) })
|
82
82
|
]
|
83
83
|
}
|
84
84
|
),
|
@@ -114,7 +114,7 @@ const ue = W(
|
|
114
114
|
{
|
115
115
|
renderAs: "primary",
|
116
116
|
position: "bottom",
|
117
|
-
tooltipItem:
|
117
|
+
tooltipItem: m,
|
118
118
|
hidden: !B,
|
119
119
|
children: /* @__PURE__ */ e(
|
120
120
|
te,
|
@@ -122,26 +122,26 @@ const ue = W(
|
|
122
122
|
ref: n,
|
123
123
|
$renderAs: L ? "ah4" : "ab1",
|
124
124
|
$color: "BLACK_1",
|
125
|
-
children:
|
125
|
+
children: m
|
126
126
|
}
|
127
127
|
)
|
128
128
|
}
|
129
129
|
),
|
130
|
-
o !== "DRAFT" && /* @__PURE__ */ t(s, { $renderAs: "ub3", $color: "BLACK_T_60", children: [
|
131
|
-
|
132
|
-
|
130
|
+
!!h && o !== "DRAFT" && /* @__PURE__ */ t(s, { $renderAs: "ub3", $color: "BLACK_T_60", children: [
|
131
|
+
`${a}% complete`,
|
132
|
+
o === "ACTIVE" && M
|
133
133
|
] })
|
134
134
|
] }),
|
135
|
-
i != null && i.length
|
135
|
+
!!(i != null && i.length) && /* @__PURE__ */ t(P, { children: [
|
136
136
|
/* @__PURE__ */ e(U, { width: 40, height: 1, background: "BLACK_T_15" }),
|
137
137
|
/* @__PURE__ */ e(re, { outcomes: i })
|
138
|
-
] })
|
138
|
+
] })
|
139
139
|
] })
|
140
140
|
] }),
|
141
141
|
y === "TEACHER" && /* @__PURE__ */ e(
|
142
142
|
Y,
|
143
143
|
{
|
144
|
-
milestone:
|
144
|
+
milestone: d,
|
145
145
|
studentId: A,
|
146
146
|
studentName: _,
|
147
147
|
teacherName: I ?? "",
|