@cuemath/leap 3.0.10 → 3.0.11-akm-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/features/chapters/chapters-list/chapter-item/chapter-item-styled.js +36 -27
- package/dist/features/chapters/chapters-list/chapter-item/chapter-item-styled.js.map +1 -1
- package/dist/features/chapters/chapters-list/chapter-item/chapter-item.js +43 -31
- package/dist/features/chapters/chapters-list/chapter-item/chapter-item.js.map +1 -1
- package/dist/features/chapters/chapters-list/chapters-list.js +16 -15
- package/dist/features/chapters/chapters-list/chapters-list.js.map +1 -1
- package/dist/features/chapters-v2/chapter-details/block-sections/block-section-view.js +2 -2
- package/dist/features/chapters-v2/chapter-details/block-sections/block-section-view.js.map +1 -1
- package/dist/features/chapters-v2/chapter-details/block-sections/block-sections.js +30 -30
- package/dist/features/chapters-v2/chapter-details/block-sections/block-sections.js.map +1 -1
- package/dist/features/chapters-v2/chapter-details/chapter-details.js +35 -35
- package/dist/features/chapters-v2/chapter-details/chapter-details.js.map +1 -1
- package/dist/features/chapters-v2/comps/node-card/teacher-actions/teacher-actions.js +44 -44
- package/dist/features/chapters-v2/comps/node-card/teacher-actions/teacher-actions.js.map +1 -1
- package/dist/features/circle-games/hooks/use-circle-sounds/use-circle-sounds.js +74 -74
- package/dist/features/circle-games/hooks/use-circle-sounds/use-circle-sounds.js.map +1 -1
- package/dist/features/homework/homework-card.js +146 -131
- package/dist/features/homework/homework-card.js.map +1 -1
- package/dist/features/journey/hooks/use-chapter-journey.js +28 -28
- package/dist/features/journey/hooks/use-chapter-journey.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-list.js +40 -38
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-list.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-tabs/milestone-tabs.js +53 -50
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-tabs/milestone-tabs.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget.js +64 -62
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list-container.js +44 -42
- package/dist/features/milestone/milestone-list-container/milestone-list-container.js.map +1 -1
- package/dist/features/milestone/milestone-resources/resources-list/resources-list.js +39 -37
- package/dist/features/milestone/milestone-resources/resources-list/resources-list.js.map +1 -1
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-container.js +38 -31
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-container.js.map +1 -1
- package/dist/features/post-game-stats/accuracy/accuracy.js +40 -39
- package/dist/features/post-game-stats/accuracy/accuracy.js.map +1 -1
- package/dist/features/post-game-stats/clock/clock.js +45 -45
- package/dist/features/post-game-stats/clock/clock.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"homework-card.js","sources":["../../../src/features/homework/homework-card.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 { memo, useCallback, useMemo, useRef } from 'react';\n\nimport Eye2Icon from '../../assets/line-icons/icons/eye2';\nimport MoreVerticalIcon from '../../assets/line-icons/icons/more-vertical';\nimport RedoIcon from '../../assets/line-icons/icons/redo';\nimport ArrowTooltip from '../ui/arrow-tooltip/arrow-tooltip';\nimport Clickable from '../ui/buttons/clickable/clickable';\nimport useContextMenuClickHandler from '../ui/hooks/use-context-menu-click-handler';\nimport FlexView from '../ui/layout/flex-view';\nimport CardMenuOptions from './card-menu-options';\nimport HomeworkView from './homework-card-view';\nimport * as Styled from './styles';\nimport { getCardAnalyticProps } from './utils';\n\ninterface IHomeworkCardProps extends INodeCardCallbacks {\n header: string;\n nodeData: INodeDataProps;\n subHeader: string;\n userType: TUserTypes;\n studentId: string;\n userMilestoneId?: string;\n renderAs: 'homework' | 'milestone';\n shouldOpenOnRight: boolean;\n isInQueue?: boolean;\n}\n\nconst HomeworkCard = ({\n // callbacks\n nodeData,\n onNodeAttempt,\n onNodeReattempt,\n onNodeReview,\n onNodeUnassign,\n onNodeView,\n\n header,\n isInQueue,\n renderAs,\n shouldOpenOnRight,\n studentId,\n subHeader,\n userMilestoneId,\n userType,\n}: IHomeworkCardProps) => {\n const isHomeWork = renderAs === 'homework';\n const {\n node_type: nodeType,\n state,\n permissions,\n user_node_id: userNodeId,\n user_milestone_id: milestoneId,\n homework_id: homeworkId,\n } = nodeData;\n\n const teacherContainerRef = useRef<HTMLDivElement>(null);\n const studentContainerRef = useRef<HTMLDivElement>(null);\n const { menuVisible: teacherMenuVisible, onMenuClick: onTeacherMenuClick } =\n useContextMenuClickHandler(teacherContainerRef);\n const { menuVisible: studentMenuVisible, onMenuClick: onStudentMenuClick } =\n useContextMenuClickHandler(studentContainerRef);\n\n const {\n can_start: canStart,\n can_resume: canResume,\n can_review: canReview,\n can_unassign: canUnassign,\n can_reset: canReset,\n } = permissions;\n const isStudent = userType === 'STUDENT';\n\n const onStudentViewSheet = useCallback(() => {\n if (canReview) {\n if (typeof onNodeReview !== 'function') {\n throw new Error('onReview must be a function');\n }\n\n if (!userNodeId) {\n throw new Error('user node id must be present to review the sheet');\n }\n onNodeReview(nodeData, userMilestoneId);\n\n return;\n }\n }, [canReview, onNodeReview, userNodeId, nodeData, userMilestoneId]);\n\n const onStudentCardClick = useCallback(() => {\n if (canStart || canResume) {\n if (typeof onNodeAttempt !== 'function') {\n throw new Error('onNodeAttempt must be a function');\n }\n\n onNodeAttempt(nodeData, homeworkId);\n\n return;\n }\n\n if (!isHomeWork) {\n onStudentMenuClick();\n\n return;\n }\n onStudentViewSheet();\n }, [\n canStart,\n canResume,\n isHomeWork,\n onStudentViewSheet,\n onNodeAttempt,\n nodeData,\n homeworkId,\n onStudentMenuClick,\n ]);\n\n const onTeacherCardClick = useCallback(() => {\n if (canReview) {\n if (typeof onNodeReview !== 'function') {\n throw new Error('onNodeReview must be a function');\n }\n\n if (!userNodeId) {\n throw new Error('user node id must be present to review the sheet');\n }\n onNodeReview(nodeData, userMilestoneId || milestoneId, homeworkId);\n\n return;\n }\n\n if (typeof onNodeView !== 'function') {\n throw new Error('onNodeView must be a function');\n }\n\n onNodeView(nodeData, userMilestoneId || milestoneId);\n }, [\n canReview,\n onNodeView,\n nodeData,\n userMilestoneId,\n milestoneId,\n onNodeReview,\n userNodeId,\n homeworkId,\n ]);\n\n const handleOnMenuOptionClick = useCallback(\n (optionId: string) => {\n switch (optionId) {\n case 'teacher-card-view':\n onTeacherCardClick();\n\n return;\n case 'student-card-view':\n onStudentViewSheet();\n\n return;\n case 'teacher-card-unassign':\n onNodeUnassign?.(nodeData, userMilestoneId);\n\n return;\n case 'student-card-reattempt':\n case 'teacher-card-redo':\n onNodeReattempt?.(nodeData, userMilestoneId);\n\n return;\n\n default:\n throw new Error(`No callback function for ${optionId}`);\n }\n },\n [\n nodeData,\n onNodeReattempt,\n onNodeUnassign,\n onStudentViewSheet,\n onTeacherCardClick,\n userMilestoneId,\n ],\n );\n\n const teacherOptions = [\n {\n id: 'teacher-card-view',\n label: canReview ? 'Review' : 'View',\n icon: Eye2Icon,\n disabled: false,\n onClick: handleOnMenuOptionClick,\n },\n {\n id: 'teacher-card-unassign',\n label: 'Unassign',\n icon: Styled.StyledMinus2Icon,\n disabled: isHomeWork ? nodeType === 'MASTERY' : !canUnassign,\n onClick: handleOnMenuOptionClick,\n },\n {\n id: 'teacher-card-redo',\n label: 'Redo',\n icon: RedoIcon,\n disabled: !canReset,\n onClick: handleOnMenuOptionClick,\n },\n ];\n\n const studentOptions = [\n {\n id: 'student-card-view',\n label: 'Review',\n icon: Eye2Icon,\n disabled: !canReview,\n onClick: handleOnMenuOptionClick,\n },\n {\n id: 'student-card-reattempt',\n label: 'Reattempt',\n icon: RedoIcon,\n disabled: !canReset,\n onClick: handleOnMenuOptionClick,\n },\n ];\n\n const analyticsLabel = useMemo(\n () =>\n getCardAnalyticProps({\n canResume,\n canStart,\n homeworkId,\n isHomeWork,\n isStudent,\n milestoneId,\n nodeType,\n studentId,\n userNodeId,\n }),\n [\n isStudent,\n isHomeWork,\n studentId,\n nodeType,\n canStart,\n canResume,\n homeworkId,\n userNodeId,\n milestoneId,\n ],\n );\n\n return (\n <Styled.CardContainer $position=\"relative\" $width=\"fit-content\">\n <Clickable\n onClick={isStudent ? onStudentCardClick : onTeacherCardClick}\n label=\"homework-card\"\n analyticsLabel={analyticsLabel.analyticsLabel}\n analyticsProps={analyticsLabel.analyticsProps}\n >\n <HomeworkView\n header={header}\n isInQueue={isInQueue}\n nodeData={nodeData}\n studentContainerRef={studentContainerRef}\n subHeader={subHeader}\n userType={userType}\n />\n </Clickable>\n {isStudent && !isHomeWork && (\n <CardMenuOptions\n $width={200}\n options={studentOptions}\n triggerRef={studentContainerRef}\n visible={studentMenuVisible}\n shouldOpenOnRight={false}\n />\n )}\n {!isStudent && (\n <Styled.MenuWrapper $position=\"absolute\" $width=\"fit-content\" $borderRadiusX={2}>\n <ArrowTooltip\n renderAs=\"primary\"\n tooltipItem=\"Review\"\n position=\"bottom\"\n zIndex={6}\n parentWidth=\"100%\"\n hidden={teacherMenuVisible || (state !== 'WAIT_FOR_REVIEW' && isHomeWork)}\n >\n <Styled.CardKebabMenuWrapper\n $alignItems=\"center\"\n $justifyContent=\"center\"\n ref={teacherContainerRef}\n onClick={onTeacherMenuClick}\n >\n <MoreVerticalIcon width={16} height={16} />\n </Styled.CardKebabMenuWrapper>\n </ArrowTooltip>\n <CardMenuOptions\n options={teacherOptions}\n triggerRef={teacherContainerRef}\n visible={teacherMenuVisible}\n shouldOpenOnRight={shouldOpenOnRight}\n />\n </Styled.MenuWrapper>\n )}\n {isInQueue && (\n <Styled.BlurContainer $background=\"WHITE_5\">\n <Styled.BlurFlexView $heightX={1} $widthX={6}>\n <ArrowTooltip renderAs=\"primary\" tooltipItem=\"Not visible to student\" position=\"bottom\">\n <FlexView $heightX={1} $widthX={6} />\n </ArrowTooltip>\n </Styled.BlurFlexView>\n </Styled.BlurContainer>\n )}\n </Styled.CardContainer>\n );\n};\n\nexport default memo(HomeworkCard);\n"],"names":["HomeworkCard","nodeData","onNodeAttempt","onNodeReattempt","onNodeReview","onNodeUnassign","onNodeView","header","isInQueue","renderAs","shouldOpenOnRight","studentId","subHeader","userMilestoneId","userType","isHomeWork","nodeType","state","permissions","userNodeId","milestoneId","homeworkId","teacherContainerRef","useRef","studentContainerRef","teacherMenuVisible","onTeacherMenuClick","useContextMenuClickHandler","studentMenuVisible","onStudentMenuClick","canStart","canResume","canReview","canUnassign","canReset","isStudent","onStudentViewSheet","useCallback","onStudentCardClick","onTeacherCardClick","handleOnMenuOptionClick","optionId","teacherOptions","Eye2Icon","Styled.StyledMinus2Icon","RedoIcon","studentOptions","analyticsLabel","useMemo","getCardAnalyticProps","Styled.CardContainer","jsx","Clickable","HomeworkView","CardMenuOptions","jsxs","Styled.MenuWrapper","ArrowTooltip","Styled.CardKebabMenuWrapper","MoreVerticalIcon","Styled.BlurContainer","Styled.BlurFlexView","FlexView","HomeworkCard$1","memo"],"mappings":";;;;;;;;;;;;;AAgCA,MAAMA,KAAe,CAAC;AAAA;AAAA,EAEpB,UAAAC;AAAA,EACA,eAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,YAAAC;AAAA,EAEA,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,UAAAC;AACF,MAA0B;AACxB,QAAMC,IAAaN,MAAa,YAC1B;AAAA,IACJ,WAAWO;AAAA,IACX,OAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAcC;AAAA,IACd,mBAAmBC;AAAA,IACnB,aAAaC;AAAA,EACX,IAA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,UAAS;AAAA,UACT,aAAY;AAAA,UACZ,UAAS;AAAA,UACT,QAAQ;AAAA,UACR,aAAY;AAAA,UACZ,QAAQhC,KAAuBR,MAAU,qBAAqBF;AAAA,UAE9D,UAAA,gBAAAoC;AAAA,YAACO;AAAAA,YAAA;AAAA,cACC,aAAY;AAAA,cACZ,iBAAgB;AAAA,cAChB,KAAKpC;AAAA,cACL,SAASI;AAAA,cAET,UAAC,gBAAAyB,EAAAQ,GAAA,EAAiB,OAAO,IAAI,QAAQ,IAAI;AAAA,YAAA;AAAA,UAC3C;AAAA,QAAA;AAAA,MACF;AAAA,MACA,gBAAAR;AAAA,QAACG;AAAA,QAAA;AAAA,UACC,SAASZ;AAAA,UACT,YAAYpB;AAAA,UACZ,SAASG;AAAA,UACT,mBAAAf;AAAA,QAAA;AAAA,MACF;AAAA,IAAA,GACF;AAAA,IAEDF,KACC,gBAAA2C,EAACS,IAAA,EAAqB,aAAY,WAChC,UAAA,gBAAAT,EAACU,IAAA,EAAoB,UAAU,GAAG,SAAS,GACzC,UAAC,gBAAAV,EAAAM,GAAA,EAAa,UAAS,WAAU,aAAY,0BAAyB,UAAS,UAC7E,UAAA,gBAAAN,EAACW,IAAS,EAAA,UAAU,GAAG,SAAS,EAAG,CAAA,EACrC,CAAA,EACF,CAAA,GACF;AAAA,EAEJ,EAAA,CAAA;AAEJ,GAEeC,KAAAC,EAAKhE,EAAY;"}
|
1
|
+
{"version":3,"file":"homework-card.js","sources":["../../../src/features/homework/homework-card.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 { memo, useCallback, useMemo, useRef } from 'react';\n\nimport Eye2Icon from '../../assets/line-icons/icons/eye2';\nimport Home2Icon from '../../assets/line-icons/icons/home2';\nimport MoreVerticalIcon from '../../assets/line-icons/icons/more-vertical';\nimport RedoIcon from '../../assets/line-icons/icons/redo';\nimport ArrowTooltip from '../ui/arrow-tooltip/arrow-tooltip';\nimport Clickable from '../ui/buttons/clickable/clickable';\nimport useContextMenuClickHandler from '../ui/hooks/use-context-menu-click-handler';\nimport FlexView from '../ui/layout/flex-view';\nimport CardMenuOptions from './card-menu-options';\nimport HomeworkView from './homework-card-view';\nimport * as Styled from './styles';\nimport { getCardAnalyticProps } from './utils';\n\ninterface IHomeworkCardProps extends INodeCardCallbacks {\n header: string;\n nodeData: INodeDataProps;\n subHeader: string;\n userType: TUserTypes;\n studentId: string;\n userMilestoneId?: string;\n renderAs: 'homework' | 'milestone';\n shouldOpenOnRight: boolean;\n isInQueue?: boolean;\n}\n\nconst HomeworkCard = ({\n // callbacks\n nodeData,\n onNodeAttempt,\n onNodeReattempt,\n onNodeReview,\n onNodeUnassign,\n onNodeView,\n onNodeAssignAsHomework,\n\n header,\n isInQueue,\n renderAs,\n shouldOpenOnRight,\n studentId,\n subHeader,\n userMilestoneId,\n userType,\n}: IHomeworkCardProps) => {\n const isHomeWork = renderAs === 'homework';\n const {\n node_type: nodeType,\n state,\n permissions,\n user_node_id: userNodeId,\n user_milestone_id: milestoneId,\n homework_id: homeworkId,\n } = nodeData;\n\n const teacherContainerRef = useRef<HTMLDivElement>(null);\n const studentContainerRef = useRef<HTMLDivElement>(null);\n const { menuVisible: teacherMenuVisible, onMenuClick: onTeacherMenuClick } =\n useContextMenuClickHandler(teacherContainerRef);\n const { menuVisible: studentMenuVisible, onMenuClick: onStudentMenuClick } =\n useContextMenuClickHandler(studentContainerRef);\n\n const {\n can_start: canStart,\n can_resume: canResume,\n can_review: canReview,\n can_unassign: canUnassign,\n can_reset: canReset,\n can_assign_as_homework: canAssignAsHw,\n } = permissions;\n const isStudent = userType === 'STUDENT';\n\n const onStudentViewSheet = useCallback(() => {\n if (canReview) {\n if (typeof onNodeReview !== 'function') {\n throw new Error('onReview must be a function');\n }\n\n if (!userNodeId) {\n throw new Error('user node id must be present to review the sheet');\n }\n onNodeReview(nodeData, userMilestoneId);\n\n return;\n }\n }, [canReview, onNodeReview, userNodeId, nodeData, userMilestoneId]);\n\n const onStudentCardClick = useCallback(() => {\n if (canStart || canResume) {\n if (typeof onNodeAttempt !== 'function') {\n throw new Error('onNodeAttempt must be a function');\n }\n\n onNodeAttempt(nodeData, homeworkId);\n\n return;\n }\n\n if (!isHomeWork) {\n onStudentMenuClick();\n\n return;\n }\n onStudentViewSheet();\n }, [\n canStart,\n canResume,\n isHomeWork,\n onStudentViewSheet,\n onNodeAttempt,\n nodeData,\n homeworkId,\n onStudentMenuClick,\n ]);\n\n const onTeacherCardClick = useCallback(() => {\n if (canReview) {\n if (typeof onNodeReview !== 'function') {\n throw new Error('onNodeReview must be a function');\n }\n\n if (!userNodeId) {\n throw new Error('user node id must be present to review the sheet');\n }\n onNodeReview(nodeData, userMilestoneId || milestoneId, homeworkId);\n\n return;\n }\n\n if (typeof onNodeView !== 'function') {\n throw new Error('onNodeView must be a function');\n }\n\n onNodeView(nodeData, userMilestoneId || milestoneId);\n }, [\n canReview,\n onNodeView,\n nodeData,\n userMilestoneId,\n milestoneId,\n onNodeReview,\n userNodeId,\n homeworkId,\n ]);\n\n const handleOnMenuOptionClick = useCallback(\n (optionId: string) => {\n switch (optionId) {\n case 'teacher-card-view':\n onTeacherCardClick();\n\n return;\n case 'student-card-view':\n onStudentViewSheet();\n\n return;\n case 'teacher-card-unassign':\n onNodeUnassign?.(nodeData, userMilestoneId);\n\n return;\n case 'student-card-reattempt':\n case 'teacher-card-redo':\n onNodeReattempt?.(nodeData, userMilestoneId);\n\n return;\n\n case 'teacher-card-assign-as-hw':\n onNodeAssignAsHomework?.(nodeData, userMilestoneId);\n\n return;\n\n default:\n throw new Error(`No callback function for ${optionId}`);\n }\n },\n [\n nodeData,\n onNodeAssignAsHomework,\n onNodeReattempt,\n onNodeUnassign,\n onStudentViewSheet,\n onTeacherCardClick,\n userMilestoneId,\n ],\n );\n\n const teacherOptions = [\n {\n id: 'teacher-card-view',\n label: canReview ? 'Review' : 'View',\n icon: Eye2Icon,\n disabled: false,\n onClick: handleOnMenuOptionClick,\n },\n {\n id: 'teacher-card-unassign',\n label: 'Unassign',\n icon: Styled.StyledMinus2Icon,\n disabled: isHomeWork ? nodeType === 'MASTERY' : !canUnassign,\n onClick: handleOnMenuOptionClick,\n },\n {\n id: 'teacher-card-redo',\n label: 'Redo',\n icon: RedoIcon,\n disabled: !canReset,\n onClick: handleOnMenuOptionClick,\n },\n {\n id: 'teacher-card-assign-as-hw',\n label: 'Assign as HW',\n icon: Home2Icon,\n disabled: !canAssignAsHw,\n onClick: handleOnMenuOptionClick,\n },\n ];\n\n const studentOptions = [\n {\n id: 'student-card-view',\n label: 'Review',\n icon: Eye2Icon,\n disabled: !canReview,\n onClick: handleOnMenuOptionClick,\n },\n {\n id: 'student-card-reattempt',\n label: 'Reattempt',\n icon: RedoIcon,\n disabled: !canReset,\n onClick: handleOnMenuOptionClick,\n },\n ];\n\n const analyticsLabel = useMemo(\n () =>\n getCardAnalyticProps({\n canResume,\n canStart,\n homeworkId,\n isHomeWork,\n isStudent,\n milestoneId,\n nodeType,\n studentId,\n userNodeId,\n }),\n [\n isStudent,\n isHomeWork,\n studentId,\n nodeType,\n canStart,\n canResume,\n homeworkId,\n userNodeId,\n milestoneId,\n ],\n );\n\n return (\n <Styled.CardContainer $position=\"relative\" $width=\"fit-content\">\n <Clickable\n onClick={isStudent ? onStudentCardClick : onTeacherCardClick}\n label=\"homework-card\"\n analyticsLabel={analyticsLabel.analyticsLabel}\n analyticsProps={analyticsLabel.analyticsProps}\n >\n <HomeworkView\n header={header}\n isInQueue={isInQueue}\n nodeData={nodeData}\n studentContainerRef={studentContainerRef}\n subHeader={subHeader}\n userType={userType}\n />\n </Clickable>\n {isStudent && !isHomeWork && (\n <CardMenuOptions\n $width={200}\n options={studentOptions}\n triggerRef={studentContainerRef}\n visible={studentMenuVisible}\n shouldOpenOnRight={false}\n />\n )}\n {!isStudent && (\n <Styled.MenuWrapper $position=\"absolute\" $width=\"fit-content\" $borderRadiusX={2}>\n <ArrowTooltip\n renderAs=\"primary\"\n tooltipItem=\"Review\"\n position=\"bottom\"\n zIndex={6}\n parentWidth=\"100%\"\n hidden={teacherMenuVisible || (state !== 'WAIT_FOR_REVIEW' && isHomeWork)}\n >\n <Styled.CardKebabMenuWrapper\n $alignItems=\"center\"\n $justifyContent=\"center\"\n ref={teacherContainerRef}\n onClick={onTeacherMenuClick}\n >\n <MoreVerticalIcon width={16} height={16} />\n </Styled.CardKebabMenuWrapper>\n </ArrowTooltip>\n <CardMenuOptions\n options={teacherOptions}\n triggerRef={teacherContainerRef}\n visible={teacherMenuVisible}\n shouldOpenOnRight={shouldOpenOnRight}\n $width={144}\n />\n </Styled.MenuWrapper>\n )}\n {isInQueue && (\n <Styled.BlurContainer $background=\"WHITE_5\">\n <Styled.BlurFlexView $heightX={1} $widthX={6}>\n <ArrowTooltip renderAs=\"primary\" tooltipItem=\"Not visible to student\" position=\"bottom\">\n <FlexView $heightX={1} $widthX={6} />\n </ArrowTooltip>\n </Styled.BlurFlexView>\n </Styled.BlurContainer>\n )}\n </Styled.CardContainer>\n );\n};\n\nexport default memo(HomeworkCard);\n"],"names":["HomeworkCard","nodeData","onNodeAttempt","onNodeReattempt","onNodeReview","onNodeUnassign","onNodeView","onNodeAssignAsHomework","header","isInQueue","renderAs","shouldOpenOnRight","studentId","subHeader","userMilestoneId","userType","isHomeWork","nodeType","state","permissions","userNodeId","milestoneId","homeworkId","teacherContainerRef","useRef","studentContainerRef","teacherMenuVisible","onTeacherMenuClick","useContextMenuClickHandler","studentMenuVisible","onStudentMenuClick","canStart","canResume","canReview","canUnassign","canReset","canAssignAsHw","isStudent","onStudentViewSheet","useCallback","onStudentCardClick","onTeacherCardClick","handleOnMenuOptionClick","optionId","teacherOptions","Eye2Icon","Styled.StyledMinus2Icon","RedoIcon","Home2Icon","studentOptions","analyticsLabel","useMemo","getCardAnalyticProps","Styled.CardContainer","jsx","Clickable","HomeworkView","CardMenuOptions","jsxs","Styled.MenuWrapper","ArrowTooltip","Styled.CardKebabMenuWrapper","MoreVerticalIcon","Styled.BlurContainer","Styled.BlurFlexView","FlexView","HomeworkCard$1","memo"],"mappings":";;;;;;;;;;;;;;AAiCA,MAAMA,KAAe,CAAC;AAAA;AAAA,EAEpB,UAAAC;AAAA,EACA,eAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,wBAAAC;AAAA,EAEA,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,UAAAC;AACF,MAA0B;AACxB,QAAMC,IAAaN,MAAa,YAC1B;AAAA,IACJ,WAAWO;AAAA,IACX,OAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAcC;AAAA,IACd,mBAAmBC;AAAA,IACnB,aAAaC;AAAA,EACX,IAAArB,GAEEsB,IAAsBC,EAAuB,IAAI,GACjDC,IAAsBD,EAAuB,IAAI,GACjD,EAAE,aAAaE,GAAoB,aAAaC,MACpDC,EAA2BL,CAAmB,GAC1C,EAAE,aAAaM,GAAoB,aAAaC,MACpDF,EAA2BH,CAAmB,GAE1C;AAAA,IACJ,WAAWM;AAAA,IACX,YAAYC;AAAA,IACZ,YAAYC;AAAA,IACZ,cAAcC;AAAA,IACd,WAAWC;AAAA,IACX,wBAAwBC;AAAA,EACtB,IAAAjB,GACEkB,IAAYtB,MAAa,WAEzBuB,IAAqBC,EAAY,MAAM;AAC3C,QAAIN,GAAW;AACT,UAAA,OAAO7B,KAAiB;AACpB,cAAA,IAAI,MAAM,6BAA6B;AAG/C,UAAI,CAACgB;AACG,cAAA,IAAI,MAAM,kDAAkD;AAEpE,MAAAhB,EAAaH,GAAUa,CAAe;AAEtC;AAAA,IACF;AAAA,EAAA,GACC,CAACmB,GAAW7B,GAAcgB,GAAYnB,GAAUa,CAAe,C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AAR;AAAA,QAACG;AAAA,QAAA;AAAA,UACC,SAASb;AAAA,UACT,YAAYrB;AAAA,UACZ,SAASG;AAAA,UACT,mBAAAf;AAAA,UACA,QAAQ;AAAA,QAAA;AAAA,MACV;AAAA,IAAA,GACF;AAAA,IAEDF,KACC,gBAAA6C,EAACS,IAAA,EAAqB,aAAY,WAChC,UAAA,gBAAAT,EAACU,IAAA,EAAoB,UAAU,GAAG,SAAS,GACzC,UAAC,gBAAAV,EAAAM,GAAA,EAAa,UAAS,WAAU,aAAY,0BAAyB,UAAS,UAC7E,UAAA,gBAAAN,EAACW,IAAS,EAAA,UAAU,GAAG,SAAS,EAAG,CAAA,EACrC,CAAA,EACF,CAAA,GACF;AAAA,EAEJ,EAAA,CAAA;AAEJ,GAEeC,KAAAC,EAAKnE,EAAY;"}
|
@@ -1,31 +1,31 @@
|
|
1
1
|
import { jsxs as x, jsx as o } from "react/jsx-runtime";
|
2
2
|
import { useRef as n, useCallback as p, useMemo as R, useEffect as N } from "react";
|
3
3
|
import _ from "../../chapters-v2/chapter-details/block-sections/block-sections.js";
|
4
|
-
import
|
4
|
+
import k from "../../chapters-v2/chapter-details/chapter-banner/chapter-banner.js";
|
5
5
|
import I from "../../chapters-v2/chapter-details/chapter-details.js";
|
6
|
-
import
|
6
|
+
import A from "../../ui/layout/flex-view.js";
|
7
7
|
import P from "../../ui/separator/separator.js";
|
8
|
-
import { JOURNEY_ID_STUDENT as
|
9
|
-
import { PROGRESS_STAT_MOCK as y, BLOCK_MOCKS as
|
8
|
+
import { JOURNEY_ID_STUDENT as H } from "../journey-id/journey-id-student.js";
|
9
|
+
import { PROGRESS_STAT_MOCK as y, BLOCK_MOCKS as K } from "../mocks/chapter-page-journey-mock-data.js";
|
10
10
|
import { IndicatorType as l } from "../use-journey/constants.js";
|
11
11
|
import { useJourney as v } from "../use-journey/use-journey.js";
|
12
|
-
import
|
12
|
+
import s from "./use-home-page-journey/tooltip-item.js";
|
13
13
|
const $ = () => {
|
14
|
-
const t =
|
14
|
+
const t = H.CHAPTER_PAGE_JOURNEY, r = n(null), e = n(null), a = n(null), c = n([]), { nextCoachmark: d, setJourney: h, endJourney: C } = v(), i = p(() => {
|
15
15
|
d(t, !1, 0, !0);
|
16
16
|
}, [t, d]), g = p(() => {
|
17
17
|
document.body.style.overflow = "unset", C(t);
|
18
18
|
}, [C, t]), f = p(
|
19
19
|
({ chapterDetails: m, userChapterId: B, studentId: E, userType: T }) => {
|
20
|
-
const { name:
|
21
|
-
if (!(r != null && r.current) || !(e != null && e.current) || !
|
20
|
+
const { name: w, image_hue: u, image_url: O } = m;
|
21
|
+
if (!(r != null && r.current) || !(e != null && e.current) || !a.current)
|
22
22
|
return;
|
23
23
|
const S = [
|
24
24
|
{
|
25
25
|
originalElementToHighlightRef: r,
|
26
26
|
isActive: !1,
|
27
27
|
type: l.TOOLTIP,
|
28
|
-
elementToHighlight: /* @__PURE__ */ x(
|
28
|
+
elementToHighlight: /* @__PURE__ */ x(A, { children: [
|
29
29
|
/* @__PURE__ */ o(P, { heightX: 10 }),
|
30
30
|
/* @__PURE__ */ o(
|
31
31
|
I,
|
@@ -35,7 +35,7 @@ const $ = () => {
|
|
35
35
|
userType: T,
|
36
36
|
onBlockSkipUnskip: () => null,
|
37
37
|
onNodeAttempt: () => null,
|
38
|
-
|
38
|
+
onNodeAssignAsHomework: () => null,
|
39
39
|
onNodeMarkAsDone: () => null,
|
40
40
|
onNodeReattempt: () => null,
|
41
41
|
onNodeReview: () => null,
|
@@ -53,7 +53,7 @@ const $ = () => {
|
|
53
53
|
arrowSize: 12,
|
54
54
|
width: 264,
|
55
55
|
tooltipItem: /* @__PURE__ */ o(
|
56
|
-
|
56
|
+
s,
|
57
57
|
{
|
58
58
|
text: "Welcome to the all new chapter experience.",
|
59
59
|
buttonLabel: "Next",
|
@@ -65,11 +65,11 @@ const $ = () => {
|
|
65
65
|
{
|
66
66
|
originalElementToHighlightRef: e,
|
67
67
|
elementToHighlight: /* @__PURE__ */ o(
|
68
|
-
|
68
|
+
k,
|
69
69
|
{
|
70
|
-
title:
|
70
|
+
title: w,
|
71
71
|
progressStats: y,
|
72
|
-
imageUrl:
|
72
|
+
imageUrl: O,
|
73
73
|
imageHue: u
|
74
74
|
}
|
75
75
|
),
|
@@ -84,7 +84,7 @@ const $ = () => {
|
|
84
84
|
width: 264,
|
85
85
|
arrowSize: 12,
|
86
86
|
tooltipItem: /* @__PURE__ */ o(
|
87
|
-
|
87
|
+
s,
|
88
88
|
{
|
89
89
|
text: "A chapter is divided into *core sheets (compulsory), and supplementary sheets.",
|
90
90
|
buttonLabel: "Next",
|
@@ -97,11 +97,11 @@ const $ = () => {
|
|
97
97
|
{
|
98
98
|
originalElementToHighlightRef: e,
|
99
99
|
elementToHighlight: /* @__PURE__ */ o(
|
100
|
-
|
100
|
+
k,
|
101
101
|
{
|
102
|
-
title:
|
102
|
+
title: w,
|
103
103
|
progressStats: y,
|
104
|
-
imageUrl:
|
104
|
+
imageUrl: O,
|
105
105
|
imageHue: u
|
106
106
|
}
|
107
107
|
),
|
@@ -116,7 +116,7 @@ const $ = () => {
|
|
116
116
|
arrowSize: 12,
|
117
117
|
width: 264,
|
118
118
|
tooltipItem: /* @__PURE__ */ o(
|
119
|
-
|
119
|
+
s,
|
120
120
|
{
|
121
121
|
text: "Easily track the progress of the core sheets.",
|
122
122
|
buttonLabel: "Next",
|
@@ -127,8 +127,8 @@ const $ = () => {
|
|
127
127
|
isActive: !1
|
128
128
|
},
|
129
129
|
{
|
130
|
-
originalElementToHighlightRef:
|
131
|
-
elementToHighlight: /* @__PURE__ */ o(
|
130
|
+
originalElementToHighlightRef: a,
|
131
|
+
elementToHighlight: /* @__PURE__ */ o(A, { $widthX: 50, children: /* @__PURE__ */ o(_, { userType: T, blocks: K, imageHue: u }) }),
|
132
132
|
type: l.TOOLTIP,
|
133
133
|
indicator: {
|
134
134
|
position: "top",
|
@@ -140,7 +140,7 @@ const $ = () => {
|
|
140
140
|
arrowSize: 12,
|
141
141
|
width: 264,
|
142
142
|
tooltipItem: /* @__PURE__ */ o(
|
143
|
-
|
143
|
+
s,
|
144
144
|
{
|
145
145
|
text: "Core sheets are marked to help you find them faster.",
|
146
146
|
buttonLabel: "Got it",
|
@@ -152,24 +152,24 @@ const $ = () => {
|
|
152
152
|
}
|
153
153
|
];
|
154
154
|
h(t, S);
|
155
|
-
const
|
156
|
-
clearTimeout(
|
155
|
+
const b = setTimeout(() => {
|
156
|
+
clearTimeout(b), window.scrollTo(0, 0), document.body.style.overflow = "hidden", i();
|
157
157
|
}, 500);
|
158
|
-
c.current.push(
|
158
|
+
c.current.push(b);
|
159
159
|
},
|
160
160
|
[i, g, h, t]
|
161
|
-
),
|
161
|
+
), L = R(
|
162
162
|
() => ({
|
163
163
|
chapterPageRef: r,
|
164
164
|
bannerRef: e,
|
165
|
-
coreBlocksRef:
|
165
|
+
coreBlocksRef: a,
|
166
166
|
startJourney: f
|
167
167
|
}),
|
168
168
|
[f]
|
169
169
|
);
|
170
170
|
return N(() => () => {
|
171
171
|
c.current.forEach((m) => clearTimeout(m)), c.current = [];
|
172
|
-
}, []),
|
172
|
+
}, []), L;
|
173
173
|
};
|
174
174
|
export {
|
175
175
|
$ as useChapterPageJourney
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-chapter-journey.js","sources":["../../../../src/features/journey/hooks/use-chapter-journey.tsx"],"sourcesContent":["import type { IUserChapterData } from '../../chapters-v2/chapter-details/chapter-details-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 BlockSections from '../../chapters-v2/chapter-details/block-sections/block-sections';\nimport ChapterBanner from '../../chapters-v2/chapter-details/chapter-banner/chapter-banner';\nimport ChapterDetails from '../../chapters-v2/chapter-details/chapter-details';\nimport FlexView from '../../ui/layout/flex-view';\nimport Separator from '../../ui/separator/separator';\nimport { JOURNEY_ID_STUDENT } from '../journey-id/journey-id-student';\nimport { BLOCK_MOCKS, PROGRESS_STAT_MOCK } from '../mocks/chapter-page-journey-mock-data';\nimport { IndicatorType } from '../use-journey/constants';\nimport { useJourney } from '../use-journey/use-journey';\nimport TooltipItem from './use-home-page-journey/tooltip-item';\n\ninterface IChapterStartJourneyProps {\n chapterDetails: IUserChapterData;\n userChapterId: string;\n studentId: string;\n userType: TUserTypes;\n}\n\nexport const useChapterPageJourney = () => {\n const journeyId = JOURNEY_ID_STUDENT.CHAPTER_PAGE_JOURNEY;\n\n const chapterPageRef = useRef<HTMLDivElement>(null);\n const bannerRef = useRef<HTMLDivElement>(null);\n const coreBlocksRef = useRef<HTMLDivElement>(null);\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n const { nextCoachmark, setJourney, endJourney } = useJourney();\n\n const handleNextCoachmark = useCallback(() => {\n nextCoachmark(journeyId, false, 0, true);\n }, [journeyId, nextCoachmark]);\n\n const handleEndJourney = useCallback(() => {\n document.body.style.overflow = 'unset';\n endJourney(journeyId);\n }, [endJourney, journeyId]);\n\n const startJourney = useCallback(\n ({ chapterDetails, userChapterId, studentId, userType }: IChapterStartJourneyProps) => {\n const { name, image_hue: imageHue, image_url: imageUrl } = chapterDetails;\n\n if (!chapterPageRef?.current || !bannerRef?.current || !coreBlocksRef.current) {\n return;\n }\n\n const chapterPageSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: chapterPageRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: (\n <FlexView>\n <Separator heightX={10} />\n <ChapterDetails\n userChapterId={userChapterId}\n studentId={studentId}\n userType={userType}\n onBlockSkipUnskip={() => null}\n onNodeAttempt={() => null}\n onNodeAttemptLocationChange={() => null}\n onNodeMarkAsDone={() => null}\n onNodeReattempt={() => null}\n onNodeReview={() => null}\n onNodeView={() => null}\n onExit={() => null}\n />\n </FlexView>\n ),\n indicator: {\n position: 'top',\n tooltipYCoOrdinates: -140,\n backgroundColor: 'BLUE_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n arrowSize: 12,\n width: 264,\n tooltipItem: (\n <TooltipItem\n text=\"Welcome to the all new chapter experience.\"\n buttonLabel=\"Next\"\n onButtonClick={handleNextCoachmark}\n />\n ),\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: bannerRef,\n elementToHighlight: (\n <ChapterBanner\n title={name}\n progressStats={PROGRESS_STAT_MOCK}\n imageUrl={imageUrl}\n imageHue={imageHue}\n />\n ),\n type: IndicatorType.TOOLTIP,\n indicator: {\n position: 'bottom',\n tooltipXCoOrdinates: -45,\n tooltipYCoOrdinates: -40,\n backgroundColor: 'ORANGE_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n width: 264,\n arrowSize: 12,\n tooltipItem: (\n <TooltipItem\n text=\"A chapter is divided into *core sheets (compulsory), and supplementary sheets.\"\n buttonLabel=\"Next\"\n onButtonClick={handleNextCoachmark}\n />\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n {\n originalElementToHighlightRef: bannerRef,\n elementToHighlight: (\n <ChapterBanner\n title={name}\n progressStats={PROGRESS_STAT_MOCK}\n imageUrl={imageUrl}\n imageHue={imageHue}\n />\n ),\n type: IndicatorType.TOOLTIP,\n indicator: {\n position: 'bottom',\n tooltipXCoOrdinates: -275,\n tooltipYCoOrdinates: -15,\n backgroundColor: 'PURPLE_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n arrowSize: 12,\n width: 264,\n tooltipItem: (\n <TooltipItem\n text=\"Easily track the progress of the core sheets.\"\n buttonLabel=\"Next\"\n onButtonClick={handleNextCoachmark}\n />\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n {\n originalElementToHighlightRef: coreBlocksRef,\n elementToHighlight: (\n <FlexView $widthX={50}>\n <BlockSections userType={userType} blocks={BLOCK_MOCKS} imageHue={imageHue} />\n </FlexView>\n ),\n type: IndicatorType.TOOLTIP,\n indicator: {\n position: 'top',\n tooltipXCoOrdinates: -150,\n tooltipYCoOrdinates: -260,\n backgroundColor: 'PURPLE_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n arrowSize: 12,\n width: 264,\n tooltipItem: (\n <TooltipItem\n text=\"Core sheets are marked to help you find them faster.\"\n buttonLabel=\"Got it\"\n onButtonClick={handleEndJourney}\n />\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n ];\n\n setJourney(journeyId, chapterPageSteps);\n\n const delayBeforeStart = setTimeout(() => {\n clearTimeout(delayBeforeStart);\n window.scrollTo(0, 0);\n document.body.style.overflow = 'hidden';\n handleNextCoachmark();\n }, 500);\n\n timerRefs.current.push(delayBeforeStart);\n },\n [handleNextCoachmark, handleEndJourney, setJourney, journeyId],\n );\n\n const data = useMemo(\n () => ({\n chapterPageRef,\n bannerRef,\n coreBlocksRef,\n startJourney,\n }),\n [startJourney],\n );\n\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n };\n }, []);\n\n return data;\n};\n"],"names":["useChapterPageJourney","journeyId","JOURNEY_ID_STUDENT","chapterPageRef","useRef","bannerRef","coreBlocksRef","timerRefs","nextCoachmark","setJourney","endJourney","useJourney","handleNextCoachmark","useCallback","handleEndJourney","startJourney","chapterDetails","userChapterId","studentId","userType","name","imageHue","imageUrl","chapterPageSteps","IndicatorType","FlexView","jsx","Separator","ChapterDetails","TooltipItem","ChapterBanner","PROGRESS_STAT_MOCK","BlockSections","BLOCK_MOCKS","delayBeforeStart","data","useMemo","useEffect","timer"],"mappings":";;;;;;;;;;;;AAyBO,MAAMA,IAAwB,MAAM;AACzC,QAAMC,IAAYC,EAAmB,sBAE/BC,IAAiBC,EAAuB,IAAI,GAC5CC,IAAYD,EAAuB,IAAI,GACvCE,IAAgBF,EAAuB,IAAI,GAC3CG,IAAYH,EAAwC,CAAA,CAAE,GACtD,EAAE,eAAAI,GAAe,YAAAC,GAAY,YAAA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BAA+BN;AAAA,UAC/B,oBACG,gBAAAoB,EAAAD,GAAA,EAAS,SAAS,IACjB,UAAC,gBAAAC,EAAAM,GAAA,EAAc,UAAAb,GAAoB,QAAQc,GAAa,UAAAZ,EAAA,CAAoB,EAC9E,CAAA;AAAA,UAEF,MAAMG,EAAc;AAAA,UACpB,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,gBAAAE;AAAA,cAACG;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,aAAY;AAAA,gBACZ,eAAef;AAAA,cAAA;AAAA,YACjB;AAAA,UAEJ;AAAA,UACA,UAAU;AAAA,QACZ;AAAA,MAAA;AAGF,MAAAL,EAAWR,GAAWsB,CAAgB;AAEhC,YAAAW,IAAmB,WAAW,MAAM;AACxC,qBAAaA,CAAgB,GACtB,OAAA,SAAS,GAAG,CAAC,GACX,SAAA,KAAK,MAAM,WAAW,UACXtB;SACnB,GAAG;AAEI,MAAAL,EAAA,QAAQ,KAAK2B,CAAgB;AAAA,IACzC;AAAA,IACA,CAACtB,GAAqBE,GAAkBL,GAAYR,CAAS;AAAA,EAAA,GAGzDkC,IAAOC;AAAA,IACX,OAAO;AAAA,MACL,gBAAAjC;AAAA,MACA,WAAAE;AAAA,MACA,eAAAC;AAAA,MACA,cAAAS;AAAA,IAAA;AAAA,IAEF,CAACA,CAAY;AAAA,EAAA;AAGf,SAAAsB,EAAU,MACD,MAAM;AACX,IAAA9B,EAAU,QAAQ,QAAQ,CAAS+B,MAAA,aAAaA,CAAK,CAAC,GACtD/B,EAAU,UAAU;EAAC,GAEtB,CAAE,CAAA,GAEE4B;AACT;"}
|
1
|
+
{"version":3,"file":"use-chapter-journey.js","sources":["../../../../src/features/journey/hooks/use-chapter-journey.tsx"],"sourcesContent":["import type { IUserChapterData } from '../../chapters-v2/chapter-details/chapter-details-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 BlockSections from '../../chapters-v2/chapter-details/block-sections/block-sections';\nimport ChapterBanner from '../../chapters-v2/chapter-details/chapter-banner/chapter-banner';\nimport ChapterDetails from '../../chapters-v2/chapter-details/chapter-details';\nimport FlexView from '../../ui/layout/flex-view';\nimport Separator from '../../ui/separator/separator';\nimport { JOURNEY_ID_STUDENT } from '../journey-id/journey-id-student';\nimport { BLOCK_MOCKS, PROGRESS_STAT_MOCK } from '../mocks/chapter-page-journey-mock-data';\nimport { IndicatorType } from '../use-journey/constants';\nimport { useJourney } from '../use-journey/use-journey';\nimport TooltipItem from './use-home-page-journey/tooltip-item';\n\ninterface IChapterStartJourneyProps {\n chapterDetails: IUserChapterData;\n userChapterId: string;\n studentId: string;\n userType: TUserTypes;\n}\n\nexport const useChapterPageJourney = () => {\n const journeyId = JOURNEY_ID_STUDENT.CHAPTER_PAGE_JOURNEY;\n\n const chapterPageRef = useRef<HTMLDivElement>(null);\n const bannerRef = useRef<HTMLDivElement>(null);\n const coreBlocksRef = useRef<HTMLDivElement>(null);\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n const { nextCoachmark, setJourney, endJourney } = useJourney();\n\n const handleNextCoachmark = useCallback(() => {\n nextCoachmark(journeyId, false, 0, true);\n }, [journeyId, nextCoachmark]);\n\n const handleEndJourney = useCallback(() => {\n document.body.style.overflow = 'unset';\n endJourney(journeyId);\n }, [endJourney, journeyId]);\n\n const startJourney = useCallback(\n ({ chapterDetails, userChapterId, studentId, userType }: IChapterStartJourneyProps) => {\n const { name, image_hue: imageHue, image_url: imageUrl } = chapterDetails;\n\n if (!chapterPageRef?.current || !bannerRef?.current || !coreBlocksRef.current) {\n return;\n }\n\n const chapterPageSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: chapterPageRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: (\n <FlexView>\n <Separator heightX={10} />\n <ChapterDetails\n userChapterId={userChapterId}\n studentId={studentId}\n userType={userType}\n onBlockSkipUnskip={() => null}\n onNodeAttempt={() => null}\n onNodeAssignAsHomework={() => null}\n onNodeMarkAsDone={() => null}\n onNodeReattempt={() => null}\n onNodeReview={() => null}\n onNodeView={() => null}\n onExit={() => null}\n />\n </FlexView>\n ),\n indicator: {\n position: 'top',\n tooltipYCoOrdinates: -140,\n backgroundColor: 'BLUE_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n arrowSize: 12,\n width: 264,\n tooltipItem: (\n <TooltipItem\n text=\"Welcome to the all new chapter experience.\"\n buttonLabel=\"Next\"\n onButtonClick={handleNextCoachmark}\n />\n ),\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: bannerRef,\n elementToHighlight: (\n <ChapterBanner\n title={name}\n progressStats={PROGRESS_STAT_MOCK}\n imageUrl={imageUrl}\n imageHue={imageHue}\n />\n ),\n type: IndicatorType.TOOLTIP,\n indicator: {\n position: 'bottom',\n tooltipXCoOrdinates: -45,\n tooltipYCoOrdinates: -40,\n backgroundColor: 'ORANGE_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n width: 264,\n arrowSize: 12,\n tooltipItem: (\n <TooltipItem\n text=\"A chapter is divided into *core sheets (compulsory), and supplementary sheets.\"\n buttonLabel=\"Next\"\n onButtonClick={handleNextCoachmark}\n />\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n {\n originalElementToHighlightRef: bannerRef,\n elementToHighlight: (\n <ChapterBanner\n title={name}\n progressStats={PROGRESS_STAT_MOCK}\n imageUrl={imageUrl}\n imageHue={imageHue}\n />\n ),\n type: IndicatorType.TOOLTIP,\n indicator: {\n position: 'bottom',\n tooltipXCoOrdinates: -275,\n tooltipYCoOrdinates: -15,\n backgroundColor: 'PURPLE_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n arrowSize: 12,\n width: 264,\n tooltipItem: (\n <TooltipItem\n text=\"Easily track the progress of the core sheets.\"\n buttonLabel=\"Next\"\n onButtonClick={handleNextCoachmark}\n />\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n {\n originalElementToHighlightRef: coreBlocksRef,\n elementToHighlight: (\n <FlexView $widthX={50}>\n <BlockSections userType={userType} blocks={BLOCK_MOCKS} imageHue={imageHue} />\n </FlexView>\n ),\n type: IndicatorType.TOOLTIP,\n indicator: {\n position: 'top',\n tooltipXCoOrdinates: -150,\n tooltipYCoOrdinates: -260,\n backgroundColor: 'PURPLE_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n arrowSize: 12,\n width: 264,\n tooltipItem: (\n <TooltipItem\n text=\"Core sheets are marked to help you find them faster.\"\n buttonLabel=\"Got it\"\n onButtonClick={handleEndJourney}\n />\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n ];\n\n setJourney(journeyId, chapterPageSteps);\n\n const delayBeforeStart = setTimeout(() => {\n clearTimeout(delayBeforeStart);\n window.scrollTo(0, 0);\n document.body.style.overflow = 'hidden';\n handleNextCoachmark();\n }, 500);\n\n timerRefs.current.push(delayBeforeStart);\n },\n [handleNextCoachmark, handleEndJourney, setJourney, journeyId],\n );\n\n const data = useMemo(\n () => ({\n chapterPageRef,\n bannerRef,\n coreBlocksRef,\n startJourney,\n }),\n [startJourney],\n );\n\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n };\n }, []);\n\n return data;\n};\n"],"names":["useChapterPageJourney","journeyId","JOURNEY_ID_STUDENT","chapterPageRef","useRef","bannerRef","coreBlocksRef","timerRefs","nextCoachmark","setJourney","endJourney","useJourney","handleNextCoachmark","useCallback","handleEndJourney","startJourney","chapterDetails","userChapterId","studentId","userType","name","imageHue","imageUrl","chapterPageSteps","IndicatorType","FlexView","jsx","Separator","ChapterDetails","TooltipItem","ChapterBanner","PROGRESS_STAT_MOCK","BlockSections","BLOCK_MOCKS","delayBeforeStart","data","useMemo","useEffect","timer"],"mappings":";;;;;;;;;;;;AAyBO,MAAMA,IAAwB,MAAM;AACzC,QAAMC,IAAYC,EAAmB,sBAE/BC,IAAiBC,EAAuB,IAAI,GAC5CC,IAAYD,EAAuB,IAAI,GACvCE,IAAgBF,EAAuB,IAAI,GAC3CG,IAAYH,EAAwC,CAAA,CAAE,GACtD,EAAE,eAAAI,GAAe,YAAAC,GAAY,YAAAC,MAAeC,EAAW,GAEvDC,IAAsBC,EAAY,MAAM;AAC9B,IAAAL,EAAAP,GAAW,IAAO,GAAG,EAAI;AAAA,EAAA,GACtC,CAACA,GAAWO,CAAa,CAAC,GAEvBM,IAAmBD,EAAY,MAAM;AAChC,aAAA,KAAK,MAAM,WAAW,SAC/BH,EAAWT,CAAS;AAAA,EAAA,GACnB,CAACS,GAAYT,CAAS,CAAC,GAEpBc,IAAeF;AAAA,IACnB,CAAC,EAAE,gBAAAG,GAAgB,eAAAC,GAAe,WAAAC,GAAW,UAAAC,QAA0C;AACrF,YAAM,EAAE,MAAAC,GAAM,WAAWC,GAAU,WAAWC,EAAa,IAAAN;AAEvD,UAAA,EAACb,KAAA,QAAAA,EAAgB,YAAW,EAACE,KAAA,QAAAA,EAAW,YAAW,CAACC,EAAc;AACpE;AAGF,YAAMiB,IAAsC;AAAA,QAC1C;AAAA,UACE,+BAA+BpB;AAAA,UAC/B,UAAU;AAAA,UACV,MAAMqB,EAAc;AAAA,UACpB,sCACGC,GACC,EAAA,UAAA;AAAA,YAAC,gBAAAC,EAAAC,GAAA,EAAU,SAAS,GAAI,CAAA;AAAA,YACxB,gBAAAD;AAAA,cAACE;AAAA,cAAA;AAAA,gBACC,eAAAX;AAAA,gBACA,WAAAC;AAAA,gBACA,UAAAC;AAAA,gBACA,mBAAmB,MAAM;AAAA,gBACzB,eAAe,MAAM;AAAA,gBAC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jC;AAAA,MACA,WAAAE;AAAA,MACA,eAAAC;AAAA,MACA,cAAAS;AAAA,IAAA;AAAA,IAEF,CAACA,CAAY;AAAA,EAAA;AAGf,SAAAsB,EAAU,MACD,MAAM;AACX,IAAA9B,EAAU,QAAQ,QAAQ,CAAS+B,MAAA,aAAaA,CAAK,CAAC,GACtD/B,EAAU,UAAU;EAAC,GAEtB,CAAE,CAAA,GAEE4B;AACT;"}
|
@@ -1,17 +1,17 @@
|
|
1
|
-
import { jsxs as t, Fragment as
|
2
|
-
import
|
3
|
-
import
|
1
|
+
import { jsxs as t, Fragment as te, jsx as n } from "react/jsx-runtime";
|
2
|
+
import ne, { memo as oe, useState as ie, useCallback as h } from "react";
|
3
|
+
import re from "../../../hooks/use-lazy-ref.js";
|
4
4
|
import u from "../../../ui/buttons/text-button/text-button.js";
|
5
5
|
import c from "../../../ui/layout/flex-view.js";
|
6
|
-
import
|
6
|
+
import se from "../../../ui/separator/separator.js";
|
7
7
|
import C from "../../../ui/text/text.js";
|
8
|
-
import
|
9
|
-
import { StyledDownIcon as
|
10
|
-
import
|
11
|
-
import
|
12
|
-
const
|
8
|
+
import ae from "./milestone-widget/milestone-widget.js";
|
9
|
+
import { StyledDownIcon as le } from "./milestone-widget/milestone-widget-styled.js";
|
10
|
+
import ce from "./no-active-milestone/no-active-milestone.js";
|
11
|
+
import de from "../../../../node_modules/uuid/dist/esm-browser/v4.js";
|
12
|
+
const Te = oe(
|
13
13
|
({ milestones: e, studentId: M, milestoneType: s, ...x }) => {
|
14
|
-
const [a, N] =
|
14
|
+
const [a, N] = ie(!1), {
|
15
15
|
canCreatePlan: m,
|
16
16
|
isClassOngoing: T,
|
17
17
|
isFiltersAdded: $,
|
@@ -27,8 +27,8 @@ const Ne = ne(
|
|
27
27
|
onCreateMilestoneTest: P,
|
28
28
|
onNodeAttempt: S,
|
29
29
|
onNodeView: b,
|
30
|
-
onNodeReview:
|
31
|
-
onNodeReattempt:
|
30
|
+
onNodeReview: k,
|
31
|
+
onNodeReattempt: F,
|
32
32
|
onNodeReset: B,
|
33
33
|
onNodeUnassign: V,
|
34
34
|
onAssignResources: j,
|
@@ -40,28 +40,29 @@ const Ne = ne(
|
|
40
40
|
onWidgetTabSelection: z,
|
41
41
|
studentName: p,
|
42
42
|
teacherName: X,
|
43
|
-
parentName:
|
43
|
+
parentName: H,
|
44
44
|
userType: d,
|
45
|
-
courseStream:
|
46
|
-
|
45
|
+
courseStream: U,
|
46
|
+
onNodeAssignAsHomework: W
|
47
|
+
} = x, l = s === "ACTIVE", A = s === "DRAFT", g = re(de), q = h(() => {
|
47
48
|
r == null || r(g);
|
48
|
-
}, [r, g]),
|
49
|
+
}, [r, g]), J = () => {
|
49
50
|
!a && f && f(), N(!a);
|
50
|
-
},
|
51
|
+
}, K = h(() => {
|
51
52
|
i == null || i();
|
52
53
|
}, [i]);
|
53
54
|
if (!e) return null;
|
54
|
-
const
|
55
|
+
const Q = e.some(
|
55
56
|
(o) => o.milestone_state === "ACTIVE"
|
56
|
-
),
|
57
|
+
), Y = e.some(
|
57
58
|
(o) => o.milestone_state === "DRAFT"
|
58
59
|
);
|
59
|
-
return /* @__PURE__ */ t(
|
60
|
-
l && !
|
61
|
-
|
60
|
+
return /* @__PURE__ */ t(te, { children: [
|
61
|
+
l && !Q && /* @__PURE__ */ n(c, { $marginBottom: 40, children: /* @__PURE__ */ n(
|
62
|
+
ce,
|
62
63
|
{
|
63
64
|
canCreatePlan: m,
|
64
|
-
isDraftMilestonePresent:
|
65
|
+
isDraftMilestonePresent: Y,
|
65
66
|
isFiltersAdded: $,
|
66
67
|
onCreatePlan: r,
|
67
68
|
studentName: p,
|
@@ -80,11 +81,11 @@ const Ne = ne(
|
|
80
81
|
{
|
81
82
|
label: "Create Goal",
|
82
83
|
size: "small",
|
83
|
-
onClick:
|
84
|
+
onClick: q,
|
84
85
|
disabled: !m
|
85
86
|
}
|
86
87
|
),
|
87
|
-
/* @__PURE__ */ n(u, { label: "Add Milestone", size: "small", onClick:
|
88
|
+
/* @__PURE__ */ n(u, { label: "Add Milestone", size: "small", onClick: K })
|
88
89
|
] })
|
89
90
|
] }),
|
90
91
|
s === "INACTIVE" && !!e.length && /* @__PURE__ */ t(
|
@@ -100,25 +101,25 @@ const Ne = ne(
|
|
100
101
|
e.length,
|
101
102
|
")"
|
102
103
|
] }),
|
103
|
-
/* @__PURE__ */ n(
|
104
|
+
/* @__PURE__ */ n(le, { onClick: J, $expanded: a })
|
104
105
|
]
|
105
106
|
}
|
106
107
|
),
|
107
|
-
(
|
108
|
-
const { id:
|
109
|
-
return /* @__PURE__ */ t(
|
108
|
+
(A || l || a) && e.map((o, Z) => {
|
109
|
+
const { id: ee } = o;
|
110
|
+
return /* @__PURE__ */ t(ne.Fragment, { children: [
|
110
111
|
/* @__PURE__ */ n(
|
111
|
-
|
112
|
+
ae,
|
112
113
|
{
|
113
114
|
milestone: o,
|
114
115
|
studentId: M,
|
115
116
|
studentName: p,
|
116
|
-
parentName:
|
117
|
+
parentName: H,
|
117
118
|
teacherName: X,
|
118
119
|
userType: d,
|
119
120
|
onAddOutcome: i,
|
120
121
|
onChapterClick: w,
|
121
|
-
isMilestoneActive: l ||
|
122
|
+
isMilestoneActive: l || A,
|
122
123
|
milestoneType: s,
|
123
124
|
onEdit: D,
|
124
125
|
onCreateMilestoneTest: P,
|
@@ -130,26 +131,27 @@ const Ne = ne(
|
|
130
131
|
onAssignResources: j,
|
131
132
|
onNodeAttempt: S,
|
132
133
|
onNodeView: b,
|
133
|
-
onNodeReview:
|
134
|
-
onNodeReattempt:
|
134
|
+
onNodeReview: k,
|
135
|
+
onNodeReattempt: F,
|
135
136
|
onNodeReset: B,
|
136
137
|
onNodeUnassign: V,
|
138
|
+
onNodeAssignAsHomework: W,
|
137
139
|
onTestPreview: G,
|
138
140
|
onTestReview: L,
|
139
141
|
onTestStart: O,
|
140
|
-
courseStream:
|
142
|
+
courseStream: U,
|
141
143
|
activeMilestoneId: _,
|
142
144
|
activeTabId: y,
|
143
145
|
onWidgetTabSelection: z
|
144
146
|
}
|
145
147
|
),
|
146
|
-
|
147
|
-
] }, `milestone=${
|
148
|
+
Z !== e.length - 1 && /* @__PURE__ */ n(se, { heightX: 2 })
|
149
|
+
] }, `milestone=${ee}`);
|
148
150
|
})
|
149
151
|
] });
|
150
152
|
}
|
151
153
|
);
|
152
154
|
export {
|
153
|
-
|
155
|
+
Te as default
|
154
156
|
};
|
155
157
|
//# sourceMappingURL=milestone-list.js.map
|
package/dist/features/milestone/milestone-list-container/milestone-list/milestone-list.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"milestone-list.js","sources":["../../../../../src/features/milestone/milestone-list-container/milestone-list/milestone-list.tsx"],"sourcesContent":["import type { IMilestoneListProps } from './milestone-list-types';\n\nimport React, { memo, useCallback, useState } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport useLazyRef from '../../../hooks/use-lazy-ref';\nimport TextButton from '../../../ui/buttons/text-button/text-button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport MilestoneWidget from './milestone-widget/milestone-widget';\nimport { StyledDownIcon } from './milestone-widget/milestone-widget-styled';\nimport NoActiveMilestone from './no-active-milestone/no-active-milestone';\n\nconst MilestoneList: React.FC<IMilestoneListProps> = memo(\n ({ milestones, studentId, milestoneType, ...restMilestoneListProps }) => {\n const [expandInactiveMilestones, setExpandInactiveMilestones] = useState(false);\n const {\n canCreatePlan,\n isClassOngoing,\n isFiltersAdded,\n isStudentPresent,\n onAddChapter,\n onAddOutcome,\n onChapterClick,\n onCreatePlan,\n onDelete,\n onDraftPublish,\n onEdit,\n onExpandPastMilestones,\n onCreateMilestoneTest,\n onNodeAttempt,\n onNodeView,\n onNodeReview,\n onNodeReattempt,\n onNodeReset,\n onNodeUnassign,\n onAssignResources,\n onTestPreview,\n onTestReview,\n onTestStart,\n activeMilestoneId,\n activeTabId,\n onWidgetTabSelection,\n studentName,\n teacherName,\n parentName,\n userType,\n courseStream,\n } = restMilestoneListProps;\n\n const isMilestoneActive = milestoneType === 'ACTIVE';\n const isDraftMilestone = milestoneType === 'DRAFT';\n const temporaryMilestoneId = useLazyRef(uuidv4);\n\n const handleCreatePlan = useCallback(() => {\n onCreatePlan?.(temporaryMilestoneId);\n }, [onCreatePlan, temporaryMilestoneId]);\n\n const toggleExpand = () => {\n if (!expandInactiveMilestones && onExpandPastMilestones) {\n onExpandPastMilestones();\n }\n setExpandInactiveMilestones(!expandInactiveMilestones);\n };\n\n const handleOnAddOutcome = useCallback(() => {\n onAddOutcome?.();\n }, [onAddOutcome]);\n\n if (!milestones) return null;\n\n const activeMilestonePresent = milestones.some(\n milestone => milestone.milestone_state === 'ACTIVE',\n );\n const draftMilestonePresent = milestones.some(\n milestone => milestone.milestone_state === 'DRAFT',\n );\n\n return (\n <>\n {isMilestoneActive && !activeMilestonePresent && (\n <FlexView $marginBottom={40}>\n <NoActiveMilestone\n canCreatePlan={canCreatePlan}\n isDraftMilestonePresent={draftMilestonePresent}\n isFiltersAdded={isFiltersAdded}\n onCreatePlan={onCreatePlan}\n studentName={studentName}\n userType={userType}\n />\n </FlexView>\n )}\n\n {isMilestoneActive && (\n <FlexView $flexDirection=\"row\" $justifyContent=\"space-between\" $marginBottom={16}>\n <Text $renderAs=\"ac4\">Goals ({milestones.length})</Text>\n\n {userType === 'TEACHER' && (\n <FlexView $flexDirection=\"row\" $flexGapX={1}>\n <TextButton\n label=\"Create Goal\"\n size=\"small\"\n onClick={handleCreatePlan}\n disabled={!canCreatePlan}\n />\n <TextButton label=\"Add Milestone\" size=\"small\" onClick={handleOnAddOutcome} />\n </FlexView>\n )}\n </FlexView>\n )}\n\n {milestoneType === 'INACTIVE' && Boolean(milestones.length) && (\n <FlexView\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $justifyContent=\"space-between\"\n $marginBottomX={1}\n >\n <Text $renderAs=\"ac4\">PAST LEARNING PLANS & OUTCOMES ({milestones.length})</Text>\n <StyledDownIcon onClick={toggleExpand} $expanded={expandInactiveMilestones} />\n </FlexView>\n )}\n\n {(isDraftMilestone || isMilestoneActive || expandInactiveMilestones) &&\n milestones.map((milestone, idx) => {\n const { id: milestoneId } = milestone;\n\n return (\n <React.Fragment key={`milestone=${milestoneId}`}>\n <MilestoneWidget\n milestone={milestone}\n studentId={studentId}\n studentName={studentName}\n parentName={parentName}\n teacherName={teacherName}\n userType={userType}\n onAddOutcome={onAddOutcome}\n onChapterClick={onChapterClick}\n isMilestoneActive={isMilestoneActive || isDraftMilestone}\n milestoneType={milestoneType}\n onEdit={onEdit}\n onCreateMilestoneTest={onCreateMilestoneTest}\n onAddChapter={onAddChapter}\n onDelete={onDelete}\n onDraftPublish={onDraftPublish}\n isClassOngoing={isClassOngoing}\n isStudentPresent={isStudentPresent}\n onAssignResources={onAssignResources}\n onNodeAttempt={onNodeAttempt}\n onNodeView={onNodeView}\n onNodeReview={onNodeReview}\n onNodeReattempt={onNodeReattempt}\n onNodeReset={onNodeReset}\n onNodeUnassign={onNodeUnassign}\n onTestPreview={onTestPreview}\n onTestReview={onTestReview}\n onTestStart={onTestStart}\n courseStream={courseStream}\n activeMilestoneId={activeMilestoneId}\n activeTabId={activeTabId}\n onWidgetTabSelection={onWidgetTabSelection}\n />\n {idx !== milestones.length - 1 && <Separator heightX={2} />}\n </React.Fragment>\n );\n })}\n </>\n );\n },\n);\n\nexport default MilestoneList;\n"],"names":["MilestoneList","memo","milestones","studentId","milestoneType","restMilestoneListProps","expandInactiveMilestones","setExpandInactiveMilestones","useState","canCreatePlan","isClassOngoing","isFiltersAdded","isStudentPresent","onAddChapter","onAddOutcome","onChapterClick","onCreatePlan","onDelete","onDraftPublish","onEdit","onExpandPastMilestones","onCreateMilestoneTest","onNodeAttempt","onNodeView","onNodeReview","onNodeReattempt","onNodeReset","onNodeUnassign","onAssignResources","onTestPreview","onTestReview","onTestStart","activeMilestoneId","activeTabId","onWidgetTabSelection","studentName","teacherName","parentName","userType","courseStream","isMilestoneActive","isDraftMilestone","temporaryMilestoneId","useLazyRef","uuidv4","handleCreatePlan","useCallback","toggleExpand","handleOnAddOutcome","activeMilestonePresent","milestone","draftMilestonePresent","jsxs","Fragment","jsx","FlexView","NoActiveMilestone","Text","TextButton","StyledDownIcon","idx","milestoneId","React","MilestoneWidget","Separator"],"mappings":";;;;;;;;;;;AAcA,MAAMA,KAA+CC;AAAA,EACnD,CAAC,EAAE,YAAAC,GAAY,WAAAC,GAAW,eAAAC,GAAe,GAAGC,QAA6B;AACvE,UAAM,CAACC,GAA0BC,CAA2B,IAAIC,GAAS,EAAK,GACxE;AAAA,MACJ,eAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,cAAAC;AAAA,MACA,cAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,cAAAC;AAAA,MACA,UAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,QAAAC;AAAA,MACA,wBAAAC;AAAA,MACA,uBAAAC;AAAA,MACA,eAAAC;AAAA,MACA,YAAAC;AAAA,MACA,cAAAC;AAAA,MACA,iBAAAC;AAAA,MACA,aAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,eAAAC;AAAA,MACA,cAAAC;AAAA,MACA,aAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,aAAAC;AAAA,MACA,sBAAAC;AAAA,MACA,aAAAC;AAAA,MACA,aAAAC;AAAA,MACA,YAAAC;AAAA,MACA,UAAAC;AAAA,MACA,cAAAC;AAAA,IACE,IAAAlC,GAEEmC,IAAoBpC,MAAkB,UACtCqC,IAAmBrC,MAAkB,SACrCsC,IAAuBC,GAAWC,EAAM,GAExCC,IAAmBC,EAAY,MAAM;AACzC,MAAA9B,KAAA,QAAAA,EAAe0B;AAAA,IAAoB,GAClC,CAAC1B,GAAc0B,CAAoB,CAAC,GAEjCK,IAAe,MAAM;AACrB,MAAA,CAACzC,KAA4Bc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EAAU,SAAS,GAAG;AAAA,QAlCtC,EAAA,GAAA,aAAaH,CAAW,EAmC7C;AAAA,MAAA,CAEH;AAAA,IACL,EAAA,CAAA;AAAA,EAEJ;AACF;"}
|
1
|
+
{"version":3,"file":"milestone-list.js","sources":["../../../../../src/features/milestone/milestone-list-container/milestone-list/milestone-list.tsx"],"sourcesContent":["import type { IMilestoneListProps } from './milestone-list-types';\n\nimport React, { memo, useCallback, useState } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport useLazyRef from '../../../hooks/use-lazy-ref';\nimport TextButton from '../../../ui/buttons/text-button/text-button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport MilestoneWidget from './milestone-widget/milestone-widget';\nimport { StyledDownIcon } from './milestone-widget/milestone-widget-styled';\nimport NoActiveMilestone from './no-active-milestone/no-active-milestone';\n\nconst MilestoneList: React.FC<IMilestoneListProps> = memo(\n ({ milestones, studentId, milestoneType, ...restMilestoneListProps }) => {\n const [expandInactiveMilestones, setExpandInactiveMilestones] = useState(false);\n const {\n canCreatePlan,\n isClassOngoing,\n isFiltersAdded,\n isStudentPresent,\n onAddChapter,\n onAddOutcome,\n onChapterClick,\n onCreatePlan,\n onDelete,\n onDraftPublish,\n onEdit,\n onExpandPastMilestones,\n onCreateMilestoneTest,\n onNodeAttempt,\n onNodeView,\n onNodeReview,\n onNodeReattempt,\n onNodeReset,\n onNodeUnassign,\n onAssignResources,\n onTestPreview,\n onTestReview,\n onTestStart,\n activeMilestoneId,\n activeTabId,\n onWidgetTabSelection,\n studentName,\n teacherName,\n parentName,\n userType,\n courseStream,\n onNodeAssignAsHomework,\n } = restMilestoneListProps;\n\n const isMilestoneActive = milestoneType === 'ACTIVE';\n const isDraftMilestone = milestoneType === 'DRAFT';\n const temporaryMilestoneId = useLazyRef(uuidv4);\n\n const handleCreatePlan = useCallback(() => {\n onCreatePlan?.(temporaryMilestoneId);\n }, [onCreatePlan, temporaryMilestoneId]);\n\n const toggleExpand = () => {\n if (!expandInactiveMilestones && onExpandPastMilestones) {\n onExpandPastMilestones();\n }\n setExpandInactiveMilestones(!expandInactiveMilestones);\n };\n\n const handleOnAddOutcome = useCallback(() => {\n onAddOutcome?.();\n }, [onAddOutcome]);\n\n if (!milestones) return null;\n\n const activeMilestonePresent = milestones.some(\n milestone => milestone.milestone_state === 'ACTIVE',\n );\n const draftMilestonePresent = milestones.some(\n milestone => milestone.milestone_state === 'DRAFT',\n );\n\n return (\n <>\n {isMilestoneActive && !activeMilestonePresent && (\n <FlexView $marginBottom={40}>\n <NoActiveMilestone\n canCreatePlan={canCreatePlan}\n isDraftMilestonePresent={draftMilestonePresent}\n isFiltersAdded={isFiltersAdded}\n onCreatePlan={onCreatePlan}\n studentName={studentName}\n userType={userType}\n />\n </FlexView>\n )}\n\n {isMilestoneActive && (\n <FlexView $flexDirection=\"row\" $justifyContent=\"space-between\" $marginBottom={16}>\n <Text $renderAs=\"ac4\">Goals ({milestones.length})</Text>\n\n {userType === 'TEACHER' && (\n <FlexView $flexDirection=\"row\" $flexGapX={1}>\n <TextButton\n label=\"Create Goal\"\n size=\"small\"\n onClick={handleCreatePlan}\n disabled={!canCreatePlan}\n />\n <TextButton label=\"Add Milestone\" size=\"small\" onClick={handleOnAddOutcome} />\n </FlexView>\n )}\n </FlexView>\n )}\n\n {milestoneType === 'INACTIVE' && Boolean(milestones.length) && (\n <FlexView\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $justifyContent=\"space-between\"\n $marginBottomX={1}\n >\n <Text $renderAs=\"ac4\">PAST LEARNING PLANS & OUTCOMES ({milestones.length})</Text>\n <StyledDownIcon onClick={toggleExpand} $expanded={expandInactiveMilestones} />\n </FlexView>\n )}\n\n {(isDraftMilestone || isMilestoneActive || expandInactiveMilestones) &&\n milestones.map((milestone, idx) => {\n const { id: milestoneId } = milestone;\n\n return (\n <React.Fragment key={`milestone=${milestoneId}`}>\n <MilestoneWidget\n milestone={milestone}\n studentId={studentId}\n studentName={studentName}\n parentName={parentName}\n teacherName={teacherName}\n userType={userType}\n onAddOutcome={onAddOutcome}\n onChapterClick={onChapterClick}\n isMilestoneActive={isMilestoneActive || isDraftMilestone}\n milestoneType={milestoneType}\n onEdit={onEdit}\n onCreateMilestoneTest={onCreateMilestoneTest}\n onAddChapter={onAddChapter}\n onDelete={onDelete}\n onDraftPublish={onDraftPublish}\n isClassOngoing={isClassOngoing}\n isStudentPresent={isStudentPresent}\n onAssignResources={onAssignResources}\n onNodeAttempt={onNodeAttempt}\n onNodeView={onNodeView}\n onNodeReview={onNodeReview}\n onNodeReattempt={onNodeReattempt}\n onNodeReset={onNodeReset}\n onNodeUnassign={onNodeUnassign}\n onNodeAssignAsHomework={onNodeAssignAsHomework}\n onTestPreview={onTestPreview}\n onTestReview={onTestReview}\n onTestStart={onTestStart}\n courseStream={courseStream}\n activeMilestoneId={activeMilestoneId}\n activeTabId={activeTabId}\n onWidgetTabSelection={onWidgetTabSelection}\n />\n {idx !== milestones.length - 1 && <Separator heightX={2} />}\n </React.Fragment>\n );\n })}\n </>\n );\n },\n);\n\nexport default MilestoneList;\n"],"names":["MilestoneList","memo","milestones","studentId","milestoneType","restMilestoneListProps","expandInactiveMilestones","setExpandInactiveMilestones","useState","canCreatePlan","isClassOngoing","isFiltersAdded","isStudentPresent","onAddChapter","onAddOutcome","onChapterClick","onCreatePlan","onDelete","onDraftPublish","onEdit","onExpandPastMilestones","onCreateMilestoneTest","onNodeAttempt","onNodeView","onNodeReview","onNodeReattempt","onNodeReset","onNodeUnassign","onAssignResources","onTestPreview","onTestReview","onTestStart","activeMilestoneId","activeTabId","onWidgetTabSelection","studentName","teacherName","parentName","userType","courseStream","onNodeAssignAsHomework","isMilestoneActive","isDraftMilestone","temporaryMilestoneId","useLazyRef","uuidv4","handleCreatePlan","useCallback","toggleExpand","handleOnAddOutcome","activeMilestonePresent","milestone","draftMilestonePresent","jsxs","Fragment","jsx","FlexView","NoActiveMilestone","Text","TextButton","StyledDownIcon","idx","milestoneId","React","MilestoneWidget","Separator"],"mappings":";;;;;;;;;;;AAcA,MAAMA,KAA+CC;AAAA,EACnD,CAAC,EAAE,YAAAC,GAAY,WAAAC,GAAW,eAAAC,GAAe,GAAGC,QAA6B;AACvE,UAAM,CAACC,GAA0BC,CAA2B,IAAIC,GAAS,EAAK,GACxE;AAAA,MACJ,eAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,cAAAC;AAAA,MACA,cAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,cAAAC;AAAA,MACA,UAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,QAAAC;AAAA,MACA,wBAAAC;AAAA,MACA,uBAAAC;AAAA,MACA,eAAAC;AAAA,MACA,YAAAC;AAAA,MACA,cAAAC;AAAA,MACA,iBAAAC;AAAA,MACA,aAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,eAAAC;AAAA,MACA,cAAAC;AAAA,MACA,aAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,aAAAC;AAAA,MACA,sBAAAC;AAAA,MACA,aAAAC;AAAA,MACA,aAAAC;AAAA,MACA,YAAAC;AAAA,MACA,UAAAC;AAAA,MACA,cAAAC;AAAA,MACA,wBAAAC;AAAA,IACE,IAAAnC,GAEEoC,IAAoBrC,MAAkB,UACtCsC,IAAmBtC,MAAkB,SACrCuC,IAAuBC,GAAWC,EAAM,GAExCC,IAAmBC,EAAY,MAAM;AACzC,MAAA/B,KAAA,QAAAA,EAAe2B;AAAA,IAAoB,GAClC,CAAC3B,GAAc2B,CAAoB,CAAC,GAEjCK,IAAe,MAAM;AACrB,MAAA,CAAC1C,KAA4Bc,KACRA,KAEzBb,EAA4B,CAACD,CAAwB;AAAA,IAAA,GAGjD2C,IAAqBF,EAAY,MAAM;AAC5B,MAAAjC,KAAA,QAAAA;AAAA,IAAA,GACd,CAACA,CAAY,CAAC;AAE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