@cuemath/leap 2.8.61-as4 → 2.8.61-as5
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-v2/chapter-details/block-sections/block-sections.js +32 -28
- package/dist/features/chapters-v2/chapter-details/block-sections/block-sections.js.map +1 -1
- package/dist/features/chapters-v2/comps/node-card/teacher-actions/teacher-actions.js +17 -17
- package/dist/features/chapters-v2/comps/node-card/teacher-actions/teacher-actions.js.map +1 -1
- package/dist/features/homework/hw-card-list/hw-card-list.js +83 -76
- package/dist/features/homework/hw-card-list/hw-card-list.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-info.js +10 -10
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-info.js.map +1 -1
- package/package.json +1 -1
@@ -1,8 +1,8 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { memo as
|
1
|
+
import { jsxs as G, jsx as f } from "react/jsx-runtime";
|
2
|
+
import { memo as I } from "react";
|
3
3
|
import L from "../../../ui/layout/flex-view.js";
|
4
|
-
import
|
5
|
-
const
|
4
|
+
import u from "./block-section-view.js";
|
5
|
+
const b = I((A) => {
|
6
6
|
const {
|
7
7
|
blocks: t,
|
8
8
|
imageHue: n,
|
@@ -11,41 +11,45 @@ const O = G((A) => {
|
|
11
11
|
onNodeAttemptLocationChange: c,
|
12
12
|
onNodeMarkAsDone: l,
|
13
13
|
onNodeReattempt: r,
|
14
|
-
onNodeReview:
|
15
|
-
onNodeView:
|
16
|
-
onBlockSkipUnskip:
|
14
|
+
onNodeReview: d,
|
15
|
+
onNodeView: p,
|
16
|
+
onBlockSkipUnskip: m
|
17
17
|
} = A;
|
18
|
-
let
|
19
|
-
const
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
18
|
+
let k = 0;
|
19
|
+
const S = t.filter(
|
20
|
+
(o) => o.section_code === "GOALS" || o.section_code === "READINESS"
|
21
|
+
), N = t.filter(
|
22
|
+
(o) => o.section_code !== "GOALS" && o.section_code !== "READINESS"
|
23
|
+
);
|
24
|
+
return /* @__PURE__ */ G(L, { $width: "100%", children: [
|
25
|
+
S.map((o, e) => {
|
26
|
+
const { block_type: _, block_id: B, is_skipped: w } = o;
|
27
|
+
let a = 0;
|
28
|
+
const x = e === S.length - 1;
|
29
|
+
return _ === "GOAL" && (w || (k += 1), a = k), /* @__PURE__ */ f(
|
30
|
+
u,
|
27
31
|
{
|
28
32
|
blockData: o,
|
29
33
|
userType: i,
|
30
|
-
isLastBlock:
|
31
|
-
lessonIdx:
|
34
|
+
isLastBlock: x,
|
35
|
+
lessonIdx: a,
|
32
36
|
imageHue: n,
|
33
37
|
isGoalBlock: !0,
|
34
38
|
onNodeAttempt: s,
|
35
39
|
onNodeAttemptLocationChange: c,
|
36
40
|
onNodeMarkAsDone: l,
|
37
41
|
onNodeReattempt: r,
|
38
|
-
onNodeReview:
|
39
|
-
onNodeView:
|
40
|
-
onBlockSkipUnskip:
|
42
|
+
onNodeReview: d,
|
43
|
+
onNodeView: p,
|
44
|
+
onBlockSkipUnskip: m
|
41
45
|
},
|
42
|
-
|
46
|
+
B
|
43
47
|
);
|
44
48
|
}),
|
45
49
|
N.map((o) => {
|
46
50
|
const { block_id: e } = o;
|
47
|
-
return /* @__PURE__ */
|
48
|
-
|
51
|
+
return /* @__PURE__ */ f(
|
52
|
+
u,
|
49
53
|
{
|
50
54
|
blockData: o,
|
51
55
|
userType: i,
|
@@ -54,9 +58,9 @@ const O = G((A) => {
|
|
54
58
|
onNodeAttemptLocationChange: c,
|
55
59
|
onNodeMarkAsDone: l,
|
56
60
|
onNodeReattempt: r,
|
57
|
-
onNodeReview:
|
58
|
-
onNodeView:
|
59
|
-
onBlockSkipUnskip:
|
61
|
+
onNodeReview: d,
|
62
|
+
onNodeView: p,
|
63
|
+
onBlockSkipUnskip: m
|
60
64
|
},
|
61
65
|
e
|
62
66
|
);
|
@@ -64,6 +68,6 @@ const O = G((A) => {
|
|
64
68
|
] });
|
65
69
|
});
|
66
70
|
export {
|
67
|
-
|
71
|
+
b as default
|
68
72
|
};
|
69
73
|
//# sourceMappingURL=block-sections.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"block-sections.js","sources":["../../../../../src/features/chapters-v2/chapter-details/block-sections/block-sections.tsx"],"sourcesContent":["import type { IBlockSectionsProps } from './block-sections-types';\nimport type { FC } from 'react';\n\nimport { memo } from 'react';\n\nimport FlexView from '../../../ui/layout/flex-view';\nimport BlockSectionView from './block-section-view';\n\nconst BlockSections: FC<IBlockSectionsProps> = memo(props => {\n const {\n blocks,\n imageHue,\n userType,\n onNodeAttempt,\n onNodeAttemptLocationChange,\n onNodeMarkAsDone,\n onNodeReattempt,\n onNodeReview,\n onNodeView,\n onBlockSkipUnskip,\n } = props;\n\n let lessonCount = 0;\n\n const goalBlocks = blocks.filter(block => block.section_code === 'GOALS');\n const nonGoalBlocks = blocks.filter(block => block.section_code !== 'GOALS');\n\n return (\n <FlexView $width=\"100%\">\n {goalBlocks.map((blockData, idx) => {\n const { block_type: blockType, block_id: blockId, is_skipped: isSkipped } = blockData;\n let lessonIdx = 0;\n\n const isLastBlock = idx === goalBlocks.length - 1;\n\n if (blockType === 'GOAL') {\n if (!isSkipped) {\n lessonCount += 1;\n }\n\n lessonIdx = lessonCount;\n }\n\n return (\n <BlockSectionView\n blockData={blockData}\n userType={userType}\n isLastBlock={isLastBlock}\n key={blockId}\n lessonIdx={lessonIdx}\n imageHue={imageHue}\n isGoalBlock\n onNodeAttempt={onNodeAttempt}\n onNodeAttemptLocationChange={onNodeAttemptLocationChange}\n onNodeMarkAsDone={onNodeMarkAsDone}\n onNodeReattempt={onNodeReattempt}\n onNodeReview={onNodeReview}\n onNodeView={onNodeView}\n onBlockSkipUnskip={onBlockSkipUnskip}\n />\n );\n })}\n\n {nonGoalBlocks.map(blockData => {\n const { block_id: blockId } = blockData;\n\n return (\n <BlockSectionView\n key={blockId}\n blockData={blockData}\n userType={userType}\n imageHue={imageHue}\n onNodeAttempt={onNodeAttempt}\n onNodeAttemptLocationChange={onNodeAttemptLocationChange}\n onNodeMarkAsDone={onNodeMarkAsDone}\n onNodeReattempt={onNodeReattempt}\n onNodeReview={onNodeReview}\n onNodeView={onNodeView}\n onBlockSkipUnskip={onBlockSkipUnskip}\n />\n );\n })}\n </FlexView>\n );\n});\n\nexport default BlockSections;\n"],"names":["BlockSections","memo","props","blocks","imageHue","userType","onNodeAttempt","onNodeAttemptLocationChange","onNodeMarkAsDone","onNodeReattempt","onNodeReview","onNodeView","onBlockSkipUnskip","lessonCount","goalBlocks","block","nonGoalBlocks","jsxs","FlexView","blockData","idx","blockType","blockId","isSkipped","lessonIdx","isLastBlock","jsx","BlockSectionView"],"mappings":";;;;AAQM,MAAAA,IAAyCC,EAAK,CAASC,MAAA;AACrD,QAAA;AAAA,IACJ,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,eAAAC;AAAA,IACA,6BAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,YAAAC;AAAA,IACA,mBAAAC;AAAA,EACE,IAAAV;AAEJ,MAAIW,IAAc;AAElB,QAAMC,IAAaX,EAAO,
|
1
|
+
{"version":3,"file":"block-sections.js","sources":["../../../../../src/features/chapters-v2/chapter-details/block-sections/block-sections.tsx"],"sourcesContent":["import type { IBlockSectionsProps } from './block-sections-types';\nimport type { FC } from 'react';\n\nimport { memo } from 'react';\n\nimport FlexView from '../../../ui/layout/flex-view';\nimport BlockSectionView from './block-section-view';\n\nconst BlockSections: FC<IBlockSectionsProps> = memo(props => {\n const {\n blocks,\n imageHue,\n userType,\n onNodeAttempt,\n onNodeAttemptLocationChange,\n onNodeMarkAsDone,\n onNodeReattempt,\n onNodeReview,\n onNodeView,\n onBlockSkipUnskip,\n } = props;\n\n let lessonCount = 0;\n\n const goalBlocks = blocks.filter(\n block => block.section_code === 'GOALS' || block.section_code === 'READINESS',\n );\n\n const nonGoalBlocks = blocks.filter(\n block => block.section_code !== 'GOALS' && block.section_code !== 'READINESS',\n );\n\n return (\n <FlexView $width=\"100%\">\n {goalBlocks.map((blockData, idx) => {\n const { block_type: blockType, block_id: blockId, is_skipped: isSkipped } = blockData;\n let lessonIdx = 0;\n\n const isLastBlock = idx === goalBlocks.length - 1;\n\n if (blockType === 'GOAL') {\n if (!isSkipped) {\n lessonCount += 1;\n }\n\n lessonIdx = lessonCount;\n }\n\n return (\n <BlockSectionView\n blockData={blockData}\n userType={userType}\n isLastBlock={isLastBlock}\n key={blockId}\n lessonIdx={lessonIdx}\n imageHue={imageHue}\n isGoalBlock\n onNodeAttempt={onNodeAttempt}\n onNodeAttemptLocationChange={onNodeAttemptLocationChange}\n onNodeMarkAsDone={onNodeMarkAsDone}\n onNodeReattempt={onNodeReattempt}\n onNodeReview={onNodeReview}\n onNodeView={onNodeView}\n onBlockSkipUnskip={onBlockSkipUnskip}\n />\n );\n })}\n\n {nonGoalBlocks.map(blockData => {\n const { block_id: blockId } = blockData;\n\n return (\n <BlockSectionView\n key={blockId}\n blockData={blockData}\n userType={userType}\n imageHue={imageHue}\n onNodeAttempt={onNodeAttempt}\n onNodeAttemptLocationChange={onNodeAttemptLocationChange}\n onNodeMarkAsDone={onNodeMarkAsDone}\n onNodeReattempt={onNodeReattempt}\n onNodeReview={onNodeReview}\n onNodeView={onNodeView}\n onBlockSkipUnskip={onBlockSkipUnskip}\n />\n );\n })}\n </FlexView>\n );\n});\n\nexport default BlockSections;\n"],"names":["BlockSections","memo","props","blocks","imageHue","userType","onNodeAttempt","onNodeAttemptLocationChange","onNodeMarkAsDone","onNodeReattempt","onNodeReview","onNodeView","onBlockSkipUnskip","lessonCount","goalBlocks","block","nonGoalBlocks","jsxs","FlexView","blockData","idx","blockType","blockId","isSkipped","lessonIdx","isLastBlock","jsx","BlockSectionView"],"mappings":";;;;AAQM,MAAAA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,UAAAd;AAAA,UACA,UAAAD;AAAA,UACA,eAAAE;AAAA,UACA,6BAAAC;AAAA,UACA,kBAAAC;AAAA,UACA,iBAAAC;AAAA,UACA,cAAAC;AAAA,UACA,YAAAC;AAAA,UACA,mBAAAC;AAAA,QAAA;AAAA,QAVKU;AAAA,MAAA;AAAA,IAWP,CAEH;AAAA,EACH,EAAA,CAAA;AAEJ,CAAC;"}
|
@@ -22,10 +22,10 @@ const { ASSIGN_AS_HW: de, REVIEW: me, VIEW: pe, MARK_AS_DONE: he } = V, Be = P(
|
|
22
22
|
imageHue: T,
|
23
23
|
blockType: O,
|
24
24
|
isSkipped: $,
|
25
|
-
onNodeAttemptLocationChange:
|
26
|
-
onNodeMarkAsDone:
|
27
|
-
onNodeView:
|
28
|
-
onNodeReview:
|
25
|
+
onNodeAttemptLocationChange: i,
|
26
|
+
onNodeMarkAsDone: o,
|
27
|
+
onNodeView: n,
|
28
|
+
onNodeReview: c
|
29
29
|
}) => {
|
30
30
|
const l = X(null), { menuVisible: w, onMenuClick: u } = Y(l), {
|
31
31
|
accuracy: x,
|
@@ -33,7 +33,7 @@ const { ASSIGN_AS_HW: de, REVIEW: me, VIEW: pe, MARK_AS_DONE: he } = V, Be = P(
|
|
33
33
|
node_type: d,
|
34
34
|
card_header: W,
|
35
35
|
title: A,
|
36
|
-
state:
|
36
|
+
state: a,
|
37
37
|
is_optional: C,
|
38
38
|
sheet_statement: _,
|
39
39
|
permissions: B
|
@@ -41,17 +41,17 @@ const { ASSIGN_AS_HW: de, REVIEW: me, VIEW: pe, MARK_AS_DONE: he } = V, Be = P(
|
|
41
41
|
can_change_attempt_location: H,
|
42
42
|
can_mark_familiar: L,
|
43
43
|
can_review: m
|
44
|
-
} = B, p = O === Q.GOAL,
|
44
|
+
} = B, p = O === Q.GOAL, s = a === f.LOCKED, G = a === f.NOT_STARTED, K = a === f.IN_PROGRESS, I = y === "INCLASS", M = !_ || !p, g = !C && (K || G), R = Z(d), b = D(d), h = F(
|
45
45
|
(E) => {
|
46
46
|
switch (E) {
|
47
47
|
case "node-card-view":
|
48
|
-
m ?
|
48
|
+
m ? c == null || c(r) : n == null || n(r);
|
49
49
|
return;
|
50
50
|
case "node-card-assign-as-hw":
|
51
|
-
|
51
|
+
i == null || i(r);
|
52
52
|
return;
|
53
53
|
case "node-card-mark-as-done":
|
54
|
-
|
54
|
+
o == null || o(r);
|
55
55
|
return;
|
56
56
|
default:
|
57
57
|
throw new Error(`No callback function for ${E}`);
|
@@ -60,10 +60,10 @@ const { ASSIGN_AS_HW: de, REVIEW: me, VIEW: pe, MARK_AS_DONE: he } = V, Be = P(
|
|
60
60
|
[
|
61
61
|
m,
|
62
62
|
r,
|
63
|
+
i,
|
63
64
|
o,
|
64
|
-
|
65
|
-
|
66
|
-
c
|
65
|
+
c,
|
66
|
+
n
|
67
67
|
]
|
68
68
|
), j = [
|
69
69
|
{
|
@@ -92,7 +92,7 @@ const { ASSIGN_AS_HW: de, REVIEW: me, VIEW: pe, MARK_AS_DONE: he } = V, Be = P(
|
|
92
92
|
re,
|
93
93
|
{
|
94
94
|
$showOutline: !g,
|
95
|
-
$isSheetLocked:
|
95
|
+
$isSheetLocked: s,
|
96
96
|
$background: `${T}_2`,
|
97
97
|
$disabled: !!$,
|
98
98
|
children: [
|
@@ -127,14 +127,14 @@ const { ASSIGN_AS_HW: de, REVIEW: me, VIEW: pe, MARK_AS_DONE: he } = V, Be = P(
|
|
127
127
|
$position: "relative",
|
128
128
|
$alignItems: "center",
|
129
129
|
$justifyContent: "center",
|
130
|
-
$opacity:
|
130
|
+
$opacity: s ? 0.5 : 1,
|
131
131
|
children: [
|
132
132
|
b && /* @__PURE__ */ e(b, { width: 20, height: 20 }),
|
133
133
|
!C && /* @__PURE__ */ e(oe, {})
|
134
134
|
]
|
135
135
|
}
|
136
136
|
),
|
137
|
-
/* @__PURE__ */ t(J, { $renderAs: "ac4-black", $color: "BLACK", $opacity:
|
137
|
+
/* @__PURE__ */ t(J, { $renderAs: "ac4-black", $color: "BLACK", $opacity: s ? 0.5 : 1, children: [
|
138
138
|
W,
|
139
139
|
" ",
|
140
140
|
I && ". CW"
|
@@ -144,7 +144,7 @@ const { ASSIGN_AS_HW: de, REVIEW: me, VIEW: pe, MARK_AS_DONE: he } = V, Be = P(
|
|
144
144
|
]
|
145
145
|
}
|
146
146
|
),
|
147
|
-
/* @__PURE__ */ e(se, { nodeType: d, state:
|
147
|
+
/* @__PURE__ */ e(se, { nodeType: d, state: a, accuracy: x }),
|
148
148
|
!p && /* @__PURE__ */ t(
|
149
149
|
ne,
|
150
150
|
{
|
@@ -160,7 +160,7 @@ const { ASSIGN_AS_HW: de, REVIEW: me, VIEW: pe, MARK_AS_DONE: he } = V, Be = P(
|
|
160
160
|
{
|
161
161
|
$renderAs: "ab3",
|
162
162
|
$color: "BLACK_1",
|
163
|
-
$opacity:
|
163
|
+
$opacity: s ? 0.5 : 1,
|
164
164
|
children: A
|
165
165
|
}
|
166
166
|
),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"teacher-actions.js","sources":["../../../../../../src/features/chapters-v2/comps/node-card/teacher-actions/teacher-actions.tsx"],"sourcesContent":["import type { INodeCardProps } from '../node-card-types';\nimport type { INodeMenuOption } from '../node-menu-options/node-menu-options-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useRef } from 'react';\n\nimport Check2Icon from '../../../../../assets/line-icons/icons/check2';\nimport Eye2Icon from '../../../../../assets/line-icons/icons/eye2';\nimport Home2Icon from '../../../../../assets/line-icons/icons/home2';\nimport MoreVerticalIcon from '../../../../../assets/line-icons/icons/more-vertical';\nimport ArrowTooltip from '../../../../ui/arrow-tooltip/arrow-tooltip';\nimport useContextMenuClickHandler from '../../../../ui/hooks/use-context-menu-click-handler';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { BLOCK_TYPE } from '../../../constants/block-constants';\nimport { NODE_CARD_STATES, TEACHER_MENU_LABELS } from '../../../constants/node-constants';\nimport { getNodeTypeBasedBgImage } from '../../../utils';\nimport { getNodeCardBasedIcon } from '../../../utils/node-card-utils';\nimport BorderPathAnimation from '../border-path-animation';\nimport * as Styled from '../node-card-styled';\nimport NodeCardTags from '../node-card-tags';\nimport NodeMenuOptions from '../node-menu-options/node-menu-options';\n\nconst { ASSIGN_AS_HW, REVIEW, VIEW, MARK_AS_DONE } = TEACHER_MENU_LABELS;\n\nconst TeacherActions: FC<Omit<INodeCardProps, 'userType'>> = memo(\n ({\n nodeData,\n imageHue,\n blockType,\n isSkipped,\n onNodeAttemptLocationChange,\n onNodeMarkAsDone,\n onNodeView,\n onNodeReview,\n }) => {\n const containerRef = useRef<HTMLDivElement>(null);\n\n const { menuVisible, onMenuClick } = useContextMenuClickHandler(containerRef);\n\n const {\n accuracy,\n attempt_location: attemptLocation,\n node_type: nodeType,\n card_header: cardHeader,\n title,\n state,\n is_optional: isOptional,\n sheet_statement: sheetStatement,\n permissions,\n } = nodeData;\n\n const {\n can_change_attempt_location: canChangeAttemptLocation,\n can_mark_familiar: canMarkFamiliar,\n can_review: canReview,\n } = permissions;\n\n const isGoalBlock = blockType === BLOCK_TYPE.GOAL;\n const sheetLocked = state === NODE_CARD_STATES.LOCKED;\n const sheetNotStarted = state === NODE_CARD_STATES.NOT_STARTED;\n const sheetInProgress = state === NODE_CARD_STATES.IN_PROGRESS;\n const inClassSheet = attemptLocation === 'INCLASS';\n const tooltipHidden = !sheetStatement || !isGoalBlock || sheetLocked;\n\n const showCardAnimation = !isOptional && (sheetInProgress || sheetNotStarted);\n\n const nodeBgImage = getNodeTypeBasedBgImage(nodeType);\n const NodeCardIcon = getNodeCardBasedIcon(nodeType);\n\n const handleOnMenuOptionClick = useCallback(\n (optionId: string) => {\n switch (optionId) {\n case 'node-card-view':\n if (canReview) {\n onNodeReview?.(nodeData);\n } else {\n onNodeView?.(nodeData);\n }\n\n return;\n\n case 'node-card-assign-as-hw':\n onNodeAttemptLocationChange?.(nodeData);\n\n return;\n\n case 'node-card-mark-as-done':\n onNodeMarkAsDone?.(nodeData);\n\n return;\n default:\n throw new Error(`No callback function for ${optionId}`);\n }\n },\n [\n canReview,\n nodeData,\n onNodeAttemptLocationChange,\n onNodeMarkAsDone,\n onNodeReview,\n onNodeView,\n ],\n );\n\n const menuOptions: INodeMenuOption[] = [\n {\n id: 'node-card-view',\n label: canReview ? REVIEW : VIEW,\n icon: Eye2Icon,\n disabled: false,\n onClick: handleOnMenuOptionClick,\n },\n {\n id: 'node-card-assign-as-hw',\n label: ASSIGN_AS_HW,\n icon: Home2Icon,\n disabled: !canChangeAttemptLocation || !inClassSheet,\n onClick: handleOnMenuOptionClick,\n },\n {\n id: 'node-card-mark-as-done',\n label: MARK_AS_DONE,\n icon: Check2Icon,\n disabled: !canMarkFamiliar,\n onClick: handleOnMenuOptionClick,\n },\n ];\n\n return (\n <Styled.NodeCardContainer\n $showOutline={!showCardAnimation}\n $isSheetLocked={sheetLocked}\n $background={`${imageHue}_2`}\n $disabled={Boolean(isSkipped)}\n >\n <ArrowTooltip\n renderAs=\"primary\"\n tooltipItem={sheetStatement}\n position=\"bottom\"\n zIndex={5}\n hidden={tooltipHidden}\n parentWidth=\"100%\"\n widthX={11.25}\n >\n <Styled.NodeCardInfoWrapper\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $width=\"100%\"\n $heightX={3.5}\n $bgImage={nodeBgImage}\n $gutterX={0.78125}\n $flexGap={8.5}\n >\n <Styled.IconWrapper\n $width={31}\n $height={31}\n $background=\"WHITE_1\"\n $position=\"relative\"\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $opacity={sheetLocked ? 0.5 : 1}\n >\n {NodeCardIcon && <NodeCardIcon width={20} height={20} />}\n {!isOptional && <Styled.StyledImportantIcon />}\n </Styled.IconWrapper>\n\n <Text $renderAs=\"ac4-black\" $color=\"BLACK\" $opacity={sheetLocked ? 0.5 : 1}>\n {cardHeader} {inClassSheet && `. CW`}\n </Text>\n\n <FlexView className=\"context-menu\">\n {isGoalBlock && (\n <Styled.NodeKebabMenuWrapper ref={containerRef} onClick={onMenuClick}>\n <MoreVerticalIcon width={16} height={16} />\n </Styled.NodeKebabMenuWrapper>\n )}\n </FlexView>\n\n {showCardAnimation && !isSkipped && <BorderPathAnimation />}\n </Styled.NodeCardInfoWrapper>\n\n <NodeCardTags nodeType={nodeType} state={state} accuracy={accuracy} />\n\n {!isGoalBlock && (\n <Styled.NodeCardContentWrapper\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $background=\"WHITE_1\"\n $flexGap={8}\n $heightX={4}\n $justifyContent=\"space-between\"\n >\n <Styled.NodeCardTitle\n $renderAs=\"ab3\"\n $color=\"BLACK_1\"\n $opacity={sheetLocked ? 0.5 : 1}\n >\n {title}\n </Styled.NodeCardTitle>\n\n <Styled.NodeKebabMenuWrapper ref={containerRef} onClick={onMenuClick}>\n <MoreVerticalIcon width={16} height={16} />\n </Styled.NodeKebabMenuWrapper>\n </Styled.NodeCardContentWrapper>\n )}\n </ArrowTooltip>\n\n <Styled.NodeMenuOptionsWrapper $visible={menuVisible}>\n <NodeMenuOptions options={menuOptions} />\n </Styled.NodeMenuOptionsWrapper>\n </Styled.NodeCardContainer>\n );\n },\n);\n\nexport default TeacherActions;\n"],"names":["ASSIGN_AS_HW","REVIEW","VIEW","MARK_AS_DONE","TEACHER_MENU_LABELS","TeacherActions","memo","nodeData","imageHue","blockType","isSkipped","onNodeAttemptLocationChange","onNodeMarkAsDone","onNodeView","onNodeReview","containerRef","useRef","menuVisible","onMenuClick","useContextMenuClickHandler","accuracy","attemptLocation","nodeType","cardHeader","title","state","isOptional","sheetStatement","permissions","canChangeAttemptLocation","canMarkFamiliar","canReview","isGoalBlock","BLOCK_TYPE","sheetLocked","NODE_CARD_STATES","sheetNotStarted","sheetInProgress","inClassSheet","tooltipHidden","showCardAnimation","nodeBgImage","getNodeTypeBasedBgImage","NodeCardIcon","getNodeCardBasedIcon","handleOnMenuOptionClick","useCallback","optionId","menuOptions","Eye2Icon","Home2Icon","Check2Icon","jsxs","Styled.NodeCardContainer","ArrowTooltip","Styled.NodeCardInfoWrapper","Styled.IconWrapper","jsx","Styled.StyledImportantIcon","Text","FlexView","Styled.NodeKebabMenuWrapper","MoreVerticalIcon","BorderPathAnimation","NodeCardTags","Styled.NodeCardContentWrapper","Styled.NodeCardTitle","Styled.NodeMenuOptionsWrapper","NodeMenuOptions"],"mappings":";;;;;;;;;;;;;;;;;;AAuBA,MAAM,EAAE,cAAAA,IAAc,QAAAC,IAAQ,MAAAC,IAAM,cAAAC,OAAiBC,GAE/CC,KAAuDC;AAAA,EAC3D,CAAC;AAAA,IACC,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,6BAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,EAAA,MACI;AACE,UAAAC,IAAeC,EAAuB,IAAI,GAE1C,EAAE,aAAAC,GAAa,aAAAC,EAAY,IAAIC,EAA2BJ,CAAY,GAEtE;AAAA,MACJ,UAAAK;AAAA,MACA,kBAAkBC;AAAA,MAClB,WAAWC;AAAA,MACX,aAAaC;AAAA,MACb,OAAAC;AAAA,MACA,OAAAC;AAAA,MACA,aAAaC;AAAA,MACb,iBAAiBC;AAAA,MACjB,aAAAC;AAAA,IACE,IAAArB,GAEE;AAAA,MACJ,6BAA6BsB;AAAA,MAC7B,mBAAmBC;AAAA,MACnB,YAAYC;AAAA,IACV,IAAAH,GAEEI,IAAcvB,MAAcwB,EAAW,MACvCC,IAAcT,MAAUU,EAAiB,QACzCC,IAAkBX,MAAUU,EAAiB,aAC7CE,IAAkBZ,MAAUU,EAAiB,aAC7CG,IAAejB,MAAoB,WACnCkB,IAAgB,CAACZ,KAAkB,CAACK,KAAeE,GAEnDM,IAAoB,CAACd,MAAeW,KAAmBD,IAEvDK,IAAcC,EAAwBpB,CAAQ,GAC9CqB,IAAeC,EAAqBtB,CAAQ,GAE5CuB,IAA0BC;A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A,oBACZ,UAAU;AAAA,oBACV,UAAU;AAAA,oBACV,iBAAgB;AAAA,oBAEhB,UAAA;AAAA,sBAAA,gBAAAR;AAAA,wBAACS;AAAAA,wBAAA;AAAA,0BACC,WAAU;AAAA,0BACV,QAAO;AAAA,0BACP,UAAUhC,IAAc,MAAM;AAAA,0BAE7B,UAAAV;AAAA,wBAAA;AAAA,sBACH;AAAA,sBAEC,gBAAAiC,EAAAI,GAAA,EAA4B,KAAK9C,GAAc,SAASG,GACvD,UAAA,gBAAAuC,EAACK,GAAiB,EAAA,OAAO,IAAI,QAAQ,GAAI,CAAA,GAC3C;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACF;AAAA,cAAA;AAAA,YAAA;AAAA,UAEJ;AAAA,UAEA,gBAAAL,EAACU,IAAA,EAA8B,UAAUlD,GACvC,UAAC,gBAAAwC,EAAAW,IAAA,EAAgB,SAASpB,EAAA,CAAa,EACzC,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;"}
|
1
|
+
{"version":3,"file":"teacher-actions.js","sources":["../../../../../../src/features/chapters-v2/comps/node-card/teacher-actions/teacher-actions.tsx"],"sourcesContent":["import type { INodeCardProps } from '../node-card-types';\nimport type { INodeMenuOption } from '../node-menu-options/node-menu-options-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useRef } from 'react';\n\nimport Check2Icon from '../../../../../assets/line-icons/icons/check2';\nimport Eye2Icon from '../../../../../assets/line-icons/icons/eye2';\nimport Home2Icon from '../../../../../assets/line-icons/icons/home2';\nimport MoreVerticalIcon from '../../../../../assets/line-icons/icons/more-vertical';\nimport ArrowTooltip from '../../../../ui/arrow-tooltip/arrow-tooltip';\nimport useContextMenuClickHandler from '../../../../ui/hooks/use-context-menu-click-handler';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { BLOCK_TYPE } from '../../../constants/block-constants';\nimport { NODE_CARD_STATES, TEACHER_MENU_LABELS } from '../../../constants/node-constants';\nimport { getNodeTypeBasedBgImage } from '../../../utils';\nimport { getNodeCardBasedIcon } from '../../../utils/node-card-utils';\nimport BorderPathAnimation from '../border-path-animation';\nimport * as Styled from '../node-card-styled';\nimport NodeCardTags from '../node-card-tags';\nimport NodeMenuOptions from '../node-menu-options/node-menu-options';\n\nconst { ASSIGN_AS_HW, REVIEW, VIEW, MARK_AS_DONE } = TEACHER_MENU_LABELS;\n\nconst TeacherActions: FC<Omit<INodeCardProps, 'userType'>> = memo(\n ({\n nodeData,\n imageHue,\n blockType,\n isSkipped,\n onNodeAttemptLocationChange,\n onNodeMarkAsDone,\n onNodeView,\n onNodeReview,\n }) => {\n const containerRef = useRef<HTMLDivElement>(null);\n\n const { menuVisible, onMenuClick } = useContextMenuClickHandler(containerRef);\n\n const {\n accuracy,\n attempt_location: attemptLocation,\n node_type: nodeType,\n card_header: cardHeader,\n title,\n state,\n is_optional: isOptional,\n sheet_statement: sheetStatement,\n permissions,\n } = nodeData;\n\n const {\n can_change_attempt_location: canChangeAttemptLocation,\n can_mark_familiar: canMarkFamiliar,\n can_review: canReview,\n } = permissions;\n\n const isGoalBlock = blockType === BLOCK_TYPE.GOAL;\n const sheetLocked = state === NODE_CARD_STATES.LOCKED;\n const sheetNotStarted = state === NODE_CARD_STATES.NOT_STARTED;\n const sheetInProgress = state === NODE_CARD_STATES.IN_PROGRESS;\n const inClassSheet = attemptLocation === 'INCLASS';\n const tooltipHidden = !sheetStatement || !isGoalBlock;\n\n const showCardAnimation = !isOptional && (sheetInProgress || sheetNotStarted);\n\n const nodeBgImage = getNodeTypeBasedBgImage(nodeType);\n const NodeCardIcon = getNodeCardBasedIcon(nodeType);\n\n const handleOnMenuOptionClick = useCallback(\n (optionId: string) => {\n switch (optionId) {\n case 'node-card-view':\n if (canReview) {\n onNodeReview?.(nodeData);\n } else {\n onNodeView?.(nodeData);\n }\n\n return;\n\n case 'node-card-assign-as-hw':\n onNodeAttemptLocationChange?.(nodeData);\n\n return;\n\n case 'node-card-mark-as-done':\n onNodeMarkAsDone?.(nodeData);\n\n return;\n default:\n throw new Error(`No callback function for ${optionId}`);\n }\n },\n [\n canReview,\n nodeData,\n onNodeAttemptLocationChange,\n onNodeMarkAsDone,\n onNodeReview,\n onNodeView,\n ],\n );\n\n const menuOptions: INodeMenuOption[] = [\n {\n id: 'node-card-view',\n label: canReview ? REVIEW : VIEW,\n icon: Eye2Icon,\n disabled: false,\n onClick: handleOnMenuOptionClick,\n },\n {\n id: 'node-card-assign-as-hw',\n label: ASSIGN_AS_HW,\n icon: Home2Icon,\n disabled: !canChangeAttemptLocation || !inClassSheet,\n onClick: handleOnMenuOptionClick,\n },\n {\n id: 'node-card-mark-as-done',\n label: MARK_AS_DONE,\n icon: Check2Icon,\n disabled: !canMarkFamiliar,\n onClick: handleOnMenuOptionClick,\n },\n ];\n\n return (\n <Styled.NodeCardContainer\n $showOutline={!showCardAnimation}\n $isSheetLocked={sheetLocked}\n $background={`${imageHue}_2`}\n $disabled={Boolean(isSkipped)}\n >\n <ArrowTooltip\n renderAs=\"primary\"\n tooltipItem={sheetStatement}\n position=\"bottom\"\n zIndex={5}\n hidden={tooltipHidden}\n parentWidth=\"100%\"\n widthX={11.25}\n >\n <Styled.NodeCardInfoWrapper\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $width=\"100%\"\n $heightX={3.5}\n $bgImage={nodeBgImage}\n $gutterX={0.78125}\n $flexGap={8.5}\n >\n <Styled.IconWrapper\n $width={31}\n $height={31}\n $background=\"WHITE_1\"\n $position=\"relative\"\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $opacity={sheetLocked ? 0.5 : 1}\n >\n {NodeCardIcon && <NodeCardIcon width={20} height={20} />}\n {!isOptional && <Styled.StyledImportantIcon />}\n </Styled.IconWrapper>\n\n <Text $renderAs=\"ac4-black\" $color=\"BLACK\" $opacity={sheetLocked ? 0.5 : 1}>\n {cardHeader} {inClassSheet && `. CW`}\n </Text>\n\n <FlexView className=\"context-menu\">\n {isGoalBlock && (\n <Styled.NodeKebabMenuWrapper ref={containerRef} onClick={onMenuClick}>\n <MoreVerticalIcon width={16} height={16} />\n </Styled.NodeKebabMenuWrapper>\n )}\n </FlexView>\n\n {showCardAnimation && !isSkipped && <BorderPathAnimation />}\n </Styled.NodeCardInfoWrapper>\n\n <NodeCardTags nodeType={nodeType} state={state} accuracy={accuracy} />\n\n {!isGoalBlock && (\n <Styled.NodeCardContentWrapper\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $background=\"WHITE_1\"\n $flexGap={8}\n $heightX={4}\n $justifyContent=\"space-between\"\n >\n <Styled.NodeCardTitle\n $renderAs=\"ab3\"\n $color=\"BLACK_1\"\n $opacity={sheetLocked ? 0.5 : 1}\n >\n {title}\n </Styled.NodeCardTitle>\n\n <Styled.NodeKebabMenuWrapper ref={containerRef} onClick={onMenuClick}>\n <MoreVerticalIcon width={16} height={16} />\n </Styled.NodeKebabMenuWrapper>\n </Styled.NodeCardContentWrapper>\n )}\n </ArrowTooltip>\n\n <Styled.NodeMenuOptionsWrapper $visible={menuVisible}>\n <NodeMenuOptions options={menuOptions} />\n </Styled.NodeMenuOptionsWrapper>\n </Styled.NodeCardContainer>\n );\n },\n);\n\nexport default TeacherActions;\n"],"names":["ASSIGN_AS_HW","REVIEW","VIEW","MARK_AS_DONE","TEACHER_MENU_LABELS","TeacherActions","memo","nodeData","imageHue","blockType","isSkipped","onNodeAttemptLocationChange","onNodeMarkAsDone","onNodeView","onNodeReview","containerRef","useRef","menuVisible","onMenuClick","useContextMenuClickHandler","accuracy","attemptLocation","nodeType","cardHeader","title","state","isOptional","sheetStatement","permissions","canChangeAttemptLocation","canMarkFamiliar","canReview","isGoalBlock","BLOCK_TYPE","sheetLocked","NODE_CARD_STATES","sheetNotStarted","sheetInProgress","inClassSheet","tooltipHidden","showCardAnimation","nodeBgImage","getNodeTypeBasedBgImage","NodeCardIcon","getNodeCardBasedIcon","handleOnMenuOptionClick","useCallback","optionId","menuOptions","Eye2Icon","Home2Icon","Check2Icon","jsxs","Styled.NodeCardContainer","ArrowTooltip","Styled.NodeCardInfoWrapper","Styled.IconWrapper","jsx","Styled.StyledImportantIcon","Text","FlexView","Styled.NodeKebabMenuWrapper","MoreVerticalIcon","BorderPathAnimation","NodeCardTags","Styled.NodeCardContentWrapper","Styled.NodeCardTitle","Styled.NodeMenuOptionsWrapper","NodeMenuOptions"],"mappings":";;;;;;;;;;;;;;;;;;AAuBA,MAAM,EAAE,cAAAA,IAAc,QAAAC,IAAQ,MAAAC,IAAM,cAAAC,OAAiBC,GAE/CC,KAAuDC;AAAA,EAC3D,CAAC;AAAA,IACC,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,6BAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,EAAA,MACI;AACE,UAAAC,IAAeC,EAAuB,IAAI,GAE1C,EAAE,aAAAC,GAAa,aAAAC,EAAY,IAAIC,EAA2BJ,CAAY,GAEtE;AAAA,MACJ,UAAAK;AAAA,MACA,kBAAkBC;AAAA,MAClB,WAAWC;AAAA,MACX,aAAaC;AAAA,MACb,OAAAC;AAAA,MACA,OAAAC;AAAA,MACA,aAAaC;AAAA,MACb,iBAAiBC;AAAA,MACjB,aAAAC;AAAA,IACE,IAAArB,GAEE;AAAA,MACJ,6BAA6BsB;AAAA,MAC7B,mBAAmBC;AAAA,MACnB,YAAYC;AAAA,IACV,IAAAH,GAEEI,IAAcvB,MAAcwB,EAAW,MACvCC,IAAcT,MAAUU,EAAiB,QACzCC,IAAkBX,MAAUU,EAAiB,aAC7CE,IAAkBZ,MAAUU,EAAiB,aAC7CG,IAAejB,MAAoB,WACnCkB,IAAgB,CAACZ,KAAkB,CAACK,GAEpCQ,IAAoB,CAACd,MAAeW,KAAmBD,IAEvDK,IAAcC,EAAwBpB,CAAQ,GAC9CqB,IAAeC,EAAqBtB,CAAQ,GAE5CuB,IAA0BC;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AA,oBACZ,UAAU;AAAA,oBACV,UAAU;AAAA,oBACV,iBAAgB;AAAA,oBAEhB,UAAA;AAAA,sBAAA,gBAAAR;AAAA,wBAACS;AAAAA,wBAAA;AAAA,0BACC,WAAU;AAAA,0BACV,QAAO;AAAA,0BACP,UAAUhC,IAAc,MAAM;AAAA,0BAE7B,UAAAV;AAAA,wBAAA;AAAA,sBACH;AAAA,sBAEC,gBAAAiC,EAAAI,GAAA,EAA4B,KAAK9C,GAAc,SAASG,GACvD,UAAA,gBAAAuC,EAACK,GAAiB,EAAA,OAAO,IAAI,QAAQ,GAAI,CAAA,GAC3C;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACF;AAAA,cAAA;AAAA,YAAA;AAAA,UAEJ;AAAA,UAEA,gBAAAL,EAACU,IAAA,EAA8B,UAAUlD,GACvC,UAAC,gBAAAwC,EAAAW,IAAA,EAAgB,SAASpB,EAAA,CAAa,EACzC,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;"}
|
@@ -1,76 +1,83 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { h as
|
3
|
-
import { useRef as
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import { getTopicsFromItems as
|
7
|
-
import
|
8
|
-
import
|
1
|
+
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
2
|
+
import { h as Z } from "../../../node_modules/humanize-plus/dist/humanize.js";
|
3
|
+
import { useRef as D, useState as l, useCallback as n, useEffect as u } from "react";
|
4
|
+
import J from "../../../assets/line-icons/icons/chevron-left.js";
|
5
|
+
import ee from "../../../assets/line-icons/icons/chevron-right.js";
|
6
|
+
import { getTopicsFromItems as te } from "../../milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-utils.js";
|
7
|
+
import c from "../../ui/layout/flex-view.js";
|
8
|
+
import m from "../../ui/text/text.js";
|
9
9
|
import oe from "../homework-card.js";
|
10
10
|
import { useGetHomeworks as re } from "./api/get-homeworks.js";
|
11
|
-
import { HoverZone as
|
11
|
+
import { HoverZone as k, ScrollButton as _, ScrollContainer as ne } from "./hw-card-list-styled.js";
|
12
12
|
const ie = ({
|
13
|
-
userType:
|
14
|
-
studentId:
|
15
|
-
stream:
|
13
|
+
userType: b = "STUDENT",
|
14
|
+
studentId: p,
|
15
|
+
stream: $,
|
16
16
|
onTestStart: w,
|
17
17
|
onNodeAttempt: x,
|
18
18
|
onTestPreview: R,
|
19
19
|
onNodeView: S,
|
20
|
-
onTestReview:
|
21
|
-
onNodeReview:
|
22
|
-
onNodeUnassign:
|
20
|
+
onTestReview: T,
|
21
|
+
onNodeReview: A,
|
22
|
+
onNodeUnassign: E
|
23
23
|
}) => {
|
24
|
-
const
|
25
|
-
|
26
|
-
}, []),
|
27
|
-
|
28
|
-
}, []),
|
29
|
-
$(!0);
|
30
|
-
}, []), G = r(() => {
|
31
|
-
$(!1);
|
32
|
-
}, []), K = r(() => {
|
24
|
+
const r = D(null), [I, g] = l(!1), [y, v] = l(!1), [B, M] = l(!1), [N, j] = l(!0), { get: L, data: e, isProcessingFailed: K } = re(), z = n(() => {
|
25
|
+
r.current && r.current.scrollBy({ left: -200, behavior: "smooth" });
|
26
|
+
}, []), G = n(() => {
|
27
|
+
r.current && r.current.scrollBy({ left: 200, behavior: "smooth" });
|
28
|
+
}, []), W = n(() => {
|
33
29
|
g(!0);
|
34
|
-
}, []),
|
30
|
+
}, []), F = n(() => {
|
35
31
|
g(!1);
|
36
|
-
}, []),
|
37
|
-
|
38
|
-
|
39
|
-
|
32
|
+
}, []), X = n(() => {
|
33
|
+
v(!0);
|
34
|
+
}, []), O = n(() => {
|
35
|
+
v(!1);
|
36
|
+
}, []), i = n(() => {
|
37
|
+
if (r.current) {
|
38
|
+
const { scrollLeft: o, scrollWidth: h, clientWidth: a } = r.current;
|
39
|
+
M(o > 10), j(o < h - a - 10);
|
40
40
|
}
|
41
41
|
}, []);
|
42
|
-
|
43
|
-
const
|
44
|
-
if (
|
45
|
-
return
|
46
|
-
|
42
|
+
u(() => {
|
43
|
+
const o = r.current;
|
44
|
+
if (o)
|
45
|
+
return o.addEventListener("scroll", i), i(), () => {
|
46
|
+
o.removeEventListener("scroll", i);
|
47
47
|
};
|
48
|
-
}, [i]),
|
48
|
+
}, [i]), u(() => {
|
49
49
|
i();
|
50
|
-
}, [
|
51
|
-
const
|
52
|
-
|
53
|
-
}, [
|
54
|
-
return
|
55
|
-
|
56
|
-
}, [
|
57
|
-
/* @__PURE__ */
|
50
|
+
}, [e, i]);
|
51
|
+
const C = n(() => {
|
52
|
+
L(p, void 0, { stream: $ });
|
53
|
+
}, [L, $, p]);
|
54
|
+
return u(() => {
|
55
|
+
C();
|
56
|
+
}, [C]), e && e.length === 0 ? /* @__PURE__ */ s(c, { $flexRowGapX: 1, children: [
|
57
|
+
/* @__PURE__ */ s(m, { $renderAs: "ac4-black", $color: "BLACK_T_60", children: [
|
58
58
|
"Homework (",
|
59
|
-
|
59
|
+
e == null ? void 0 : e.length,
|
60
60
|
")"
|
61
61
|
] }),
|
62
|
-
/* @__PURE__ */
|
63
|
-
|
64
|
-
|
62
|
+
/* @__PURE__ */ t(m, { $renderAs: "ab2", $color: "BLACK_T_60", children: "No Homework assigned yet" })
|
63
|
+
] }) : K ? null : /* @__PURE__ */ s(c, { $flexRowGapX: 1, children: [
|
64
|
+
/* @__PURE__ */ s(m, { $renderAs: "ac4-black", $color: "BLACK_T_60", children: [
|
65
|
+
"Homework (",
|
66
|
+
e == null ? void 0 : e.length,
|
67
|
+
")"
|
68
|
+
] }),
|
69
|
+
/* @__PURE__ */ s(c, { $position: "relative", onMouseEnter: i, children: [
|
70
|
+
B && /* @__PURE__ */ t(
|
71
|
+
k,
|
65
72
|
{
|
66
73
|
$position: "absolute",
|
67
74
|
$width: "60px",
|
68
75
|
left: "0",
|
69
76
|
right: "auto",
|
70
|
-
onMouseEnter:
|
71
|
-
onMouseLeave:
|
77
|
+
onMouseEnter: W,
|
78
|
+
onMouseLeave: F,
|
72
79
|
children: /* @__PURE__ */ t(
|
73
|
-
|
80
|
+
_,
|
74
81
|
{
|
75
82
|
$position: "absolute",
|
76
83
|
$background: "BLACK_T_60",
|
@@ -81,49 +88,49 @@ const ie = ({
|
|
81
88
|
$visible: I,
|
82
89
|
left: "0px",
|
83
90
|
right: "auto",
|
84
|
-
children: /* @__PURE__ */ t(
|
91
|
+
children: /* @__PURE__ */ t(J, { width: 24, height: 24 })
|
85
92
|
}
|
86
93
|
)
|
87
94
|
},
|
88
95
|
"left-hover-zone"
|
89
96
|
),
|
90
|
-
/* @__PURE__ */ t(ne, { ref:
|
97
|
+
/* @__PURE__ */ t(ne, { ref: r, children: /* @__PURE__ */ t(c, { $flexDirection: "row", $flexGapX: 1, children: e == null ? void 0 : e.map((o, h) => {
|
91
98
|
const {
|
92
|
-
items:
|
93
|
-
node_id:
|
94
|
-
sheet_time:
|
95
|
-
total_questions:
|
96
|
-
worksheet_id:
|
97
|
-
node_type:
|
98
|
-
} =
|
99
|
+
items: a,
|
100
|
+
node_id: P,
|
101
|
+
sheet_time: H,
|
102
|
+
total_questions: d,
|
103
|
+
worksheet_id: Q,
|
104
|
+
node_type: V
|
105
|
+
} = o, q = H && Math.ceil(H / 60) || 0, U = te(a).join(", "), Y = `${typeof d == "number" ? `${d} ${Z.pluralize(d, "Question")}, ` : ""}${q} Mins`, f = V === "DYNAMIC";
|
99
106
|
return /* @__PURE__ */ t(
|
100
107
|
oe,
|
101
108
|
{
|
102
|
-
userType:
|
103
|
-
header:
|
104
|
-
subHeader:
|
105
|
-
nodeData:
|
109
|
+
userType: b,
|
110
|
+
header: U,
|
111
|
+
subHeader: Y,
|
112
|
+
nodeData: o,
|
106
113
|
renderAs: "homework",
|
107
|
-
onNodeAttempt:
|
114
|
+
onNodeAttempt: f ? w : x,
|
108
115
|
shouldOpenOnRight: !1,
|
109
|
-
onNodeView:
|
110
|
-
onNodeReview:
|
111
|
-
onNodeUnassign:
|
116
|
+
onNodeView: f ? R : S,
|
117
|
+
onNodeReview: f ? T : A,
|
118
|
+
onNodeUnassign: E
|
112
119
|
},
|
113
|
-
`${
|
120
|
+
`${Q}_${P}_${h}`
|
114
121
|
);
|
115
122
|
}) }) }),
|
116
|
-
|
117
|
-
|
123
|
+
N && /* @__PURE__ */ t(
|
124
|
+
k,
|
118
125
|
{
|
119
126
|
$position: "absolute",
|
120
127
|
$width: "60px",
|
121
128
|
right: "0",
|
122
129
|
left: "auto",
|
123
|
-
onMouseEnter:
|
124
|
-
onMouseLeave:
|
130
|
+
onMouseEnter: X,
|
131
|
+
onMouseLeave: O,
|
125
132
|
children: /* @__PURE__ */ t(
|
126
|
-
|
133
|
+
_,
|
127
134
|
{
|
128
135
|
$position: "absolute",
|
129
136
|
$width: "60px",
|
@@ -131,11 +138,11 @@ const ie = ({
|
|
131
138
|
$background: "BLACK_T_60",
|
132
139
|
$justifyContent: "center",
|
133
140
|
$alignItems: "center",
|
134
|
-
onClick:
|
135
|
-
$visible:
|
141
|
+
onClick: G,
|
142
|
+
$visible: y,
|
136
143
|
left: "auto",
|
137
144
|
right: "0px",
|
138
|
-
children: /* @__PURE__ */ t(
|
145
|
+
children: /* @__PURE__ */ t(ee, { width: 24, height: 24 })
|
139
146
|
}
|
140
147
|
)
|
141
148
|
},
|
@@ -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 { TUserTypes } from '../../ui/types';\n\nimport { pluralize } from 'humanize-plus';\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 { getTopicsFromItems } from '../../milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-utils';\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) => void;\n onTestReview?: (sheetData: INodeDataProps, milestoneId?: string) => void;\n}\n\nconst HWCardList: React.FC<HWCardListProps> = ({\n userType = 'STUDENT',\n studentId,\n stream,\n onTestStart,\n onNodeAttempt,\n onTestPreview,\n onNodeView,\n onTestReview,\n onNodeReview,\n onNodeUnassign,\n}) => {\n const scrollRef = useRef<HTMLDivElement>(null);\n const [isLeftHovered, setIsLeftHovered] = useState(false);\n const [isRightHovered, setIsRightHovered] = useState(false);\n const [canScrollLeft, setCanScrollLeft] = useState(false);\n const [canScrollRight, setCanScrollRight] = useState(true);\n const { get: getHomeworks, data: hwDetails, isProcessingFailed } = useGetHomeworks();\n\n const handleScrollLeft = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: -200, behavior: 'smooth' });\n }\n }, []);\n\n const handleScrollRight = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: 200, behavior: 'smooth' });\n }\n }, []);\n\n const handleLeftHoverEnter = useCallback(() => {\n setIsLeftHovered(true);\n }, []);\n\n const handleLeftHoverLeave = useCallback(() => {\n setIsLeftHovered(false);\n }, []);\n\n const handleRightHoverEnter = useCallback(() => {\n setIsRightHovered(true);\n }, []);\n\n const handleRightHoverLeave = useCallback(() => {\n setIsRightHovered(false);\n }, []);\n\n // Function to check scroll position and update button availability\n const checkScrollPosition = useCallback(() => {\n if (scrollRef.current) {\n const { scrollLeft, scrollWidth, clientWidth } = scrollRef.current;\n\n // Can scroll left if scrolled to the right\n setCanScrollLeft(scrollLeft > 10);\n\n // Can scroll right if not at the end\n setCanScrollRight(scrollLeft < scrollWidth - clientWidth - 10);\n }\n }, []);\n\n // Add scroll event listener to check scroll position\n useEffect(() => {\n const scrollElement = scrollRef.current;\n\n if (scrollElement) {\n scrollElement.addEventListener('scroll', checkScrollPosition);\n // Run once on mount to set initial button states\n checkScrollPosition();\n\n return () => {\n scrollElement.removeEventListener('scroll', checkScrollPosition);\n };\n }\n }, [checkScrollPosition]);\n\n // Also check when content changes\n useEffect(() => {\n checkScrollPosition();\n }, [hwDetails, checkScrollPosition]);\n\n const fetchChapterDetails = useCallback(() => {\n getHomeworks(studentId, undefined, { stream });\n }, [getHomeworks, stream, studentId]);\n\n useEffect(() => {\n fetchChapterDetails();\n }, [fetchChapterDetails]);\n\n if (isProcessingFailed) {\n return null;\n }\n\n return (\n <FlexView $flexRowGapX={1}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Homework ({hwDetails?.length})\n </Text>\n <FlexView $position=\"relative\" onMouseEnter={checkScrollPosition}>\n {/* Left hover zone */}\n {canScrollLeft && (\n <Styled.HoverZone\n key=\"left-hover-zone\"\n $position=\"absolute\"\n $width=\"60px\"\n left=\"0\"\n right=\"auto\"\n onMouseEnter={handleLeftHoverEnter}\n onMouseLeave={handleLeftHoverLeave}\n >\n {/* Left scroll button - only visible when hovered */}\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 </Styled.HoverZone>\n )}\n\n <Styled.ScrollContainer ref={scrollRef}>\n <FlexView $flexDirection=\"row\" $flexGapX={1}>\n {hwDetails?.map((sheet, idx) => {\n const {\n items,\n node_id: nodeId,\n sheet_time: sheetTime,\n total_questions: totalQuestions,\n worksheet_id: worksheetId,\n node_type: nodeType,\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 const isTestSheet = nodeType === 'DYNAMIC';\n\n return (\n <HomeworkCard\n key={`${worksheetId}_${nodeId}_${idx}`}\n userType={userType}\n header={testChapterName}\n subHeader={subHeader}\n nodeData={sheet}\n renderAs=\"homework\"\n onNodeAttempt={isTestSheet ? onTestStart : onNodeAttempt}\n shouldOpenOnRight={false}\n onNodeView={isTestSheet ? onTestPreview : onNodeView}\n onNodeReview={isTestSheet ? onTestReview : onNodeReview}\n onNodeUnassign={onNodeUnassign}\n />\n );\n })}\n </FlexView>\n </Styled.ScrollContainer>\n\n {/* Right hover zone */}\n {canScrollRight && (\n <Styled.HoverZone\n key=\"right-hover-zone\"\n $position=\"absolute\"\n $width=\"60px\"\n right=\"0\"\n left=\"auto\"\n onMouseEnter={handleRightHoverEnter}\n onMouseLeave={handleRightHoverLeave}\n >\n {/* Right scroll button - only visible when hovered */}\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 </Styled.HoverZone>\n )}\n </FlexView>\n </FlexView>\n );\n};\n\nexport default HWCardList;\n"],"names":["HWCardList","userType","studentId","stream","onTestStart","onNodeAttempt","onTestPreview","onNodeView","onTestReview","onNodeReview","onNodeUnassign","scrollRef","useRef","isLeftHovered","setIsLeftHovered","useState","isRightHovered","setIsRightHovered","canScrollLeft","setCanScrollLeft","canScrollRight","setCanScrollRight","getHomeworks","hwDetails","isProcessingFailed","useGetHomeworks","handleScrollLeft","useCallback","handleScrollRight","handleLeftHoverEnter","handleLeftHoverLeave","handleRightHoverEnter","handleRightHoverLeave","checkScrollPosition","scrollLeft","scrollWidth","clientWidth","useEffect","scrollElement","fetchChapterDetails","jsxs","FlexView","Text","jsx","Styled.HoverZone","Styled.ScrollButton","ChevronLeftIcon","Styled.ScrollContainer","sheet","idx","items","nodeId","sheetTime","totalQuestions","worksheetId","nodeType","totalSheetTime","testChapterName","getTopicsFromItems","subHeader","pluralize","isTestSheet","HomeworkCard","ChevronRightIcon","HWCardList$1"],"mappings":";;;;;;;;;;;AA2BA,MAAMA,KAAwC,CAAC;AAAA,EAC7C,UAAAC,IAAW;AAAA,EACX,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;AACF,MAAM;AACE,QAAAC,IAAYC,EAAuB,IAAI,GACvC,CAACC,GAAeC,CAAgB,IAAIC,EAAS,EAAK,GAClD,CAACC,GAAgBC,CAAiB,IAAIF,EAAS,EAAK,GACpD,CAACG,GAAeC,CAAgB,IAAIJ,EAAS,EAAK,GAClD,CAACK,GAAgBC,CAAiB,IAAIN,EAAS,EAAI,GACnD,EAAE,KAAKO,GAAc,MAAMC,GAAW,oBAAAC,EAAA,IAAuBC,MAE7DC,IAAmBC,EAAY,MAAM;AACzC,IAAIhB,EAAU,WACZA,EAAU,QAAQ,SAAS,EAAE,MAAM,MAAM,UAAU,UAAU;AAAA,EAEjE,GAAG,CAAE,CAAA,GAECiB,IAAoBD,EAAY,MAAM;AAC1C,IAAIhB,EAAU,WACZA,EAAU,QAAQ,SAAS,EAAE,MAAM,KAAK,UAAU,UAAU;AAAA,EAEhE,GAAG,CAAE,CAAA,GAECkB,IAAuBF,EAAY,MAAM;AAC7C,IAAAb,EAAiB,EAAI;AAAA,EACvB,GAAG,CAAE,CAAA,GAECgB,IAAuBH,EAAY,MAAM;AAC7C,IAAAb,EAAiB,EAAK;AA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AAA,YAC3C,mBAAmB;AAAA,YACnB,YAAYwD,IAAcvD,IAAgBC;AAAA,YAC1C,cAAcsD,IAAcrD,IAAeC;AAAA,YAC3C,gBAAAC;AAAA,UAAA;AAAA,UAVK,GAAG4C,CAAW,IAAIH,CAAM,IAAIF,CAAG;AAAA,QAAA;AAAA,MAWtC,IAGN,EACF,CAAA;AAAA,MAGC7B,KACC,gBAAAuB;AAAA,QAACC;AAAAA,QAAA;AAAA,UAEC,WAAU;AAAA,UACV,QAAO;AAAA,UACP,OAAM;AAAA,UACN,MAAK;AAAA,UACL,cAAcb;AAAA,UACd,cAAcC;AAAA,UAGd,UAAA,gBAAAW;AAAA,YAACE;AAAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,QAAO;AAAA,cACP,SAAQ;AAAA,cACR,aAAY;AAAA,cACZ,iBAAgB;AAAA,cAChB,aAAY;AAAA,cACZ,SAASjB;AAAA,cACT,UAAUZ;AAAA,cACV,MAAK;AAAA,cACL,OAAM;AAAA,cAEN,UAAC,gBAAA2B,EAAAoB,GAAA,EAAiB,OAAO,IAAI,QAAQ,IAAI;AAAA,YAAA;AAAA,UAC3C;AAAA,QAAA;AAAA,QAtBI;AAAA,MAuBN;AAAA,IAAA,GAEJ;AAAA,EACF,EAAA,CAAA;AAEJ,GAEAC,KAAehE;"}
|
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 { TUserTypes } from '../../ui/types';\n\nimport { pluralize } from 'humanize-plus';\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 { getTopicsFromItems } from '../../milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-utils';\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) => void;\n onTestReview?: (sheetData: INodeDataProps, milestoneId?: string) => void;\n}\n\nconst HWCardList: React.FC<HWCardListProps> = ({\n userType = 'STUDENT',\n studentId,\n stream,\n onTestStart,\n onNodeAttempt,\n onTestPreview,\n onNodeView,\n onTestReview,\n onNodeReview,\n onNodeUnassign,\n}) => {\n const scrollRef = useRef<HTMLDivElement>(null);\n const [isLeftHovered, setIsLeftHovered] = useState(false);\n const [isRightHovered, setIsRightHovered] = useState(false);\n const [canScrollLeft, setCanScrollLeft] = useState(false);\n const [canScrollRight, setCanScrollRight] = useState(true);\n const { get: getHomeworks, data: hwDetails, isProcessingFailed } = useGetHomeworks();\n\n const handleScrollLeft = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: -200, behavior: 'smooth' });\n }\n }, []);\n\n const handleScrollRight = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: 200, behavior: 'smooth' });\n }\n }, []);\n\n const handleLeftHoverEnter = useCallback(() => {\n setIsLeftHovered(true);\n }, []);\n\n const handleLeftHoverLeave = useCallback(() => {\n setIsLeftHovered(false);\n }, []);\n\n const handleRightHoverEnter = useCallback(() => {\n setIsRightHovered(true);\n }, []);\n\n const handleRightHoverLeave = useCallback(() => {\n setIsRightHovered(false);\n }, []);\n\n // Function to check scroll position and update button availability\n const checkScrollPosition = useCallback(() => {\n if (scrollRef.current) {\n const { scrollLeft, scrollWidth, clientWidth } = scrollRef.current;\n\n // Can scroll left if scrolled to the right\n setCanScrollLeft(scrollLeft > 10);\n\n // Can scroll right if not at the end\n setCanScrollRight(scrollLeft < scrollWidth - clientWidth - 10);\n }\n }, []);\n\n // Add scroll event listener to check scroll position\n useEffect(() => {\n const scrollElement = scrollRef.current;\n\n if (scrollElement) {\n scrollElement.addEventListener('scroll', checkScrollPosition);\n // Run once on mount to set initial button states\n checkScrollPosition();\n\n return () => {\n scrollElement.removeEventListener('scroll', checkScrollPosition);\n };\n }\n }, [checkScrollPosition]);\n\n // Also check when content changes\n useEffect(() => {\n checkScrollPosition();\n }, [hwDetails, checkScrollPosition]);\n\n const fetchChapterDetails = useCallback(() => {\n getHomeworks(studentId, undefined, { stream });\n }, [getHomeworks, stream, studentId]);\n\n useEffect(() => {\n fetchChapterDetails();\n }, [fetchChapterDetails]);\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 <FlexView $flexRowGapX={1}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Homework ({hwDetails?.length})\n </Text>\n <FlexView $position=\"relative\" onMouseEnter={checkScrollPosition}>\n {/* Left hover zone */}\n {canScrollLeft && (\n <Styled.HoverZone\n key=\"left-hover-zone\"\n $position=\"absolute\"\n $width=\"60px\"\n left=\"0\"\n right=\"auto\"\n onMouseEnter={handleLeftHoverEnter}\n onMouseLeave={handleLeftHoverLeave}\n >\n {/* Left scroll button - only visible when hovered */}\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 </Styled.HoverZone>\n )}\n\n <Styled.ScrollContainer ref={scrollRef}>\n <FlexView $flexDirection=\"row\" $flexGapX={1}>\n {hwDetails?.map((sheet, idx) => {\n const {\n items,\n node_id: nodeId,\n sheet_time: sheetTime,\n total_questions: totalQuestions,\n worksheet_id: worksheetId,\n node_type: nodeType,\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 const isTestSheet = nodeType === 'DYNAMIC';\n\n return (\n <HomeworkCard\n key={`${worksheetId}_${nodeId}_${idx}`}\n userType={userType}\n header={testChapterName}\n subHeader={subHeader}\n nodeData={sheet}\n renderAs=\"homework\"\n onNodeAttempt={isTestSheet ? onTestStart : onNodeAttempt}\n shouldOpenOnRight={false}\n onNodeView={isTestSheet ? onTestPreview : onNodeView}\n onNodeReview={isTestSheet ? onTestReview : onNodeReview}\n onNodeUnassign={onNodeUnassign}\n />\n );\n })}\n </FlexView>\n </Styled.ScrollContainer>\n\n {/* Right hover zone */}\n {canScrollRight && (\n <Styled.HoverZone\n key=\"right-hover-zone\"\n $position=\"absolute\"\n $width=\"60px\"\n right=\"0\"\n left=\"auto\"\n onMouseEnter={handleRightHoverEnter}\n onMouseLeave={handleRightHoverLeave}\n >\n {/* Right scroll button - only visible when hovered */}\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 </Styled.HoverZone>\n )}\n </FlexView>\n </FlexView>\n );\n};\n\nexport default HWCardList;\n"],"names":["HWCardList","userType","studentId","stream","onTestStart","onNodeAttempt","onTestPreview","onNodeView","onTestReview","onNodeReview","onNodeUnassign","scrollRef","useRef","isLeftHovered","setIsLeftHovered","useState","isRightHovered","setIsRightHovered","canScrollLeft","setCanScrollLeft","canScrollRight","setCanScrollRight","getHomeworks","hwDetails","isProcessingFailed","useGetHomeworks","handleScrollLeft","useCallback","handleScrollRight","handleLeftHoverEnter","handleLeftHoverLeave","handleRightHoverEnter","handleRightHoverLeave","checkScrollPosition","scrollLeft","scrollWidth","clientWidth","useEffect","scrollElement","fetchChapterDetails","jsxs","FlexView","Text","jsx","Styled.HoverZone","Styled.ScrollButton","ChevronLeftIcon","Styled.ScrollContainer","sheet","idx","items","nodeId","sheetTime","totalQuestions","worksheetId","nodeType","totalSheetTime","testChapterName","getTopicsFromItems","subHeader","pluralize","isTestSheet","HomeworkCard","ChevronRightIcon","HWCardList$1"],"mappings":";;;;;;;;;;;AA2BA,MAAMA,KAAwC,CAAC;AAAA,EAC7C,UAAAC,IAAW;AAAA,EACX,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;AACF,MAAM;AACE,QAAAC,IAAYC,EAAuB,IAAI,GACvC,CAACC,GAAeC,CAAgB,IAAIC,EAAS,EAAK,GAClD,CAACC,GAAgBC,CAAiB,IAAIF,EAAS,EAAK,GACpD,CAACG,GAAeC,CAAgB,IAAIJ,EAAS,EAAK,GAClD,CAACK,GAAgBC,CAAiB,IAAIN,EAAS,EAAI,GACnD,EAAE,KAAKO,GAAc,MAAMC,GAAW,oBAAAC,EAAA,IAAuBC,MAE7DC,IAAmBC,EAAY,MAAM;AACzC,IAAIhB,EAAU,WACZA,EAAU,QAAQ,SAAS,EAAE,MAAM,MAAM,UAAU,UAAU;AAAA,EAEjE,GAAG,CAAE,CAAA,GAECiB,IAAoBD,EAAY,MAAM;AAC1C,IAAIhB,EAAU,WACZA,EAAU,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;AAAA,UAC3C;AAAA,QAAA;AAAA,QAtBI;AAAA,MAuBN;AAAA,IAAA,GAEJ;AAAA,EACF,EAAA,CAAA;AAEJ,GAEAC,KAAehE;"}
|
@@ -5,7 +5,7 @@ import V from "../../../../ui/arrow-tooltip/arrow-tooltip.js";
|
|
5
5
|
import v from "../../../../ui/image/image.js";
|
6
6
|
import r from "../../../../ui/layout/flex-view.js";
|
7
7
|
import U from "../../../../ui/separator/separator.js";
|
8
|
-
import
|
8
|
+
import a from "../../../../ui/text/text.js";
|
9
9
|
import Y from "./goals/goal-action-ctas.js";
|
10
10
|
import { GOAL_CATEGORY_BASED_IMAGES as q } from "./milestone-constants.js";
|
11
11
|
import { getRemainingDaysToCompleteGoal as z, getGoalCategoryBasedColorTheme as J, getMilestoneWidgetStatusInfo as Q } from "./milestone-utils.js";
|
@@ -32,7 +32,7 @@ const ue = X(
|
|
32
32
|
goal_category: l,
|
33
33
|
goal_code: g,
|
34
34
|
progress_stat: S
|
35
|
-
} = d, { completed: p = 0, total: k = 0 } = S || {}, h = i === "OUTCOME_PENDING",
|
35
|
+
} = d, { completed: p = 0, total: k = 0 } = S || {}, h = i === "OUTCOME_PENDING", s = p > 0 ? Math.floor((p / k || 1) * 100) : 0, o = j(null), [B, O] = H(!1), { textColor: N, borderColor: $ } = J(l), c = Q(i), R = (h ? c == null ? void 0 : c.progressBackgroundColor : $) || "WHITE_5", M = L(() => typeof g == "string", [g]), P = z(b);
|
36
36
|
return F(() => {
|
37
37
|
o.current && o.current.scrollHeight > o.current.clientHeight && O(!0);
|
38
38
|
}, [o]), l ? /* @__PURE__ */ t(
|
@@ -40,7 +40,7 @@ const ue = X(
|
|
40
40
|
{
|
41
41
|
$flexDirection: "row",
|
42
42
|
$justifyContent: "space-between",
|
43
|
-
$alignItems: "
|
43
|
+
$alignItems: "center",
|
44
44
|
$flexGapX: 1,
|
45
45
|
children: [
|
46
46
|
/* @__PURE__ */ t(r, { $flexDirection: "row", $flexGapX: 1.5, children: [
|
@@ -62,7 +62,7 @@ const ue = X(
|
|
62
62
|
{
|
63
63
|
$progressCircle: !0,
|
64
64
|
$progressBackground: "BLACK_1",
|
65
|
-
$progress:
|
65
|
+
$progress: s * 2,
|
66
66
|
r: "31",
|
67
67
|
cx: "32",
|
68
68
|
cy: "32"
|
@@ -78,14 +78,14 @@ const ue = X(
|
|
78
78
|
height: 40
|
79
79
|
}
|
80
80
|
) }),
|
81
|
-
|
81
|
+
s === 100 && /* @__PURE__ */ e(ee, { children: /* @__PURE__ */ e(K, { width: 20, height: 20 }) })
|
82
82
|
]
|
83
83
|
}
|
84
84
|
),
|
85
85
|
/* @__PURE__ */ t(r, { $flexGap: 16, children: [
|
86
86
|
/* @__PURE__ */ t(r, { $flexGap: 4, children: [
|
87
87
|
/* @__PURE__ */ t(r, { $flexDirection: "row", $alignItems: "center", $flexGap: 4, children: [
|
88
|
-
/* @__PURE__ */ e(
|
88
|
+
/* @__PURE__ */ e(a, { $renderAs: "ac4-black", $color: N, children: l.split("_").join(" ") }),
|
89
89
|
h && /* @__PURE__ */ e(
|
90
90
|
r,
|
91
91
|
{
|
@@ -94,7 +94,7 @@ const ue = X(
|
|
94
94
|
$gutter: 4,
|
95
95
|
$alignItems: "center",
|
96
96
|
$background: R,
|
97
|
-
children: /* @__PURE__ */ e(
|
97
|
+
children: /* @__PURE__ */ e(a, { $renderAs: "ac4", $color: "WHITE", children: "Outcome pending" })
|
98
98
|
}
|
99
99
|
),
|
100
100
|
i === "DRAFT" && /* @__PURE__ */ e(
|
@@ -105,7 +105,7 @@ const ue = X(
|
|
105
105
|
$gutter: 4,
|
106
106
|
$alignItems: "center",
|
107
107
|
$background: $,
|
108
|
-
children: /* @__PURE__ */ e(
|
108
|
+
children: /* @__PURE__ */ e(a, { $renderAs: "ac4", children: "Draft" })
|
109
109
|
}
|
110
110
|
)
|
111
111
|
] }),
|
@@ -126,8 +126,8 @@ const ue = X(
|
|
126
126
|
)
|
127
127
|
}
|
128
128
|
),
|
129
|
-
i !== "DRAFT" && /* @__PURE__ */ t(
|
130
|
-
|
129
|
+
i !== "DRAFT" && s > 0 && /* @__PURE__ */ t(a, { $renderAs: "ub3", $color: "BLACK_T_60", children: [
|
130
|
+
s,
|
131
131
|
"% complete",
|
132
132
|
P
|
133
133
|
] })
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"milestone-info.js","sources":["../../../../../../src/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-info.tsx"],"sourcesContent":["import type { IMileStoneInfoWrapperProps } from './milestone-widget-types';\n\nimport React, { memo, useLayoutEffect, useMemo, useRef, useState } from 'react';\n\nimport Check2Icon from '../../../../../assets/line-icons/icons/check2';\nimport ArrowTooltip from '../../../../ui/arrow-tooltip/arrow-tooltip';\nimport Image from '../../../../ui/image/image';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Separator from '../../../../ui/separator/separator';\nimport Text from '../../../../ui/text/text';\nimport GoalActionCtas from './goals/goal-action-ctas';\nimport { GOAL_CATEGORY_BASED_IMAGES } from './milestone-constants';\nimport {\n getGoalCategoryBasedColorTheme,\n getMilestoneWidgetStatusInfo,\n getRemainingDaysToCompleteGoal,\n} from './milestone-utils';\nimport * as Styled from './milestone-widget-styled';\nimport OutcomeWrapper from './outcome/outcome';\n\nconst MilestoneInfoWrapper: React.FC<IMileStoneInfoWrapperProps> = memo(\n ({ isClassOngoing, isStudentPresent, isExpanded, ...restMilestoneInfoWrapperProps }) => {\n const {\n milestone,\n studentId,\n studentName,\n teacherName,\n parentName,\n userType,\n courseStream,\n outcomes,\n onEdit,\n onDraftPublish,\n onAddOutcome,\n } = restMilestoneInfoWrapperProps;\n\n const {\n milestone_name: milestoneName,\n milestone_date_ts: dueDate,\n milestone_state: milestoneState,\n goal_category: goalCategory,\n goal_code: goalCode,\n progress_stat: progressStat,\n } = milestone;\n\n const { completed = 0, total = 0 } = progressStat || {};\n const isOutcomePending = milestoneState === 'OUTCOME_PENDING';\n const progressCompletionPercentage =\n completed > 0 ? Math.floor((completed / total || 1) * 100) : 0;\n\n const titleTextRef = useRef<HTMLDivElement>(null);\n const [showTitleTooltip, setShowTitleTooltip] = useState(false);\n\n const { textColor: goalCategoryTextColor, borderColor } =\n getGoalCategoryBasedColorTheme(goalCategory);\n\n const outcomeStatusInfo = getMilestoneWidgetStatusInfo(milestoneState);\n const backgroundColor =\n (isOutcomePending ? outcomeStatusInfo?.progressBackgroundColor : borderColor) || 'WHITE_5';\n\n const isGoalCreation = useMemo(() => typeof goalCode === 'string', [goalCode]);\n const remainingDays = getRemainingDaysToCompleteGoal(dueDate);\n\n useLayoutEffect(() => {\n if (\n titleTextRef.current &&\n titleTextRef.current.scrollHeight > titleTextRef.current.clientHeight\n ) {\n setShowTitleTooltip(true);\n }\n }, [titleTextRef]);\n\n if (!goalCategory) return null;\n\n return (\n <FlexView\n $flexDirection=\"row\"\n $justifyContent=\"space-between\"\n $alignItems=\"flex-start\"\n $flexGapX={1}\n >\n <FlexView $flexDirection=\"row\" $flexGapX={1.5}>\n <FlexView\n $widthX={4}\n $heightX={4}\n $background=\"WHITE_T_38\"\n $position=\"relative\"\n $justifyContent=\"center\"\n $alignItems=\"center\"\n $borderRadiusX={2}\n >\n <Styled.ChapterProgressSVG width=\"64px\" height=\"64px\">\n <Styled.ChapterProgressSVGCircle $progress={0} r=\"31\" cx=\"32\" cy=\"32\" />\n <Styled.ChapterProgressSVGCircle\n $progressCircle\n $progressBackground=\"BLACK_1\"\n $progress={progressCompletionPercentage * 2}\n r=\"31\"\n cx=\"32\"\n cy=\"32\"\n />\n </Styled.ChapterProgressSVG>\n\n <FlexView $widthX={4} $heightX={4} $justifyContent=\"center\" $alignItems=\"center\">\n <Image\n src={GOAL_CATEGORY_BASED_IMAGES[goalCategory]}\n withLoader\n width={40}\n height={40}\n />\n </FlexView>\n\n {progressCompletionPercentage === 100 && (\n <Styled.StyledCheckIconWrapper>\n <Check2Icon width={20} height={20} />\n </Styled.StyledCheckIconWrapper>\n )}\n </FlexView>\n\n <FlexView $flexGap={16}>\n <FlexView $flexGap={4}>\n <FlexView $flexDirection=\"row\" $alignItems=\"center\" $flexGap={4}>\n <Text $renderAs=\"ac4-black\" $color={goalCategoryTextColor}>\n {goalCategory.split('_').join(' ')}\n </Text>\n\n {isOutcomePending && (\n <FlexView\n $flexDirection=\"row\"\n $gap={4}\n $gutter={4}\n $alignItems=\"center\"\n $background={backgroundColor}\n >\n <Text $renderAs=\"ac4\" $color=\"WHITE\">\n Outcome pending\n </Text>\n </FlexView>\n )}\n\n {milestoneState === 'DRAFT' && (\n <FlexView\n $flexDirection=\"row\"\n $gap={4}\n $gutter={4}\n $alignItems=\"center\"\n $background={borderColor}\n >\n <Text $renderAs=\"ac4\">Draft</Text>\n </FlexView>\n )}\n </FlexView>\n\n <ArrowTooltip\n renderAs=\"primary\"\n position=\"bottom\"\n tooltipItem={milestoneName}\n hidden={!showTitleTooltip}\n >\n <Styled.MilestoneTitle\n ref={titleTextRef}\n $renderAs={!isGoalCreation ? 'ah3' : 'ah4'}\n >\n {milestoneName}\n </Styled.MilestoneTitle>\n </ArrowTooltip>\n\n {milestoneState !== 'DRAFT' && (\n <Text $renderAs=\"ub3\" $color=\"BLACK_T_60\">\n {progressCompletionPercentage}% complete{remainingDays}\n </Text>\n )}\n </FlexView>\n\n {outcomes?.length ? (\n <>\n <Separator width={40} height={1} background=\"BLACK_T_15\" />\n <OutcomeWrapper outcomes={outcomes} />\n </>\n ) : undefined}\n </FlexView>\n </FlexView>\n\n {userType === 'TEACHER' && (\n <GoalActionCtas\n milestone={milestone}\n studentId={studentId}\n studentName={studentName}\n teacherName={teacherName ?? ''}\n parentName={parentName ?? ''}\n onAddOutcome={onAddOutcome}\n isClassOngoing={Boolean(isClassOngoing)}\n isStudentPresent={Boolean(isStudentPresent)}\n onDraftPublish={onDraftPublish}\n onEdit={onEdit}\n courseStream={courseStream}\n />\n )}\n </FlexView>\n );\n },\n);\n\nexport default MilestoneInfoWrapper;\n"],"names":["MilestoneInfoWrapper","memo","isClassOngoing","isStudentPresent","isExpanded","restMilestoneInfoWrapperProps","milestone","studentId","studentName","teacherName","parentName","userType","courseStream","outcomes","onEdit","onDraftPublish","onAddOutcome","milestoneName","dueDate","milestoneState","goalCategory","goalCode","progressStat","completed","total","isOutcomePending","progressCompletionPercentage","titleTextRef","useRef","showTitleTooltip","setShowTitleTooltip","useState","goalCategoryTextColor","borderColor","getGoalCategoryBasedColorTheme","outcomeStatusInfo","getMilestoneWidgetStatusInfo","backgroundColor","isGoalCreation","useMemo","remainingDays","getRemainingDaysToCompleteGoal","useLayoutEffect","jsxs","FlexView","Styled.ChapterProgressSVG","jsx","Styled.ChapterProgressSVGCircle","Image","GOAL_CATEGORY_BASED_IMAGES","Styled.StyledCheckIconWrapper","Check2Icon","Text","ArrowTooltip","Styled.MilestoneTitle","Fragment","Separator","OutcomeWrapper","GoalActionCtas"],"mappings":";;;;;;;;;;;;;AAoBA,MAAMA,KAA6DC;AAAA,EACjE,CAAC,EAAE,gBAAAC,GAAgB,kBAAAC,GAAkB,YAAAC,IAAY,GAAGC,QAAoC;AAChF,UAAA;AAAA,MACJ,WAAAC;AAAA,MACA,WAAAC;AAAA,MACA,aAAAC;AAAA,MACA,aAAAC;AAAA,MACA,YAAAC;AAAA,MACA,UAAAC;AAAA,MACA,cAAAC;AAAA,MACA,UAAAC;AAAA,MACA,QAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,cAAAC;AAAA,IACE,IAAAX,GAEE;AAAA,MACJ,gBAAgBY;AAAA,MAChB,mBAAmBC;AAAA,MACnB,iBAAiBC;AAAA,MACjB,eAAeC;AAAA,MACf,WAAWC;AAAA,MACX,eAAeC;AAAA,IACb,IAAAhB,GAEE,EAAE,WAAAiB,IAAY,GAAG,OAAAC,IAAQ,EAAE,IAAIF,KAAgB,IAC/CG,IAAmBN,MAAmB,mBACtCO,IACJH,IAAY,IAAI,KAAK,OAAOA,IAAYC,KAAS,KAAK,GAAG,IAAI,GAEzDG,IAAeC,EAAu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container/milestone-list/milestone-widget/milestone-info.tsx"],"sourcesContent":["import type { IMileStoneInfoWrapperProps } from './milestone-widget-types';\n\nimport React, { memo, useLayoutEffect, useMemo, useRef, useState } from 'react';\n\nimport Check2Icon from '../../../../../assets/line-icons/icons/check2';\nimport ArrowTooltip from '../../../../ui/arrow-tooltip/arrow-tooltip';\nimport Image from '../../../../ui/image/image';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Separator from '../../../../ui/separator/separator';\nimport Text from '../../../../ui/text/text';\nimport GoalActionCtas from './goals/goal-action-ctas';\nimport { GOAL_CATEGORY_BASED_IMAGES } from './milestone-constants';\nimport {\n getGoalCategoryBasedColorTheme,\n getMilestoneWidgetStatusInfo,\n getRemainingDaysToCompleteGoal,\n} from './milestone-utils';\nimport * as Styled from './milestone-widget-styled';\nimport OutcomeWrapper from './outcome/outcome';\n\nconst MilestoneInfoWrapper: React.FC<IMileStoneInfoWrapperProps> = memo(\n ({ isClassOngoing, isStudentPresent, isExpanded, ...restMilestoneInfoWrapperProps }) => {\n const {\n milestone,\n studentId,\n studentName,\n teacherName,\n parentName,\n userType,\n courseStream,\n outcomes,\n onEdit,\n onDraftPublish,\n onAddOutcome,\n } = restMilestoneInfoWrapperProps;\n\n const {\n milestone_name: milestoneName,\n milestone_date_ts: dueDate,\n milestone_state: milestoneState,\n goal_category: goalCategory,\n goal_code: goalCode,\n progress_stat: progressStat,\n } = milestone;\n\n const { completed = 0, total = 0 } = progressStat || {};\n const isOutcomePending = milestoneState === 'OUTCOME_PENDING';\n const progressCompletionPercentage =\n completed > 0 ? Math.floor((completed / total || 1) * 100) : 0;\n\n const titleTextRef = useRef<HTMLDivElement>(null);\n const [showTitleTooltip, setShowTitleTooltip] = useState(false);\n\n const { textColor: goalCategoryTextColor, borderColor } =\n getGoalCategoryBasedColorTheme(goalCategory);\n\n const outcomeStatusInfo = getMilestoneWidgetStatusInfo(milestoneState);\n const backgroundColor =\n (isOutcomePending ? outcomeStatusInfo?.progressBackgroundColor : borderColor) || 'WHITE_5';\n\n const isGoalCreation = useMemo(() => typeof goalCode === 'string', [goalCode]);\n const remainingDays = getRemainingDaysToCompleteGoal(dueDate);\n\n useLayoutEffect(() => {\n if (\n titleTextRef.current &&\n titleTextRef.current.scrollHeight > titleTextRef.current.clientHeight\n ) {\n setShowTitleTooltip(true);\n }\n }, [titleTextRef]);\n\n if (!goalCategory) return null;\n\n return (\n <FlexView\n $flexDirection=\"row\"\n $justifyContent=\"space-between\"\n $alignItems=\"center\"\n $flexGapX={1}\n >\n <FlexView $flexDirection=\"row\" $flexGapX={1.5}>\n <FlexView\n $widthX={4}\n $heightX={4}\n $background=\"WHITE_T_38\"\n $position=\"relative\"\n $justifyContent=\"center\"\n $alignItems=\"center\"\n $borderRadiusX={2}\n >\n <Styled.ChapterProgressSVG width=\"64px\" height=\"64px\">\n <Styled.ChapterProgressSVGCircle $progress={0} r=\"31\" cx=\"32\" cy=\"32\" />\n <Styled.ChapterProgressSVGCircle\n $progressCircle\n $progressBackground=\"BLACK_1\"\n $progress={progressCompletionPercentage * 2}\n r=\"31\"\n cx=\"32\"\n cy=\"32\"\n />\n </Styled.ChapterProgressSVG>\n\n <FlexView $widthX={4} $heightX={4} $justifyContent=\"center\" $alignItems=\"center\">\n <Image\n src={GOAL_CATEGORY_BASED_IMAGES[goalCategory]}\n withLoader\n width={40}\n height={40}\n />\n </FlexView>\n\n {progressCompletionPercentage === 100 && (\n <Styled.StyledCheckIconWrapper>\n <Check2Icon width={20} height={20} />\n </Styled.StyledCheckIconWrapper>\n )}\n </FlexView>\n\n <FlexView $flexGap={16}>\n <FlexView $flexGap={4}>\n <FlexView $flexDirection=\"row\" $alignItems=\"center\" $flexGap={4}>\n <Text $renderAs=\"ac4-black\" $color={goalCategoryTextColor}>\n {goalCategory.split('_').join(' ')}\n </Text>\n\n {isOutcomePending && (\n <FlexView\n $flexDirection=\"row\"\n $gap={4}\n $gutter={4}\n $alignItems=\"center\"\n $background={backgroundColor}\n >\n <Text $renderAs=\"ac4\" $color=\"WHITE\">\n Outcome pending\n </Text>\n </FlexView>\n )}\n\n {milestoneState === 'DRAFT' && (\n <FlexView\n $flexDirection=\"row\"\n $gap={4}\n $gutter={4}\n $alignItems=\"center\"\n $background={borderColor}\n >\n <Text $renderAs=\"ac4\">Draft</Text>\n </FlexView>\n )}\n </FlexView>\n\n <ArrowTooltip\n renderAs=\"primary\"\n position=\"bottom\"\n tooltipItem={milestoneName}\n hidden={!showTitleTooltip}\n >\n <Styled.MilestoneTitle\n ref={titleTextRef}\n $renderAs={!isGoalCreation ? 'ah3' : 'ah4'}\n >\n {milestoneName}\n </Styled.MilestoneTitle>\n </ArrowTooltip>\n\n {milestoneState !== 'DRAFT' && progressCompletionPercentage > 0 && (\n <Text $renderAs=\"ub3\" $color=\"BLACK_T_60\">\n {progressCompletionPercentage}% complete{remainingDays}\n </Text>\n )}\n </FlexView>\n\n {outcomes?.length ? (\n <>\n <Separator width={40} height={1} background=\"BLACK_T_15\" />\n <OutcomeWrapper outcomes={outcomes} />\n </>\n ) : undefined}\n </FlexView>\n </FlexView>\n\n {userType === 'TEACHER' && (\n <GoalActionCtas\n milestone={milestone}\n studentId={studentId}\n studentName={studentName}\n teacherName={teacherName ?? ''}\n parentName={parentName ?? ''}\n onAddOutcome={onAddOutcome}\n isClassOngoing={Boolean(isClassOngoing)}\n isStudentPresent={Boolean(isStudentPresent)}\n onDraftPublish={onDraftPublish}\n onEdit={onEdit}\n courseStream={courseStream}\n />\n )}\n </FlexView>\n );\n },\n);\n\nexport default MilestoneInfoWrapper;\n"],"names":["MilestoneInfoWrapper","memo","isClassOngoing","isStudentPresent","isExpanded","restMilestoneInfoWrapperProps","milestone","studentId","studentName","teacherName","parentName","userType","courseStream","outcomes","onEdit","onDraftPublish","onAddOutcome","milestoneName","dueDate","milestoneState","goalCategory","goalCode","progressStat","completed","total","isOutcomePending","progressCompletionPercentage","titleTextRef","useRef","showTitleTooltip","setShowTitleTooltip","useState","goalCategoryTextColor","borderColor","getGoalCategoryBasedColorTheme","outcomeStatusInfo","getMilestoneWidgetStatusInfo","backgroundColor","isGoalCreation","useMemo","remainingDays","getRemainingDaysToCompleteGoal","useLayoutEffect","jsxs","FlexView","Styled.ChapterProgressSVG","jsx","Styled.ChapterProgressSVGCircle","Image","GOAL_CATEGORY_BASED_IMAGES","Styled.StyledCheckIconWrapper","Check2Icon","Text","ArrowTooltip","Styled.MilestoneTitle","Fragment","Separator","OutcomeWrapper","GoalActionCtas"],"mappings":";;;;;;;;;;;;;AAoBA,MAAMA,KAA6DC;AAAA,EACjE,CAAC,EAAE,gBAAAC,GAAgB,kBAAAC,GAAkB,YAAAC,IAAY,GAAGC,QAAoC;AAChF,UAAA;AAAA,MACJ,WAAAC;AAAA,MACA,WAAAC;AAAA,MACA,aAAAC;AAAA,MACA,aAAAC;AAAA,MACA,YAAAC;AAAA,MACA,UAAAC;AAAA,MACA,cAAAC;AAAA,MACA,UAAAC;AAAA,MACA,QAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,cAAAC;AAAA,IACE,IAAAX,GAEE;AAAA,MACJ,gBAAgBY;AAAA,MAChB,mBAAmBC;AAAA,MACnB,iBAAiBC;AAAA,MACjB,eAAeC;AAAA,MACf,WAAWC;AAAA,MACX,eAAeC;AAAA,IACb,IAAAhB,GAEE,EAAE,WAAAiB,IAAY,GAAG,OAAAC,IAAQ,EAAE,IAAIF,KAAgB,IAC/CG,IAAmBN,MAAmB,mBACtCO,IACJH,IAAY,IAAI,KAAK,OAAOA,IAAYC,KAAS,KAAK,GAAG,IAAI,GAEzDG,IAAeC,EAAuB,IAAI,GAC1C,CAACC,GAAkBC,CAAmB,IAAIC,EAAS,EAAK,GAExD,EAAE,WAAWC,GAAuB,aAAAC,EAAY,IACpDC,EAA+Bd,CAAY,GAEvCe,IAAoBC,EAA6BjB,CAAc,GAC/DkB,KACHZ,IAAmBU,KAAA,gBAAAA,EAAmB,0BAA0BF,MAAgB,WAE7EK,IAAiBC,EAAQ,MAAM,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