@cuemath/leap 2.8.61-as2 → 2.8.61-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.
@@ -1,14 +1,14 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { h as
|
3
|
-
import { useRef as
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import { getTopicsFromItems as
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import
|
10
|
-
import { useGetHomeworks as
|
11
|
-
const
|
1
|
+
import { jsxs as w, jsx as t, Fragment as M } from "react/jsx-runtime";
|
2
|
+
import { h as C } from "../../../node_modules/humanize-plus/dist/humanize.js";
|
3
|
+
import { useRef as S, useState as _, useCallback as r, useEffect as R } from "react";
|
4
|
+
import g from "styled-components";
|
5
|
+
import D from "../../../assets/line-icons/icons/chevron-right.js";
|
6
|
+
import { getTopicsFromItems as E } from "../../milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-utils.js";
|
7
|
+
import d from "../../ui/layout/flex-view.js";
|
8
|
+
import F from "../../ui/separator/separator.js";
|
9
|
+
import L from "../homework-card.js";
|
10
|
+
import { useGetHomeworks as j } from "./api/get-homeworks.js";
|
11
|
+
const q = g.div`
|
12
12
|
display: flex;
|
13
13
|
overflow-x: auto;
|
14
14
|
white-space: nowrap;
|
@@ -28,7 +28,7 @@ const B = f.div`
|
|
28
28
|
&::-webkit-scrollbar-thumb:hover {
|
29
29
|
background: #555;
|
30
30
|
}
|
31
|
-
`,
|
31
|
+
`, B = g(d)`
|
32
32
|
right: 0;
|
33
33
|
top: 0;
|
34
34
|
height: 100%;
|
@@ -41,50 +41,54 @@ const B = f.div`
|
|
41
41
|
path {
|
42
42
|
fill: ${({ theme: e }) => e.colors.WHITE};
|
43
43
|
}
|
44
|
-
`,
|
44
|
+
`, U = ({
|
45
45
|
userType: e = "STUDENT",
|
46
|
-
studentId:
|
46
|
+
studentId: c,
|
47
47
|
stream: l,
|
48
|
-
...
|
48
|
+
...o
|
49
49
|
}) => {
|
50
|
-
const
|
51
|
-
requestAnimationFrame(() =>
|
52
|
-
}, []),
|
53
|
-
requestAnimationFrame(() =>
|
54
|
-
}, []),
|
55
|
-
|
56
|
-
}, []), { get:
|
57
|
-
|
58
|
-
}, [
|
59
|
-
return
|
60
|
-
|
61
|
-
}, [
|
62
|
-
/* @__PURE__ */
|
50
|
+
const i = S(null), [$, m] = _(!1), v = r(() => {
|
51
|
+
requestAnimationFrame(() => m(!0));
|
52
|
+
}, []), b = r(() => {
|
53
|
+
requestAnimationFrame(() => m(!1));
|
54
|
+
}, []), x = r(() => {
|
55
|
+
i.current && i.current.scrollBy({ left: 200, behavior: "smooth" });
|
56
|
+
}, []), { get: p, data: n, isProcessingFailed: N } = j(), u = r(() => {
|
57
|
+
p(c, void 0, { stream: l });
|
58
|
+
}, [p, l, c]);
|
59
|
+
return R(() => {
|
60
|
+
u();
|
61
|
+
}, [u]), N ? null : /* @__PURE__ */ w(d, { $position: "relative", onMouseEnter: v, onMouseLeave: b, children: [
|
62
|
+
/* @__PURE__ */ t(q, { ref: i, children: /* @__PURE__ */ t(d, { $flexDirection: "row", $flexRowGapX: 1, children: n == null ? void 0 : n.map((h) => {
|
63
63
|
const {
|
64
|
-
items:
|
65
|
-
node_id:
|
66
|
-
sheet_time:
|
64
|
+
items: A,
|
65
|
+
node_id: T,
|
66
|
+
sheet_time: f,
|
67
67
|
total_questions: s,
|
68
|
-
worksheet_id:
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
68
|
+
worksheet_id: k,
|
69
|
+
node_type: a
|
70
|
+
} = h, y = f && Math.ceil(f / 60) || 0, H = E(A).join(", "), I = `${typeof s == "number" ? `${s} ${C.pluralize(s, "Question")}, ` : ""}${y} Mins`;
|
71
|
+
return /* @__PURE__ */ w(M, { children: [
|
72
|
+
/* @__PURE__ */ t(
|
73
|
+
L,
|
73
74
|
{
|
74
75
|
userType: e,
|
75
|
-
header:
|
76
|
-
subHeader:
|
77
|
-
nodeData:
|
76
|
+
header: H,
|
77
|
+
subHeader: I,
|
78
|
+
nodeData: h,
|
78
79
|
renderAs: "homework",
|
79
|
-
|
80
|
+
onNodeAttempt: a === "DYNAMIC" ? o.onTestStart : o.onNodeAttempt,
|
81
|
+
onNodeView: a === "DYNAMIC" ? o.onTestPreview : o.onNodeAttempt,
|
82
|
+
onNodeReview: a === "DYNAMIC" ? o.onTestReview : o.onNodeAttempt,
|
83
|
+
onNodeUnassign: o.onNodeUnassign
|
80
84
|
},
|
81
|
-
`${
|
85
|
+
`${k}_${T}`
|
82
86
|
),
|
83
|
-
/* @__PURE__ */
|
87
|
+
/* @__PURE__ */ t(F, { width: 16 })
|
84
88
|
] });
|
85
89
|
}) }) }),
|
86
|
-
/* @__PURE__ */
|
87
|
-
|
90
|
+
/* @__PURE__ */ t(
|
91
|
+
B,
|
88
92
|
{
|
89
93
|
$position: "absolute",
|
90
94
|
$width: "100%",
|
@@ -92,14 +96,14 @@ const B = f.div`
|
|
92
96
|
$background: "BLACK_T_60",
|
93
97
|
$justifyContent: "center",
|
94
98
|
$alignItems: "center",
|
95
|
-
onClick:
|
96
|
-
$visible:
|
97
|
-
children: /* @__PURE__ */
|
99
|
+
onClick: x,
|
100
|
+
$visible: $,
|
101
|
+
children: /* @__PURE__ */ t(D, { width: 24, height: 24 })
|
98
102
|
}
|
99
103
|
)
|
100
104
|
] });
|
101
|
-
},
|
105
|
+
}, Z = U;
|
102
106
|
export {
|
103
|
-
|
107
|
+
Z as default
|
104
108
|
};
|
105
109
|
//# sourceMappingURL=hw-card-list.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"hw-card-list.js","sources":["../../../../src/features/homework/hw-card-list/hw-card-list.tsx"],"sourcesContent":["import type { TUserTypes } from '../../ui/types';\n\nimport { pluralize } from 'humanize-plus';\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport styled from 'styled-components';\n\nimport ChevronRightIcon from '../../../assets/line-icons/icons/chevron-right';\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 Separator from '../../ui/separator/separator';\nimport HomeworkCard from '../homework-card';\nimport { useGetHomeworks } from './api/get-homeworks';\n\ninterface HWCardListProps {\n userType: TUserTypes;\n studentId: string;\n stream: string;\n}\n\nconst ScrollContainer = styled.div`\n display: flex;\n overflow-x: auto;\n white-space: nowrap;\n -webkit-overflow-scrolling: touch;\n scrollbar-width: thin;\n padding: 16px 0;\n\n &::-webkit-scrollbar {\n height: 6px;\n }\n\n &::-webkit-scrollbar-thumb {\n background: #888;\n border-radius: 4px;\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background: #555;\n }\n`;\n\nconst ScrollButton = styled(FlexView)<{ $visible: boolean }>`\n right: 0;\n top: 0;\n height: 100%;\n width: 32px;\n cursor: pointer;\n transition: opacity 0.3s ease-in-out;\n opacity: ${({ $visible }) => ($visible ? 1 : 0)};\n pointer-events: ${({ $visible }) => ($visible ? 'auto' : 'none')};\n\n path {\n fill: ${({ theme }) => theme.colors.WHITE};\n }\n`;\n\nconst HWCardList: React.FC<HWCardListProps> = ({\n userType = 'STUDENT',\n studentId,\n stream,\n ...sheetCallbacks\n}) => {\n const scrollRef = useRef<HTMLDivElement>(null);\n const [isHovered, setIsHovered] = useState(false);\n\n const handleMouseEnter = useCallback(() => {\n requestAnimationFrame(() => setIsHovered(true));\n }, []);\n\n const handleMouseLeave = useCallback(() => {\n requestAnimationFrame(() => setIsHovered(false));\n }, []);\n\n const handleScrollRight = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: 200, behavior: 'smooth' });\n }\n }, []);\n\n const { get: getHomeworks, data: hwDetails, isProcessingFailed } = useGetHomeworks();\n\n const fetchChapterDetails = useCallback(() => {\n getHomeworks(studentId, undefined, { stream });\n }, [getHomeworks, stream, studentId]);\n\n useEffect(() => {\n fetchChapterDetails();\n }, [fetchChapterDetails]);\n\n if (isProcessingFailed) {\n return null;\n }\n\n return (\n <FlexView $position=\"relative\" onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave}>\n <ScrollContainer ref={scrollRef}>\n <FlexView $flexDirection=\"row\" $flexRowGapX={1}>\n {hwDetails?.map(sheet => {\n const {\n items,\n node_id: nodeId,\n sheet_time: sheetTime,\n total_questions: totalQuestions,\n worksheet_id: worksheetId,\n } = sheet;\n const totalSheetTime = (sheetTime && Math.ceil(sheetTime / 60)) || 0;\n const topics = getTopicsFromItems(items);\n const testChapterName = topics.join(', ');\n const subHeader = `${\n typeof totalQuestions === 'number'\n ? `${totalQuestions} ${pluralize(totalQuestions, 'Question')}, `\n : ''\n }${totalSheetTime} Mins`;\n\n return (\n <>\n <HomeworkCard\n key={`${worksheetId}_${nodeId}`}\n userType={userType}\n header={testChapterName}\n subHeader={subHeader}\n nodeData={sheet}\n renderAs=\"homework\"\n {
|
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 { pluralize } from 'humanize-plus';\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport styled from 'styled-components';\n\nimport ChevronRightIcon from '../../../assets/line-icons/icons/chevron-right';\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 Separator from '../../ui/separator/separator';\nimport HomeworkCard from '../homework-card';\nimport { useGetHomeworks } from './api/get-homeworks';\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}\n\nconst ScrollContainer = styled.div`\n display: flex;\n overflow-x: auto;\n white-space: nowrap;\n -webkit-overflow-scrolling: touch;\n scrollbar-width: thin;\n padding: 16px 0;\n\n &::-webkit-scrollbar {\n height: 6px;\n }\n\n &::-webkit-scrollbar-thumb {\n background: #888;\n border-radius: 4px;\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background: #555;\n }\n`;\n\nconst ScrollButton = styled(FlexView)<{ $visible: boolean }>`\n right: 0;\n top: 0;\n height: 100%;\n width: 32px;\n cursor: pointer;\n transition: opacity 0.3s ease-in-out;\n opacity: ${({ $visible }) => ($visible ? 1 : 0)};\n pointer-events: ${({ $visible }) => ($visible ? 'auto' : 'none')};\n\n path {\n fill: ${({ theme }) => theme.colors.WHITE};\n }\n`;\n\nconst HWCardList: React.FC<HWCardListProps> = ({\n userType = 'STUDENT',\n studentId,\n stream,\n ...sheetCallbacks\n}) => {\n const scrollRef = useRef<HTMLDivElement>(null);\n const [isHovered, setIsHovered] = useState(false);\n\n const handleMouseEnter = useCallback(() => {\n requestAnimationFrame(() => setIsHovered(true));\n }, []);\n\n const handleMouseLeave = useCallback(() => {\n requestAnimationFrame(() => setIsHovered(false));\n }, []);\n\n const handleScrollRight = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: 200, behavior: 'smooth' });\n }\n }, []);\n\n const { get: getHomeworks, data: hwDetails, isProcessingFailed } = useGetHomeworks();\n\n const fetchChapterDetails = useCallback(() => {\n getHomeworks(studentId, undefined, { stream });\n }, [getHomeworks, stream, studentId]);\n\n useEffect(() => {\n fetchChapterDetails();\n }, [fetchChapterDetails]);\n\n if (isProcessingFailed) {\n return null;\n }\n\n return (\n <FlexView $position=\"relative\" onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave}>\n <ScrollContainer ref={scrollRef}>\n <FlexView $flexDirection=\"row\" $flexRowGapX={1}>\n {hwDetails?.map(sheet => {\n const {\n items,\n node_id: nodeId,\n sheet_time: sheetTime,\n total_questions: totalQuestions,\n worksheet_id: worksheetId,\n node_type: nodeType,\n } = sheet;\n const totalSheetTime = (sheetTime && Math.ceil(sheetTime / 60)) || 0;\n const topics = getTopicsFromItems(items);\n const testChapterName = topics.join(', ');\n const subHeader = `${\n typeof totalQuestions === 'number'\n ? `${totalQuestions} ${pluralize(totalQuestions, 'Question')}, `\n : ''\n }${totalSheetTime} Mins`;\n\n return (\n <>\n <HomeworkCard\n key={`${worksheetId}_${nodeId}`}\n userType={userType}\n header={testChapterName}\n subHeader={subHeader}\n nodeData={sheet}\n renderAs=\"homework\"\n onNodeAttempt={\n nodeType === 'DYNAMIC'\n ? sheetCallbacks.onTestStart\n : sheetCallbacks.onNodeAttempt\n }\n onNodeView={\n nodeType === 'DYNAMIC'\n ? sheetCallbacks.onTestPreview\n : sheetCallbacks.onNodeAttempt\n }\n onNodeReview={\n nodeType === 'DYNAMIC'\n ? sheetCallbacks.onTestReview\n : sheetCallbacks.onNodeAttempt\n }\n onNodeUnassign={sheetCallbacks.onNodeUnassign}\n />\n <Separator width={16} />\n </>\n );\n })}\n </FlexView>\n </ScrollContainer>\n\n <ScrollButton\n $position=\"absolute\"\n $width=\"100%\"\n $height={1}\n $background=\"BLACK_T_60\"\n $justifyContent=\"center\"\n $alignItems=\"center\"\n onClick={handleScrollRight}\n $visible={isHovered}\n >\n <ChevronRightIcon width={24} height={24} />\n </ScrollButton>\n </FlexView>\n );\n};\n\nexport default HWCardList;\n"],"names":["ScrollContainer","styled","ScrollButton","FlexView","$visible","theme","HWCardList","userType","studentId","stream","sheetCallbacks","scrollRef","useRef","isHovered","setIsHovered","useState","handleMouseEnter","useCallback","handleMouseLeave","handleScrollRight","getHomeworks","hwDetails","isProcessingFailed","useGetHomeworks","fetchChapterDetails","useEffect","jsx","sheet","items","nodeId","sheetTime","totalQuestions","worksheetId","nodeType","totalSheetTime","testChapterName","getTopicsFromItems","subHeader","pluralize","jsxs","Fragment","HomeworkCard","Separator","ChevronRightIcon","HWCardList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V,QAAO;AAAA,QACP,SAAS;AAAA,QACT,aAAY;AAAA,QACZ,iBAAgB;AAAA,QAChB,aAAY;AAAA,QACZ,SAASiB;AAAA,QACT,UAAUN;AAAA,QAEV,UAAC,gBAAAa,EAAAiB,GAAA,EAAiB,OAAO,IAAI,QAAQ,IAAI;AAAA,MAAA;AAAA,IAC3C;AAAA,EACF,EAAA,CAAA;AAEJ,GAEAC,IAAetC;"}
|
package/dist/index.d.ts
CHANGED
@@ -496,10 +496,13 @@ export declare const HomeworkCardList: React_2.FC<HWCardListProps>;
|
|
496
496
|
|
497
497
|
declare const hues: readonly ["YELLOW", "ORANGE", "PURPLE", "GREEN", "BLUE"];
|
498
498
|
|
499
|
-
declare interface HWCardListProps {
|
499
|
+
declare interface HWCardListProps extends INodeCardCallbacks {
|
500
500
|
userType: TUserTypes;
|
501
501
|
studentId: string;
|
502
502
|
stream: string;
|
503
|
+
onTestPreview?: (sheetData: INodeDataProps, milestoneId?: string) => void;
|
504
|
+
onTestStart?: (sheetData: INodeDataProps) => void;
|
505
|
+
onTestReview?: (sheetData: INodeDataProps, milestoneId?: string) => void;
|
503
506
|
}
|
504
507
|
|
505
508
|
declare interface IAccordionSectionProps {
|