@cuemath/leap 2.8.60-beta-0.1 → 2.8.60
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 +0 -9
- package/dist/assets/illustrations/illustrations.js.map +1 -1
- package/dist/assets/line-icons/icons/closed-eye.js +23 -0
- package/dist/assets/line-icons/icons/closed-eye.js.map +1 -0
- package/dist/features/chapters/chapters-list/chapter-item/chapter-item-styled.js +33 -98
- 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 +47 -76
- 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 +70 -65
- package/dist/features/chapters/chapters-list/chapters-list.js.map +1 -1
- package/dist/features/circle-games/game-launcher/comps/segmented-game-card/segmented-game-card.js +62 -75
- package/dist/features/circle-games/game-launcher/comps/segmented-game-card/segmented-game-card.js.map +1 -1
- package/dist/features/circle-games/game-launcher/comps/tables-card/tables-card.js +127 -110
- package/dist/features/circle-games/game-launcher/comps/tables-card/tables-card.js.map +1 -1
- package/dist/features/milestone/create/comps/milestone-progress-v2/milestone-progress-v2.js +92 -0
- package/dist/features/milestone/create/comps/milestone-progress-v2/milestone-progress-v2.js.map +1 -0
- package/dist/features/milestone/create/comps/milestone-progress-v2/styled.js +25 -0
- package/dist/features/milestone/create/comps/milestone-progress-v2/styled.js.map +1 -0
- package/dist/features/milestone/edit/comps/edit-milestone-modal/index.js +53 -51
- package/dist/features/milestone/edit/comps/edit-milestone-modal/index.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/api/get-milestones.js +17 -9
- package/dist/features/milestone/milestone-list-container/api/get-milestones.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-list.js +91 -116
- 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/context-menu-helper/menu-element-styled.js +13 -0
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/context-menu-helper/menu-element-styled.js.map +1 -0
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/context-menu-helper/menu-element.js +38 -0
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/context-menu-helper/menu-element.js.map +1 -0
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/goals/goal-action-ctas.js +121 -105
- 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 +173 -145
- 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 +10 -24
- 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 +81 -76
- 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 +22 -10
- 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-status.js +53 -0
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget-status.js.map +1 -0
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget-styled.js +37 -70
- 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 +174 -114
- 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-info.js +25 -0
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/outcome/outcome-info.js.map +1 -0
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/outcome/outcome-rank.js +16 -29
- 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 +23 -19
- 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 +35 -23
- 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 +36 -34
- 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 +78 -96
- package/dist/features/milestone/milestone-resources/resources-list/resources-list.js.map +1 -1
- package/dist/features/milestone/milestone-tests/tests-list/tests-list.js +68 -77
- package/dist/features/milestone/milestone-tests/tests-list/tests-list.js.map +1 -1
- package/dist/features/sheets/sheets-list/sheet-item/reward-n-actions/teacher-actions/teacher-actions-constant.js +3 -4
- package/dist/features/sheets/sheets-list/sheet-item/reward-n-actions/teacher-actions/teacher-actions-constant.js.map +1 -1
- package/dist/features/sheets/utils/is-v3-worksheet.js.map +1 -1
- package/dist/features/ui/arrow-tooltip/arrow-tooltip.js +29 -30
- 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 +14 -28
- package/dist/features/ui/context-menu/context-menu-styled.js.map +1 -1
- package/dist/features/ui/context-menu/context-menu.js +15 -30
- package/dist/features/ui/context-menu/context-menu.js.map +1 -1
- package/dist/features/ui/lottie-animation/lottie-animation.js +39 -24
- package/dist/features/ui/lottie-animation/lottie-animation.js.map +1 -1
- package/dist/features/ui/theme/button.js +102 -17
- package/dist/features/ui/theme/button.js.map +1 -1
- package/dist/index.d.ts +12 -187
- package/dist/index.js +471 -487
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/assets/line-icons/icons/alarm.js +0 -41
- package/dist/assets/line-icons/icons/alarm.js.map +0 -1
- package/dist/assets/line-icons/icons/dart.js +0 -23
- package/dist/assets/line-icons/icons/dart.js.map +0 -1
- package/dist/assets/line-icons/icons/exclamation.js +0 -26
- package/dist/assets/line-icons/icons/exclamation.js.map +0 -1
- package/dist/assets/line-icons/icons/home2.js +0 -25
- package/dist/assets/line-icons/icons/home2.js.map +0 -1
- package/dist/assets/line-icons/icons/important.js +0 -23
- package/dist/assets/line-icons/icons/important.js.map +0 -1
- package/dist/assets/line-icons/icons/puzzle.js +0 -25
- package/dist/assets/line-icons/icons/puzzle.js.map +0 -1
- package/dist/assets/line-icons/icons/recap.js +0 -32
- package/dist/assets/line-icons/icons/recap.js.map +0 -1
- package/dist/assets/line-icons/icons/status.js +0 -41
- package/dist/assets/line-icons/icons/status.js.map +0 -1
- package/dist/assets/line-icons/icons/testtube.js +0 -33
- package/dist/assets/line-icons/icons/testtube.js.map +0 -1
- package/dist/features/chapters-v2/api/chapter.js +0 -10
- package/dist/features/chapters-v2/api/chapter.js.map +0 -1
- package/dist/features/chapters-v2/chapter-details/block-sections/block-section-view.js +0 -112
- package/dist/features/chapters-v2/chapter-details/block-sections/block-section-view.js.map +0 -1
- package/dist/features/chapters-v2/chapter-details/block-sections/block-sections-styled.js +0 -26
- package/dist/features/chapters-v2/chapter-details/block-sections/block-sections-styled.js.map +0 -1
- package/dist/features/chapters-v2/chapter-details/block-sections/block-sections.js +0 -69
- package/dist/features/chapters-v2/chapter-details/block-sections/block-sections.js.map +0 -1
- package/dist/features/chapters-v2/chapter-details/chapter-banner/chapter-banner-styled.js +0 -90
- package/dist/features/chapters-v2/chapter-details/chapter-banner/chapter-banner-styled.js.map +0 -1
- package/dist/features/chapters-v2/chapter-details/chapter-banner/chapter-banner.js +0 -97
- package/dist/features/chapters-v2/chapter-details/chapter-banner/chapter-banner.js.map +0 -1
- package/dist/features/chapters-v2/chapter-details/chapter-details-styled.js +0 -52
- package/dist/features/chapters-v2/chapter-details/chapter-details-styled.js.map +0 -1
- package/dist/features/chapters-v2/chapter-details/chapter-details.js +0 -103
- package/dist/features/chapters-v2/chapter-details/chapter-details.js.map +0 -1
- package/dist/features/chapters-v2/comps/node-card/border-path-animation.js +0 -13
- package/dist/features/chapters-v2/comps/node-card/border-path-animation.js.map +0 -1
- package/dist/features/chapters-v2/comps/node-card/node-card-styled.js +0 -154
- package/dist/features/chapters-v2/comps/node-card/node-card-styled.js.map +0 -1
- package/dist/features/chapters-v2/comps/node-card/node-card-tags.js +0 -12
- package/dist/features/chapters-v2/comps/node-card/node-card-tags.js.map +0 -1
- package/dist/features/chapters-v2/comps/node-card/node-card.js +0 -12
- package/dist/features/chapters-v2/comps/node-card/node-card.js.map +0 -1
- package/dist/features/chapters-v2/comps/node-card/node-menu-options/node-menu-options-styled.js +0 -32
- package/dist/features/chapters-v2/comps/node-card/node-menu-options/node-menu-options-styled.js.map +0 -1
- package/dist/features/chapters-v2/comps/node-card/node-menu-options/node-menu-options.js +0 -31
- package/dist/features/chapters-v2/comps/node-card/node-menu-options/node-menu-options.js.map +0 -1
- package/dist/features/chapters-v2/comps/node-card/student-actions/student-actions.js +0 -160
- package/dist/features/chapters-v2/comps/node-card/student-actions/student-actions.js.map +0 -1
- package/dist/features/chapters-v2/comps/node-card/teacher-actions/teacher-actions.js +0 -184
- package/dist/features/chapters-v2/comps/node-card/teacher-actions/teacher-actions.js.map +0 -1
- package/dist/features/chapters-v2/comps/tag/tag-styled.js +0 -13
- package/dist/features/chapters-v2/comps/tag/tag-styled.js.map +0 -1
- package/dist/features/chapters-v2/comps/tag/tag.js +0 -28
- package/dist/features/chapters-v2/comps/tag/tag.js.map +0 -1
- package/dist/features/chapters-v2/constants/block-constants.js +0 -20
- package/dist/features/chapters-v2/constants/block-constants.js.map +0 -1
- package/dist/features/chapters-v2/constants/node-constants.js +0 -15
- package/dist/features/chapters-v2/constants/node-constants.js.map +0 -1
- package/dist/features/chapters-v2/utils/index.js +0 -40
- package/dist/features/chapters-v2/utils/index.js.map +0 -1
- package/dist/features/chapters-v2/utils/node-card-utils.js +0 -78
- package/dist/features/chapters-v2/utils/node-card-utils.js.map +0 -1
- package/dist/static/chapter-header-bg-2.c8d96894.svg +0 -1
- package/dist/static/node-custom-test-bg.d3b757be.svg +0 -1
- package/dist/static/node-learn-bg.b61f815c.svg +0 -1
- package/dist/static/node-practice-bg.16cbaf2a.svg +0 -1
- package/dist/static/node-project-bg.e6a33e28.svg +0 -1
- package/dist/static/node-puzzle-bg.3422135c.svg +0 -1
- package/dist/static/node-recap-bg.546154e4.svg +0 -1
- package/dist/static/node-test-prep-bg.42c0b9c4.svg +0 -1
- package/dist/static/node-video-bg.3df3f73a.svg +0 -1
@@ -1,79 +1,84 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { memo as
|
1
|
+
import { jsxs as i, jsx as r, Fragment as T } from "react/jsx-runtime";
|
2
|
+
import { memo as b, useCallback as y } from "react";
|
3
3
|
import { IMAGES as g } from "../../../assets/images/images.js";
|
4
|
-
import k from "
|
5
|
-
import x from "../../ui/
|
4
|
+
import k from "../../../assets/line-icons/icons/plus2.js";
|
5
|
+
import x from "../../ui/arrow-tooltip/arrow-tooltip.js";
|
6
|
+
import E from "../../ui/buttons/button/button.js";
|
7
|
+
import I from "../../ui/buttons/icon-button/icon-button.js";
|
6
8
|
import { useUIContext as $ } from "../../ui/context/context.js";
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import
|
10
|
-
import { ChaptersListContainer as
|
11
|
-
const
|
12
|
-
({ milestoneId: t, canUpdatePlan:
|
13
|
-
const { isGoalCreation:
|
14
|
-
|
9
|
+
import d from "../../ui/separator/separator.js";
|
10
|
+
import L from "../../ui/text/text.js";
|
11
|
+
import X from "./chapter-item/chapter-item.js";
|
12
|
+
import { ChaptersListContainer as h, ChaptersWrapper as M, AddChapterIconWrapper as S } from "./chapters-list-styled.js";
|
13
|
+
const j = b(
|
14
|
+
({ milestoneId: t, canUpdatePlan: n, chapters: a, ...C }) => {
|
15
|
+
const { isGoalCreation: s, userType: o, onChapterClick: f, onAddChapter: e, isMilestoneActive: p } = C, A = o === "TEACHER" && e && n, { onClick: c } = $(), m = y(() => {
|
16
|
+
c({
|
15
17
|
label: "add_chapter_icon",
|
16
18
|
props: {
|
17
19
|
milestone_id: t
|
18
20
|
}
|
19
|
-
}), e == null || e({ milestoneId: t, isGoalCreation:
|
20
|
-
}, [t,
|
21
|
-
return
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
}), e == null || e({ milestoneId: t, isGoalCreation: s });
|
22
|
+
}, [t, s, e, c]);
|
23
|
+
return a.length ? /* @__PURE__ */ i(h, { children: [
|
24
|
+
/* @__PURE__ */ r(M, { children: a.map((l, u) => {
|
25
|
+
const { id: _ } = l;
|
26
|
+
return /* @__PURE__ */ r(
|
27
|
+
X,
|
28
|
+
{
|
29
|
+
milestoneId: t,
|
30
|
+
userType: o,
|
31
|
+
chapter: l,
|
32
|
+
onChapterClick: f,
|
33
|
+
itemIndex: u
|
34
|
+
},
|
35
|
+
_
|
36
|
+
);
|
37
|
+
}) }),
|
38
|
+
A && /* @__PURE__ */ r(S, { children: /* @__PURE__ */ r(
|
39
|
+
I,
|
25
40
|
{
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
}
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
{
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
k,
|
41
|
+
Icon: k,
|
42
|
+
renderAs: "secondary",
|
43
|
+
size: "small",
|
44
|
+
analyticsLabel: "add_chapter_icon",
|
45
|
+
onClick: m
|
46
|
+
}
|
47
|
+
) })
|
48
|
+
] }) : /* @__PURE__ */ i(h, { $gapX: 6.75, $alignItems: "center", $justifyContent: "center", children: [
|
49
|
+
/* @__PURE__ */ r("img", { src: g.EMPTY_MIX_TESTS, alt: "empty_mix_tests" }),
|
50
|
+
/* @__PURE__ */ r(d, { heightX: 2 }),
|
51
|
+
o === "TEACHER" ? /* @__PURE__ */ i(T, { children: [
|
52
|
+
/* @__PURE__ */ r(
|
53
|
+
x,
|
54
|
+
{
|
55
|
+
renderAs: "primary",
|
56
|
+
position: "bottom",
|
57
|
+
hidden: p,
|
58
|
+
tooltipItem: "Plan is completed",
|
59
|
+
children: /* @__PURE__ */ r(
|
60
|
+
E,
|
47
61
|
{
|
62
|
+
widthX: 10,
|
48
63
|
renderAs: "primary",
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
shape: "square",
|
58
|
-
size: "small",
|
59
|
-
label: "Add chapter",
|
60
|
-
onClick: f,
|
61
|
-
disabled: !n || !d,
|
62
|
-
analyticsProps: {
|
63
|
-
milestone_id: t
|
64
|
-
}
|
65
|
-
}
|
66
|
-
)
|
64
|
+
shape: "square",
|
65
|
+
size: "small",
|
66
|
+
label: "Add chapter",
|
67
|
+
onClick: m,
|
68
|
+
disabled: !p || !n,
|
69
|
+
analyticsProps: {
|
70
|
+
milestone_id: t
|
71
|
+
}
|
67
72
|
}
|
68
|
-
)
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
}
|
73
|
-
);
|
73
|
+
)
|
74
|
+
}
|
75
|
+
),
|
76
|
+
/* @__PURE__ */ r(d, { heightX: 2 })
|
77
|
+
] }) : /* @__PURE__ */ r(L, { $renderAs: "ab2-bold", $color: "BLACK_T_87", children: "Wait for the teacher to add a chapter" })
|
78
|
+
] });
|
74
79
|
}
|
75
|
-
),
|
80
|
+
), K = j;
|
76
81
|
export {
|
77
|
-
|
82
|
+
K as default
|
78
83
|
};
|
79
84
|
//# sourceMappingURL=chapters-list.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"chapters-list.js","sources":["../../../../src/features/chapters/chapters-list/chapters-list.tsx"],"sourcesContent":["import type { IChaptersListProps } from './chapters-list-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback } 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 { useUIContext } from '../../ui/context/context';\nimport Separator from '../../ui/separator/separator';\nimport Text from '../../ui/text/text';\nimport ChapterItem from './chapter-item/chapter-item';\nimport * as Styled from './chapters-list-styled';\n\nconst ChaptersList: FC<IChaptersListProps> = memo(\n ({ milestoneId, canUpdatePlan, chapters, ...restChaptersList }) => {\n const { isGoalCreation, userType, onChapterClick, onAddChapter, isMilestoneActive } =\n restChaptersList;\n\n const { onClick: trackOnClick } = useUIContext();\n\n const handleOnAddChapter = useCallback(() => {\n trackOnClick({\n label: 'add_chapter_icon',\n props: {\n milestone_id: milestoneId,\n },\n });\n onAddChapter?.({ milestoneId, isGoalCreation });\n }, [milestoneId, isGoalCreation, onAddChapter, trackOnClick]);\n\n if (!chapters.length) {\n return (\n <Styled.ChaptersListContainer
|
1
|
+
{"version":3,"file":"chapters-list.js","sources":["../../../../src/features/chapters/chapters-list/chapters-list.tsx"],"sourcesContent":["import type { IChaptersListProps } from './chapters-list-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback } from 'react';\n\nimport { IMAGES } from '../../../assets/images/images';\nimport Plus2Icon from '../../../assets/line-icons/icons/plus2';\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 { useUIContext } from '../../ui/context/context';\nimport Separator from '../../ui/separator/separator';\nimport Text from '../../ui/text/text';\nimport ChapterItem from './chapter-item/chapter-item';\nimport * as Styled from './chapters-list-styled';\n\nconst ChaptersList: FC<IChaptersListProps> = memo(\n ({ milestoneId, canUpdatePlan, chapters, ...restChaptersList }) => {\n const { isGoalCreation, userType, onChapterClick, onAddChapter, isMilestoneActive } =\n restChaptersList;\n\n const canAddChapter = userType === 'TEACHER' && onAddChapter && canUpdatePlan;\n const { onClick: trackOnClick } = useUIContext();\n\n const handleOnAddChapter = useCallback(() => {\n trackOnClick({\n label: 'add_chapter_icon',\n props: {\n milestone_id: milestoneId,\n },\n });\n onAddChapter?.({ milestoneId, isGoalCreation });\n }, [milestoneId, isGoalCreation, onAddChapter, trackOnClick]);\n\n if (!chapters.length) {\n return (\n <Styled.ChaptersListContainer $gapX={6.75} $alignItems=\"center\" $justifyContent=\"center\">\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={isMilestoneActive}\n tooltipItem=\"Plan is completed\"\n >\n <Button\n widthX={10}\n renderAs=\"primary\"\n shape=\"square\"\n size=\"small\"\n label=\"Add chapter\"\n onClick={handleOnAddChapter}\n disabled={!isMilestoneActive || !canUpdatePlan}\n analyticsProps={{\n milestone_id: milestoneId,\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 add a chapter\n </Text>\n )}\n </Styled.ChaptersListContainer>\n );\n }\n\n return (\n <Styled.ChaptersListContainer>\n <Styled.ChaptersWrapper>\n {chapters.map((chapter, idx) => {\n const { id } = chapter;\n\n return (\n <ChapterItem\n key={id}\n milestoneId={milestoneId}\n userType={userType}\n chapter={chapter}\n onChapterClick={onChapterClick}\n itemIndex={idx}\n />\n );\n })}\n </Styled.ChaptersWrapper>\n {canAddChapter && (\n <Styled.AddChapterIconWrapper>\n <IconButton\n Icon={Plus2Icon}\n renderAs=\"secondary\"\n size=\"small\"\n analyticsLabel=\"add_chapter_icon\"\n onClick={handleOnAddChapter}\n />\n </Styled.AddChapterIconWrapper>\n )}\n </Styled.ChaptersListContainer>\n );\n },\n);\n\nexport default ChaptersList;\n"],"names":["ChaptersList","memo","milestoneId","canUpdatePlan","chapters","restChaptersList","isGoalCreation","userType","onChapterClick","onAddChapter","isMilestoneActive","canAddChapter","trackOnClick","useUIContext","handleOnAddChapter","useCallback","jsxs","Styled.ChaptersListContainer","jsx","Styled.ChaptersWrapper","chapter","idx","id","ChapterItem","Styled.AddChapterIconWrapper","IconButton","Plus2Icon","IMAGES","Separator","Fragment","ArrowTooltip","Button","Text","ChaptersList$1"],"mappings":";;;;;;;;;;;;AAgBA,MAAMA,IAAuCC;AAAA,EAC3C,CAAC,EAAE,aAAAC,GAAa,eAAAC,GAAe,UAAAC,GAAU,GAAGC,QAAuB;AACjE,UAAM,EAAE,gBAAAC,GAAgB,UAAAC,GAAU,gBAAAC,GAAgB,cAAAC,GAAc,mBAAAC,EAC9D,IAAAL,GAEIM,IAAgBJ,MAAa,aAAaE,KAAgBN,GAC1D,EAAE,SAASS,EAAa,IAAIC,EAAa,GAEzCC,IAAqBC,EAAY,MAAM;AAC9B,MAAAH,EAAA;AAAA,QACX,OAAO;AAAA,QACP,OAAO;AAAA,UACL,cAAcV;AAAA,QAChB;AAAA,MAAA,CACD,GACcO,KAAA,QAAAA,EAAA,EAAE,aAAAP,GAAa,gBAAAI,EAAA;AAAA,OAC7B,CAACJ,GAAaI,GAAgBG,GAAcG,CAAY,CAAC;AAExD,W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;AAAA,YACF;AAAA,UAAA;AAAA,QACF;AAAA,QACA,gBAAAgB,EAACU,GAAU,EAAA,SAAS,EAAG,CAAA;AAAA,MAAA,EAAA,CACzB,IAEC,gBAAAV,EAAAc,GAAA,EAAK,WAAU,YAAW,QAAO,cAAa,UAE/C,yCAAA;AAAA,IAEJ,EAAA,CAAA;AAAA,EAmCN;AACF,GAEAC,IAAejC;"}
|
package/dist/features/circle-games/game-launcher/comps/segmented-game-card/segmented-game-card.js
CHANGED
@@ -1,118 +1,105 @@
|
|
1
|
-
import {
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import $ from "../../../../../assets/
|
5
|
-
import
|
6
|
-
import {
|
7
|
-
import U from "
|
8
|
-
|
9
|
-
|
10
|
-
const
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
}) => {
|
17
|
-
const
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
loop: !0,
|
26
|
-
autoplay: !0,
|
27
|
-
animationData: p
|
28
|
-
});
|
29
|
-
})(), () => o == null ? void 0 : o.destroy();
|
30
|
-
}, [m]);
|
31
|
-
const d = c(() => s(l), [s, l]);
|
32
|
-
return /* @__PURE__ */ t(z, { children: /* @__PURE__ */ I(J, { $segmentType: e, onMouseEnter: d, children: [
|
33
|
-
/* @__PURE__ */ t(K, { ref: a, $segmentType: e }),
|
34
|
-
i && /* @__PURE__ */ t(Q, { $segmentType: e, children: /* @__PURE__ */ t(X, { children: /* @__PURE__ */ t($, { color: "#fff", height: 40, width: 40 }) }) })
|
35
|
-
] }) });
|
36
|
-
}, Y = ({ data: e, label: i, initialValue: m = 0, value: l, maxValue: s = 1 }, a) => {
|
37
|
-
const d = T(null), o = T(null), [u, p] = h(i), [L, y] = h(!1), [R, P] = h("WHITE_T_87"), _ = u !== i, C = c((n) => {
|
38
|
-
p(n);
|
39
|
-
}, []), b = c(() => {
|
40
|
-
p(i);
|
41
|
-
}, [i]), g = c(
|
42
|
-
(n) => {
|
43
|
-
var r, f;
|
44
|
-
(f = (r = e[n]) == null ? void 0 : r.onPress) == null || f.call(r);
|
1
|
+
import { jsx as n, jsxs as L } from "react/jsx-runtime";
|
2
|
+
import { memo as P, useCallback as m, forwardRef as O, useRef as E, useState as f, useImperativeHandle as F, useMemo as A } from "react";
|
3
|
+
import G from "../../../../../assets/line-icons/icons/check.js";
|
4
|
+
import { LOTTIE as $ } from "../../../../../assets/lottie/lottie.js";
|
5
|
+
import R from "../../../../ui/lottie-animation/lottie-animation.js";
|
6
|
+
import { CardContainer as j } from "../card-container/card-container.js";
|
7
|
+
import { SegmentContainer as w, SegmentContentContainer as U, SegmentAssetContainer as x, SegmentOverlay as B, IconWrapper as N, CircularProgressLottieContainer as q, SegmentLeft as z, SegmentRight as D, SegmentBottom as J } from "./segmented-game-card-styled.js";
|
8
|
+
const K = { renderer: "canvas", loop: !0 }, C = P(
|
9
|
+
({ segmentType: e, isCompleted: o, card: c, name: i, onMouseEnter: s }) => {
|
10
|
+
const a = m(() => s(i), [s, i]);
|
11
|
+
return /* @__PURE__ */ n(w, { children: /* @__PURE__ */ L(U, { $segmentType: e, onMouseEnter: a, children: [
|
12
|
+
/* @__PURE__ */ n(x, { $segmentType: e, children: /* @__PURE__ */ n(R, { src: c, settings: K, animateOnIntersect: !0 }) }),
|
13
|
+
o && /* @__PURE__ */ n(B, { $segmentType: e, children: /* @__PURE__ */ n(N, { children: /* @__PURE__ */ n(G, { color: "#fff", height: 40, width: 40 }) }) })
|
14
|
+
] }) });
|
15
|
+
}
|
16
|
+
), Q = ({ data: e, label: o, initialValue: c = 0, value: i, maxValue: s = 1 }, a) => {
|
17
|
+
const g = E(null), h = E(null), [u, S] = f(o), [T, _] = f(!1), [b, M] = f("WHITE_T_87"), W = u !== o, d = m((t) => {
|
18
|
+
S(t);
|
19
|
+
}, []), k = m(() => {
|
20
|
+
S(o);
|
21
|
+
}, [o]), p = m(
|
22
|
+
(t) => {
|
23
|
+
var r, l;
|
24
|
+
(l = (r = e[t]) == null ? void 0 : r.onPress) == null || l.call(r);
|
45
25
|
},
|
46
26
|
[e]
|
47
|
-
),
|
48
|
-
|
27
|
+
), v = m((t) => {
|
28
|
+
_(!0), M(t);
|
49
29
|
}, []);
|
50
30
|
F(a, () => ({
|
51
|
-
labelRef:
|
52
|
-
segmentedCardWrapperRef:
|
53
|
-
startLabelAnimation:
|
31
|
+
labelRef: g,
|
32
|
+
segmentedCardWrapperRef: h,
|
33
|
+
startLabelAnimation: v
|
54
34
|
}));
|
55
|
-
const
|
35
|
+
const I = A(() => {
|
56
36
|
if (s <= 0)
|
57
37
|
return;
|
58
|
-
const
|
59
|
-
return [
|
60
|
-
}, [
|
38
|
+
const t = 92, r = t / s, l = Math.min(r * c, t), H = Math.min(r * i + 1, t);
|
39
|
+
return [l, H];
|
40
|
+
}, [c, s, i]), y = A(
|
61
41
|
() => ({
|
62
42
|
renderer: "canvas",
|
63
43
|
autoplay: !0,
|
64
44
|
loop: !1,
|
65
|
-
initialSegment:
|
45
|
+
initialSegment: I
|
66
46
|
}),
|
67
|
-
[
|
47
|
+
[I]
|
68
48
|
);
|
69
|
-
return /* @__PURE__ */
|
70
|
-
|
49
|
+
return /* @__PURE__ */ L(
|
50
|
+
j,
|
71
51
|
{
|
72
|
-
ref:
|
73
|
-
labelRef:
|
52
|
+
ref: h,
|
53
|
+
labelRef: g,
|
74
54
|
label: u,
|
75
|
-
isAnimated:
|
76
|
-
onMouseLeave:
|
77
|
-
labelColor:
|
55
|
+
isAnimated: T,
|
56
|
+
onMouseLeave: k,
|
57
|
+
labelColor: T ? b : W ? "WHITE_T_87" : "WHITE_T_60",
|
78
58
|
children: [
|
79
|
-
/* @__PURE__ */
|
80
|
-
|
81
|
-
|
59
|
+
/* @__PURE__ */ n(q, { children: /* @__PURE__ */ n(
|
60
|
+
R,
|
61
|
+
{
|
62
|
+
src: $.LEVELUP_RINGS,
|
63
|
+
settings: y,
|
64
|
+
animateOnIntersect: !0
|
65
|
+
}
|
66
|
+
) }),
|
67
|
+
/* @__PURE__ */ n(z, { onClick: () => p(0), children: /* @__PURE__ */ n(
|
68
|
+
C,
|
82
69
|
{
|
83
70
|
segmentType: "left",
|
84
71
|
card: e[0].card,
|
85
72
|
name: e[0].name,
|
86
73
|
isCompleted: e[0].isCompleted,
|
87
|
-
onMouseEnter:
|
74
|
+
onMouseEnter: d
|
88
75
|
}
|
89
76
|
) }),
|
90
|
-
/* @__PURE__ */
|
91
|
-
|
77
|
+
/* @__PURE__ */ n(D, { onClick: () => p(1), children: /* @__PURE__ */ n(
|
78
|
+
C,
|
92
79
|
{
|
93
80
|
segmentType: "right",
|
94
81
|
card: e[1].card,
|
95
82
|
name: e[1].name,
|
96
83
|
isCompleted: e[1].isCompleted,
|
97
|
-
onMouseEnter:
|
84
|
+
onMouseEnter: d
|
98
85
|
}
|
99
86
|
) }),
|
100
|
-
/* @__PURE__ */
|
101
|
-
|
87
|
+
/* @__PURE__ */ n(J, { onClick: () => p(2), children: /* @__PURE__ */ n(
|
88
|
+
C,
|
102
89
|
{
|
103
90
|
segmentType: "bottom",
|
104
91
|
card: e[2].card,
|
105
92
|
name: e[2].name,
|
106
93
|
isCompleted: e[2].isCompleted,
|
107
|
-
onMouseEnter:
|
94
|
+
onMouseEnter: d
|
108
95
|
}
|
109
96
|
) })
|
110
97
|
]
|
111
98
|
}
|
112
99
|
);
|
113
|
-
},
|
100
|
+
}, re = P(O(Q));
|
114
101
|
export {
|
115
|
-
|
116
|
-
|
102
|
+
C as SegmentContent,
|
103
|
+
re as SegmentedGameCard
|
117
104
|
};
|
118
105
|
//# sourceMappingURL=segmented-game-card.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"segmented-game-card.js","sources":["../../../../../../src/features/circle-games/game-launcher/comps/segmented-game-card/segmented-game-card.tsx"],"sourcesContent":["import type { TColorNames } from '../../../../ui/types';\nimport type {\n IGameCardSegmentContentProps,\n ISegmentedGameCardProps,\n ISegmentedGameCardRefs,\n} from './segmented-game-card-types';\nimport type { AnimationItem } from 'lottie-web';\nimport type { FC, ForwardRefRenderFunction } from 'react';\n\nimport Lottie from 'lottie-web';\nimport {\n forwardRef,\n memo,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport CheckIcon from '../../../../../assets/line-icons/icons/check';\nimport { LOTTIE } from '../../../../../assets/lottie/lottie';\nimport { fetchLottie } from '../../../../ui/lottie-animation/helper';\nimport LottieAnimation from '../../../../ui/lottie-animation/lottie-animation';\nimport { CardContainer } from '../card-container/card-container';\nimport * as Styled from './segmented-game-card-styled';\n\nexport const SegmentContent: FC<IGameCardSegmentContentProps> = ({\n segmentType,\n isCompleted,\n card,\n name,\n onMouseEnter,\n}) => {\n const lottieAnimationRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n let animation: AnimationItem | null = null;\n\n const loadLottie = async () => {\n const lottie = await fetchLottie(card);\n\n animation = Lottie.loadAnimation({\n container: lottieAnimationRef.current as Element,\n renderer: 'canvas',\n loop: true,\n autoplay: true,\n animationData: lottie,\n });\n };\n\n loadLottie();\n\n return () => {\n return animation?.destroy();\n };\n }, [card]);\n\n const handleMouseEnter = useCallback(() => onMouseEnter(name), [onMouseEnter, name]);\n\n return (\n <Styled.SegmentContainer>\n <Styled.SegmentContentContainer $segmentType={segmentType} onMouseEnter={handleMouseEnter}>\n <Styled.SegmentAssetContainer ref={lottieAnimationRef} $segmentType={segmentType} />\n {isCompleted && (\n <Styled.SegmentOverlay $segmentType={segmentType}>\n <Styled.IconWrapper>\n <CheckIcon color=\"#fff\" height={40} width={40} />\n </Styled.IconWrapper>\n </Styled.SegmentOverlay>\n )}\n </Styled.SegmentContentContainer>\n </Styled.SegmentContainer>\n );\n};\n\nconst SegmentedGameCardComponent: ForwardRefRenderFunction<\n ISegmentedGameCardRefs,\n ISegmentedGameCardProps\n> = ({ data, label: gameCategoryLabel, initialValue = 0, value, maxValue = 1 }, ref) => {\n const labelRef = useRef<HTMLDivElement>(null);\n const cardWrapperRef = useRef<HTMLDivElement>(null);\n\n const [label, setLabel] = useState<string>(gameCategoryLabel);\n const [isAnimated, setIsAnimated] = useState(false);\n const [animatedColor, setAnimatedColor] = useState<TColorNames>('WHITE_T_87');\n\n const isLabelHighlighted = label !== gameCategoryLabel;\n\n const onMouseEnter = useCallback((gameName: string) => {\n setLabel(gameName);\n }, []);\n\n const onMouseLeave = useCallback(() => {\n setLabel(gameCategoryLabel);\n }, [gameCategoryLabel]);\n\n const onSegmentPress = useCallback(\n (index: number) => {\n data[index]?.onPress?.();\n },\n [data],\n );\n\n const startLabelAnimation = useCallback((color: TColorNames) => {\n setIsAnimated(true);\n setAnimatedColor(color);\n }, []);\n\n useImperativeHandle(ref, () => ({\n labelRef,\n segmentedCardWrapperRef: cardWrapperRef,\n startLabelAnimation,\n }));\n\n const animationSegments: [number, number] | undefined = useMemo(() => {\n if (maxValue <= 0) {\n return;\n }\n\n const totalFrames = 92;\n const framesPerValue = totalFrames / maxValue;\n\n const initialFrameToPlay = Math.min(framesPerValue * initialValue, totalFrames);\n const finalFrameToPlay = Math.min(framesPerValue * value + 1, totalFrames);\n\n return [initialFrameToPlay, finalFrameToPlay];\n }, [initialValue, maxValue, value]);\n\n const levelUpAnimationSettings = useMemo(\n () => ({\n renderer: 'canvas',\n autoplay: true,\n loop: false,\n initialSegment: animationSegments,\n }),\n [animationSegments],\n );\n\n return (\n <CardContainer\n ref={cardWrapperRef}\n labelRef={labelRef}\n label={label}\n isAnimated={isAnimated}\n onMouseLeave={onMouseLeave}\n labelColor={isAnimated ? animatedColor : isLabelHighlighted ? 'WHITE_T_87' : 'WHITE_T_60'}\n >\n <Styled.CircularProgressLottieContainer>\n <LottieAnimation src={LOTTIE.LEVELUP_RINGS} settings={levelUpAnimationSettings} />\n </Styled.CircularProgressLottieContainer>\n {/* left segment */}\n <Styled.SegmentLeft onClick={() => onSegmentPress(0)}>\n <SegmentContent\n segmentType={'left'}\n card={data[0]!.card}\n name={data[0]!.name}\n isCompleted={data[0]!.isCompleted}\n onMouseEnter={onMouseEnter}\n />\n </Styled.SegmentLeft>\n\n {/* right segment */}\n <Styled.SegmentRight onClick={() => onSegmentPress(1)}>\n <SegmentContent\n segmentType={'right'}\n card={data[1]!.card}\n name={data[1]!.name}\n isCompleted={data[1]!.isCompleted}\n onMouseEnter={onMouseEnter}\n />\n </Styled.SegmentRight>\n\n {/* bottom segment */}\n <Styled.SegmentBottom onClick={() => onSegmentPress(2)}>\n <SegmentContent\n segmentType={'bottom'}\n card={data[2]!.card}\n name={data[2]!.name}\n isCompleted={data[2]!.isCompleted}\n onMouseEnter={onMouseEnter}\n />\n </Styled.SegmentBottom>\n </CardContainer>\n );\n};\n\nexport const SegmentedGameCard = memo(forwardRef(SegmentedGameCardComponent));\n"],"names":["SegmentContent","segmentType","isCompleted","card","name","onMouseEnter","lottieAnimationRef","useRef","useEffect","animation","lottie","fetchLottie","Lottie","handleMouseEnter","useCallback","jsx","Styled.SegmentContainer","jsxs","Styled.SegmentContentContainer","Styled.SegmentAssetContainer","Styled.SegmentOverlay","Styled.IconWrapper","CheckIcon","SegmentedGameCardComponent","data","gameCategoryLabel","initialValue","value","maxValue","ref","labelRef","cardWrapperRef","label","setLabel","useState","isAnimated","setIsAnimated","animatedColor","setAnimatedColor","isLabelHighlighted","gameName","onMouseLeave","onSegmentPress","index","_b","_a","startLabelAnimation","color","useImperativeHandle","animationSegments","useMemo","totalFrames","framesPerValue","initialFrameToPlay","finalFrameToPlay","levelUpAnimationSettings","CardContainer","Styled.CircularProgressLottieContainer","LottieAnimation","LOTTIE","Styled.SegmentLeft","Styled.SegmentRight","Styled.SegmentBottom","SegmentedGameCard","memo","forwardRef"],"mappings":";;;;;;;;;AA4BO,MAAMA,IAAmD,CAAC;AAAA,EAC/D,aAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAAC;AACF,M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gBAAAxB,EAAA0C,GAAA,EACC,UAAC,gBAAA1C,EAAA2C,GAAA,EAAgB,KAAKC,EAAO,eAAe,UAAUJ,EAAA,CAA0B,EAClF,CAAA;AAAA,QAEA,gBAAAxC,EAAC6C,GAAA,EAAmB,SAAS,MAAMlB,EAAe,CAAC,GACjD,UAAA,gBAAA3B;AAAA,UAACf;AAAA,UAAA;AAAA,YACC,aAAa;AAAA,YACb,MAAMwB,EAAK,CAAC,EAAG;AAAA,YACf,MAAMA,EAAK,CAAC,EAAG;AAAA,YACf,aAAaA,EAAK,CAAC,EAAG;AAAA,YACtB,cAAAnB;AAAA,UAAA;AAAA,QAAA,GAEJ;AAAA,QAGA,gBAAAU,EAAC8C,GAAA,EAAoB,SAAS,MAAMnB,EAAe,CAAC,GAClD,UAAA,gBAAA3B;AAAA,UAACf;AAAA,UAAA;AAAA,YACC,aAAa;AAAA,YACb,MAAMwB,EAAK,CAAC,EAAG;AAAA,YACf,MAAMA,EAAK,CAAC,EAAG;AAAA,YACf,aAAaA,EAAK,CAAC,EAAG;AAAA,YACtB,cAAAnB;AAAA,UAAA;AAAA,QAAA,GAEJ;AAAA,QAGA,gBAAAU,EAAC+C,GAAA,EAAqB,SAAS,MAAMpB,EAAe,CAAC,GACnD,UAAA,gBAAA3B;AAAA,UAACf;AAAA,UAAA;AAAA,YACC,aAAa;AAAA,YACb,MAAMwB,EAAK,CAAC,EAAG;AAAA,YACf,MAAMA,EAAK,CAAC,EAAG;AAAA,YACf,aAAaA,EAAK,CAAC,EAAG;AAAA,YACtB,cAAAnB;AAAA,UAAA;AAAA,QAAA,GAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN,GAEa0D,KAAoBC,EAAKC,EAAW1C,CAA0B,CAAC;"}
|
1
|
+
{"version":3,"file":"segmented-game-card.js","sources":["../../../../../../src/features/circle-games/game-launcher/comps/segmented-game-card/segmented-game-card.tsx"],"sourcesContent":["import type { TColorNames } from '../../../../ui/types';\nimport type {\n IGameCardSegmentContentProps,\n ISegmentedGameCardProps,\n ISegmentedGameCardRefs,\n} from './segmented-game-card-types';\nimport type { ForwardRefRenderFunction } from 'react';\n\nimport {\n forwardRef,\n memo,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport CheckIcon from '../../../../../assets/line-icons/icons/check';\nimport { LOTTIE } from '../../../../../assets/lottie/lottie';\nimport LottieAnimation from '../../../../ui/lottie-animation/lottie-animation';\nimport { CardContainer } from '../card-container/card-container';\nimport * as Styled from './segmented-game-card-styled';\n\nconst renderSettings = { renderer: 'canvas', loop: true };\n\nexport const SegmentContent = memo(\n ({ segmentType, isCompleted, card, name, onMouseEnter }: IGameCardSegmentContentProps) => {\n const handleMouseEnter = useCallback(() => onMouseEnter(name), [onMouseEnter, name]);\n\n return (\n <Styled.SegmentContainer>\n <Styled.SegmentContentContainer $segmentType={segmentType} onMouseEnter={handleMouseEnter}>\n <Styled.SegmentAssetContainer $segmentType={segmentType}>\n <LottieAnimation src={card} settings={renderSettings} animateOnIntersect />\n </Styled.SegmentAssetContainer>\n\n {isCompleted && (\n <Styled.SegmentOverlay $segmentType={segmentType}>\n <Styled.IconWrapper>\n <CheckIcon color=\"#fff\" height={40} width={40} />\n </Styled.IconWrapper>\n </Styled.SegmentOverlay>\n )}\n </Styled.SegmentContentContainer>\n </Styled.SegmentContainer>\n );\n },\n);\n\nconst SegmentedGameCardComponent: ForwardRefRenderFunction<\n ISegmentedGameCardRefs,\n ISegmentedGameCardProps\n> = ({ data, label: gameCategoryLabel, initialValue = 0, value, maxValue = 1 }, ref) => {\n const labelRef = useRef<HTMLDivElement>(null);\n const cardWrapperRef = useRef<HTMLDivElement>(null);\n\n const [label, setLabel] = useState<string>(gameCategoryLabel);\n const [isAnimated, setIsAnimated] = useState(false);\n const [animatedColor, setAnimatedColor] = useState<TColorNames>('WHITE_T_87');\n\n const isLabelHighlighted = label !== gameCategoryLabel;\n\n const onMouseEnter = useCallback((gameName: string) => {\n setLabel(gameName);\n }, []);\n\n const onMouseLeave = useCallback(() => {\n setLabel(gameCategoryLabel);\n }, [gameCategoryLabel]);\n\n const onSegmentPress = useCallback(\n (index: number) => {\n data[index]?.onPress?.();\n },\n [data],\n );\n\n const startLabelAnimation = useCallback((color: TColorNames) => {\n setIsAnimated(true);\n setAnimatedColor(color);\n }, []);\n\n useImperativeHandle(ref, () => ({\n labelRef,\n segmentedCardWrapperRef: cardWrapperRef,\n startLabelAnimation,\n }));\n\n const animationSegments: [number, number] | undefined = useMemo(() => {\n if (maxValue <= 0) {\n return;\n }\n\n const totalFrames = 92;\n const framesPerValue = totalFrames / maxValue;\n\n const initialFrameToPlay = Math.min(framesPerValue * initialValue, totalFrames);\n const finalFrameToPlay = Math.min(framesPerValue * value + 1, totalFrames);\n\n return [initialFrameToPlay, finalFrameToPlay];\n }, [initialValue, maxValue, value]);\n\n const levelUpAnimationSettings = useMemo(\n () => ({\n renderer: 'canvas',\n autoplay: true,\n loop: false,\n initialSegment: animationSegments,\n }),\n [animationSegments],\n );\n\n return (\n <CardContainer\n ref={cardWrapperRef}\n labelRef={labelRef}\n label={label}\n isAnimated={isAnimated}\n onMouseLeave={onMouseLeave}\n labelColor={isAnimated ? animatedColor : isLabelHighlighted ? 'WHITE_T_87' : 'WHITE_T_60'}\n >\n <Styled.CircularProgressLottieContainer>\n <LottieAnimation\n src={LOTTIE.LEVELUP_RINGS}\n settings={levelUpAnimationSettings}\n animateOnIntersect\n />\n </Styled.CircularProgressLottieContainer>\n {/* left segment */}\n <Styled.SegmentLeft onClick={() => onSegmentPress(0)}>\n <SegmentContent\n segmentType={'left'}\n card={data[0]!.card}\n name={data[0]!.name}\n isCompleted={data[0]!.isCompleted}\n onMouseEnter={onMouseEnter}\n />\n </Styled.SegmentLeft>\n\n {/* right segment */}\n <Styled.SegmentRight onClick={() => onSegmentPress(1)}>\n <SegmentContent\n segmentType={'right'}\n card={data[1]!.card}\n name={data[1]!.name}\n isCompleted={data[1]!.isCompleted}\n onMouseEnter={onMouseEnter}\n />\n </Styled.SegmentRight>\n\n {/* bottom segment */}\n <Styled.SegmentBottom onClick={() => onSegmentPress(2)}>\n <SegmentContent\n segmentType={'bottom'}\n card={data[2]!.card}\n name={data[2]!.name}\n isCompleted={data[2]!.isCompleted}\n onMouseEnter={onMouseEnter}\n />\n </Styled.SegmentBottom>\n </CardContainer>\n );\n};\n\nexport const SegmentedGameCard = memo(forwardRef(SegmentedGameCardComponent));\n"],"names":["renderSettings","SegmentContent","memo","segmentType","isCompleted","card","name","onMouseEnter","handleMouseEnter","useCallback","jsx","Styled.SegmentContainer","jsxs","Styled.SegmentContentContainer","Styled.SegmentAssetContainer","LottieAnimation","Styled.SegmentOverlay","Styled.IconWrapper","CheckIcon","SegmentedGameCardComponent","data","gameCategoryLabel","initialValue","value","maxValue","ref","labelRef","useRef","cardWrapperRef","label","setLabel","useState","isAnimated","setIsAnimated","animatedColor","setAnimatedColor","isLabelHighlighted","gameName","onMouseLeave","onSegmentPress","index","_b","_a","startLabelAnimation","color","useImperativeHandle","animationSegments","useMemo","totalFrames","framesPerValue","initialFrameToPlay","finalFrameToPlay","levelUpAnimationSettings","CardContainer","Styled.CircularProgressLottieContainer","LOTTIE","Styled.SegmentLeft","Styled.SegmentRight","Styled.SegmentBottom","SegmentedGameCard","forwardRef"],"mappings":";;;;;;;AAwBA,MAAMA,IAAiB,EAAE,UAAU,UAAU,MAAM,GAAK,GAE3CC,IAAiBC;AAAA,EAC5B,CAAC,EAAE,aAAAC,GAAa,aAAAC,GAAa,MAAAC,GAAM,MAAAC,GAAM,cAAAC,QAAiD;AAClF,UAAAC,IAAmBC,EAAY,MAAMF,EAAaD,CAAI,GAAG,CAACC,GAAcD,CAAI,CAAC;AAGjF,WAAA,gBAAAI,EAACC,GAAA,EACC,UAAA,gBAAAC,EAACC,GAAA,EAA+B,cAAcV,GAAa,cAAcK,GACvE,UAAA;AAAA,MAAA,gBAAAE,EAACI,GAAA,EAA6B,cAAcX,GAC1C,U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