@cuemath/leap 3.5.4-as5 → 3.5.4-as7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"use-daily-timeline-get.js","sources":["../../../../src/features/timeline/api/use-daily-timeline-get.ts"],"sourcesContent":["import { createGetAPI } from '@cuemath/rest-api';\n\nimport { BASE_URL_V3 } from '../../../constants/api';\nimport { stringify } from '../../../helpers/query-string';\nimport type { TCourseStream } from '../../milestone/create/milestone-create-types';\n\nexport type TState = 'COMPLETED' | 'IN_PROGRESS' | 'PENDING';\n\nexport interface ItemRef {\n ref: string;\n}\n\nexport interface TimeLineItem {\n accuracy: number | null;\n block_type: string | null;\n card_type?: string;\n chapter_name: string | null;\n feedback_comments: string | null;\n image_hue: string | null;\n is_timed: boolean;\n items: ItemRef[] | null;\n label: string;\n learnosity_activity_ref: string | null;\n node_id: string;\n node_type: string;\n max_score: number | null;\n points: number | null;\n state: TState;\n subtext: string | null;\n task_type: string | null;\n time_taken: number | null;\n tip: string | null;\n title: string;\n total_questions: number | null;\n total_score: number | null;\n user_id?: string;\n user_node_id: string;\n}\n\nexport interface TimeLineEntry {\n cards: TimeLineItem[];\n course_stream: TCourseStream | 'CIRCLE' | null;\n summary: string | null;\n type: 'CW' | 'HW' | 'CIRCLE';\n}\n\nexport type TimelineData = {\n daily_logs: TimeLineEntry[];\n\n from_date: string;\n to_date: string;\n};\n\nexport type TimelineResponse = {\n curr_page: number | null;\n next_page: number | null;\n per_page: number | null;\n total_pages: number | null;\n user_logs: TimelineData[];\n};\n\ninterface GetUserTimelineParams {\n course_stream?: TCourseStream[];\n page?: number; // defaults to 1\n size?: number; // defaults to 10 - page size means no of dates data\n timezone: string;\n}\n\nconst { useGet: useDailyTimelineGet } = createGetAPI<TimelineResponse, GetUserTimelineParams>({\n getURL: (studentId: string, queryParams) => {\n return `${BASE_URL_V3}/user-timeline/${studentId}?${stringify(queryParams)}`;\n },\n});\n\nexport { useDailyTimelineGet };\n"],"names":["useDailyTimelineGet","createGetAPI","studentId","queryParams","BASE_URL_V3","stringify"],"mappings":";;;AAoEA,MAAM,EAAE,QAAQA,EAAoB,IAAIC,EAAsD;AAAA,EAC5F,QAAQ,CAACC,GAAmBC,MACnB,GAAGC,CAAW,kBAAkBF,CAAS,IAAIG,EAAUF,CAAW,CAAC;AAE9E,CAAC;"}
1
+ {"version":3,"file":"use-daily-timeline-get.js","sources":["../../../../src/features/timeline/api/use-daily-timeline-get.ts"],"sourcesContent":["import { createGetAPI } from '@cuemath/rest-api';\n\nimport { BASE_URL_V3 } from '../../../constants/api';\nimport { stringify } from '../../../helpers/query-string';\nimport type { TCourseStream } from '../../milestone/create/milestone-create-types';\n\nexport type TState = 'COMPLETED' | 'IN_PROGRESS' | 'PENDING';\n\nexport interface ItemRef {\n ref: string;\n}\n\nexport interface TimeLineItem {\n accuracy: number | null;\n block_type: string | null;\n card_type?: string;\n chapter_name: string | null;\n feedback_comments: string | null;\n image_hue: string | null;\n is_timed: boolean;\n items: ItemRef[] | null;\n label: string;\n learnosity_activity_ref: string | null;\n max_score: number | null;\n node_id: string;\n node_type: string;\n points: number | null;\n state: TState;\n subtext: string | null;\n task_type: string | null;\n time_taken: number | null;\n tip: string | null;\n title: string;\n total_questions: number | null;\n total_score: number | null;\n user_block_id: string | null;\n user_id?: string;\n user_node_id: string;\n}\n\nexport interface TimeLineEntry {\n cards: TimeLineItem[];\n course_stream: TCourseStream | 'CIRCLE' | null;\n summary: string | null;\n type: 'CW' | 'HW' | 'CIRCLE';\n}\n\nexport type TimelineData = {\n daily_logs: TimeLineEntry[];\n\n from_date: string;\n to_date: string;\n};\n\nexport type TimelineResponse = {\n curr_page: number | null;\n next_page: number | null;\n per_page: number | null;\n total_pages: number | null;\n user_logs: TimelineData[];\n};\n\ninterface GetUserTimelineParams {\n course_stream?: TCourseStream[];\n page?: number; // defaults to 1\n size?: number; // defaults to 10 - page size means no of dates data\n timezone: string;\n}\n\nconst { useGet: useDailyTimelineGet } = createGetAPI<TimelineResponse, GetUserTimelineParams>({\n getURL: (studentId: string, queryParams) => {\n return `${BASE_URL_V3}/user-timeline/${studentId}?${stringify(queryParams)}`;\n },\n});\n\nexport { useDailyTimelineGet };\n"],"names":["useDailyTimelineGet","createGetAPI","studentId","queryParams","BASE_URL_V3","stringify"],"mappings":";;;AAqEA,MAAM,EAAE,QAAQA,EAAoB,IAAIC,EAAsD;AAAA,EAC5F,QAAQ,CAACC,GAAmBC,MACnB,GAAGC,CAAW,kBAAkBF,CAAS,IAAIG,EAAUF,CAAW,CAAC;AAE9E,CAAC;"}
@@ -1,44 +1,53 @@
1
1
  import { jsxs as o, jsx as r } from "react/jsx-runtime";
