@cuemath/leap 2.9.3 → 2.9.4-as2
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/assets/illustrations/illustrations.js +9 -0
- package/dist/assets/illustrations/illustrations.js.map +1 -1
- package/dist/assets/line-icons/icons/alarm.js +41 -0
- package/dist/assets/line-icons/icons/alarm.js.map +1 -0
- package/dist/assets/line-icons/icons/bin2.js +7 -8
- package/dist/assets/line-icons/icons/bin2.js.map +1 -1
- package/dist/assets/line-icons/icons/chevron-left.js.map +1 -1
- package/dist/assets/line-icons/icons/dart.js +23 -0
- package/dist/assets/line-icons/icons/dart.js.map +1 -0
- package/dist/assets/line-icons/icons/exclamation.js +26 -0
- package/dist/assets/line-icons/icons/exclamation.js.map +1 -0
- package/dist/assets/line-icons/icons/home2.js +25 -0
- package/dist/assets/line-icons/icons/home2.js.map +1 -0
- package/dist/assets/line-icons/icons/important.js +23 -0
- package/dist/assets/line-icons/icons/important.js.map +1 -0
- package/dist/assets/line-icons/icons/puzzle.js +25 -0
- package/dist/assets/line-icons/icons/puzzle.js.map +1 -0
- package/dist/assets/line-icons/icons/recap.js +32 -0
- package/dist/assets/line-icons/icons/recap.js.map +1 -0
- package/dist/assets/line-icons/icons/skip-colored.js +43 -0
- package/dist/assets/line-icons/icons/skip-colored.js.map +1 -0
- package/dist/assets/line-icons/icons/status.js +41 -0
- package/dist/assets/line-icons/icons/status.js.map +1 -0
- package/dist/assets/line-icons/icons/testtube.js +33 -0
- package/dist/assets/line-icons/icons/testtube.js.map +1 -0
- package/dist/assets/lottie/lottie.js +9 -1
- package/dist/assets/lottie/lottie.js.map +1 -1
- package/dist/constants/api.js +3 -2
- package/dist/constants/api.js.map +1 -1
- package/dist/features/chapters/chapters-list/chapter-item/chapter-item-styled.js +99 -33
- 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 +92 -49
- package/dist/features/chapters/chapters-list/chapter-item/chapter-item.js.map +1 -1
- package/dist/features/chapters/chapters-list/chapters-list-styled.js +5 -5
- package/dist/features/chapters/chapters-list/chapters-list-styled.js.map +1 -1
- package/dist/features/chapters/chapters-list/chapters-list.js +64 -70
- package/dist/features/chapters/chapters-list/chapters-list.js.map +1 -1
- package/dist/features/chapters-v2/api/chapter.js +10 -0
- package/dist/features/chapters-v2/api/chapter.js.map +1 -0
- package/dist/features/chapters-v2/chapter-details/block-sections/block-section-view.js +112 -0
- package/dist/features/chapters-v2/chapter-details/block-sections/block-section-view.js.map +1 -0
- package/dist/features/chapters-v2/chapter-details/block-sections/block-sections-styled.js +26 -0
- package/dist/features/chapters-v2/chapter-details/block-sections/block-sections-styled.js.map +1 -0
- package/dist/features/chapters-v2/chapter-details/block-sections/block-sections.js +73 -0
- package/dist/features/chapters-v2/chapter-details/block-sections/block-sections.js.map +1 -0
- package/dist/features/chapters-v2/chapter-details/chapter-banner/chapter-banner-styled.js +90 -0
- package/dist/features/chapters-v2/chapter-details/chapter-banner/chapter-banner-styled.js.map +1 -0
- package/dist/features/chapters-v2/chapter-details/chapter-banner/chapter-banner.js +97 -0
- package/dist/features/chapters-v2/chapter-details/chapter-banner/chapter-banner.js.map +1 -0
- package/dist/features/chapters-v2/chapter-details/chapter-details-styled.js +52 -0
- package/dist/features/chapters-v2/chapter-details/chapter-details-styled.js.map +1 -0
- package/dist/features/chapters-v2/chapter-details/chapter-details.js +103 -0
- package/dist/features/chapters-v2/chapter-details/chapter-details.js.map +1 -0
- package/dist/features/chapters-v2/comps/node-card/border-path-animation.js +13 -0
- package/dist/features/chapters-v2/comps/node-card/border-path-animation.js.map +1 -0
- package/dist/features/chapters-v2/comps/node-card/node-card-styled.js +153 -0
- package/dist/features/chapters-v2/comps/node-card/node-card-styled.js.map +1 -0
- package/dist/features/chapters-v2/comps/node-card/node-card-tags.js +16 -0
- package/dist/features/chapters-v2/comps/node-card/node-card-tags.js.map +1 -0
- package/dist/features/chapters-v2/comps/node-card/node-card.js +12 -0
- package/dist/features/chapters-v2/comps/node-card/node-card.js.map +1 -0
- package/dist/features/chapters-v2/comps/node-card/node-menu-options/node-menu-options-styled.js +32 -0
- package/dist/features/chapters-v2/comps/node-card/node-menu-options/node-menu-options-styled.js.map +1 -0
- package/dist/features/chapters-v2/comps/node-card/node-menu-options/node-menu-options.js +31 -0
- package/dist/features/chapters-v2/comps/node-card/node-menu-options/node-menu-options.js.map +1 -0
- package/dist/features/chapters-v2/comps/node-card/student-actions/student-actions.js +171 -0
- package/dist/features/chapters-v2/comps/node-card/student-actions/student-actions.js.map +1 -0
- package/dist/features/chapters-v2/comps/node-card/teacher-actions/teacher-actions.js +192 -0
- package/dist/features/chapters-v2/comps/node-card/teacher-actions/teacher-actions.js.map +1 -0
- package/dist/features/chapters-v2/comps/tag/tag-styled.js +13 -0
- package/dist/features/chapters-v2/comps/tag/tag-styled.js.map +1 -0
- package/dist/features/chapters-v2/comps/tag/tag.js +28 -0
- package/dist/features/chapters-v2/comps/tag/tag.js.map +1 -0
- package/dist/features/chapters-v2/constants/block-constants.js +20 -0
- package/dist/features/chapters-v2/constants/block-constants.js.map +1 -0
- package/dist/features/chapters-v2/constants/node-constants.js +14 -0
- package/dist/features/chapters-v2/constants/node-constants.js.map +1 -0
- package/dist/features/chapters-v2/utils/index.js +41 -0
- package/dist/features/chapters-v2/utils/index.js.map +1 -0
- package/dist/features/chapters-v2/utils/node-card-utils.js +144 -0
- package/dist/features/chapters-v2/utils/node-card-utils.js.map +1 -0
- package/dist/features/communication/pub-sub/constants.js +5 -2
- package/dist/features/communication/pub-sub/constants.js.map +1 -1
- package/dist/features/homework/card-menu-options.js +38 -0
- package/dist/features/homework/card-menu-options.js.map +1 -0
- package/dist/features/homework/card-title.js +15 -0
- package/dist/features/homework/card-title.js.map +1 -0
- package/dist/features/homework/homework-card-view.js +131 -0
- package/dist/features/homework/homework-card-view.js.map +1 -0
- package/dist/features/homework/homework-card.js +205 -0
- package/dist/features/homework/homework-card.js.map +1 -0
- package/dist/features/homework/hw-card-list/api/get-homeworks.js +10 -0
- package/dist/features/homework/hw-card-list/api/get-homeworks.js.map +1 -0
- package/dist/features/homework/hw-card-list/hw-card-list-styled.js +71 -0
- package/dist/features/homework/hw-card-list/hw-card-list-styled.js.map +1 -0
- package/dist/features/homework/hw-card-list/hw-card-list.js +199 -0
- package/dist/features/homework/hw-card-list/hw-card-list.js.map +1 -0
- package/dist/features/homework/node-progress.js +29 -0
- package/dist/features/homework/node-progress.js.map +1 -0
- package/dist/features/homework/styles.js +130 -0
- package/dist/features/homework/styles.js.map +1 -0
- package/dist/features/journey/comps/coachmark/coachmark-styled.js +12 -5
- package/dist/features/journey/comps/coachmark/coachmark-styled.js.map +1 -1
- package/dist/features/journey/comps/coachmark/coachmark.js +24 -24
- package/dist/features/journey/comps/coachmark/coachmark.js.map +1 -1
- package/dist/features/journey/hooks/use-home-page-journey.js +145 -0
- package/dist/features/journey/hooks/use-home-page-journey.js.map +1 -0
- package/dist/features/journey/journey-id/journey-id-student.js +1 -1
- package/dist/features/journey/journey-id/journey-id-student.js.map +1 -1
- package/dist/features/journey/use-journey/journey-context-provider.js +36 -28
- package/dist/features/journey/use-journey/journey-context-provider.js.map +1 -1
- package/dist/features/journey/use-journey/journey-styled.js +10 -5
- package/dist/features/journey/use-journey/journey-styled.js.map +1 -1
- package/dist/features/milestone/create/api/goal-submit.js +1 -1
- package/dist/features/milestone/create/api/goal-submit.js.map +1 -1
- package/dist/features/milestone/create/comps/chapter-item/chapter-item.js +42 -49
- package/dist/features/milestone/create/comps/chapter-item/chapter-item.js.map +1 -1
- package/dist/features/milestone/create/comps/chapters-selection-step/chapters-selection-step-styled.js +12 -4
- package/dist/features/milestone/create/comps/chapters-selection-step/chapters-selection-step-styled.js.map +1 -1
- package/dist/features/milestone/create/comps/chapters-selection-step/chapters-selection-step.js +128 -105
- package/dist/features/milestone/create/comps/chapters-selection-step/chapters-selection-step.js.map +1 -1
- package/dist/features/milestone/create/comps/sheets-list/sheets-list-styled.js +14 -20
- package/dist/features/milestone/create/comps/sheets-list/sheets-list-styled.js.map +1 -1
- package/dist/features/milestone/create/comps/sheets-list/sheets-list.js +26 -50
- package/dist/features/milestone/create/comps/sheets-list/sheets-list.js.map +1 -1
- package/dist/features/milestone/create/milestone-create.js +49 -43
- package/dist/features/milestone/create/milestone-create.js.map +1 -1
- package/dist/features/milestone/create/utils/index.js +33 -38
- package/dist/features/milestone/create/utils/index.js.map +1 -1
- package/dist/features/milestone/edit/comps/edit-milestone-modal/api/get-milestone.js +1 -1
- package/dist/features/milestone/edit/comps/edit-milestone-modal/api/get-milestone.js.map +1 -1
- package/dist/features/milestone/edit/comps/edit-milestone-modal/api/patch-goal-plan.js +1 -1
- package/dist/features/milestone/edit/comps/edit-milestone-modal/api/patch-goal-plan.js.map +1 -1
- package/dist/features/milestone/edit/comps/edit-milestone-modal/index.js +51 -53
- package/dist/features/milestone/edit/comps/edit-milestone-modal/index.js.map +1 -1
- package/dist/features/milestone/edit/goal-drafts/goal-draft-edit-container.js +42 -40
- package/dist/features/milestone/edit/goal-drafts/goal-draft-edit-container.js.map +1 -1
- package/dist/features/milestone/edit/goal-edit-container.js +64 -62
- package/dist/features/milestone/edit/goal-edit-container.js.map +1 -1
- package/dist/features/milestone/edit/goal-edit-helpers.js +50 -53
- package/dist/features/milestone/edit/goal-edit-helpers.js.map +1 -1
- package/dist/features/milestone/edit/milestone-edit-container.js +54 -52
- package/dist/features/milestone/edit/milestone-edit-container.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/api/get-milestone-resources.js +1 -1
- package/dist/features/milestone/milestone-list-container/api/get-milestone-resources.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/api/get-milestones.js +9 -17
- package/dist/features/milestone/milestone-list-container/api/get-milestones.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/api/get-tests-list.js +1 -1
- package/dist/features/milestone/milestone-list-container/api/get-tests-list.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-list.js +136 -104
- 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/goals/goal-action-ctas.js +107 -123
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/goals/goal-action-ctas.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-info.js +155 -175
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-info.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-tabs/milestone-tabs-styled.js +24 -10
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-tabs/milestone-tabs-styled.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-tabs/milestone-tabs.js +80 -86
- 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-utils.js +10 -22
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-utils.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget-styled.js +70 -37
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget-styled.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget.js +114 -176
- 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/milestone-widget/outcome/outcome-rank.js +29 -16
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/outcome/outcome-rank.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/outcome/outcome-styled.js +19 -23
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/outcome/outcome-styled.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/outcome/outcome.js +23 -35
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/outcome/outcome.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list-container.js +96 -100
- package/dist/features/milestone/milestone-list-container/milestone-list-container.js.map +1 -1
- package/dist/features/milestone/milestone-resources/resources-list/resources-list-styled.js +1 -1
- package/dist/features/milestone/milestone-resources/resources-list/resources-list-styled.js.map +1 -1
- package/dist/features/milestone/milestone-resources/resources-list/resources-list.js +114 -112
- 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 +165 -0
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-container.js.map +1 -0
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-view-styled.js +25 -0
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-view-styled.js.map +1 -0
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-view.js +85 -0
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-view.js.map +1 -0
- package/dist/features/milestone/milestone-tests/tests-creation/tests-creation.js +16 -18
- package/dist/features/milestone/milestone-tests/tests-creation/tests-creation.js.map +1 -1
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-utils.js +6 -34
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-utils.js.map +1 -1
- package/dist/features/recent-chapters/api/get-recent-chapters.js +9 -0
- package/dist/features/recent-chapters/api/get-recent-chapters.js.map +1 -0
- package/dist/features/recent-chapters/recent-chapters-styled.js +16 -0
- package/dist/features/recent-chapters/recent-chapters-styled.js.map +1 -0
- package/dist/features/recent-chapters/recent-chapters.js +85 -0
- package/dist/features/recent-chapters/recent-chapters.js.map +1 -0
- package/dist/features/sheet-v2/resource-list/resource-list.js +39 -0
- package/dist/features/sheet-v2/resource-list/resource-list.js.map +1 -0
- package/dist/features/sheets/resources-list/resource-item/styled.js +1 -1
- package/dist/features/sheets/resources-list/resource-item/styled.js.map +1 -1
- package/dist/features/sheets/sheets-list/sheet-item/reward-n-actions/teacher-actions/teacher-actions-constant.js +4 -3
- package/dist/features/sheets/sheets-list/sheet-item/reward-n-actions/teacher-actions/teacher-actions-constant.js.map +1 -1
- package/dist/features/trial-session/api/trial-pricing.js +1 -1
- package/dist/features/trial-session/api/trial-pricing.js.map +1 -1
- package/dist/features/trial-session/comps/offering-information/offering-information.js +21 -21
- package/dist/features/trial-session/comps/offering-information/offering-information.js.map +1 -1
- package/dist/features/trial-session/comps/pricing/pricing-cards.js +144 -0
- package/dist/features/trial-session/comps/pricing/pricing-cards.js.map +1 -0
- package/dist/features/trial-session/comps/pricing/pricing.js +51 -128
- package/dist/features/trial-session/comps/pricing/pricing.js.map +1 -1
- package/dist/features/ui/arrow-tooltip/arrow-tooltip.js +30 -29
- package/dist/features/ui/arrow-tooltip/arrow-tooltip.js.map +1 -1
- package/dist/features/ui/constants/z-index.js +1 -1
- package/dist/features/ui/constants/z-index.js.map +1 -1
- package/dist/features/ui/context-menu/context-menu-styled.js +28 -14
- package/dist/features/ui/context-menu/context-menu-styled.js.map +1 -1
- package/dist/features/ui/context-menu/context-menu.js +30 -15
- package/dist/features/ui/context-menu/context-menu.js.map +1 -1
- package/dist/features/ui/theme/button.js +22 -107
- package/dist/features/ui/theme/button.js.map +1 -1
- package/dist/index.d.ts +299 -32
- package/dist/index.js +498 -470
- package/dist/index.js.map +1 -1
- package/dist/node_modules/date-fns/differenceInDays.js +17 -0
- package/dist/node_modules/date-fns/differenceInDays.js.map +1 -0
- package/dist/static/chapter-header-bg-2.c8d96894.svg +1 -0
- package/dist/static/competitive-arena.b9c40801.json +1 -0
- package/dist/static/learn.71b13323.json +1 -0
- package/dist/static/node-custom-test-bg.d3b757be.svg +1 -0
- package/dist/static/node-learn-bg.b61f815c.svg +1 -0
- package/dist/static/node-practice-bg.16cbaf2a.svg +1 -0
- package/dist/static/node-project-bg.e6a33e28.svg +1 -0
- package/dist/static/node-puzzle-bg.3422135c.svg +1 -0
- package/dist/static/node-recap-bg.546154e4.svg +1 -0
- package/dist/static/node-test-prep-bg.42c0b9c4.svg +1 -0
- package/dist/static/node-video-bg.3df3f73a.svg +1 -0
- package/dist/static/practice.158dd488.json +1 -0
- package/dist/static/project.eb665827.json +1 -0
- package/dist/static/puzzle.b298c7e4.json +1 -0
- package/dist/static/recap.0dd2c1e2.json +1 -0
- package/dist/static/test.803d6036.json +1 -0
- package/dist/static/video.b41451e2.json +1 -0
- package/package.json +1 -1
- package/dist/features/milestone/create/comps/milestone-progress-v2/milestone-progress-v2.js +0 -92
- package/dist/features/milestone/create/comps/milestone-progress-v2/milestone-progress-v2.js.map +0 -1
- package/dist/features/milestone/create/comps/milestone-progress-v2/styled.js +0 -25
- package/dist/features/milestone/create/comps/milestone-progress-v2/styled.js.map +0 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/context-menu-helper/menu-element-styled.js +0 -13
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/context-menu-helper/menu-element-styled.js.map +0 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/context-menu-helper/menu-element.js +0 -38
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/context-menu-helper/menu-element.js.map +0 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget-status.js +0 -53
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget-status.js.map +0 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/outcome/outcome-info.js +0 -25
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/outcome/outcome-info.js.map +0 -1
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-cta.js +0 -71
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-cta.js.map +0 -1
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-styled.js +0 -31
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-styled.js.map +0 -1
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item.js +0 -79
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item.js.map +0 -1
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheets-list-styled.js +0 -18
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheets-list-styled.js.map +0 -1
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheets-list.js +0 -51
- package/dist/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheets-list.js.map +0 -1
- package/dist/features/milestone/milestone-tests/tests-list/tests-list-styled.js +0 -11
- package/dist/features/milestone/milestone-tests/tests-list/tests-list-styled.js.map +0 -1
- package/dist/features/milestone/milestone-tests/tests-list/tests-list.js +0 -135
- package/dist/features/milestone/milestone-tests/tests-list/tests-list.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"resources-list.js","sources":["../../../../../src/features/milestone/milestone-resources/resources-list/resources-list.tsx"],"sourcesContent":["import type { ISheetItemCallbackProps } from '../../../sheets/sheets-list/sheet-item/sheet-item-types';\nimport type { IMilestoneWidgetResourcesProps } from './resources-list-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useEffect } from 'react';\n\nimport { IMAGES } from '../../../../assets/images/images';\nimport PlusIcon from '../../../../assets/line-icons/icons/plus';\nimport SearchIcon from '../../../../assets/line-icons/icons/search';\nimport ResourcesList from '../../../sheets/resources-list/resources-list';\nimport ArrowTooltip from '../../../ui/arrow-tooltip/arrow-tooltip';\nimport Button from '../../../ui/buttons/button/button';\nimport IconButton from '../../../ui/buttons/icon-button/icon-button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport Text from '../../../ui/text/text';\nimport { useGetMilestoneResources } from '../../milestone-list-container/api/get-milestone-resources';\nimport * as Styled from './resources-list-styled';\n\nconst MilestoneWidgetResources: FC<IMilestoneWidgetResourcesProps> = memo(props => {\n const {\n isDraftMilestone,\n isMilestoneActive,\n userType,\n studentId,\n userMilestoneId,\n canUpdatePlan,\n onAssignResources,\n onStart,\n onUnAssignSheet,\n onReset,\n onPreview,\n onReview,\n onResume,\n onReattempt,\n } = props;\n\n const isTeacher = userType === 'TEACHER';\n const isEPSheetCreationDisabled =\n !canUpdatePlan || !isMilestoneActive || (isMilestoneActive && isDraftMilestone);\n\n const {\n get: getMilestoneResources,\n isProcessed,\n isProcessing,\n isProcessingFailed,\n isStale,\n data: sheets,\n } = useGetMilestoneResources();\n\n const fetchMilestoneResources = useCallback(() => {\n if (userMilestoneId) {\n getMilestoneResources(userMilestoneId, undefined, {\n studentId,\n });\n }\n }, [studentId, userMilestoneId, getMilestoneResources]);\n\n const handleOnTryAgain = useCallback(() => {\n fetchMilestoneResources();\n }, [fetchMilestoneResources]);\n\n useEffect(() => {\n if (!isProcessing && ((!isProcessed && !isProcessingFailed) || isStale)) {\n handleOnTryAgain();\n }\n }, [handleOnTryAgain, isProcessed, isProcessing, isProcessingFailed, isStale]);\n\n const handleOnAssignResources = useCallback(() => {\n if (typeof onAssignResources !== 'function')\n throw new Error('onAssignResources must be a function');\n\n if (!userMilestoneId) throw new Error('userMilestoneId is required');\n\n onAssignResources(userMilestoneId);\n }, [onAssignResources, userMilestoneId]);\n\n const handleOnUnAssignResources = useCallback<\n NonNullable<ISheetItemCallbackProps['onUnAssignSheet']>\n >(\n sheet => {\n if (typeof onUnAssignSheet !== 'function')\n throw new Error('onUnAssignSheet must be a function');\n\n if (!userMilestoneId) throw new Error('userMilestoneId is required');\n\n onUnAssignSheet(sheet, userMilestoneId);\n },\n [onUnAssignSheet, userMilestoneId],\n );\n\n const handleOnReset = useCallback<NonNullable<ISheetItemCallbackProps['onReset']>>(\n sheetData => {\n onReset?.(sheetData, userMilestoneId);\n },\n [onReset, userMilestoneId],\n );\n\n if (isProcessingFailed) {\n return (\n <Styled.MilestoneResourcesWrapper $alignItems=\"center\" $justifyContent=\"center\">\n <FlexView $flexGapX={1.5} $alignItems=\"center\" $justifyContent=\"center\">\n <Text $renderAs=\"h6\">Oops! Something went wrong. Please try again later.</Text>\n <Button\n widthX={14}\n size=\"small\"\n shape=\"square\"\n renderAs=\"primary\"\n label=\"Try again\"\n onClick={handleOnTryAgain}\n />\n </FlexView>\n </Styled.MilestoneResourcesWrapper>\n );\n }\n\n if (isProcessed) {\n return (\n <Styled.MilestoneResourcesWrapper $justifyContent=\"space-between\">\n {sheets && sheets.length > 0 ? (\n <>\n <ResourcesList\n sheets={sheets}\n userType={userType}\n userMilestoneId={userMilestoneId}\n isMilestoneWidget\n onStart={onStart}\n onResume={onResume}\n onReattempt={onReattempt}\n onUnAssignSheet={handleOnUnAssignResources}\n onReset={handleOnReset}\n onPreview={onPreview}\n onReview={onReview}\n />\n\n {isTeacher && canUpdatePlan && (\n <Styled.SearchButtonWrapper\n $flexDirection=\"row\"\n $justifyContent=\"flex-end\"\n $gapX={1}\n $gutterX={1}\n >\n <Styled.SearchButtonCover>\n <IconButton\n Icon={SearchIcon}\n renderAs=\"secondary\"\n size=\"small\"\n analyticsLabel=\"Milestone Resource Search\"\n onClick={handleOnAssignResources}\n disabled={!isMilestoneActive}\n />\n </Styled.SearchButtonCover>\n </Styled.SearchButtonWrapper>\n )}\n </>\n ) : (\n <FlexView $width=\"100%\" $alignItems=\"center\" $justifyContent=\"flex-start\">\n <Styled.DefaultWrapper $isImageWrapper>\n <img src={IMAGES.BG_EMPTY_RESOURCES} alt=\"Empty resources\" width={420} height={420} />\n </Styled.DefaultWrapper>\n\n <Styled.DefaultWrapper>\n {isTeacher ? (\n <ArrowTooltip\n renderAs=\"primary\"\n position=\"bottom\"\n hidden={!isEPSheetCreationDisabled}\n tooltipItem={\n isDraftMilestone ? 'Allowed after plan is published' : 'Plan is completed'\n }\n >\n <Button\n renderAs=\"primary\"\n label=\"Assign Resource\"\n Icon={PlusIcon}\n shape=\"square\"\n size=\"small\"\n onClick={handleOnAssignResources}\n disabled={isEPSheetCreationDisabled}\n />\n </ArrowTooltip>\n ) : (\n <Text $renderAs=\"ab2-bold\">Wait for the teacher to assign a resource</Text>\n )}\n </Styled.DefaultWrapper>\n </FlexView>\n )}\n </Styled.MilestoneResourcesWrapper>\n );\n }\n\n return (\n <Styled.MilestoneResourcesWrapper $justifyContent=\"center\">\n <AppLoader height=\"100%\" />\n </Styled.MilestoneResourcesWrapper>\n );\n});\n\nexport default MilestoneWidgetResources;\n"],"names":["MilestoneWidgetResources","memo","props","isDraftMilestone","isMilestoneActive","userType","studentId","userMilestoneId","canUpdatePlan","onAssignResources","onStart","onUnAssignSheet","onReset","onPreview","onReview","onResume","onReattempt","isTeacher","isEPSheetCreationDisabled","getMilestoneResources","isProcessed","isProcessing","isProcessingFailed","isStale","sheets","useGetMilestoneResources","fetchMilestoneResources","useCallback","handleOnTryAgain","useEffect","handleOnAssignResources","handleOnUnAssignResources","sheet","handleOnReset","sheetData","jsx","Styled.MilestoneResourcesWrapper","jsxs","FlexView","Text","Button","Fragment","ResourcesList","Styled.SearchButtonWrapper","Styled.SearchButtonCover","IconButton","SearchIcon","Styled.DefaultWrapper","IMAGES","ArrowTooltip","PlusIcon","AppLoader"],"mappings":";;;;;;;;;;;;;;AAmBM,MAAAA,KAA+DC,EAAK,CAASC,MAAA;AAC3E,QAAA;AAAA,IACJ,kBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;AAAA,EACE,IAAAd,GAE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,UAAS,iBAAgB,cAC3D,UAAA;AAAA,IAAA,gBAAAH,EAACY,GAAA,EAAsB,iBAAe,IACpC,4BAAC,OAAI,EAAA,KAAKC,EAAO,oBAAoB,KAAI,mBAAkB,OAAO,KAAK,QAAQ,IAAK,CAAA,GACtF;AAAA,IAEC,gBAAAb,EAAAY,GAAA,EACE,UACC9B,IAAA,gBAAAkB;AAAA,MAACc;AAAA,MAAA;AAAA,QACC,UAAS;AAAA,QACT,UAAS;AAAA,QACT,QAAQ,CAAC/B;AAAA,QACT,aACEf,IAAmB,oCAAoC;AAAA,QAGzD,UAAA,gBAAAgC;AAAA,UAACK;AAAA,UAAA;AAAA,YACC,UAAS;AAAA,YACT,OAAM;AAAA,YACN,MAAMU;AAAA,YACN,OAAM;AAAA,YACN,MAAK;AAAA,YACL,SAASpB;AAAA,YACT,UAAUZ;AAAA,UAAA;AAAA,QACZ;AAAA,MAAA;AAAA,IAAA,IAGD,gBAAAiB,EAAAI,GAAA,EAAK,WAAU,YAAW,sDAAyC,CAAA,GAExE;AAAA,EAAA,EACF,CAAA,EAEJ,CAAA,IAKF,gBAAAJ,EAACC,GAAA,EAAiC,iBAAgB,UAChD,UAAC,gBAAAD,EAAAgB,GAAA,EAAU,QAAO,OAAO,CAAA,EAC3B,CAAA;AAEJ,CAAC;"}
|
1
|
+
{"version":3,"file":"resources-list.js","sources":["../../../../../src/features/milestone/milestone-resources/resources-list/resources-list.tsx"],"sourcesContent":["import type { IMilestoneWidgetResourcesProps } from './resources-list-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useEffect } from 'react';\n\nimport { IMAGES } from '../../../../assets/images/images';\nimport PlusIcon from '../../../../assets/line-icons/icons/plus';\nimport SearchIcon from '../../../../assets/line-icons/icons/search';\nimport ResourcesList from '../../../sheet-v2/resource-list/resource-list';\nimport ArrowTooltip from '../../../ui/arrow-tooltip/arrow-tooltip';\nimport Button from '../../../ui/buttons/button/button';\nimport IconButton from '../../../ui/buttons/icon-button/icon-button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport Text from '../../../ui/text/text';\nimport { useGetMilestoneResources } from '../../milestone-list-container/api/get-milestone-resources';\nimport * as Styled from './resources-list-styled';\n\nconst MilestoneWidgetResources: FC<IMilestoneWidgetResourcesProps> = memo(props => {\n const {\n isDraftMilestone,\n isMilestoneActive,\n userType,\n studentId,\n userMilestoneId,\n canUpdatePlan,\n onAssignResources,\n onNodeAttempt,\n onNodeView,\n onNodeReview,\n onNodeReset,\n onNodeUnassign,\n onNodeReattempt,\n } = props;\n\n const isTeacher = userType === 'TEACHER';\n const isEPSheetCreationDisabled =\n !canUpdatePlan || !isMilestoneActive || (isMilestoneActive && isDraftMilestone);\n\n const {\n get: getMilestoneResources,\n isProcessed,\n isProcessing,\n isProcessingFailed,\n isStale,\n data: sheets,\n } = useGetMilestoneResources();\n\n const fetchMilestoneResources = useCallback(() => {\n if (userMilestoneId) {\n getMilestoneResources(userMilestoneId, undefined, {\n studentId,\n });\n }\n }, [studentId, userMilestoneId, getMilestoneResources]);\n\n const handleOnTryAgain = useCallback(() => {\n fetchMilestoneResources();\n }, [fetchMilestoneResources]);\n\n useEffect(() => {\n if (!isProcessing && ((!isProcessed && !isProcessingFailed) || isStale)) {\n handleOnTryAgain();\n }\n }, [handleOnTryAgain, isProcessed, isProcessing, isProcessingFailed, isStale]);\n\n const handleOnAssignResources = useCallback(() => {\n if (typeof onAssignResources !== 'function')\n throw new Error('onAssignResources must be a function');\n\n if (!userMilestoneId) throw new Error('userMilestoneId is required');\n\n onAssignResources(userMilestoneId);\n }, [onAssignResources, userMilestoneId]);\n\n const sheetsDataPresent = sheets && sheets.length > 0;\n\n if (isProcessingFailed) {\n return (\n <Styled.MilestoneResourcesWrapper\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $background=\"WHITE\"\n >\n <FlexView $flexGapX={1.5} $alignItems=\"center\" $justifyContent=\"center\">\n <Text $renderAs=\"h6\">Oops! Something went wrong. Please try again later.</Text>\n <Button\n widthX={14}\n size=\"small\"\n shape=\"square\"\n renderAs=\"primary\"\n label=\"Try again\"\n onClick={handleOnTryAgain}\n />\n </FlexView>\n </Styled.MilestoneResourcesWrapper>\n );\n }\n\n if (isProcessed) {\n return (\n <Styled.MilestoneResourcesWrapper $justifyContent=\"space-between\">\n {sheetsDataPresent ? (\n <>\n <ResourcesList\n sheets={sheets}\n userType={userType}\n onNodeAttempt={onNodeAttempt}\n onNodeView={onNodeView}\n onNodeReview={onNodeReview}\n onNodeReattempt={onNodeReattempt}\n onNodeReset={onNodeReset}\n onNodeUnassign={onNodeUnassign}\n userMilestoneId={userMilestoneId}\n />\n\n {isTeacher && canUpdatePlan && (\n <Styled.SearchButtonWrapper\n $flexDirection=\"row\"\n $justifyContent=\"flex-end\"\n $gapX={1}\n $gutterX={1}\n >\n <Styled.SearchButtonCover>\n <IconButton\n Icon={SearchIcon}\n renderAs=\"secondary\"\n size=\"small\"\n analyticsLabel=\"Milestone Resource Search\"\n onClick={handleOnAssignResources}\n disabled={!isMilestoneActive}\n />\n </Styled.SearchButtonCover>\n </Styled.SearchButtonWrapper>\n )}\n </>\n ) : (\n <FlexView\n $width=\"100%\"\n $height=\"100%\"\n $alignItems=\"center\"\n $justifyContent=\"flex-start\"\n $background=\"WHITE\"\n >\n <Styled.DefaultWrapper $isImageWrapper>\n <img src={IMAGES.BG_EMPTY_RESOURCES} alt=\"Empty resources\" width={420} height={420} />\n </Styled.DefaultWrapper>\n\n <Styled.DefaultWrapper>\n {isTeacher ? (\n <ArrowTooltip\n renderAs=\"primary\"\n position=\"bottom\"\n hidden={!isEPSheetCreationDisabled}\n tooltipItem={\n isDraftMilestone ? 'Allowed after plan is published' : 'Plan is completed'\n }\n >\n <Button\n renderAs=\"primary\"\n label=\"Assign Resource\"\n Icon={PlusIcon}\n shape=\"square\"\n size=\"small\"\n onClick={handleOnAssignResources}\n disabled={isEPSheetCreationDisabled}\n />\n </ArrowTooltip>\n ) : (\n <Text $renderAs=\"ab2-bold\">Wait for the teacher to assign a resource</Text>\n )}\n </Styled.DefaultWrapper>\n </FlexView>\n )}\n </Styled.MilestoneResourcesWrapper>\n );\n }\n\n return (\n <Styled.MilestoneResourcesWrapper $justifyContent=\"center\" $background=\"WHITE\">\n <AppLoader height=\"100%\" />\n </Styled.MilestoneResourcesWrapper>\n );\n});\n\nexport default MilestoneWidgetResources;\n"],"names":["MilestoneWidgetResources","memo","props","isDraftMilestone","isMilestoneActive","userType","studentId","userMilestoneId","canUpdatePlan","onAssignResources","onNodeAttempt","onNodeView","onNodeReview","onNodeReset","onNodeUnassign","onNodeReattempt","isTeacher","isEPSheetCreationDisabled","getMilestoneResources","isProcessed","isProcessing","isProcessingFailed","isStale","sheets","useGetMilestoneResources","fetchMilestoneResources","useCallback","handleOnTryAgain","useEffect","handleOnAssignResources","sheetsDataPresent","jsx","Styled.MilestoneResourcesWrapper","FlexView","Text","Button","jsxs","Fragment","ResourcesList","Styled.SearchButtonWrapper","Styled.SearchButtonCover","IconButton","SearchIcon","Styled.DefaultWrapper","IMAGES","ArrowTooltip","PlusIcon","AppLoader"],"mappings":";;;;;;;;;;;;;;AAkBM,MAAAA,KAA+DC,EAAK,CAASC,MAAA;AAC3E,QAAA;AAAA,IACJ,kBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,iBAAAC;AAAA,EACE,IAAAb,GAEEc,IAAYX,MAAa,WACzBY,IACJ,CAACT,KAAiB,CAACJ,KAAsBA,KAAqBD,GAE1D;AAAA,IACJ,KAAKe;AAAA,IACL,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,MAAMC;A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BACL,SAASjB;AAAA,gBACT,UAAUZ;AAAA,cAAA;AAAA,YACZ;AAAA,UAAA;AAAA,QAAA,IAGD,gBAAAc,EAAAG,GAAA,EAAK,WAAU,YAAW,sDAAyC,CAAA,GAExE;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN,EAAA,CAAA,IAKD,gBAAAH,EAAAC,GAAA,EAAiC,iBAAgB,UAAS,aAAY,SACrE,UAAC,gBAAAD,EAAAgB,GAAA,EAAU,QAAO,OAAO,CAAA,EAC3B,CAAA;AAEJ,CAAC;"}
|
@@ -0,0 +1,165 @@
|
|
1
|
+
import { jsxs as u, jsx as e, Fragment as x } from "react/jsx-runtime";
|
2
|
+
import { memo as H, useCallback as l, useEffect as L } from "react";
|
3
|
+
import { IMAGES as X } from "../../../../assets/images/images.js";
|
4
|
+
import D from "../../../ui/arrow-tooltip/arrow-tooltip.js";
|
5
|
+
import S from "../../../ui/buttons/button/button.js";
|
6
|
+
import T from "../../../ui/layout/flex-view.js";
|
7
|
+
import j from "../../../ui/loader/app-loader/app-loader.js";
|
8
|
+
import _ from "../../../ui/separator/separator.js";
|
9
|
+
import N from "../../../ui/text/text.js";
|
10
|
+
import { MILESTONE_WIDGET_MIN_HEIGHT as v } from "../../constants.js";
|
11
|
+
import { useGetTestHelpData as G } from "../../milestone-list-container/api/get-tests-list.js";
|
12
|
+
import { TESTS_CREATION_ANALYTICS_EVENTS as R } from "../tests-creation/tests-creation-analytics-events.js";
|
13
|
+
import W from "./test-list-view.js";
|
14
|
+
const re = H((c) => {
|
15
|
+
const {
|
16
|
+
isChaptersAvailable: g,
|
17
|
+
isDraftMilestone: E,
|
18
|
+
isMilestoneActive: d,
|
19
|
+
userType: b,
|
20
|
+
studentId: m,
|
21
|
+
userMilestoneId: t,
|
22
|
+
canUpdatePlan: I
|
23
|
+
} = c, { onCreateMilestoneTest: i, onTestPreview: o, onTestStart: n, onTestReview: s } = c, {
|
24
|
+
get: A,
|
25
|
+
data: r,
|
26
|
+
isProcessingFailed: p,
|
27
|
+
isProcessed: f,
|
28
|
+
isStale: C,
|
29
|
+
isProcessing: w
|
30
|
+
} = G(), y = !I || !g || !d || d && E, k = d && !g ? "Chapters need to be assigned" : E ? "Allowed after plan is published" : "Plan is completed", h = l(() => {
|
31
|
+
A(t, void 0, {
|
32
|
+
studentId: m
|
33
|
+
});
|
34
|
+
}, [A, m, t]);
|
35
|
+
L(() => {
|
36
|
+
!w && (!f && !p || C) && h();
|
37
|
+
}, [h, f, w, p, C]);
|
38
|
+
const $ = l(() => {
|
39
|
+
if (typeof i == "function") {
|
40
|
+
i == null || i(t, ((r == null ? void 0 : r.length) || 0) + 1);
|
41
|
+
return;
|
42
|
+
}
|
43
|
+
throw new Error("No callback provided. If provided it must be a function");
|
44
|
+
}, [i, t, r]), M = l(
|
45
|
+
(a) => {
|
46
|
+
if (typeof o == "function") {
|
47
|
+
o == null || o(a, t);
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
throw new Error("No callback provided. If provided it must be a function");
|
51
|
+
},
|
52
|
+
[o, t]
|
53
|
+
), O = l(
|
54
|
+
(a) => {
|
55
|
+
if (typeof n == "function") {
|
56
|
+
n == null || n(a);
|
57
|
+
return;
|
58
|
+
}
|
59
|
+
throw new Error("No callback provided. If provided it must be a function");
|
60
|
+
},
|
61
|
+
[n]
|
62
|
+
), P = l(
|
63
|
+
(a) => {
|
64
|
+
if (typeof s == "function") {
|
65
|
+
s == null || s(a, t);
|
66
|
+
return;
|
67
|
+
}
|
68
|
+
throw new Error("No callback provided. If provided it must be a function");
|
69
|
+
},
|
70
|
+
[s, t]
|
71
|
+
);
|
72
|
+
return p ? /* @__PURE__ */ u(
|
73
|
+
T,
|
74
|
+
{
|
75
|
+
$flexGapX: 1.5,
|
76
|
+
$alignItems: "center",
|
77
|
+
$justifyContent: "center",
|
78
|
+
$height: "100%",
|
79
|
+
$background: "WHITE",
|
80
|
+
children: [
|
81
|
+
/* @__PURE__ */ e(N, { $renderAs: "h6", children: "Oops! Something went wrong. Please try again later." }),
|
82
|
+
/* @__PURE__ */ e(
|
83
|
+
S,
|
84
|
+
{
|
85
|
+
widthX: 14,
|
86
|
+
size: "small",
|
87
|
+
shape: "square",
|
88
|
+
renderAs: "primary",
|
89
|
+
label: "Try again",
|
90
|
+
onClick: h
|
91
|
+
}
|
92
|
+
)
|
93
|
+
]
|
94
|
+
}
|
95
|
+
) : f ? r != null && r.length ? /* @__PURE__ */ e(
|
96
|
+
W,
|
97
|
+
{
|
98
|
+
...c,
|
99
|
+
onNodeAttempt: O,
|
100
|
+
onNodeView: M,
|
101
|
+
onNodeReview: P,
|
102
|
+
milestoneId: t,
|
103
|
+
sheets: r,
|
104
|
+
userType: b,
|
105
|
+
studentId: m,
|
106
|
+
onCreateNewTest: $,
|
107
|
+
canUpdatedPlan: I,
|
108
|
+
isMilestoneActive: d
|
109
|
+
}
|
110
|
+
) : /* @__PURE__ */ u(
|
111
|
+
T,
|
112
|
+
{
|
113
|
+
$gapX: 6.75,
|
114
|
+
$alignItems: "center",
|
115
|
+
$justifyContent: "center",
|
116
|
+
$background: "WHITE",
|
117
|
+
$height: v,
|
118
|
+
children: [
|
119
|
+
/* @__PURE__ */ e("img", { src: X.EMPTY_MIX_TESTS, alt: "empty_mix_tests" }),
|
120
|
+
/* @__PURE__ */ e(_, { heightX: 2 }),
|
121
|
+
b === "TEACHER" ? /* @__PURE__ */ u(x, { children: [
|
122
|
+
/* @__PURE__ */ e(
|
123
|
+
D,
|
124
|
+
{
|
125
|
+
renderAs: "primary",
|
126
|
+
position: "bottom",
|
127
|
+
hidden: !y,
|
128
|
+
tooltipItem: k,
|
129
|
+
children: /* @__PURE__ */ e(
|
130
|
+
S,
|
131
|
+
{
|
132
|
+
widthX: 10,
|
133
|
+
renderAs: "primary",
|
134
|
+
shape: "square",
|
135
|
+
size: "small",
|
136
|
+
label: "Create a Test",
|
137
|
+
onClick: $,
|
138
|
+
disabled: y,
|
139
|
+
analyticsLabel: R.CUSTOM_TEST_CREATION_STARTED,
|
140
|
+
analyticsProps: {
|
141
|
+
milestone_id: t
|
142
|
+
}
|
143
|
+
}
|
144
|
+
)
|
145
|
+
}
|
146
|
+
),
|
147
|
+
/* @__PURE__ */ e(_, { heightX: 2 })
|
148
|
+
] }) : /* @__PURE__ */ e(N, { $renderAs: "ab2-bold", $color: "BLACK_T_87", children: "Wait for the teacher to create a test" })
|
149
|
+
]
|
150
|
+
}
|
151
|
+
) : /* @__PURE__ */ e(
|
152
|
+
T,
|
153
|
+
{
|
154
|
+
$height: v,
|
155
|
+
$alignItems: "center",
|
156
|
+
$justifyContent: "center",
|
157
|
+
$background: "WHITE",
|
158
|
+
children: /* @__PURE__ */ e(j, { height: "100%" })
|
159
|
+
}
|
160
|
+
);
|
161
|
+
});
|
162
|
+
export {
|
163
|
+
re as default
|
164
|
+
};
|
165
|
+
//# sourceMappingURL=test-list-container.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"test-list-container.js","sources":["../../../../../src/features/milestone/milestone-tests/test-list-v2/test-list-container.tsx"],"sourcesContent":["import type { INodeDataProps } from '../../../chapters-v2/comps/node-card/node-card-types';\nimport type { ITestsListProps } from './types';\n\nimport { memo, useCallback, useEffect, type FC } from 'react';\n\nimport { IMAGES } from '../../../../assets/images/images';\nimport ArrowTooltip from '../../../ui/arrow-tooltip/arrow-tooltip';\nimport Button from '../../../ui/buttons/button/button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport { MILESTONE_WIDGET_MIN_HEIGHT } from '../../constants';\nimport { useGetTestHelpData } from '../../milestone-list-container/api/get-tests-list';\nimport { TESTS_CREATION_ANALYTICS_EVENTS } from '../tests-creation/tests-creation-analytics-events';\nimport TestSheetsList from './test-list-view';\n\nconst MilestoneTestsList: FC<ITestsListProps> = memo(props => {\n const {\n isChaptersAvailable,\n isDraftMilestone,\n isMilestoneActive,\n userType,\n studentId,\n userMilestoneId,\n canUpdatePlan,\n } = props;\n const { onCreateMilestoneTest, onTestPreview, onTestStart, onTestReview } = props;\n\n const {\n get: getTestHelpData,\n data,\n isProcessingFailed,\n isProcessed,\n isStale,\n isProcessing,\n } = useGetTestHelpData();\n\n const isTestSheetCreationDisabled =\n !canUpdatePlan ||\n !isChaptersAvailable ||\n !isMilestoneActive ||\n (isMilestoneActive && isDraftMilestone);\n const testCreationCtaTooltipText =\n isMilestoneActive && !isChaptersAvailable\n ? 'Chapters need to be assigned'\n : isDraftMilestone\n ? 'Allowed after plan is published'\n : 'Plan is completed';\n\n const handleOnTryAgain = useCallback(() => {\n getTestHelpData(userMilestoneId, undefined, {\n studentId,\n });\n }, [getTestHelpData, studentId, userMilestoneId]);\n\n useEffect(() => {\n if (!isProcessing && ((!isProcessed && !isProcessingFailed) || isStale)) {\n handleOnTryAgain();\n }\n }, [handleOnTryAgain, isProcessed, isProcessing, isProcessingFailed, isStale]);\n\n const handleOnCreateMilestoneTest = useCallback(() => {\n if (typeof onCreateMilestoneTest === 'function') {\n onCreateMilestoneTest?.(userMilestoneId, (data?.length || 0) + 1);\n\n return;\n }\n\n throw new Error('No callback provided. If provided it must be a function');\n }, [onCreateMilestoneTest, userMilestoneId, data]);\n\n const handleOnTestPreview = useCallback(\n (sheetData: INodeDataProps) => {\n if (typeof onTestPreview === 'function') {\n onTestPreview?.(sheetData, userMilestoneId);\n\n return;\n }\n\n throw new Error('No callback provided. If provided it must be a function');\n },\n [onTestPreview, userMilestoneId],\n );\n\n const handleOnTestStart = useCallback(\n (sheetData: INodeDataProps) => {\n if (typeof onTestStart === 'function') {\n onTestStart?.(sheetData);\n\n return;\n }\n\n throw new Error('No callback provided. If provided it must be a function');\n },\n [onTestStart],\n );\n\n const handleOnTestReview = useCallback(\n (sheetData: INodeDataProps) => {\n if (typeof onTestReview === 'function') {\n onTestReview?.(sheetData, userMilestoneId);\n\n return;\n }\n\n throw new Error('No callback provided. If provided it must be a function');\n },\n [onTestReview, userMilestoneId],\n );\n\n if (isProcessingFailed) {\n return (\n <FlexView\n $flexGapX={1.5}\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $height=\"100%\"\n $background=\"WHITE\"\n >\n <Text $renderAs=\"h6\">Oops! Something went wrong. Please try again later.</Text>\n <Button\n widthX={14}\n size=\"small\"\n shape=\"square\"\n renderAs=\"primary\"\n label=\"Try again\"\n onClick={handleOnTryAgain}\n />\n </FlexView>\n );\n }\n\n if (isProcessed) {\n if (data?.length) {\n return (\n <TestSheetsList\n {...props}\n onNodeAttempt={handleOnTestStart}\n onNodeView={handleOnTestPreview}\n onNodeReview={handleOnTestReview}\n milestoneId={userMilestoneId}\n sheets={data}\n userType={userType}\n studentId={studentId}\n onCreateNewTest={handleOnCreateMilestoneTest}\n canUpdatedPlan={canUpdatePlan}\n isMilestoneActive={isMilestoneActive}\n />\n );\n }\n\n return (\n <FlexView\n $gapX={6.75}\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $background=\"WHITE\"\n $height={MILESTONE_WIDGET_MIN_HEIGHT}\n >\n <img src={IMAGES.EMPTY_MIX_TESTS} alt=\"empty_mix_tests\" />\n <Separator heightX={2} />\n {userType === 'TEACHER' ? (\n <>\n <ArrowTooltip\n renderAs=\"primary\"\n position=\"bottom\"\n hidden={!isTestSheetCreationDisabled}\n tooltipItem={testCreationCtaTooltipText}\n >\n <Button\n widthX={10}\n renderAs=\"primary\"\n shape=\"square\"\n size=\"small\"\n label=\"Create a Test\"\n onClick={handleOnCreateMilestoneTest}\n disabled={isTestSheetCreationDisabled}\n analyticsLabel={TESTS_CREATION_ANALYTICS_EVENTS.CUSTOM_TEST_CREATION_STARTED}\n analyticsProps={{\n milestone_id: userMilestoneId,\n }}\n />\n </ArrowTooltip>\n <Separator heightX={2} />\n </>\n ) : (\n <Text $renderAs=\"ab2-bold\" $color=\"BLACK_T_87\">\n Wait for the teacher to create a test\n </Text>\n )}\n </FlexView>\n );\n }\n\n return (\n <FlexView\n $height={MILESTONE_WIDGET_MIN_HEIGHT}\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $background=\"WHITE\"\n >\n <AppLoader height=\"100%\" />\n </FlexView>\n );\n});\n\nexport default MilestoneTestsList;\n"],"names":["MilestoneTestsList","memo","props","isChaptersAvailable","isDraftMilestone","isMilestoneActive","userType","studentId","userMilestoneId","canUpdatePlan","onCreateMilestoneTest","onTestPreview","onTestStart","onTestReview","getTestHelpData","data","isProcessingFailed","isProcessed","isStale","isProcessing","useGetTestHelpData","isTestSheetCreationDisabled","testCreationCtaTooltipText","handleOnTryAgain","useCallback","useEffect","handleOnCreateMilestoneTest","handleOnTestPreview","sheetData","handleOnTestStart","handleOnTestReview","jsxs","FlexView","jsx","Text","Button","TestSheetsList","MILESTONE_WIDGET_MIN_HEIGHT","IMAGES","Separator","Fragment","ArrowTooltip","TESTS_CREATION_ANALYTICS_EVENTS","AppLoader"],"mappings":";;;;;;;;;;;;;AAiBM,MAAAA,KAA0CC,EAAK,CAASC,MAAA;AACtD,QAAA;AAAA,IACJ,qBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,eAAAC;AAAA,EACE,IAAAP,GACE,EAAE,uBAAAQ,GAAuB,eAAAC,GAAe,aAAAC,GAAa,cAAAC,MAAiBX,GAEtE;AAAA,IACJ,KAAKY;AAAA,IACL,MAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,SAAAC;AAAA,IACA,cAAAC;AAAA,MACEC,EAAmB,GAEjBC,IACJ,CAACZ,KACD,CAACN,KACD,CAACE,KACAA,KAAqBD,GAClBkB,IACJjB,KAAqB,CAACF,IAClB,iCACAC,IACE,oCACA,qBAEFmB,IAAmBC,EAAY,MAAM;AACzC,IAAAV,EAAgBN,GAAiB,QAAW;AAAA,MAC1C,WAAAD;AAAA,IAAA,CACD;AAAA,EACA,GAAA,CA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AA,kBACT,UAAUL;AAAA,kBACV,gBAAgBqB,EAAgC;AAAA,kBAChD,gBAAgB;AAAA,oBACd,cAAclC;AAAA,kBAChB;AAAA,gBAAA;AAAA,cACF;AAAA,YAAA;AAAA,UACF;AAAA,UACA,gBAAAyB,EAACM,GAAU,EAAA,SAAS,EAAG,CAAA;AAAA,QAAA,EAAA,CACzB,IAEC,gBAAAN,EAAAC,GAAA,EAAK,WAAU,YAAW,QAAO,cAAa,UAE/C,yCAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAON,gBAAAD;AAAA,IAACD;AAAA,IAAA;AAAA,MACC,SAASK;AAAA,MACT,aAAY;AAAA,MACZ,iBAAgB;AAAA,MAChB,aAAY;AAAA,MAEZ,UAAA,gBAAAJ,EAACU,GAAU,EAAA,QAAO,OAAO,CAAA;AAAA,IAAA;AAAA,EAAA;AAG/B,CAAC;"}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { styled as t } from "styled-components";
|
2
|
+
import o from "../../../ui/layout/flex-view.js";
|
3
|
+
const i = t(o)`
|
4
|
+
position: sticky;
|
5
|
+
bottom: 0;
|
6
|
+
margin-left: auto;
|
7
|
+
`, s = t(o)(({ theme: e }) => {
|
8
|
+
const { colors: r } = e;
|
9
|
+
return `
|
10
|
+
border-radius: 50%;
|
11
|
+
box-shadow: 0px 10px 20px 0px ${r.BLACK_T_15};
|
12
|
+
`;
|
13
|
+
}), a = t.div`
|
14
|
+
display: grid;
|
15
|
+
grid-template-columns: repeat(3, 200px);
|
16
|
+
grid-gap: 32px;
|
17
|
+
justify-content: center;
|
18
|
+
padding: 32px 0;
|
19
|
+
`;
|
20
|
+
export {
|
21
|
+
s as IconButtonCover,
|
22
|
+
i as IconContainer,
|
23
|
+
a as TestSheetItemWrapper
|
24
|
+
};
|
25
|
+
//# sourceMappingURL=test-list-view-styled.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"test-list-view-styled.js","sources":["../../../../../src/features/milestone/milestone-tests/test-list-v2/test-list-view-styled.ts"],"sourcesContent":["import { styled } from 'styled-components';\n\nimport FlexView from '../../../ui/layout/flex-view';\n\nconst IconContainer = styled(FlexView)`\n position: sticky;\n bottom: 0;\n margin-left: auto;\n`;\n\nconst IconButtonCover = styled(FlexView)(({ theme }) => {\n const { colors } = theme;\n\n return `\n border-radius: 50%;\n box-shadow: 0px 10px 20px 0px ${colors.BLACK_T_15};\n `;\n});\n\nconst TestSheetItemWrapper = styled.div`\n display: grid;\n grid-template-columns: repeat(3, 200px);\n grid-gap: 32px;\n justify-content: center;\n padding: 32px 0;\n`;\n\nexport { IconContainer, IconButtonCover, TestSheetItemWrapper };\n"],"names":["IconContainer","styled","FlexView","IconButtonCover","theme","colors","TestSheetItemWrapper"],"mappings":";;AAIM,MAAAA,IAAgBC,EAAOC,CAAQ;AAAA;AAAA;AAAA;AAAA,GAM/BC,IAAkBF,EAAOC,CAAQ,EAAE,CAAC,EAAE,OAAAE,QAAY;AAChD,QAAA,EAAE,QAAAC,EAAW,IAAAD;AAEZ,SAAA;AAAA;AAAA,sCAE6BC,EAAO,UAAU;AAAA;AAEvD,CAAC,GAEKC,IAAuBL,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
@@ -0,0 +1,85 @@
|
|
1
|
+
import { jsxs as C, jsx as t } from "react/jsx-runtime";
|
2
|
+
import { h as S } from "../../../../node_modules/humanize-plus/dist/humanize.js";
|
3
|
+
import { memo as x } from "react";
|
4
|
+
import A from "../../../../assets/line-icons/icons/plus2.js";
|
5
|
+
import N from "../../../homework/homework-card.js";
|
6
|
+
import w from "../../../ui/buttons/icon-button/icon-button.js";
|
7
|
+
import O from "../../../ui/layout/flex-view.js";
|
8
|
+
import { MILESTONE_WIDGET_MIN_HEIGHT as g } from "../../constants.js";
|
9
|
+
import { TESTS_CREATION_ANALYTICS_EVENTS as j } from "../tests-creation/tests-creation-analytics-events.js";
|
10
|
+
import { TestSheetItemWrapper as y, IconContainer as H, IconButtonCover as M } from "./test-list-view-styled.js";
|
11
|
+
const R = (e) => {
|
12
|
+
const o = /* @__PURE__ */ new Set();
|
13
|
+
return e == null || e.forEach((r) => {
|
14
|
+
o.add(r.chapter_name);
|
15
|
+
}), Array.from(o).join(", ");
|
16
|
+
}, V = x(
|
17
|
+
({
|
18
|
+
milestoneId: e,
|
19
|
+
studentId: o,
|
20
|
+
sheets: r,
|
21
|
+
userType: i,
|
22
|
+
onCreateNewTest: m,
|
23
|
+
isMilestoneActive: c,
|
24
|
+
canUpdatedPlan: d,
|
25
|
+
...l
|
26
|
+
}) => /* @__PURE__ */ C(
|
27
|
+
O,
|
28
|
+
{
|
29
|
+
$height: g,
|
30
|
+
$position: "relative",
|
31
|
+
$justifyContent: "space-between",
|
32
|
+
children: [
|
33
|
+
/* @__PURE__ */ t(y, { children: r.map((s, a) => {
|
34
|
+
const {
|
35
|
+
items: p,
|
36
|
+
node_id: T,
|
37
|
+
sheet_time: h,
|
38
|
+
total_questions: n,
|
39
|
+
worksheet_id: u,
|
40
|
+
is_timed: _
|
41
|
+
} = s, f = Math.ceil((h || 0) / 60), I = R(p), E = _ ? `${f} Mins` : "", $ = `${n ? `${n} ${S.pluralize(n, "Question")}` : ""} ${E}`;
|
42
|
+
return /* @__PURE__ */ t(
|
43
|
+
N,
|
44
|
+
{
|
45
|
+
userType: i,
|
46
|
+
header: I,
|
47
|
+
subHeader: $,
|
48
|
+
nodeData: s,
|
49
|
+
renderAs: "milestone",
|
50
|
+
shouldOpenOnRight: (a + 1) % 3 === 0,
|
51
|
+
...l
|
52
|
+
},
|
53
|
+
`${u}_${T}_${a}`
|
54
|
+
);
|
55
|
+
}) }),
|
56
|
+
i === "TEACHER" && d && /* @__PURE__ */ t(
|
57
|
+
H,
|
58
|
+
{
|
59
|
+
$flexDirection: "row",
|
60
|
+
$justifyContent: "flex-end",
|
61
|
+
$gapX: 1,
|
62
|
+
$gutterX: 1,
|
63
|
+
children: /* @__PURE__ */ t(M, { children: /* @__PURE__ */ t(
|
64
|
+
w,
|
65
|
+
{
|
66
|
+
Icon: A,
|
67
|
+
renderAs: "secondary",
|
68
|
+
analyticsLabel: j.CUSTOM_TEST_CREATION_STARTED,
|
69
|
+
onClick: m,
|
70
|
+
disabled: !c,
|
71
|
+
analyticsProps: {
|
72
|
+
milestone_id: e
|
73
|
+
}
|
74
|
+
}
|
75
|
+
) })
|
76
|
+
}
|
77
|
+
)
|
78
|
+
]
|
79
|
+
}
|
80
|
+
)
|
81
|
+
);
|
82
|
+
export {
|
83
|
+
V as default
|
84
|
+
};
|
85
|
+
//# sourceMappingURL=test-list-view.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"test-list-view.js","sources":["../../../../../src/features/milestone/milestone-tests/test-list-v2/test-list-view.tsx"],"sourcesContent":["import type { TNodeDataTestItemsDataProps } from '../../../chapters-v2/comps/node-card/node-card-types';\nimport type { ITestSheetsList } from './types';\nimport type { FC } from 'react';\n\nimport { pluralize } from 'humanize-plus';\nimport { memo } from 'react';\n\nimport Plus2Icon from '../../../../assets/line-icons/icons/plus2';\nimport HomeworkCard from '../../../homework/homework-card';\nimport IconButton from '../../../ui/buttons/icon-button/icon-button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport { MILESTONE_WIDGET_MIN_HEIGHT } from '../../constants';\nimport { TESTS_CREATION_ANALYTICS_EVENTS } from '../tests-creation/tests-creation-analytics-events';\nimport * as Styled from './test-list-view-styled';\n\nconst getTopicNameFromItems = (items?: TNodeDataTestItemsDataProps[]) => {\n const topics = new Set<string>();\n\n items?.forEach(item => {\n topics.add(item.chapter_name);\n });\n\n return Array.from(topics).join(', ');\n};\n\nconst TestSheetsList: FC<ITestSheetsList> = memo(\n ({\n milestoneId,\n studentId,\n sheets,\n userType,\n onCreateNewTest,\n isMilestoneActive,\n canUpdatedPlan,\n ...sheetCallbacks\n }) => {\n return (\n <FlexView\n $height={MILESTONE_WIDGET_MIN_HEIGHT}\n $position=\"relative\"\n $justifyContent=\"space-between\"\n >\n <Styled.TestSheetItemWrapper>\n {sheets.map((sheet, idx) => {\n const {\n items,\n node_id: nodeId,\n sheet_time: sheetTime,\n total_questions: totalQuestions,\n worksheet_id: worksheetId,\n is_timed: isTimed,\n } = sheet;\n const totalSheetTime = Math.ceil((sheetTime || 0) / 60);\n const testChapterName = getTopicNameFromItems(items);\n const sheetTimeText = isTimed ? `${totalSheetTime} Mins` : '';\n const totalQuestionsText = totalQuestions\n ? `${totalQuestions} ${pluralize(totalQuestions, 'Question')}`\n : '';\n const subHeader = `${totalQuestionsText} ${sheetTimeText}`;\n\n return (\n <HomeworkCard\n key={`${worksheetId}_${nodeId}_${idx}`}\n userType={userType}\n header={testChapterName}\n subHeader={subHeader}\n nodeData={sheet}\n renderAs=\"milestone\"\n shouldOpenOnRight={(idx + 1) % 3 === 0}\n {...sheetCallbacks}\n />\n );\n })}\n </Styled.TestSheetItemWrapper>\n\n {userType === 'TEACHER' && canUpdatedPlan && (\n <Styled.IconContainer\n $flexDirection=\"row\"\n $justifyContent=\"flex-end\"\n $gapX={1}\n $gutterX={1}\n >\n <Styled.IconButtonCover>\n <IconButton\n Icon={Plus2Icon}\n renderAs=\"secondary\"\n analyticsLabel={TESTS_CREATION_ANALYTICS_EVENTS.CUSTOM_TEST_CREATION_STARTED}\n onClick={onCreateNewTest}\n disabled={!isMilestoneActive}\n analyticsProps={{\n milestone_id: milestoneId,\n }}\n />\n </Styled.IconButtonCover>\n </Styled.IconContainer>\n )}\n </FlexView>\n );\n },\n);\n\nexport default TestSheetsList;\n"],"names":["getTopicNameFromItems","items","topics","item","TestSheetsList","memo","milestoneId","studentId","sheets","userType","onCreateNewTest","isMilestoneActive","canUpdatedPlan","sheetCallbacks","jsxs","FlexView","MILESTONE_WIDGET_MIN_HEIGHT","jsx","Styled.TestSheetItemWrapper","sheet","idx","nodeId","sheetTime","totalQuestions","worksheetId","isTimed","totalSheetTime","testChapterName","sheetTimeText","subHeader","pluralize","HomeworkCard","Styled.IconContainer","Styled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A,YAAA;AAAA,YAPC,GAAGW,CAAW,IAAIH,CAAM,IAAID,CAAG;AAAA,UAAA;AAAA,QAUzC,CAAA,GACH;AAAA,QAECX,MAAa,aAAaG,KACzB,gBAAAK;AAAA,UAACe;AAAAA,UAAA;AAAA,YACC,gBAAe;AAAA,YACf,iBAAgB;AAAA,YAChB,OAAO;AAAA,YACP,UAAU;AAAA,YAEV,UAAA,gBAAAf,EAACgB,GAAA,EACC,UAAA,gBAAAhB;AAAA,cAACiB;AAAA,cAAA;AAAA,gBACC,MAAMC;AAAA,gBACN,UAAS;AAAA,gBACT,gBAAgBC,EAAgC;AAAA,gBAChD,SAAS1B;AAAA,gBACT,UAAU,CAACC;AAAA,gBACX,gBAAgB;AAAA,kBACd,cAAcL;AAAA,gBAChB;AAAA,cAAA;AAAA,YAAA,GAEJ;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAKV;"}
|
@@ -17,7 +17,7 @@ const ee = {
|
|
17
17
|
duration: null,
|
18
18
|
chapters: null
|
19
19
|
}, te = G((D) => {
|
20
|
-
const { milestoneId: s, studentId:
|
20
|
+
const { milestoneId: s, studentId: f, testNumber: h, onTestAssign: v, onExit: L, onError: c } = D, [I, x] = _("CHAPTER_SELECTION"), [o, p] = _(ee), [d, A] = _([]), m = i((e) => {
|
21
21
|
x(e);
|
22
22
|
}, []), $ = i(
|
23
23
|
(e, t) => {
|
@@ -35,43 +35,41 @@ const ee = {
|
|
35
35
|
};
|
36
36
|
}), c(
|
37
37
|
"We're experiencing a temporary limitation with the chapters you've selected. Please select alternative chapters and proceed."
|
38
|
-
)), e ? c(e) : t &&
|
38
|
+
)), e ? c(e) : t && A(t);
|
39
39
|
},
|
40
|
-
[c,
|
40
|
+
[c, A, m]
|
41
41
|
), F = i(
|
42
42
|
(e) => {
|
43
43
|
e ? c(e) : v();
|
44
44
|
},
|
45
45
|
[c, v]
|
46
46
|
), {
|
47
|
-
get:
|
47
|
+
get: S,
|
48
48
|
data: H,
|
49
49
|
isProcessing: N,
|
50
50
|
isProcessingFailed: b,
|
51
51
|
error: g
|
52
52
|
} = B(s, {
|
53
|
-
with_plan: !0,
|
54
53
|
with_sheets: !0
|
55
|
-
}), { post:
|
54
|
+
}), { post: w, isProcessing: M } = Y({
|
56
55
|
onComplete: $
|
57
56
|
}), { post: E, isProcessing: R } = J({
|
58
57
|
onComplete: F
|
59
58
|
}), { user_milestone_plan: j } = H || {}, { user_chapters: a } = j || {}, y = i(
|
60
59
|
(e) => {
|
61
|
-
|
60
|
+
w(e);
|
62
61
|
},
|
63
|
-
[
|
62
|
+
[w]
|
64
63
|
), T = i(() => {
|
65
|
-
|
66
|
-
with_plan: !0,
|
64
|
+
S(s, {
|
67
65
|
with_sheets: !0
|
68
66
|
});
|
69
|
-
}, [
|
67
|
+
}, [S, s]), k = i(() => {
|
70
68
|
const { duration: e, difficultyLevel: t, selectedChapters: n } = o;
|
71
69
|
e && t && n && E(
|
72
70
|
{
|
73
71
|
items: d,
|
74
|
-
title: `Test ${
|
72
|
+
title: `Test ${h}`,
|
75
73
|
node_params: {
|
76
74
|
is_timed: !0,
|
77
75
|
sheet_time: e * 60,
|
@@ -79,11 +77,11 @@ const ee = {
|
|
79
77
|
}
|
80
78
|
},
|
81
79
|
{
|
82
|
-
studentId:
|
80
|
+
studentId: f,
|
83
81
|
userMilestoneId: s
|
84
82
|
}
|
85
83
|
);
|
86
|
-
}, [E, o,
|
84
|
+
}, [E, o, f, s, d, h]), P = i(
|
87
85
|
(e, t) => {
|
88
86
|
if (m(e), t) {
|
89
87
|
const { difficultyLevel: n, duration: r } = t;
|
@@ -113,17 +111,17 @@ const ee = {
|
|
113
111
|
onClick: T
|
114
112
|
}
|
115
113
|
)
|
116
|
-
] }) : a ?
|
114
|
+
] }) : a ? I === "PREVIEW" ? /* @__PURE__ */ l(
|
117
115
|
Z,
|
118
116
|
{
|
119
|
-
studentId:
|
117
|
+
studentId: f,
|
120
118
|
items: d,
|
121
|
-
testNumber:
|
119
|
+
testNumber: h,
|
122
120
|
isAssignInProgress: R,
|
123
121
|
onTestStageChange: P,
|
124
122
|
onTestSheetAssign: k
|
125
123
|
}
|
126
|
-
) :
|
124
|
+
) : I === "DIFFICULTY_AND_DURATION_SELECTION" ? /* @__PURE__ */ l(
|
127
125
|
Q,
|
128
126
|
{
|
129
127
|
testFormData: o,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tests-creation.js","sources":["../../../../../src/features/milestone/milestone-tests/tests-creation/tests-creation.tsx"],"sourcesContent":["import type { ITestHelpPreviewPayload, ITestHelpPreviewResponse } from './api/preview-test-sheet';\nimport type { ITestFromData, ITestsCreationProps, TTestsStage } from './tests-creation-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useEffect, useState } from 'react';\n\nimport Button from '../../../ui/buttons/button/button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport Text from '../../../ui/text/text';\nimport { useMilestoneGet } from '../../edit/comps/edit-milestone-modal/api/get-milestone';\nimport { usePostTestHelpPreview } from './api/preview-test-sheet';\nimport { usePostTestSheetAssign } from './api/test-sheet-assign';\nimport ChapterSelection from './test-stages/chapter-selection/chapter-selection';\nimport DifficultyAndDurationSelection from './test-stages/difficulty-and-duration-selection/difficulty-and-duration-selection';\nimport TestPreview from './test-stages/test-preview/test-preview';\n\nconst initFormData: ITestFromData = {\n selectedChapters: null,\n difficultyLevel: null,\n title: null,\n duration: null,\n chapters: null,\n};\n\nconst TestsCreation: FC<ITestsCreationProps> = memo(props => {\n const { milestoneId, studentId, testNumber, onTestAssign, onExit, onError } = props;\n\n const [testStage, setTestStage] = useState<TTestsStage>('CHAPTER_SELECTION');\n const [testFormData, setTestFromData] = useState<ITestFromData>(initFormData);\n const [testPreviewItems, setTestPreviewItems] = useState<ITestHelpPreviewResponse[]>([]);\n\n const handleOnTestStageChange = useCallback((nextStage: TTestsStage) => {\n setTestStage(nextStage);\n }, []);\n\n const handleOnTestHelpPreviewComplete = useCallback(\n (errorMessage: string | null, data?: ITestHelpPreviewResponse[]) => {\n if (errorMessage || !data?.length) {\n handleOnTestStageChange('CHAPTER_SELECTION');\n\n setTestFromData(prev => {\n const { chapters, selectedChapters } = prev;\n\n const updatedChapters = chapters?.map(chapter => {\n if (selectedChapters?.includes(chapter.id)) {\n return {\n ...chapter,\n item_bank_enabled: false,\n };\n }\n\n return chapter;\n });\n\n return {\n ...prev,\n chapters: updatedChapters ?? null,\n selectedChapters: null,\n difficultyLevel: null,\n duration: null,\n };\n });\n\n onError(\n `We're experiencing a temporary limitation with the chapters you've selected. Please select alternative chapters and proceed.`,\n );\n }\n\n if (errorMessage) {\n onError(errorMessage);\n } else if (data) {\n setTestPreviewItems(data);\n }\n },\n [onError, setTestPreviewItems, handleOnTestStageChange],\n );\n\n const handleOnTestSheetAssignComplete = useCallback(\n (errorMessage: string | null) => {\n if (errorMessage) {\n onError(errorMessage);\n } else {\n onTestAssign();\n }\n },\n [onError, onTestAssign],\n );\n\n const {\n get: getMilestone,\n data: currentMilestoneData,\n isProcessing: isMilestoneProcessing,\n isProcessingFailed: isMilestoneProcessingFailed,\n error: milestoneGetError,\n } = useMilestoneGet(milestoneId, {\n with_plan: true,\n with_sheets: true,\n });\n\n const { post: postTestHelpPreview, isProcessing: testPreviewIsProcessing } =\n usePostTestHelpPreview({\n onComplete: handleOnTestHelpPreviewComplete,\n });\n\n const { post: postTestSheetAssign, isProcessing: testAssignIsProcessing } =\n usePostTestSheetAssign({\n onComplete: handleOnTestSheetAssignComplete,\n });\n\n const { user_milestone_plan: userMilestonePlan } = currentMilestoneData || {};\n const { user_chapters: userChapters } = userMilestonePlan || {};\n\n const handleOnPostTestHelpPreview = useCallback(\n (data: ITestHelpPreviewPayload) => {\n postTestHelpPreview(data);\n },\n [postTestHelpPreview],\n );\n\n const handleOnGetMilestone = useCallback(() => {\n getMilestone(milestoneId, {\n with_plan: true,\n with_sheets: true,\n });\n }, [getMilestone, milestoneId]);\n\n const handleOnTestSheetAssign = useCallback(() => {\n const { duration, difficultyLevel, selectedChapters } = testFormData;\n\n if (duration && difficultyLevel && selectedChapters) {\n postTestSheetAssign(\n {\n items: testPreviewItems,\n title: `Test ${testNumber}`,\n node_params: {\n is_timed: true,\n sheet_time: duration * 60,\n difficulty_level: difficultyLevel,\n },\n },\n {\n studentId,\n userMilestoneId: milestoneId,\n },\n );\n }\n }, [postTestSheetAssign, testFormData, studentId, milestoneId, testPreviewItems, testNumber]);\n\n const handleOnProceed = useCallback(\n (nextStage: TTestsStage, updatedForm?: ITestFromData) => {\n handleOnTestStageChange(nextStage);\n\n if (updatedForm) {\n const { difficultyLevel, duration } = updatedForm;\n\n setTestFromData(prev => ({ ...prev, ...updatedForm }));\n\n if (nextStage === 'PREVIEW' && difficultyLevel && duration) {\n handleOnPostTestHelpPreview({\n difficulty_level: difficultyLevel,\n duration: duration,\n user_chapter_ids: testFormData.selectedChapters || [],\n });\n }\n }\n },\n [handleOnTestStageChange, handleOnPostTestHelpPreview, testFormData],\n );\n\n useEffect(() => {\n if (milestoneId) {\n handleOnGetMilestone();\n }\n }, [milestoneId, handleOnGetMilestone]);\n\n useEffect(() => {\n if (userChapters && userChapters.length > 0) {\n setTestFromData(prev => ({ ...prev, chapters: userChapters }));\n }\n }, [userChapters]);\n\n if (isMilestoneProcessing || testPreviewIsProcessing) {\n return <AppLoader height=\"100vh\" />;\n }\n\n if (isMilestoneProcessingFailed) {\n return (\n <FlexView $height=\"100vh\" $flexGapX={1.5} $alignItems=\"center\" $justifyContent=\"center\">\n <Text $renderAs=\"h6\">{milestoneGetError?.message || 'Oops! Something went wrong.'}</Text>\n <Button\n widthX={14}\n size=\"small\"\n shape=\"square\"\n renderAs=\"primary\"\n label=\"Try again\"\n onClick={handleOnGetMilestone}\n />\n </FlexView>\n );\n }\n\n if (!userChapters) return null;\n\n if (testStage === 'PREVIEW') {\n return (\n <TestPreview\n studentId={studentId}\n items={testPreviewItems}\n testNumber={testNumber}\n isAssignInProgress={testAssignIsProcessing}\n onTestStageChange={handleOnProceed}\n onTestSheetAssign={handleOnTestSheetAssign}\n />\n );\n }\n\n if (testStage === 'DIFFICULTY_AND_DURATION_SELECTION') {\n return (\n <DifficultyAndDurationSelection\n testFormData={testFormData}\n onTestStageChange={handleOnProceed}\n />\n );\n }\n\n return (\n <ChapterSelection testFormData={testFormData} onProceed={handleOnProceed} onExit={onExit} />\n );\n});\n\nexport default TestsCreation;\n"],"names":["initFormData","TestsCreation","memo","props","milestoneId","studentId","testNumber","onTestAssign","onExit","onError","testStage","setTestStage","useState","testFormData","setTestFromData","testPreviewItems","setTestPreviewItems","handleOnTestStageChange","useCallback","nextStage","handleOnTestHelpPreviewComplete","errorMessage","data","prev","chapters","selectedChapters","updatedChapters","chapter","handleOnTestSheetAssignComplete","getMilestone","currentMilestoneData","isMilestoneProcessing","isMilestoneProcessingFailed","milestoneGetError","useMilestoneGet","postTestHelpPreview","testPreviewIsProcessing","usePostTestHelpPreview","postTestSheetAssign","testAssignIsProcessing","usePostTestSheetAssign","userMilestonePlan","userChapters","handleOnPostTestHelpPreview","handleOnGetMilestone","handleOnTestSheetAssign","duration","difficultyLevel","handleOnProceed","updatedForm","useEffect","jsx","AppLoader","jsxs","FlexView","Text","Button","TestPreview","DifficultyAndDurationSelection","ChapterSelection","TestsCreation$1"],"mappings":";;;;;;;;;;;;AAiBA,MAAMA,KAA8B;AAAA,EAClC,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AACZ,GAEMC,KAAyCC,EAAK,CAASC,MAAA;AAC3D,QAAM,EAAE,aAAAC,GAAa,WAAAC,GAAW,YAAAC,GAAY,cAAAC,GAAc,QAAAC,GAAQ,SAAAC,EAAY,IAAAN,GAExE,CAACO,GAAWC,CAAY,IAAIC,EAAsB,mBAAmB,GACrE,CAACC,GAAcC,CAAe,IAAIF,EAAwBZ,EAAY,GACtE,CAACe,GA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D,KAAe3D;"}
|
1
|
+
{"version":3,"file":"tests-creation.js","sources":["../../../../../src/features/milestone/milestone-tests/tests-creation/tests-creation.tsx"],"sourcesContent":["import type { ITestHelpPreviewPayload, ITestHelpPreviewResponse } from './api/preview-test-sheet';\nimport type { ITestFromData, ITestsCreationProps, TTestsStage } from './tests-creation-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useEffect, useState } from 'react';\n\nimport Button from '../../../ui/buttons/button/button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport Text from '../../../ui/text/text';\nimport { useMilestoneGet } from '../../edit/comps/edit-milestone-modal/api/get-milestone';\nimport { usePostTestHelpPreview } from './api/preview-test-sheet';\nimport { usePostTestSheetAssign } from './api/test-sheet-assign';\nimport ChapterSelection from './test-stages/chapter-selection/chapter-selection';\nimport DifficultyAndDurationSelection from './test-stages/difficulty-and-duration-selection/difficulty-and-duration-selection';\nimport TestPreview from './test-stages/test-preview/test-preview';\n\nconst initFormData: ITestFromData = {\n selectedChapters: null,\n difficultyLevel: null,\n title: null,\n duration: null,\n chapters: null,\n};\n\nconst TestsCreation: FC<ITestsCreationProps> = memo(props => {\n const { milestoneId, studentId, testNumber, onTestAssign, onExit, onError } = props;\n\n const [testStage, setTestStage] = useState<TTestsStage>('CHAPTER_SELECTION');\n const [testFormData, setTestFromData] = useState<ITestFromData>(initFormData);\n const [testPreviewItems, setTestPreviewItems] = useState<ITestHelpPreviewResponse[]>([]);\n\n const handleOnTestStageChange = useCallback((nextStage: TTestsStage) => {\n setTestStage(nextStage);\n }, []);\n\n const handleOnTestHelpPreviewComplete = useCallback(\n (errorMessage: string | null, data?: ITestHelpPreviewResponse[]) => {\n if (errorMessage || !data?.length) {\n handleOnTestStageChange('CHAPTER_SELECTION');\n\n setTestFromData(prev => {\n const { chapters, selectedChapters } = prev;\n\n const updatedChapters = chapters?.map(chapter => {\n if (selectedChapters?.includes(chapter.id)) {\n return {\n ...chapter,\n item_bank_enabled: false,\n };\n }\n\n return chapter;\n });\n\n return {\n ...prev,\n chapters: updatedChapters ?? null,\n selectedChapters: null,\n difficultyLevel: null,\n duration: null,\n };\n });\n\n onError(\n `We're experiencing a temporary limitation with the chapters you've selected. Please select alternative chapters and proceed.`,\n );\n }\n\n if (errorMessage) {\n onError(errorMessage);\n } else if (data) {\n setTestPreviewItems(data);\n }\n },\n [onError, setTestPreviewItems, handleOnTestStageChange],\n );\n\n const handleOnTestSheetAssignComplete = useCallback(\n (errorMessage: string | null) => {\n if (errorMessage) {\n onError(errorMessage);\n } else {\n onTestAssign();\n }\n },\n [onError, onTestAssign],\n );\n\n const {\n get: getMilestone,\n data: currentMilestoneData,\n isProcessing: isMilestoneProcessing,\n isProcessingFailed: isMilestoneProcessingFailed,\n error: milestoneGetError,\n } = useMilestoneGet(milestoneId, {\n with_sheets: true,\n });\n\n const { post: postTestHelpPreview, isProcessing: testPreviewIsProcessing } =\n usePostTestHelpPreview({\n onComplete: handleOnTestHelpPreviewComplete,\n });\n\n const { post: postTestSheetAssign, isProcessing: testAssignIsProcessing } =\n usePostTestSheetAssign({\n onComplete: handleOnTestSheetAssignComplete,\n });\n\n const { user_milestone_plan: userMilestonePlan } = currentMilestoneData || {};\n const { user_chapters: userChapters } = userMilestonePlan || {};\n\n const handleOnPostTestHelpPreview = useCallback(\n (data: ITestHelpPreviewPayload) => {\n postTestHelpPreview(data);\n },\n [postTestHelpPreview],\n );\n\n const handleOnGetMilestone = useCallback(() => {\n getMilestone(milestoneId, {\n with_sheets: true,\n });\n }, [getMilestone, milestoneId]);\n\n const handleOnTestSheetAssign = useCallback(() => {\n const { duration, difficultyLevel, selectedChapters } = testFormData;\n\n if (duration && difficultyLevel && selectedChapters) {\n postTestSheetAssign(\n {\n items: testPreviewItems,\n title: `Test ${testNumber}`,\n node_params: {\n is_timed: true,\n sheet_time: duration * 60,\n difficulty_level: difficultyLevel,\n },\n },\n {\n studentId,\n userMilestoneId: milestoneId,\n },\n );\n }\n }, [postTestSheetAssign, testFormData, studentId, milestoneId, testPreviewItems, testNumber]);\n\n const handleOnProceed = useCallback(\n (nextStage: TTestsStage, updatedForm?: ITestFromData) => {\n handleOnTestStageChange(nextStage);\n\n if (updatedForm) {\n const { difficultyLevel, duration } = updatedForm;\n\n setTestFromData(prev => ({ ...prev, ...updatedForm }));\n\n if (nextStage === 'PREVIEW' && difficultyLevel && duration) {\n handleOnPostTestHelpPreview({\n difficulty_level: difficultyLevel,\n duration: duration,\n user_chapter_ids: testFormData.selectedChapters || [],\n });\n }\n }\n },\n [handleOnTestStageChange, handleOnPostTestHelpPreview, testFormData],\n );\n\n useEffect(() => {\n if (milestoneId) {\n handleOnGetMilestone();\n }\n }, [milestoneId, handleOnGetMilestone]);\n\n useEffect(() => {\n if (userChapters && userChapters.length > 0) {\n setTestFromData(prev => ({ ...prev, chapters: userChapters }));\n }\n }, [userChapters]);\n\n if (isMilestoneProcessing || testPreviewIsProcessing) {\n return <AppLoader height=\"100vh\" />;\n }\n\n if (isMilestoneProcessingFailed) {\n return (\n <FlexView $height=\"100vh\" $flexGapX={1.5} $alignItems=\"center\" $justifyContent=\"center\">\n <Text $renderAs=\"h6\">{milestoneGetError?.message || 'Oops! Something went wrong.'}</Text>\n <Button\n widthX={14}\n size=\"small\"\n shape=\"square\"\n renderAs=\"primary\"\n label=\"Try again\"\n onClick={handleOnGetMilestone}\n />\n </FlexView>\n );\n }\n\n if (!userChapters) return null;\n\n if (testStage === 'PREVIEW') {\n return (\n <TestPreview\n studentId={studentId}\n items={testPreviewItems}\n testNumber={testNumber}\n isAssignInProgress={testAssignIsProcessing}\n onTestStageChange={handleOnProceed}\n onTestSheetAssign={handleOnTestSheetAssign}\n />\n );\n }\n\n if (testStage === 'DIFFICULTY_AND_DURATION_SELECTION') {\n return (\n <DifficultyAndDurationSelection\n testFormData={testFormData}\n onTestStageChange={handleOnProceed}\n />\n );\n }\n\n return (\n <ChapterSelection testFormData={testFormData} onProceed={handleOnProceed} onExit={onExit} />\n );\n});\n\nexport default TestsCreation;\n"],"names":["initFormData","TestsCreation","memo","props","milestoneId","studentId","testNumber","onTestAssign","onExit","onError","testStage","setTestStage","useState","testFormData","setTestFromData","testPreviewItems","setTestPreviewItems","handleOnTestStageChange","useCallback","nextStage","handleOnTestHelpPreviewComplete","errorMessage","data","prev","chapters","selectedChapters","updatedChapters","chapter","handleOnTestSheetAssignComplete","getMilestone","currentMilestoneData","isMilestoneProcessing","isMilestoneProcessingFailed","milestoneGetError","useMilestoneGet","postTestHelpPreview","testPreviewIsProcessing","usePostTestHelpPreview","postTestSheetAssign","testAssignIsProcessing","usePostTestSheetAssign","userMilestonePlan","userChapters","handleOnPostTestHelpPreview","handleOnGetMilestone","handleOnTestSheetAssign","duration","difficultyLevel","handleOnProceed","updatedForm","useEffect","jsx","AppLoader","jsxs","FlexView","Text","Button","TestPreview","DifficultyAndDurationSelection","ChapterSelection","TestsCreation$1"],"mappings":";;;;;;;;;;;;AAiBA,MAAMA,KAA8B;AAAA,EAClC,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AACZ,GAEMC,KAAyCC,EAAK,CAASC,MAAA;AAC3D,QAAM,EAAE,aAAAC,GAAa,WAAAC,GAAW,YAAAC,GAAY,cAAAC,GAAc,QAAAC,GAAQ,SAAAC,EAAY,IAAAN,GAExE,CAACO,GAAWC,CAAY,IAAIC,EAAsB,mBAAmB,GACrE,CAACC,GAAcC,CAAe,IAAIF,EAAwBZ,EAAY,GACtE,CAACe,GAAkBC,CAAmB,IAAIJ,EAAqC,CAAE,CAAA,GAEjFK,IAA0BC,EAAY,CAACC,MAA2B;AACtE,IAAAR,EAAaQ,CAAS;AAAA,EACxB,GAAG,CAAE,CAAA,GAECC,IAAkCF;AAAA,IACtC,CAACG,GAA6BC,MAAsC;AAC9D,OAAAD,KAAgB,EAACC,KAAA,QAAAA,EAAM,aACzBL,EAAwB,mBAAmB,GAE3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EAAA;AAAA,EAC/D,GACC,CAACA,CAAY,CAAC,GAEbX,KAAyBK,IACpB,gBAAAe,EAACC,GAAU,EAAA,QAAO,QAAQ,CAAA,IAG/BpB,IAEA,gBAAAqB,EAACC,KAAS,SAAQ,SAAQ,WAAW,KAAK,aAAY,UAAS,iBAAgB,UAC7E,UAAA;AAAA,IAAA,gBAAAH,EAACI,GAAK,EAAA,WAAU,MAAM,WAAAtB,KAAA,gBAAAA,EAAmB,YAAW,+BAA8B;AAAA,IAClF,gBAAAkB;AAAA,MAACK;AAAA,MAAA;AAAA,QACC,QAAQ;AAAA,QACR,MAAK;AAAA,QACL,OAAM;AAAA,QACN,UAAS;AAAA,QACT,OAAM;AAAA,QACN,SAASZ;AAAA,MAAA;AAAA,IACX;AAAA,EACF,EAAA,CAAA,IAICF,IAEDhC,MAAc,YAEd,gBAAAyC;AAAA,IAACM;AAAA,IAAA;AAAA,MACC,WAAApD;AAAA,MACA,OAAOU;AAAA,MACP,YAAAT;AAAA,MACA,oBAAoBiC;AAAA,MACpB,mBAAmBS;AAAA,MACnB,mBAAmBH;AAAA,IAAA;AAAA,EAAA,IAKrBnC,MAAc,sCAEd,gBAAAyC;AAAA,IAACO;AAAA,IAAA;AAAA,MACC,cAAA7C;AAAA,MACA,mBAAmBmC;AAAA,IAAA;AAAA,EAAA,IAMtB,gBAAAG,EAAAQ,GAAA,EAAiB,cAAA9C,GAA4B,WAAWmC,GAAiB,QAAAxC,EAAgB,CAAA,IAzBlE;AA2B5B,CAAC,GAEDoD,KAAe3D;"}
|
@@ -1,38 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
if (a)
|
7
|
-
return {
|
8
|
-
state: "in_progress",
|
9
|
-
renderAs: "primary",
|
10
|
-
label: "Resume"
|
11
|
-
};
|
12
|
-
if (n)
|
13
|
-
return {
|
14
|
-
state: void 0,
|
15
|
-
renderAs: "primary",
|
16
|
-
label: "Start"
|
17
|
-
};
|
18
|
-
}
|
19
|
-
return o ? {
|
20
|
-
state: "completed",
|
21
|
-
renderAs: "secondary_black",
|
22
|
-
label: "Review"
|
23
|
-
} : {
|
24
|
-
state: a ? "in_progress" : void 0,
|
25
|
-
renderAs: "primary",
|
26
|
-
label: "View"
|
27
|
-
};
|
28
|
-
}, E = (r) => {
|
29
|
-
const e = /* @__PURE__ */ new Set();
|
30
|
-
return r == null || r.forEach((t) => {
|
31
|
-
e.add(t.chapter_name);
|
32
|
-
}), Array.from(e);
|
1
|
+
const a = (r) => {
|
2
|
+
const o = /* @__PURE__ */ new Set();
|
3
|
+
return r == null || r.forEach((c) => {
|
4
|
+
o.add(c.chapter_name);
|
5
|
+
}), Array.from(o);
|
33
6
|
};
|
34
7
|
export {
|
35
|
-
|
36
|
-
E as getTopicsFromItems
|
8
|
+
a as getTopicsFromItems
|
37
9
|
};
|
38
10
|
//# sourceMappingURL=test-sheet-item-utils.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"test-sheet-item-utils.js","sources":["../../../../../../../src/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-utils.ts"],"sourcesContent":["import type {\n TSheetButtonState,\n TSheetButtonVariant,\n} from '../../../../../sheets/comps/sheet-button/types';\nimport type {\n ISheetDataProps,\n TTestHelpItemsDataProps,\n} from '../../../../../sheets/sheets-list/sheet-item/sheet-item-types';\n\nimport { SHEET_STATE } from '../../../../../sheets/constants/sheet';\nimport { IS_CHAPTER_COMPLETED_STATES } from '../../../../create/milestone-create-constants';\n\nconst { COMPLETED } = SHEET_STATE;\n\ninterface IGetTestSheetCtaInfo {\n (\n state: ISheetDataProps['state'],\n permissions: ISheetDataProps['permissions'],\n isStudent: boolean,\n ): {\n state: TSheetButtonState | undefined;\n renderAs: TSheetButtonVariant;\n label: 'Start' | 'Resume' | 'View' | 'Review';\n };\n}\n\nconst getTestCtaInfo: IGetTestSheetCtaInfo = (sheetState, permissions, isStudent) => {\n const { can_start: canStart, can_resume: canResume } = permissions;\n\n const isSheetCompleted =\n sheetState === COMPLETED ||\n IS_CHAPTER_COMPLETED_STATES.some(completedState => completedState === sheetState);\n\n if (isStudent) {\n if (canResume) {\n return {\n state: 'in_progress',\n renderAs: 'primary',\n label: 'Resume',\n };\n }\n\n if (canStart) {\n return {\n state: undefined,\n renderAs: 'primary',\n label: 'Start',\n };\n }\n }\n\n if (isSheetCompleted) {\n return {\n state: 'completed',\n renderAs: 'secondary_black',\n label: 'Review',\n };\n }\n\n return {\n state: canResume ? 'in_progress' : undefined,\n renderAs: 'primary',\n label: 'View',\n };\n};\n\nconst getTopicsFromItems = (items?: TTestHelpItemsDataProps[]) => {\n const topics = new Set<string>();\n\n items?.forEach(item => {\n topics.add(item.chapter_name);\n });\n\n return Array.from(topics);\n};\n\nexport { getTopicsFromItems, getTestCtaInfo };\n"],"names":["
|
1
|
+
{"version":3,"file":"test-sheet-item-utils.js","sources":["../../../../../../../src/features/milestone/milestone-tests/tests-list/test-sheets-list/test-sheet-item/test-sheet-item-utils.ts"],"sourcesContent":["import type {\n TSheetButtonState,\n TSheetButtonVariant,\n} from '../../../../../sheets/comps/sheet-button/types';\nimport type {\n ISheetDataProps,\n TTestHelpItemsDataProps,\n} from '../../../../../sheets/sheets-list/sheet-item/sheet-item-types';\n\nimport { SHEET_STATE } from '../../../../../sheets/constants/sheet';\nimport { IS_CHAPTER_COMPLETED_STATES } from '../../../../create/milestone-create-constants';\n\nconst { COMPLETED } = SHEET_STATE;\n\ninterface IGetTestSheetCtaInfo {\n (\n state: ISheetDataProps['state'],\n permissions: ISheetDataProps['permissions'],\n isStudent: boolean,\n ): {\n state: TSheetButtonState | undefined;\n renderAs: TSheetButtonVariant;\n label: 'Start' | 'Resume' | 'View' | 'Review';\n };\n}\n\nconst getTestCtaInfo: IGetTestSheetCtaInfo = (sheetState, permissions, isStudent) => {\n const { can_start: canStart, can_resume: canResume } = permissions;\n\n const isSheetCompleted =\n sheetState === COMPLETED ||\n IS_CHAPTER_COMPLETED_STATES.some(completedState => completedState === sheetState);\n\n if (isStudent) {\n if (canResume) {\n return {\n state: 'in_progress',\n renderAs: 'primary',\n label: 'Resume',\n };\n }\n\n if (canStart) {\n return {\n state: undefined,\n renderAs: 'primary',\n label: 'Start',\n };\n }\n }\n\n if (isSheetCompleted) {\n return {\n state: 'completed',\n renderAs: 'secondary_black',\n label: 'Review',\n };\n }\n\n return {\n state: canResume ? 'in_progress' : undefined,\n renderAs: 'primary',\n label: 'View',\n };\n};\n\nconst getTopicsFromItems = (items?: TTestHelpItemsDataProps[]) => {\n const topics = new Set<string>();\n\n items?.forEach(item => {\n topics.add(item.chapter_name);\n });\n\n return Array.from(topics);\n};\n\nexport { getTopicsFromItems, getTestCtaInfo };\n"],"names":["getTopicsFromItems","items","topics","item"],"mappings":"AAkEM,MAAAA,IAAqB,CAACC,MAAsC;AAC1D,QAAAC,wBAAa;AAEnB,SAAAD,KAAA,QAAAA,EAAO,QAAQ,CAAQE,MAAA;AACd,IAAAD,EAAA,IAAIC,EAAK,YAAY;AAAA,EAAA,IAGvB,MAAM,KAAKD,CAAM;AAC1B;"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { createGetAPI as r } from "@cuemath/rest-api";
|
2
|
+
import { BASE_URL_V3 as s } from "../../../constants/api.js";
|
3
|
+
const { useGet: p } = r({
|
4
|
+
getURL: (e, o, { courseStream: t }) => `${s}/users/${e}/course-streams/${t}/recent-chapters`
|
5
|
+
});
|
6
|
+
export {
|
7
|
+
p as useGetRecentChapters
|
8
|
+
};
|
9
|
+
//# sourceMappingURL=get-recent-chapters.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"get-recent-chapters.js","sources":["../../../../src/features/recent-chapters/api/get-recent-chapters.ts"],"sourcesContent":["import type { IChapterDataProps } from '../../chapters/chapter/chapter-types';\nimport type { TCourseStream } from '../../milestone/create/milestone-create-types';\n\nimport { createGetAPI } from '@cuemath/rest-api';\n\nimport { BASE_URL_V3 } from '../../../constants/api';\n\nconst { useGet: useGetRecentChapters } = createGetAPI<\n IChapterDataProps[],\n void,\n { courseStream: TCourseStream }\n>({\n getURL: (studentId: string, _, { courseStream }) =>\n `${BASE_URL_V3}/users/${studentId}/course-streams/${courseStream}/recent-chapters`,\n});\n\nexport { useGetRecentChapters };\n"],"names":["useGetRecentChapters","createGetAPI","studentId","_","courseStream","BASE_URL_V3"],"mappings":";;AAOA,MAAM,EAAE,QAAQA,EAAqB,IAAIC,EAIvC;AAAA,EACA,QAAQ,CAACC,GAAmBC,GAAG,EAAE,cAAAC,EAAA,MAC/B,GAAGC,CAAW,UAAUH,CAAS,mBAAmBE,CAAY;AACpE,CAAC;"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import e from "styled-components";
|
2
|
+
const p = e.div(({ theme: t }) => {
|
3
|
+
const { WHITE_5: r, WHITE_2: a } = t.colors;
|
4
|
+
return `
|
5
|
+
display: grid;
|
6
|
+
grid-template-columns: repeat(4, 1fr);
|
7
|
+
align-content: start;
|
8
|
+
background: ${a};
|
9
|
+
background-image: linear-gradient(${r} 0.5px, transparent 0.5px), linear-gradient(90deg, ${r} 0.5px, transparent 0.5px);
|
10
|
+
background-size: 45px 45px;
|
11
|
+
`;
|
12
|
+
});
|
13
|
+
export {
|
14
|
+
p as ChaptersWrapper
|
15
|
+
};
|
16
|
+
//# sourceMappingURL=recent-chapters-styled.js.map
|