@cuemath/leap 2.9.4-as2 → 2.9.4-as3

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.
@@ -5,12 +5,12 @@ import ne from "../../../assets/line-icons/icons/chevron-right.js";
5
5
  import { useJourney as ie } from "../../journey/use-journey/use-journey.js";
6
6
  import { getTopicsFromItems as le } from "../../milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-utils.js";
7
7
  import $ from "../../ui/layout/flex-view.js";
8
- import C from "../../ui/text/text.js";
8
+ import L from "../../ui/text/text.js";
9
9
  import ce from "../homework-card.js";
10
10
  import { useGetHomeworks as se } from "./api/get-homeworks.js";
11
- import { ContentWrapper as he, HoverZone as R, ScrollButton as w, ScrollContainer as fe, QueueWrapper as ae, QueueText as de } from "./hw-card-list-styled.js";
11
+ import { ContentWrapper as he, HoverZone as w, ScrollButton as A, ScrollContainer as fe, QueueWrapper as ae, QueueText as de } from "./hw-card-list-styled.js";
12
12
  const ue = ({
13
- userType: A = "STUDENT",
13
+ userType: g = "STUDENT",
14
14
  studentId: s,
15
15
  stream: f,
16
16
  onTestStart: x,
@@ -18,38 +18,38 @@ const ue = ({
18
18
  onTestPreview: S,
19
19
  onNodeView: T,
20
20
  onTestReview: I,
21
- onNodeReview: y,
22
- onNodeUnassign: B,
23
- homeworkRef: W,
21
+ onNodeReview: B,
22
+ onNodeUnassign: W,
23
+ homeworkRef: y,
24
24
  individualHomeworkRef: N,
25
- startHomePageJourney: p
25
+ startHomePageJourney: m
26
26
  }) => {
27
- const r = te(null), [j, L] = u(!1), [K, k] = u(!1), [M, F] = u(!1), [G, X] = u(!0), {
28
- get: b,
27
+ const r = te(null), [j, k] = u(!1), [K, b] = u(!1), [M, F] = u(!1), [G, X] = u(!0), {
28
+ get: H,
29
29
  data: e,
30
30
  isProcessingFailed: Q,
31
- isProcessing: g,
32
- isStale: H
33
- } = se(s), { isJourneyActive: m } = ie();
31
+ isProcessing: p,
32
+ isStale: _
33
+ } = se(s), { isJourneyActive: v } = ie();
34
34
  h(() => {
35
- e != null && e.length && p && !m && p(e, s, f);
36
- }, [e, m, p, f, s]);
35
+ e != null && e.length && m && !v && m({ hwDetails: e, studentId: s, stream: f, userType: g });
36
+ }, [e, v, m, f, s, g]);
37
37
  const O = n(() => {
38
38
  r.current && r.current.scrollBy({ left: -200, behavior: "smooth" });
39
39
  }, []), V = n(() => {
40
40
  r.current && r.current.scrollBy({ left: 200, behavior: "smooth" });
41
41
  }, []), z = n(() => {
42
- L(!0);
42
+ k(!0);
43
43
  }, []), P = n(() => {
44
- L(!1);
44
+ k(!1);
45
45
  }, []), U = n(() => {
46
- k(!0);
46
+ b(!0);
47
47
  }, []), Y = n(() => {
48
- k(!1);
48
+ b(!1);
49
49
  }, []), i = n(() => {
50
50
  if (r.current) {
51
- const { scrollLeft: t, scrollWidth: l, clientWidth: v } = r.current;
52
- F(t > 10), X(t < l - v - 10);
51
+ const { scrollLeft: t, scrollWidth: l, clientWidth: C } = r.current;
52
+ F(t > 10), X(t < l - C - 10);
53
53
  }
54
54
  }, []);
55
55
  h(() => {
@@ -62,23 +62,23 @@ const ue = ({
62
62
  i();
63
63
  }, [e, i]);
64
64
  const a = n(() => {
65
- b(s, void 0, { stream: f });
66
- }, [b, f, s]);
65
+ H(s, void 0, { stream: f });
66
+ }, [H, f, s]);
67
67
  h(() => {
68
- !g && H && a();
69
- }, [a, g, H]), h(() => {
68
+ !p && _ && a();
69
+ }, [a, p, _]), h(() => {
70
70
  a();
71
71
  }, [a]);
72
72
  const Z = ((e == null ? void 0 : e.filter((t) => t.state === "WAIT_FOR_REVIEW")) || []).length;
73
73
  return e && e.length === 0 ? /* @__PURE__ */ c($, { $flexRowGapX: 1, children: [
74
- /* @__PURE__ */ c(C, { $renderAs: "ac4-black", $color: "BLACK_T_60", children: [
74
+ /* @__PURE__ */ c(L, { $renderAs: "ac4-black", $color: "BLACK_T_60", children: [
75
75
  "Homework (",
76
76
  e == null ? void 0 : e.length,
77
77
  ")"
78
78
  ] }),
79
- /* @__PURE__ */ o(C, { $renderAs: "ab2", $color: "BLACK_T_60", children: "No Homework assigned yet" })
80
- ] }) : Q ? null : /* @__PURE__ */ c(he, { ref: W, $flexRowGapX: 1, $disablePointerEvents: g, children: [
81
- !m && /* @__PURE__ */ c(C, { $renderAs: "ac4-black", $color: "BLACK_T_60", children: [
79
+ /* @__PURE__ */ o(L, { $renderAs: "ab2", $color: "BLACK_T_60", children: "No Homework assigned yet" })
80
+ ] }) : Q ? null : /* @__PURE__ */ c(he, { ref: y, $flexRowGapX: 1, $disablePointerEvents: p, children: [
81
+ !v && /* @__PURE__ */ c(L, { $renderAs: "ac4-black", $color: "BLACK_T_60", children: [
82
82
  "Homework (",
83
83
  Z,
84
84
  "/",
@@ -87,7 +87,7 @@ const ue = ({
87
87
  ] }),
88
88
  /* @__PURE__ */ c($, { $position: "relative", onMouseEnter: i, children: [
89
89
  M && /* @__PURE__ */ o(
90
- R,
90
+ w,
91
91
  {
92
92
  $position: "absolute",
93
93
  $width: "60px",
@@ -96,7 +96,7 @@ const ue = ({
96
96
  onMouseEnter: z,
97
97
  onMouseLeave: P,
98
98
  children: /* @__PURE__ */ o(
99
- w,
99
+ A,
100
100
  {
101
101
  $position: "absolute",
102
102
  $background: "BLACK_T_60",
@@ -115,13 +115,13 @@ const ue = ({
115
115
  ),
116
116
  /* @__PURE__ */ o(fe, { ref: r, children: /* @__PURE__ */ o($, { $flexDirection: "row", $flexGapX: 1, children: e == null ? void 0 : e.map((t, l) => {
117
117
  const {
118
- items: v,
119
- node_id: _,
118
+ items: C,
119
+ node_id: R,
120
120
  worksheet_id: q,
121
121
  node_type: J,
122
122
  title: D,
123
123
  subtext: ee
124
- } = t, oe = le(v).join(", "), d = J === "DYNAMIC";
124
+ } = t, oe = le(C).join(", "), d = J === "DYNAMIC";
125
125
  return /* @__PURE__ */ c(
126
126
  $,
127
127
  {
@@ -144,7 +144,7 @@ const ue = ({
144
144
  ce,
145
145
  {
146
146
  isInQueue: e.length > 10 && l > 9,
147
- userType: A,
147
+ userType: g,
148
148
  header: d ? oe : D,
149
149
  subHeader: ee || "",
150
150
  nodeData: t,
@@ -152,18 +152,18 @@ const ue = ({
152
152
  onNodeAttempt: d ? x : E,
153
153
  shouldOpenOnRight: e.length > 3 && l === e.length - 1,
154
154
  onNodeView: d ? S : T,
155
- onNodeReview: d ? I : y,
156
- onNodeUnassign: B
155
+ onNodeReview: d ? I : B,
156
+ onNodeUnassign: W
157
157
  },
158
- `${q}_${_}_${l}`
158
+ `${q}_${R}_${l}`
159
159
  )
160
160
  ]
161
161
  },
162
- _
162
+ R
163
163
  );
164
164
  }) }) }),
165
165
  G && /* @__PURE__ */ o(
166
- R,
166
+ w,
167
167
  {
168
168
  $position: "absolute",
169
169
  $width: "60px",
@@ -172,7 +172,7 @@ const ue = ({
172
172
  onMouseEnter: U,
173
173
  onMouseLeave: Y,
174
174
  children: /* @__PURE__ */ o(
175
- w,
175
+ A,
176
176
  {
177
177
  $position: "absolute",
178
178
  $width: "60px",
@@ -1 +1 @@
1
- {"version":3,"file":"hw-card-list.js","sources":["../../../../src/features/homework/hw-card-list/hw-card-list.tsx"],"sourcesContent":["import type {\n INodeCardCallbacks,\n INodeDataProps,\n} from '../../chapters-v2/comps/node-card/node-card-types';\nimport type { TUserTypes } from '../../ui/types';\n\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\n\nimport ChevronLeftIcon from '../../../assets/line-icons/icons/chevron-left';\nimport ChevronRightIcon from '../../../assets/line-icons/icons/chevron-right';\nimport { useJourney } from '../../journey/use-journey/use-journey';\nimport { getTopicsFromItems } from '../../milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-utils';\nimport FlexView from '../../ui/layout/flex-view';\nimport Text from '../../ui/text/text';\nimport HomeworkCard from '../homework-card';\nimport { useGetHomeworks } from './api/get-homeworks';\nimport * as Styled from './hw-card-list-styled';\n\ninterface HWCardListProps extends INodeCardCallbacks {\n userType: TUserTypes;\n studentId: string;\n stream: string;\n onTestPreview?: (sheetData: INodeDataProps, milestoneId?: string) => void;\n onTestStart?: (sheetData: INodeDataProps) => void;\n onTestReview?: (sheetData: INodeDataProps, milestoneId?: string) => void;\n homeworkRef?: React.RefObject<HTMLDivElement>;\n individualHomeworkRef?: React.RefObject<HTMLDivElement>;\n startHomePageJourney?: (\n homeworkDetails: INodeDataProps[],\n studentId: string,\n stream: string,\n ) => void;\n}\n\nconst HWCardList: React.FC<HWCardListProps> = ({\n userType = 'STUDENT',\n studentId,\n stream,\n onTestStart,\n onNodeAttempt,\n onTestPreview,\n onNodeView,\n onTestReview,\n onNodeReview,\n onNodeUnassign,\n homeworkRef,\n individualHomeworkRef,\n startHomePageJourney,\n}) => {\n const scrollRef = useRef<HTMLDivElement>(null);\n const [isLeftHovered, setIsLeftHovered] = useState(false);\n const [isRightHovered, setIsRightHovered] = useState(false);\n const [canScrollLeft, setCanScrollLeft] = useState(false);\n const [canScrollRight, setCanScrollRight] = useState(true);\n const {\n get: getHomeworks,\n data: hwDetails,\n isProcessingFailed,\n isProcessing,\n isStale,\n } = useGetHomeworks(studentId);\n const { isJourneyActive } = useJourney();\n\n useEffect(() => {\n if (hwDetails?.length && startHomePageJourney && !isJourneyActive) {\n startHomePageJourney(hwDetails, studentId, stream);\n }\n }, [hwDetails, isJourneyActive, startHomePageJourney, stream, studentId]);\n\n const handleScrollLeft = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: -200, behavior: 'smooth' });\n }\n }, []);\n\n const handleScrollRight = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: 200, behavior: 'smooth' });\n }\n }, []);\n\n const handleLeftHoverEnter = useCallback(() => {\n setIsLeftHovered(true);\n }, []);\n\n const handleLeftHoverLeave = useCallback(() => {\n setIsLeftHovered(false);\n }, []);\n\n const handleRightHoverEnter = useCallback(() => {\n setIsRightHovered(true);\n }, []);\n\n const handleRightHoverLeave = useCallback(() => {\n setIsRightHovered(false);\n }, []);\n\n const checkScrollPosition = useCallback(() => {\n if (scrollRef.current) {\n const { scrollLeft, scrollWidth, clientWidth } = scrollRef.current;\n\n setCanScrollLeft(scrollLeft > 10);\n setCanScrollRight(scrollLeft < scrollWidth - clientWidth - 10);\n }\n }, []);\n\n useEffect(() => {\n const scrollElement = scrollRef.current;\n\n if (scrollElement) {\n scrollElement.addEventListener('scroll', checkScrollPosition);\n checkScrollPosition();\n\n return () => {\n scrollElement.removeEventListener('scroll', checkScrollPosition);\n };\n }\n }, [checkScrollPosition]);\n\n // Also check when content changes\n useEffect(() => {\n checkScrollPosition();\n }, [hwDetails, checkScrollPosition]);\n\n const fetchHomeworks = useCallback(() => {\n getHomeworks(studentId, undefined, { stream });\n }, [getHomeworks, stream, studentId]);\n\n useEffect(() => {\n if (!isProcessing && isStale) {\n fetchHomeworks();\n }\n }, [fetchHomeworks, isProcessing, isStale]);\n\n useEffect(() => {\n fetchHomeworks();\n }, [fetchHomeworks]);\n\n const waitForReviewSheets = (hwDetails?.filter(sheet => sheet.state === 'WAIT_FOR_REVIEW') || [])\n .length;\n\n if (hwDetails && hwDetails.length === 0) {\n return (\n <FlexView $flexRowGapX={1}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Homework ({hwDetails?.length})\n </Text>\n <Text $renderAs=\"ab2\" $color=\"BLACK_T_60\">\n No Homework assigned yet\n </Text>\n </FlexView>\n );\n }\n\n if (isProcessingFailed) {\n return null;\n }\n\n return (\n <Styled.ContentWrapper ref={homeworkRef} $flexRowGapX={1} $disablePointerEvents={isProcessing}>\n {!isJourneyActive && (\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Homework ({waitForReviewSheets}/{hwDetails?.length})\n </Text>\n )}\n <FlexView $position=\"relative\" onMouseEnter={checkScrollPosition}>\n {/* Left hover zone */}\n {canScrollLeft && (\n <Styled.HoverZone\n key=\"left-hover-zone\"\n $position=\"absolute\"\n $width=\"60px\"\n left=\"0\"\n right=\"auto\"\n onMouseEnter={handleLeftHoverEnter}\n onMouseLeave={handleLeftHoverLeave}\n >\n {/* Left scroll button - only visible when hovered */}\n <Styled.ScrollButton\n $position=\"absolute\"\n $background=\"BLACK_T_60\"\n $justifyContent=\"center\"\n $alignItems=\"center\"\n $height=\"100%\"\n onClick={handleScrollLeft}\n $visible={isLeftHovered}\n left=\"0px\"\n right=\"auto\"\n >\n <ChevronLeftIcon width={24} height={24} />\n </Styled.ScrollButton>\n </Styled.HoverZone>\n )}\n\n <Styled.ScrollContainer ref={scrollRef}>\n <FlexView $flexDirection=\"row\" $flexGapX={1}>\n {hwDetails?.map((sheet, idx) => {\n const {\n items,\n node_id: nodeId,\n worksheet_id: worksheetId,\n node_type: nodeType,\n title,\n subtext,\n } = sheet;\n const topics = getTopicsFromItems(items);\n const testChapterName = topics.join(', ');\n const isDynamicSheet = nodeType === 'DYNAMIC';\n\n return (\n <FlexView\n ref={idx === 0 ? individualHomeworkRef : undefined}\n key={nodeId}\n $flexDirection=\"row\"\n $flexGapX={1}\n >\n {hwDetails.length > 10 && idx === 10 && (\n <Styled.QueueWrapper\n $widthX={9.5}\n $background=\"BLACK_4\"\n $justifyContent=\"center\"\n $gutter={4}\n $gap={8}\n >\n <Styled.QueueText $renderAs=\"ac3\" $color=\"WHITE\">\n In Queue\n </Styled.QueueText>\n </Styled.QueueWrapper>\n )}\n <HomeworkCard\n isInQueue={hwDetails.length > 10 && idx > 9}\n key={`${worksheetId}_${nodeId}_${idx}`}\n userType={userType}\n header={isDynamicSheet ? testChapterName : title}\n subHeader={subtext || ''}\n nodeData={sheet}\n renderAs=\"homework\"\n onNodeAttempt={isDynamicSheet ? onTestStart : onNodeAttempt}\n shouldOpenOnRight={hwDetails.length > 3 && idx === hwDetails.length - 1}\n onNodeView={isDynamicSheet ? onTestPreview : onNodeView}\n onNodeReview={isDynamicSheet ? onTestReview : onNodeReview}\n onNodeUnassign={onNodeUnassign}\n />\n </FlexView>\n );\n })}\n </FlexView>\n </Styled.ScrollContainer>\n\n {/* Right hover zone */}\n {canScrollRight && (\n <Styled.HoverZone\n key=\"right-hover-zone\"\n $position=\"absolute\"\n $width=\"60px\"\n right=\"0\"\n left=\"auto\"\n onMouseEnter={handleRightHoverEnter}\n onMouseLeave={handleRightHoverLeave}\n >\n {/* Right scroll button - only visible when hovered */}\n <Styled.ScrollButton\n $position=\"absolute\"\n $width=\"60px\"\n $height=\"100%\"\n $background=\"BLACK_T_60\"\n $justifyContent=\"center\"\n $alignItems=\"center\"\n onClick={handleScrollRight}\n $visible={isRightHovered}\n left=\"auto\"\n right=\"0px\"\n >\n <ChevronRightIcon width={24} height={24} />\n </Styled.ScrollButton>\n </Styled.HoverZone>\n )}\n </FlexView>\n </Styled.ContentWrapper>\n );\n};\n\nexport default HWCardList;\n"],"names":["HWCardList","userType","studentId","stream","onTestStart","onNodeAttempt","onTestPreview","onNodeView","onTestReview","onNodeReview","onNodeUnassign","homeworkRef","individualHomeworkRef","startHomePageJourney","scrollRef","useRef","isLeftHovered","setIsLeftHovered","useState","isRightHovered","setIsRightHovered","canScrollLeft","setCanScrollLeft","canScrollRight","setCanScrollRight","getHomeworks","hwDetails","isProcessingFailed","isProcessing","isStale","useGetHomeworks","isJourneyActive","useJourney","useEffect","handleScrollLeft","useCallback","handleScrollRight","handleLeftHoverEnter","handleLeftHoverLeave","handleRightHoverEnter","handleRightHoverLeave","checkScrollPosition","scrollLeft","scrollWidth","clientWidth","scrollElement","fetchHomeworks","waitForReviewSheets","sheet","jsxs","FlexView","Text","Styled.ContentWrapper","jsx","Styled.HoverZone","Styled.ScrollButton","ChevronLeftIcon","Styled.ScrollContainer","idx","items","nodeId","worksheetId","nodeType","title","subtext","testChapterName","getTopicsFromItems","isDynamicSheet","Styled.QueueWrapper","Styled.QueueText","HomeworkCard","ChevronRightIcon","HWCardList$1"],"mappings":";;;;;;;;;;;AAkCA,MAAMA,KAAwC,CAAC;AAAA,EAC7C,UAAAC,IAAW;AA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MA+BP,IAGN,EACF,CAAA;AAAA,MAGCrC,KACC,gBAAA8B;AAAA,QAACC;AAAAA,QAAA;AAAA,UAEC,WAAU;AAAA,UACV,QAAO;AAAA,UACP,OAAM;AAAA,UACN,MAAK;AAAA,UACL,cAAcf;AAAA,UACd,cAAcC;AAAA,UAGd,UAAA,gBAAAa;AAAA,YAACE;AAAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,QAAO;AAAA,cACP,SAAQ;AAAA,cACR,aAAY;AAAA,cACZ,iBAAgB;AAAA,cAChB,aAAY;AAAA,cACZ,SAASnB;AAAA,cACT,UAAUjB;AAAA,cACV,MAAK;AAAA,cACL,OAAM;AAAA,cAEN,UAAC,gBAAAkC,EAAAkB,IAAA,EAAiB,OAAO,IAAI,QAAQ,IAAI;AAAA,YAAA;AAAA,UAC3C;AAAA,QAAA;AAAA,QAtBI;AAAA,MAuBN;AAAA,IAAA,GAEJ;AAAA,EACF,EAAA,CAAA;AAEJ,GAEAC,KAAexE;"}
1
+ {"version":3,"file":"hw-card-list.js","sources":["../../../../src/features/homework/hw-card-list/hw-card-list.tsx"],"sourcesContent":["import type {\n INodeCardCallbacks,\n INodeDataProps,\n} from '../../chapters-v2/comps/node-card/node-card-types';\nimport type { IHomepageStartJourneyProps } from '../../journey/types/homepage-journey-types';\nimport type { TUserTypes } from '../../ui/types';\n\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\n\nimport ChevronLeftIcon from '../../../assets/line-icons/icons/chevron-left';\nimport ChevronRightIcon from '../../../assets/line-icons/icons/chevron-right';\nimport { useJourney } from '../../journey/use-journey/use-journey';\nimport { getTopicsFromItems } from '../../milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-utils';\nimport FlexView from '../../ui/layout/flex-view';\nimport Text from '../../ui/text/text';\nimport HomeworkCard from '../homework-card';\nimport { useGetHomeworks } from './api/get-homeworks';\nimport * as Styled from './hw-card-list-styled';\n\ninterface HWCardListProps extends INodeCardCallbacks {\n userType: TUserTypes;\n studentId: string;\n stream: string;\n onTestPreview?: (sheetData: INodeDataProps, milestoneId?: string) => void;\n onTestStart?: (sheetData: INodeDataProps) => void;\n onTestReview?: (sheetData: INodeDataProps, milestoneId?: string) => void;\n homeworkRef?: React.RefObject<HTMLDivElement>;\n individualHomeworkRef?: React.RefObject<HTMLDivElement>;\n startHomePageJourney?: ({\n hwDetails,\n studentId,\n stream,\n userType,\n }: IHomepageStartJourneyProps) => void;\n}\n\nconst HWCardList: React.FC<HWCardListProps> = ({\n userType = 'STUDENT',\n studentId,\n stream,\n onTestStart,\n onNodeAttempt,\n onTestPreview,\n onNodeView,\n onTestReview,\n onNodeReview,\n onNodeUnassign,\n homeworkRef,\n individualHomeworkRef,\n startHomePageJourney,\n}) => {\n const scrollRef = useRef<HTMLDivElement>(null);\n const [isLeftHovered, setIsLeftHovered] = useState(false);\n const [isRightHovered, setIsRightHovered] = useState(false);\n const [canScrollLeft, setCanScrollLeft] = useState(false);\n const [canScrollRight, setCanScrollRight] = useState(true);\n const {\n get: getHomeworks,\n data: hwDetails,\n isProcessingFailed,\n isProcessing,\n isStale,\n } = useGetHomeworks(studentId);\n const { isJourneyActive } = useJourney();\n\n useEffect(() => {\n if (hwDetails?.length && startHomePageJourney && !isJourneyActive) {\n startHomePageJourney({ hwDetails, studentId, stream, userType });\n }\n }, [hwDetails, isJourneyActive, startHomePageJourney, stream, studentId, userType]);\n\n const handleScrollLeft = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: -200, behavior: 'smooth' });\n }\n }, []);\n\n const handleScrollRight = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: 200, behavior: 'smooth' });\n }\n }, []);\n\n const handleLeftHoverEnter = useCallback(() => {\n setIsLeftHovered(true);\n }, []);\n\n const handleLeftHoverLeave = useCallback(() => {\n setIsLeftHovered(false);\n }, []);\n\n const handleRightHoverEnter = useCallback(() => {\n setIsRightHovered(true);\n }, []);\n\n const handleRightHoverLeave = useCallback(() => {\n setIsRightHovered(false);\n }, []);\n\n const checkScrollPosition = useCallback(() => {\n if (scrollRef.current) {\n const { scrollLeft, scrollWidth, clientWidth } = scrollRef.current;\n\n setCanScrollLeft(scrollLeft > 10);\n setCanScrollRight(scrollLeft < scrollWidth - clientWidth - 10);\n }\n }, []);\n\n useEffect(() => {\n const scrollElement = scrollRef.current;\n\n if (scrollElement) {\n scrollElement.addEventListener('scroll', checkScrollPosition);\n checkScrollPosition();\n\n return () => {\n scrollElement.removeEventListener('scroll', checkScrollPosition);\n };\n }\n }, [checkScrollPosition]);\n\n // Also check when content changes\n useEffect(() => {\n checkScrollPosition();\n }, [hwDetails, checkScrollPosition]);\n\n const fetchHomeworks = useCallback(() => {\n getHomeworks(studentId, undefined, { stream });\n }, [getHomeworks, stream, studentId]);\n\n useEffect(() => {\n if (!isProcessing && isStale) {\n fetchHomeworks();\n }\n }, [fetchHomeworks, isProcessing, isStale]);\n\n useEffect(() => {\n fetchHomeworks();\n }, [fetchHomeworks]);\n\n const waitForReviewSheets = (hwDetails?.filter(sheet => sheet.state === 'WAIT_FOR_REVIEW') || [])\n .length;\n\n if (hwDetails && hwDetails.length === 0) {\n return (\n <FlexView $flexRowGapX={1}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Homework ({hwDetails?.length})\n </Text>\n <Text $renderAs=\"ab2\" $color=\"BLACK_T_60\">\n No Homework assigned yet\n </Text>\n </FlexView>\n );\n }\n\n if (isProcessingFailed) {\n return null;\n }\n\n return (\n <Styled.ContentWrapper ref={homeworkRef} $flexRowGapX={1} $disablePointerEvents={isProcessing}>\n {!isJourneyActive && (\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Homework ({waitForReviewSheets}/{hwDetails?.length})\n </Text>\n )}\n <FlexView $position=\"relative\" onMouseEnter={checkScrollPosition}>\n {/* Left hover zone */}\n {canScrollLeft && (\n <Styled.HoverZone\n key=\"left-hover-zone\"\n $position=\"absolute\"\n $width=\"60px\"\n left=\"0\"\n right=\"auto\"\n onMouseEnter={handleLeftHoverEnter}\n onMouseLeave={handleLeftHoverLeave}\n >\n {/* Left scroll button - only visible when hovered */}\n <Styled.ScrollButton\n $position=\"absolute\"\n $background=\"BLACK_T_60\"\n $justifyContent=\"center\"\n $alignItems=\"center\"\n $height=\"100%\"\n onClick={handleScrollLeft}\n $visible={isLeftHovered}\n left=\"0px\"\n right=\"auto\"\n >\n <ChevronLeftIcon width={24} height={24} />\n </Styled.ScrollButton>\n </Styled.HoverZone>\n )}\n\n <Styled.ScrollContainer ref={scrollRef}>\n <FlexView $flexDirection=\"row\" $flexGapX={1}>\n {hwDetails?.map((sheet, idx) => {\n const {\n items,\n node_id: nodeId,\n worksheet_id: worksheetId,\n node_type: nodeType,\n title,\n subtext,\n } = sheet;\n const topics = getTopicsFromItems(items);\n const testChapterName = topics.join(', ');\n const isDynamicSheet = nodeType === 'DYNAMIC';\n\n return (\n <FlexView\n ref={idx === 0 ? individualHomeworkRef : undefined}\n key={nodeId}\n $flexDirection=\"row\"\n $flexGapX={1}\n >\n {hwDetails.length > 10 && idx === 10 && (\n <Styled.QueueWrapper\n $widthX={9.5}\n $background=\"BLACK_4\"\n $justifyContent=\"center\"\n $gutter={4}\n $gap={8}\n >\n <Styled.QueueText $renderAs=\"ac3\" $color=\"WHITE\">\n In Queue\n </Styled.QueueText>\n </Styled.QueueWrapper>\n )}\n <HomeworkCard\n isInQueue={hwDetails.length > 10 && idx > 9}\n key={`${worksheetId}_${nodeId}_${idx}`}\n userType={userType}\n header={isDynamicSheet ? testChapterName : title}\n subHeader={subtext || ''}\n nodeData={sheet}\n renderAs=\"homework\"\n onNodeAttempt={isDynamicSheet ? onTestStart : onNodeAttempt}\n shouldOpenOnRight={hwDetails.length > 3 && idx === hwDetails.length - 1}\n onNodeView={isDynamicSheet ? onTestPreview : onNodeView}\n onNodeReview={isDynamicSheet ? onTestReview : onNodeReview}\n onNodeUnassign={onNodeUnassign}\n />\n </FlexView>\n );\n })}\n </FlexView>\n </Styled.ScrollContainer>\n\n {/* Right hover zone */}\n {canScrollRight && (\n <Styled.HoverZone\n key=\"right-hover-zone\"\n $position=\"absolute\"\n $width=\"60px\"\n right=\"0\"\n left=\"auto\"\n onMouseEnter={handleRightHoverEnter}\n onMouseLeave={handleRightHoverLeave}\n >\n {/* Right scroll button - only visible when hovered */}\n <Styled.ScrollButton\n $position=\"absolute\"\n $width=\"60px\"\n $height=\"100%\"\n $background=\"BLACK_T_60\"\n $justifyContent=\"center\"\n $alignItems=\"center\"\n onClick={handleScrollRight}\n $visible={isRightHovered}\n left=\"auto\"\n right=\"0px\"\n >\n <ChevronRightIcon width={24} height={24} />\n </Styled.ScrollButton>\n </Styled.HoverZone>\n )}\n </FlexView>\n </Styled.ContentWrapper>\n );\n};\n\nexport default HWCardList;\n"],"names":["HWCardList","userType","studentId","stream","onTestStart","onNodeAttempt","onTestPreview","onNodeView","onTestReview","onNodeReview","onNodeUnassign","homeworkRef","individualHomeworkRef","startHomePageJourney","scrollRef","useRef","isLeftHovered","setIsLeftHovered","useState","isRightHovered","setIsRightHovered","canScrollLeft","setCanScrollLeft","canScrollRight","setCanScrollRight","getHomeworks","hwDetails","isProcessingFailed","isProcessing","isStale","useGetHomeworks","isJourneyActive","useJourney","useEffect","handleScrollLeft","useCallback","handleScrollRight","handleLeftHoverEnter","handleLeftHoverLeave","handleRightHoverEnter","handleRightHoverLeave","checkScrollPosition","scrollLeft","scrollWidth","clientWidth","scrollElement","fetchHomeworks","waitForReviewSheets","sheet","jsxs","FlexView","Text","Styled.ContentWrapper","jsx","Styled.HoverZone","Styled.ScrollButton","ChevronLeftIcon","Styled.ScrollContainer","idx","items","nodeId","worksheetId","nodeType","title","subtext","testChapterName","getTopicsFromItems","isDynamicSheet","Styled.QueueWrapper","Styled.QueueText","HomeworkCard","ChevronRightIcon","HWCardList$1"],"mappings":";;;;;;;;;;;AAoCA,MAAMA,KAAwC,CAAC;AAAA,EAC7C,UAAAC,IAAW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;AAAA,YAAA;AAAA,UAAA;AAAA,UA9BKE;AAAA,QAAA;AAAA,MA+BP,IAGN,EACF,CAAA;AAAA,MAGCrC,KACC,gBAAA8B;AAAA,QAACC;AAAAA,QAAA;AAAA,UAEC,WAAU;AAAA,UACV,QAAO;AAAA,UACP,OAAM;AAAA,UACN,MAAK;AAAA,UACL,cAAcf;AAAA,UACd,cAAcC;AAAA,UAGd,UAAA,gBAAAa;AAAA,YAACE;AAAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,QAAO;AAAA,cACP,SAAQ;AAAA,cACR,aAAY;AAAA,cACZ,iBAAgB;AAAA,cAChB,aAAY;AAAA,cACZ,SAASnB;AAAA,cACT,UAAUjB;AAAA,cACV,MAAK;AAAA,cACL,OAAM;AAAA,cAEN,UAAC,gBAAAkC,EAAAkB,IAAA,EAAiB,OAAO,IAAI,QAAQ,IAAI;AAAA,YAAA;AAAA,UAC3C;AAAA,QAAA;AAAA,QAtBI;AAAA,MAuBN;AAAA,IAAA,GAEJ;AAAA,EACF,EAAA,CAAA;AAEJ,GAEAC,KAAexE;"}
@@ -1,27 +1,71 @@
1
- import { jsx as e, Fragment as R, jsxs as c } from "react/jsx-runtime";
2
- import { useRef as l, useCallback as X, useMemo as B, useEffect as N } from "react";
3
- import P from "../../homework/homework-card.js";
4
- import S from "../../homework/hw-card-list/hw-card-list.js";
5
- import { getTopicsFromItems as _ } from "../../milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-utils.js";
6
- import d from "../../ui/buttons/button/button.js";
7
- import m from "../../ui/layout/flex-view.js";
8
- import p from "../../ui/text/text.js";
9
- import { ELementWrapper as w } from "../comps/coachmark/coachmark-styled.js";
10
- import { JOURNEY_ID_STUDENT as z } from "../journey-id/journey-id-student.js";
11
- import { IndicatorType as u } from "../use-journey/constants.js";
12
- import { useJourney as J } from "../use-journey/use-journey.js";
13
- const q = () => {
14
- const o = z.HOMEPAGE_JOURNEY, t = l(null), r = l(null), i = l(null), T = l(null), a = l([]), { nextCoachmark: n, setJourney: h } = J(), C = X(
15
- (s, b, A, f) => {
16
- const { items: y, node_type: x, title: E, subtext: L } = s[0], I = _(y).join(", "), k = x === "DYNAMIC";
17
- if (!(t != null && t.current) || !(r != null && r.current) || !(i != null && i.current))
1
+ import { jsx as e, jsxs as p, Fragment as P } from "react/jsx-runtime";
2
+ import { useRef as a, useCallback as x, useMemo as S, useEffect as Y } from "react";
3
+ import _ from "../../homework/homework-card.js";
4
+ import $ from "../../homework/hw-card-list/hw-card-list.js";
5
+ import { getTopicsFromItems as J } from "../../milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-utils.js";
6
+ import z from "../../recent-chapters/recent-chapters.js";
7
+ import h from "../../ui/buttons/button/button.js";
8
+ import s from "../../ui/layout/flex-view.js";
9
+ import u from "../../ui/text/text.js";
10
+ import { ELementWrapper as L } from "../comps/coachmark/coachmark-styled.js";
11
+ import { JOURNEY_ID_STUDENT as w } from "../journey-id/journey-id-student.js";
12
+ import { IndicatorType as C } from "../use-journey/constants.js";
13
+ import { useJourney as K } from "../use-journey/use-journey.js";
14
+ const re = () => {
15
+ const o = w.HOMEPAGE_JOURNEY, i = a(null), n = a(null), l = a(null), c = a(null), f = a([]), { nextCoachmark: t, setJourney: A, endJourney: g, addCoachmark: T } = K(), b = x(
16
+ (r, d, m) => {
17
+ c.current ? (T(w.HOMEPAGE_JOURNEY, {
18
+ originalElementToHighlightRef: c,
19
+ elementToHighlight: /* @__PURE__ */ e(s, { $widthX: 45, children: /* @__PURE__ */ e(
20
+ z,
21
+ {
22
+ studentId: r,
23
+ courseStream: m,
24
+ userType: d,
25
+ onChapterClick: () => null
26
+ }
27
+ ) }),
28
+ isActive: !1,
29
+ type: C.TOOLTIP,
30
+ indicator: {
31
+ tooltipItem: /* @__PURE__ */ p(s, { $flexRowGapX: 0.75, $justifyContent: "flex-start", children: [
32
+ /* @__PURE__ */ e(u, { $renderAs: "ab2-bold", children: "Access all your recent chapters in one place." }),
33
+ /* @__PURE__ */ e(
34
+ h,
35
+ {
36
+ label: "Got it",
37
+ size: "xsmall",
38
+ widthX: 6,
39
+ renderAs: "secondary",
40
+ onClick: () => g(w.HOMEPAGE_JOURNEY)
41
+ }
42
+ )
43
+ ] }),
44
+ position: "top",
45
+ renderAs: "primary",
46
+ tooltipXCoOrdinates: -227,
47
+ tooltipYCoOrdinates: 12,
48
+ arrowXCoOrdinates: -110,
49
+ backgroundColor: "YELLOW_4",
50
+ borderColor: "BLACK",
51
+ arrowColor: "BLACK",
52
+ arrowSize: 12,
53
+ width: 264
54
+ }
55
+ }), t(o, !1, 0, !0)) : g(o);
56
+ },
57
+ [t, o, T, g]
58
+ ), E = x(
59
+ ({ hwDetails: r, studentId: d, stream: m, userType: O }) => {
60
+ const { items: X, node_type: k, title: H, subtext: I } = r[0], B = J(X).join(", "), N = k === "DYNAMIC";
61
+ if (!(i != null && i.current) || !(n != null && n.current) || !(l != null && l.current))
18
62
  return;
19
- const H = [
63
+ const G = [
20
64
  {
21
- originalElementToHighlightRef: t,
65
+ originalElementToHighlightRef: i,
22
66
  isActive: !1,
23
- type: u.TOOLTIP,
24
- elementToHighlight: /* @__PURE__ */ e(R, {}),
67
+ type: C.TOOLTIP,
68
+ elementToHighlight: /* @__PURE__ */ e(P, {}),
25
69
  indicator: {
26
70
  position: "left",
27
71
  tooltipXCoOrdinates: 0,
@@ -31,25 +75,25 @@ const q = () => {
31
75
  arrowColor: "BLACK",
32
76
  arrowSize: 12,
33
77
  width: 264,
34
- tooltipItem: /* @__PURE__ */ c(m, { $flexRowGapX: 0.75, children: [
35
- /* @__PURE__ */ e(p, { $renderAs: "ab2-bold", children: "Welcome to the all new tutoring homepage." }),
78
+ tooltipItem: /* @__PURE__ */ p(s, { $flexRowGapX: 0.75, children: [
79
+ /* @__PURE__ */ e(u, { $renderAs: "ab2-bold", children: "Welcome to the all new tutoring homepage." }),
36
80
  /* @__PURE__ */ e(
37
- d,
81
+ h,
38
82
  {
39
83
  label: "Next",
40
84
  size: "xsmall",
41
85
  widthX: 6,
42
86
  renderAs: "secondary",
43
- onClick: () => n(o, !1, 0, !0)
87
+ onClick: () => t(o, !1, 0, !0)
44
88
  }
45
89
  )
46
90
  ] })
47
91
  }
48
92
  },
49
93
  {
50
- originalElementToHighlightRef: r,
51
- elementToHighlight: /* @__PURE__ */ e(w, { children: /* @__PURE__ */ e(S, { userType: f, studentId: b, stream: A }) }),
52
- type: u.TOOLTIP,
94
+ originalElementToHighlightRef: n,
95
+ elementToHighlight: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e($, { userType: O, studentId: d, stream: m }) }),
96
+ type: C.TOOLTIP,
53
97
  indicator: {
54
98
  position: "top",
55
99
  tooltipXCoOrdinates: -197,
@@ -60,16 +104,16 @@ const q = () => {
60
104
  arrowColor: "BLACK",
61
105
  width: 264,
62
106
  arrowSize: 12,
63
- tooltipItem: /* @__PURE__ */ c(m, { $flexRowGapX: 0.75, children: [
64
- /* @__PURE__ */ e(p, { $renderAs: "ab2-bold", children: "Homework is now easy to access and easy to complete!" }),
107
+ tooltipItem: /* @__PURE__ */ p(s, { $flexRowGapX: 0.75, children: [
108
+ /* @__PURE__ */ e(u, { $renderAs: "ab2-bold", children: "Homework is now easy to access and easy to complete!" }),
65
109
  /* @__PURE__ */ e(
66
- d,
110
+ h,
67
111
  {
68
112
  label: "Next",
69
113
  size: "xsmall",
70
114
  widthX: 6,
71
115
  renderAs: "secondary",
72
- onClick: () => n(o, !1, 0, !0)
116
+ onClick: () => t(o, !1, 0, !0)
73
117
  }
74
118
  )
75
119
  ] })
@@ -77,20 +121,20 @@ const q = () => {
77
121
  isActive: !1
78
122
  },
79
123
  {
80
- originalElementToHighlightRef: i,
81
- elementToHighlight: /* @__PURE__ */ e(w, { children: /* @__PURE__ */ e(
82
- P,
124
+ originalElementToHighlightRef: l,
125
+ elementToHighlight: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
126
+ _,
83
127
  {
84
128
  isInQueue: !1,
85
- userType: f,
86
- header: k ? I : E,
87
- subHeader: L || "",
88
- nodeData: s[0],
129
+ userType: O,
130
+ header: N ? B : H,
131
+ subHeader: I || "",
132
+ nodeData: r[0],
89
133
  renderAs: "homework",
90
134
  shouldOpenOnRight: !1
91
135
  }
92
136
  ) }),
93
- type: u.TOOLTIP,
137
+ type: C.TOOLTIP,
94
138
  indicator: {
95
139
  position: "top",
96
140
  tooltipXCoOrdinates: -35,
@@ -101,16 +145,16 @@ const q = () => {
101
145
  arrowXCoOrdinates: -97,
102
146
  arrowSize: 12,
103
147
  width: 264,
104
- tooltipItem: /* @__PURE__ */ c(m, { $flexRowGapX: 0.75, children: [
105
- /* @__PURE__ */ e(p, { $renderAs: "ab2-bold", children: "Track homework status and their due dates." }),
148
+ tooltipItem: /* @__PURE__ */ p(s, { $flexRowGapX: 0.75, children: [
149
+ /* @__PURE__ */ e(u, { $renderAs: "ab2-bold", children: "Track homework status and their due dates." }),
106
150
  /* @__PURE__ */ e(
107
- d,
151
+ h,
108
152
  {
109
- label: "Next",
153
+ label: c.current ? "Next" : "Got it",
110
154
  size: "xsmall",
111
155
  widthX: 6,
112
156
  renderAs: "secondary",
113
- onClick: () => n(o, !1, 0, !0)
157
+ onClick: () => b(d, O, m)
114
158
  }
115
159
  )
116
160
  ] })
@@ -118,28 +162,28 @@ const q = () => {
118
162
  isActive: !1
119
163
  }
120
164
  ];
121
- h(o, H);
122
- const g = setTimeout(() => {
123
- clearTimeout(g), n(o);
165
+ A(o, G);
166
+ const y = setTimeout(() => {
167
+ clearTimeout(y), t(o);
124
168
  }, 200);
125
- a.current.push(g);
169
+ f.current.push(y);
126
170
  },
127
- [h, o, n]
128
- ), O = B(
171
+ [A, o, t, b]
172
+ ), R = S(
129
173
  () => ({
130
- homepageRef: t,
131
- homeworkRef: r,
132
- individualHomeworkRef: i,
133
- recentChaptersRef: T,
134
- startJourney: C
174
+ homepageRef: i,
175
+ homeworkRef: n,
176
+ individualHomeworkRef: l,
177
+ recentChaptersRef: c,
178
+ startJourney: E
135
179
  }),
136
- [C]
180
+ [E]
137
181
  );
138
- return N(() => () => {
139
- a.current.forEach((s) => clearTimeout(s)), a.current = [];
140
- }, []), O;
182
+ return Y(() => () => {
183
+ f.current.forEach((r) => clearTimeout(r)), f.current = [];
184
+ }, []), R;
141
185
  };
142
186
  export {
143
- q as useHomePageJourney
187
+ re as useHomePageJourney
144
188
  };
145
189
  //# sourceMappingURL=use-home-page-journey.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-home-page-journey.js","sources":["../../../../src/features/journey/hooks/use-home-page-journey.tsx"],"sourcesContent":["import type { IHomeworkData } from '../../homework/hw-card-list/api/get-homeworks';\nimport type { TCourseStream } from '../../milestone/create/milestone-create-types';\nimport type { IArrowTooltipProps } from '../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { TUserTypes } from '../../ui/types';\nimport type { ICoachmarkProps } from '../use-journey/journey-context-types';\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport HomeworkCard from '../../homework/homework-card';\nimport HWCardList from '../../homework/hw-card-list/hw-card-list';\nimport { getTopicsFromItems } from '../../milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-utils';\nimport Button from '../../ui/buttons/button/button';\nimport FlexView from '../../ui/layout/flex-view';\nimport Text from '../../ui/text/text';\nimport { ELementWrapper } from '../comps/coachmark/coachmark-styled';\nimport { JOURNEY_ID_STUDENT } from '../journey-id/journey-id-student';\nimport { IndicatorType } from '../use-journey/constants';\nimport { useJourney } from '../use-journey/use-journey';\n\nexport const useHomePageJourney = () => {\n const journeyId = JOURNEY_ID_STUDENT.HOMEPAGE_JOURNEY;\n\n const homepageRef = useRef<HTMLDivElement>(null);\n const homeworkRef = useRef<HTMLDivElement>(null);\n const individualHomeworkRef = useRef<HTMLDivElement>(null);\n const recentChaptersRef = useRef<HTMLDivElement>(null);\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n const { nextCoachmark, setJourney } = useJourney();\n\n const startJourney = useCallback(\n (\n hwDetails: IHomeworkData[],\n studentId: string,\n stream: TCourseStream,\n userType: TUserTypes,\n ) => {\n const { items, node_type: nodeType, title, subtext } = hwDetails[0] as IHomeworkData;\n const topics = getTopicsFromItems(items);\n const testChapterName = topics.join(', ');\n const isDynamicSheet = nodeType === 'DYNAMIC';\n\n if (!homepageRef?.current || !homeworkRef?.current || !individualHomeworkRef?.current) {\n return;\n }\n\n const homepageSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: homepageRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'left',\n tooltipXCoOrdinates: 0,\n tooltipYCoOrdinates: 100,\n backgroundColor: 'BLUE_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n arrowSize: 12,\n width: 264,\n tooltipItem: (\n <FlexView $flexRowGapX={0.75}>\n <Text $renderAs=\"ab2-bold\">Welcome to the all new tutoring homepage.</Text>\n <Button\n label=\"Next\"\n size=\"xsmall\"\n widthX={6}\n renderAs=\"secondary\"\n onClick={() => nextCoachmark(journeyId, false, 0, true)}\n />\n </FlexView>\n ),\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: homeworkRef,\n elementToHighlight: (\n <ELementWrapper>\n <HWCardList userType={userType} studentId={studentId} stream={stream} />\n </ELementWrapper>\n ),\n type: IndicatorType.TOOLTIP,\n indicator: {\n position: 'top',\n tooltipXCoOrdinates: -197,\n tooltipYCoOrdinates: -12,\n arrowXCoOrdinates: -110,\n backgroundColor: 'GREEN_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n width: 264,\n arrowSize: 12,\n tooltipItem: (\n <FlexView $flexRowGapX={0.75}>\n <Text $renderAs=\"ab2-bold\">\n Homework is now easy to access and easy to complete!\n </Text>\n <Button\n label=\"Next\"\n size=\"xsmall\"\n widthX={6}\n renderAs=\"secondary\"\n onClick={() => nextCoachmark(journeyId, false, 0, true)}\n />\n </FlexView>\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n {\n originalElementToHighlightRef: individualHomeworkRef,\n elementToHighlight: (\n <ELementWrapper>\n <HomeworkCard\n isInQueue={false}\n userType={userType}\n header={isDynamicSheet ? testChapterName : title}\n subHeader={subtext || ''}\n nodeData={hwDetails[0] as IHomeworkData}\n renderAs=\"homework\"\n shouldOpenOnRight={false}\n />\n </ELementWrapper>\n ),\n type: IndicatorType.TOOLTIP,\n indicator: {\n position: 'top',\n tooltipXCoOrdinates: -35,\n tooltipYCoOrdinates: -7,\n backgroundColor: 'PURPLE_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n arrowXCoOrdinates: -97,\n arrowSize: 12,\n width: 264,\n tooltipItem: (\n <FlexView $flexRowGapX={0.75}>\n <Text $renderAs=\"ab2-bold\">Track homework status and their due dates.</Text>\n <Button\n label=\"Next\"\n size=\"xsmall\"\n widthX={6}\n renderAs=\"secondary\"\n onClick={() => nextCoachmark(journeyId, false, 0, true)}\n />\n </FlexView>\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n ];\n\n setJourney(journeyId, homepageSteps);\n\n const delayBeforeStart = setTimeout(() => {\n clearTimeout(delayBeforeStart);\n nextCoachmark(journeyId);\n }, 200);\n\n timerRefs.current.push(delayBeforeStart); // Store to cleanup later\n },\n [setJourney, journeyId, nextCoachmark],\n );\n\n const data = useMemo(\n () => ({\n homepageRef,\n homeworkRef,\n individualHomeworkRef,\n recentChaptersRef,\n startJourney,\n }),\n [startJourney],\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n };\n }, []);\n\n return data;\n};\n"],"names":["useHomePageJourney","journeyId","JOURNEY_ID_STUDENT","homepageRef","useRef","homeworkRef","individualHomeworkRef","recentChaptersRef","timerRefs","nextCoachmark","setJourney","useJourney","startJourney","useCallback","hwDetails","studentId","stream","userType","items","nodeType","title","subtext","testChapterName","getTopicsFromItems","isDynamicSheet","homepageSteps","IndicatorType","jsx","Fragment","jsxs","FlexView","Text","Button","ELementWrapper","HWCardList","HomeworkCard","delayBeforeStart","data","useMemo","useEffect","timer"],"mappings":";;;;;;;;;;;;AAmBO,MAAMA,IAAqB,MAAM;AACtC,QAAMC,IAAYC,EAAmB,kBAE/BC,IAAcC,EAAuB,IAAI,GACzCC,IAAcD,EAAuB,IAAI,GACzCE,IAAwBF,EAAuB,IAAI,GACnDG,IAAoBH,EAAuB,IAAI,GAC/CI,IAAYJ,EAAwC,CAAA,CAAE,GACtD,EAAE,eAAAK,GAAe,YAAAC,EAAW,IAAIC,EAAW,GAE3CC,IAAeC;AAAA,IACnB,CACEC,GACAC,GACAC,GACAC,MACG;AACG,YAAA,EAAE,OAAAC,GAAO,WAAWC,GAAU,OAAAC,GAAO,SAAAC,EAAQ,IAAIP,EAAU,CAAC,GAE5DQ,IADSC,EAAmBL,CAAK,EACR,KAAK,IAAI,GAClCM,IAAiBL,MAAa;AAEhC,UAAA,EAAChB,KAAA,QAAAA,EAAa,YAAW,EAACE,KAAA,QAAAA,EAAa,YAAW,EAACC,KAAA,QAAAA,EAAuB;AAC5E;AAGF,YAAMmB,IAAmC;AAAA,QACvC;AAAA,UACE,+BAA+BtB;AAAA,UAC/B,UAAU;AAAA,UACV,MAAMuB,EAAc;AAAA,UACpB,oBAAsB,gBAAAC,EAAAC,GAAA,EAAA;AAAA,UACtB,WAAW;AAAA,YACT,UAAU;AAAA,YACV,qBAAqB;AAAA,YACrB,qBAAqB;AAAA,YACrB,iBAAiB;AAAA,YACjB,aAAa;AAAA,YACb,YAAY;AAAA,YACZ,WAAW;AAAA,YACX,OAAO;AAAA,YACP,aACE,gBAAAC,EAACC,GAAS,EAAA,cAAc,MACtB,UAAA;AAAA,cAAC,gBAAAH,EAAAI,GAAA,EAAK,WAAU,YAAW,UAAyC,6CAAA;AAAA,cACpE,gBAAAJ;AAAA,gBAACK;AAAA,gBAAA;AAAA,kBACC,OAAM;AAAA,kBAC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ey.tsx"],"sourcesContent":["import type { IHomeworkData } from '../../homework/hw-card-list/api/get-homeworks';\nimport type { TCourseStream } from '../../milestone/create/milestone-create-types';\nimport type { IArrowTooltipProps } from '../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { TUserTypes } from '../../ui/types';\nimport type { IHomepageStartJourneyProps } from '../types/homepage-journey-types';\nimport type { ICoachmarkProps } from '../use-journey/journey-context-types';\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport HomeworkCard from '../../homework/homework-card';\nimport HWCardList from '../../homework/hw-card-list/hw-card-list';\nimport { getTopicsFromItems } from '../../milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-utils';\nimport RecentChapters from '../../recent-chapters/recent-chapters';\nimport Button from '../../ui/buttons/button/button';\nimport FlexView from '../../ui/layout/flex-view';\nimport Text from '../../ui/text/text';\nimport { ELementWrapper } from '../comps/coachmark/coachmark-styled';\nimport { JOURNEY_ID_STUDENT } from '../journey-id/journey-id-student';\nimport { IndicatorType } from '../use-journey/constants';\nimport { useJourney } from '../use-journey/use-journey';\n\nexport const useHomePageJourney = () => {\n const journeyId = JOURNEY_ID_STUDENT.HOMEPAGE_JOURNEY;\n\n const homepageRef = useRef<HTMLDivElement>(null);\n const homeworkRef = useRef<HTMLDivElement>(null);\n const individualHomeworkRef = useRef<HTMLDivElement>(null);\n const recentChaptersRef = useRef<HTMLDivElement>(null);\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n const { nextCoachmark, setJourney, endJourney, addCoachmark } = useJourney();\n\n const handleLastStep = useCallback(\n (userId: string, userType: TUserTypes, courseValue: string) => {\n if (recentChaptersRef.current) {\n addCoachmark(JOURNEY_ID_STUDENT.HOMEPAGE_JOURNEY, {\n originalElementToHighlightRef: recentChaptersRef,\n elementToHighlight: (\n <FlexView $widthX={45}>\n <RecentChapters\n studentId={userId}\n courseStream={courseValue as TCourseStream}\n userType={userType}\n onChapterClick={() => null}\n />\n </FlexView>\n ),\n isActive: false,\n type: IndicatorType.TOOLTIP,\n indicator: {\n tooltipItem: (\n <FlexView $flexRowGapX={0.75} $justifyContent=\"flex-start\">\n <Text $renderAs=\"ab2-bold\">Access all your recent chapters in one place.</Text>\n <Button\n label=\"Got it\"\n size=\"xsmall\"\n widthX={6}\n renderAs=\"secondary\"\n onClick={() => endJourney(JOURNEY_ID_STUDENT.HOMEPAGE_JOURNEY)}\n />\n </FlexView>\n ),\n position: 'top',\n renderAs: 'primary',\n tooltipXCoOrdinates: -227,\n tooltipYCoOrdinates: 12,\n arrowXCoOrdinates: -110,\n backgroundColor: 'YELLOW_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n arrowSize: 12,\n width: 264,\n } as IArrowTooltipProps,\n });\n nextCoachmark(journeyId, false, 0, true);\n } else {\n endJourney(journeyId);\n }\n },\n [nextCoachmark, journeyId, addCoachmark, endJourney],\n );\n\n const startJourney = useCallback(\n ({ hwDetails, studentId, stream, userType }: IHomepageStartJourneyProps) => {\n const { items, node_type: nodeType, title, subtext } = hwDetails[0] as IHomeworkData;\n const topics = getTopicsFromItems(items);\n const testChapterName = topics.join(', ');\n const isDynamicSheet = nodeType === 'DYNAMIC';\n\n if (!homepageRef?.current || !homeworkRef?.current || !individualHomeworkRef?.current) {\n return;\n }\n\n const homepageSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: homepageRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'left',\n tooltipXCoOrdinates: 0,\n tooltipYCoOrdinates: 100,\n backgroundColor: 'BLUE_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n arrowSize: 12,\n width: 264,\n tooltipItem: (\n <FlexView $flexRowGapX={0.75}>\n <Text $renderAs=\"ab2-bold\">Welcome to the all new tutoring homepage.</Text>\n <Button\n label=\"Next\"\n size=\"xsmall\"\n widthX={6}\n renderAs=\"secondary\"\n onClick={() => nextCoachmark(journeyId, false, 0, true)}\n />\n </FlexView>\n ),\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: homeworkRef,\n elementToHighlight: (\n <ELementWrapper>\n <HWCardList userType={userType} studentId={studentId} stream={stream} />\n </ELementWrapper>\n ),\n type: IndicatorType.TOOLTIP,\n indicator: {\n position: 'top',\n tooltipXCoOrdinates: -197,\n tooltipYCoOrdinates: -12,\n arrowXCoOrdinates: -110,\n backgroundColor: 'GREEN_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n width: 264,\n arrowSize: 12,\n tooltipItem: (\n <FlexView $flexRowGapX={0.75}>\n <Text $renderAs=\"ab2-bold\">\n Homework is now easy to access and easy to complete!\n </Text>\n <Button\n label=\"Next\"\n size=\"xsmall\"\n widthX={6}\n renderAs=\"secondary\"\n onClick={() => nextCoachmark(journeyId, false, 0, true)}\n />\n </FlexView>\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n {\n originalElementToHighlightRef: individualHomeworkRef,\n elementToHighlight: (\n <ELementWrapper>\n <HomeworkCard\n isInQueue={false}\n userType={userType}\n header={isDynamicSheet ? testChapterName : title}\n subHeader={subtext || ''}\n nodeData={hwDetails[0] as IHomeworkData}\n renderAs=\"homework\"\n shouldOpenOnRight={false}\n />\n </ELementWrapper>\n ),\n type: IndicatorType.TOOLTIP,\n indicator: {\n position: 'top',\n tooltipXCoOrdinates: -35,\n tooltipYCoOrdinates: -7,\n backgroundColor: 'PURPLE_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n arrowXCoOrdinates: -97,\n arrowSize: 12,\n width: 264,\n tooltipItem: (\n <FlexView $flexRowGapX={0.75}>\n <Text $renderAs=\"ab2-bold\">Track homework status and their due dates.</Text>\n <Button\n label={recentChaptersRef.current ? 'Next' : 'Got it'}\n size=\"xsmall\"\n widthX={6}\n renderAs=\"secondary\"\n onClick={() => handleLastStep(studentId, userType, stream)}\n />\n </FlexView>\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n ];\n\n setJourney(journeyId, homepageSteps);\n\n const delayBeforeStart = setTimeout(() => {\n clearTimeout(delayBeforeStart);\n nextCoachmark(journeyId);\n }, 200);\n\n timerRefs.current.push(delayBeforeStart); // Store to cleanup later\n },\n [setJourney, journeyId, nextCoachmark, handleLastStep],\n );\n\n const data = useMemo(\n () => ({\n homepageRef,\n homeworkRef,\n individualHomeworkRef,\n recentChaptersRef,\n startJourney,\n }),\n [startJourney],\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n };\n }, []);\n\n return data;\n};\n"],"names":["useHomePageJourney","journeyId","JOURNEY_ID_STUDENT","homepageRef","useRef","homeworkRef","individualHomeworkRef","recentChaptersRef","timerRefs","nextCoachmark","setJourney","endJourney","addCoachmark","useJourney","handleLastStep","useCallback","userId","userType","courseValue","jsx","FlexView","RecentChapters","IndicatorType","jsxs","Text","Button","startJourney","hwDetails","studentId","stream","items","nodeType","title","subtext","testChapterName","getTopicsFromItems","isDynamicSheet","homepageSteps","Fragment","ELementWrapper","HWCardList","HomeworkCard","delayBeforeStart","data","useMemo","useEffect","timer"],"mappings":";;;;;;;;;;;;;AAqBO,MAAMA,KAAqB,MAAM;AACtC,QAAMC,IAAYC,EAAmB,kBAE/BC,IAAcC,EAAuB,IAAI,GACzCC,IAAcD,EAAuB,IAAI,GACzCE,IAAwBF,EAAuB,IAAI,GACnDG,IAAoBH,EAAuB,IAAI,GAC/CI,IAAYJ,EAAwC,CAAA,CAAE,GACtD,EAAE,eAAAK,GAAe,YAAAC,GAAY,YAAAC,GAAY,cAAAC,EAAA,IAAiBC,KAE1DC,IAAiBC;AAAA,IACrB,CAACC,GAAgBC,GAAsBC,MAAwB;AAC7D,MAAIX,EAAkB,WACpBK,EAAaV,EAAmB,kBAAkB;AAAA,QAChD,+BAA+BK;AAAA,QAC/B,oBACE,gBAAAY,EAACC,GAAS,EAAA,SAAS,IACjB,UAAA,gBAAAD;AAAA,UAACE;AAAA,UAAA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EAAcR,CAAS;AAAA,SACtB,GAAG;AAEI,MAAAO,EAAA,QAAQ,KAAKkC,CAAgB;AAAA,IACzC;AAAA,IACA,CAAChC,GAAYT,GAAWQ,GAAeK,CAAc;AAAA,EAAA,GAGjD6B,IAAOC;AAAA,IACX,OAAO;AAAA,MACL,aAAAzC;AAAA,MACA,aAAAE;AAAA,MACA,uBAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,cAAAmB;AAAA,IAAA;AAAA,IAEF,CAACA,CAAY;AAAA,EAAA;AAIf,SAAAmB,EAAU,MACD,MAAM;AACX,IAAArC,EAAU,QAAQ,QAAQ,CAASsC,MAAA,aAAaA,CAAK,CAAC,GACtDtC,EAAU,UAAU;EAAC,GAEtB,CAAE,CAAA,GAEEmC;AACT;"}
@@ -1,85 +1,39 @@
1
- import { jsx as r, jsxs as t } from "react/jsx-runtime";
2
- import { useCallback as O, useRef as $, useEffect as u } from "react";
3
- import A from "../chapters/chapters-list/chapter-item/chapter-item.js";
4
- import { JOURNEY_ID_STUDENT as R } from "../journey/journey-id/journey-id-student.js";
5
- import { IndicatorType as w } from "../journey/use-journey/constants.js";
6
- import { useJourney as g } from "../journey/use-journey/use-journey.js";
7
- import T from "../ui/buttons/button/button.js";
8
- import i from "../ui/layout/flex-view.js";
9
- import s from "../ui/text/text.js";
10
- import { useGetRecentChapters as y } from "./api/get-recent-chapters.js";
11
- import { ChaptersWrapper as x } from "./recent-chapters-styled.js";
12
- const _ = ({ studentId: a, courseStream: c, onChapterClick: n }) => {
13
- const { get: d, data: e, isProcessingFailed: E } = y(), m = O(() => {
14
- d(a, void 0, { courseStream: c });
15
- }, [c, d, a]), p = $(null), { addCoachmark: f, endJourney: h } = g(), { isJourneyActive: C } = g();
16
- return u(() => {
17
- m();
18
- }, [m]), u(() => {
19
- e && e.length > 0 && !C && f(R.HOMEPAGE_JOURNEY, {
20
- originalElementToHighlightRef: p,
21
- elementToHighlight: /* @__PURE__ */ r(i, { $widthX: 45, children: /* @__PURE__ */ t(i, { $flexRowGapX: 1, children: [
22
- /* @__PURE__ */ t(s, { $renderAs: "ac4-black", $color: "BLACK_T_60", children: [
23
- "Recent Chapters (",
24
- e == null ? void 0 : e.length,
25
- ")"
26
- ] }),
27
- /* @__PURE__ */ r(x, { children: e.map((o, l) => /* @__PURE__ */ r(
28
- A,
29
- {
30
- chapter: o,
31
- onChapterClick: n,
32
- itemIndex: l
33
- },
34
- o.id
35
- )) })
36
- ] }) }),
37
- isActive: !1,
38
- type: w.TOOLTIP,
39
- indicator: {
40
- tooltipItem: /* @__PURE__ */ t(i, { $flexRowGapX: 0.75, $justifyContent: "flex-start", children: [
41
- /* @__PURE__ */ r(s, { $renderAs: "ab2-bold", children: "Access all your recent chapters in one place." }),
42
- /* @__PURE__ */ r(
43
- T,
44
- {
45
- label: "Got it",
46
- size: "xsmall",
47
- widthX: 6,
48
- renderAs: "secondary",
49
- onClick: () => h(R.HOMEPAGE_JOURNEY)
50
- }
51
- )
52
- ] }),
53
- position: "top",
54
- renderAs: "primary",
55
- tooltipXCoOrdinates: -227,
56
- tooltipYCoOrdinates: 12,
57
- arrowXCoOrdinates: -110,
58
- backgroundColor: "YELLOW_4",
59
- borderColor: "BLACK",
60
- arrowColor: "BLACK",
61
- arrowSize: 12,
62
- width: 264
63
- }
64
- });
65
- }, [f, e, h, n, C]), E ? null : e && e.length > 0 ? /* @__PURE__ */ t(i, { $flexRowGapX: 1, ref: p, children: [
66
- /* @__PURE__ */ t(s, { $renderAs: "ac4-black", $color: "BLACK_T_60", children: [
1
+ import { jsxs as s, jsx as l } from "react/jsx-runtime";
2
+ import { useCallback as f, useEffect as h } from "react";
3
+ import C from "../chapters/chapters-list/chapter-item/chapter-item.js";
4
+ import d from "../ui/layout/flex-view.js";
5
+ import u from "../ui/text/text.js";
6
+ import { useGetRecentChapters as x } from "./api/get-recent-chapters.js";
7
+ import { ChaptersWrapper as g } from "./recent-chapters-styled.js";
8
+ const R = ({
9
+ studentId: r,
10
+ courseStream: t,
11
+ onChapterClick: p,
12
+ recentChaptersRef: a
13
+ }) => {
14
+ const { get: o, data: e, isProcessingFailed: m } = x(), i = f(() => {
15
+ o(r, void 0, { courseStream: t });
16
+ }, [t, o, r]);
17
+ return h(() => {
18
+ i();
19
+ }, [i]), m ? null : e && e.length > 0 ? /* @__PURE__ */ s(d, { $flexRowGapX: 1, ref: a, children: [
20
+ /* @__PURE__ */ s(u, { $renderAs: "ac4-black", $color: "BLACK_T_60", children: [
67
21
  "Recent Chapters (",
68
22
  e == null ? void 0 : e.length,
69
23
  ")"
70
24
  ] }),
71
- /* @__PURE__ */ r(x, { children: e.map((o, l) => /* @__PURE__ */ r(
72
- A,
25
+ /* @__PURE__ */ l(g, { children: e.map((n, c) => /* @__PURE__ */ l(
26
+ C,
73
27
  {
74
- chapter: o,
75
- onChapterClick: n,
76
- itemIndex: l
28
+ chapter: n,
29
+ onChapterClick: p,
30
+ itemIndex: c
77
31
  },
78
- o.id
32
+ n.id
79
33
  )) })
80
34
  ] }) : null;
81
- }, N = _;
35
+ }, G = R;
82
36
  export {
83
- N as default
37
+ G as default
84
38
  };
85
39
  //# sourceMappingURL=recent-chapters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"recent-chapters.js","sources":["../../../src/features/recent-chapters/recent-chapters.tsx"],"sourcesContent":["import type { IChaptersListProps } from '../chapters/chapters-list/chapters-list-types';\nimport type { TCourseStream } from '../milestone/create/milestone-create-types';\nimport type { IArrowTooltipProps } from '../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { TUserTypes } from '../ui/types';\nimport type { FC } from 'react';\n\nimport { useCallback, useEffect, useRef } from 'react';\n\nimport ChapterItem from '../chapters/chapters-list/chapter-item/chapter-item';\nimport { JOURNEY_ID_STUDENT } from '../journey/journey-id/journey-id-student';\nimport { IndicatorType } from '../journey/use-journey/constants';\nimport { useJourney } from '../journey/use-journey/use-journey';\nimport Button from '../ui/buttons/button/button';\nimport FlexView from '../ui/layout/flex-view';\nimport Text from '../ui/text/text';\nimport { useGetRecentChapters } from './api/get-recent-chapters';\nimport * as Styled from './recent-chapters-styled';\n\ninterface RecentChaptersProps {\n studentId: string;\n courseStream: TCourseStream;\n userType: TUserTypes;\n onChapterClick: IChaptersListProps['onChapterClick'];\n}\n\nconst RecentChapters: FC<RecentChaptersProps> = ({ studentId, courseStream, onChapterClick }) => {\n const { get: getChapters, data: chapterData, isProcessingFailed } = useGetRecentChapters();\n\n const fetchChapterDetails = useCallback(() => {\n getChapters(studentId, undefined, { courseStream });\n }, [courseStream, getChapters, studentId]);\n const recentChapterRef = useRef<HTMLDivElement>(null);\n const { addCoachmark, endJourney } = useJourney();\n const { isJourneyActive } = useJourney();\n\n useEffect(() => {\n fetchChapterDetails();\n }, [fetchChapterDetails]);\n\n useEffect(() => {\n if (chapterData && chapterData.length > 0 && !isJourneyActive) {\n addCoachmark(JOURNEY_ID_STUDENT.HOMEPAGE_JOURNEY, {\n originalElementToHighlightRef: recentChapterRef,\n elementToHighlight: (\n <FlexView $widthX={45}>\n <FlexView $flexRowGapX={1}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Recent Chapters ({chapterData?.length})\n </Text>\n <Styled.ChaptersWrapper>\n {chapterData.map((chapter, idx) => (\n <ChapterItem\n key={chapter.id}\n chapter={chapter}\n onChapterClick={onChapterClick}\n itemIndex={idx}\n />\n ))}\n </Styled.ChaptersWrapper>\n </FlexView>\n </FlexView>\n ),\n isActive: false,\n type: IndicatorType.TOOLTIP,\n indicator: {\n tooltipItem: (\n <FlexView $flexRowGapX={0.75} $justifyContent=\"flex-start\">\n <Text $renderAs=\"ab2-bold\">Access all your recent chapters in one place.</Text>\n <Button\n label=\"Got it\"\n size=\"xsmall\"\n widthX={6}\n renderAs=\"secondary\"\n onClick={() => endJourney(JOURNEY_ID_STUDENT.HOMEPAGE_JOURNEY)}\n />\n </FlexView>\n ),\n position: 'top',\n renderAs: 'primary',\n tooltipXCoOrdinates: -227,\n tooltipYCoOrdinates: 12,\n arrowXCoOrdinates: -110,\n backgroundColor: 'YELLOW_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n arrowSize: 12,\n width: 264,\n } as IArrowTooltipProps,\n });\n }\n }, [addCoachmark, chapterData, endJourney, onChapterClick, isJourneyActive]);\n\n if (isProcessingFailed) {\n return null;\n }\n\n if (chapterData && chapterData.length > 0) {\n return (\n <FlexView $flexRowGapX={1} ref={recentChapterRef}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Recent Chapters ({chapterData?.length})\n </Text>\n <Styled.ChaptersWrapper>\n {chapterData.map((chapter, idx) => (\n <ChapterItem\n key={chapter.id}\n chapter={chapter}\n onChapterClick={onChapterClick}\n itemIndex={idx}\n />\n ))}\n </Styled.ChaptersWrapper>\n </FlexView>\n );\n }\n\n return null;\n};\n\nexport default RecentChapters;\n"],"names":["RecentChapters","studentId","courseStream","onChapterClick","getChapters","chapterData","isProcessingFailed","useGetRecentChapters","fetchChapterDetails","useCallback","recentChapterRef","useRef","addCoachmark","endJourney","useJourney","isJourneyActive","useEffect","JOURNEY_ID_STUDENT","FlexView","jsxs","Text","jsx","Styled.ChaptersWrapper","chapter","idx","ChapterItem","IndicatorType","Button","RecentChapters$1"],"mappings":";;;;;;;;;;;AAyBA,MAAMA,IAA0C,CAAC,EAAE,WAAAC,GAAW,cAAAC,GAAc,gBAAAC,QAAqB;AAC/F,QAAM,EAAE,KAAKC,GAAa,MAAMC,GAAa,oBAAAC,EAAA,IAAuBC,KAE9DC,IAAsBC,EAAY,MAAM;AAC5C,IAAAL,EAAYH,GAAW,QAAW,EAAE,cAAAC,EAAc,CAAA;AAAA,EACjD,GAAA,CAACA,GAAcE,GAAaH,CAAS,CAAC,GACnCS,IAAmBC,EAAuB,IAAI,GAC9C,EAAE,cAAAC,GAAc,YAAAC,EAAW,IAAIC,EAAW,GAC1C,EAAE,iBAAAC,MAAoBD;AA2D5B,SAzDAE,EAAU,MAAM;AACM,IAAAR;EAAA,GACnB,CAACA,C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,CACD;AAAA,EACH,GACC,CAACL,GAAcP,GAAaQ,GAAYV,GAAgBY,CAAe,CAAC,GAEvET,IACK,OAGLD,KAAeA,EAAY,SAAS,IAEnC,gBAAAc,EAAAD,GAAA,EAAS,cAAc,GAAG,KAAKR,GAC9B,UAAA;AAAA,IAAA,gBAAAS,EAACC,GAAK,EAAA,WAAU,aAAY,QAAO,cAAa,UAAA;AAAA,MAAA;AAAA,MAC5Bf,KAAA,gBAAAA,EAAa;AAAA,MAAO;AAAA,IAAA,GACxC;AAAA,IACA,gBAAAgB,EAACC,GAAA,EACE,YAAY,IAAI,CAACC,GAASC,MACzB,gBAAAH;AAAA,MAACI;AAAA,MAAA;AAAA,QAEC,SAAAF;AAAA,QACA,gBAAApB;AAAA,QACA,WAAWqB;AAAA,MAAA;AAAA,MAHND,EAAQ;AAAA,IAKhB,CAAA,GACH;AAAA,EACF,EAAA,CAAA,IAIG;AACT,GAEAK,IAAe5B;"}
1
+ {"version":3,"file":"recent-chapters.js","sources":["../../../src/features/recent-chapters/recent-chapters.tsx"],"sourcesContent":["import type { IChaptersListProps } from '../chapters/chapters-list/chapters-list-types';\nimport type { TCourseStream } from '../milestone/create/milestone-create-types';\nimport type { TUserTypes } from '../ui/types';\nimport type { FC } from 'react';\n\nimport { useCallback, useEffect } from 'react';\n\nimport ChapterItem from '../chapters/chapters-list/chapter-item/chapter-item';\nimport FlexView from '../ui/layout/flex-view';\nimport Text from '../ui/text/text';\nimport { useGetRecentChapters } from './api/get-recent-chapters';\nimport * as Styled from './recent-chapters-styled';\n\ninterface RecentChaptersProps {\n studentId: string;\n courseStream: TCourseStream;\n userType: TUserTypes;\n onChapterClick: IChaptersListProps['onChapterClick'];\n recentChaptersRef?: React.RefObject<HTMLDivElement>;\n}\n\nconst RecentChapters: FC<RecentChaptersProps> = ({\n studentId,\n courseStream,\n onChapterClick,\n recentChaptersRef,\n}) => {\n const { get: getChapters, data: chapterData, isProcessingFailed } = useGetRecentChapters();\n\n const fetchChapterDetails = useCallback(() => {\n getChapters(studentId, undefined, { courseStream });\n }, [courseStream, getChapters, studentId]);\n\n useEffect(() => {\n fetchChapterDetails();\n }, [fetchChapterDetails]);\n\n if (isProcessingFailed) {\n return null;\n }\n\n if (chapterData && chapterData.length > 0) {\n return (\n <FlexView $flexRowGapX={1} ref={recentChaptersRef}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Recent Chapters ({chapterData?.length})\n </Text>\n <Styled.ChaptersWrapper>\n {chapterData.map((chapter, idx) => (\n <ChapterItem\n key={chapter.id}\n chapter={chapter}\n onChapterClick={onChapterClick}\n itemIndex={idx}\n />\n ))}\n </Styled.ChaptersWrapper>\n </FlexView>\n );\n }\n\n return null;\n};\n\nexport default RecentChapters;\n"],"names":["RecentChapters","studentId","courseStream","onChapterClick","recentChaptersRef","getChapters","chapterData","isProcessingFailed","useGetRecentChapters","fetchChapterDetails","useCallback","useEffect","jsxs","FlexView","Text","jsx","Styled.ChaptersWrapper","chapter","idx","ChapterItem","RecentChapters$1"],"mappings":";;;;;;;AAqBA,MAAMA,IAA0C,CAAC;AAAA,EAC/C,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,mBAAAC;AACF,MAAM;AACJ,QAAM,EAAE,KAAKC,GAAa,MAAMC,GAAa,oBAAAC,EAAA,IAAuBC,KAE9DC,IAAsBC,EAAY,MAAM;AAC5C,IAAAL,EAAYJ,GAAW,QAAW,EAAE,cAAAC,EAAc,CAAA;AAAA,EACjD,GAAA,CAACA,GAAcG,GAAaJ,CAAS,CAAC;AAMzC,SAJAU,EAAU,MAAM;AACM,IAAAF;EAAA,GACnB,CAACA,CAAmB,CAAC,GAEpBF,IACK,OAGLD,KAAeA,EAAY,SAAS,IAEnC,gBAAAM,EAAAC,GAAA,EAAS,cAAc,GAAG,KAAKT,GAC9B,UAAA;AAAA,IAAA,gBAAAQ,EAACE,GAAK,EAAA,WAAU,aAAY,QAAO,cAAa,UAAA;AAAA,MAAA;AAAA,MAC5BR,KAAA,gBAAAA,EAAa;AAAA,MAAO;AAAA,IAAA,GACxC;AAAA,IACA,gBAAAS,EAACC,GAAA,EACE,YAAY,IAAI,CAACC,GAASC,MACzB,gBAAAH;AAAA,MAACI;AAAA,MAAA;AAAA,QAEC,SAAAF;AAAA,QACA,gBAAAd;AAAA,QACA,WAAWe;AAAA,MAAA;AAAA,MAHND,EAAQ;AAAA,IAKhB,CAAA,GACH;AAAA,EACF,EAAA,CAAA,IAIG;AACT,GAEAG,IAAepB;"}
package/dist/index.d.ts CHANGED
@@ -506,7 +506,7 @@ declare interface HWCardListProps extends INodeCardCallbacks {
506
506
  onTestReview?: (sheetData: INodeDataProps, milestoneId?: string) => void;
507
507
  homeworkRef?: React_2.RefObject<HTMLDivElement>;
508
508
  individualHomeworkRef?: React_2.RefObject<HTMLDivElement>;
509
- startHomePageJourney?: (homeworkDetails: INodeDataProps[], studentId: string, stream: string) => void;
509
+ startHomePageJourney?: ({ hwDetails, studentId, stream, userType, }: IHomepageStartJourneyProps) => void;
510
510
  }
511
511
 
512
512
  declare interface IAccordionSectionProps {
@@ -1312,6 +1312,13 @@ declare interface IGradeSelectorProps {
1312
1312
  layoutAlignment?: 'center' | 'auto';
1313
1313
  }
1314
1314
 
1315
+ export declare interface IHomepageStartJourneyProps {
1316
+ hwDetails: IHomeworkData[];
1317
+ studentId: string;
1318
+ stream: string;
1319
+ userType: TUserTypes;
1320
+ }
1321
+
1315
1322
  export declare interface IHomeworkData extends INodeDataProps {
1316
1323
  homework_id: string;
1317
1324
  chapter_name: string;
@@ -4037,6 +4044,7 @@ declare interface RecentChaptersProps {
4037
4044
  courseStream: TCourseStream;
4038
4045
  userType: TUserTypes;
4039
4046
  onChapterClick: IChaptersListProps['onChapterClick'];
4047
+ recentChaptersRef?: React.RefObject<HTMLDivElement>;
4040
4048
  }
4041
4049
 
4042
4050
  export declare const RedoIcon: React_2.FC<React_2.SVGProps<SVGSVGElement>>;
@@ -5335,7 +5343,7 @@ export declare const useHomePageJourney: () => {
5335
5343
  homeworkRef: RefObject<HTMLDivElement>;
5336
5344
  individualHomeworkRef: RefObject<HTMLDivElement>;
5337
5345
  recentChaptersRef: RefObject<HTMLDivElement>;
5338
- startJourney: (hwDetails: IHomeworkData[], studentId: string, stream: TCourseStream, userType: TUserTypes) => void;
5346
+ startJourney: ({ hwDetails, studentId, stream, userType }: IHomepageStartJourneyProps) => void;
5339
5347
  };
5340
5348
 
5341
5349
  export declare const useInClassActionDispatcher: ({ studentClassroomId, }: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuemath/leap",
3
- "version": "2.9.4-as2",
3
+ "version": "2.9.4-as3",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"