@cuemath/leap 2.8.60-gs1 → 2.8.61-as1
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/constants/api.js +3 -2
- package/dist/constants/api.js.map +1 -1
- package/dist/features/chapters/chapters-list/chapter-item/chapter-item.js +1 -1
- 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 +7 -7
- package/dist/features/chapters-v2/chapter-details/block-sections/block-section-view.js.map +1 -1
- package/dist/features/chapters-v2/comps/node-card/node-card-styled.js +15 -16
- package/dist/features/chapters-v2/comps/node-card/node-card-styled.js.map +1 -1
- package/dist/features/chapters-v2/comps/node-card/node-card-tags.js +12 -8
- package/dist/features/chapters-v2/comps/node-card/node-card-tags.js.map +1 -1
- package/dist/features/chapters-v2/comps/node-card/student-actions/student-actions.js +2 -2
- package/dist/features/chapters-v2/comps/node-card/student-actions/student-actions.js.map +1 -1
- package/dist/features/chapters-v2/utils/index.js +5 -4
- package/dist/features/chapters-v2/utils/index.js.map +1 -1
- package/dist/features/chapters-v2/utils/node-card-utils.js +62 -35
- package/dist/features/chapters-v2/utils/node-card-utils.js.map +1 -1
- package/dist/features/homework/card-menu-options.js +23 -0
- package/dist/features/homework/card-menu-options.js.map +1 -0
- package/dist/features/homework/homework-card.js +209 -0
- package/dist/features/homework/homework-card.js.map +1 -0
- package/dist/features/homework/styles.js +114 -0
- package/dist/features/homework/styles.js.map +1 -0
- package/dist/features/milestone/create/api/goal-submit.js +1 -1
- package/dist/features/milestone/create/api/goal-submit.js.map +1 -1
- package/dist/features/milestone/edit/comps/edit-milestone-modal/api/patch-goal-plan.js +1 -1
- package/dist/features/milestone/edit/comps/edit-milestone-modal/api/patch-goal-plan.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/api/get-milestone-resources.js +1 -1
- package/dist/features/milestone/milestone-list-container/api/get-milestone-resources.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/api/get-tests-list.js +1 -1
- package/dist/features/milestone/milestone-list-container/api/get-tests-list.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-list.js +79 -81
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-list.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-tabs/milestone-tabs.js +59 -61
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-tabs/milestone-tabs.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget.js +83 -85
- 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 +88 -90
- package/dist/features/milestone/milestone-list-container/milestone-list-container.js.map +1 -1
- package/dist/features/milestone/milestone-resources/resources-list/resources-list.js +82 -98
- package/dist/features/milestone/milestone-resources/resources-list/resources-list.js.map +1 -1
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-container.js +165 -0
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-container.js.map +1 -0
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-view-styled.js +25 -0
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-view-styled.js.map +1 -0
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-view.js +82 -0
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-view.js.map +1 -0
- package/dist/features/recent-chapters/api/get-recent-chapters.js +9 -0
- package/dist/features/recent-chapters/api/get-recent-chapters.js.map +1 -0
- package/dist/features/recent-chapters/recent-chapters-styled.js +16 -0
- package/dist/features/recent-chapters/recent-chapters-styled.js.map +1 -0
- package/dist/features/recent-chapters/recent-chapters.js +40 -0
- package/dist/features/recent-chapters/recent-chapters.js.map +1 -0
- package/dist/features/sheet-v2/resource-list/resource-list.js +49 -0
- package/dist/features/sheet-v2/resource-list/resource-list.js.map +1 -0
- package/dist/features/sheets/resources-list/resource-item/styled.js +1 -1
- package/dist/features/sheets/resources-list/resource-item/styled.js.map +1 -1
- package/dist/index.d.ts +35 -16
- package/dist/index.js +31 -29
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-cta.js +0 -71
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-cta.js.map +0 -1
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-styled.js +0 -31
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-styled.js.map +0 -1
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-utils.js +0 -38
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-utils.js.map +0 -1
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item.js +0 -79
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item.js.map +0 -1
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheets-list-styled.js +0 -18
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheets-list-styled.js.map +0 -1
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheets-list.js +0 -51
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheets-list.js.map +0 -1
- package/dist/features/milestone/milestone-tests/tests-list/tests-list-styled.js +0 -11
- package/dist/features/milestone/milestone-tests/tests-list/tests-list-styled.js.map +0 -1
- package/dist/features/milestone/milestone-tests/tests-list/tests-list.js +0 -144
- package/dist/features/milestone/milestone-tests/tests-list/tests-list.js.map +0 -1
@@ -1,129 +1,113 @@
|
|
1
|
-
import { jsx as e, jsxs as
|
2
|
-
import { memo as
|
3
|
-
import { IMAGES as
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import
|
10
|
-
import
|
11
|
-
import
|
12
|
-
import
|
13
|
-
import { useGetMilestoneResources as
|
14
|
-
import { MilestoneResourcesWrapper as
|
15
|
-
const
|
1
|
+
import { jsx as e, jsxs as c, Fragment as N } from "react/jsx-runtime";
|
2
|
+
import { memo as B, useCallback as l, useEffect as D } from "react";
|
3
|
+
import { IMAGES as v } from "../../../../assets/images/images.js";
|
4
|
+
import G from "../../../../assets/line-icons/icons/plus.js";
|
5
|
+
import H from "../../../../assets/line-icons/icons/search.js";
|
6
|
+
import O from "../../../sheet-v2/resource-list/resource-list.js";
|
7
|
+
import X from "../../../ui/arrow-tooltip/arrow-tooltip.js";
|
8
|
+
import b from "../../../ui/buttons/button/button.js";
|
9
|
+
import q from "../../../ui/buttons/icon-button/icon-button.js";
|
10
|
+
import w from "../../../ui/layout/flex-view.js";
|
11
|
+
import z from "../../../ui/loader/app-loader/app-loader.js";
|
12
|
+
import C from "../../../ui/text/text.js";
|
13
|
+
import { useGetMilestoneResources as F } from "../../milestone-list-container/api/get-milestone-resources.js";
|
14
|
+
import { MilestoneResourcesWrapper as d, SearchButtonWrapper as L, SearchButtonCover as U, DefaultWrapper as E } from "./resources-list-styled.js";
|
15
|
+
const ae = B((M) => {
|
16
16
|
const {
|
17
|
-
isDraftMilestone:
|
18
|
-
isMilestoneActive:
|
19
|
-
userType:
|
20
|
-
studentId:
|
17
|
+
isDraftMilestone: m,
|
18
|
+
isMilestoneActive: t,
|
19
|
+
userType: u,
|
20
|
+
studentId: p,
|
21
21
|
userMilestoneId: r,
|
22
|
-
canUpdatePlan:
|
22
|
+
canUpdatePlan: h,
|
23
23
|
onAssignResources: o,
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
studentId: g
|
24
|
+
onNodeAttempt: T,
|
25
|
+
onNodeView: P,
|
26
|
+
onNodeReview: S,
|
27
|
+
onNodeReset: x,
|
28
|
+
onNodeUnassign: W,
|
29
|
+
onNodeReattempt: j
|
30
|
+
} = M, f = u === "TEACHER", g = !h || !t || t && m, {
|
31
|
+
get: $,
|
32
|
+
isProcessed: s,
|
33
|
+
isProcessing: A,
|
34
|
+
isProcessingFailed: n,
|
35
|
+
isStale: y,
|
36
|
+
data: i
|
37
|
+
} = F(), I = l(() => {
|
38
|
+
r && $(r, void 0, {
|
39
|
+
studentId: p
|
41
40
|
});
|
42
|
-
}, [
|
43
|
-
|
44
|
-
}, [
|
45
|
-
|
46
|
-
!
|
47
|
-
}, [
|
48
|
-
const
|
41
|
+
}, [p, r, $]), a = l(() => {
|
42
|
+
I();
|
43
|
+
}, [I]);
|
44
|
+
D(() => {
|
45
|
+
!A && (!s && !n || y) && a();
|
46
|
+
}, [a, s, A, n, y]);
|
47
|
+
const R = l(() => {
|
49
48
|
if (typeof o != "function")
|
50
49
|
throw new Error("onAssignResources must be a function");
|
51
50
|
if (!r) throw new Error("userMilestoneId is required");
|
52
51
|
o(r);
|
53
|
-
}, [o, r]),
|
54
|
-
|
55
|
-
|
56
|
-
throw new Error("onUnAssignSheet must be a function");
|
57
|
-
if (!r) throw new Error("userMilestoneId is required");
|
58
|
-
i(u, r);
|
59
|
-
},
|
60
|
-
[i, r]
|
61
|
-
), v = t(
|
62
|
-
(u) => {
|
63
|
-
n == null || n(u, r);
|
64
|
-
},
|
65
|
-
[n, r]
|
66
|
-
), B = l && l.length > 0;
|
67
|
-
return c ? /* @__PURE__ */ e(
|
68
|
-
m,
|
52
|
+
}, [o, r]), k = i && i.length > 0;
|
53
|
+
return n ? /* @__PURE__ */ e(
|
54
|
+
d,
|
69
55
|
{
|
70
56
|
$alignItems: "center",
|
71
57
|
$justifyContent: "center",
|
72
58
|
$background: "WHITE",
|
73
|
-
children: /* @__PURE__ */
|
74
|
-
/* @__PURE__ */ e(
|
59
|
+
children: /* @__PURE__ */ c(w, { $flexGapX: 1.5, $alignItems: "center", $justifyContent: "center", children: [
|
60
|
+
/* @__PURE__ */ e(C, { $renderAs: "h6", children: "Oops! Something went wrong. Please try again later." }),
|
75
61
|
/* @__PURE__ */ e(
|
76
|
-
|
62
|
+
b,
|
77
63
|
{
|
78
64
|
widthX: 14,
|
79
65
|
size: "small",
|
80
66
|
shape: "square",
|
81
67
|
renderAs: "primary",
|
82
68
|
label: "Try again",
|
83
|
-
onClick:
|
69
|
+
onClick: a
|
84
70
|
}
|
85
71
|
)
|
86
72
|
] })
|
87
73
|
}
|
88
|
-
) :
|
74
|
+
) : s ? /* @__PURE__ */ e(d, { $justifyContent: "space-between", children: k ? /* @__PURE__ */ c(N, { children: [
|
89
75
|
/* @__PURE__ */ e(
|
90
|
-
|
76
|
+
O,
|
91
77
|
{
|
92
|
-
sheets:
|
93
|
-
userType:
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
onPreview: x,
|
102
|
-
onReview: j
|
78
|
+
sheets: i,
|
79
|
+
userType: u,
|
80
|
+
onNodeAttempt: T,
|
81
|
+
onNodeView: P,
|
82
|
+
onNodeReview: S,
|
83
|
+
onNodeReattempt: j,
|
84
|
+
onNodeReset: x,
|
85
|
+
onNodeUnassign: W,
|
86
|
+
userMilestoneId: r
|
103
87
|
}
|
104
88
|
),
|
105
|
-
|
106
|
-
|
89
|
+
f && h && /* @__PURE__ */ e(
|
90
|
+
L,
|
107
91
|
{
|
108
92
|
$flexDirection: "row",
|
109
93
|
$justifyContent: "flex-end",
|
110
94
|
$gapX: 1,
|
111
95
|
$gutterX: 1,
|
112
|
-
children: /* @__PURE__ */ e(
|
113
|
-
|
96
|
+
children: /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(
|
97
|
+
q,
|
114
98
|
{
|
115
|
-
Icon:
|
99
|
+
Icon: H,
|
116
100
|
renderAs: "secondary",
|
117
101
|
size: "small",
|
118
102
|
analyticsLabel: "Milestone Resource Search",
|
119
|
-
onClick:
|
120
|
-
disabled: !
|
103
|
+
onClick: R,
|
104
|
+
disabled: !t
|
121
105
|
}
|
122
106
|
) })
|
123
107
|
}
|
124
108
|
)
|
125
|
-
] }) : /* @__PURE__ */
|
126
|
-
|
109
|
+
] }) : /* @__PURE__ */ c(
|
110
|
+
w,
|
127
111
|
{
|
128
112
|
$width: "100%",
|
129
113
|
$height: "100%",
|
@@ -131,33 +115,33 @@ const ue = q((T) => {
|
|
131
115
|
$justifyContent: "flex-start",
|
132
116
|
$background: "WHITE",
|
133
117
|
children: [
|
134
|
-
/* @__PURE__ */ e(
|
135
|
-
/* @__PURE__ */ e(
|
136
|
-
|
118
|
+
/* @__PURE__ */ e(E, { $isImageWrapper: !0, children: /* @__PURE__ */ e("img", { src: v.BG_EMPTY_RESOURCES, alt: "Empty resources", width: 420, height: 420 }) }),
|
119
|
+
/* @__PURE__ */ e(E, { children: f ? /* @__PURE__ */ e(
|
120
|
+
X,
|
137
121
|
{
|
138
122
|
renderAs: "primary",
|
139
123
|
position: "bottom",
|
140
|
-
hidden: !
|
141
|
-
tooltipItem:
|
124
|
+
hidden: !g,
|
125
|
+
tooltipItem: m ? "Allowed after plan is published" : "Plan is completed",
|
142
126
|
children: /* @__PURE__ */ e(
|
143
|
-
|
127
|
+
b,
|
144
128
|
{
|
145
129
|
renderAs: "primary",
|
146
130
|
label: "Assign Resource",
|
147
|
-
Icon:
|
131
|
+
Icon: G,
|
148
132
|
shape: "square",
|
149
133
|
size: "small",
|
150
|
-
onClick:
|
151
|
-
disabled:
|
134
|
+
onClick: R,
|
135
|
+
disabled: g
|
152
136
|
}
|
153
137
|
)
|
154
138
|
}
|
155
|
-
) : /* @__PURE__ */ e(
|
139
|
+
) : /* @__PURE__ */ e(C, { $renderAs: "ab2-bold", children: "Wait for the teacher to assign a resource" }) })
|
156
140
|
]
|
157
141
|
}
|
158
|
-
) }) : /* @__PURE__ */ e(
|
142
|
+
) }) : /* @__PURE__ */ e(d, { $justifyContent: "center", $background: "WHITE", children: /* @__PURE__ */ e(z, { height: "100%" }) });
|
159
143
|
});
|
160
144
|
export {
|
161
|
-
|
145
|
+
ae as default
|
162
146
|
};
|
163
147
|
//# sourceMappingURL=resources-list.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"resources-list.js","sources":["../../../../../src/features/milestone/milestone-resources/resources-list/resources-list.tsx"],"sourcesContent":["import type { ISheetItemCallbackProps } from '../../../sheets/sheets-list/sheet-item/sheet-item-types';\nimport type { IMilestoneWidgetResourcesProps } from './resources-list-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useEffect } from 'react';\n\nimport { IMAGES } from '../../../../assets/images/images';\nimport PlusIcon from '../../../../assets/line-icons/icons/plus';\nimport SearchIcon from '../../../../assets/line-icons/icons/search';\nimport ResourcesList from '../../../sheets/resources-list/resources-list';\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 FlexView from '../../../ui/layout/flex-view';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport Text from '../../../ui/text/text';\nimport { useGetMilestoneResources } from '../../milestone-list-container/api/get-milestone-resources';\nimport * as Styled from './resources-list-styled';\n\nconst MilestoneWidgetResources: FC<IMilestoneWidgetResourcesProps> = memo(props => {\n const {\n isDraftMilestone,\n isMilestoneActive,\n userType,\n studentId,\n userMilestoneId,\n canUpdatePlan,\n onAssignResources,\n onStart,\n onUnAssignSheet,\n onReset,\n onPreview,\n onReview,\n onResume,\n onReattempt,\n } = props;\n\n const isTeacher = userType === 'TEACHER';\n const isEPSheetCreationDisabled =\n !canUpdatePlan || !isMilestoneActive || (isMilestoneActive && isDraftMilestone);\n\n const {\n get: getMilestoneResources,\n isProcessed,\n isProcessing,\n isProcessingFailed,\n isStale,\n data: sheets,\n } = useGetMilestoneResources();\n\n const fetchMilestoneResources = useCallback(() => {\n if (userMilestoneId) {\n getMilestoneResources(userMilestoneId, undefined, {\n studentId,\n });\n }\n }, [studentId, userMilestoneId, getMilestoneResources]);\n\n const handleOnTryAgain = useCallback(() => {\n fetchMilestoneResources();\n }, [fetchMilestoneResources]);\n\n useEffect(() => {\n if (!isProcessing && ((!isProcessed && !isProcessingFailed) || isStale)) {\n handleOnTryAgain();\n }\n }, [handleOnTryAgain, isProcessed, isProcessing, isProcessingFailed, isStale]);\n\n const handleOnAssignResources = useCallback(() => {\n if (typeof onAssignResources !== 'function')\n throw new Error('onAssignResources must be a function');\n\n if (!userMilestoneId) throw new Error('userMilestoneId is required');\n\n onAssignResources(userMilestoneId);\n }, [onAssignResources, userMilestoneId]);\n\n const handleOnUnAssignResources = useCallback<\n NonNullable<ISheetItemCallbackProps['onUnAssignSheet']>\n >(\n sheet => {\n if (typeof onUnAssignSheet !== 'function')\n throw new Error('onUnAssignSheet must be a function');\n\n if (!userMilestoneId) throw new Error('userMilestoneId is required');\n\n onUnAssignSheet(sheet, userMilestoneId);\n },\n [onUnAssignSheet, userMilestoneId],\n );\n\n const handleOnReset = useCallback<NonNullable<ISheetItemCallbackProps['onReset']>>(\n sheetData => {\n onReset?.(sheetData, userMilestoneId);\n },\n [onReset, userMilestoneId],\n );\n\n const sheetsDataPresent = sheets && sheets.length > 0;\n\n if (isProcessingFailed) {\n return (\n <Styled.MilestoneResourcesWrapper\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $background=\"WHITE\"\n >\n <FlexView $flexGapX={1.5} $alignItems=\"center\" $justifyContent=\"center\">\n <Text $renderAs=\"h6\">Oops! Something went wrong. Please try again later.</Text>\n <Button\n widthX={14}\n size=\"small\"\n shape=\"square\"\n renderAs=\"primary\"\n label=\"Try again\"\n onClick={handleOnTryAgain}\n />\n </FlexView>\n </Styled.MilestoneResourcesWrapper>\n );\n }\n\n if (isProcessed) {\n return (\n <Styled.MilestoneResourcesWrapper $justifyContent=\"space-between\">\n {sheetsDataPresent ? (\n <>\n <ResourcesList\n sheets={sheets}\n userType={userType}\n userMilestoneId={userMilestoneId}\n isMilestoneWidget\n onStart={onStart}\n onResume={onResume}\n onReattempt={onReattempt}\n onUnAssignSheet={handleOnUnAssignResources}\n onReset={handleOnReset}\n onPreview={onPreview}\n onReview={onReview}\n />\n\n {isTeacher && canUpdatePlan && (\n <Styled.SearchButtonWrapper\n $flexDirection=\"row\"\n $justifyContent=\"flex-end\"\n $gapX={1}\n $gutterX={1}\n >\n <Styled.SearchButtonCover>\n <IconButton\n Icon={SearchIcon}\n renderAs=\"secondary\"\n size=\"small\"\n analyticsLabel=\"Milestone Resource Search\"\n onClick={handleOnAssignResources}\n disabled={!isMilestoneActive}\n />\n </Styled.SearchButtonCover>\n </Styled.SearchButtonWrapper>\n )}\n </>\n ) : (\n <FlexView\n $width=\"100%\"\n $height=\"100%\"\n $alignItems=\"center\"\n $justifyContent=\"flex-start\"\n $background=\"WHITE\"\n >\n <Styled.DefaultWrapper $isImageWrapper>\n <img src={IMAGES.BG_EMPTY_RESOURCES} alt=\"Empty resources\" width={420} height={420} />\n </Styled.DefaultWrapper>\n\n <Styled.DefaultWrapper>\n {isTeacher ? (\n <ArrowTooltip\n renderAs=\"primary\"\n position=\"bottom\"\n hidden={!isEPSheetCreationDisabled}\n tooltipItem={\n isDraftMilestone ? 'Allowed after plan is published' : 'Plan is completed'\n }\n >\n <Button\n renderAs=\"primary\"\n label=\"Assign Resource\"\n Icon={PlusIcon}\n shape=\"square\"\n size=\"small\"\n onClick={handleOnAssignResources}\n disabled={isEPSheetCreationDisabled}\n />\n </ArrowTooltip>\n ) : (\n <Text $renderAs=\"ab2-bold\">Wait for the teacher to assign a resource</Text>\n )}\n </Styled.DefaultWrapper>\n </FlexView>\n )}\n </Styled.MilestoneResourcesWrapper>\n );\n }\n\n return (\n <Styled.MilestoneResourcesWrapper $justifyContent=\"center\" $background=\"WHITE\">\n <AppLoader height=\"100%\" />\n </Styled.MilestoneResourcesWrapper>\n );\n});\n\nexport default MilestoneWidgetResources;\n"],"names":["MilestoneWidgetResources","memo","props","isDraftMilestone","isMilestoneActive","userType","studentId","userMilestoneId","canUpdatePlan","onAssignResources","onStart","onUnAssignSheet","onReset","onPreview","onReview","onResume","onReattempt","isTeacher","isEPSheetCreationDisabled","getMilestoneResources","isProcessed","isProcessing","isProcessingFailed","isStale","sheets","useGetMilestoneResources","fetchMilestoneResources","useCallback","handleOnTryAgain","useEffect","handleOnAssignResources","handleOnUnAssignResources","sheet","handleOnReset","sheetData","sheetsDataPresent","jsx","Styled.MilestoneResourcesWrapper","FlexView","Text","Button","jsxs","Fragment","ResourcesList","Styled.SearchButtonWrapper","Styled.SearchButtonCover","IconButton","SearchIcon","Styled.DefaultWrapper","IMAGES","ArrowTooltip","PlusIcon","AppLoader"],"mappings":";;;;;;;;;;;;;;AAmBM,MAAAA,KAA+DC,EAAK,CAASC,MAAA;AAC3E,QAAA;AAAA,IACJ,kBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;AAAA,EACE,IAAAd,GAEEe,IAAYZ,MAAa,WACzBa,IACJ,CAACV,KAAiB,CAACJ,KAAsBA,KAAqBD,GAE1D;AAAA,IACJ,KAAKgB;AAAA,IACL,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,MAAMC;AAAA,MACJC,EAAyB,GAEvBC,IAA0BC,EAAY,MAAM;AAChD,IAAIpB,KACFY,EAAsBZ,GAAiB,QAAW;AAAA,MAChD,WAAAD;AAAA,IAAA,CACD;AAAA,EAEF,GAAA,CAACA,GAAWC,GAAiBY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AAAmB;AAAA,UAACc;AAAA,UAAA;AAAA,YACC,UAAS;AAAA,YACT,UAAS;AAAA,YACT,QAAQ,CAAChC;AAAA,YACT,aACEf,IAAmB,oCAAoC;AAAA,YAGzD,UAAA,gBAAAiC;AAAA,cAACI;AAAA,cAAA;AAAA,gBACC,UAAS;AAAA,gBACT,OAAM;AAAA,gBACN,MAAMW;AAAA,gBACN,OAAM;AAAA,gBACN,MAAK;AAAA,gBACL,SAASrB;AAAA,gBACT,UAAUZ;AAAA,cAAA;AAAA,YACZ;AAAA,UAAA;AAAA,QAAA,IAGD,gBAAAkB,EAAAG,GAAA,EAAK,WAAU,YAAW,sDAAyC,CAAA,GAExE;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN,EAAA,CAAA,IAKD,gBAAAH,EAAAC,GAAA,EAAiC,iBAAgB,UAAS,aAAY,SACrE,UAAC,gBAAAD,EAAAgB,GAAA,EAAU,QAAO,OAAO,CAAA,EAC3B,CAAA;AAEJ,CAAC;"}
|
1
|
+
{"version":3,"file":"resources-list.js","sources":["../../../../../src/features/milestone/milestone-resources/resources-list/resources-list.tsx"],"sourcesContent":["import type { IMilestoneWidgetResourcesProps } from './resources-list-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useEffect } from 'react';\n\nimport { IMAGES } from '../../../../assets/images/images';\nimport PlusIcon from '../../../../assets/line-icons/icons/plus';\nimport SearchIcon from '../../../../assets/line-icons/icons/search';\nimport ResourcesList from '../../../sheet-v2/resource-list/resource-list';\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 FlexView from '../../../ui/layout/flex-view';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport Text from '../../../ui/text/text';\nimport { useGetMilestoneResources } from '../../milestone-list-container/api/get-milestone-resources';\nimport * as Styled from './resources-list-styled';\n\nconst MilestoneWidgetResources: FC<IMilestoneWidgetResourcesProps> = memo(props => {\n const {\n isDraftMilestone,\n isMilestoneActive,\n userType,\n studentId,\n userMilestoneId,\n canUpdatePlan,\n onAssignResources,\n onNodeAttempt,\n onNodeView,\n onNodeReview,\n onNodeReset,\n onNodeUnassign,\n onNodeReattempt,\n } = props;\n\n const isTeacher = userType === 'TEACHER';\n const isEPSheetCreationDisabled =\n !canUpdatePlan || !isMilestoneActive || (isMilestoneActive && isDraftMilestone);\n\n const {\n get: getMilestoneResources,\n isProcessed,\n isProcessing,\n isProcessingFailed,\n isStale,\n data: sheets,\n } = useGetMilestoneResources();\n\n const fetchMilestoneResources = useCallback(() => {\n if (userMilestoneId) {\n getMilestoneResources(userMilestoneId, undefined, {\n studentId,\n });\n }\n }, [studentId, userMilestoneId, getMilestoneResources]);\n\n const handleOnTryAgain = useCallback(() => {\n fetchMilestoneResources();\n }, [fetchMilestoneResources]);\n\n useEffect(() => {\n if (!isProcessing && ((!isProcessed && !isProcessingFailed) || isStale)) {\n handleOnTryAgain();\n }\n }, [handleOnTryAgain, isProcessed, isProcessing, isProcessingFailed, isStale]);\n\n const handleOnAssignResources = useCallback(() => {\n if (typeof onAssignResources !== 'function')\n throw new Error('onAssignResources must be a function');\n\n if (!userMilestoneId) throw new Error('userMilestoneId is required');\n\n onAssignResources(userMilestoneId);\n }, [onAssignResources, userMilestoneId]);\n\n const sheetsDataPresent = sheets && sheets.length > 0;\n\n if (isProcessingFailed) {\n return (\n <Styled.MilestoneResourcesWrapper\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $background=\"WHITE\"\n >\n <FlexView $flexGapX={1.5} $alignItems=\"center\" $justifyContent=\"center\">\n <Text $renderAs=\"h6\">Oops! Something went wrong. Please try again later.</Text>\n <Button\n widthX={14}\n size=\"small\"\n shape=\"square\"\n renderAs=\"primary\"\n label=\"Try again\"\n onClick={handleOnTryAgain}\n />\n </FlexView>\n </Styled.MilestoneResourcesWrapper>\n );\n }\n\n if (isProcessed) {\n return (\n <Styled.MilestoneResourcesWrapper $justifyContent=\"space-between\">\n {sheetsDataPresent ? (\n <>\n <ResourcesList\n sheets={sheets}\n userType={userType}\n onNodeAttempt={onNodeAttempt}\n onNodeView={onNodeView}\n onNodeReview={onNodeReview}\n onNodeReattempt={onNodeReattempt}\n onNodeReset={onNodeReset}\n onNodeUnassign={onNodeUnassign}\n userMilestoneId={userMilestoneId}\n />\n\n {isTeacher && canUpdatePlan && (\n <Styled.SearchButtonWrapper\n $flexDirection=\"row\"\n $justifyContent=\"flex-end\"\n $gapX={1}\n $gutterX={1}\n >\n <Styled.SearchButtonCover>\n <IconButton\n Icon={SearchIcon}\n renderAs=\"secondary\"\n size=\"small\"\n analyticsLabel=\"Milestone Resource Search\"\n onClick={handleOnAssignResources}\n disabled={!isMilestoneActive}\n />\n </Styled.SearchButtonCover>\n </Styled.SearchButtonWrapper>\n )}\n </>\n ) : (\n <FlexView\n $width=\"100%\"\n $height=\"100%\"\n $alignItems=\"center\"\n $justifyContent=\"flex-start\"\n $background=\"WHITE\"\n >\n <Styled.DefaultWrapper $isImageWrapper>\n <img src={IMAGES.BG_EMPTY_RESOURCES} alt=\"Empty resources\" width={420} height={420} />\n </Styled.DefaultWrapper>\n\n <Styled.DefaultWrapper>\n {isTeacher ? (\n <ArrowTooltip\n renderAs=\"primary\"\n position=\"bottom\"\n hidden={!isEPSheetCreationDisabled}\n tooltipItem={\n isDraftMilestone ? 'Allowed after plan is published' : 'Plan is completed'\n }\n >\n <Button\n renderAs=\"primary\"\n label=\"Assign Resource\"\n Icon={PlusIcon}\n shape=\"square\"\n size=\"small\"\n onClick={handleOnAssignResources}\n disabled={isEPSheetCreationDisabled}\n />\n </ArrowTooltip>\n ) : (\n <Text $renderAs=\"ab2-bold\">Wait for the teacher to assign a resource</Text>\n )}\n </Styled.DefaultWrapper>\n </FlexView>\n )}\n </Styled.MilestoneResourcesWrapper>\n );\n }\n\n return (\n <Styled.MilestoneResourcesWrapper $justifyContent=\"center\" $background=\"WHITE\">\n <AppLoader height=\"100%\" />\n </Styled.MilestoneResourcesWrapper>\n );\n});\n\nexport default MilestoneWidgetResources;\n"],"names":["MilestoneWidgetResources","memo","props","isDraftMilestone","isMilestoneActive","userType","studentId","userMilestoneId","canUpdatePlan","onAssignResources","onNodeAttempt","onNodeView","onNodeReview","onNodeReset","onNodeUnassign","onNodeReattempt","isTeacher","isEPSheetCreationDisabled","getMilestoneResources","isProcessed","isProcessing","isProcessingFailed","isStale","sheets","useGetMilestoneResources","fetchMilestoneResources","useCallback","handleOnTryAgain","useEffect","handleOnAssignResources","sheetsDataPresent","jsx","Styled.MilestoneResourcesWrapper","FlexView","Text","Button","jsxs","Fragment","ResourcesList","Styled.SearchButtonWrapper","Styled.SearchButtonCover","IconButton","SearchIcon","Styled.DefaultWrapper","IMAGES","ArrowTooltip","PlusIcon","AppLoader"],"mappings":";;;;;;;;;;;;;;AAkBM,MAAAA,KAA+DC,EAAK,CAASC,MAAA;AAC3E,QAAA;AAAA,IACJ,kBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,iBAAAC;AAAA,EACE,IAAAb,GAEEc,IAAYX,MAAa,WACzBY,IACJ,CAACT,KAAiB,CAACJ,KAAsBA,KAAqBD,GAE1D;AAAA,IACJ,KAAKe;AAAA,IACL,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,MAAMC;AAAA,MACJC,EAAyB,GAEvBC,IAA0BC,EAAY,MAAM;AAChD,IAAInB,KACFW,EAAsBX,GAAiB,QAAW;AAAA,MAChD,WAAAD;AAAA,IAAA,CACD;AAAA,EAEF,GAAA,CAACA,GAAWC,GAAiBW,CAAqB,CAAC,GAEhDS,IAAmBD,EAA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KD,gBAAAH,EAAAC,GAAA,EAAiC,iBAAgB,UAAS,aAAY,SACrE,UAAC,gBAAAD,EAAAgB,GAAA,EAAU,QAAO,OAAO,CAAA,EAC3B,CAAA;AAEJ,CAAC;"}
|
@@ -0,0 +1,165 @@
|
|
1
|
+
import { jsxs as u, jsx as e, Fragment as x } from "react/jsx-runtime";
|
2
|
+
import { memo as H, useCallback as l, useEffect as L } from "react";
|
3
|
+
import { IMAGES as X } from "../../../../assets/images/images.js";
|
4
|
+
import D from "../../../ui/arrow-tooltip/arrow-tooltip.js";
|
5
|
+
import S from "../../../ui/buttons/button/button.js";
|
6
|
+
import T from "../../../ui/layout/flex-view.js";
|
7
|
+
import j from "../../../ui/loader/app-loader/app-loader.js";
|
8
|
+
import _ from "../../../ui/separator/separator.js";
|
9
|
+
import N from "../../../ui/text/text.js";
|
10
|
+
import { MILESTONE_WIDGET_MIN_HEIGHT as v } from "../../constants.js";
|
11
|
+
import { useGetTestHelpData as G } from "../../milestone-list-container/api/get-tests-list.js";
|
12
|
+
import { TESTS_CREATION_ANALYTICS_EVENTS as R } from "../tests-creation/tests-creation-analytics-events.js";
|
13
|
+
import W from "./test-list-view.js";
|
14
|
+
const re = H((c) => {
|
15
|
+
const {
|
16
|
+
isChaptersAvailable: g,
|
17
|
+
isDraftMilestone: E,
|
18
|
+
isMilestoneActive: d,
|
19
|
+
userType: b,
|
20
|
+
studentId: m,
|
21
|
+
userMilestoneId: t,
|
22
|
+
canUpdatePlan: I
|
23
|
+
} = c, { onCreateMilestoneTest: i, onTestPreview: o, onTestStart: n, onTestReview: s } = c, {
|
24
|
+
get: A,
|
25
|
+
data: r,
|
26
|
+
isProcessingFailed: p,
|
27
|
+
isProcessed: f,
|
28
|
+
isStale: C,
|
29
|
+
isProcessing: w
|
30
|
+
} = G(), y = !I || !g || !d || d && E, k = d && !g ? "Chapters need to be assigned" : E ? "Allowed after plan is published" : "Plan is completed", h = l(() => {
|
31
|
+
A(t, void 0, {
|
32
|
+
studentId: m
|
33
|
+
});
|
34
|
+
}, [A, m, t]);
|
35
|
+
L(() => {
|
36
|
+
!w && (!f && !p || C) && h();
|
37
|
+
}, [h, f, w, p, C]);
|
38
|
+
const $ = l(() => {
|
39
|
+
if (typeof i == "function") {
|
40
|
+
i == null || i(t, ((r == null ? void 0 : r.length) || 0) + 1);
|
41
|
+
return;
|
42
|
+
}
|
43
|
+
throw new Error("No callback provided. If provided it must be a function");
|
44
|
+
}, [i, t, r]), M = l(
|
45
|
+
(a) => {
|
46
|
+
if (typeof o == "function") {
|
47
|
+
o == null || o(a, t);
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
throw new Error("No callback provided. If provided it must be a function");
|
51
|
+
},
|
52
|
+
[o, t]
|
53
|
+
), O = l(
|
54
|
+
(a) => {
|
55
|
+
if (typeof n == "function") {
|
56
|
+
n == null || n(a);
|
57
|
+
return;
|
58
|
+
}
|
59
|
+
throw new Error("No callback provided. If provided it must be a function");
|
60
|
+
},
|
61
|
+
[n]
|
62
|
+
), P = l(
|
63
|
+
(a) => {
|
64
|
+
if (typeof s == "function") {
|
65
|
+
s == null || s(a, t);
|
66
|
+
return;
|
67
|
+
}
|
68
|
+
throw new Error("No callback provided. If provided it must be a function");
|
69
|
+
},
|
70
|
+
[s, t]
|
71
|
+
);
|
72
|
+
return p ? /* @__PURE__ */ u(
|
73
|
+
T,
|
74
|
+
{
|
75
|
+
$flexGapX: 1.5,
|
76
|
+
$alignItems: "center",
|
77
|
+
$justifyContent: "center",
|
78
|
+
$height: "100%",
|
79
|
+
$background: "WHITE",
|
80
|
+
children: [
|
81
|
+
/* @__PURE__ */ e(N, { $renderAs: "h6", children: "Oops! Something went wrong. Please try again later." }),
|
82
|
+
/* @__PURE__ */ e(
|
83
|
+
S,
|
84
|
+
{
|
85
|
+
widthX: 14,
|
86
|
+
size: "small",
|
87
|
+
shape: "square",
|
88
|
+
renderAs: "primary",
|
89
|
+
label: "Try again",
|
90
|
+
onClick: h
|
91
|
+
}
|
92
|
+
)
|
93
|
+
]
|
94
|
+
}
|
95
|
+
) : f ? r != null && r.length ? /* @__PURE__ */ e(
|
96
|
+
W,
|
97
|
+
{
|
98
|
+
...c,
|
99
|
+
onNodeAttempt: O,
|
100
|
+
onNodeView: M,
|
101
|
+
onNodeReview: P,
|
102
|
+
milestoneId: t,
|
103
|
+
sheets: r,
|
104
|
+
userType: b,
|
105
|
+
studentId: m,
|
106
|
+
onCreateNewTest: $,
|
107
|
+
canUpdatedPlan: I,
|
108
|
+
isMilestoneActive: d
|
109
|
+
}
|
110
|
+
) : /* @__PURE__ */ u(
|
111
|
+
T,
|
112
|
+
{
|
113
|
+
$gapX: 6.75,
|
114
|
+
$alignItems: "center",
|
115
|
+
$justifyContent: "center",
|
116
|
+
$background: "WHITE",
|
117
|
+
$height: v,
|
118
|
+
children: [
|
119
|
+
/* @__PURE__ */ e("img", { src: X.EMPTY_MIX_TESTS, alt: "empty_mix_tests" }),
|
120
|
+
/* @__PURE__ */ e(_, { heightX: 2 }),
|
121
|
+
b === "TEACHER" ? /* @__PURE__ */ u(x, { children: [
|
122
|
+
/* @__PURE__ */ e(
|
123
|
+
D,
|
124
|
+
{
|
125
|
+
renderAs: "primary",
|
126
|
+
position: "bottom",
|
127
|
+
hidden: !y,
|
128
|
+
tooltipItem: k,
|
129
|
+
children: /* @__PURE__ */ e(
|
130
|
+
S,
|
131
|
+
{
|
132
|
+
widthX: 10,
|
133
|
+
renderAs: "primary",
|
134
|
+
shape: "square",
|
135
|
+
size: "small",
|
136
|
+
label: "Create a Test",
|
137
|
+
onClick: $,
|
138
|
+
disabled: y,
|
139
|
+
analyticsLabel: R.CUSTOM_TEST_CREATION_STARTED,
|
140
|
+
analyticsProps: {
|
141
|
+
milestone_id: t
|
142
|
+
}
|
143
|
+
}
|
144
|
+
)
|
145
|
+
}
|
146
|
+
),
|
147
|
+
/* @__PURE__ */ e(_, { heightX: 2 })
|
148
|
+
] }) : /* @__PURE__ */ e(N, { $renderAs: "ab2-bold", $color: "BLACK_T_87", children: "Wait for the teacher to create a test" })
|
149
|
+
]
|
150
|
+
}
|
151
|
+
) : /* @__PURE__ */ e(
|
152
|
+
T,
|
153
|
+
{
|
154
|
+
$height: v,
|
155
|
+
$alignItems: "center",
|
156
|
+
$justifyContent: "center",
|
157
|
+
$background: "WHITE",
|
158
|
+
children: /* @__PURE__ */ e(j, { height: "100%" })
|
159
|
+
}
|
160
|
+
);
|
161
|
+
});
|
162
|
+
export {
|
163
|
+
re as default
|
164
|
+
};
|
165
|
+
//# sourceMappingURL=test-list-container.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"test-list-container.js","sources":["../../../../../src/features/milestone/milestone-tests/test-list-v2/test-list-container.tsx"],"sourcesContent":["import type { INodeDataProps } from '../../../chapters-v2/comps/node-card/node-card-types';\nimport type { ITestsListProps } from './types';\n\nimport { memo, useCallback, useEffect, type FC } from 'react';\n\nimport { IMAGES } from '../../../../assets/images/images';\nimport ArrowTooltip from '../../../ui/arrow-tooltip/arrow-tooltip';\nimport Button from '../../../ui/buttons/button/button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport { MILESTONE_WIDGET_MIN_HEIGHT } from '../../constants';\nimport { useGetTestHelpData } from '../../milestone-list-container/api/get-tests-list';\nimport { TESTS_CREATION_ANALYTICS_EVENTS } from '../tests-creation/tests-creation-analytics-events';\nimport TestSheetsList from './test-list-view';\n\nconst MilestoneTestsList: FC<ITestsListProps> = memo(props => {\n const {\n isChaptersAvailable,\n isDraftMilestone,\n isMilestoneActive,\n userType,\n studentId,\n userMilestoneId,\n canUpdatePlan,\n } = props;\n const { onCreateMilestoneTest, onTestPreview, onTestStart, onTestReview } = props;\n\n const {\n get: getTestHelpData,\n data,\n isProcessingFailed,\n isProcessed,\n isStale,\n isProcessing,\n } = useGetTestHelpData();\n\n const isTestSheetCreationDisabled =\n !canUpdatePlan ||\n !isChaptersAvailable ||\n !isMilestoneActive ||\n (isMilestoneActive && isDraftMilestone);\n const testCreationCtaTooltipText =\n isMilestoneActive && !isChaptersAvailable\n ? 'Chapters need to be assigned'\n : isDraftMilestone\n ? 'Allowed after plan is published'\n : 'Plan is completed';\n\n const handleOnTryAgain = useCallback(() => {\n getTestHelpData(userMilestoneId, undefined, {\n studentId,\n });\n }, [getTestHelpData, studentId, userMilestoneId]);\n\n useEffect(() => {\n if (!isProcessing && ((!isProcessed && !isProcessingFailed) || isStale)) {\n handleOnTryAgain();\n }\n }, [handleOnTryAgain, isProcessed, isProcessing, isProcessingFailed, isStale]);\n\n const handleOnCreateMilestoneTest = useCallback(() => {\n if (typeof onCreateMilestoneTest === 'function') {\n onCreateMilestoneTest?.(userMilestoneId, (data?.length || 0) + 1);\n\n return;\n }\n\n throw new Error('No callback provided. If provided it must be a function');\n }, [onCreateMilestoneTest, userMilestoneId, data]);\n\n const handleOnTestPreview = useCallback(\n (sheetData: INodeDataProps) => {\n if (typeof onTestPreview === 'function') {\n onTestPreview?.(sheetData, userMilestoneId);\n\n return;\n }\n\n throw new Error('No callback provided. If provided it must be a function');\n },\n [onTestPreview, userMilestoneId],\n );\n\n const handleOnTestStart = useCallback(\n (sheetData: INodeDataProps) => {\n if (typeof onTestStart === 'function') {\n onTestStart?.(sheetData);\n\n return;\n }\n\n throw new Error('No callback provided. If provided it must be a function');\n },\n [onTestStart],\n );\n\n const handleOnTestReview = useCallback(\n (sheetData: INodeDataProps) => {\n if (typeof onTestReview === 'function') {\n onTestReview?.(sheetData, userMilestoneId);\n\n return;\n }\n\n throw new Error('No callback provided. If provided it must be a function');\n },\n [onTestReview, userMilestoneId],\n );\n\n if (isProcessingFailed) {\n return (\n <FlexView\n $flexGapX={1.5}\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $height=\"100%\"\n $background=\"WHITE\"\n >\n <Text $renderAs=\"h6\">Oops! Something went wrong. Please try again later.</Text>\n <Button\n widthX={14}\n size=\"small\"\n shape=\"square\"\n renderAs=\"primary\"\n label=\"Try again\"\n onClick={handleOnTryAgain}\n />\n </FlexView>\n );\n }\n\n if (isProcessed) {\n if (data?.length) {\n return (\n <TestSheetsList\n {...props}\n onNodeAttempt={handleOnTestStart}\n onNodeView={handleOnTestPreview}\n onNodeReview={handleOnTestReview}\n milestoneId={userMilestoneId}\n sheets={data}\n userType={userType}\n studentId={studentId}\n onCreateNewTest={handleOnCreateMilestoneTest}\n canUpdatedPlan={canUpdatePlan}\n isMilestoneActive={isMilestoneActive}\n />\n );\n }\n\n return (\n <FlexView\n $gapX={6.75}\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $background=\"WHITE\"\n $height={MILESTONE_WIDGET_MIN_HEIGHT}\n >\n <img src={IMAGES.EMPTY_MIX_TESTS} alt=\"empty_mix_tests\" />\n <Separator heightX={2} />\n {userType === 'TEACHER' ? (\n <>\n <ArrowTooltip\n renderAs=\"primary\"\n position=\"bottom\"\n hidden={!isTestSheetCreationDisabled}\n tooltipItem={testCreationCtaTooltipText}\n >\n <Button\n widthX={10}\n renderAs=\"primary\"\n shape=\"square\"\n size=\"small\"\n label=\"Create a Test\"\n onClick={handleOnCreateMilestoneTest}\n disabled={isTestSheetCreationDisabled}\n analyticsLabel={TESTS_CREATION_ANALYTICS_EVENTS.CUSTOM_TEST_CREATION_STARTED}\n analyticsProps={{\n milestone_id: userMilestoneId,\n }}\n />\n </ArrowTooltip>\n <Separator heightX={2} />\n </>\n ) : (\n <Text $renderAs=\"ab2-bold\" $color=\"BLACK_T_87\">\n Wait for the teacher to create a test\n </Text>\n )}\n </FlexView>\n );\n }\n\n return (\n <FlexView\n $height={MILESTONE_WIDGET_MIN_HEIGHT}\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $background=\"WHITE\"\n >\n <AppLoader height=\"100%\" />\n </FlexView>\n );\n});\n\nexport default MilestoneTestsList;\n"],"names":["MilestoneTestsList","memo","props","isChaptersAvailable","isDraftMilestone","isMilestoneActive","userType","studentId","userMilestoneId","canUpdatePlan","onCreateMilestoneTest","onTestPreview","onTestStart","onTestReview","getTestHelpData","data","isProcessingFailed","isProcessed","isStale","isProcessing","useGetTestHelpData","isTestSheetCreationDisabled","testCreationCtaTooltipText","handleOnTryAgain","useCallback","useEffect","handleOnCreateMilestoneTest","handleOnTestPreview","sheetData","handleOnTestStart","handleOnTestReview","jsxs","FlexView","jsx","Text","Button","TestSheetsList","MILESTONE_WIDGET_MIN_HEIGHT","IMAGES","Separator","Fragment","ArrowTooltip","TESTS_CREATION_ANALYTICS_EVENTS","AppLoader"],"mappings":";;;;;;;;;;;;;AAiBM,MAAAA,KAA0CC,EAAK,CAASC,MAAA;AACtD,QAAA;AAAA,IACJ,qBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,eAAAC;AAAA,EACE,IAAAP,GACE,EAAE,uBAAAQ,GAAuB,eAAAC,GAAe,aAAAC,GAAa,cAAAC,MAAiBX,GAEtE;AAAA,IACJ,KAAKY;AAAA,IACL,MAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,SAAAC;AAAA,IACA,cAAAC;AAAA,MACEC,EAAmB,GAEjBC,IACJ,CAACZ,KACD,CAACN,KACD,CAACE,KACAA,KAAqBD,GAClBkB,IACJjB,KAAqB,CAACF,IAClB,iCACAC,IACE,oCACA,qBAEFmB,IAAmBC,EAAY,MAAM;AACzC,IAAAV,EAAgBN,GAAiB,QAAW;AAAA,MAC1C,WAAAD;AAAA,IAAA,CACD;AAAA,EACA,GAAA,CAACO,GAAiBP,GAAWC,CAAe,CAAC;AAEhD,EAAAiB,EAAU,MAAM;AACd,IAAI,CAACN,MAAkB,CAACF,KAAe,CAACD,KAAuBE,MAC5CK;EACnB,GACC,CAACA,GAAkBN,GAAaE,GAAcH,GAAoBE,CAAO,CAAC;AAEvE,QAAAQ,IAA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,CAAA;AAAA,QAAA,EAAA,CACzB,IAEC,gBAAAN,EAAAC,GAAA,EAAK,WAAU,YAAW,QAAO,cAAa,UAE/C,yCAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAON,gBAAAD;AAAA,IAACD;AAAA,IAAA;AAAA,MACC,SAASK;AAAA,MACT,aAAY;AAAA,MACZ,iBAAgB;AAAA,MAChB,aAAY;AAAA,MAEZ,UAAA,gBAAAJ,EAACU,GAAU,EAAA,QAAO,OAAO,CAAA;AAAA,IAAA;AAAA,EAAA;AAG/B,CAAC;"}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { styled as t } from "styled-components";
|
2
|
+
import o from "../../../ui/layout/flex-view.js";
|
3
|
+
const i = t(o)`
|
4
|
+
position: sticky;
|
5
|
+
bottom: 0;
|
6
|
+
margin-left: auto;
|
7
|
+
`, s = t(o)(({ theme: e }) => {
|
8
|
+
const { colors: r } = e;
|
9
|
+
return `
|
10
|
+
border-radius: 50%;
|
11
|
+
box-shadow: 0px 10px 20px 0px ${r.BLACK_T_15};
|
12
|
+
`;
|
13
|
+
}), a = t.div`
|
14
|
+
display: grid;
|
15
|
+
grid-template-columns: repeat(3, 200px);
|
16
|
+
grid-gap: 32px;
|
17
|
+
justify-content: center;
|
18
|
+
padding: 32px 0;
|
19
|
+
`;
|
20
|
+
export {
|
21
|
+
s as IconButtonCover,
|
22
|
+
i as IconContainer,
|
23
|
+
a as TestSheetItemWrapper
|
24
|
+
};
|
25
|
+
//# sourceMappingURL=test-list-view-styled.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"test-list-view-styled.js","sources":["../../../../../src/features/milestone/milestone-tests/test-list-v2/test-list-view-styled.ts"],"sourcesContent":["import { styled } from 'styled-components';\n\nimport FlexView from '../../../ui/layout/flex-view';\n\nconst IconContainer = styled(FlexView)`\n position: sticky;\n bottom: 0;\n margin-left: auto;\n`;\n\nconst IconButtonCover = styled(FlexView)(({ theme }) => {\n const { colors } = theme;\n\n return `\n border-radius: 50%;\n box-shadow: 0px 10px 20px 0px ${colors.BLACK_T_15};\n `;\n});\n\nconst TestSheetItemWrapper = styled.div`\n display: grid;\n grid-template-columns: repeat(3, 200px);\n grid-gap: 32px;\n justify-content: center;\n padding: 32px 0;\n`;\n\nexport { IconContainer, IconButtonCover, TestSheetItemWrapper };\n"],"names":["IconContainer","styled","FlexView","IconButtonCover","theme","colors","TestSheetItemWrapper"],"mappings":";;AAIM,MAAAA,IAAgBC,EAAOC,CAAQ;AAAA;AAAA;AAAA;AAAA,GAM/BC,IAAkBF,EAAOC,CAAQ,EAAE,CAAC,EAAE,OAAAE,QAAY;AAChD,QAAA,EAAE,QAAAC,EAAW,IAAAD;AAEZ,SAAA;AAAA;AAAA,sCAE6BC,EAAO,UAAU;AAAA;AAEvD,CAAC,GAEKC,IAAuBL,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
import { jsxs as E, jsx as t } from "react/jsx-runtime";
|
2
|
+
import { h as $ } from "../../../../node_modules/humanize-plus/dist/humanize.js";
|
3
|
+
import { memo as C } from "react";
|
4
|
+
import S from "../../../../assets/line-icons/icons/plus2.js";
|
5
|
+
import A from "../../../homework/homework-card.js";
|
6
|
+
import N from "../../../ui/buttons/icon-button/icon-button.js";
|
7
|
+
import w from "../../../ui/layout/flex-view.js";
|
8
|
+
import { MILESTONE_WIDGET_MIN_HEIGHT as x } from "../../constants.js";
|
9
|
+
import { TESTS_CREATION_ANALYTICS_EVENTS as y } from "../tests-creation/tests-creation-analytics-events.js";
|
10
|
+
import { TestSheetItemWrapper as b, IconContainer as j, IconButtonCover as H } from "./test-list-view-styled.js";
|
11
|
+
const M = (e) => {
|
12
|
+
const o = /* @__PURE__ */ new Set();
|
13
|
+
return e == null || e.forEach((r) => {
|
14
|
+
o.add(r.chapter_name);
|
15
|
+
}), Array.from(o).join(", ");
|
16
|
+
}, G = C(
|
17
|
+
({
|
18
|
+
milestoneId: e,
|
19
|
+
studentId: o,
|
20
|
+
sheets: r,
|
21
|
+
userType: i,
|
22
|
+
onCreateNewTest: a,
|
23
|
+
isMilestoneActive: m,
|
24
|
+
canUpdatedPlan: c,
|
25
|
+
...d
|
26
|
+
}) => /* @__PURE__ */ E(
|
27
|
+
w,
|
28
|
+
{
|
29
|
+
$height: x,
|
30
|
+
$position: "relative",
|
31
|
+
$justifyContent: "space-between",
|
32
|
+
children: [
|
33
|
+
/* @__PURE__ */ t(b, { children: r.map((s, p) => {
|
34
|
+
const {
|
35
|
+
items: l,
|
36
|
+
node_id: h,
|
37
|
+
sheet_time: T,
|
38
|
+
total_questions: n,
|
39
|
+
worksheet_id: f
|
40
|
+
} = s, u = Math.ceil((T || 0) / 60), I = M(l), _ = `${typeof n == "number" ? `${n} ${$.pluralize(n, "Question")}, ` : ""}${u} Mins`;
|
41
|
+
return /* @__PURE__ */ t(
|
42
|
+
A,
|
43
|
+
{
|
44
|
+
userType: i,
|
45
|
+
header: I,
|
46
|
+
subHeader: _,
|
47
|
+
nodeData: s,
|
48
|
+
...d
|
49
|
+
},
|
50
|
+
`${f}_${h}_${p}`
|
51
|
+
);
|
52
|
+
}) }),
|
53
|
+
i === "TEACHER" && c && /* @__PURE__ */ t(
|
54
|
+
j,
|
55
|
+
{
|
56
|
+
$flexDirection: "row",
|
57
|
+
$justifyContent: "flex-end",
|
58
|
+
$gapX: 1,
|
59
|
+
$gutterX: 1,
|
60
|
+
children: /* @__PURE__ */ t(H, { children: /* @__PURE__ */ t(
|
61
|
+
N,
|
62
|
+
{
|
63
|
+
Icon: S,
|
64
|
+
renderAs: "secondary",
|
65
|
+
analyticsLabel: y.CUSTOM_TEST_CREATION_STARTED,
|
66
|
+
onClick: a,
|
67
|
+
disabled: !m,
|
68
|
+
analyticsProps: {
|
69
|
+
milestone_id: e
|
70
|
+
}
|
71
|
+
}
|
72
|
+
) })
|
73
|
+
}
|
74
|
+
)
|
75
|
+
]
|
76
|
+
}
|
77
|
+
)
|
78
|
+
);
|
79
|
+
export {
|
80
|
+
G as default
|
81
|
+
};
|
82
|
+
//# sourceMappingURL=test-list-view.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"test-list-view.js","sources":["../../../../../src/features/milestone/milestone-tests/test-list-v2/test-list-view.tsx"],"sourcesContent":["import type { TNodeDataTestItemsDataProps } from '../../../chapters-v2/comps/node-card/node-card-types';\nimport type { ITestSheetsList } from './types';\nimport type { FC } from 'react';\n\nimport { pluralize } from 'humanize-plus';\nimport { memo } from 'react';\n\nimport Plus2Icon from '../../../../assets/line-icons/icons/plus2';\nimport HomeworkCard from '../../../homework/homework-card';\nimport IconButton from '../../../ui/buttons/icon-button/icon-button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport { MILESTONE_WIDGET_MIN_HEIGHT } from '../../constants';\nimport { TESTS_CREATION_ANALYTICS_EVENTS } from '../tests-creation/tests-creation-analytics-events';\nimport * as Styled from './test-list-view-styled';\n\nconst getTopicNameFromItems = (items?: TNodeDataTestItemsDataProps[]) => {\n const topics = new Set<string>();\n\n items?.forEach(item => {\n topics.add(item.chapter_name);\n });\n\n return Array.from(topics).join(', ');\n};\n\nconst TestSheetsList: FC<ITestSheetsList> = memo(\n ({\n milestoneId,\n studentId,\n sheets,\n userType,\n onCreateNewTest,\n isMilestoneActive,\n canUpdatedPlan,\n ...sheetCallbacks\n }) => {\n return (\n <FlexView\n $height={MILESTONE_WIDGET_MIN_HEIGHT}\n $position=\"relative\"\n $justifyContent=\"space-between\"\n >\n <Styled.TestSheetItemWrapper>\n {sheets.map((sheet, idx) => {\n const {\n items,\n node_id: nodeId,\n sheet_time: sheetTime,\n total_questions: totalQuestions,\n worksheet_id: worksheetId,\n } = sheet;\n const totalSheetTime = Math.ceil((sheetTime || 0) / 60);\n const testChapterName = getTopicNameFromItems(items);\n const subHeader = `${\n typeof totalQuestions === 'number'\n ? `${totalQuestions} ${pluralize(totalQuestions, 'Question')}, `\n : ''\n }${totalSheetTime} Mins`;\n\n return (\n <HomeworkCard\n key={`${worksheetId}_${nodeId}_${idx}`}\n userType={userType}\n header={testChapterName}\n subHeader={subHeader}\n nodeData={sheet}\n {...sheetCallbacks}\n />\n );\n })}\n </Styled.TestSheetItemWrapper>\n\n {userType === 'TEACHER' && canUpdatedPlan && (\n <Styled.IconContainer\n $flexDirection=\"row\"\n $justifyContent=\"flex-end\"\n $gapX={1}\n $gutterX={1}\n >\n <Styled.IconButtonCover>\n <IconButton\n Icon={Plus2Icon}\n renderAs=\"secondary\"\n analyticsLabel={TESTS_CREATION_ANALYTICS_EVENTS.CUSTOM_TEST_CREATION_STARTED}\n onClick={onCreateNewTest}\n disabled={!isMilestoneActive}\n analyticsProps={{\n milestone_id: milestoneId,\n }}\n />\n </Styled.IconButtonCover>\n </Styled.IconContainer>\n )}\n </FlexView>\n );\n },\n);\n\nexport default TestSheetsList;\n"],"names":["getTopicNameFromItems","items","topics","item","TestSheetsList","memo","milestoneId","studentId","sheets","userType","onCreateNewTest","isMilestoneActive","canUpdatedPlan","sheetCallbacks","jsxs","FlexView","MILESTONE_WIDGET_MIN_HEIGHT","jsx","Styled.TestSheetItemWrapper","sheet","idx","nodeId","sheetTime","totalQuestions","worksheetId","totalSheetTime","testChapterName","subHeader","pluralize","HomeworkCard","Styled.IconContainer","Styled.IconButtonCover","IconButton","Plus2Icon","TESTS_CREATION_ANALYTICS_EVENTS"],"mappings":";;;;;;;;;;AAeA,MAAMA,IAAwB,CAACC,MAA0C;AACjE,QAAAC,wBAAa;AAEnB,SAAAD,KAAA,QAAAA,EAAO,QAAQ,CAAQE,MAAA;AACd,IAAAD,EAAA,IAAIC,EAAK,YAAY;AAAA,EAAA,IAGvB,MAAM,KAAKD,CAAM,EAAE,KAAK,IAAI;AACrC,GAEME,IAAsCC;AAAA,EAC1C,CAAC;AAAA,IACC,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,iBAAAC;AAAA,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AAAA,QACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAKV;"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { createGetAPI as r } from "@cuemath/rest-api";
|
2
|
+
import { BASE_URL_V3 as s } from "../../../constants/api.js";
|
3
|
+
const { useGet: p } = r({
|
4
|
+
getURL: (e, o, { courseStream: t }) => `${s}/users/${e}/course-streams/${t}/recent-chapters`
|
5
|
+
});
|
6
|
+
export {
|
7
|
+
p as useGetRecentChapters
|
8
|
+
};
|
9
|
+
//# sourceMappingURL=get-recent-chapters.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"get-recent-chapters.js","sources":["../../../../src/features/recent-chapters/api/get-recent-chapters.ts"],"sourcesContent":["import type { IChapterDataProps } from '../../chapters/chapter/chapter-types';\nimport type { TCourseStream } from '../../milestone/create/milestone-create-types';\n\nimport { createGetAPI } from '@cuemath/rest-api';\n\nimport { BASE_URL_V3 } from '../../../constants/api';\n\nconst { useGet: useGetRecentChapters } = createGetAPI<\n IChapterDataProps[],\n void,\n { courseStream: TCourseStream }\n>({\n getURL: (studentId: string, _, { courseStream }) =>\n `${BASE_URL_V3}/users/${studentId}/course-streams/${courseStream}/recent-chapters`,\n});\n\nexport { useGetRecentChapters };\n"],"names":["useGetRecentChapters","createGetAPI","studentId","_","courseStream","BASE_URL_V3"],"mappings":";;AAOA,MAAM,EAAE,QAAQA,EAAqB,IAAIC,EAIvC;AAAA,EACA,QAAQ,CAACC,GAAmBC,GAAG,EAAE,cAAAC,EAAA,MAC/B,GAAGC,CAAW,UAAUH,CAAS,mBAAmBE,CAAY;AACpE,CAAC;"}
|