@cuemath/leap 2.8.60-as1 → 2.8.60-as4
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/analytics-events/whitelist-events.js +9 -7
- package/dist/features/analytics-events/whitelist-events.js.map +1 -1
- package/dist/features/homework/homework-card.js +77 -69
- package/dist/features/homework/homework-card.js.map +1 -1
- package/dist/features/homework/styles.js +20 -20
- package/dist/features/homework/styles.js.map +1 -1
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-container.js +127 -81
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-container.js.map +1 -1
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-view-styled.js +16 -10
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-view-styled.js.map +1 -1
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-view.js +76 -45
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-view.js.map +1 -1
- package/dist/features/sheet-v2/resource-list/resource-list.js +39 -17
- package/dist/features/sheet-v2/resource-list/resource-list.js.map +1 -1
- package/dist/features/sheets/resources-list/resource-item/resource-item.js.map +1 -1
- package/dist/features/sheets/resources-list/resource-item/styled.js +1 -0
- package/dist/features/sheets/resources-list/resource-item/styled.js.map +1 -1
- package/dist/features/sheets/sheets-analytics-events.js +6 -2
- package/dist/features/sheets/sheets-analytics-events.js.map +1 -1
- package/package.json +1 -1
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-item.js +0 -41
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-item.js.map +0 -1
- package/dist/features/sheet-v2/resource-list/resource-item.js +0 -51
- package/dist/features/sheet-v2/resource-list/resource-item.js.map +0 -1
@@ -1,119 +1,165 @@
|
|
1
|
-
import {
|
2
|
-
import { memo as
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import
|
10
|
-
import
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import
|
14
|
-
|
15
|
-
const s = H(S)`
|
16
|
-
position: relative;
|
17
|
-
min-height: ${L}px;
|
18
|
-
`, Q = M((o) => {
|
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) => {
|
19
15
|
const {
|
20
|
-
isChaptersAvailable:
|
21
|
-
isDraftMilestone:
|
22
|
-
isMilestoneActive:
|
23
|
-
userType:
|
24
|
-
studentId:
|
25
|
-
userMilestoneId:
|
26
|
-
canUpdatePlan:
|
27
|
-
} =
|
28
|
-
get:
|
29
|
-
data:
|
30
|
-
isProcessingFailed:
|
31
|
-
isProcessed:
|
32
|
-
isStale:
|
33
|
-
isProcessing:
|
34
|
-
} =
|
35
|
-
|
36
|
-
studentId:
|
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
|
37
33
|
});
|
38
|
-
}, [
|
39
|
-
|
40
|
-
!
|
41
|
-
}, [
|
42
|
-
const
|
34
|
+
}, [A, m, t]);
|
35
|
+
L(() => {
|
36
|
+
!w && (!f && !p || C) && h();
|
37
|
+
}, [h, f, w, p, C]);
|
38
|
+
const $ = l(() => {
|
43
39
|
if (typeof i == "function") {
|
44
|
-
i == null || i(
|
40
|
+
i == null || i(t, ((r == null ? void 0 : r.length) || 0) + 1);
|
45
41
|
return;
|
46
42
|
}
|
47
43
|
throw new Error("No callback provided. If provided it must be a function");
|
48
|
-
}, [i,
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
{
|
54
|
-
widthX: 14,
|
55
|
-
size: "small",
|
56
|
-
shape: "square",
|
57
|
-
renderAs: "primary",
|
58
|
-
label: "Try again",
|
59
|
-
onClick: c
|
44
|
+
}, [i, t, r]), M = l(
|
45
|
+
(a) => {
|
46
|
+
if (typeof o == "function") {
|
47
|
+
o == null || o(a, t);
|
48
|
+
return;
|
60
49
|
}
|
61
|
-
|
62
|
-
|
63
|
-
|
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,
|
64
97
|
{
|
65
|
-
...
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
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
|
73
109
|
}
|
74
|
-
)
|
75
|
-
|
110
|
+
) : /* @__PURE__ */ u(
|
111
|
+
T,
|
76
112
|
{
|
77
113
|
$gapX: 6.75,
|
78
114
|
$alignItems: "center",
|
79
115
|
$justifyContent: "center",
|
80
116
|
$background: "WHITE",
|
117
|
+
$height: v,
|
81
118
|
children: [
|
82
|
-
/* @__PURE__ */ e("img", { src:
|
83
|
-
/* @__PURE__ */ e(
|
84
|
-
|
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: [
|
85
122
|
/* @__PURE__ */ e(
|
86
|
-
|
123
|
+
D,
|
87
124
|
{
|
88
125
|
renderAs: "primary",
|
89
126
|
position: "bottom",
|
90
|
-
hidden: !
|
91
|
-
tooltipItem:
|
127
|
+
hidden: !y,
|
128
|
+
tooltipItem: k,
|
92
129
|
children: /* @__PURE__ */ e(
|
93
|
-
|
130
|
+
S,
|
94
131
|
{
|
95
132
|
widthX: 10,
|
96
133
|
renderAs: "primary",
|
97
134
|
shape: "square",
|
98
135
|
size: "small",
|
99
136
|
label: "Create a Test",
|
100
|
-
onClick:
|
101
|
-
disabled:
|
102
|
-
analyticsLabel:
|
137
|
+
onClick: $,
|
138
|
+
disabled: y,
|
139
|
+
analyticsLabel: R.CUSTOM_TEST_CREATION_STARTED,
|
103
140
|
analyticsProps: {
|
104
|
-
milestone_id:
|
141
|
+
milestone_id: t
|
105
142
|
}
|
106
143
|
}
|
107
144
|
)
|
108
145
|
}
|
109
146
|
),
|
110
|
-
/* @__PURE__ */ e(
|
111
|
-
] }) : /* @__PURE__ */ e(
|
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" })
|
112
149
|
]
|
113
150
|
}
|
114
|
-
) : /* @__PURE__ */ e(
|
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
|
+
);
|
115
161
|
});
|
116
162
|
export {
|
117
|
-
|
163
|
+
re as default
|
118
164
|
};
|
119
165
|
//# sourceMappingURL=test-list-container.js.map
|
@@ -1 +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 { ITestsListProps } from './types';\n\nimport { memo, useCallback, useEffect, type FC } from 'react';\nimport styled from 'styled-components';\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 TestHelpWrapper = styled(FlexView)`\n position: relative;\n min-height: ${MILESTONE_WIDGET_MIN_HEIGHT}px;\n`;\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 } = 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 if (isProcessingFailed) {\n return (\n <TestHelpWrapper $alignItems=\"center\" $justifyContent=\"center\" $background=\"WHITE\">\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 </TestHelpWrapper>\n );\n }\n\n if (isProcessed) {\n if (data?.length) {\n return (\n <TestHelpWrapper>\n <TestSheetsList\n {...props}\n milestoneId={userMilestoneId}\n sheets={data}\n userType={userType}\n studentId={studentId}\n onCreateNewTest={handleOnCreateMilestoneTest}\n canUpdatedPlan={canUpdatePlan}\n isMilestoneActive={isMilestoneActive}\n />\n </TestHelpWrapper>\n );\n }\n\n return (\n <TestHelpWrapper\n $gapX={6.75}\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $background=\"WHITE\"\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 </TestHelpWrapper>\n );\n }\n\n return (\n <TestHelpWrapper $alignItems=\"center\" $justifyContent=\"center\" $background=\"WHITE\">\n <AppLoader height=\"100%\" />\n </TestHelpWrapper>\n );\n});\n\nexport default MilestoneTestsList;\n"],"names":["TestHelpWrapper","styled","FlexView","MILESTONE_WIDGET_MIN_HEIGHT","MilestoneTestsList","memo","props","isChaptersAvailable","isDraftMilestone","isMilestoneActive","userType","studentId","userMilestoneId","canUpdatePlan","onCreateMilestoneTest","getTestHelpData","data","isProcessingFailed","isProcessed","isStale","isProcessing","useGetTestHelpData","isTestSheetCreationDisabled","testCreationCtaTooltipText","handleOnTryAgain","useCallback","useEffect","handleOnCreateMilestoneTest","jsx","jsxs","Text","Button","TestSheetsList","IMAGES","Separator","Fragment","ArrowTooltip","TESTS_CREATION_ANALYTICS_EVENTS","AppLoader"],"mappings":";;;;;;;;;;;;;;AAiBA,MAAMA,IAAkBC,EAAOC,CAAQ;AAAA;AAAA,gBAEvBC,CAA2B;AAAA,GAGrCC,IAA0CC,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,EAA0B,IAAAR,GAE5B;AAAA,IACJ,KAAKS;AAAA,IACL,MAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,SAAAC;AAAA,IACA,cAAAC;AAAA,MACEC,EAAmB,GAEjBC,IACJ,CAACT,KACD,CAACN,KACD,CA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"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":";;;;;;;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
-
import { styled as
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
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`
|
9
14
|
display: grid;
|
10
15
|
grid-template-columns: repeat(3, 200px);
|
11
16
|
grid-gap: 32px;
|
@@ -13,7 +18,8 @@ const p = o.div(({ theme: t }) => `
|
|
13
18
|
padding: 32px 0;
|
14
19
|
`;
|
15
20
|
export {
|
16
|
-
|
17
|
-
|
21
|
+
s as IconButtonCover,
|
22
|
+
i as IconContainer,
|
23
|
+
a as TestSheetItemWrapper
|
18
24
|
};
|
19
25
|
//# sourceMappingURL=test-list-view-styled.js.map
|
@@ -1 +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\nconst IconContainer = styled
|
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;"}
|
@@ -1,51 +1,82 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import {
|
3
|
-
import
|
4
|
-
import S from "
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import
|
8
|
-
|
1
|
+
import { jsxs as E, jsx as e } 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 w from "../../../ui/buttons/icon-button/icon-button.js";
|
7
|
+
import x from "../../../ui/layout/flex-view.js";
|
8
|
+
import { MILESTONE_WIDGET_MIN_HEIGHT as N } 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 = (t) => {
|
12
|
+
const o = /* @__PURE__ */ new Set();
|
13
|
+
return t == null || t.forEach((r) => {
|
14
|
+
o.add(r.chapter_name);
|
15
|
+
}), Array.from(o);
|
16
|
+
}, P = C(
|
9
17
|
({
|
10
|
-
milestoneId:
|
11
|
-
studentId:
|
12
|
-
sheets:
|
13
|
-
userType:
|
18
|
+
milestoneId: t,
|
19
|
+
studentId: o,
|
20
|
+
sheets: r,
|
21
|
+
userType: i,
|
14
22
|
onCreateNewTest: m,
|
15
|
-
isMilestoneActive:
|
16
|
-
canUpdatedPlan:
|
17
|
-
...
|
18
|
-
}) => /* @__PURE__ */
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
23
|
+
isMilestoneActive: c,
|
24
|
+
canUpdatedPlan: p,
|
25
|
+
...d
|
26
|
+
}) => /* @__PURE__ */ E(
|
27
|
+
x,
|
28
|
+
{
|
29
|
+
$height: N,
|
30
|
+
$position: "relative",
|
31
|
+
$justifyContent: "space-between",
|
32
|
+
children: [
|
33
|
+
/* @__PURE__ */ e(b, { children: r.map((s, l) => {
|
34
|
+
const {
|
35
|
+
items: h,
|
36
|
+
node_id: T,
|
37
|
+
sheet_time: a,
|
38
|
+
total_questions: n,
|
39
|
+
worksheet_id: f
|
40
|
+
} = s, u = a && Math.ceil(a / 60) || 0, I = M(h).join(", "), _ = `${typeof n == "number" ? `${n} ${$.pluralize(n, "Question")}, ` : ""}${u} Mins`;
|
41
|
+
return /* @__PURE__ */ e(
|
42
|
+
A,
|
43
|
+
{
|
44
|
+
userType: i,
|
45
|
+
header: I,
|
46
|
+
subHeader: _,
|
47
|
+
nodeData: s,
|
48
|
+
...d
|
49
|
+
},
|
50
|
+
`${f}_${T}_${l}`
|
51
|
+
);
|
52
|
+
}) }),
|
53
|
+
i === "TEACHER" && p && /* @__PURE__ */ e(
|
54
|
+
j,
|
55
|
+
{
|
56
|
+
$flexDirection: "row",
|
57
|
+
$justifyContent: "flex-end",
|
58
|
+
$gapX: 1,
|
59
|
+
$gutterX: 1,
|
60
|
+
children: /* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(
|
61
|
+
w,
|
62
|
+
{
|
63
|
+
Icon: S,
|
64
|
+
renderAs: "secondary",
|
65
|
+
analyticsLabel: y.CUSTOM_TEST_CREATION_STARTED,
|
66
|
+
onClick: m,
|
67
|
+
disabled: !c,
|
68
|
+
analyticsProps: {
|
69
|
+
milestone_id: t
|
70
|
+
}
|
71
|
+
}
|
72
|
+
) })
|
73
|
+
}
|
74
|
+
)
|
75
|
+
]
|
76
|
+
}
|
77
|
+
)
|
47
78
|
);
|
48
79
|
export {
|
49
|
-
|
80
|
+
P as default
|
50
81
|
};
|
51
82
|
//# sourceMappingURL=test-list-view.js.map
|
@@ -1 +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 { ITestSheetsList } from './types';\nimport type { FC } from 'react';\n\nimport { memo } from 'react';\n\nimport Plus2Icon from '../../../../assets/line-icons/icons/plus2';\nimport IconButton from '../../../ui/buttons/icon-button/icon-button';\nimport { TESTS_CREATION_ANALYTICS_EVENTS } from '../tests-creation/tests-creation-analytics-events';\nimport
|
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 getTopicsFromItems = (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);\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 = (sheetTime && Math.ceil(sheetTime / 60)) || 0;\n const topics = getTopicsFromItems(items);\n const testChapterName = topics.join(', ');\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":["getTopicsFromItems","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,IAAqB,CAACC,MAA0C;AAC9D,QAAAC,wBAAa;AAEnB,SAAAD,KAAA,QAAAA,EAAO,QAAQ,CAAQE,MAAA;AACd,IAAAD,EAAA,IAAIC,EAAK,YAAY;AAAA,EAAA,IAGvB,MAAM,KAAKD,CAAM;AAC1B,GAEME,IAAsCC;AAAA,EAC1C,CAAC;AAAA,IACC,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,MAGD,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAASC;AAAA,MACT,WAAU;AAAA,MACV,iBAAgB;AAAA,MAEhB,UAAA;AAAA,QAAA,gBAAAC,EAACC,GAAA,EACE,YAAO,IAAI,CAACC,GAAOC,MAAQ;AACpB,gBAAA;AAAA,YACJ,OAAAnB;AAAA,YACA,SAASoB;AAAA,YACT,YAAYC;AAAA,YACZ,iBAAiBC;AAAA,YACjB,cAAcC;AAAA,UACZ,IAAAL,GACEM,IAAkBH,KAAa,KAAK,KAAKA,IAAY,EAAE,KAAM,GAE7DI,IADS1B,EAAmBC,CAAK,EACR,KAAK,IAAI,GAClC0B,IAAY,GAChB,OAAOJ,KAAmB,WACtB,GAAGA,CAAc,IAAIK,EAAA,UAAUL,GAAgB,UAAU,CAAC,OAC1D,EACN,GAAGE,CAAc;AAGf,iBAAA,gBAAAR;AAAA,YAACY;AAAA,YAAA;AAAA,cAEC,UAAApB;AAAA,cACA,QAAQiB;AAAA,cACR,WAAAC;AAAA,cACA,UAAUR;AAAA,cACT,GAAGN;AAAA,YAAA;AAAA,YALC,GAAGW,CAAW,IAAIH,CAAM,IAAID,CAAG;AAAA,UAAA;AAAA,QAQzC,CAAA,GACH;AAAA,QAECX,MAAa,aAAaG,KACzB,gBAAAK;AAAA,UAACa;AAAAA,UAAA;AAAA,YACC,gBAAe;AAAA,YACf,iBAAgB;AAAA,YAChB,OAAO;AAAA,YACP,UAAU;AAAA,YAEV,UAAA,gBAAAb,EAACc,GAAA,EACC,UAAA,gBAAAd;AAAA,cAACe;AAAA,cAAA;AAAA,gBACC,MAAMC;AAAA,gBACN,UAAS;AAAA,gBACT,gBAAgBC,EAAgC;AAAA,gBAChD,SAASxB;AAAA,gBACT,UAAU,CAACC;AAAA,gBACX,gBAAgB;AAAA,kBACd,cAAcL;AAAA,gBAChB;AAAA,cAAA;AAAA,YAAA,GAEJ;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAKV;"}
|
@@ -1,30 +1,52 @@
|
|
1
|
-
import { jsx as
|
2
|
-
import {
|
3
|
-
import u from "
|
4
|
-
import
|
5
|
-
import
|
6
|
-
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
2
|
+
import { h as p } from "../../../node_modules/humanize-plus/dist/humanize.js";
|
3
|
+
import { memo as u, useRef as l } from "react";
|
4
|
+
import f from "styled-components";
|
5
|
+
import E from "../../homework/homework-card.js";
|
6
|
+
import _ from "../../ui/layout/flex-view.js";
|
7
|
+
const h = f.div`
|
7
8
|
display: grid;
|
8
9
|
grid-template-columns: repeat(3, 200px);
|
9
10
|
grid-gap: 32px;
|
10
11
|
justify-content: center;
|
11
12
|
padding: 32px 0;
|
12
|
-
`,
|
13
|
-
const
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
`, Z = (r) => {
|
14
|
+
const {
|
15
|
+
sheet_time: t,
|
16
|
+
node_type: o,
|
17
|
+
total_questions: e
|
18
|
+
} = r || {};
|
19
|
+
switch (o) {
|
20
|
+
case "ASSESSMENT":
|
21
|
+
case "MASTERY":
|
22
|
+
case "DYNAMIC":
|
23
|
+
return `${typeof e == "number" ? `${e} ${p.pluralize(e, "Question")}, ${t ? `${t / 60} min` : ""}` : ""}`;
|
24
|
+
case "PUZZLE_EASY":
|
25
|
+
case "PUZZLE_HARD":
|
26
|
+
case "PUZZLE_MEDIUM":
|
27
|
+
case "PUZZLE":
|
28
|
+
return "";
|
29
|
+
default:
|
30
|
+
return "";
|
31
|
+
}
|
32
|
+
}, R = u(({ sheets: r, userType: t, ...o }) => {
|
33
|
+
const e = l(null);
|
34
|
+
return /* @__PURE__ */ n(_, { ref: e, children: /* @__PURE__ */ n(h, { children: r.map((s, i) => {
|
35
|
+
const { title: a, node_id: d, worksheet_id: m } = s, c = Z(s);
|
36
|
+
return /* @__PURE__ */ n(
|
37
|
+
E,
|
18
38
|
{
|
19
|
-
|
20
|
-
|
21
|
-
|
39
|
+
header: a,
|
40
|
+
subHeader: c,
|
41
|
+
userType: t,
|
42
|
+
nodeData: s,
|
43
|
+
...o
|
22
44
|
},
|
23
|
-
`${
|
45
|
+
`${m}_${d}_${i}`
|
24
46
|
);
|
25
47
|
}) }) });
|
26
48
|
});
|
27
49
|
export {
|
28
|
-
|
50
|
+
R as default
|
29
51
|
};
|
30
52
|
//# sourceMappingURL=resource-list.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"resource-list.js","sources":["../../../../src/features/sheet-v2/resource-list/resource-list.tsx"],"sourcesContent":["import type { IResourcesListProps } from './types';\nimport type { FC } from 'react';\n\nimport { useRef, memo } from 'react';\nimport styled from 'styled-components';\n\nimport
|
1
|
+
{"version":3,"file":"resource-list.js","sources":["../../../../src/features/sheet-v2/resource-list/resource-list.tsx"],"sourcesContent":["import type { INodeDataProps } from '../../chapters-v2/comps/node-card/node-card-types';\nimport type { IResourcesListProps } from './types';\nimport type { FC } from 'react';\n\nimport { pluralize } from 'humanize-plus';\nimport { useRef, memo } from 'react';\nimport styled from 'styled-components';\n\nimport HomeworkCard from '../../homework/homework-card';\nimport FlexView from '../../ui/layout/flex-view';\n\nconst ResourceItemListWrapper = 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\nconst getSubHeader = (sheet: INodeDataProps) => {\n const {\n sheet_time: sheetTime,\n node_type: nodeType,\n total_questions: totalQuestions,\n } = sheet || {};\n\n switch (nodeType) {\n case 'ASSESSMENT':\n case 'MASTERY':\n case 'DYNAMIC':\n return `${\n typeof totalQuestions === 'number'\n ? `${totalQuestions} ${pluralize(totalQuestions, 'Question')}, ${\n sheetTime ? `${sheetTime / 60} min` : ''\n }`\n : ''\n }`;\n case 'PUZZLE_EASY':\n case 'PUZZLE_HARD':\n case 'PUZZLE_MEDIUM':\n case 'PUZZLE':\n return '';\n default:\n return '';\n }\n};\n\nconst ResourcesList: FC<IResourcesListProps> = memo(({ sheets, userType, ...sheetCallBacks }) => {\n const resourceListContainerRef = useRef<HTMLDivElement>(null);\n\n return (\n <FlexView ref={resourceListContainerRef}>\n <ResourceItemListWrapper>\n {sheets.map((sheet, idx) => {\n const { title, node_id: nodeId, worksheet_id: worksheetId } = sheet;\n const subHeader = getSubHeader(sheet);\n\n return (\n <HomeworkCard\n key={`${worksheetId}_${nodeId}_${idx}`}\n header={title}\n subHeader={subHeader}\n userType={userType}\n nodeData={sheet}\n {...sheetCallBacks}\n />\n );\n })}\n </ResourceItemListWrapper>\n </FlexView>\n );\n});\n\nexport default ResourcesList;\n"],"names":["ResourceItemListWrapper","styled","getSubHeader","sheet","sheetTime","nodeType","totalQuestions","pluralize","ResourcesList","memo","sheets","userType","sheetCallBacks","resourceListContainerRef","useRef","jsx","FlexView","idx","title","nodeId","worksheetId","subHeader","HomeworkCard"],"mappings":";;;;;;AAWA,MAAMA,IAA0BC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAQjCC,IAAe,CAACC,MAA0B;AACxC,QAAA;AAAA,IACJ,YAAYC;AAAA,IACZ,WAAWC;AAAA,IACX,iBAAiBC;AAAA,EAAA,IACfH,KAAS,CAAA;AAEb,UAAQE,GAAU;AAAA,IAChB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO,GACL,OAAOC,KAAmB,WACtB,GAAGA,CAAc,IAAIC,YAAUD,GAAgB,UAAU,CAAC,KACxDF,IAAY,GAAGA,IAAY,EAAE,SAAS,EACxC,KACA,EACN;AAAA,IACF,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACI,aAAA;AAAA,IACT;AACS,aAAA;AAAA,EACX;AACF,GAEMI,IAAyCC,EAAK,CAAC,EAAE,QAAAC,GAAQ,UAAAC,GAAU,GAAGC,QAAqB;AACzF,QAAAC,IAA2BC,EAAuB,IAAI;AAG1D,SAAA,gBAAAC,EAACC,GAAS,EAAA,KAAKH,GACb,UAAA,gBAAAE,EAACf,KACE,UAAOU,EAAA,IAAI,CAACP,GAAOc,MAAQ;AAC1B,UAAM,EAAE,OAAAC,GAAO,SAASC,GAAQ,cAAcC,EAAgB,IAAAjB,GACxDkB,IAAYnB,EAAaC,CAAK;AAGlC,WAAA,gBAAAY;AAAA,MAACO;AAAA,MAAA;AAAA,QAEC,QAAQJ;AAAA,QACR,WAAAG;AAAA,QACA,UAAAV;AAAA,QACA,UAAUR;AAAA,QACT,GAAGS;AAAA,MAAA;AAAA,MALC,GAAGQ,CAAW,IAAID,CAAM,IAAIF,CAAG;AAAA,IAAA;AAAA,EAMtC,CAEH,GACH,EACF,CAAA;AAEJ,CAAC;"}
|