@cuemath/leap 3.2.33-beta-0.2 → 3.2.33-beta-0.3
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/worksheet/worksheet/worksheet-sidebar/question-guide.js +32 -24
- package/dist/features/worksheet/worksheet/worksheet-sidebar/question-guide.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-sidebar/sidebar.js +36 -34
- package/dist/features/worksheet/worksheet/worksheet-sidebar/sidebar.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet.js +234 -252
- package/dist/features/worksheet/worksheet/worksheet.js.map +1 -1
- package/dist/features/worksheet/worksheet-preview/hooks/use-worksheet-layout.js +10 -10
- package/dist/features/worksheet/worksheet-preview/hooks/use-worksheet-layout.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,63 +1,71 @@
|
|
|
1
1
|
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { memo as
|
|
2
|
+
import { memo as v, useState as T, useCallback as h, useMemo as X, useRef as H, useEffect as y } from "react";
|
|
3
3
|
import $ from "../../../ui/buttons/clickable/clickable.js";
|
|
4
4
|
import c from "../../../ui/layout/flex-view.js";
|
|
5
|
-
import
|
|
5
|
+
import P from "../../../ui/separator/separator.js";
|
|
6
6
|
import u from "../../../ui/text/text.js";
|
|
7
7
|
import N from "../../constants/events.js";
|
|
8
|
-
import { GuideContainer as
|
|
9
|
-
const
|
|
10
|
-
({
|
|
8
|
+
import { GuideContainer as V, HintIcon as j, SolIcon as x, Pointer as B, SectionContainer as W, Section as K, CloseIcon as M, Guide as Y } from "./worksheet-sidebar-styled.js";
|
|
9
|
+
const ee = v(
|
|
10
|
+
({
|
|
11
|
+
questionWidth: f,
|
|
12
|
+
questions: _,
|
|
13
|
+
activeQuestionIndex: O,
|
|
14
|
+
learnosity: S,
|
|
15
|
+
actionbarHeight: p,
|
|
16
|
+
loggerRef: l,
|
|
17
|
+
hideSolution: k
|
|
18
|
+
}) => {
|
|
11
19
|
var C;
|
|
12
|
-
const [t, s] = T(), [
|
|
20
|
+
const [t, s] = T(), [A, R] = T({
|
|
13
21
|
top: 0,
|
|
14
22
|
left: 0
|
|
15
|
-
}), { top: g, left: b } =
|
|
23
|
+
}), { top: g, left: b } = A, w = h(() => {
|
|
16
24
|
s("HINT"), l.current(N.WORKSHEET_V3_HINT_SEEN);
|
|
17
|
-
}, [l]), w = h(() => {
|
|
18
|
-
s("SOL"), l.current(N.WORKSHEET_V3_SOLUTION_SEEN);
|
|
19
25
|
}, [l]), G = h(() => {
|
|
26
|
+
s("SOL"), l.current(N.WORKSHEET_V3_SOLUTION_SEEN);
|
|
27
|
+
}, [l]), L = h(() => {
|
|
20
28
|
s(() => {
|
|
21
29
|
});
|
|
22
|
-
}, []), { hints: n, solution: d } = ((C = _[O]) == null ? void 0 : C.metadata) || {}, o =
|
|
30
|
+
}, []), { hints: n, solution: d } = ((C = _[O]) == null ? void 0 : C.metadata) || {}, o = X(() => t === void 0 ? void 0 : t === "HINT" ? n : d, [t, n, d]), E = H(null), I = H(null), m = h((a) => {
|
|
23
31
|
if (a.current) {
|
|
24
32
|
const i = a.current.getBoundingClientRect();
|
|
25
|
-
|
|
33
|
+
R({
|
|
26
34
|
top: i.top + i.height / 2 - 8,
|
|
27
35
|
left: i.right - 78
|
|
28
36
|
// 52px (sidebar width) + 16px (gutter) + 10px
|
|
29
37
|
});
|
|
30
38
|
}
|
|
31
39
|
}, []);
|
|
32
|
-
return t && o && S && S.renderMath("mathjax"),
|
|
40
|
+
return t && o && S && S.renderMath("mathjax"), y(() => {
|
|
33
41
|
t === "HINT" ? m(I) : t === "SOL" ? m(E) : o || s(void 0);
|
|
34
|
-
}, [t, m, o]), /* @__PURE__ */ r(
|
|
35
|
-
/* @__PURE__ */ e($, { label: "hints", onClick:
|
|
36
|
-
/* @__PURE__ */ e(
|
|
42
|
+
}, [t, m, o]), /* @__PURE__ */ r(V, { $background: "WHITE", children: [
|
|
43
|
+
/* @__PURE__ */ e($, { label: "hints", onClick: w, disabled: !n, children: /* @__PURE__ */ r(c, { $alignItems: "center", $justifyContent: "center", ref: I, children: [
|
|
44
|
+
/* @__PURE__ */ e(j, { width: 32, height: 32, $disabled: !n }),
|
|
37
45
|
/* @__PURE__ */ e(u, { $renderAs: "eyebrow2", $color: n ? "BLACK" : "GREY_4", children: "HINT" }),
|
|
38
|
-
/* @__PURE__ */ e(c, { $gap: 8, $alignItems: "center", children: /* @__PURE__ */ e(
|
|
46
|
+
/* @__PURE__ */ e(c, { $gap: 8, $alignItems: "center", children: /* @__PURE__ */ e(P, { width: 24, height: 1, background: "GREY_2" }) })
|
|
39
47
|
] }) }),
|
|
40
|
-
/* @__PURE__ */ e($, { label: "solution", onClick:
|
|
41
|
-
/* @__PURE__ */ e(
|
|
48
|
+
!k && /* @__PURE__ */ e($, { label: "solution", onClick: G, disabled: !d, children: /* @__PURE__ */ r(c, { $alignItems: "center", $justifyContent: "center", ref: E, children: [
|
|
49
|
+
/* @__PURE__ */ e(x, { width: 32, height: 32, $disabled: !d }),
|
|
42
50
|
/* @__PURE__ */ e(u, { $renderAs: "eyebrow2", $color: n ? "BLACK" : "GREY_4", children: "SOL" })
|
|
43
51
|
] }) }),
|
|
44
|
-
t && g && b && /* @__PURE__ */ e(
|
|
52
|
+
t && g && b && /* @__PURE__ */ e(B, { topValue: g, leftValue: b }),
|
|
45
53
|
t && /* @__PURE__ */ e(
|
|
46
|
-
|
|
54
|
+
W,
|
|
47
55
|
{
|
|
48
56
|
$background: "WHITE",
|
|
49
57
|
$questionWidth: f,
|
|
50
58
|
$actionbarHeight: p,
|
|
51
59
|
$borderRadius: 10,
|
|
52
60
|
children: /* @__PURE__ */ r(
|
|
53
|
-
|
|
61
|
+
K,
|
|
54
62
|
{
|
|
55
63
|
$gutterX: 1,
|
|
56
64
|
$gapX: 1,
|
|
57
65
|
$questionWidth: f,
|
|
58
66
|
$actionbarHeight: p,
|
|
59
67
|
children: [
|
|
60
|
-
/* @__PURE__ */ e($, { label: "close", onClick:
|
|
68
|
+
/* @__PURE__ */ e($, { label: "close", onClick: L, children: /* @__PURE__ */ e(M, {}) }),
|
|
61
69
|
/* @__PURE__ */ e(c, { $gutterX: 0.5, children: /* @__PURE__ */ e(u, { $renderAs: "eyebrow2", $color: "ORANGE_5", $marginBottomX: 0.25, children: t === "HINT" ? "HINTS:" : "SOLUTION:" }) }),
|
|
62
70
|
o && o.map((a, i) => /* @__PURE__ */ r(c, { $gutterX: 0.5, $gapX: 0.5, children: [
|
|
63
71
|
o.length > 1 && /* @__PURE__ */ r(u, { $renderAs: "eyebrow2", $color: "ORANGE_5", $marginBottomX: 0.25, children: [
|
|
@@ -67,7 +75,7 @@ const Z = L(
|
|
|
67
75
|
":"
|
|
68
76
|
] }),
|
|
69
77
|
/* @__PURE__ */ e(
|
|
70
|
-
|
|
78
|
+
Y,
|
|
71
79
|
{
|
|
72
80
|
dangerouslySetInnerHTML: {
|
|
73
81
|
__html: a
|
|
@@ -84,6 +92,6 @@ const Z = L(
|
|
|
84
92
|
}
|
|
85
93
|
);
|
|
86
94
|
export {
|
|
87
|
-
|
|
95
|
+
ee as default
|
|
88
96
|
};
|
|
89
97
|
//# sourceMappingURL=question-guide.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question-guide.js","sources":["../../../../../src/features/worksheet/worksheet/worksheet-sidebar/question-guide.tsx"],"sourcesContent":["import type { ILearnosity, IWorksheetProps, IWorksheetQuestion } from '../worksheet-types';\n\nimport React, { memo, useCallback, useEffect, useMemo, useState, useRef } from 'react';\n\nimport Clickable from '../../../ui/buttons/clickable/clickable';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport EVENTS from '../../constants/events';\nimport {\n Section,\n GuideContainer,\n CloseIcon,\n SolIcon,\n HintIcon,\n SectionContainer,\n Guide,\n Pointer,\n} from './worksheet-sidebar-styled';\n\ntype TSections = 'HINT' | 'SOL';\n\ninterface IQuestionGuideProps extends Pick<IWorksheetProps, 'loggerRef'> {\n questionWidth: number;\n questions: IWorksheetQuestion[];\n activeQuestionIndex: number;\n learnosity: ILearnosity;\n actionbarHeight: number;\n hideSolution?: boolean;\n}\n\nconst QuestionGuide: React.FC<IQuestionGuideProps> = memo(\n ({
|
|
1
|
+
{"version":3,"file":"question-guide.js","sources":["../../../../../src/features/worksheet/worksheet/worksheet-sidebar/question-guide.tsx"],"sourcesContent":["import type { ILearnosity, IWorksheetProps, IWorksheetQuestion } from '../worksheet-types';\n\nimport React, { memo, useCallback, useEffect, useMemo, useState, useRef } from 'react';\n\nimport Clickable from '../../../ui/buttons/clickable/clickable';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport EVENTS from '../../constants/events';\nimport {\n Section,\n GuideContainer,\n CloseIcon,\n SolIcon,\n HintIcon,\n SectionContainer,\n Guide,\n Pointer,\n} from './worksheet-sidebar-styled';\n\ntype TSections = 'HINT' | 'SOL';\n\ninterface IQuestionGuideProps extends Pick<IWorksheetProps, 'loggerRef'> {\n questionWidth: number;\n questions: IWorksheetQuestion[];\n activeQuestionIndex: number;\n learnosity: ILearnosity;\n actionbarHeight: number;\n hideSolution?: boolean;\n}\n\nconst QuestionGuide: React.FC<IQuestionGuideProps> = memo(\n ({\n questionWidth,\n questions,\n activeQuestionIndex,\n learnosity,\n actionbarHeight,\n loggerRef,\n hideSolution,\n }) => {\n const [activeSection, setActiveSection] = useState<TSections | undefined>();\n const [pointerPosition, setPointerPosition] = useState({\n top: 0,\n left: 0,\n });\n const { top, left } = pointerPosition;\n\n const handleHintClick = useCallback(() => {\n setActiveSection('HINT');\n loggerRef.current(EVENTS.WORKSHEET_V3_HINT_SEEN);\n }, [loggerRef]);\n const handleSolClick = useCallback(() => {\n setActiveSection('SOL');\n loggerRef.current(EVENTS.WORKSHEET_V3_SOLUTION_SEEN);\n }, [loggerRef]);\n const handleClose = useCallback(() => {\n setActiveSection(() => undefined);\n }, []);\n\n const { hints, solution } = questions[activeQuestionIndex]?.metadata || {};\n\n const activeSectionData = useMemo(() => {\n return activeSection === undefined ? undefined : activeSection === 'HINT' ? hints : solution;\n }, [activeSection, hints, solution]);\n\n const sqlRef = useRef<HTMLDivElement>(null) as React.RefObject<HTMLDivElement>;\n const hintRef = useRef<HTMLDivElement>(null) as React.RefObject<HTMLDivElement>;\n\n const updatePointerPosition = useCallback((ref: React.RefObject<HTMLDivElement>) => {\n if (ref.current) {\n const rect = ref.current.getBoundingClientRect();\n\n setPointerPosition({\n top: rect.top + rect.height / 2 - 8,\n left: rect.right - 78, // 52px (sidebar width) + 16px (gutter) + 10px\n });\n }\n }, []);\n\n if (activeSection && activeSectionData && learnosity) {\n learnosity.renderMath('mathjax');\n }\n\n useEffect(() => {\n if (activeSection === 'HINT') {\n updatePointerPosition(hintRef);\n } else if (activeSection === 'SOL') {\n updatePointerPosition(sqlRef);\n } else if (!activeSectionData) {\n setActiveSection(undefined);\n }\n }, [activeSection, updatePointerPosition, activeSectionData]);\n\n return (\n <GuideContainer $background=\"WHITE\">\n <Clickable label=\"hints\" onClick={handleHintClick} disabled={!hints}>\n <FlexView $alignItems=\"center\" $justifyContent=\"center\" ref={hintRef}>\n <HintIcon width={32} height={32} $disabled={!hints} />\n <Text $renderAs=\"eyebrow2\" $color={!hints ? 'GREY_4' : 'BLACK'}>\n HINT\n </Text>\n <FlexView $gap={8} $alignItems=\"center\">\n <Separator width={24} height={1} background=\"GREY_2\" />\n </FlexView>\n </FlexView>\n </Clickable>\n {!hideSolution && (\n <Clickable label=\"solution\" onClick={handleSolClick} disabled={!solution}>\n <FlexView $alignItems=\"center\" $justifyContent=\"center\" ref={sqlRef}>\n <SolIcon width={32} height={32} $disabled={!solution} />\n <Text $renderAs=\"eyebrow2\" $color={!hints ? 'GREY_4' : 'BLACK'}>\n SOL\n </Text>\n </FlexView>\n </Clickable>\n )}\n {activeSection && top && left && <Pointer topValue={top} leftValue={left} />}\n {activeSection && (\n <SectionContainer\n $background=\"WHITE\"\n $questionWidth={questionWidth}\n $actionbarHeight={actionbarHeight}\n $borderRadius={10}\n >\n <Section\n $gutterX={1}\n $gapX={1}\n $questionWidth={questionWidth}\n $actionbarHeight={actionbarHeight}\n >\n <Clickable label=\"close\" onClick={handleClose}>\n <CloseIcon />\n </Clickable>\n <FlexView $gutterX={0.5}>\n <Text $renderAs=\"eyebrow2\" $color=\"ORANGE_5\" $marginBottomX={0.25}>\n {activeSection === 'HINT' ? 'HINTS:' : 'SOLUTION:'}\n </Text>\n </FlexView>\n {activeSectionData &&\n activeSectionData.map((item, index) => (\n <FlexView $gutterX={0.5} $gapX={0.5} key={index.toString()}>\n {activeSectionData.length > 1 && (\n <Text $renderAs=\"eyebrow2\" $color=\"ORANGE_5\" $marginBottomX={0.25}>\n {activeSection} {index + 1}:\n </Text>\n )}\n <Guide\n dangerouslySetInnerHTML={{\n __html: item,\n }}\n />\n </FlexView>\n ))}\n </Section>\n </SectionContainer>\n )}\n </GuideContainer>\n );\n },\n);\n\nexport default QuestionGuide;\n"],"names":["QuestionGuide","memo","questionWidth","questions","activeQuestionIndex","learnosity","actionbarHeight","loggerRef","hideSolution","activeSection","setActiveSection","useState","pointerPosition","setPointerPosition","top","left","handleHintClick","useCallback","EVENTS","handleSolClick","handleClose","hints","solution","_a","activeSectionData","useMemo","sqlRef","useRef","hintRef","updatePointerPosition","ref","rect","useEffect","jsxs","GuideContainer","jsx","Clickable","FlexView","HintIcon","Text","Separator","SolIcon","Pointer","SectionContainer","Section","CloseIcon","item","index","Guide"],"mappings":";;;;;;;;AA+BA,MAAMA,KAA+CC;AAAA,EACnD,CAAC;AAAA,IACC,eAAAC;AAAA,IACA,WAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,EAAA,MACI;;AACJ,UAAM,CAACC,GA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;AAAA,YAAA;AAAA,cACC,UAAU;AAAA,cACV,OAAO;AAAA,cACP,gBAAgB1C;AAAA,cAChB,kBAAkBI;AAAA,cAElB,UAAA;AAAA,gBAAA,gBAAA6B,EAACC,KAAU,OAAM,SAAQ,SAAShB,GAChC,UAAA,gBAAAe,EAACU,KAAU,EACb,CAAA;AAAA,kCACCR,GAAS,EAAA,UAAU,KAClB,UAAA,gBAAAF,EAACI,KAAK,WAAU,YAAW,QAAO,YAAW,gBAAgB,MAC1D,UAAA9B,MAAkB,SAAS,WAAW,YACzC,CAAA,GACF;AAAA,gBACCe,KACCA,EAAkB,IAAI,CAACsB,GAAMC,MAC3B,gBAAAd,EAACI,GAAS,EAAA,UAAU,KAAK,OAAO,KAC7B,UAAA;AAAA,kBAAkBb,EAAA,SAAS,KACzB,gBAAAS,EAAAM,GAAA,EAAK,WAAU,YAAW,QAAO,YAAW,gBAAgB,MAC1D,UAAA;AAAA,oBAAA9B;AAAA,oBAAc;AAAA,oBAAEsC,IAAQ;AAAA,oBAAE;AAAA,kBAAA,GAC7B;AAAA,kBAEF,gBAAAZ;AAAA,oBAACa;AAAA,oBAAA;AAAA,sBACC,yBAAyB;AAAA,wBACvB,QAAQF;AAAA,sBACV;AAAA,oBAAA;AAAA,kBACF;AAAA,gBAAA,KAVwCC,EAAM,SAAS,CAWzD,CACD;AAAA,cAAA;AAAA,YAAA;AAAA,UACL;AAAA,QAAA;AAAA,MACF;AAAA,IAEJ,EAAA,CAAA;AAAA,EAEJ;AACF;"}
|
|
@@ -1,49 +1,51 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { SIDEBAR_WIDTH as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { SideBarContainer as
|
|
9
|
-
const
|
|
1
|
+
import { jsxs as l, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { memo as u, useMemo as x, useCallback as g } from "react";
|
|
3
|
+
import w from "../../../ui/layout/flex-view.js";
|
|
4
|
+
import C from "../../../ui/separator/separator.js";
|
|
5
|
+
import { SIDEBAR_WIDTH as s } from "../constants.js";
|
|
6
|
+
import T from "./navigator.js";
|
|
7
|
+
import j from "./question-guide.js";
|
|
8
|
+
import { SideBarContainer as k, UnderlinedTextWrapper as B, UnderlinedText as D } from "./worksheet-sidebar-styled.js";
|
|
9
|
+
const _ = u(
|
|
10
10
|
({
|
|
11
|
-
questionWidth:
|
|
12
|
-
questions:
|
|
11
|
+
questionWidth: i,
|
|
12
|
+
questions: o,
|
|
13
13
|
activeQuestionIndex: m,
|
|
14
14
|
learnosity: a,
|
|
15
|
-
userType:
|
|
16
|
-
height:
|
|
17
|
-
actionbarHeight:
|
|
18
|
-
openQuestionFeedbackModal:
|
|
19
|
-
loggerRef:
|
|
15
|
+
userType: n,
|
|
16
|
+
height: h,
|
|
17
|
+
actionbarHeight: d,
|
|
18
|
+
openQuestionFeedbackModal: t,
|
|
19
|
+
loggerRef: p,
|
|
20
|
+
isPuzzleCard: f
|
|
20
21
|
}) => {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
}, [
|
|
24
|
-
return
|
|
25
|
-
|
|
22
|
+
const $ = o[m], { item_reference: c } = $ ?? {}, e = x(() => n === "STUDENT", [n]), S = g(() => {
|
|
23
|
+
t && t(c || "");
|
|
24
|
+
}, [c, t]);
|
|
25
|
+
return !f && (e || !t) ? null : /* @__PURE__ */ l(
|
|
26
|
+
k,
|
|
26
27
|
{
|
|
27
|
-
$width:
|
|
28
|
-
$questionWidth:
|
|
29
|
-
$height:
|
|
28
|
+
$width: s,
|
|
29
|
+
$questionWidth: i,
|
|
30
|
+
$height: h,
|
|
30
31
|
$justifyContent: "space-between",
|
|
31
32
|
children: [
|
|
32
|
-
/* @__PURE__ */ r(
|
|
33
|
-
/* @__PURE__ */
|
|
33
|
+
!e && /* @__PURE__ */ r(B, { $width: s, $alignItems: "flex-start", $gapX: 0.5, children: /* @__PURE__ */ r(D, { $renderAs: "cta1", onClick: S, children: "Question Feedback" }) }),
|
|
34
|
+
/* @__PURE__ */ l(w, { children: [
|
|
34
35
|
/* @__PURE__ */ r(
|
|
35
|
-
|
|
36
|
+
j,
|
|
36
37
|
{
|
|
37
|
-
questionWidth:
|
|
38
|
-
questions:
|
|
38
|
+
questionWidth: i,
|
|
39
|
+
questions: o,
|
|
39
40
|
activeQuestionIndex: m,
|
|
40
41
|
learnosity: a,
|
|
41
|
-
actionbarHeight:
|
|
42
|
-
loggerRef:
|
|
42
|
+
actionbarHeight: d,
|
|
43
|
+
loggerRef: p,
|
|
44
|
+
hideSolution: e && f
|
|
43
45
|
}
|
|
44
46
|
),
|
|
45
|
-
/* @__PURE__ */ r(
|
|
46
|
-
/* @__PURE__ */ r(
|
|
47
|
+
/* @__PURE__ */ r(C, { heightX: 0.5 }),
|
|
48
|
+
/* @__PURE__ */ r(T, {})
|
|
47
49
|
] })
|
|
48
50
|
]
|
|
49
51
|
}
|
|
@@ -51,6 +53,6 @@ const I = $(
|
|
|
51
53
|
}
|
|
52
54
|
);
|
|
53
55
|
export {
|
|
54
|
-
|
|
56
|
+
_ as default
|
|
55
57
|
};
|
|
56
58
|
//# sourceMappingURL=sidebar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.js","sources":["../../../../../src/features/worksheet/worksheet/worksheet-sidebar/sidebar.tsx"],"sourcesContent":["import type { TUserTypes } from '../../../ui/types';\nimport type { ILearnosity, IWorksheetProps, IWorksheetQuestion } from '../worksheet-types';\n\nimport { memo, useCallback } from 'react';\n\nimport FlexView from '../../../ui/layout/flex-view';\nimport Separator from '../../../ui/separator/separator';\nimport { SIDEBAR_WIDTH } from '../constants';\nimport Navigator from './navigator';\nimport QuestionGuide from './question-guide';\nimport {\n SideBarContainer,\n UnderlinedText,\n UnderlinedTextWrapper,\n} from './worksheet-sidebar-styled';\n\ninterface IWorksheetSideBarProps extends Pick<IWorksheetProps, 'loggerRef'> {\n questionWidth: number;\n questions: IWorksheetQuestion[];\n activeQuestionIndex: number;\n learnosity: ILearnosity;\n userType: TUserTypes;\n height: number | string;\n actionbarHeight: number;\n openQuestionFeedbackModal?: (itemRef: string) => void;\n}\n\nconst WorksheetSideBar: React.FC<IWorksheetSideBarProps> = memo(\n ({\n questionWidth,\n questions,\n activeQuestionIndex,\n learnosity,\n userType,\n height,\n actionbarHeight,\n openQuestionFeedbackModal,\n loggerRef,\n }) => {\n const activeQuestion = questions[activeQuestionIndex];\n const { item_reference: itemRef } = activeQuestion ?? {};\n\n const onFeedbackClick = useCallback(() => {\n if (openQuestionFeedbackModal) {\n openQuestionFeedbackModal(itemRef || '');\n }\n }, [itemRef, openQuestionFeedbackModal]);\n\n if (
|
|
1
|
+
{"version":3,"file":"sidebar.js","sources":["../../../../../src/features/worksheet/worksheet/worksheet-sidebar/sidebar.tsx"],"sourcesContent":["import type { TUserTypes } from '../../../ui/types';\nimport type { ILearnosity, IWorksheetProps, IWorksheetQuestion } from '../worksheet-types';\n\nimport { memo, useCallback, useMemo } from 'react';\n\nimport FlexView from '../../../ui/layout/flex-view';\nimport Separator from '../../../ui/separator/separator';\nimport { SIDEBAR_WIDTH } from '../constants';\nimport Navigator from './navigator';\nimport QuestionGuide from './question-guide';\nimport {\n SideBarContainer,\n UnderlinedText,\n UnderlinedTextWrapper,\n} from './worksheet-sidebar-styled';\n\ninterface IWorksheetSideBarProps extends Pick<IWorksheetProps, 'loggerRef'> {\n questionWidth: number;\n questions: IWorksheetQuestion[];\n activeQuestionIndex: number;\n learnosity: ILearnosity;\n userType: TUserTypes;\n height: number | string;\n actionbarHeight: number;\n openQuestionFeedbackModal?: (itemRef: string) => void;\n isPuzzleCard?: boolean;\n}\n\nconst WorksheetSideBar: React.FC<IWorksheetSideBarProps> = memo(\n ({\n questionWidth,\n questions,\n activeQuestionIndex,\n learnosity,\n userType,\n height,\n actionbarHeight,\n openQuestionFeedbackModal,\n loggerRef,\n isPuzzleCard,\n }) => {\n const activeQuestion = questions[activeQuestionIndex];\n const { item_reference: itemRef } = activeQuestion ?? {};\n const isStudent = useMemo(() => userType === 'STUDENT', [userType]);\n\n const onFeedbackClick = useCallback(() => {\n if (openQuestionFeedbackModal) {\n openQuestionFeedbackModal(itemRef || '');\n }\n }, [itemRef, openQuestionFeedbackModal]);\n\n if (!isPuzzleCard && (isStudent || !openQuestionFeedbackModal)) return null;\n\n return (\n <SideBarContainer\n $width={SIDEBAR_WIDTH}\n $questionWidth={questionWidth}\n $height={height}\n $justifyContent=\"space-between\"\n >\n {!isStudent && (\n <UnderlinedTextWrapper $width={SIDEBAR_WIDTH} $alignItems=\"flex-start\" $gapX={0.5}>\n <UnderlinedText $renderAs=\"cta1\" onClick={onFeedbackClick}>\n Question Feedback\n </UnderlinedText>\n </UnderlinedTextWrapper>\n )}\n\n <FlexView>\n <QuestionGuide\n questionWidth={questionWidth}\n questions={questions}\n activeQuestionIndex={activeQuestionIndex}\n learnosity={learnosity}\n actionbarHeight={actionbarHeight}\n loggerRef={loggerRef}\n hideSolution={isStudent && isPuzzleCard}\n />\n <Separator heightX={0.5} />\n <Navigator />\n </FlexView>\n </SideBarContainer>\n );\n },\n);\n\nexport default WorksheetSideBar;\n"],"names":["WorksheetSideBar","memo","questionWidth","questions","activeQuestionIndex","learnosity","userType","height","actionbarHeight","openQuestionFeedbackModal","loggerRef","isPuzzleCard","activeQuestion","itemRef","isStudent","useMemo","onFeedbackClick","useCallback","jsxs","SideBarContainer","SIDEBAR_WIDTH","jsx","UnderlinedTextWrapper","UnderlinedText","FlexView","QuestionGuide","Separator","Navigator"],"mappings":";;;;;;;;AA4BA,MAAMA,IAAqDC;AAAA,EACzD,CAAC;AAAA,IACC,eAAAC;AAAA,IACA,WAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,UAAAC;AAAA,IACA,QAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,2BAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC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