@cuemath/leap 3.0.19-gs1 → 3.0.20-gs1
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 +61 -54
- package/dist/features/chapters-v2/chapter-details/block-sections/block-sections.js.map +1 -1
- package/dist/features/chapters-v2/utils/index.js +2 -1
- package/dist/features/chapters-v2/utils/index.js.map +1 -1
- package/package.json +1 -1
@@ -1,13 +1,13 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { memo as
|
3
|
-
import
|
4
|
-
import { ChapterDetailsWrapper as
|
5
|
-
const
|
1
|
+
import { jsxs as S, jsx as s } from "react/jsx-runtime";
|
2
|
+
import { memo as w, useMemo as x } from "react";
|
3
|
+
import _ from "./block-section-view.js";
|
4
|
+
import { ChapterDetailsWrapper as E } from "./block-sections-styled.js";
|
5
|
+
const y = w((g) => {
|
6
6
|
const {
|
7
7
|
blocks: n,
|
8
8
|
imageHue: t,
|
9
9
|
userType: l,
|
10
|
-
coreBlocksRef:
|
10
|
+
coreBlocksRef: h,
|
11
11
|
onNodeAttempt: r,
|
12
12
|
onNodeAssignAsHomework: i,
|
13
13
|
onNodeMarkAsDone: c,
|
@@ -15,62 +15,69 @@ const L = I((_) => {
|
|
15
15
|
onNodeReview: d,
|
16
16
|
onNodeView: k,
|
17
17
|
onBlockSkipUnskip: m
|
18
|
-
} =
|
18
|
+
} = g;
|
19
19
|
let u = 0;
|
20
|
-
const { goalBlocks: a, nonGoalBlocks:
|
20
|
+
const { goalBlocks: a, nonGoalBlocks: B } = x(
|
21
21
|
() => n.reduce(
|
22
22
|
(o, e) => (e.section_code === "GOALS" || e.section_code === "READINESS" ? o.goalBlocks.push(e) : o.nonGoalBlocks.push(e), o),
|
23
23
|
{ goalBlocks: [], nonGoalBlocks: [] }
|
24
24
|
),
|
25
25
|
[n]
|
26
26
|
);
|
27
|
-
return /* @__PURE__ */
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
27
|
+
return /* @__PURE__ */ S(
|
28
|
+
E,
|
29
|
+
{
|
30
|
+
$width: "100%",
|
31
|
+
$background: B.length ? "WHITE_3" : "WHITE_1",
|
32
|
+
children: [
|
33
|
+
/* @__PURE__ */ s("div", { ref: h, children: a.map((o, e) => {
|
34
|
+
const { block_type: A, block_id: N, permissions: G } = o;
|
35
|
+
let f = 0;
|
36
|
+
const I = e === a.length - 1;
|
37
|
+
return A === "GOAL" && (G.can_un_skip || (u += 1), f = u), /* @__PURE__ */ s(
|
38
|
+
_,
|
39
|
+
{
|
40
|
+
blockData: o,
|
41
|
+
userType: l,
|
42
|
+
isLastBlock: I,
|
43
|
+
lessonIdx: f,
|
44
|
+
imageHue: t,
|
45
|
+
isGoalBlock: !0,
|
46
|
+
onNodeAttempt: r,
|
47
|
+
onNodeAssignAsHomework: i,
|
48
|
+
onNodeMarkAsDone: c,
|
49
|
+
onNodeReattempt: p,
|
50
|
+
onNodeReview: d,
|
51
|
+
onNodeView: k,
|
52
|
+
onBlockSkipUnskip: m
|
53
|
+
},
|
54
|
+
N
|
55
|
+
);
|
56
|
+
}) }),
|
57
|
+
B.map((o) => {
|
58
|
+
const { block_id: e } = o;
|
59
|
+
return /* @__PURE__ */ s(
|
60
|
+
_,
|
61
|
+
{
|
62
|
+
blockData: o,
|
63
|
+
userType: l,
|
64
|
+
imageHue: t,
|
65
|
+
onNodeAttempt: r,
|
66
|
+
onNodeAssignAsHomework: i,
|
67
|
+
onNodeMarkAsDone: c,
|
68
|
+
onNodeReattempt: p,
|
69
|
+
onNodeReview: d,
|
70
|
+
onNodeView: k,
|
71
|
+
onBlockSkipUnskip: m
|
72
|
+
},
|
73
|
+
e
|
74
|
+
);
|
75
|
+
})
|
76
|
+
]
|
77
|
+
}
|
78
|
+
);
|
72
79
|
});
|
73
80
|
export {
|
74
|
-
|
81
|
+
y as default
|
75
82
|
};
|
76
83
|
//# 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, useMemo } from 'react';\n\nimport BlockSectionView from './block-section-view';\nimport * as Styled from './block-sections-styled';\n\nconst BlockSections: FC<IBlockSectionsProps> = memo(props => {\n const {\n blocks,\n imageHue,\n userType,\n coreBlocksRef,\n onNodeAttempt,\n onNodeAssignAsHomework,\n onNodeMarkAsDone,\n onNodeReattempt,\n onNodeReview,\n onNodeView,\n onBlockSkipUnskip,\n } = props;\n\n let lessonCount = 0;\n\n const { goalBlocks, nonGoalBlocks } = useMemo(\n () =>\n blocks.reduce(\n (acc, block) => {\n if (block.section_code === 'GOALS' || block.section_code === 'READINESS') {\n acc.goalBlocks.push(block);\n } else {\n acc.nonGoalBlocks.push(block);\n }\n\n return acc;\n },\n { goalBlocks: [] as typeof blocks, nonGoalBlocks: [] as typeof blocks },\n ),\n [blocks],\n );\n\n return (\n <Styled.ChapterDetailsWrapper
|
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, useMemo } from 'react';\n\nimport BlockSectionView from './block-section-view';\nimport * as Styled from './block-sections-styled';\n\nconst BlockSections: FC<IBlockSectionsProps> = memo(props => {\n const {\n blocks,\n imageHue,\n userType,\n coreBlocksRef,\n onNodeAttempt,\n onNodeAssignAsHomework,\n onNodeMarkAsDone,\n onNodeReattempt,\n onNodeReview,\n onNodeView,\n onBlockSkipUnskip,\n } = props;\n\n let lessonCount = 0;\n\n const { goalBlocks, nonGoalBlocks } = useMemo(\n () =>\n blocks.reduce(\n (acc, block) => {\n if (block.section_code === 'GOALS' || block.section_code === 'READINESS') {\n acc.goalBlocks.push(block);\n } else {\n acc.nonGoalBlocks.push(block);\n }\n\n return acc;\n },\n { goalBlocks: [] as typeof blocks, nonGoalBlocks: [] as typeof blocks },\n ),\n [blocks],\n );\n\n return (\n <Styled.ChapterDetailsWrapper\n $width=\"100%\"\n $background={!nonGoalBlocks.length ? `WHITE_1` : 'WHITE_3'}\n >\n <div ref={coreBlocksRef}>\n {goalBlocks.map((blockData, idx) => {\n const { block_type: blockType, block_id: blockId, permissions } = blockData;\n let lessonIdx = 0;\n\n const isLastBlock = idx === goalBlocks.length - 1;\n\n if (blockType === 'GOAL') {\n if (!permissions.can_un_skip) {\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 onNodeAssignAsHomework={onNodeAssignAsHomework}\n onNodeMarkAsDone={onNodeMarkAsDone}\n onNodeReattempt={onNodeReattempt}\n onNodeReview={onNodeReview}\n onNodeView={onNodeView}\n onBlockSkipUnskip={onBlockSkipUnskip}\n />\n );\n })}\n </div>\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 onNodeAssignAsHomework={onNodeAssignAsHomework}\n onNodeMarkAsDone={onNodeMarkAsDone}\n onNodeReattempt={onNodeReattempt}\n onNodeReview={onNodeReview}\n onNodeView={onNodeView}\n onBlockSkipUnskip={onBlockSkipUnskip}\n />\n );\n })}\n </Styled.ChapterDetailsWrapper>\n );\n});\n\nexport default BlockSections;\n"],"names":["BlockSections","memo","props","blocks","imageHue","userType","coreBlocksRef","onNodeAttempt","onNodeAssignAsHomework","onNodeMarkAsDone","onNodeReattempt","onNodeReview","onNodeView","onBlockSkipUnskip","lessonCount","goalBlocks","nonGoalBlocks","useMemo","acc","block","jsxs","Styled.ChapterDetailsWrapper","jsx","blockData","idx","blockType","blockId","permissions","lessonIdx","isLastBlock","BlockSectionView"],"mappings":";;;;AAQM,MAAAA,IAAyCC,EAAK,CAASC,MAAA;AACrD,QAAA;AAAA,IACJ,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,eAAAC;AAAA,IACA,eAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,YAAAC;AAAA,IACA,mBAAAC;AAAA,EACE,IAAAX;AAEJ,MAAIY,IAAc;AAEZ,QAAA,EAAE,YAAAC,GAAY,eAAAC,EAAA,IAAkBC;AAAA,IACpC,MACEd,EAAO;AAAA,MACL,CAACe,GAAKC,OACAA,EAAM,iBAAiB,WAAWA,EAAM,iBAAiB,cACvDD,EAAA,WAAW,KAAKC,CAAK,IAErBD,EAAA,cAAc,KAAKC,CAAK,GAGvBD;AAAA,MAET,EAAE,YAAY,CAAA,GAAqB,eAAe,GAAoB;AAAA,IACxE;AAAA,IACF,CAACf,CAAM;AAAA,EAAA;AAIP,SAAA,gBAAAiB;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,QAAO;AAAA,MACP,aAAcL,EAAc,SAAqB,YAAZ;AAAA,MAErC,UAAA;AAAA,QAAA,gBAAAM,EAAC,SAAI,KAAKhB,GACP,YAAW,IAAI,CAACiB,GAAWC,MAAQ;AAClC,gBAAM,EAAE,YAAYC,GAAW,UAAUC,GAAS,aAAAC,EAAgB,IAAAJ;AAClE,cAAIK,IAAY;AAEV,gBAAAC,IAAcL,MAAQT,EAAW,SAAS;AAEhD,iBAAIU,MAAc,WACXE,EAAY,gBACAb,KAAA,IAGLc,IAAAd,IAIZ,gBAAAQ;AAAA,YAACQ;AAAA,YAAA;AAAA,cACC,WAAAP;AAAA,cACA,UAAAlB;AAAA,cACA,aAAAwB;AAAA,cAEA,WAAAD;AAAA,cACA,UAAAxB;AAAA,cACA,aAAW;AAAA,cACX,eAAAG;AAAA,cACA,wBAAAC;AAAA,cACA,kBAAAC;AAAA,cACA,iBAAAC;AAAA,cACA,cAAAC;AAAA,cACA,YAAAC;AAAA,cACA,mBAAAC;AAAA,YAAA;AAAA,YAVKa;AAAA,UAAA;AAAA,QAaV,CAAA,GACH;AAAA,QAECV,EAAc,IAAI,CAAaO,MAAA;AACxB,gBAAA,EAAE,UAAUG,EAAY,IAAAH;AAG5B,iBAAA,gBAAAD;AAAA,YAACQ;AAAA,YAAA;AAAA,cAEC,WAAAP;AAAA,cACA,UAAAlB;AAAA,cACA,UAAAD;AAAA,cACA,eAAAG;AAAA,cACA,wBAAAC;AAAA,cACA,kBAAAC;AAAA,cACA,iBAAAC;AAAA,cACA,cAAAC;AAAA,cACA,YAAAC;AAAA,cACA,mBAAAC;AAAA,YAAA;AAAA,YAVKa;AAAA,UAAA;AAAA,QAWP,CAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/features/chapters-v2/utils/index.ts"],"sourcesContent":["import type { IChapterProgressStats } from '../chapter-details/chapter-details-types';\nimport type { INodeDataProps } from '../comps/node-card/node-card-types';\n\nimport { ILLUSTRATIONS } from '../../../assets/illustrations/illustrations';\n\n// This function calculates the completion percentage of a chapter based on progress stats.\n// If no progress stats are provided, it returns 0.\n// It uses the `mandatory` field from the progress stats to determine the completed and total items.\n// It returns an integer representing the percentage of completion, rounded down to the nearest whole number.\nconst getChapterCompletionPercentage = (progressStats: IChapterProgressStats | null) => {\n if (!progressStats) return 0;\n\n const { mandatory } = progressStats;\n const { completed, total } = mandatory;\n\n if (total === 0) {\n return 0;\n }\n\n const percentage = Math.floor((completed / total) * 100);\n\n return percentage;\n};\n\nconst getNodeTypeBasedBgImage = (nodeType: INodeDataProps['node_type']) => {\n switch (nodeType) {\n case 'LEARNING':\n case 'LEVEL2':\n case 'LEVEL3':\n return ILLUSTRATIONS.NODE_LEARN_BG;\n case 'RECAP':\n case 'REMEDIAL':\n case 'REVISION':\n return ILLUSTRATIONS.NODE_RECAP_BG;\n\n case 'DYNAMIC':\n case 'ASSESSMENT':\n case 'CHAPTER_ASSESSMENT':\n case 'DIAGNOSTIC':\n return ILLUSTRATIONS.NODE_CUSTOM_TEST_BG;\n\n case 'PRACTICE':\n case 'EXTRA_PRACTICE':\n case 'TARGET_PRACTICE':\n case 'MASTERY':\n return ILLUSTRATIONS.NODE_PRACTICE_BG;\n\n case 'PUZZLE':\n case 'PUZZLE_EASY':\n case 'PUZZLE_MEDIUM':\n case 'PUZZLE_HARD':\n return ILLUSTRATIONS.NODE_PUZZLE_BG;\n\n case 'VIDEO':\n return ILLUSTRATIONS.NODE_VIDEO_BG;\n\n default:\n return ILLUSTRATIONS.NODE_CUSTOM_TEST_BG;\n }\n};\n\nconst getSheetNLessonCount = (\n isSkipped: boolean,\n sheetsLength: number,\n isGoalBlock?: boolean,\n lessonIdx?: number,\n) => {\n if (
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/features/chapters-v2/utils/index.ts"],"sourcesContent":["import type { IChapterProgressStats } from '../chapter-details/chapter-details-types';\nimport type { INodeDataProps } from '../comps/node-card/node-card-types';\n\nimport { ILLUSTRATIONS } from '../../../assets/illustrations/illustrations';\n\n// This function calculates the completion percentage of a chapter based on progress stats.\n// If no progress stats are provided, it returns 0.\n// It uses the `mandatory` field from the progress stats to determine the completed and total items.\n// It returns an integer representing the percentage of completion, rounded down to the nearest whole number.\nconst getChapterCompletionPercentage = (progressStats: IChapterProgressStats | null) => {\n if (!progressStats) return 0;\n\n const { mandatory } = progressStats;\n const { completed, total } = mandatory;\n\n if (total === 0) {\n return 0;\n }\n\n const percentage = Math.floor((completed / total) * 100);\n\n return percentage;\n};\n\nconst getNodeTypeBasedBgImage = (nodeType: INodeDataProps['node_type']) => {\n switch (nodeType) {\n case 'LEARNING':\n case 'LEVEL2':\n case 'LEVEL3':\n return ILLUSTRATIONS.NODE_LEARN_BG;\n case 'RECAP':\n case 'REMEDIAL':\n case 'REVISION':\n return ILLUSTRATIONS.NODE_RECAP_BG;\n\n case 'DYNAMIC':\n case 'ASSESSMENT':\n case 'CHAPTER_ASSESSMENT':\n case 'DIAGNOSTIC':\n return ILLUSTRATIONS.NODE_CUSTOM_TEST_BG;\n\n case 'PRACTICE':\n case 'EXTRA_PRACTICE':\n case 'TARGET_PRACTICE':\n case 'MASTERY':\n return ILLUSTRATIONS.NODE_PRACTICE_BG;\n\n case 'PUZZLE':\n case 'PUZZLE_EASY':\n case 'PUZZLE_MEDIUM':\n case 'PUZZLE_HARD':\n return ILLUSTRATIONS.NODE_PUZZLE_BG;\n\n case 'VIDEO':\n return ILLUSTRATIONS.NODE_VIDEO_BG;\n\n default:\n return ILLUSTRATIONS.NODE_CUSTOM_TEST_BG;\n }\n};\n\nconst getSheetNLessonCount = (\n isSkipped: boolean,\n sheetsLength: number,\n isGoalBlock?: boolean,\n lessonIdx?: number,\n) => {\n if (!isGoalBlock) return `(${sheetsLength})`;\n\n if (isSkipped || !lessonIdx) return undefined;\n\n return `${lessonIdx}`;\n};\n\nexport { getChapterCompletionPercentage, getNodeTypeBasedBgImage, getSheetNLessonCount };\n"],"names":["getChapterCompletionPercentage","progressStats","mandatory","completed","total","getNodeTypeBasedBgImage","nodeType","ILLUSTRATIONS","getSheetNLessonCount","isSkipped","sheetsLength","isGoalBlock","lessonIdx"],"mappings":";AASM,MAAAA,IAAiC,CAACC,MAAgD;AAClF,MAAA,CAACA,EAAsB,QAAA;AAErB,QAAA,EAAE,WAAAC,EAAc,IAAAD,GAChB,EAAE,WAAAE,GAAW,OAAAC,EAAU,IAAAF;AAE7B,SAAIE,MAAU,IACL,IAGU,KAAK,MAAOD,IAAYC,IAAS,GAAG;AAGzD,GAEMC,IAA0B,CAACC,MAA0C;AACzE,UAAQA,GAAU;AAAA,IAChB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAOC,EAAc;AAAA,IACvB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAOA,EAAc;AAAA,IAEvB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAOA,EAAc;AAAA,IAEvB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAOA,EAAc;AAAA,IAEvB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAOA,EAAc;AAAA,IAEvB,KAAK;AACH,aAAOA,EAAc;AAAA,IAEvB;AACE,aAAOA,EAAc;AAAA,EACzB;AACF,GAEMC,IAAuB,CAC3BC,GACAC,GACAC,GACAC,MACG;AACH,MAAI,CAACD,EAAoB,QAAA,IAAID,CAAY;AAErC,MAAA,EAAAD,KAAa,CAACG;AAElB,WAAO,GAAGA,CAAS;AACrB;"}
|