@cuemath/leap 3.3.29-beta.1 → 3.3.30-beta.0
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 +43 -34
- package/dist/features/chapters-v2/chapter-details/block-sections/block-sections.js.map +1 -1
- package/dist/features/chapters-v2/chapter-details/chapter-details.js +140 -101
- package/dist/features/chapters-v2/chapter-details/chapter-details.js.map +1 -1
- package/dist/features/chapters-v2/utils/index.js +20 -16
- package/dist/features/chapters-v2/utils/index.js.map +1 -1
- package/dist/features/journey/hooks/use-chapter-page-journey/use-download-block-journey.js +86 -0
- package/dist/features/journey/hooks/use-chapter-page-journey/use-download-block-journey.js.map +1 -0
- package/dist/features/journey/hooks/use-chapter-page-journey/use-download-node-journey.js +140 -0
- package/dist/features/journey/hooks/use-chapter-page-journey/use-download-node-journey.js.map +1 -0
- package/dist/features/journey/journey-id/journey-id-student.js +1 -1
- package/dist/features/journey/journey-id/journey-id-student.js.map +1 -1
- package/dist/features/journey/journey-id/journey-id-teacher.js +2 -2
- package/dist/features/journey/journey-id/journey-id-teacher.js.map +1 -1
- package/dist/features/journey/mocks/chapter-page-journey-mock-data.js +400 -0
- package/dist/features/journey/mocks/chapter-page-journey-mock-data.js.map +1 -1
- package/dist/features/trial-session/comps/school-goals/school-goals.js +23 -22
- package/dist/features/trial-session/comps/school-goals/school-goals.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/package.json +1 -1
|
@@ -1,53 +1,62 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import { BLOCK_TYPE as
|
|
4
|
-
import
|
|
5
|
-
import { ChapterDetailsWrapper as
|
|
6
|
-
const { SAT_MOCK_TEST:
|
|
7
|
-
const {
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsxs as O, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { memo as y, useMemo as D } from "react";
|
|
3
|
+
import { BLOCK_TYPE as G, SECTION_CODE as I } from "../../constants/block-constants.js";
|
|
4
|
+
import u from "./block-section-view.js";
|
|
5
|
+
import { ChapterDetailsWrapper as L } from "./block-sections-styled.js";
|
|
6
|
+
const { SAT_MOCK_TEST: _, GOAL: w } = G, { GOALS: N, READINESS: x } = I, F = y((h) => {
|
|
7
|
+
const {
|
|
8
|
+
blocks: t,
|
|
9
|
+
imageHue: i,
|
|
10
|
+
userType: r,
|
|
11
|
+
coreBlocksRef: S,
|
|
12
|
+
challengeBlockRef: C,
|
|
13
|
+
downloadBlockRef: E,
|
|
14
|
+
downloadCoreBlockRef: g,
|
|
15
|
+
...d
|
|
16
|
+
} = h;
|
|
17
|
+
let a = 0, k = !1, f = !1;
|
|
18
|
+
const { goalBlocks: p, nonGoalBlocks: B } = D(
|
|
10
19
|
() => t.reduce(
|
|
11
|
-
(o, e) => (e.section_code ===
|
|
20
|
+
(o, e) => (e.section_code === N || e.section_code === x || e.block_type === _ ? o.goalBlocks.push(e) : o.nonGoalBlocks.push(e), o),
|
|
12
21
|
{ goalBlocks: [], nonGoalBlocks: [] }
|
|
13
22
|
),
|
|
14
23
|
[t]
|
|
15
24
|
);
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
-
|
|
25
|
+
return /* @__PURE__ */ O(
|
|
26
|
+
L,
|
|
18
27
|
{
|
|
19
28
|
$width: "100%",
|
|
20
|
-
$background:
|
|
29
|
+
$background: B.length ? "WHITE_3" : "WHITE_1",
|
|
21
30
|
children: [
|
|
22
|
-
/* @__PURE__ */ c("div", { ref:
|
|
23
|
-
const { block_type: l, block_id: s, permissions:
|
|
24
|
-
let
|
|
25
|
-
const
|
|
26
|
-
return (l ===
|
|
27
|
-
|
|
31
|
+
/* @__PURE__ */ c("div", { ref: S, children: p.map((o, e) => {
|
|
32
|
+
const { block_type: l, block_id: s, permissions: n, sheets: A } = o;
|
|
33
|
+
let m = 0;
|
|
34
|
+
const R = e === p.length - 1, T = A.find((b) => b.node_type === "PDF");
|
|
35
|
+
return (l === w || l === _) && (n.can_un_skip || (a += 1), m = a), /* @__PURE__ */ c(
|
|
36
|
+
u,
|
|
28
37
|
{
|
|
29
38
|
blockData: o,
|
|
30
|
-
userType:
|
|
31
|
-
isLastBlock:
|
|
32
|
-
lessonIdx:
|
|
33
|
-
imageHue:
|
|
39
|
+
userType: r,
|
|
40
|
+
isLastBlock: R,
|
|
41
|
+
lessonIdx: m,
|
|
42
|
+
imageHue: i,
|
|
34
43
|
isGoalBlock: !0,
|
|
35
|
-
...
|
|
36
|
-
blockSectionRef: void 0
|
|
44
|
+
...d,
|
|
45
|
+
blockSectionRef: T ? g : void 0
|
|
37
46
|
},
|
|
38
47
|
s
|
|
39
48
|
);
|
|
40
49
|
}) }),
|
|
41
|
-
|
|
42
|
-
const { block_id: e, block_type: l } = o, s = l === "CHALLENGE_ARENA" && !k;
|
|
43
|
-
return s && (k = !0), /* @__PURE__ */ c(
|
|
44
|
-
|
|
50
|
+
B.map((o) => {
|
|
51
|
+
const { block_id: e, block_type: l } = o, s = l === "CHALLENGE_ARENA" && !k, n = l === "DOWNLOADS" && !f;
|
|
52
|
+
return s && (k = !0), n && (f = !0), /* @__PURE__ */ c(
|
|
53
|
+
u,
|
|
45
54
|
{
|
|
46
55
|
blockData: o,
|
|
47
|
-
userType:
|
|
48
|
-
imageHue:
|
|
49
|
-
...
|
|
50
|
-
blockSectionRef: s ?
|
|
56
|
+
userType: r,
|
|
57
|
+
imageHue: i,
|
|
58
|
+
...d,
|
|
59
|
+
blockSectionRef: s ? C : n ? E : void 0
|
|
51
60
|
},
|
|
52
61
|
e
|
|
53
62
|
);
|
|
@@ -57,6 +66,6 @@ const { SAT_MOCK_TEST: u, GOAL: y } = C, { GOALS: G, READINESS: I } = g, v = b((
|
|
|
57
66
|
);
|
|
58
67
|
});
|
|
59
68
|
export {
|
|
60
|
-
|
|
69
|
+
F as default
|
|
61
70
|
};
|
|
62
71
|
//# 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 { BLOCK_TYPE, SECTION_CODE } from '../../constants/block-constants';\nimport BlockSectionView from './block-section-view';\nimport * as Styled from './block-sections-styled';\n\nconst { SAT_MOCK_TEST, GOAL } = BLOCK_TYPE;\nconst { GOALS, READINESS } = SECTION_CODE;\n\nconst BlockSections: FC<IBlockSectionsProps> = memo(props => {\n const {
|
|
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 { BLOCK_TYPE, SECTION_CODE } from '../../constants/block-constants';\nimport BlockSectionView from './block-section-view';\nimport * as Styled from './block-sections-styled';\n\nconst { SAT_MOCK_TEST, GOAL } = BLOCK_TYPE;\nconst { GOALS, READINESS } = SECTION_CODE;\n\nconst BlockSections: FC<IBlockSectionsProps> = memo(props => {\n const {\n blocks,\n imageHue,\n userType,\n coreBlocksRef,\n challengeBlockRef,\n downloadBlockRef,\n downloadCoreBlockRef,\n ...blockSectionCallBacks\n } = props;\n\n let lessonCount = 0;\n let addChallengeArenaRef = false;\n let addDownloadBlockRef = false;\n\n const { goalBlocks, nonGoalBlocks } = useMemo(\n () =>\n blocks.reduce(\n (acc, block) => {\n if (\n block.section_code === GOALS ||\n block.section_code === READINESS ||\n block.block_type === SAT_MOCK_TEST\n ) {\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, sheets } = blockData;\n let lessonIdx = 0;\n\n const isLastBlock = idx === goalBlocks.length - 1;\n\n const hasPDFNode = sheets.find(sheet => sheet.node_type === 'PDF');\n\n if (blockType === GOAL || blockType === SAT_MOCK_TEST) {\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 {...blockSectionCallBacks}\n blockSectionRef={hasPDFNode ? downloadCoreBlockRef : undefined}\n />\n );\n })}\n </div>\n\n {nonGoalBlocks.map(blockData => {\n const { block_id: blockId, block_type: blockType } = blockData;\n\n // Apply blockSectionRef only to the first CHALLENGE_ARENA block\n const isChallengeArenaBlock = blockType === 'CHALLENGE_ARENA' && !addChallengeArenaRef;\n\n const isDownloadBlock = blockType === 'DOWNLOADS' && !addDownloadBlockRef;\n\n if (isChallengeArenaBlock) {\n addChallengeArenaRef = true;\n }\n\n if (isDownloadBlock) {\n addDownloadBlockRef = true;\n }\n\n return (\n <BlockSectionView\n key={blockId}\n blockData={blockData}\n userType={userType}\n imageHue={imageHue}\n {...blockSectionCallBacks}\n blockSectionRef={\n isChallengeArenaBlock\n ? challengeBlockRef\n : isDownloadBlock\n ? downloadBlockRef\n : undefined\n }\n />\n );\n })}\n </Styled.ChapterDetailsWrapper>\n );\n});\n\nexport default BlockSections;\n"],"names":["SAT_MOCK_TEST","GOAL","BLOCK_TYPE","GOALS","READINESS","SECTION_CODE","BlockSections","memo","props","blocks","imageHue","userType","coreBlocksRef","challengeBlockRef","downloadBlockRef","downloadCoreBlockRef","blockSectionCallBacks","lessonCount","addChallengeArenaRef","addDownloadBlockRef","goalBlocks","nonGoalBlocks","useMemo","acc","block","jsxs","Styled.ChapterDetailsWrapper","jsx","blockData","idx","blockType","blockId","permissions","sheets","lessonIdx","isLastBlock","hasPDFNode","sheet","BlockSectionView","isChallengeArenaBlock","isDownloadBlock"],"mappings":";;;;;AASA,MAAM,EAAE,eAAAA,GAAe,MAAAC,EAAS,IAAAC,GAC1B,EAAE,OAAAC,GAAO,WAAAC,EAAc,IAAAC,GAEvBC,IAAyCC,EAAK,CAASC,MAAA;AACrD,QAAA;AAAA,IACJ,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,eAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,GAAGC;AAAA,EACD,IAAAR;AAEJ,MAAIS,IAAc,GACdC,IAAuB,IACvBC,IAAsB;AAEpB,QAAA,EAAE,YAAAC,GAAY,eAAAC,EAAA,IAAkBC;AAAA,IACpC,MACEb,EAAO;AAAA,MACL,CAACc,GAAKC,OAEFA,EAAM,iBAAiBrB,KACvBqB,EAAM,iBAAiBpB,KACvBoB,EAAM,eAAexB,IAEjBuB,EAAA,WAAW,KAAKC,CAAK,IAErBD,EAAA,cAAc,KAAKC,CAAK,GAGvBD;AAAA,MAET,EAAE,YAAY,CAAA,GAAqB,eAAe,GAAoB;AAAA,IACxE;AAAA,IACF,CAACd,CAAM;AAAA,EAAA;AAIP,SAAA,gBAAAgB;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,QAAO;AAAA,MACP,aAAcL,EAAc,SAAqB,YAAZ;AAAA,MAErC,UAAA;AAAA,QAAA,gBAAAM,EAAC,SAAI,KAAKf,GACP,YAAW,IAAI,CAACgB,GAAWC,MAAQ;AAClC,gBAAM,EAAE,YAAYC,GAAW,UAAUC,GAAS,aAAAC,GAAa,QAAAC,EAAW,IAAAL;AAC1E,cAAIM,IAAY;AAEV,gBAAAC,IAAcN,MAAQT,EAAW,SAAS,GAE1CgB,IAAaH,EAAO,KAAK,CAASI,MAAAA,EAAM,cAAc,KAAK;AAE7D,kBAAAP,MAAc7B,KAAQ6B,MAAc9B,OACjCgC,EAAY,gBACAf,KAAA,IAGLiB,IAAAjB,IAIZ,gBAAAU;AAAA,YAACW;AAAA,YAAA;AAAA,cACC,WAAAV;AAAA,cACA,UAAAjB;AAAA,cACA,aAAAwB;AAAA,cAEA,WAAAD;AAAA,cACA,UAAAxB;AAAA,cACA,aAAW;AAAA,cACV,GAAGM;AAAA,cACJ,iBAAiBoB,IAAarB,IAAuB;AAAA,YAAA;AAAA,YALhDgB;AAAA,UAAA;AAAA,QAQV,CAAA,GACH;AAAA,QAECV,EAAc,IAAI,CAAaO,MAAA;AAC9B,gBAAM,EAAE,UAAUG,GAAS,YAAYD,MAAcF,GAG/CW,IAAwBT,MAAc,qBAAqB,CAACZ,GAE5DsB,IAAkBV,MAAc,eAAe,CAACX;AAEtD,iBAAIoB,MACqBrB,IAAA,KAGrBsB,MACoBrB,IAAA,KAItB,gBAAAQ;AAAA,YAACW;AAAA,YAAA;AAAA,cAEC,WAAAV;AAAA,cACA,UAAAjB;AAAA,cACA,UAAAD;AAAA,cACC,GAAGM;AAAA,cACJ,iBACEuB,IACI1B,IACA2B,IACE1B,IACA;AAAA,YAAA;AAAA,YAVHiB;AAAA,UAAA;AAAA,QAYP,CAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
|
@@ -1,148 +1,187 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import { ILLUSTRATIONS as
|
|
4
|
-
import
|
|
5
|
-
import { useChallengeArenaJourney as
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
|
|
1
|
+
import { jsxs as p, jsx as o, Fragment as z } from "react/jsx-runtime";
|
|
2
|
+
import { memo as G, useCallback as M, useEffect as f, useMemo as h } from "react";
|
|
3
|
+
import { ILLUSTRATIONS as V } from "../../../assets/illustrations/illustrations.js";
|
|
4
|
+
import q from "../../../assets/line-icons/icons/back2.js";
|
|
5
|
+
import { useChallengeArenaJourney as K } from "../../journey/hooks/use-chapter-page-journey/use-challenge-arena-journey.js";
|
|
6
|
+
import { useDownloadBlockJourney as Q } from "../../journey/hooks/use-chapter-page-journey/use-download-block-journey.js";
|
|
7
|
+
import { useDownloadNodeJourney as Y } from "../../journey/hooks/use-chapter-page-journey/use-download-node-journey.js";
|
|
8
|
+
import { useJourney as Z } from "../../journey/use-journey/use-journey.js";
|
|
9
|
+
import ee from "../../ui/buttons/button/button.js";
|
|
10
|
+
import oe from "../../ui/buttons/icon-button/icon-button.js";
|
|
11
|
+
import te from "../../ui/layout/flex-view.js";
|
|
12
|
+
import re from "../../ui/loader/app-loader/app-loader.js";
|
|
13
|
+
import ne from "../../ui/text/text.js";
|
|
14
|
+
import { useGetChapterDetails as ae } from "../api/chapter.js";
|
|
15
|
+
import { getHasDownloadBlock as ie, getHasNonDownloadBlockWithPdfNode as se } from "../utils/index.js";
|
|
16
|
+
import le from "./block-sections/block-sections.js";
|
|
17
|
+
import ce from "./chapter-banner/chapter-banner.js";
|
|
18
|
+
import { ContentWrapper as de, BackButtonContainer as me, BackButtonWrapper as pe, LoaderWrapper as fe } from "./chapter-details-styled.js";
|
|
19
|
+
const he = G((S) => {
|
|
17
20
|
const {
|
|
18
|
-
userChapterId:
|
|
19
|
-
studentId:
|
|
20
|
-
userType:
|
|
21
|
-
onBlockSkipUnskip:
|
|
22
|
-
onNodeAttempt:
|
|
23
|
-
onNodeAssignAsHomework:
|
|
24
|
-
onNodeMarkAsDone:
|
|
25
|
-
onNodeReattempt:
|
|
26
|
-
onNodeReview:
|
|
27
|
-
onNodeView:
|
|
28
|
-
onExit:
|
|
29
|
-
onNodeUnassign:
|
|
30
|
-
onNodeUnlock:
|
|
31
|
-
onNodeSkipUnSkip:
|
|
32
|
-
startChapterPageJourney:
|
|
33
|
-
onBlockReset:
|
|
34
|
-
chapterPageRef:
|
|
35
|
-
bannerRef:
|
|
36
|
-
coreBlocksRef:
|
|
37
|
-
canStartJourney:
|
|
38
|
-
canStartChallengeArenaJourney:
|
|
39
|
-
|
|
40
|
-
|
|
21
|
+
userChapterId: s,
|
|
22
|
+
studentId: l,
|
|
23
|
+
userType: t,
|
|
24
|
+
onBlockSkipUnskip: J,
|
|
25
|
+
onNodeAttempt: A,
|
|
26
|
+
onNodeAssignAsHomework: b,
|
|
27
|
+
onNodeMarkAsDone: $,
|
|
28
|
+
onNodeReattempt: x,
|
|
29
|
+
onNodeReview: I,
|
|
30
|
+
onNodeView: v,
|
|
31
|
+
onExit: P,
|
|
32
|
+
onNodeUnassign: _,
|
|
33
|
+
onNodeUnlock: E,
|
|
34
|
+
onNodeSkipUnSkip: H,
|
|
35
|
+
startChapterPageJourney: m,
|
|
36
|
+
onBlockReset: L,
|
|
37
|
+
chapterPageRef: T,
|
|
38
|
+
bannerRef: U,
|
|
39
|
+
coreBlocksRef: W,
|
|
40
|
+
canStartJourney: r,
|
|
41
|
+
canStartChallengeArenaJourney: u,
|
|
42
|
+
canStartDownloadNodeJourney: c,
|
|
43
|
+
canStartDownloadBlockJourney: n
|
|
44
|
+
} = S, { isJourneyActive: g } = Z(), {
|
|
45
|
+
get: k,
|
|
41
46
|
data: e,
|
|
42
|
-
isProcessing:
|
|
43
|
-
isProcessingFailed:
|
|
44
|
-
isStale:
|
|
45
|
-
} =
|
|
46
|
-
|
|
47
|
-
}, [
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}, [
|
|
51
|
-
const { blockSectionRef:
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
isProcessing: a,
|
|
48
|
+
isProcessingFailed: j,
|
|
49
|
+
isStale: y
|
|
50
|
+
} = ae(), i = M(() => {
|
|
51
|
+
k(s, void 0, { studentId: l });
|
|
52
|
+
}, [k, s, l]);
|
|
53
|
+
f(() => {
|
|
54
|
+
i();
|
|
55
|
+
}, [i]);
|
|
56
|
+
const { blockSectionRef: F, startJourney: B } = K(), {
|
|
57
|
+
blockSectionRef: w,
|
|
58
|
+
downloadCoreBlockRef: O,
|
|
59
|
+
startJourney: C
|
|
60
|
+
} = Y(), { blockSectionRef: N, startJourney: R } = Q(), D = h(
|
|
61
|
+
() => e && ie(e.blocks),
|
|
62
|
+
[e]
|
|
63
|
+
), d = h(
|
|
64
|
+
() => e && se(e.blocks),
|
|
65
|
+
[e]
|
|
66
|
+
), X = h(
|
|
67
|
+
() => c && d ? w : n ? N : void 0,
|
|
68
|
+
[
|
|
69
|
+
c,
|
|
70
|
+
n,
|
|
71
|
+
d,
|
|
72
|
+
w,
|
|
73
|
+
N
|
|
74
|
+
]
|
|
75
|
+
);
|
|
76
|
+
return f(() => {
|
|
77
|
+
e && !g && (r && m && m({
|
|
78
|
+
chapterDetails: e,
|
|
79
|
+
userChapterId: s,
|
|
80
|
+
studentId: l,
|
|
81
|
+
userType: t
|
|
82
|
+
}), !r && u && B({
|
|
83
|
+
chapterDetails: e,
|
|
84
|
+
userType: t
|
|
85
|
+
}), !r && c && d && C({
|
|
54
86
|
chapterDetails: e,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}), e && !l && h && !m && f({
|
|
87
|
+
userType: t,
|
|
88
|
+
canStartDownloadBlockJourney: n
|
|
89
|
+
}), !r && n && D && R({
|
|
59
90
|
chapterDetails: e,
|
|
60
|
-
userType:
|
|
61
|
-
});
|
|
91
|
+
userType: t
|
|
92
|
+
}));
|
|
62
93
|
}, [
|
|
63
|
-
|
|
64
|
-
|
|
94
|
+
u,
|
|
95
|
+
r,
|
|
65
96
|
e,
|
|
97
|
+
g,
|
|
98
|
+
B,
|
|
66
99
|
m,
|
|
67
|
-
|
|
100
|
+
R,
|
|
101
|
+
C,
|
|
102
|
+
l,
|
|
68
103
|
s,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
104
|
+
t,
|
|
105
|
+
d,
|
|
106
|
+
D,
|
|
107
|
+
c,
|
|
108
|
+
n
|
|
109
|
+
]), f(() => {
|
|
110
|
+
!a && y && i();
|
|
111
|
+
}, [i, a, y]), j ? /* @__PURE__ */ p(te, { $flexGapX: 1.5, $height: "100vh", $justifyContent: "center", $alignItems: "center", children: [
|
|
112
|
+
/* @__PURE__ */ o(ne, { $renderAs: "h6", children: "Oops! Something went wrong. Please try again later." }),
|
|
113
|
+
/* @__PURE__ */ o(
|
|
114
|
+
ee,
|
|
78
115
|
{
|
|
79
116
|
widthX: 14,
|
|
80
117
|
size: "small",
|
|
81
118
|
shape: "square",
|
|
82
119
|
renderAs: "primary",
|
|
83
120
|
label: "Try again",
|
|
84
|
-
onClick:
|
|
121
|
+
onClick: i
|
|
85
122
|
}
|
|
86
123
|
)
|
|
87
|
-
] }) : !e &&
|
|
88
|
-
|
|
124
|
+
] }) : !e && a ? /* @__PURE__ */ o(re, { height: "100vh" }) : /* @__PURE__ */ p(
|
|
125
|
+
de,
|
|
89
126
|
{
|
|
90
|
-
ref:
|
|
127
|
+
ref: T,
|
|
91
128
|
$widthX: 50,
|
|
92
|
-
$disablePointerEvents:
|
|
129
|
+
$disablePointerEvents: a,
|
|
93
130
|
$justifyContent: "center",
|
|
94
131
|
$alignItems: "center",
|
|
95
132
|
$height: "max-content",
|
|
96
133
|
children: [
|
|
97
|
-
|
|
98
|
-
|
|
134
|
+
t === "TEACHER" && /* @__PURE__ */ o(me, { $height: "100%", className: "goal-widget-chapter-item", children: /* @__PURE__ */ o(pe, { children: /* @__PURE__ */ o(
|
|
135
|
+
oe,
|
|
99
136
|
{
|
|
100
|
-
Icon:
|
|
137
|
+
Icon: q,
|
|
101
138
|
renderAs: "secondary-gray",
|
|
102
139
|
analyticsLabel: "chapter_page_exit",
|
|
103
140
|
size: "xsmall",
|
|
104
|
-
onClick:
|
|
141
|
+
onClick: P
|
|
105
142
|
}
|
|
106
143
|
) }) }),
|
|
107
|
-
|
|
108
|
-
e && /* @__PURE__ */
|
|
109
|
-
/* @__PURE__ */
|
|
110
|
-
|
|
144
|
+
a && /* @__PURE__ */ o(fe, { children: /* @__PURE__ */ o("img", { src: V.LOADER_1, alt: "loader" }) }),
|
|
145
|
+
e && /* @__PURE__ */ p(z, { children: [
|
|
146
|
+
/* @__PURE__ */ o(
|
|
147
|
+
ce,
|
|
111
148
|
{
|
|
112
149
|
title: e.name,
|
|
113
150
|
imageHue: e.image_hue,
|
|
114
151
|
imageUrl: e.image_url,
|
|
115
152
|
progressStats: e == null ? void 0 : e.progress_stat,
|
|
116
|
-
bannerRef:
|
|
153
|
+
bannerRef: U
|
|
117
154
|
}
|
|
118
155
|
),
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
|
|
156
|
+
/* @__PURE__ */ o(
|
|
157
|
+
le,
|
|
121
158
|
{
|
|
122
159
|
imageHue: e.image_hue,
|
|
123
|
-
userType:
|
|
160
|
+
userType: t,
|
|
124
161
|
blocks: e.blocks,
|
|
125
|
-
onBlockSkipUnskip:
|
|
126
|
-
onNodeAttempt:
|
|
127
|
-
onNodeAssignAsHomework:
|
|
128
|
-
onNodeMarkAsDone:
|
|
129
|
-
onNodeReattempt:
|
|
130
|
-
onNodeReview:
|
|
131
|
-
onNodeView:
|
|
132
|
-
coreBlocksRef:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
162
|
+
onBlockSkipUnskip: J,
|
|
163
|
+
onNodeAttempt: A,
|
|
164
|
+
onNodeAssignAsHomework: b,
|
|
165
|
+
onNodeMarkAsDone: $,
|
|
166
|
+
onNodeReattempt: x,
|
|
167
|
+
onNodeReview: I,
|
|
168
|
+
onNodeView: v,
|
|
169
|
+
coreBlocksRef: W,
|
|
170
|
+
challengeBlockRef: F,
|
|
171
|
+
downloadCoreBlockRef: O,
|
|
172
|
+
downloadBlockRef: X,
|
|
173
|
+
onNodeUnassign: _,
|
|
174
|
+
onNodeUnlock: E,
|
|
175
|
+
onNodeSkipUnSkip: H,
|
|
176
|
+
onBlockReset: L
|
|
138
177
|
}
|
|
139
178
|
)
|
|
140
179
|
] })
|
|
141
180
|
]
|
|
142
181
|
}
|
|
143
182
|
);
|
|
144
|
-
}),
|
|
183
|
+
}), Pe = he;
|
|
145
184
|
export {
|
|
146
|
-
|
|
185
|
+
Pe as default
|
|
147
186
|
};
|
|
148
187
|
//# sourceMappingURL=chapter-details.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chapter-details.js","sources":["../../../../src/features/chapters-v2/chapter-details/chapter-details.tsx"],"sourcesContent":["import type { IChapterDetails } from './chapter-details-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useEffect } from 'react';\n\nimport { ILLUSTRATIONS } from '../../../assets/illustrations/illustrations';\nimport Back2Icon from '../../../assets/line-icons/icons/back2';\nimport { useChallengeArenaJourney } from '../../journey/hooks/use-chapter-page-journey/use-challenge-arena-journey';\nimport { useJourney } from '../../journey/use-journey/use-journey';\nimport Button from '../../ui/buttons/button/button';\nimport IconButton from '../../ui/buttons/icon-button/icon-button';\nimport FlexView from '../../ui/layout/flex-view';\nimport AppLoader from '../../ui/loader/app-loader/app-loader';\nimport Text from '../../ui/text/text';\nimport { useGetChapterDetails } from '../api/chapter';\nimport BlockSections from './block-sections/block-sections';\nimport ChapterBanner from './chapter-banner/chapter-banner';\nimport * as Styled from './chapter-details-styled';\n\nconst ChapterDetails: FC<IChapterDetails> = memo(props => {\n const {\n userChapterId,\n studentId,\n userType,\n onBlockSkipUnskip,\n onNodeAttempt,\n onNodeAssignAsHomework,\n onNodeMarkAsDone,\n onNodeReattempt,\n onNodeReview,\n onNodeView,\n onExit,\n onNodeUnassign,\n onNodeUnlock,\n onNodeSkipUnSkip,\n startChapterPageJourney,\n onBlockReset,\n chapterPageRef,\n bannerRef,\n coreBlocksRef,\n canStartJourney,\n canStartChallengeArenaJourney,\n } = props;\n const { isJourneyActive } = useJourney();\n const {\n get: getChapterDetails,\n data: chapterDetails,\n isProcessing,\n isProcessingFailed,\n isStale,\n } = useGetChapterDetails();\n\n const fetchChapterDetails = useCallback(() => {\n getChapterDetails(userChapterId, undefined, { studentId });\n }, [getChapterDetails, userChapterId, studentId]);\n\n useEffect(() => {\n fetchChapterDetails();\n }, [fetchChapterDetails]);\n\n const { blockSectionRef, startJourney: startChallengeArenaJourney } = useChallengeArenaJourney();\n\n useEffect(() => {\n if (chapterDetails && canStartJourney && !isJourneyActive && startChapterPageJourney) {\n startChapterPageJourney({\n chapterDetails: chapterDetails,\n userChapterId,\n studentId,\n userType,\n });\n }\n\n if (chapterDetails && !canStartJourney && canStartChallengeArenaJourney && !isJourneyActive) {\n startChallengeArenaJourney({\n chapterDetails,\n userType,\n });\n }\n }, [\n canStartChallengeArenaJourney,\n canStartJourney,\n chapterDetails,\n isJourneyActive,\n startChallengeArenaJourney,\n startChapterPageJourney,\n studentId,\n userChapterId,\n userType,\n ]);\n\n useEffect(() => {\n if (!isProcessing && isStale) {\n fetchChapterDetails();\n }\n }, [fetchChapterDetails, isProcessing, isStale]);\n\n if (isProcessingFailed) {\n return (\n <FlexView $flexGapX={1.5} $height=\"100vh\" $justifyContent=\"center\" $alignItems=\"center\">\n <Text $renderAs=\"h6\">Oops! Something went wrong. Please try again later.</Text>\n <Button\n widthX={14}\n size=\"small\"\n shape=\"square\"\n renderAs=\"primary\"\n label=\"Try again\"\n onClick={fetchChapterDetails}\n />\n </FlexView>\n );\n }\n\n if (!chapterDetails && isProcessing) {\n return <AppLoader height=\"100vh\" />;\n }\n\n return (\n <Styled.ContentWrapper\n ref={chapterPageRef}\n $widthX={50}\n $disablePointerEvents={isProcessing}\n $justifyContent=\"center\"\n $alignItems=\"center\"\n $height=\"max-content\"\n >\n {userType === 'TEACHER' && (\n <Styled.BackButtonContainer $height=\"100%\" className=\"goal-widget-chapter-item\">\n <Styled.BackButtonWrapper>\n <IconButton\n Icon={Back2Icon}\n renderAs=\"secondary-gray\"\n analyticsLabel=\"chapter_page_exit\"\n size=\"xsmall\"\n onClick={onExit}\n />\n </Styled.BackButtonWrapper>\n </Styled.BackButtonContainer>\n )}\n\n {isProcessing && (\n <Styled.LoaderWrapper>\n <img src={ILLUSTRATIONS.LOADER_1} alt=\"loader\" />\n </Styled.LoaderWrapper>\n )}\n\n {chapterDetails && (\n <>\n <ChapterBanner\n title={chapterDetails.name}\n imageHue={chapterDetails.image_hue}\n imageUrl={chapterDetails.image_url}\n progressStats={chapterDetails?.progress_stat}\n bannerRef={bannerRef}\n />\n <BlockSections\n imageHue={chapterDetails.image_hue}\n userType={userType}\n blocks={chapterDetails.blocks}\n onBlockSkipUnskip={onBlockSkipUnskip}\n onNodeAttempt={onNodeAttempt}\n onNodeAssignAsHomework={onNodeAssignAsHomework}\n onNodeMarkAsDone={onNodeMarkAsDone}\n onNodeReattempt={onNodeReattempt}\n onNodeReview={onNodeReview}\n onNodeView={onNodeView}\n coreBlocksRef={coreBlocksRef}\n blockSectionRef={blockSectionRef}\n onNodeUnassign={onNodeUnassign}\n onNodeUnlock={onNodeUnlock}\n onNodeSkipUnSkip={onNodeSkipUnSkip}\n onBlockReset={onBlockReset}\n />\n </>\n )}\n </Styled.ContentWrapper>\n );\n});\n\nexport default ChapterDetails;\n"],"names":["ChapterDetails","memo","props","userChapterId","studentId","userType","onBlockSkipUnskip","onNodeAttempt","onNodeAssignAsHomework","onNodeMarkAsDone","onNodeReattempt","onNodeReview","onNodeView","onExit","onNodeUnassign","onNodeUnlock","onNodeSkipUnSkip","startChapterPageJourney","onBlockReset","chapterPageRef","bannerRef","coreBlocksRef","canStartJourney","canStartChallengeArenaJourney","isJourneyActive","useJourney","getChapterDetails","chapterDetails","isProcessing","isProcessingFailed","isStale","useGetChapterDetails","fetchChapterDetails","useCallback","useEffect","blockSectionRef","startChallengeArenaJourney","useChallengeArenaJourney","jsxs","FlexView","jsx","Text","Button","AppLoader","Styled.ContentWrapper","Styled.BackButtonContainer","Styled.BackButtonWrapper","IconButton","Back2Icon","Styled.LoaderWrapper","ILLUSTRATIONS","Fragment","ChapterBanner","BlockSections","ChapterDetails$1"],"mappings":";;;;;;;;;;;;;;;AAmBA,MAAMA,IAAsCC,EAAK,CAASC,MAAA;AAClD,QAAA;AAAA,IACJ,eAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,YAAAC;AAAA,IACA,QAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,yBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,eAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,+BAAAC;AAAA,EACE,IAAArB,GACE,EAAE,iBAAAsB,MAAoBC,KACtB;AAAA,IACJ,KAAKC;AAAA,IACL,MAAMC;AAAA,IACN,cAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,SAAAC;AAAA,MACEC,EAAqB,GAEnBC,IAAsBC,EAAY,MAAM;AAC5C,IAAAP,EAAkBvB,GAAe,QAAW,EAAE,WAAAC,EAAW,CAAA;AAAA,EACxD,GAAA,CAACsB,GAAmBvB,GAAeC,CAAS,CAAC;AAEhD,EAAA8B,EAAU,MAAM;AACM,IAAAF;EAAA,GACnB,CAACA,CAAmB,CAAC;AAExB,QAAM,EAAE,iBAAAG,GAAiB,cAAcC,MAA+BC,EAAyB;AAoC/F,SAlCAH,EAAU,MAAM;AACd,IAAIP,KAAkBL,KAAmB,CAACE,KAAmBP,KACnCA,EAAA;AAAA,MACtB,gBAAAU;AAAA,MACA,eAAAxB;AAAA,MACA,WAAAC;AAAA,MACA,UAAAC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b,EACF,CAAA;AAAA,QAGDe,KACC,gBAAAY,EAACS,GAAA,EACC,UAAA,gBAAAT,EAAC,OAAI,EAAA,KAAKU,EAAc,UAAU,KAAI,SAAA,CAAS,EACjD,CAAA;AAAA,QAGDvB,KAEG,gBAAAW,EAAAa,GAAA,EAAA,UAAA;AAAA,UAAA,gBAAAX;AAAA,YAACY;AAAA,YAAA;AAAA,cACC,OAAOzB,EAAe;AAAA,cACtB,UAAUA,EAAe;AAAA,cACzB,UAAUA,EAAe;AAAA,cACzB,eAAeA,KAAA,gBAAAA,EAAgB;AAAA,cAC/B,WAAAP;AAAA,YAAA;AAAA,UACF;AAAA,UACA,gBAAAoB;AAAA,YAACa;AAAA,YAAA;AAAA,cACC,UAAU1B,EAAe;AAAA,cACzB,UAAAtB;AAAA,cACA,QAAQsB,EAAe;AAAA,cACvB,mBAAArB;AAAA,cACA,eAAAC;AAAA,cACA,wBAAAC;AAAA,cACA,kBAAAC;AAAA,cACA,iBAAAC;AAAA,cACA,cAAAC;AAAA,cACA,YAAAC;AAAA,cACA,eAAAS;AAAA,cACA,iBAAAc;AAAA,cACA,gBAAArB;AAAA,cACA,cAAAC;AAAA,cACA,kBAAAC;AAAA,cACA,cAAAE;AAAA,YAAA;AAAA,UACF;AAAA,QAAA,GACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC,GAEDoC,KAAetD;"}
|
|
1
|
+
{"version":3,"file":"chapter-details.js","sources":["../../../../src/features/chapters-v2/chapter-details/chapter-details.tsx"],"sourcesContent":["import type { IChapterDetails } from './chapter-details-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useEffect, useMemo } from 'react';\n\nimport { ILLUSTRATIONS } from '../../../assets/illustrations/illustrations';\nimport Back2Icon from '../../../assets/line-icons/icons/back2';\nimport { useChallengeArenaJourney } from '../../journey/hooks/use-chapter-page-journey/use-challenge-arena-journey';\nimport { useDownloadBlockJourney } from '../../journey/hooks/use-chapter-page-journey/use-download-block-journey';\nimport { useDownloadNodeJourney } from '../../journey/hooks/use-chapter-page-journey/use-download-node-journey';\nimport { useJourney } from '../../journey/use-journey/use-journey';\nimport Button from '../../ui/buttons/button/button';\nimport IconButton from '../../ui/buttons/icon-button/icon-button';\nimport FlexView from '../../ui/layout/flex-view';\nimport AppLoader from '../../ui/loader/app-loader/app-loader';\nimport Text from '../../ui/text/text';\nimport { useGetChapterDetails } from '../api/chapter';\nimport { getHasDownloadBlock, getHasNonDownloadBlockWithPdfNode } from '../utils';\nimport BlockSections from './block-sections/block-sections';\nimport ChapterBanner from './chapter-banner/chapter-banner';\nimport * as Styled from './chapter-details-styled';\n\nconst ChapterDetails: FC<IChapterDetails> = memo(props => {\n const {\n userChapterId,\n studentId,\n userType,\n onBlockSkipUnskip,\n onNodeAttempt,\n onNodeAssignAsHomework,\n onNodeMarkAsDone,\n onNodeReattempt,\n onNodeReview,\n onNodeView,\n onExit,\n onNodeUnassign,\n onNodeUnlock,\n onNodeSkipUnSkip,\n startChapterPageJourney,\n onBlockReset,\n chapterPageRef,\n bannerRef,\n coreBlocksRef,\n canStartJourney,\n canStartChallengeArenaJourney,\n canStartDownloadNodeJourney,\n canStartDownloadBlockJourney,\n } = props;\n\n const { isJourneyActive } = useJourney();\n const {\n get: getChapterDetails,\n data: chapterDetails,\n isProcessing,\n isProcessingFailed,\n isStale,\n } = useGetChapterDetails();\n\n const fetchChapterDetails = useCallback(() => {\n getChapterDetails(userChapterId, undefined, { studentId });\n }, [getChapterDetails, userChapterId, studentId]);\n\n useEffect(() => {\n fetchChapterDetails();\n }, [fetchChapterDetails]);\n\n const { blockSectionRef: challengeBlockRef, startJourney: startChallengeArenaJourney } =\n useChallengeArenaJourney();\n\n const {\n blockSectionRef: downloadBlockRef,\n downloadCoreBlockRef,\n startJourney: startDownloadNodeJourney,\n } = useDownloadNodeJourney();\n\n const { blockSectionRef: downloadBlockSectionRef, startJourney: startDownloadBlockJourney } =\n useDownloadBlockJourney();\n\n const hasDownloadBlock = useMemo(\n () => chapterDetails && getHasDownloadBlock(chapterDetails.blocks),\n [chapterDetails],\n );\n const hasNonDownloadBlockWithPdfNode = useMemo(\n () => chapterDetails && getHasNonDownloadBlockWithPdfNode(chapterDetails.blocks),\n [chapterDetails],\n );\n\n const activeDownloadBlockRef = useMemo(\n () =>\n canStartDownloadNodeJourney && hasNonDownloadBlockWithPdfNode\n ? downloadBlockRef\n : canStartDownloadBlockJourney\n ? downloadBlockSectionRef\n : undefined,\n [\n canStartDownloadNodeJourney,\n canStartDownloadBlockJourney,\n hasNonDownloadBlockWithPdfNode,\n downloadBlockRef,\n downloadBlockSectionRef,\n ],\n );\n\n useEffect(() => {\n if (chapterDetails && !isJourneyActive) {\n if (canStartJourney && startChapterPageJourney) {\n startChapterPageJourney({\n chapterDetails: chapterDetails,\n userChapterId,\n studentId,\n userType,\n });\n }\n\n if (!canStartJourney && canStartChallengeArenaJourney) {\n startChallengeArenaJourney({\n chapterDetails,\n userType,\n });\n }\n\n if (!canStartJourney && canStartDownloadNodeJourney && hasNonDownloadBlockWithPdfNode) {\n startDownloadNodeJourney({\n chapterDetails,\n userType,\n canStartDownloadBlockJourney,\n });\n }\n\n if (!canStartJourney && canStartDownloadBlockJourney && hasDownloadBlock) {\n startDownloadBlockJourney({\n chapterDetails,\n userType,\n });\n }\n }\n }, [\n canStartChallengeArenaJourney,\n canStartJourney,\n chapterDetails,\n isJourneyActive,\n startChallengeArenaJourney,\n startChapterPageJourney,\n startDownloadBlockJourney,\n startDownloadNodeJourney,\n studentId,\n userChapterId,\n userType,\n hasNonDownloadBlockWithPdfNode,\n hasDownloadBlock,\n canStartDownloadNodeJourney,\n canStartDownloadBlockJourney,\n ]);\n\n useEffect(() => {\n if (!isProcessing && isStale) {\n fetchChapterDetails();\n }\n }, [fetchChapterDetails, isProcessing, isStale]);\n\n if (isProcessingFailed) {\n return (\n <FlexView $flexGapX={1.5} $height=\"100vh\" $justifyContent=\"center\" $alignItems=\"center\">\n <Text $renderAs=\"h6\">Oops! Something went wrong. Please try again later.</Text>\n <Button\n widthX={14}\n size=\"small\"\n shape=\"square\"\n renderAs=\"primary\"\n label=\"Try again\"\n onClick={fetchChapterDetails}\n />\n </FlexView>\n );\n }\n\n if (!chapterDetails && isProcessing) {\n return <AppLoader height=\"100vh\" />;\n }\n\n return (\n <Styled.ContentWrapper\n ref={chapterPageRef}\n $widthX={50}\n $disablePointerEvents={isProcessing}\n $justifyContent=\"center\"\n $alignItems=\"center\"\n $height=\"max-content\"\n >\n {userType === 'TEACHER' && (\n <Styled.BackButtonContainer $height=\"100%\" className=\"goal-widget-chapter-item\">\n <Styled.BackButtonWrapper>\n <IconButton\n Icon={Back2Icon}\n renderAs=\"secondary-gray\"\n analyticsLabel=\"chapter_page_exit\"\n size=\"xsmall\"\n onClick={onExit}\n />\n </Styled.BackButtonWrapper>\n </Styled.BackButtonContainer>\n )}\n\n {isProcessing && (\n <Styled.LoaderWrapper>\n <img src={ILLUSTRATIONS.LOADER_1} alt=\"loader\" />\n </Styled.LoaderWrapper>\n )}\n\n {chapterDetails && (\n <>\n <ChapterBanner\n title={chapterDetails.name}\n imageHue={chapterDetails.image_hue}\n imageUrl={chapterDetails.image_url}\n progressStats={chapterDetails?.progress_stat}\n bannerRef={bannerRef}\n />\n <BlockSections\n imageHue={chapterDetails.image_hue}\n userType={userType}\n blocks={chapterDetails.blocks}\n onBlockSkipUnskip={onBlockSkipUnskip}\n onNodeAttempt={onNodeAttempt}\n onNodeAssignAsHomework={onNodeAssignAsHomework}\n onNodeMarkAsDone={onNodeMarkAsDone}\n onNodeReattempt={onNodeReattempt}\n onNodeReview={onNodeReview}\n onNodeView={onNodeView}\n coreBlocksRef={coreBlocksRef}\n challengeBlockRef={challengeBlockRef}\n downloadCoreBlockRef={downloadCoreBlockRef}\n downloadBlockRef={activeDownloadBlockRef}\n onNodeUnassign={onNodeUnassign}\n onNodeUnlock={onNodeUnlock}\n onNodeSkipUnSkip={onNodeSkipUnSkip}\n onBlockReset={onBlockReset}\n />\n </>\n )}\n </Styled.ContentWrapper>\n );\n});\n\nexport default ChapterDetails;\n"],"names":["ChapterDetails","memo","props","userChapterId","studentId","userType","onBlockSkipUnskip","onNodeAttempt","onNodeAssignAsHomework","onNodeMarkAsDone","onNodeReattempt","onNodeReview","onNodeView","onExit","onNodeUnassign","onNodeUnlock","onNodeSkipUnSkip","startChapterPageJourney","onBlockReset","chapterPageRef","bannerRef","coreBlocksRef","canStartJourney","canStartChallengeArenaJourney","canStartDownloadNodeJourney","canStartDownloadBlockJourney","isJourneyActive","useJourney","getChapterDetails","chapterDetails","isProcessing","isProcessingFailed","isStale","useGetChapterDetails","fetchChapterDetails","useCallback","useEffect","challengeBlockRef","startChallengeArenaJourney","useChallengeArenaJourney","downloadBlockRef","downloadCoreBlockRef","startDownloadNodeJourney","useDownloadNodeJourney","downloadBlockSectionRef","startDownloadBlockJourney","useDownloadBlockJourney","hasDownloadBlock","useMemo","getHasDownloadBlock","hasNonDownloadBlockWithPdfNode","getHasNonDownloadBlockWithPdfNode","activeDownloadBlockRef","jsxs","FlexView","jsx","Text","Button","AppLoader","Styled.ContentWrapper","Styled.BackButtonContainer","Styled.BackButtonWrapper","IconButton","Back2Icon","Styled.LoaderWrapper","ILLUSTRATIONS","Fragment","ChapterBanner","BlockSections","ChapterDetails$1"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,MAAMA,KAAsCC,EAAK,CAASC,MAAA;AAClD,QAAA;AAAA,IACJ,eAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,YAAAC;AAAA,IACA,QAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,yBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,WAAAC;AAAA,IACA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rations.js";
|
|
2
|
-
const
|
|
2
|
+
const S = (E) => {
|
|
3
3
|
if (!E) return 0;
|
|
4
|
-
const { mandatory:
|
|
5
|
-
return
|
|
6
|
-
},
|
|
4
|
+
const { mandatory: _ } = E, { completed: t, total: c } = _;
|
|
5
|
+
return c === 0 ? 0 : Math.floor(t / c * 100);
|
|
6
|
+
}, A = (E) => {
|
|
7
7
|
switch (E) {
|
|
8
8
|
case "LEVEL2":
|
|
9
9
|
case "LEVEL3":
|
|
@@ -52,20 +52,24 @@ const A = (E) => {
|
|
|
52
52
|
default:
|
|
53
53
|
return e.NODE_PROJECT_BG;
|
|
54
54
|
}
|
|
55
|
-
},
|
|
55
|
+
}, r = ({
|
|
56
56
|
isSkipped: E,
|
|
57
|
-
sheetsLength:
|
|
58
|
-
isGoalBlock:
|
|
59
|
-
lessonIdx:
|
|
60
|
-
isSatMockTestBlock:
|
|
57
|
+
sheetsLength: _,
|
|
58
|
+
isGoalBlock: t,
|
|
59
|
+
lessonIdx: c,
|
|
60
|
+
isSatMockTestBlock: a
|
|
61
61
|
}) => {
|
|
62
|
-
if (!
|
|
63
|
-
if (!(E || !
|
|
64
|
-
return `${
|
|
65
|
-
}
|
|
62
|
+
if (!t && !a) return `(${_})`;
|
|
63
|
+
if (!(E || !c))
|
|
64
|
+
return `${c}`;
|
|
65
|
+
}, T = (E) => E.some(
|
|
66
|
+
(_) => _.block_type !== "DOWNLOADS" && _.sheets.some((t) => t.node_type === "PDF")
|
|
67
|
+
), N = (E) => E.some((_) => _.block_type === "DOWNLOADS");
|
|
66
68
|
export {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
S as getChapterCompletionPercentage,
|
|
70
|
+
N as getHasDownloadBlock,
|
|
71
|
+
T as getHasNonDownloadBlockWithPdfNode,
|
|
72
|
+
A as getNodeTypeBasedBgImage,
|
|
73
|
+
r as getSheetNLessonCount
|
|
70
74
|
};
|
|
71
75
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/features/chapters-v2/utils/index.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/features/chapters-v2/utils/index.ts"],"sourcesContent":["import type {\n IChapterBlockData,\n IChapterProgressStats,\n} 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 'LEVEL2':\n case 'LEVEL3':\n case 'HIDDEN_BASIC':\n return ILLUSTRATIONS.NODE_TEST_PREP_BG;\n case 'LEARNING':\n case 'SAT_MATH_LEARNING':\n case 'SAT_ENGLISH_LEARNING':\n return ILLUSTRATIONS.NODE_LEARN_BG;\n case 'RECAP':\n case 'REMEDIAL':\n case 'REVISION':\n case 'PPT_BASIC':\n case 'SAT_MATH_RECAP':\n case 'SAT_ENGLISH_RECAP':\n return ILLUSTRATIONS.NODE_RECAP_BG;\n\n case 'DYNAMIC':\n case 'ASSESSMENT':\n case 'CHAPTER_ASSESSMENT':\n case 'DIAGNOSTIC':\n case 'TURING_ASSESSMENT':\n return ILLUSTRATIONS.NODE_CUSTOM_TEST_BG;\n\n case 'PRACTICE':\n case 'EXTRA_PRACTICE':\n case 'TARGET_PRACTICE':\n case 'MASTERY':\n case 'TURING_PRACTICE':\n case 'SAT_MATH_ASSESSMENT':\n case 'SAT_ENGLISH_ASSESSMENT':\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 'TURING_SUBJECTIVE':\n return ILLUSTRATIONS.NODE_SUBJECTIVE_BG;\n\n case 'TURING_BASIC':\n case 'PYTHON_BASIC':\n case 'PYTHON_VISUAL':\n return ILLUSTRATIONS.NODE_ACTIVITY_BG;\n\n case 'VIDEO':\n return ILLUSTRATIONS.NODE_VIDEO_BG;\n\n case 'PDF':\n return ILLUSTRATIONS.NODE_DOWNLOAD_BG;\n\n default:\n return ILLUSTRATIONS.NODE_PROJECT_BG;\n }\n};\n\ninterface IGetSheetNLessonCountParams {\n isSkipped: boolean;\n sheetsLength: number;\n isGoalBlock?: boolean;\n lessonIdx?: number;\n isSatMockTestBlock?: boolean;\n}\n\nconst getSheetNLessonCount = ({\n isSkipped,\n sheetsLength,\n isGoalBlock,\n lessonIdx,\n isSatMockTestBlock,\n}: IGetSheetNLessonCountParams) => {\n if (!isGoalBlock && !isSatMockTestBlock) return `(${sheetsLength})`;\n\n if (isSkipped || !lessonIdx) return undefined;\n\n return `${lessonIdx}`;\n};\n\nconst getHasNonDownloadBlockWithPdfNode = (blocks: IChapterBlockData[]) => {\n return blocks.some(\n blockInfo =>\n blockInfo.block_type !== 'DOWNLOADS' &&\n blockInfo.sheets.some(sheetInfo => sheetInfo.node_type === 'PDF'),\n );\n};\n\nconst getHasDownloadBlock = (blocks: IChapterBlockData[]) => {\n return blocks.some(blockInfo => blockInfo.block_type === 'DOWNLOADS');\n};\n\nexport {\n getChapterCompletionPercentage,\n getNodeTypeBasedBgImage,\n getSheetNLessonCount,\n getHasNonDownloadBlockWithPdfNode,\n getHasDownloadBlock,\n};\n"],"names":["getChapterCompletionPercentage","progressStats","mandatory","completed","total","getNodeTypeBasedBgImage","nodeType","ILLUSTRATIONS","getSheetNLessonCount","isSkipped","sheetsLength","isGoalBlock","lessonIdx","isSatMockTestBlock","getHasNonDownloadBlockWithPdfNode","blocks","blockInfo","sheetInfo","getHasDownloadBlock"],"mappings":";AAYM,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,IACvB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,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;AAAA,IACL,KAAK;AACH,aAAOA,EAAc;AAAA,IAEvB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,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,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAOA,EAAc;AAAA,IAEvB,KAAK;AACH,aAAOA,EAAc;AAAA,IAEvB,KAAK;AACH,aAAOA,EAAc;AAAA,IAEvB;AACE,aAAOA,EAAc;AAAA,EACzB;AACF,GAU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