2
- import { memo as A, useCallback as h } from "react";
3
- import f from "../../../ui/buttons/text-button/text-button.js";
4
- import i from "../../../ui/layout/flex-view.js";
5
- import c from "../../../ui/text/text.js";
6
- import { getStateColor as _, getStateIcon as w } from "./utils.js";
7
- const C = A(
8
- ({ userType: l, card: $, onPuzzleClick: n, onReviewClick: d }) => {
9
- const { label: t, title: x, state: s, subtext: a, user_node_id: e } = $, b = t === "PUZZLE", m = w(s), u = h(() => {
10
- t === "PUZZLE" && l === "TEACHER" && e && n && n(e);
11
- }, [t, n, e, l]), p = h(() => {
12
- d && e && d(e);
13
- }, [d, e]);
14
- return /* @__PURE__ */ o(i, { $flexDirection: "row", $flexGapX: 1.5, children: [
15
- /* @__PURE__ */ r(i, { $background: _(s), $borderRadiusX: 0.5, $width: 16, $height: 16, children: m && /* @__PURE__ */ r(m, { width: 16, height: 16 }) }),
16
- /* @__PURE__ */ o(i, { $flexRowGapX: 0.25, children: [
17
- /* @__PURE__ */ o(c, { $renderAs: "ub3", children: [
18
- /* @__PURE__ */ o(c, { $renderAs: "ub3-bold", $inline: !0, children: [
19
- t,
2
+ import { memo as k, useCallback as b } from "react";
3
+ import p from "../../../ui/buttons/text-button/text-button.js";
4
+ import t from "../../../ui/layout/flex-view.js";
5
+ import s from "../../../ui/text/text.js";
6
+ import { getStateColor as C, getStateIcon as B } from "./utils.js";
7
+ import { BLOCK_TYPE as S } from "../../../chapters-v2/constants/block-constants.js";
8
+ const g = k(
9
+ ({ userType: n, card: _, onPuzzleClick: l, onReviewClick: i }) => {
10
+ const {
11
+ label: d,
12
+ title: $,
13
+ state: a,
14
+ subtext: m,
15
+ user_node_id: e,
16
+ block_type: T,
17
+ user_block_id: h
18
+ } = _, x = d === "PUZZLE", u = B(a), c = n === "TEACHER" || n === "STUDENT", A = b(() => {
19
+ c && e && l && l(e);
20
+ }, [l, c, e]), f = T === S.SAT_MOCK_TEST, w = b(() => {
21
+ i && e && i(e, f, h);
22
+ }, [f, i, h, e]);
23
+ return /* @__PURE__ */ o(t, { $flexDirection: "row", $flexGapX: 1.5, children: [
24
+ /* @__PURE__ */ r(t, { $background: C(a), $borderRadiusX: 0.5, $width: 16, $height: 16, children: u && /* @__PURE__ */ r(u, { width: 16, height: 16 }) }),
25
+ /* @__PURE__ */ o(t, { $flexRowGapX: 0.25, children: [
26
+ /* @__PURE__ */ o(s, { $renderAs: "ub3", children: [
27
+ /* @__PURE__ */ o(s, { $renderAs: "ub3-bold", $inline: !0, children: [
28
+ d,
20
29
  ":"
21
30
  ] }),
22
31
  " ",
23
- x
32
+ $
24
33
  ] }),
25
- b ? /* @__PURE__ */ r(
26
- f,
34
+ x ? /* @__PURE__ */ r(
35
+ p,
27
36
  {
28
37
  label: "View assigned puzzle",
29
38
  size: "small",
30
39
  color: "BLACK_T_60",
31
- onClick: u
40
+ onClick: A
32
41
  }
33
- ) : /* @__PURE__ */ o(i, { $flexDirection: "row", $flexGapX: 0.25, children: [
34
- a && /* @__PURE__ */ r(c, { $renderAs: "ub3", $color: "BLACK_T_60", children: a }),
35
- l === "TEACHER" && /* @__PURE__ */ r(
36
- f,
42
+ ) : /* @__PURE__ */ o(t, { $flexDirection: "row", $flexGapX: 0.25, children: [
43
+ m && /* @__PURE__ */ r(s, { $renderAs: "ub3", $color: "BLACK_T_60", children: m }),
44
+ c && /* @__PURE__ */ r(
45
+ p,
37
46
  {
38
47
  label: "Review",
39
48
  size: "small",
40
49
  color: "BLACK_T_60",
41
- onClick: p
50
+ onClick: w
42
51
  }
43
52
  )
44
53
  ] })
@@ -46,8 +55,8 @@ const C = A(
46
55
  ] });
47
56
  }
48
57
  );
49
- C.displayName = "AccordionItem";
58
+ g.displayName = "AccordionItem";
50
59
  export {
51
- C as default
60
+ g as default
52
61
  };
53
62
  //# sourceMappingURL=accordion-item.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"accordion-item.js","sources":["../../../../../src/features/timeline/comps/accordion-item/accordion-item.tsx"],"sourcesContent":["import { memo, useCallback, type FC } from 'react';\n\nimport TextButton from '../../../ui/buttons/text-button/text-button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Text from '../../../ui/text/text';\nimport type { AccordionItemProps } from './accordion-item-types';\nimport { getStateColor, getStateIcon } from './utils';\n\nconst AccordionItem: FC<AccordionItemProps> = memo(\n ({ userType, card, onPuzzleClick, onReviewClick }) => {\n const { label, title, state, subtext, user_node_id: userNodeId } = card;\n const isPuzzle = label === 'PUZZLE';\n const Icon = getStateIcon(state);\n\n const handleClick = useCallback(() => {\n if (label === 'PUZZLE' && userType === 'TEACHER' && userNodeId && onPuzzleClick) {\n onPuzzleClick(userNodeId);\n }\n }, [label, onPuzzleClick, userNodeId, userType]);\n\n const handleReviewClick = useCallback(() => {\n if (onReviewClick && userNodeId) {\n onReviewClick(userNodeId);\n }\n }, [onReviewClick, userNodeId]);\n\n return (\n <FlexView $flexDirection=\"row\" $flexGapX={1.5}>\n <FlexView $background={getStateColor(state)} $borderRadiusX={0.5} $width={16} $height={16}>\n {Icon && <Icon width={16} height={16} />}\n </FlexView>\n <FlexView $flexRowGapX={0.25}>\n <Text $renderAs=\"ub3\">\n <Text $renderAs=\"ub3-bold\" $inline>\n {label}:\n </Text>{' '}\n {title}\n </Text>\n {isPuzzle ? (\n <TextButton\n label=\"View assigned puzzle\"\n size=\"small\"\n color=\"BLACK_T_60\"\n onClick={handleClick}\n />\n ) : (\n <FlexView $flexDirection=\"row\" $flexGapX={0.25}>\n {subtext && (\n <Text $renderAs=\"ub3\" $color=\"BLACK_T_60\">\n {subtext}\n </Text>\n )}\n {userType === 'TEACHER' && (\n <TextButton\n label=\"Review\"\n size=\"small\"\n color=\"BLACK_T_60\"\n onClick={handleReviewClick}\n />\n )}\n </FlexView>\n )}\n </FlexView>\n </FlexView>\n );\n },\n);\n\nAccordionItem.displayName = 'AccordionItem';\n\nexport default AccordionItem;\n"],"names":["AccordionItem","memo","userType","card","onPuzzleClick","onReviewClick","label","title","state","subtext","userNodeId","isPuzzle","Icon","getStateIcon","handleClick","useCallback","handleReviewClick","jsxs","FlexView","jsx","getStateColor","Text","TextButton"],"mappings":";;;;;;AAQA,MAAMA,IAAwCC;AAAA,EAC5C,CAAC,EAAE,UAAAC,GAAU,MAAAC,GAAM,eAAAC,GAAe,eAAAC,QAAoB;AACpD,UAAM,EAAE,OAAAC,GAAO,OAAAC,GAAO,OAAAC,GAAO,SAAAC,GAAS,cAAcC,EAAe,IAAAP,GAC7DQ,IAAWL,MAAU,UACrBM,IAAOC,EAAaL,CAAK,GAEzBM,IAAcC,EAAY,MAAM;AACpC,MAAIT,MAAU,YAAYJ,MAAa,aAAaQ,KAAcN,KAChEA,EAAcM,CAAU;AAAA,OAEzB,CAACJ,GAAOF,GAAeM,GAAYR,CAAQ,CAAC,GAEzCc,IAAoBD,EAAY,MAAM;AAC1C,MAAIV,KAAiBK,KACnBL,EAAcK,CAAU;AAAA,IAC1B,GACC,CAACL,GAAeK,CAAU,CAAC;AAE9B,WACG,gBAAAO,EAAAC,GAAA,EAAS,gBAAe,OAAM,WAAW,KACxC,UAAA;AAAA,MAAA,gBAAAC,EAACD,KAAS,aAAaE,EAAcZ,CAAK,GAAG,gBAAgB,KAAK,QAAQ,IAAI,SAAS,IACpF,eAAS,gBAAAW,EAAAP,GAAA,EAAK,OAAO,IAAI,QAAQ,GAAI,CAAA,GACxC;AAAA,MACA,gBAAAK,EAACC,GAAS,EAAA,cAAc,MACtB,UAAA;AAAA,QAAC,gBAAAD,EAAAI,GAAA,EAAK,WAAU,OACd,UAAA;AAAA,UAAA,gBAAAJ,EAACI,GAAK,EAAA,WAAU,YAAW,SAAO,IAC/B,UAAA;AAAA,YAAAf;AAAA,YAAM;AAAA,UAAA,GACT;AAAA,UAAQ;AAAA,UACPC;AAAA,QAAA,GACH;AAAA,QACCI,IACC,gBAAAQ;AAAA,UAACG;AAAA,UAAA;AAAA,YACC,OAAM;AAAA,YACN,MAAK;AAAA,YACL,OAAM;AAAA,YACN,SAASR;AAAA,UAAA;AAAA,QAAA,IAGV,gBAAAG,EAAAC,GAAA,EAAS,gBAAe,OAAM,WAAW,MACvC,UAAA;AAAA,UAAAT,uBACEY,GAAK,EAAA,WAAU,OAAM,QAAO,cAC1B,UACHZ,GAAA;AAAA,UAEDP,MAAa,aACZ,gBAAAiB;AAAA,YAACG;AAAA,YAAA;AAAA,cACC,OAAM;AAAA,cACN,MAAK;AAAA,cACL,OAAM;AAAA,cACN,SAASN;AAAA,YAAA;AAAA,UACX;AAAA,QAAA,GAEJ;AAAA,MAAA,GAEJ;AAAA,IACF,EAAA,CAAA;AAAA,EAEJ;AACF;AAEAhB,EAAc,cAAc;"}
1
+ {"version":3,"file":"accordion-item.js","sources":["../../../../../src/features/timeline/comps/accordion-item/accordion-item.tsx"],"sourcesContent":["import { memo, useCallback, type FC } from 'react';\n\nimport TextButton from '../../../ui/buttons/text-button/text-button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Text from '../../../ui/text/text';\nimport type { AccordionItemProps } from './accordion-item-types';\nimport { getStateColor, getStateIcon } from './utils';\nimport { BLOCK_TYPE } from '../../../chapters-v2/constants/block-constants';\n\nconst AccordionItem: FC<AccordionItemProps> = memo(\n ({ userType, card, onPuzzleClick, onReviewClick }) => {\n const {\n label,\n title,\n state,\n subtext,\n user_node_id: userNodeId,\n block_type: blockType,\n user_block_id: userBlockId,\n } = card;\n const isPuzzle = label === 'PUZZLE';\n const Icon = getStateIcon(state);\n\n const shouldShowReview = userType === 'TEACHER' || userType === 'STUDENT';\n\n const handlePuzzleClick = useCallback(() => {\n if (shouldShowReview && userNodeId && onPuzzleClick) {\n onPuzzleClick(userNodeId);\n }\n }, [onPuzzleClick, shouldShowReview, userNodeId]);\n const isSatMockTestBlock = blockType === BLOCK_TYPE.SAT_MOCK_TEST;\n\n const handleReviewClick = useCallback(() => {\n if (onReviewClick && userNodeId) {\n onReviewClick(userNodeId, isSatMockTestBlock, userBlockId);\n }\n }, [isSatMockTestBlock, onReviewClick, userBlockId, userNodeId]);\n\n return (\n <FlexView $flexDirection=\"row\" $flexGapX={1.5}>\n <FlexView $background={getStateColor(state)} $borderRadiusX={0.5} $width={16} $height={16}>\n {Icon && <Icon width={16} height={16} />}\n </FlexView>\n <FlexView $flexRowGapX={0.25}>\n <Text $renderAs=\"ub3\">\n <Text $renderAs=\"ub3-bold\" $inline>\n {label}:\n </Text>{' '}\n {title}\n </Text>\n {isPuzzle ? (\n <TextButton\n label=\"View assigned puzzle\"\n size=\"small\"\n color=\"BLACK_T_60\"\n onClick={handlePuzzleClick}\n />\n ) : (\n <FlexView $flexDirection=\"row\" $flexGapX={0.25}>\n {subtext && (\n <Text $renderAs=\"ub3\" $color=\"BLACK_T_60\">\n {subtext}\n </Text>\n )}\n {shouldShowReview && (\n <TextButton\n label=\"Review\"\n size=\"small\"\n color=\"BLACK_T_60\"\n onClick={handleReviewClick}\n />\n )}\n </FlexView>\n )}\n </FlexView>\n </FlexView>\n );\n },\n);\n\nAccordionItem.displayName = 'AccordionItem';\n\nexport default AccordionItem;\n"],"names":["AccordionItem","memo","userType","card","onPuzzleClick","onReviewClick","label","title","state","subtext","userNodeId","blockType","userBlockId","isPuzzle","Icon","getStateIcon","shouldShowReview","handlePuzzleClick","useCallback","isSatMockTestBlock","BLOCK_TYPE","handleReviewClick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;AAAA,UAACG;AAAA,UAAA;AAAA,YACC,OAAM;AAAA,YACN,MAAK;AAAA,YACL,OAAM;AAAA,YACN,SAASV;AAAA,UAAA;AAAA,QAAA,IAGV,gBAAAK,EAAAC,GAAA,EAAS,gBAAe,OAAM,WAAW,MACvC,UAAA;AAAA,UAAAd,uBACEiB,GAAK,EAAA,WAAU,OAAM,QAAO,cAC1B,UACHjB,GAAA;AAAA,UAEDO,KACC,gBAAAQ;AAAA,YAACG;AAAA,YAAA;AAAA,cACC,OAAM;AAAA,cACN,MAAK;AAAA,cACL,OAAM;AAAA,cACN,SAASN;AAAA,YAAA;AAAA,UACX;AAAA,QAAA,GAEJ;AAAA,MAAA,GAEJ;AAAA,IACF,EAAA,CAAA;AAAA,EAEJ;AACF;AAEArB,EAAc,cAAc;"}
@@ -0,0 +1,17 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import a from "styled-components";
3
+ import i from "../../ui/layout/flex-view.js";
4
+ import { monthImageMap as n } from "./accordion-item/utils.js";
5
+ const m = a(i)`
6
+ margin-top: ${({ $isLastYear: r }) => r ? "-46px" : "0"};
7
+ background-image: url(${({ $img: r }) => r});
8
+ background-size: cover;
9
+ background-position: center;
10
+ `, u = ({ fromMonth: r, isLastDayOfMth: t }) => {
11
+ const o = n[String(r).padStart(2, "0")];
12
+ return r && t ? /* @__PURE__ */ e(m, { $isLastYear: t, $img: o, $width: "100%", $height: 246 }) : null;
13
+ };
14
+ export {
15
+ u as default
16
+ };
17
+ //# sourceMappingURL=month-break.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"month-break.js","sources":["../../../../src/features/timeline/comps/month-break.tsx"],"sourcesContent":["import styled from 'styled-components';\n\nimport FlexView from '../../ui/layout/flex-view';\nimport { monthImageMap } from './accordion-item/utils';\n\nconst MonthImageWrapper = styled(FlexView)<{ $isLastYear: boolean; $img: string }>`\n margin-top: ${({ $isLastYear }) => ($isLastYear ? '-46px' : '0')};\n background-image: url(${({ $img }) => $img});\n background-size: cover;\n background-position: center;\n`;\n\ninterface MonthBreakProps {\n fromMonth: number;\n isLastDayOfMth: boolean;\n}\n\nconst MonthBreak = ({ fromMonth, isLastDayOfMth }: MonthBreakProps) => {\n const Image = monthImageMap[String(fromMonth).padStart(2, '0') as keyof typeof monthImageMap];\n\n if (fromMonth && isLastDayOfMth)\n return (\n <MonthImageWrapper $isLastYear={isLastDayOfMth} $img={Image} $width={'100%'} $height={246} />\n );\n\n return null;\n};\n\nexport default MonthBreak;\n"],"names":["MonthImageWrapper","styled","FlexView","$isLastYear","$img","MonthBreak","fromMonth","isLastDayOfMth","Image","monthImageMap","jsx"],"mappings":";;;;AAKA,MAAMA,IAAoBC,EAAOC,CAAQ;AAAA,gBACzB,CAAC,EAAE,aAAAC,EAAA,MAAmBA,IAAc,UAAU,GAAI;AAAA,0BACxC,CAAC,EAAE,MAAAC,EAAK,MAAMA,CAAI;AAAA;AAAA;AAAA,GAUtCC,IAAa,CAAC,EAAE,WAAAC,GAAW,gBAAAC,QAAsC;AAC/D,QAAAC,IAAQC,EAAc,OAAOH,CAAS,EAAE,SAAS,GAAG,GAAG,CAA+B;AAE5F,SAAIA,KAAaC,IAEb,gBAAAG,EAACV,KAAkB,aAAaO,GAAgB,MAAMC,GAAO,QAAQ,QAAQ,SAAS,IAAK,CAAA,IAGxF;AACT;"}
@@ -0,0 +1,15 @@
1
+ import { jsxs as o, jsx as r } from "react/jsx-runtime";
2
+ import i from "styled-components";
3
+ import a from "../../ui/layout/flex-view.js";
4
+ import m from "../../ui/separator/separator.js";
5
+ import l from "../../ui/text/text.js";
6
+ const n = i(a)`
7
+ z-index: 1;
8
+ `, x = ({ toYear: e, isLastDayOfYear: t }) => t ? /* @__PURE__ */ o(n, { $gutterX: 1, children: [
9
+ /* @__PURE__ */ r(m, { heightX: 1 }),
10
+ /* @__PURE__ */ r(l, { $renderAs: "ac4-black", $color: "BLACK_T_60", children: e })
11
+ ] }) : null;
12
+ export {
13
+ x as default
14
+ };
15
+ //# sourceMappingURL=year-break.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"year-break.js","sources":["../../../../src/features/timeline/comps/year-break.tsx"],"sourcesContent":["import styled from 'styled-components';\n\nimport FlexView from '../../ui/layout/flex-view';\nimport Separator from '../../ui/separator/separator';\nimport Text from '../../ui/text/text';\n\nconst YearWrapper = styled(FlexView)`\n z-index: 1;\n`;\n\ninterface YearBreakProps {\n toYear: number;\n isLastDayOfYear: boolean;\n}\n\nconst YearBreak = ({ toYear, isLastDayOfYear }: YearBreakProps) => {\n if (isLastDayOfYear) {\n return (\n <YearWrapper $gutterX={1}>\n <Separator heightX={1} />\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n {toYear}\n </Text>\n </YearWrapper>\n );\n }\n\n return null;\n};\n\nexport default YearBreak;\n"],"names":["YearWrapper","styled","FlexView","YearBreak","toYear","isLastDayOfYear","jsxs","jsx","Separator","Text"],"mappings":";;;;;AAMA,MAAMA,IAAcC,EAAOC,CAAQ;AAAA;AAAA,GAS7BC,IAAY,CAAC,EAAE,QAAAC,GAAQ,iBAAAC,QACvBA,IAEA,gBAAAC,EAACN,GAAY,EAAA,UAAU,GACrB,UAAA;AAAA,EAAC,gBAAAO,EAAAC,GAAA,EAAU,SAAS,EAAG,CAAA;AAAA,oBACtBC,GAAK,EAAA,WAAU,aAAY,QAAO,cAChC,UACHL,GAAA;AACF,EAAA,CAAA,IAIG;"}
@@ -1,14 +1,14 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { memo as c, useMemo as s } from "react";
2
+ import { memo as p, useMemo as s } from "react";
3
3
  import g from "../../../ui/layout/flex-view.js";
4
4
  import h from "../../../ui/simple-accordian/accordion.js";
5
5
  import u from "../../comps/accordion-item/accordion-item.js";
6
6
  import { getTimelineCardIcon as $ } from "../../comps/accordion-item/utils.js";
7
7
  import { Card as x } from "./daily-timeline-items-styled.js";
8
- const B = c(
8
+ const B = p(
9
9
  ({
10
10
  type: e,
11
- summary: i,
11
+ summary: r,
12
12
  cards: t,
13
13
  onPuzzleClick: n,
14
14
  onReviewClick: l,
@@ -16,29 +16,29 @@ const B = c(
16
16
  shouldShowTag: a,
17
17
  userType: f
18
18
  }) => {
19
- const p = s(() => $(e), [e]);
19
+ const c = s(() => $(e), [e]);
20
20
  return /* @__PURE__ */ o(
21
21
  h,
22
22
  {
23
23
  tag: a ? d : void 0,
24
- title: i,
24
+ title: r,
25
25
  defaultExpanded: !1,
26
- icon: p,
27
- children: t.length > 0 && /* @__PURE__ */ o(g, { $gutter: 32, $marginBottom: 24, children: t.map((m, r) => /* @__PURE__ */ o(
26
+ icon: c ?? "",
27
+ children: t.length > 0 && /* @__PURE__ */ o(g, { $gutter: 32, $marginBottom: 24, children: t.map((i, m) => /* @__PURE__ */ o(
28
28
  x,
29
29
  {
30
- $isLastCard: r === t.length - 1,
30
+ $isLastCard: m === t.length - 1,
31
31
  children: /* @__PURE__ */ o(
32
32
  u,
33
33
  {
34
34
  userType: f,
35
- card: m,
35
+ card: i,
36
36
  onPuzzleClick: n,
37
37
  onReviewClick: l
38
38
  }
39
39
  )
40
40
  },
41
- `${m.node_id}-${r}`
41
+ `${i.node_id}-${m}`
42
42
  )) })
43
43
  }
44
44
  );
@@ -1 +1 @@
1
- {"version":3,"file":"daily-timeline-items.js","sources":["../../../../../src/features/timeline/daily-timeline/daily-timeline-items/daily-timeline-items.tsx"],"sourcesContent":["import { memo, useMemo, type FC } from 'react';\n\nimport FlexView from '../../../ui/layout/flex-view';\nimport Accordion from '../../../ui/simple-accordian/accordion';\nimport AccordionItem from '../../comps/accordion-item/accordion-item';\nimport { getTimelineCardIcon } from '../../comps/accordion-item/utils';\nimport * as Styled from './daily-timeline-items-styled';\nimport type { DailyTimelineItemsProps } from './daily-timeline-items.types';\n\nconst DailyTimelineItems: FC<DailyTimelineItemsProps> = memo(\n ({\n type,\n summary,\n cards,\n onPuzzleClick,\n onReviewClick,\n courseStream,\n shouldShowTag,\n userType,\n }) => {\n const icon = useMemo(() => getTimelineCardIcon(type), [type]);\n\n return (\n <Accordion\n tag={shouldShowTag ? courseStream : undefined}\n title={summary}\n defaultExpanded={false}\n icon={icon}\n >\n {cards.length > 0 && (\n <FlexView $gutter={32} $marginBottom={24}>\n {cards.map((card, index) => (\n <Styled.Card\n key={`${card.node_id}-${index}`}\n $isLastCard={index === cards.length - 1}\n >\n <AccordionItem\n userType={userType}\n card={card}\n onPuzzleClick={onPuzzleClick}\n onReviewClick={onReviewClick}\n />\n </Styled.Card>\n ))}\n </FlexView>\n )}\n </Accordion>\n );\n },\n);\n\nexport default DailyTimelineItems;\n"],"names":["DailyTimelineItems","memo","type","summary","cards","onPuzzleClick","onReviewClick","courseStream","shouldShowTag","userType","icon","useMemo","getTimelineCardIcon","jsx","Accordion","FlexView","card","index","Styled.Card","AccordionItem"],"mappings":";;;;;;;AASA,MAAMA,IAAkDC;AAAA,EACtD,CAAC;AAAA,IACC,MAAAC;AAAA,IACA,SAAAC;AAAA,IACA,OAAAC;AAAA,IACA,eAAAC;AAAA,IACA,eAAAC;AAAA,IACA,cAAAC;AAAA,IACA,eAAAC;AAAA,IACA,UAAAC;AAAA,EAAA,MACI;AACE,UAAAC,IAAOC,EAAQ,MAAMC,EAAoBV,CAAI,GAAG,CAACA,CAAI,CAAC;AAG1D,WAAA,gBAAAW;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,KAAKN,IAAgBD,IAAe;AAAA,QACpC,OAAOJ;AAAA,QACP,iBAAiB;AAAA,QACjB,MAAAO;AAAA,QAEC,UAAMN,EAAA,SAAS,KACd,gBAAAS,EAACE,GAAS,EAAA,SAAS,IAAI,eAAe,IACnC,UAAAX,EAAM,IAAI,CAACY,GAAMC,MAChB,gBAAAJ;AAAA,UAACK;AAAAA,UAAA;AAAA,YAEC,aAAaD,MAAUb,EAAM,SAAS;AAAA,YAEtC,UAAA,gBAAAS;AAAA,cAACM;AAAA,cAAA;AAAA,gBACC,UAAAV;AAAA,gBACA,MAAAO;AAAA,gBACA,eAAAX;AAAA,gBACA,eAAAC;AAAA,cAAA;AAAA,YACF;AAAA,UAAA;AAAA,UARK,GAAGU,EAAK,OAAO,IAAIC,CAAK;AAAA,QAUhC,CAAA,GACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;"}
1
+ {"version":3,"file":"daily-timeline-items.js","sources":["../../../../../src/features/timeline/daily-timeline/daily-timeline-items/daily-timeline-items.tsx"],"sourcesContent":["import { memo, useMemo, type FC } from 'react';\n\nimport FlexView from '../../../ui/layout/flex-view';\nimport Accordion from '../../../ui/simple-accordian/accordion';\nimport AccordionItem from '../../comps/accordion-item/accordion-item';\nimport { getTimelineCardIcon } from '../../comps/accordion-item/utils';\nimport * as Styled from './daily-timeline-items-styled';\nimport type { DailyTimelineItemsProps } from './daily-timeline-items.types';\n\nconst DailyTimelineItems: FC<DailyTimelineItemsProps> = memo(\n ({\n type,\n summary,\n cards,\n onPuzzleClick,\n onReviewClick,\n courseStream,\n shouldShowTag,\n userType,\n }) => {\n const icon = useMemo(() => getTimelineCardIcon(type), [type]);\n\n return (\n <Accordion\n tag={shouldShowTag ? courseStream : undefined}\n title={summary}\n defaultExpanded={false}\n icon={icon ?? ''}\n >\n {cards.length > 0 && (\n <FlexView $gutter={32} $marginBottom={24}>\n {cards.map((card, index) => (\n <Styled.Card\n key={`${card.node_id}-${index}`}\n $isLastCard={index === cards.length - 1}\n >\n <AccordionItem\n userType={userType}\n card={card}\n onPuzzleClick={onPuzzleClick}\n onReviewClick={onReviewClick}\n />\n </Styled.Card>\n ))}\n </FlexView>\n )}\n </Accordion>\n );\n },\n);\n\nexport default DailyTimelineItems;\n"],"names":["DailyTimelineItems","memo","type","summary","cards","onPuzzleClick","onReviewClick","courseStream","shouldShowTag","userType","icon","useMemo","getTimelineCardIcon","jsx","Accordion","FlexView","card","index","Styled.Card","AccordionItem"],"mappings":";;;;;;;AASA,MAAMA,IAAkDC;AAAA,EACtD,CAAC;AAAA,IACC,MAAAC;AAAA,IACA,SAAAC;AAAA,IACA,OAAAC;AAAA,IACA,eAAAC;AAAA,IACA,eAAAC;AAAA,IACA,cAAAC;AAAA,IACA,eAAAC;AAAA,IACA,UAAAC;AAAA,EAAA,MACI;AACE,UAAAC,IAAOC,EAAQ,MAAMC,EAAoBV,CAAI,GAAG,CAACA,CAAI,CAAC;AAG1D,WAAA,gBAAAW;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,KAAKN,IAAgBD,IAAe;AAAA,QACpC,OAAOJ;AAAA,QACP,iBAAiB;AAAA,QACjB,MAAMO,KAAQ;AAAA,QAEb,UAAMN,EAAA,SAAS,KACd,gBAAAS,EAACE,GAAS,EAAA,SAAS,IAAI,eAAe,IACnC,UAAAX,EAAM,IAAI,CAACY,GAAMC,MAChB,gBAAAJ;AAAA,UAACK;AAAAA,UAAA;AAAA,YAEC,aAAaD,MAAUb,EAAM,SAAS;AAAA,YAEtC,UAAA,gBAAAS;AAAA,cAACM;AAAA,cAAA;AAAA,gBACC,UAAAV;AAAA,gBACA,MAAAO;AAAA,gBACA,eAAAX;AAAA,gBACA,eAAAC;AAAA,cAAA;AAAA,YACF;AAAA,UAAA;AAAA,UARK,GAAGU,EAAK,OAAO,IAAIC,CAAK;AAAA,QAUhC,CAAA,GACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;"}
@@ -1,37 +1,26 @@
1
- import t from "styled-components";
2
- import e from "../../ui/layout/flex-view.js";
3
- const a = t(e)`
1
+ import o from "styled-components";
2
+ import t from "../../ui/layout/flex-view.js";
3
+ const n = o(t)`
4
4
  overflow-y: auto;
5
5
  width: 100%;
6
- `, p = t(e)`
6
+ `, m = o(t)`
7
7
  max-width: 512px;
8
8
  width: 100%;
9
- `, d = t(e)`
9
+ `, d = o(t)`
10
10
  & > div {
11
11
  border-bottom: none;
12
12
  }
13
13
  & > div:last-child {
14
- border-bottom: 1px solid ${({ theme: o, $borderBottomColor: i }) => o.colors[i]};
14
+ border-bottom: 1px solid ${({ theme: i, $borderBottomColor: e }) => i.colors[e]};
15
15
  }
16
- `, l = t(e)`
17
- margin-top: ${({ $addedmonthbreak: o }) => o ? "-122px" : "0"};
18
- z-index: 1;
19
- `, m = t(e)`
20
- margin-top: ${({ $isLastYear: o }) => o ? "-46px" : "0"};
21
- background-image: url(${({ $img: o }) => o});
22
- background-size: cover;
23
- background-position: center;
24
- width: 100%;
25
- height: 246px;
26
- `, c = t(e)`
16
+ `, a = o(t)`
17
+ margin-top: ${({ $addedmonthbreak: i }) => i ? "-122px" : "0"};
27
18
  z-index: 1;
28
19
  `;
29
20
  export {
30
- l as DailyItems,
31
- p as DailyTimelineContainer,
21
+ a as DailyItems,
22
+ m as DailyTimelineContainer,
32
23
  d as DailyTimelineItemsContainer,
33
- m as MonthImageWrapper,
34
- a as ScrollWrapper,
35
- c as YearWrapper
24
+ n as ScrollWrapper
36
25
  };
37
26
  //# sourceMappingURL=daily-timeline-styled.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"daily-timeline-styled.js","sources":["../../../../src/features/timeline/daily-timeline/daily-timeline-styled.tsx"],"sourcesContent":["import styled from 'styled-components';\n\nimport FlexView from '../../ui/layout/flex-view';\nimport { type TColorNames } from '../../ui/types';\n\nconst ScrollWrapper = styled(FlexView)`\n overflow-y: auto;\n width: 100%;\n`;\n\nconst DailyTimelineContainer = styled(FlexView)`\n max-width: 512px;\n width: 100%;\n`;\n\nconst DailyTimelineItemsContainer = styled(FlexView)<{ $borderBottomColor: TColorNames }>`\n & > div {\n border-bottom: none;\n }\n & > div:last-child {\n border-bottom: 1px solid ${({ theme, $borderBottomColor }) => theme.colors[$borderBottomColor]};\n }\n`;\n\nconst DailyItems = styled(FlexView)<{ $addedmonthbreak?: boolean }>`\n margin-top: ${({ $addedmonthbreak }) => ($addedmonthbreak ? '-122px' : '0')};\n z-index: 1;\n`;\n\nconst MonthImageWrapper = styled(FlexView)<{ $isLastYear: boolean; $img: string }>`\n margin-top: ${({ $isLastYear }) => ($isLastYear ? '-46px' : '0')};\n background-image: url(${({ $img }) => $img});\n background-size: cover;\n background-position: center;\n width: 100%;\n height: 246px;\n`;\n\nconst YearWrapper = styled(FlexView)`\n z-index: 1;\n`;\n\nexport {\n DailyTimelineContainer,\n DailyItems,\n MonthImageWrapper,\n YearWrapper,\n DailyTimelineItemsContainer,\n ScrollWrapper,\n};\n"],"names":["ScrollWrapper","styled","FlexView","DailyTimelineContainer","DailyTimelineItemsContainer","theme","$borderBottomColor","DailyItems","$addedmonthbreak","MonthImageWrapper","$isLastYear","$img","YearWrapper"],"mappings":";;AAKM,MAAAA,IAAgBC,EAAOC,CAAQ;AAAA;AAAA;AAAA,GAK/BC,IAAyBF,EAAOC,CAAQ;AAAA;AAAA;AAAA,GAKxCE,IAA8BH,EAAOC,CAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,+BAKpB,CAAC,EAAE,OAAAG,GAAO,oBAAAC,EAAA,MAAyBD,EAAM,OAAOC,CAAkB,CAAC;AAAA;AAAA,GAI5FC,IAAaN,EAAOC,CAAQ;AAAA,gBAClB,CAAC,EAAE,kBAAAM,EAAA,MAAwBA,IAAmB,WAAW,GAAI;AAAA;AAAA,GAIvEC,IAAoBR,EAAOC,CAAQ;AAAA,gBACzB,CAAC,EAAE,aAAAQ,EAAA,MAAmBA,IAAc,UAAU,GAAI;AAAA,0BACxC,CAAC,EAAE,MAAAC,EAAK,MAAMA,CAAI;AAAA;AAAA;AAAA;AAAA;AAAA,GAOtCC,IAAcX,EAAOC,CAAQ;AAAA;AAAA;"}
1
+ {"version":3,"file":"daily-timeline-styled.js","sources":["../../../../src/features/timeline/daily-timeline/daily-timeline-styled.tsx"],"sourcesContent":["import styled from 'styled-components';\n\nimport FlexView from '../../ui/layout/flex-view';\nimport { type TColorNames } from '../../ui/types';\n\nconst ScrollWrapper = styled(FlexView)`\n overflow-y: auto;\n width: 100%;\n`;\n\nconst DailyTimelineContainer = styled(FlexView)`\n max-width: 512px;\n width: 100%;\n`;\n\nconst DailyTimelineItemsContainer = styled(FlexView)<{ $borderBottomColor: TColorNames }>`\n & > div {\n border-bottom: none;\n }\n & > div:last-child {\n border-bottom: 1px solid ${({ theme, $borderBottomColor }) => theme.colors[$borderBottomColor]};\n }\n`;\n\nconst DailyItems = styled(FlexView)<{ $addedmonthbreak?: boolean }>`\n margin-top: ${({ $addedmonthbreak }) => ($addedmonthbreak ? '-122px' : '0')};\n z-index: 1;\n`;\n\nexport { DailyTimelineContainer, DailyItems, DailyTimelineItemsContainer, ScrollWrapper };\n"],"names":["ScrollWrapper","styled","FlexView","DailyTimelineContainer","DailyTimelineItemsContainer","theme","$borderBottomColor","DailyItems","$addedmonthbreak"],"mappings":";;AAKM,MAAAA,IAAgBC,EAAOC,CAAQ;AAAA;AAAA;AAAA,GAK/BC,IAAyBF,EAAOC,CAAQ;AAAA;AAAA;AAAA,GAKxCE,IAA8BH,EAAOC,CAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,+BAKpB,CAAC,EAAE,OAAAG,GAAO,oBAAAC,EAAA,MAAyBD,EAAM,OAAOC,CAAkB,CAAC;AAAA;AAAA,GAI5FC,IAAaN,EAAOC,CAAQ;AAAA,gBAClB,CAAC,EAAE,kBAAAM,EAAA,MAAwBA,IAAmB,WAAW,GAAI;AAAA;AAAA;"}
@@ -1,108 +1,100 @@
1
- import { jsx as e, jsxs as s } from "react/jsx-runtime";
2
- import { memo as G, useMemo as v, useState as x, useRef as U, useCallback as Z, useEffect as $ } from "react";
3
- import { ILLUSTRATIONS as q } from "../../../assets/illustrations/illustrations.js";
4
- import { Loader as J } from "../../ui/buttons/button/button-styled.js";
5
- import Q from "../../ui/error/error.js";
6
- import u from "../../ui/layout/flex-view.js";
7
- import ee from "../../ui/loader/app-loader/app-loader.js";
8
- import m from "../../ui/separator/separator.js";
9
- import te from "../../ui/simple-accordian/accordion.js";
10
- import N from "../../ui/text/text.js";
11
- import { useDailyTimelineGet as re } from "../api/use-daily-timeline-get.js";
12
- import { getTimelineCardIcon as oe, getDayMonthYear as O, monthImageMap as ie } from "../comps/accordion-item/utils.js";
13
- import ne from "./daily-timeline-items/daily-timeline-items.js";
14
- import { ScrollWrapper as ae, DailyTimelineContainer as le, YearWrapper as se, MonthImageWrapper as me, DailyItems as ce, DailyTimelineItemsContainer as he } from "./daily-timeline-styled.js";
1
+ import { jsx as e, jsxs as d } from "react/jsx-runtime";
2
+ import { memo as G, useMemo as b, useState as v, useRef as U, useCallback as W, useEffect as g } from "react";
3
+ import { ILLUSTRATIONS as Z } from "../../../assets/illustrations/illustrations.js";
4
+ import { Loader as q } from "../../ui/buttons/button/button-styled.js";
5
+ import J from "../../ui/error/error.js";
6
+ import p from "../../ui/layout/flex-view.js";
7
+ import Q from "../../ui/loader/app-loader/app-loader.js";
8
+ import u from "../../ui/separator/separator.js";
9
+ import ee from "../../ui/simple-accordian/accordion.js";
10
+ import te from "../../ui/text/text.js";
11
+ import { useDailyTimelineGet as oe } from "../api/use-daily-timeline-get.js";
12
+ import { getTimelineCardIcon as re, getDayMonthYear as x } from "../comps/accordion-item/utils.js";
13
+ import ie from "./daily-timeline-items/daily-timeline-items.js";
14
+ import { ScrollWrapper as ne, DailyTimelineContainer as ae, DailyItems as me, DailyTimelineItemsContainer as se } from "./daily-timeline-styled.js";
15
+ import le from "../comps/month-break.js";
16
+ import ce from "../comps/year-break.js";
15
17
  import { parseISO as B } from "../../../node_modules/date-fns/parseISO.js";
16
18
  import { isLastDayOfMonth as fe } from "../../../node_modules/date-fns/isLastDayOfMonth.js";
17
- const de = G(
18
- ({ userType: c, studentId: h, courseStreams: a, onPuzzlesClick: X, onReviewClick: j, scrollAreaHeight: k }) => {
19
- const T = v(() => Intl.DateTimeFormat().resolvedOptions().timeZone, []), [y, L] = x([]), [f, C] = x(!1), _ = U(null), K = v(() => oe("NO_ACTIVITY"), []), {
20
- get: A,
21
- data: r,
19
+ const he = G(
20
+ ({ userType: s, studentId: l, courseStreams: a, onPuzzlesClick: N, onReviewClick: k, scrollAreaHeight: S }) => {
21
+ const y = b(() => Intl.DateTimeFormat().resolvedOptions().timeZone, []), [T, $] = v([]), [c, L] = v(!1), C = U(null), j = b(() => re("NO_ACTIVITY"), []), {
22
+ get: D,
23
+ data: o,
22
24
  isProcessingFailed: R,
23
- isProcessing: Y
24
- } = re(h), { user_logs: d } = r ?? {}, i = Z(
25
- (t = 1, o = !1) => {
26
- o && C(!0), A(h, {
25
+ isProcessing: z
26
+ } = oe(l), { user_logs: f } = o ?? {}, i = W(
27
+ (t = 1, r = !1) => {
28
+ r && L(!0), D(l, {
27
29
  page: t,
28
30
  size: 10,
29
- timezone: T,
30
- course_stream: c === "TEACHER" ? a : []
31
+ timezone: y,
32
+ course_stream: s === "TEACHER" ? a : []
31
33
  });
32
34
  },
33
- [A, h, T, c, a]
35
+ [D, l, y, s, a]
34
36
  );
35
- return $(() => {
36
- r && (r.curr_page === 1 ? L(d ?? []) : (L((t) => [...t, ...d ?? []]), C(!1)));
37
- }, [r, d]), $(() => {
37
+ return g(() => {
38
+ o && (o.curr_page === 1 ? $(f ?? []) : ($((t) => [...t, ...f ?? []]), L(!1)));
39
+ }, [o, f]), g(() => {
38
40
  i(1, !1);
39
- }, [i]), $(() => {
40
- const t = _.current;
41
+ }, [i]), g(() => {
42
+ const t = C.current;
41
43
  if (!t) return;
42
- const o = () => {
43
- r != null && r.next_page && !f && t.scrollTop + t.clientHeight >= t.scrollHeight - 100 && i(r.next_page, !0);
44
+ const r = () => {
45
+ o != null && o.next_page && !c && t.scrollTop + t.clientHeight >= t.scrollHeight - 100 && i(o.next_page, !0);
44
46
  };
45
- return t.addEventListener("scroll", o), () => {
46
- t.removeEventListener("scroll", o);
47
+ return t.addEventListener("scroll", r), () => {
48
+ t.removeEventListener("scroll", r);
47
49
  };
48
- }, [r, f, i]), R ? /* @__PURE__ */ e(Q, { height: "70vh", onTryAgain: () => i(1, !1) }) : Y && !y.length ? /* @__PURE__ */ e(u, { $alignItems: "center", $justifyContent: "center", $height: "100%", children: /* @__PURE__ */ e(ee, { width: "100%", height: "100%" }) }) : /* @__PURE__ */ e(
49
- ae,
50
+ }, [o, c, i]), R ? /* @__PURE__ */ e(J, { height: "70vh", onTryAgain: () => i(1, !1) }) : z && !T.length ? /* @__PURE__ */ e(p, { $alignItems: "center", $justifyContent: "center", $height: "100%", children: /* @__PURE__ */ e(Q, { width: "100%", height: "100%" }) }) : /* @__PURE__ */ e(
51
+ ne,
50
52
  {
51
- ref: _,
52
- $height: k,
53
+ ref: C,
54
+ $height: S,
53
55
  $alignItems: "center",
54
- children: /* @__PURE__ */ s(le, { children: [
55
- y.map((t, o) => {
56
- const { daily_logs: l, from_date: D, to_date: I } = t;
57
- if (l) {
58
- const z = B(D), M = B(I), {
59
- day: b,
60
- month: w,
56
+ children: /* @__PURE__ */ d(ae, { children: [
57
+ T.map((t, r) => {
58
+ const { daily_logs: m, from_date: _, to_date: A } = t;
59
+ if (m) {
60
+ const K = B(_), I = B(A), {
61
+ day: M,
62
+ month: Y,
63
+ monthName: w
64
+ } = x(K), {
65
+ day: O,
66
+ month: E,
67
+ year: X,
61
68
  monthName: F
62
- } = O(z), {
63
- day: E,
64
- month: g,
65
- year: H,
66
- monthName: P
67
- } = O(M), p = fe(M), S = p && g === 12 && E === 31, W = !!(a && a.length > 1);
68
- return /* @__PURE__ */ s(u, { children: [
69
- S && /* @__PURE__ */ s(se, { $gutterX: 1, children: [
70
- /* @__PURE__ */ e(m, { heightX: 1 }),
71
- /* @__PURE__ */ e(N, { $renderAs: "ac4-black", $color: "BLACK_T_60", children: H })
72
- ] }),
73
- p && g && /* @__PURE__ */ e(
74
- me,
75
- {
76
- $heightX: 15.36,
77
- $isLastYear: S,
78
- $img: ie[String(w).padStart(2, "0")]
79
- }
80
- ),
81
- /* @__PURE__ */ s(ce, { $gutterX: 1, $addedmonthbreak: !!(p && g), children: [
82
- /* @__PURE__ */ e(m, { heightX: 1 }),
83
- /* @__PURE__ */ e(N, { $renderAs: "ac4-black", $color: "BLACK_T_60", children: D === I ? `${b} ${F}` : `${b} - ${E} ${P}` }),
84
- /* @__PURE__ */ e(m, { heightX: 1 }),
69
+ } = x(I), h = fe(I), H = h && E === 12 && O === 31, P = !!(a && a.length > 1);
70
+ return /* @__PURE__ */ d(p, { children: [
71
+ /* @__PURE__ */ e(ce, { toYear: X, isLastDayOfYear: H }),
72
+ /* @__PURE__ */ e(le, { fromMonth: Y, isLastDayOfMth: h }),
73
+ /* @__PURE__ */ d(me, { $gutterX: 1, $addedmonthbreak: !!(h && E), children: [
74
+ /* @__PURE__ */ e(u, { heightX: 1 }),
75
+ /* @__PURE__ */ e(te, { $renderAs: "ac4-black", $color: "BLACK_T_60", children: _ === A ? `${M} ${w}` : `${M} - ${O} ${F}` }),
76
+ /* @__PURE__ */ e(u, { heightX: 1 }),
85
77
  /* @__PURE__ */ e(
86
- he,
78
+ se,
87
79
  {
88
- $borderBottomColor: l.length > 0 ? "BLACK" : "BLACK_T_04",
89
- children: l.length > 0 ? l.map((n, V) => /* @__PURE__ */ e(
90
- ne,
80
+ $borderBottomColor: m.length > 0 ? "BLACK" : "BLACK_T_04",
81
+ children: m.length > 0 ? m.map((n, V) => /* @__PURE__ */ e(
82
+ ie,
91
83
  {
92
84
  type: n.type,
93
- summary: n.summary || "",
94
- courseStream: n.course_stream || void 0,
85
+ summary: n.summary ?? "",
86
+ courseStream: n.course_stream ?? void 0,
95
87
  cards: n.cards,
96
- onPuzzleClick: X,
97
- onReviewClick: j,
98
- userType: c,
99
- shouldShowTag: W && n.course_stream !== "CIRCLE"
88
+ onPuzzleClick: N,
89
+ onReviewClick: k,
90
+ userType: s,
91
+ shouldShowTag: P && n.course_stream !== "CIRCLE"
100
92
  },
101
93
  `timeline-${V}`
102
94
  )) : /* @__PURE__ */ e(
103
- te,
95
+ ee,
104
96
  {
105
- icon: K,
97
+ icon: j ?? "",
106
98
  title: "No Activity",
107
99
  defaultExpanded: !1,
108
100
  $borderColor: "BLACK_T_04",
@@ -111,18 +103,18 @@ const de = G(
111
103
  )
112
104
  }
113
105
  ),
114
- /* @__PURE__ */ e(m, { heightX: 1 })
106
+ /* @__PURE__ */ e(u, { heightX: 1 })
115
107
  ] })
116
- ] }, `timeline-entry-${o}`);
108
+ ] }, `timeline-entry-${r}`);
117
109
  }
118
110
  }),
119
- f && /* @__PURE__ */ e(u, { $alignItems: "center", $justifyContent: "center", $height: "100%", children: /* @__PURE__ */ e(J, { src: q.LOADER, alt: "Loader", $size: "large" }) })
111
+ c && /* @__PURE__ */ e(p, { $alignItems: "center", $justifyContent: "center", $height: "100%", children: /* @__PURE__ */ e(q, { src: Z.LOADER, alt: "Loader", $size: "large" }) })
120
112
  ] })
121
113
  }
122
114
  );
123
115
  }
124
- ), ve = de;
116
+ ), xe = he;
125
117
  export {
126
- ve as default
118
+ xe as default
127
119
  };
128
120
  //# sourceMappingURL=daily-timeline.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"daily-timeline.js","sources":["../../../../src/features/timeline/daily-timeline/daily-timeline.tsx"],"sourcesContent":["import { isLastDayOfMonth, parseISO } from 'date-fns';\nimport { memo, useCallback, useEffect, useMemo, useRef, useState, type FC } from 'react';\n\nimport { ILLUSTRATIONS } from '../../../assets/illustrations/illustrations';\nimport { Loader } from '../../ui/buttons/button/button-styled';\nimport Error from '../../ui/error/error';\nimport FlexView from '../../ui/layout/flex-view';\nimport AppLoader from '../../ui/loader/app-loader/app-loader';\nimport Separator from '../../ui/separator/separator';\nimport Accordion from '../../ui/simple-accordian/accordion';\nimport Text from '../../ui/text/text';\nimport { type TimelineData, useDailyTimelineGet } from '../api/use-daily-timeline-get';\nimport { getDayMonthYear, getTimelineCardIcon, monthImageMap } from '../comps/accordion-item/utils';\nimport DailyTimelineItems from './daily-timeline-items/daily-timeline-items';\nimport * as Styled from './daily-timeline-styled';\nimport { type DailyTimelineProps } from './daily-timeline-types';\n\nconst DailyTimeline: FC<DailyTimelineProps> = memo(\n ({ userType, studentId, courseStreams, onPuzzlesClick, onReviewClick, scrollAreaHeight }) => {\n const timezone = useMemo(() => Intl.DateTimeFormat().resolvedOptions().timeZone, []);\n const [allTimelineData, setAllTimelineData] = useState<TimelineData[]>([]);\n const [isLoadingMore, setIsLoadingMore] = useState(false);\n const scrollContainerRef = useRef<HTMLDivElement>(null);\n const NoActivityIcon = useMemo(() => getTimelineCardIcon('NO_ACTIVITY'), []);\n const {\n get: getTimeline,\n data: timelineData,\n isProcessingFailed,\n isProcessing,\n } = useDailyTimelineGet(studentId);\n const { user_logs: userLogs } = timelineData ?? {};\n\n const fetchTimeline = useCallback(\n (page = 1, append = false) => {\n if (append) {\n setIsLoadingMore(true);\n }\n\n getTimeline(studentId, {\n page,\n size: 10,\n timezone,\n course_stream: userType === 'TEACHER' ? courseStreams : [],\n });\n },\n [getTimeline, studentId, timezone, userType, courseStreams],\n );\n\n useEffect(() => {\n if (timelineData) {\n if (timelineData.curr_page === 1) {\n setAllTimelineData(userLogs ?? []);\n } else {\n setAllTimelineData(prev => [...prev, ...(userLogs ?? [])]);\n setIsLoadingMore(false);\n }\n }\n }, [timelineData, userLogs]);\n\n useEffect(() => {\n fetchTimeline(1, false);\n }, [fetchTimeline]);\n\n useEffect(() => {\n const container = scrollContainerRef.current;\n\n if (!container) return;\n\n const handleScroll = () => {\n if (\n timelineData?.next_page &&\n !isLoadingMore &&\n container.scrollTop + container.clientHeight >= container.scrollHeight - 100\n ) {\n fetchTimeline(timelineData.next_page, true);\n }\n };\n\n container.addEventListener('scroll', handleScroll);\n\n return () => {\n container.removeEventListener('scroll', handleScroll);\n };\n }, [timelineData, isLoadingMore, fetchTimeline]);\n\n if (isProcessingFailed) {\n return <Error height=\"70vh\" onTryAgain={() => fetchTimeline(1, false)} />;\n }\n\n if (isProcessing && !allTimelineData.length) {\n return (\n <FlexView $alignItems=\"center\" $justifyContent=\"center\" $height=\"100%\">\n <AppLoader width=\"100%\" height=\"100%\" />\n </FlexView>\n );\n }\n\n return (\n <Styled.ScrollWrapper\n ref={scrollContainerRef}\n $height={scrollAreaHeight}\n $alignItems=\"center\"\n >\n <Styled.DailyTimelineContainer>\n {allTimelineData.map((entry, index) => {\n const { daily_logs: dailyLogs, from_date: fromDate, to_date: toDate } = entry;\n\n if (dailyLogs) {\n const fromDateObj = parseISO(fromDate);\n const toDateObj = parseISO(toDate);\n\n const {\n day: fromDay,\n month: fromMonth,\n monthName: fromMonthName,\n } = getDayMonthYear(fromDateObj);\n\n const {\n day: toDay,\n month: toMonth,\n year: toYear,\n monthName: toMonthName,\n } = getDayMonthYear(toDateObj);\n\n const isLast = isLastDayOfMonth(toDateObj);\n const isLastYear = isLast && toMonth === 12 && toDay === 31;\n const shouldShowTag = !!(courseStreams && courseStreams.length > 1);\n\n return (\n <FlexView key={`timeline-entry-${index}`}>\n {isLastYear && (\n <Styled.YearWrapper $gutterX={1}>\n <Separator heightX={1} />\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n {toYear}\n </Text>\n </Styled.YearWrapper>\n )}\n {isLast && toMonth && (\n <Styled.MonthImageWrapper\n $heightX={15.36}\n $isLastYear={isLastYear}\n $img={\n monthImageMap[\n String(fromMonth).padStart(2, '0') as keyof typeof monthImageMap\n ]\n }\n />\n )}\n <Styled.DailyItems $gutterX={1} $addedmonthbreak={!!(isLast && toMonth)}>\n <Separator heightX={1} />\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n {fromDate === toDate\n ? `${fromDay} ${fromMonthName}`\n : `${fromDay} - ${toDay} ${toMonthName}`}\n </Text>\n <Separator heightX={1} />\n <Styled.DailyTimelineItemsContainer\n $borderBottomColor={dailyLogs.length > 0 ? 'BLACK' : 'BLACK_T_04'}\n >\n {dailyLogs.length > 0 ? (\n dailyLogs.map((log, logIndex) => (\n <DailyTimelineItems\n key={`timeline-${logIndex}`}\n type={log.type}\n summary={log.summary || ''}\n courseStream={log.course_stream || undefined}\n cards={log.cards}\n onPuzzleClick={onPuzzlesClick}\n onReviewClick={onReviewClick}\n userType={userType}\n shouldShowTag={shouldShowTag && log.course_stream !== 'CIRCLE'}\n />\n ))\n ) : (\n <Accordion\n icon={NoActivityIcon}\n title=\"No Activity\"\n defaultExpanded={false}\n $borderColor=\"BLACK_T_04\"\n $backgroundColor=\"BLACK_T_15\"\n />\n )}\n </Styled.DailyTimelineItemsContainer>\n <Separator heightX={1} />\n </Styled.DailyItems>\n </FlexView>\n );\n }\n })}\n\n {isLoadingMore && (\n <FlexView $alignItems=\"center\" $justifyContent=\"center\" $height=\"100%\">\n <Loader src={ILLUSTRATIONS.LOADER} alt=\"Loader\" $size=\"large\" />\n </FlexView>\n )}\n </Styled.DailyTimelineContainer>\n </Styled.ScrollWrapper>\n );\n },\n);\n\nexport default DailyTimeline;\n"],"names":["DailyTimeline","memo","userType","studentId","courseStreams","onPuzzlesClick","onReviewClick","scrollAreaHeight","timezone","useMemo","allTimelineData","setAllTimelineData","useState","isLoadingMore","setIsLoadingMore","scrollContainerRef","useRef","NoActivityIcon","getTimelineCardIcon","getTimeline","timelineData","isProcessingFailed","isProcessing","useDailyTimelineGet","userLogs","fetchTimeline","useCallback","page","append","useEffect","prev","container","handleScroll","jsx","Error","FlexView","AppLoader","Styled.ScrollWrapper","jsxs","Styled.DailyTimelineContainer","entry","index","dailyLogs","fromDate","toDate","fromDateObj","parseISO","toDateObj","fromDay","fromMonth","fromMonthName","getDayMonthYear","toDay","toMonth","toYear","toMonthName","isLast","isLastDayOfMonth","isLastYear","shouldShowTag","Styled.YearWrapper","Separator","Text","Styled.MonthImageWrapper","monthImageMap","Styled.DailyItems","Styled.DailyTimelineItemsContainer","log","logIndex","DailyTimelineItems","Accordion","Loader","ILLUSTRATIONS","DailyTimeline$1"],"mappings":";;;;;;;;;;;;;;;;AAiBA,MAAMA,KAAwCC;AAAA,EAC5C,CAAC,EAAE,UAAAC,GAAU,WAAAC,GAAW,eAAAC,GAAe,gBAAAC,GAAgB,eAAAC,GAAe,kBAAAC,QAAuB;AACrF,UAAAC,IAAWC,EAAQ,MAAM,KAAK,iBAAiB,gBAAgB,EAAE,UAAU,C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N,OAAM;AAAA,0BACN,iBAAiB;AAAA,0BACjB,cAAa;AAAA,0BACb,kBAAiB;AAAA,wBAAA;AAAA,sBACnB;AAAA,oBAAA;AAAA,kBAEJ;AAAA,kBACA,gBAAAgB,EAAC4B,GAAU,EAAA,SAAS,EAAG,CAAA;AAAA,gBAAA,GACzB;AAAA,cAxDa,EAAA,GAAA,kBAAkBpB,CAAK,EAyDtC;AAAA,YAEJ;AAAA,UAAA,CACD;AAAA,UAEA5B,KACE,gBAAAoB,EAAAE,GAAA,EAAS,aAAY,UAAS,iBAAgB,UAAS,SAAQ,QAC9D,UAAC,gBAAAF,EAAAsC,GAAA,EAAO,KAAKC,EAAc,QAAQ,KAAI,UAAS,OAAM,QAAQ,CAAA,GAChE;AAAA,QAAA,GAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF,GAEAC,KAAezE;"}
1
+ {"version":3,"file":"daily-timeline.js","sources":["../../../../src/features/timeline/daily-timeline/daily-timeline.tsx"],"sourcesContent":["import { isLastDayOfMonth, parseISO } from 'date-fns';\nimport { memo, useCallback, useEffect, useMemo, useRef, useState, type FC } from 'react';\n\nimport { ILLUSTRATIONS } from '../../../assets/illustrations/illustrations';\nimport { Loader } from '../../ui/buttons/button/button-styled';\nimport Error from '../../ui/error/error';\nimport FlexView from '../../ui/layout/flex-view';\nimport AppLoader from '../../ui/loader/app-loader/app-loader';\nimport Separator from '../../ui/separator/separator';\nimport Accordion from '../../ui/simple-accordian/accordion';\nimport Text from '../../ui/text/text';\nimport { type TimelineData, useDailyTimelineGet } from '../api/use-daily-timeline-get';\nimport { getDayMonthYear, getTimelineCardIcon } from '../comps/accordion-item/utils';\nimport DailyTimelineItems from './daily-timeline-items/daily-timeline-items';\nimport * as Styled from './daily-timeline-styled';\nimport { type DailyTimelineProps } from './daily-timeline-types';\nimport MonthBreak from '../comps/month-break';\nimport YearBreak from '../comps/year-break';\n\nconst DailyTimeline: FC<DailyTimelineProps> = memo(\n ({ userType, studentId, courseStreams, onPuzzlesClick, onReviewClick, scrollAreaHeight }) => {\n const timezone = useMemo(() => Intl.DateTimeFormat().resolvedOptions().timeZone, []);\n const [allTimelineData, setAllTimelineData] = useState<TimelineData[]>([]);\n const [isLoadingMore, setIsLoadingMore] = useState(false);\n const scrollContainerRef = useRef<HTMLDivElement>(null);\n const NoActivityIcon = useMemo(() => getTimelineCardIcon('NO_ACTIVITY'), []);\n const {\n get: getTimeline,\n data: timelineData,\n isProcessingFailed,\n isProcessing,\n } = useDailyTimelineGet(studentId);\n const { user_logs: userLogs } = timelineData ?? {};\n\n const fetchTimeline = useCallback(\n (page = 1, append = false) => {\n if (append) {\n setIsLoadingMore(true);\n }\n\n getTimeline(studentId, {\n page,\n size: 10,\n timezone,\n course_stream: userType === 'TEACHER' ? courseStreams : [],\n });\n },\n [getTimeline, studentId, timezone, userType, courseStreams],\n );\n\n useEffect(() => {\n if (timelineData) {\n if (timelineData.curr_page === 1) {\n setAllTimelineData(userLogs ?? []);\n } else {\n setAllTimelineData(prev => [...prev, ...(userLogs ?? [])]);\n setIsLoadingMore(false);\n }\n }\n }, [timelineData, userLogs]);\n\n useEffect(() => {\n fetchTimeline(1, false);\n }, [fetchTimeline]);\n\n useEffect(() => {\n const container = scrollContainerRef.current;\n\n if (!container) return;\n\n const handleScroll = () => {\n if (\n timelineData?.next_page &&\n !isLoadingMore &&\n container.scrollTop + container.clientHeight >= container.scrollHeight - 100\n ) {\n fetchTimeline(timelineData.next_page, true);\n }\n };\n\n container.addEventListener('scroll', handleScroll);\n\n return () => {\n container.removeEventListener('scroll', handleScroll);\n };\n }, [timelineData, isLoadingMore, fetchTimeline]);\n\n if (isProcessingFailed) {\n return <Error height=\"70vh\" onTryAgain={() => fetchTimeline(1, false)} />;\n }\n\n if (isProcessing && !allTimelineData.length) {\n return (\n <FlexView $alignItems=\"center\" $justifyContent=\"center\" $height=\"100%\">\n <AppLoader width=\"100%\" height=\"100%\" />\n </FlexView>\n );\n }\n\n return (\n <Styled.ScrollWrapper\n ref={scrollContainerRef}\n $height={scrollAreaHeight}\n $alignItems=\"center\"\n >\n <Styled.DailyTimelineContainer>\n {allTimelineData.map((entry, index) => {\n const { daily_logs: dailyLogs, from_date: fromDate, to_date: toDate } = entry;\n\n if (dailyLogs) {\n const fromDateObj = parseISO(fromDate);\n const toDateObj = parseISO(toDate);\n\n const {\n day: fromDay,\n month: fromMonth,\n monthName: fromMonthName,\n } = getDayMonthYear(fromDateObj);\n\n const {\n day: toDay,\n month: toMonth,\n year: toYear,\n monthName: toMonthName,\n } = getDayMonthYear(toDateObj);\n\n const isLastDayOfMth = isLastDayOfMonth(toDateObj);\n const isLastDayOfYear = isLastDayOfMth && toMonth === 12 && toDay === 31;\n const shouldShowTag = !!(courseStreams && courseStreams.length > 1);\n\n return (\n <FlexView key={`timeline-entry-${index}`}>\n <YearBreak toYear={toYear} isLastDayOfYear={isLastDayOfYear} />\n <MonthBreak fromMonth={fromMonth} isLastDayOfMth={isLastDayOfMth} />\n <Styled.DailyItems $gutterX={1} $addedmonthbreak={!!(isLastDayOfMth && toMonth)}>\n <Separator heightX={1} />\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n {fromDate === toDate\n ? `${fromDay} ${fromMonthName}`\n : `${fromDay} - ${toDay} ${toMonthName}`}\n </Text>\n <Separator heightX={1} />\n <Styled.DailyTimelineItemsContainer\n $borderBottomColor={dailyLogs.length > 0 ? 'BLACK' : 'BLACK_T_04'}\n >\n {dailyLogs.length > 0 ? (\n dailyLogs.map((log, logIndex) => (\n <DailyTimelineItems\n key={`timeline-${logIndex}`}\n type={log.type}\n summary={log.summary ?? ''}\n courseStream={log.course_stream ?? undefined}\n cards={log.cards}\n onPuzzleClick={onPuzzlesClick}\n onReviewClick={onReviewClick}\n userType={userType}\n shouldShowTag={shouldShowTag && log.course_stream !== 'CIRCLE'}\n />\n ))\n ) : (\n <Accordion\n icon={NoActivityIcon ?? ''}\n title=\"No Activity\"\n defaultExpanded={false}\n $borderColor=\"BLACK_T_04\"\n $backgroundColor=\"BLACK_T_15\"\n />\n )}\n </Styled.DailyTimelineItemsContainer>\n <Separator heightX={1} />\n </Styled.DailyItems>\n </FlexView>\n );\n }\n })}\n\n {isLoadingMore && (\n <FlexView $alignItems=\"center\" $justifyContent=\"center\" $height=\"100%\">\n <Loader src={ILLUSTRATIONS.LOADER} alt=\"Loader\" $size=\"large\" />\n </FlexView>\n )}\n </Styled.DailyTimelineContainer>\n </Styled.ScrollWrapper>\n );\n },\n);\n\nexport default DailyTimeline;\n"],"names":["DailyTimeline","memo","userType","studentId","courseStreams","onPuzzlesClick","onReviewClick","scrollAreaHeight","timezone","useMemo","allTimelineData","setAllTimelineData","useState","isLoadingMore","setIsLoadingMore","scrollContainerRef","useRef","NoActivityIcon","getTimelineCardIcon","getTimeline","timelineData","isProcessingFailed","isProcessing","useDailyTimelineGet","userLogs","fetchTimeline","useCallback","page","append","useEffect","prev","container","handleScroll","jsx","Error","FlexView","AppLoader","Styled.ScrollWrapper","jsxs","Styled.DailyTimelineContainer","entry","index","dailyLogs","fromDate","toDate","fromDateObj","parseISO","toDateObj","fromDay","fromMonth","fromMonthName","getDayMonthYear","toDay","toMonth","toYear","toMonthName","isLastDayOfMth","isLastDayOfMonth","isLastDayOfYear","shouldShowTag","YearBreak","MonthBreak","Styled.DailyItems","Separator","Text","Styled.DailyTimelineItemsContainer","log","logIndex","DailyTimelineItems","Accordion","Loader","ILLUSTRATIONS","DailyTimeline$1"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAMA,KAAwCC;AAAA,EAC5C,CAAC,EAAE,UAAAC,GAAU,WAAAC,GAAW,eAAAC,GAAe,gBAAAC,GAAgB,eAAAC,GAAe,kBAAAC,QAAuB;AACrF,UAAAC,IAAWC,EAAQ,MAAM,KAAK,iBAAiB,gBAAgB,EAAE,UAAU,CAAA,CAAE,GAC7E,CAACC,GAAiBC,CAAkB,IAAIC,EAAyB,CAAE,CAAA,GACnE,CAACC,GAAeC,CAAgB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EAAS,aAAY,UAAS,iBAAgB,UAAS,SAAQ,QAC9D,UAAC,gBAAAF,EAAAqC,GAAA,EAAO,KAAKC,EAAc,QAAQ,KAAI,UAAS,OAAM,QAAQ,CAAA,GAChE;AAAA,QAAA,GAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF,GAEAC,KAAexE;"}
package/dist/index.d.ts CHANGED
@@ -468,11 +468,11 @@ export declare const CustomInputField: NamedExoticComponent<ICustomInputFieldPro
468
468
  export declare const DailyTimeline: FC<DailyTimelineProps>;
469
469
 
470
470
  declare interface DailyTimelineProps {
471
- userType: TUserTypes;
471
+ userType: TUserTypes_2;
472
472
  studentId: string;
473
473
  courseStreams?: TCourseStream[];
474
474
  onPuzzlesClick: (userNodeId: string) => void;
475
- onReviewClick: (userNodeId: string) => void;
475
+ onReviewClick?: (userNodeId: string | null, isSatMockTestBlock: boolean, userBlockId: string | null) => void;
476
476
  scrollAreaHeight: string | number | undefined;
477
477
  }
478
478
 
@@ -6912,6 +6912,8 @@ declare type TUserProgram = {
6912
6912
 
6913
6913
  export declare type TUserTypes = 'TEACHER' | 'STUDENT';
6914
6914
 
6915
+ declare type TUserTypes_2 = 'TEACHER' | 'STUDENT' | 'PARENT';
6916
+
6915
6917
  export declare const TutorChangeModal: MemoExoticComponent<() => JSX.Element>;
6916
6918
 
6917
6919
  export declare const Tutorial: ({ src, title, onCross, showProgress, onTutorialPlayedOnce, isJourneyActive, }: ITutorialProps) => JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuemath/leap",
3
- "version": "3.5.4-as5",
3
+ "version": "3.5.4-as7",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"