@cuemath/leap 3.0.12 → 3.0.13-ass1
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.
@@ -1,49 +1,50 @@
|
|
1
|
-
import { jsx as e, jsxs as d, Fragment as
|
2
|
-
import { memo as
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import { BLOCK_TYPE as
|
10
|
-
import { NODE_CARD_STATES as
|
11
|
-
import { getNodeTypeBasedBgImage as
|
12
|
-
import { getNodeCardBasedIcon as
|
13
|
-
import { NodeCardContainer as
|
14
|
-
import
|
15
|
-
import
|
16
|
-
const
|
1
|
+
import { jsx as e, jsxs as d, Fragment as K } from "react/jsx-runtime";
|
2
|
+
import { memo as X, useRef as j, useCallback as m } from "react";
|
3
|
+
import G from "../../../../../assets/line-icons/icons/eye2.js";
|
4
|
+
import z from "../../../../../assets/line-icons/icons/redo.js";
|
5
|
+
import F from "../../../../ui/arrow-tooltip/arrow-tooltip.js";
|
6
|
+
import P from "../../../../ui/context-menu/context-menu.js";
|
7
|
+
import Y from "../../../../ui/lottie-animation/lottie-animation.js";
|
8
|
+
import Z from "../../../../ui/text/text.js";
|
9
|
+
import { BLOCK_TYPE as q } from "../../../constants/block-constants.js";
|
10
|
+
import { NODE_CARD_STATES as J } from "../../../constants/node-constants.js";
|
11
|
+
import { getNodeTypeBasedBgImage as Q } from "../../../utils/index.js";
|
12
|
+
import { getNodeCardBasedIcon as U } from "../../../utils/node-card-utils.js";
|
13
|
+
import { NodeCardContainer as V, NodeCardInfoWrapper as ee, IconWrapper as te, StyledImportantIcon as re, NodeCardContentWrapper as ne, NodeCardTitle as oe } from "../node-card-styled.js";
|
14
|
+
import ae from "../node-card-tags.js";
|
15
|
+
import ie from "../node-menu-options/node-menu-options.js";
|
16
|
+
const ce = { renderer: "canvas", autoplay: !1 }, ye = X((O) => {
|
17
17
|
const {
|
18
18
|
nodeData: t,
|
19
|
-
imageHue:
|
20
|
-
blockType:
|
19
|
+
imageHue: b,
|
20
|
+
blockType: y,
|
21
21
|
onNodeAttempt: a,
|
22
22
|
onNodeReattempt: i,
|
23
23
|
onNodeReview: c,
|
24
24
|
onNodeView: r,
|
25
|
-
isStudent:
|
26
|
-
} =
|
25
|
+
isStudent: A
|
26
|
+
} = O, {
|
27
27
|
accuracy: L,
|
28
28
|
attempt_location: S,
|
29
29
|
node_type: l,
|
30
|
-
card_header:
|
31
|
-
title:
|
30
|
+
card_header: E,
|
31
|
+
title: T,
|
32
32
|
state: C,
|
33
|
-
is_optional:
|
33
|
+
is_optional: x,
|
34
34
|
sheet_statement: $,
|
35
|
-
permissions:
|
36
|
-
marked_as_completed: g
|
35
|
+
permissions: R,
|
36
|
+
marked_as_completed: g,
|
37
|
+
user_attempt_id: _
|
37
38
|
} = t, {
|
38
39
|
can_review: s,
|
39
40
|
can_start: p,
|
40
41
|
can_resume: u,
|
41
|
-
can_reset:
|
42
|
-
} =
|
42
|
+
can_reset: I
|
43
|
+
} = R, v = y === q.GOAL, o = C === J.LOCKED, w = S === "INCLASS", f = !(p || u) && (I || s), h = j(null), B = Q(l), { lottie: M } = U(l), k = m(
|
43
44
|
(n) => {
|
44
45
|
switch (n) {
|
45
46
|
case "node-card-review":
|
46
|
-
s ? c == null || c(t) : r == null || r(t);
|
47
|
+
s && _ ? c == null || c(t) : r == null || r(t);
|
47
48
|
return;
|
48
49
|
case "node-card-reattempt":
|
49
50
|
i == null || i(t);
|
@@ -52,8 +53,8 @@ const ie = { renderer: "canvas", autoplay: !1 }, be = K((k) => {
|
|
52
53
|
throw new Error(`No callback function for ${n}`);
|
53
54
|
}
|
54
55
|
},
|
55
|
-
[s, t, i, c, r]
|
56
|
-
),
|
56
|
+
[s, t, i, c, r, _]
|
57
|
+
), W = m(() => {
|
57
58
|
f || o || (p || u ? a == null || a(t) : g && (r == null || r(t)));
|
58
59
|
}, [
|
59
60
|
u,
|
@@ -64,39 +65,39 @@ const ie = { renderer: "canvas", autoplay: !1 }, be = K((k) => {
|
|
64
65
|
f,
|
65
66
|
o,
|
66
67
|
g
|
67
|
-
]),
|
68
|
+
]), N = m(() => {
|
68
69
|
var n;
|
69
70
|
o || (n = h.current) == null || n.play();
|
70
|
-
}, [o]),
|
71
|
+
}, [o]), D = m(() => {
|
71
72
|
var n;
|
72
73
|
(n = h.current) == null || n.stop();
|
73
|
-
}, []),
|
74
|
+
}, []), H = [
|
74
75
|
{
|
75
76
|
id: "node-card-review",
|
76
77
|
label: "Review",
|
77
|
-
icon:
|
78
|
+
icon: G,
|
78
79
|
disabled: !s,
|
79
|
-
onClick:
|
80
|
+
onClick: k
|
80
81
|
},
|
81
82
|
{
|
82
83
|
id: "node-card-reattempt",
|
83
84
|
label: "Reattempt",
|
84
|
-
icon:
|
85
|
-
disabled: !
|
86
|
-
onClick:
|
85
|
+
icon: z,
|
86
|
+
disabled: !I,
|
87
|
+
onClick: k
|
87
88
|
}
|
88
89
|
];
|
89
90
|
return /* @__PURE__ */ e(
|
90
|
-
|
91
|
+
P,
|
91
92
|
{
|
92
93
|
targetElement: /* @__PURE__ */ e(
|
93
|
-
|
94
|
+
V,
|
94
95
|
{
|
95
|
-
$background: `${
|
96
|
+
$background: `${b}_2`,
|
96
97
|
$disabled: o,
|
97
|
-
onClick:
|
98
|
+
onClick: W,
|
98
99
|
children: /* @__PURE__ */ d(
|
99
|
-
|
100
|
+
F,
|
100
101
|
{
|
101
102
|
renderAs: "primary",
|
102
103
|
tooltipItem: $,
|
@@ -107,20 +108,20 @@ const ie = { renderer: "canvas", autoplay: !1 }, be = K((k) => {
|
|
107
108
|
widthX: 11.25,
|
108
109
|
children: [
|
109
110
|
/* @__PURE__ */ d(
|
110
|
-
|
111
|
+
ee,
|
111
112
|
{
|
112
113
|
$flexDirection: "row",
|
113
114
|
$alignItems: "center",
|
114
115
|
$heightX: 3.5,
|
115
|
-
$bgImage:
|
116
|
+
$bgImage: B,
|
116
117
|
$gutterX: 0.78125,
|
117
118
|
$flexGap: 8.5,
|
118
119
|
$opacity: o ? 0.5 : 1,
|
119
|
-
onMouseEnter:
|
120
|
-
onMouseLeave:
|
120
|
+
onMouseEnter: N,
|
121
|
+
onMouseLeave: D,
|
121
122
|
children: [
|
122
123
|
/* @__PURE__ */ d(
|
123
|
-
|
124
|
+
te,
|
124
125
|
{
|
125
126
|
$width: 31,
|
126
127
|
$height: 31,
|
@@ -130,41 +131,41 @@ const ie = { renderer: "canvas", autoplay: !1 }, be = K((k) => {
|
|
130
131
|
$justifyContent: "center",
|
131
132
|
children: [
|
132
133
|
/* @__PURE__ */ e(
|
133
|
-
|
134
|
+
Y,
|
134
135
|
{
|
135
|
-
src:
|
136
|
+
src: M,
|
136
137
|
ref: h,
|
137
|
-
settings:
|
138
|
+
settings: ce
|
138
139
|
}
|
139
140
|
),
|
140
|
-
!
|
141
|
+
!x && /* @__PURE__ */ e(re, {})
|
141
142
|
]
|
142
143
|
}
|
143
144
|
),
|
144
|
-
/* @__PURE__ */ d(
|
145
|
-
|
145
|
+
/* @__PURE__ */ d(Z, { $renderAs: "ac4-black", $color: "BLACK", children: [
|
146
|
+
E,
|
146
147
|
" ",
|
147
|
-
|
148
|
+
w && "• CW"
|
148
149
|
] })
|
149
150
|
]
|
150
151
|
}
|
151
152
|
),
|
152
153
|
/* @__PURE__ */ e(
|
153
|
-
|
154
|
+
ae,
|
154
155
|
{
|
155
156
|
nodeType: l,
|
156
157
|
state: C,
|
157
158
|
accuracy: L,
|
158
|
-
isStudent:
|
159
|
+
isStudent: A
|
159
160
|
}
|
160
161
|
),
|
161
|
-
!
|
162
|
-
|
162
|
+
!v && /* @__PURE__ */ e(ne, { $background: "WHITE_1", $heightX: 4, children: /* @__PURE__ */ e(
|
163
|
+
oe,
|
163
164
|
{
|
164
165
|
$renderAs: "ab3",
|
165
166
|
$color: "BLACK_1",
|
166
167
|
$opacity: o ? 0.5 : 1,
|
167
|
-
children:
|
168
|
+
children: T
|
168
169
|
}
|
169
170
|
) })
|
170
171
|
]
|
@@ -176,11 +177,11 @@ const ie = { renderer: "canvas", autoplay: !1 }, be = K((k) => {
|
|
176
177
|
menuWidth: "100%",
|
177
178
|
menuZIndex: 6,
|
178
179
|
menuOffset: 2,
|
179
|
-
menuElement: f ? /* @__PURE__ */ e(
|
180
|
+
menuElement: f ? /* @__PURE__ */ e(ie, { options: H }) : /* @__PURE__ */ e(K, {})
|
180
181
|
}
|
181
182
|
);
|
182
183
|
});
|
183
184
|
export {
|
184
|
-
|
185
|
+
ye as default
|
185
186
|
};
|
186
187
|
//# sourceMappingURL=student-actions.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"student-actions.js","sources":["../../../../../../src/features/chapters-v2/comps/node-card/student-actions/student-actions.tsx"],"sourcesContent":["import type { ILottieAnimationRef } from '../../../../ui/lottie-animation/types';\nimport type { INodeCardProps } from '../node-card-types';\nimport type { INodeMenuOption } from '../node-menu-options/node-menu-options-types';\n\nimport { memo, useCallback, useRef, type FC } from 'react';\n\nimport Eye2Icon from '../../../../../assets/line-icons/icons/eye2';\nimport RedoIcon from '../../../../../assets/line-icons/icons/redo';\nimport ArrowTooltip from '../../../../ui/arrow-tooltip/arrow-tooltip';\nimport ContextMenu from '../../../../ui/context-menu/context-menu';\nimport LottieAnimation from '../../../../ui/lottie-animation/lottie-animation';\nimport Text from '../../../../ui/text/text';\nimport { BLOCK_TYPE } from '../../../constants/block-constants';\nimport { NODE_CARD_STATES } from '../../../constants/node-constants';\nimport { getNodeTypeBasedBgImage } from '../../../utils';\nimport { getNodeCardBasedIcon } from '../../../utils/node-card-utils';\nimport * as Styled from '../node-card-styled';\nimport NodeCardTags from '../node-card-tags';\nimport NodeMenuOptions from '../node-menu-options/node-menu-options';\n\nconst renderSettings = { renderer: 'canvas', autoplay: false };\n\nconst StudentActions: FC<Omit<INodeCardProps, 'userType'>> = memo(props => {\n const {\n nodeData,\n imageHue,\n blockType,\n onNodeAttempt,\n onNodeReattempt,\n onNodeReview,\n onNodeView,\n isStudent,\n } = props;\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 marked_as_completed: teacherMarkedAsCompleted,\n } = nodeData;\n const {\n can_review: canReview,\n can_start: canStart,\n can_resume: canResume,\n can_reset: canReset,\n } = permissions;\n\n const isGoalBlock = blockType === BLOCK_TYPE.GOAL;\n const sheetLocked = state === NODE_CARD_STATES.LOCKED;\n const inClassSheet = attemptLocation === 'INCLASS';\n const canStartOrResume = canStart || canResume;\n\n const renderOptions = !canStartOrResume && (canReset || canReview);\n const animationRef = useRef<ILottieAnimationRef | null>(null);\n const nodeBgImage = getNodeTypeBasedBgImage(nodeType);\n const { lottie: nodeCardLottie } = getNodeCardBasedIcon(nodeType);\n\n const handleOnMenuOptionClick = useCallback(\n (optionId: string) => {\n switch (optionId) {\n case 'node-card-review':\n if (canReview) {\n onNodeReview?.(nodeData);\n } else {\n onNodeView?.(nodeData);\n }\n\n return;\n\n case 'node-card-reattempt':\n onNodeReattempt?.(nodeData);\n\n return;\n\n default:\n throw new Error(`No callback function for ${optionId}`);\n }\n },\n [canReview, nodeData, onNodeReattempt, onNodeReview, onNodeView],\n );\n\n const handleOnNodeCardClick = useCallback(() => {\n if (renderOptions || sheetLocked) return;\n\n if (canStart || canResume) {\n onNodeAttempt?.(nodeData);\n } else if (teacherMarkedAsCompleted) {\n onNodeView?.(nodeData);\n }\n }, [\n canResume,\n canStart,\n nodeData,\n onNodeAttempt,\n onNodeView,\n renderOptions,\n sheetLocked,\n teacherMarkedAsCompleted,\n ]);\n\n const handleOnMouseEnter = useCallback(() => {\n if (sheetLocked) return;\n animationRef.current?.play();\n }, [sheetLocked]);\n\n const handleOnMouseLeave = useCallback(() => {\n animationRef.current?.stop();\n }, []);\n\n const menuOptions: INodeMenuOption[] = [\n {\n id: 'node-card-review',\n label: 'Review',\n icon: Eye2Icon,\n disabled: !canReview,\n onClick: handleOnMenuOptionClick,\n },\n {\n id: 'node-card-reattempt',\n label: 'Reattempt',\n icon: RedoIcon,\n disabled: !canReset,\n onClick: handleOnMenuOptionClick,\n },\n ];\n\n return (\n <ContextMenu\n targetElement={\n <Styled.NodeCardContainer\n $background={`${imageHue}_2`}\n $disabled={sheetLocked}\n onClick={handleOnNodeCardClick}\n >\n <ArrowTooltip\n renderAs=\"primary\"\n tooltipItem={sheetStatement}\n position=\"bottom\"\n zIndex={5}\n hidden={!sheetStatement}\n parentWidth=\"100%\"\n widthX={11.25}\n >\n <Styled.NodeCardInfoWrapper\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $heightX={3.5}\n $bgImage={nodeBgImage}\n $gutterX={0.78125}\n $flexGap={8.5}\n $opacity={sheetLocked ? 0.5 : 1}\n onMouseEnter={handleOnMouseEnter}\n onMouseLeave={handleOnMouseLeave}\n >\n <Styled.IconWrapper\n $width={31}\n $height={31}\n $background=\"WHITE_1\"\n $position=\"relative\"\n $alignItems=\"center\"\n $justifyContent=\"center\"\n >\n <LottieAnimation\n src={nodeCardLottie}\n ref={animationRef}\n settings={renderSettings}\n />\n {!isOptional && <Styled.StyledImportantIcon />}\n </Styled.IconWrapper>\n\n <Text $renderAs=\"ac4-black\" $color=\"BLACK\">\n {cardHeader} {inClassSheet && `• CW`}\n </Text>\n </Styled.NodeCardInfoWrapper>\n\n <NodeCardTags\n nodeType={nodeType}\n state={state}\n accuracy={accuracy}\n isStudent={isStudent}\n />\n\n {!isGoalBlock && (\n <Styled.NodeCardContentWrapper $background=\"WHITE_1\" $heightX={4}>\n <Styled.NodeCardTitle\n $renderAs=\"ab3\"\n $color=\"BLACK_1\"\n $opacity={sheetLocked ? 0.5 : 1}\n >\n {title}\n </Styled.NodeCardTitle>\n </Styled.NodeCardContentWrapper>\n )}\n </ArrowTooltip>\n </Styled.NodeCardContainer>\n }\n startLeft\n menuWidth=\"100%\"\n menuZIndex={6}\n menuOffset={2}\n menuElement={renderOptions ? <NodeMenuOptions options={menuOptions} /> : <></>}\n />\n );\n});\n\nexport default StudentActions;\n"],"names":["renderSettings","StudentActions","memo","props","nodeData","imageHue","blockType","onNodeAttempt","onNodeReattempt","onNodeReview","onNodeView","isStudent","accuracy","attemptLocation","nodeType","cardHeader","title","state","isOptional","sheetStatement","permissions","teacherMarkedAsCompleted","canReview","canStart","canResume","canReset","isGoalBlock","BLOCK_TYPE","sheetLocked","NODE_CARD_STATES","inClassSheet","renderOptions","animationRef","useRef","nodeBgImage","getNodeTypeBasedBgImage","nodeCardLottie","getNodeCardBasedIcon","handleOnMenuOptionClick","useCallback","optionId","handleOnNodeCardClick","handleOnMouseEnter","_a","handleOnMouseLeave","menuOptions","Eye2Icon","RedoIcon","jsx","ContextMenu","Styled.NodeCardContainer","jsxs","ArrowTooltip","Styled.NodeCardInfoWrapper","Styled.IconWrapper","LottieAnimation","Styled.StyledImportantIcon","Text","NodeCardTags","Styled.NodeCardContentWrapper","Styled.NodeCardTitle","NodeMenuOptions","Fragment"],"mappings":";;;;;;;;;;;;;;;AAoBA,MAAMA,KAAiB,EAAE,UAAU,UAAU,UAAU,GAAM,GAEvDC,KAAuDC,EAAK,CAASC,MAAA;AACnE,QAAA;AAAA,IACJ,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,eAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC;AAAA,EACE,IAAAR,GACE;AAAA,IACJ,UAAAS;AAAA,IACA,kBAAkBC;AAAA,IAClB,WAAWC;AAAA,IACX,aAAaC;AAAA,IACb,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,aAAaC;AAAA,IACb,iBAAiBC;AAAA,IACjB,aAAAC;AAAA,IACA,qBAAqBC;AAAA,EACnB,IAAAjB,GACE;AAAA,IACJ,YAAYkB;AAAA,IACZ,WAAWC;AAAA,IACX,YAAYC;AAAA,IACZ,WAAWC;AAAA,EACT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A;AAAA,wBAAA1C;AAAA,wBAAW;AAAA,wBAAEe,KAAgB;AAAA,sBAAA,GAChC;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACF;AAAA,gBAEA,gBAAAkB;AAAA,kBAACU;AAAA,kBAAA;AAAA,oBACC,UAAA5C;AAAA,oBACA,OAAAG;AAAA,oBACA,UAAAL;AAAA,oBACA,WAAAD;AAAA,kBAAA;AAAA,gBACF;AAAA,gBAEC,CAACe,KACC,gBAAAsB,EAAAW,IAAA,EAA8B,aAAY,WAAU,UAAU,GAC7D,UAAA,gBAAAX;AAAA,kBAACY;AAAAA,kBAAA;AAAA,oBACC,WAAU;AAAA,oBACV,QAAO;AAAA,oBACP,UAAUhC,IAAc,MAAM;AAAA,oBAE7B,UAAAZ;AAAA,kBAAA;AAAA,gBAAA,GAEL;AAAA,cAAA;AAAA,YAAA;AAAA,UAEJ;AAAA,QAAA;AAAA,MACF;AAAA,MAEF,WAAS;AAAA,MACT,WAAU;AAAA,MACV,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,aAAae,IAAgB,gBAAAiB,EAACa,MAAgB,SAAShB,EAAA,CAAa,IAAO,gBAAAG,EAAAc,GAAA,EAAA;AAAA,IAAA;AAAA,EAAA;AAGjF,CAAC;"}
|
1
|
+
{"version":3,"file":"student-actions.js","sources":["../../../../../../src/features/chapters-v2/comps/node-card/student-actions/student-actions.tsx"],"sourcesContent":["import type { ILottieAnimationRef } from '../../../../ui/lottie-animation/types';\nimport type { INodeCardProps } from '../node-card-types';\nimport type { INodeMenuOption } from '../node-menu-options/node-menu-options-types';\n\nimport { memo, useCallback, useRef, type FC } from 'react';\n\nimport Eye2Icon from '../../../../../assets/line-icons/icons/eye2';\nimport RedoIcon from '../../../../../assets/line-icons/icons/redo';\nimport ArrowTooltip from '../../../../ui/arrow-tooltip/arrow-tooltip';\nimport ContextMenu from '../../../../ui/context-menu/context-menu';\nimport LottieAnimation from '../../../../ui/lottie-animation/lottie-animation';\nimport Text from '../../../../ui/text/text';\nimport { BLOCK_TYPE } from '../../../constants/block-constants';\nimport { NODE_CARD_STATES } from '../../../constants/node-constants';\nimport { getNodeTypeBasedBgImage } from '../../../utils';\nimport { getNodeCardBasedIcon } from '../../../utils/node-card-utils';\nimport * as Styled from '../node-card-styled';\nimport NodeCardTags from '../node-card-tags';\nimport NodeMenuOptions from '../node-menu-options/node-menu-options';\n\nconst renderSettings = { renderer: 'canvas', autoplay: false };\n\nconst StudentActions: FC<Omit<INodeCardProps, 'userType'>> = memo(props => {\n const {\n nodeData,\n imageHue,\n blockType,\n onNodeAttempt,\n onNodeReattempt,\n onNodeReview,\n onNodeView,\n isStudent,\n } = props;\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 marked_as_completed: teacherMarkedAsCompleted,\n user_attempt_id: userAttemptId,\n } = nodeData;\n const {\n can_review: canReview,\n can_start: canStart,\n can_resume: canResume,\n can_reset: canReset,\n } = permissions;\n\n const isGoalBlock = blockType === BLOCK_TYPE.GOAL;\n const sheetLocked = state === NODE_CARD_STATES.LOCKED;\n const inClassSheet = attemptLocation === 'INCLASS';\n const canStartOrResume = canStart || canResume;\n\n const renderOptions = !canStartOrResume && (canReset || canReview);\n const animationRef = useRef<ILottieAnimationRef | null>(null);\n const nodeBgImage = getNodeTypeBasedBgImage(nodeType);\n const { lottie: nodeCardLottie } = getNodeCardBasedIcon(nodeType);\n\n const handleOnMenuOptionClick = useCallback(\n (optionId: string) => {\n switch (optionId) {\n case 'node-card-review':\n if (canReview && userAttemptId) {\n onNodeReview?.(nodeData);\n } else {\n onNodeView?.(nodeData);\n }\n\n return;\n\n case 'node-card-reattempt':\n onNodeReattempt?.(nodeData);\n\n return;\n\n default:\n throw new Error(`No callback function for ${optionId}`);\n }\n },\n [canReview, nodeData, onNodeReattempt, onNodeReview, onNodeView, userAttemptId],\n );\n\n const handleOnNodeCardClick = useCallback(() => {\n if (renderOptions || sheetLocked) return;\n\n if (canStart || canResume) {\n onNodeAttempt?.(nodeData);\n } else if (teacherMarkedAsCompleted) {\n onNodeView?.(nodeData);\n }\n }, [\n canResume,\n canStart,\n nodeData,\n onNodeAttempt,\n onNodeView,\n renderOptions,\n sheetLocked,\n teacherMarkedAsCompleted,\n ]);\n\n const handleOnMouseEnter = useCallback(() => {\n if (sheetLocked) return;\n animationRef.current?.play();\n }, [sheetLocked]);\n\n const handleOnMouseLeave = useCallback(() => {\n animationRef.current?.stop();\n }, []);\n\n const menuOptions: INodeMenuOption[] = [\n {\n id: 'node-card-review',\n label: 'Review',\n icon: Eye2Icon,\n disabled: !canReview,\n onClick: handleOnMenuOptionClick,\n },\n {\n id: 'node-card-reattempt',\n label: 'Reattempt',\n icon: RedoIcon,\n disabled: !canReset,\n onClick: handleOnMenuOptionClick,\n },\n ];\n\n return (\n <ContextMenu\n targetElement={\n <Styled.NodeCardContainer\n $background={`${imageHue}_2`}\n $disabled={sheetLocked}\n onClick={handleOnNodeCardClick}\n >\n <ArrowTooltip\n renderAs=\"primary\"\n tooltipItem={sheetStatement}\n position=\"bottom\"\n zIndex={5}\n hidden={!sheetStatement}\n parentWidth=\"100%\"\n widthX={11.25}\n >\n <Styled.NodeCardInfoWrapper\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $heightX={3.5}\n $bgImage={nodeBgImage}\n $gutterX={0.78125}\n $flexGap={8.5}\n $opacity={sheetLocked ? 0.5 : 1}\n onMouseEnter={handleOnMouseEnter}\n onMouseLeave={handleOnMouseLeave}\n >\n <Styled.IconWrapper\n $width={31}\n $height={31}\n $background=\"WHITE_1\"\n $position=\"relative\"\n $alignItems=\"center\"\n $justifyContent=\"center\"\n >\n <LottieAnimation\n src={nodeCardLottie}\n ref={animationRef}\n settings={renderSettings}\n />\n {!isOptional && <Styled.StyledImportantIcon />}\n </Styled.IconWrapper>\n\n <Text $renderAs=\"ac4-black\" $color=\"BLACK\">\n {cardHeader} {inClassSheet && `• CW`}\n </Text>\n </Styled.NodeCardInfoWrapper>\n\n <NodeCardTags\n nodeType={nodeType}\n state={state}\n accuracy={accuracy}\n isStudent={isStudent}\n />\n\n {!isGoalBlock && (\n <Styled.NodeCardContentWrapper $background=\"WHITE_1\" $heightX={4}>\n <Styled.NodeCardTitle\n $renderAs=\"ab3\"\n $color=\"BLACK_1\"\n $opacity={sheetLocked ? 0.5 : 1}\n >\n {title}\n </Styled.NodeCardTitle>\n </Styled.NodeCardContentWrapper>\n )}\n </ArrowTooltip>\n </Styled.NodeCardContainer>\n }\n startLeft\n menuWidth=\"100%\"\n menuZIndex={6}\n menuOffset={2}\n menuElement={renderOptions ? <NodeMenuOptions options={menuOptions} /> : <></>}\n />\n );\n});\n\nexport default StudentActions;\n"],"names":["renderSettings","StudentActions","memo","props","nodeData","imageHue","blockType","onNodeAttempt","onNodeReattempt","onNodeReview","onNodeView","isStudent","accuracy","attemptLocation","nodeType","cardHeader","title","state","isOptional","sheetStatement","permissions","teacherMarkedAsCompleted","userAttemptId","canReview","canStart","canResume","canReset","isGoalBlock","BLOCK_TYPE","sheetLocked","NODE_CARD_STATES","inClassSheet","renderOptions","animationRef","useRef","nodeBgImage","getNodeTypeBasedBgImage","nodeCardLottie","getNodeCardBasedIcon","handleOnMenuOptionClick","useCallback","optionId","handleOnNodeCardClick","handleOnMouseEnter","_a","handleOnMouseLeave","menuOptions","Eye2Icon","RedoIcon","jsx","ContextMenu","Styled.NodeCardContainer","jsxs","ArrowTooltip","Styled.NodeCardInfoWrapper","Styled.IconWrapper","LottieAnimation","Styled.StyledImportantIcon","Text","NodeCardTags","Styled.NodeCardContentWrapper","Styled.NodeCardTitle","NodeMenuOptions","Fragment"],"mappings":";;;;;;;;;;;;;;;AAoBA,MAAMA,KAAiB,EAAE,UAAU,UAAU,UAAU,GAAM,GAEvDC,KAAuDC,EAAK,CAASC,MAAA;AACnE,QAAA;AAAA,IACJ,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WA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