@cuemath/leap 3.2.9-pzd-0.3 → 3.2.10-hg1
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 -1
- package/dist/assets/illustrations/illustrations.js.map +1 -1
- package/dist/assets/lottie/lottie.js +0 -5
- package/dist/assets/lottie/lottie.js.map +1 -1
- package/dist/features/analytics-events/platform-events-student.js +1 -2
- package/dist/features/analytics-events/platform-events-student.js.map +1 -1
- package/dist/features/analytics-events/platform-events-teacher.js +4 -6
- package/dist/features/analytics-events/platform-events-teacher.js.map +1 -1
- package/dist/features/analytics-events/whitelist-events.js +8 -10
- package/dist/features/analytics-events/whitelist-events.js.map +1 -1
- package/dist/features/auth/account-selector/account-selector.js +23 -22
- package/dist/features/auth/account-selector/account-selector.js.map +1 -1
- package/dist/features/auth/comps/auth-page-layout/auth-page-layout.js +14 -13
- package/dist/features/auth/comps/auth-page-layout/auth-page-layout.js.map +1 -1
- package/dist/features/auth/comps/user-list/user-item/user-item.js +30 -31
- package/dist/features/auth/comps/user-list/user-item/user-item.js.map +1 -1
- package/dist/features/auth/comps/user-list/user-list.js +35 -34
- package/dist/features/auth/comps/user-list/user-list.js.map +1 -1
- package/dist/features/auth/forgot-password/forgot-password-styled.js +14 -15
- package/dist/features/auth/forgot-password/forgot-password-styled.js.map +1 -1
- package/dist/features/auth/login/identifier-otp-form/identifier-otp-form-styled.js +6 -7
- package/dist/features/auth/login/identifier-otp-form/identifier-otp-form-styled.js.map +1 -1
- package/dist/features/auth/login/login-styled.js +8 -9
- package/dist/features/auth/login/login-styled.js.map +1 -1
- package/dist/features/circle-games/game-launcher/hooks/use-game-launcher-journey/use-game-launcher-journey.js +118 -95
- package/dist/features/circle-games/game-launcher/hooks/use-game-launcher-journey/use-game-launcher-journey.js.map +1 -1
- package/dist/features/circle-games/game-launcher/hooks/use-table-infinite-launcher-journey/use-table-infinite-launcher-journey.js +29 -28
- package/dist/features/circle-games/game-launcher/hooks/use-table-infinite-launcher-journey/use-table-infinite-launcher-journey.js.map +1 -1
- package/dist/features/circle-games/game-launcher/hooks/use-table-launcher-journey/use-table-launcher-journey.js +43 -42
- package/dist/features/circle-games/game-launcher/hooks/use-table-launcher-journey/use-table-launcher-journey.js.map +1 -1
- package/dist/features/circle-games/games/tutorial/tutorial.js +43 -35
- package/dist/features/circle-games/games/tutorial/tutorial.js.map +1 -1
- package/dist/features/circle-games/sign-up/comp/username-input/username-input.js +26 -24
- package/dist/features/circle-games/sign-up/comp/username-input/username-input.js.map +1 -1
- package/dist/features/communication/pub-sub/constants.js +4 -7
- package/dist/features/communication/pub-sub/constants.js.map +1 -1
- package/dist/features/homework/homework-card-view.js +97 -85
- package/dist/features/homework/homework-card-view.js.map +1 -1
- package/dist/features/homework/homework-card.js +42 -44
- package/dist/features/homework/homework-card.js.map +1 -1
- package/dist/features/homework/hw-card-list/hw-card-list-view.js +29 -31
- package/dist/features/homework/hw-card-list/hw-card-list-view.js.map +1 -1
- package/dist/features/homework/hw-card-list/hw-card-list.js +50 -57
- package/dist/features/homework/hw-card-list/hw-card-list.js.map +1 -1
- package/dist/features/homework/utils.js +27 -33
- package/dist/features/homework/utils.js.map +1 -1
- package/dist/features/journey/comps/coachmark/coachmark.js +18 -17
- package/dist/features/journey/comps/coachmark/coachmark.js.map +1 -1
- package/dist/features/journey/hooks/use-home-page-journey/tooltip-item.js +11 -17
- package/dist/features/journey/hooks/use-home-page-journey/tooltip-item.js.map +1 -1
- package/dist/features/journey/journey-id/journey-id-student.js +2 -2
- package/dist/features/journey/journey-id/journey-id-student.js.map +1 -1
- package/dist/features/journey/journey-id/journey-id-teacher.js +2 -2
- package/dist/features/journey/journey-id/journey-id-teacher.js.map +1 -1
- package/dist/features/puzzles/comps/puzzle-card-styled.js +69 -24
- package/dist/features/puzzles/comps/puzzle-card-styled.js.map +1 -1
- package/dist/features/puzzles/comps/puzzle-card.js +30 -72
- package/dist/features/puzzles/comps/puzzle-card.js.map +1 -1
- package/dist/features/puzzles/puzzle-container/puzzle-container-styled.js +25 -55
- package/dist/features/puzzles/puzzle-container/puzzle-container-styled.js.map +1 -1
- package/dist/features/puzzles/puzzle-container/puzzle-container.js +108 -89
- package/dist/features/puzzles/puzzle-container/puzzle-container.js.map +1 -1
- package/dist/features/puzzles/utils/puzzle-pattern.js +13 -28
- package/dist/features/puzzles/utils/puzzle-pattern.js.map +1 -1
- package/dist/features/ui/sticker-grid/sticker-grid-styles.js +86 -0
- package/dist/features/ui/sticker-grid/sticker-grid-styles.js.map +1 -0
- package/dist/features/ui/sticker-grid/sticker-grid.js +24 -0
- package/dist/features/ui/sticker-grid/sticker-grid.js.map +1 -0
- package/dist/features/ui/sticker-grid/sticker.js +57 -0
- package/dist/features/ui/sticker-grid/sticker.js.map +1 -0
- package/dist/features/ui/stickers/constants.js +6 -0
- package/dist/features/ui/stickers/constants.js.map +1 -0
- package/dist/features/ui/stickers/stickers-effects.js +64 -0
- package/dist/features/ui/stickers/stickers-effects.js.map +1 -0
- package/dist/features/ui/stickers/stickers-styled.js +29 -0
- package/dist/features/ui/stickers/stickers-styled.js.map +1 -0
- package/dist/features/ui/stickers/stickers-utils.js +91 -0
- package/dist/features/ui/stickers/stickers-utils.js.map +1 -0
- package/dist/features/ui/stickers/stickers.js +40 -0
- package/dist/features/ui/stickers/stickers.js.map +1 -0
- package/dist/features/ui/text/text.js +40 -36
- package/dist/features/ui/text/text.js.map +1 -1
- package/dist/features/ui/theme/constants.js +4 -2
- package/dist/features/ui/theme/constants.js.map +1 -1
- package/dist/features/ui/theme/get-device.js +3 -3
- package/dist/features/ui/theme/get-device.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-helpers.js +19 -20
- package/dist/features/worksheet/worksheet/worksheet-helpers.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-question/learnosity-question.js +25 -29
- package/dist/features/worksheet/worksheet/worksheet-question/learnosity-question.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-question/worksheet-question-styled.js +47 -97
- package/dist/features/worksheet/worksheet/worksheet-question/worksheet-question-styled.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-question/worksheet-question.js +146 -149
- package/dist/features/worksheet/worksheet/worksheet-question/worksheet-question.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-questions-controller/worksheet-questions-controller.js +207 -242
- package/dist/features/worksheet/worksheet/worksheet-questions-controller/worksheet-questions-controller.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-styled.js +37 -37
- package/dist/features/worksheet/worksheet/worksheet-styled.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-types.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet.js +313 -307
- package/dist/features/worksheet/worksheet/worksheet.js.map +1 -1
- package/dist/features/worksheet/worksheet-preview/hooks/use-worksheet-layout.js +1 -1
- package/dist/features/worksheet/worksheet-preview/hooks/use-worksheet-layout.js.map +1 -1
- package/dist/features/worksheet/worksheet-preview/worksheet-preview.js +35 -44
- package/dist/features/worksheet/worksheet-preview/worksheet-preview.js.map +1 -1
- package/dist/index.d.ts +45 -97
- package/dist/index.js +397 -403
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/features/hooks/use-viewport/use-viewport.js +0 -22
- package/dist/features/hooks/use-viewport/use-viewport.js.map +0 -1
- package/dist/features/journey/hooks/use-puzzles-journey/use-puzzle-assigned.js +0 -72
- package/dist/features/journey/hooks/use-puzzles-journey/use-puzzle-assigned.js.map +0 -1
- package/dist/features/journey/hooks/use-puzzles-journey/use-puzzle-attempt-journey.js +0 -59
- package/dist/features/journey/hooks/use-puzzles-journey/use-puzzle-attempt-journey.js.map +0 -1
- package/dist/features/journey/hooks/use-puzzles-journey/use-puzzle-dashboard-journey.js +0 -63
- package/dist/features/journey/hooks/use-puzzles-journey/use-puzzle-dashboard-journey.js.map +0 -1
- package/dist/features/journey/hooks/use-puzzles-journey/use-puzzle-intro-journey.js +0 -67
- package/dist/features/journey/hooks/use-puzzles-journey/use-puzzle-intro-journey.js.map +0 -1
- package/dist/features/journey/hooks/use-puzzles-journey/use-puzzle-progress-journey.js +0 -70
- package/dist/features/journey/hooks/use-puzzles-journey/use-puzzle-progress-journey.js.map +0 -1
- package/dist/features/journey/hooks/use-puzzles-journey/use-puzzle-review-journey.js +0 -59
- package/dist/features/journey/hooks/use-puzzles-journey/use-puzzle-review-journey.js.map +0 -1
- package/dist/features/journey/hooks/use-puzzles-journey/use-puzzle-unassign-journey.js +0 -59
- package/dist/features/journey/hooks/use-puzzles-journey/use-puzzle-unassign-journey.js.map +0 -1
- package/dist/features/journey/hooks/use-puzzles-journey/use-teacher-puzzle-assigned-journey.js +0 -70
- package/dist/features/journey/hooks/use-puzzles-journey/use-teacher-puzzle-assigned-journey.js.map +0 -1
- package/dist/features/puzzles/api/puzzle-dashboard.js +0 -10
- package/dist/features/puzzles/api/puzzle-dashboard.js.map +0 -1
- package/dist/features/puzzles/constants/puzzle-container.js +0 -8
- package/dist/features/puzzles/constants/puzzle-container.js.map +0 -1
- package/dist/features/puzzles/puzzle-analytics-events.js +0 -11
- package/dist/features/puzzles/puzzle-analytics-events.js.map +0 -1
- package/dist/features/puzzles/puzzle-container/puzzle-container-view.js +0 -55
- package/dist/features/puzzles/puzzle-container/puzzle-container-view.js.map +0 -1
- package/dist/features/puzzles/puzzle-dashboard/puzzle-dashboard-styled.js +0 -37
- package/dist/features/puzzles/puzzle-dashboard/puzzle-dashboard-styled.js.map +0 -1
- package/dist/features/puzzles/puzzle-dashboard/puzzle-dashboard.js +0 -110
- package/dist/features/puzzles/puzzle-dashboard/puzzle-dashboard.js.map +0 -1
- package/dist/features/worksheet/worksheet/hooks/use-worksheet-journey.js +0 -28
- package/dist/features/worksheet/worksheet/hooks/use-worksheet-journey.js.map +0 -1
- package/dist/static/puzzle-blue-lottie.7017e2e8.json +0 -1
- package/dist/static/puzzle-blue-lottie.bf64ebc5.json +0 -12760
- package/dist/static/puzzle-dashboard-banner.b7956519.svg +0 -1
- package/dist/static/puzzle-green-lottie.1da90698.json +0 -1
- package/dist/static/puzzle-orange-lottie.cfcf3724.json +0 -1
- package/dist/static/puzzle-purple-lottie.e70de110.json +0 -9860
- package/dist/static/puzzle-yellow-lottie.275b5cf4.json +0 -1
@@ -1,108 +1,127 @@
|
|
1
|
-
import { jsx as
|
2
|
-
import { memo as
|
3
|
-
import
|
4
|
-
import O from "../../ui/
|
5
|
-
import
|
6
|
-
import {
|
7
|
-
import
|
8
|
-
import { PuzzleContainer as
|
9
|
-
|
10
|
-
const G = {
|
11
|
-
loop: !1,
|
12
|
-
renderer: "svg",
|
13
|
-
autoPlay: !1
|
14
|
-
}, M = N(
|
1
|
+
import { jsx as i, jsxs as l, Fragment as w } from "react/jsx-runtime";
|
2
|
+
import { memo as X, useState as z, useRef as j, useEffect as C, useCallback as c } from "react";
|
3
|
+
import L from "../../../assets/line-icons/icons/check2.js";
|
4
|
+
import O from "../../ui/image/image.js";
|
5
|
+
import r from "../../ui/text/text.js";
|
6
|
+
import { usePostPuzzleToAssign as B } from "../api/puzzle-assign.js";
|
7
|
+
import D from "../comps/puzzle-card.js";
|
8
|
+
import { PuzzleContainer as W, PuzzleContent as G, AssignedTag as K, PuzzleButton as S, PuzzleText as U, CheckMarkIcon as H } from "./puzzle-container-styled.js";
|
9
|
+
const N = 1500, M = X(
|
15
10
|
({
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
11
|
+
userType: A,
|
12
|
+
triggerReveal: o = !1,
|
13
|
+
onFullyHidden: s,
|
14
|
+
onPuzzleClick: d,
|
15
|
+
puzzleData: p,
|
16
|
+
courseStream: g,
|
17
|
+
studentId: u
|
22
18
|
}) => {
|
23
19
|
const {
|
24
|
-
image_hue:
|
25
|
-
image_url:
|
26
|
-
assigned:
|
27
|
-
title:
|
28
|
-
id:
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
node_id: A,
|
33
|
-
node_type: "PUZZLE_CARD"
|
34
|
-
}),
|
35
|
-
[A]
|
36
|
-
), { post: h, isProcessing: I } = U({
|
37
|
-
onComplete: (e) => {
|
38
|
-
var t;
|
39
|
-
e ? a(!0) : ((t = o.current) == null || t.playSegments(c.REVEAL_ASSIGNED, !1), a(!1));
|
20
|
+
image_hue: m,
|
21
|
+
image_url: b,
|
22
|
+
assigned: e,
|
23
|
+
title: I,
|
24
|
+
id: h
|
25
|
+
} = p, [n, t] = z("hidden"), [f, P] = z(!1), a = j(null), { post: $, isProcessing: k } = B({
|
26
|
+
onComplete: (x) => {
|
27
|
+
x ? t("visible") : n === "visible" && t("assigning");
|
40
28
|
}
|
41
29
|
});
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
30
|
+
C(() => {
|
31
|
+
e || (o ? f ? t("assigned") : n === "hidden" && t("movingIn") : n !== "hidden" && n !== "movingOut" && t("movingOut"));
|
32
|
+
}, [o, f, e]), C(() => (n === "assigned" && !e && (a.current = setTimeout(() => {
|
33
|
+
t("movingOut");
|
34
|
+
}, N)), () => {
|
35
|
+
a.current && clearTimeout(a.current);
|
36
|
+
}), [n, e]);
|
37
|
+
const T = c(() => {
|
38
|
+
switch (n) {
|
39
|
+
case "movingIn":
|
40
|
+
t("revealing");
|
41
|
+
break;
|
42
|
+
case "revealing":
|
43
|
+
t("visible");
|
44
|
+
break;
|
45
|
+
case "assigning":
|
46
|
+
t("assigned"), P(!0);
|
47
|
+
break;
|
48
|
+
case "movingOut":
|
49
|
+
t("hidden"), s == null || s();
|
50
|
+
break;
|
51
|
+
}
|
52
|
+
}, [n, s]), v = c(() => {
|
53
|
+
e || $(
|
48
54
|
{
|
49
|
-
puzzle_id:
|
55
|
+
puzzle_id: h
|
50
56
|
},
|
51
57
|
{
|
52
|
-
studentId:
|
53
|
-
courseStream:
|
58
|
+
studentId: u,
|
59
|
+
courseStream: g
|
54
60
|
}
|
55
61
|
);
|
56
|
-
}, [
|
57
|
-
|
58
|
-
}, [
|
59
|
-
|
60
|
-
|
61
|
-
}, []), x = u(
|
62
|
-
() => ({
|
63
|
-
name: "enterFrame",
|
64
|
-
callback: (e) => {
|
65
|
-
const { currentTime: t } = e;
|
66
|
-
t === 49 && a(!0), t === 101 && (r == null || r());
|
67
|
-
}
|
68
|
-
}),
|
69
|
-
[r]
|
70
|
-
);
|
71
|
-
return l ? s ? /* @__PURE__ */ n(C, { $justifyContent: "center", children: /* @__PURE__ */ n(
|
72
|
-
y,
|
73
|
-
{
|
74
|
-
$imageHue: i,
|
75
|
-
$background: `${i}_2`,
|
76
|
-
$widthX: 15.9375,
|
77
|
-
children: /* @__PURE__ */ n(L, { imageUrl: g, title: d, assigned: !0 })
|
78
|
-
}
|
79
|
-
) }) : /* @__PURE__ */ n(C, { children: /* @__PURE__ */ V(k, { $heightX: 26, children: [
|
80
|
-
/* @__PURE__ */ n(
|
81
|
-
O,
|
62
|
+
}, [g, e, $, h, u]), _ = c(() => {
|
63
|
+
d();
|
64
|
+
}, [d]), E = () => n === "visible" || e ? /* @__PURE__ */ l(w, { children: [
|
65
|
+
/* @__PURE__ */ l(
|
66
|
+
G,
|
82
67
|
{
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
68
|
+
$justifyContent: "center",
|
69
|
+
$alignItems: "center",
|
70
|
+
$width: "100%",
|
71
|
+
$height: "100%",
|
72
|
+
onClick: _,
|
73
|
+
title: "Click to preview",
|
74
|
+
$flexGapX: 1.5,
|
75
|
+
children: [
|
76
|
+
/* @__PURE__ */ i(O, { width: 136, height: 136, src: b, withLoader: !1, alt: "Puzzle" }),
|
77
|
+
/* @__PURE__ */ i(r, { $renderAs: "h4", children: I }),
|
78
|
+
e && /* @__PURE__ */ i(K, { $gap: 4, $gutter: 8, $background: "BLACK_1", children: /* @__PURE__ */ i(r, { $renderAs: "ac4", $color: "WHITE_1", children: "Assigned" }) })
|
79
|
+
]
|
89
80
|
}
|
90
81
|
),
|
91
|
-
|
92
|
-
|
82
|
+
A === "TEACHER" && /* @__PURE__ */ i(
|
83
|
+
S,
|
93
84
|
{
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
85
|
+
$background: "BLACK_1",
|
86
|
+
$widthX: 15.75,
|
87
|
+
$alignItems: "center",
|
88
|
+
$justifyContent: "center",
|
89
|
+
$gapX: 0.75,
|
90
|
+
$gutterX: 1,
|
91
|
+
onClick: v,
|
92
|
+
$disabled: e || k,
|
93
|
+
children: /* @__PURE__ */ i(r, { $renderAs: "ub1-bold", $color: e ? "BLACK_T_38" : "WHITE_1", children: e ? "Discuss in next class" : "Assign" })
|
100
94
|
}
|
101
|
-
)
|
102
|
-
] })
|
95
|
+
)
|
96
|
+
] }) : n === "assigned" ? /* @__PURE__ */ l(U, { $alignItems: "center", $justifyContent: "center", $flexGap: 8, children: [
|
97
|
+
/* @__PURE__ */ i(
|
98
|
+
H,
|
99
|
+
{
|
100
|
+
$widthX: 2.5,
|
101
|
+
$heightX: 2.5,
|
102
|
+
$background: "WHITE",
|
103
|
+
$alignItems: "center",
|
104
|
+
$justifyContent: "center",
|
105
|
+
children: /* @__PURE__ */ i(L, {})
|
106
|
+
}
|
107
|
+
),
|
108
|
+
/* @__PURE__ */ i(r, { $renderAs: "ab1-bold", $align: "center", $color: "WHITE", children: "Puzzle assigned" })
|
109
|
+
] }) : null;
|
110
|
+
return n === "hidden" && !o ? null : /* @__PURE__ */ i(W, { children: /* @__PURE__ */ i(
|
111
|
+
D,
|
112
|
+
{
|
113
|
+
animationPhase: e ? void 0 : n,
|
114
|
+
onAnimationEnd: T,
|
115
|
+
imageHue: m ?? "BLUE",
|
116
|
+
heightX: 19,
|
117
|
+
widthX: 15.75,
|
118
|
+
backgroundColor: e ? `${m}_2` : void 0,
|
119
|
+
children: E()
|
120
|
+
}
|
121
|
+
) });
|
103
122
|
}
|
104
|
-
),
|
123
|
+
), F = M;
|
105
124
|
export {
|
106
|
-
|
125
|
+
F as default
|
107
126
|
};
|
108
127
|
//# sourceMappingURL=puzzle-container.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"puzzle-container.js","sources":["../../../../src/features/puzzles/puzzle-container/puzzle-container.tsx"],"sourcesContent":["import type { ILottieAnimationRef } from '../../ui/lottie-animation/types';\nimport type { IPuzzleCardContainerProps } from './puzzle-container-types';\nimport type { AnimationEventName, BMEnterFrameEvent } from 'lottie-web';\nimport type { FC } from 'react';\n\nimport { useState, useCallback, useEffect, useRef, memo, useMemo } from 'react';\n\nimport FlexView from '../../ui/layout/flex-view';\nimport LottieAnimation from '../../ui/lottie-animation/lottie-animation';\nimport { usePostPuzzleToAssign } from '../api/puzzle-assign';\nimport { PUZZLE_ASSIGN_ANIMATION } from '../constants/puzzle-container';\nimport { getPuzzleCardLottie } from '../utils/puzzle-pattern';\nimport * as Styled from './puzzle-container-styled';\nimport PuzzleAssigned from './puzzle-container-view';\n\nconst modeRevealAnimationSettings = {\n loop: false,\n renderer: 'svg',\n autoPlay: false,\n};\n\nconst PuzzleCardContainer: FC<IPuzzleCardContainerProps> = memo(\n ({\n triggerReveal = false,\n onFullyHidden,\n onPuzzleClick,\n puzzleData,\n courseStream,\n studentId,\n }) => {\n const {\n image_hue: imageHue,\n image_url: imageUrl,\n assigned: externalAssigned,\n title,\n id: puzzleId,\n node_id: nodeId,\n } = puzzleData;\n\n const [showPuzzleInfo, setShowPuzzleInfo] = useState(externalAssigned);\n\n const assignLottieRef = useRef<ILottieAnimationRef | null>(null);\n const puzzleLottieSrc = useMemo(() => getPuzzleCardLottie(imageHue), [imageHue]);\n\n const analyticsProps = useMemo(\n () => ({\n node_id: nodeId,\n node_type: 'PUZZLE_CARD',\n }),\n [nodeId],\n );\n\n const { post: postPuzzleToAssign, isProcessing } = usePostPuzzleToAssign({\n onComplete: (error: string | null) => {\n if (error) {\n // Handle error (e.g., show a notification)\n setShowPuzzleInfo(true);\n } else {\n assignLottieRef.current?.playSegments(PUZZLE_ASSIGN_ANIMATION.REVEAL_ASSIGNED, false);\n\n setShowPuzzleInfo(false);\n }\n },\n });\n\n useEffect(() => {\n if (!externalAssigned) {\n if (triggerReveal) {\n assignLottieRef.current?.playSegments(PUZZLE_ASSIGN_ANIMATION.REVEAL, true);\n } else {\n assignLottieRef.current?.stop();\n setShowPuzzleInfo(false);\n }\n }\n }, [externalAssigned, triggerReveal]);\n\n const handleAssign = useCallback(() => {\n if (externalAssigned) return;\n\n postPuzzleToAssign(\n {\n puzzle_id: puzzleId,\n },\n {\n studentId,\n courseStream,\n },\n );\n }, [courseStream, externalAssigned, postPuzzleToAssign, puzzleId, studentId]);\n\n const handleOnPuzzleClick = useCallback(() => {\n onPuzzleClick();\n }, [onPuzzleClick]);\n\n const showPuzzleLottie = useCallback(() => {\n assignLottieRef.current?.playSegments(PUZZLE_ASSIGN_ANIMATION.REVEAL, true);\n }, []);\n\n const onAnimationFinish = useMemo(\n () => ({\n name: 'enterFrame' as AnimationEventName,\n callback: (event: BMEnterFrameEvent) => {\n const { currentTime } = event;\n\n if (currentTime === 49) {\n setShowPuzzleInfo(true);\n }\n\n if (currentTime === 101) {\n onFullyHidden?.();\n }\n },\n }),\n [onFullyHidden],\n );\n\n if (!triggerReveal) {\n return null;\n }\n\n if (externalAssigned) {\n return (\n <Styled.PuzzleContainer $justifyContent=\"center\">\n <Styled.PuzzleAssignedWrapper\n $imageHue={imageHue}\n $background={`${imageHue}_2`}\n $widthX={15.9375}\n >\n <PuzzleAssigned imageUrl={imageUrl} title={title} assigned />\n </Styled.PuzzleAssignedWrapper>\n </Styled.PuzzleContainer>\n );\n }\n\n return (\n <Styled.PuzzleContainer>\n <FlexView $heightX={26}>\n <LottieAnimation\n src={puzzleLottieSrc}\n ref={assignLottieRef}\n settings={modeRevealAnimationSettings}\n onRender={showPuzzleLottie}\n eventListener={onAnimationFinish}\n animateOnIntersect\n />\n\n <Styled.PuzzleContentWrapper $visible={showPuzzleInfo} $position=\"absolute\">\n <PuzzleAssigned\n imageUrl={imageUrl}\n title={title}\n handleOnPuzzleClick={handleOnPuzzleClick}\n handleAssign={handleAssign}\n assigning={isProcessing}\n analyticsProps={analyticsProps}\n />\n </Styled.PuzzleContentWrapper>\n </FlexView>\n </Styled.PuzzleContainer>\n );\n },\n);\n\nexport default PuzzleCardContainer;\n"],"names":["modeRevealAnimationSettings","PuzzleCardContainer","memo","triggerReveal","onFullyHidden","onPuzzleClick","puzzleData","courseStream","studentId","imageHue","imageUrl","externalAssigned","title","puzzleId","nodeId","showPuzzleInfo","setShowPuzzleInfo","useState","assignLottieRef","useRef","puzzleLottieSrc","useMemo","getPuzzleCardLottie","analyticsProps","postPuzzleToAssign","isProcessing","usePostPuzzleToAssign","error","_a","PUZZLE_ASSIGN_ANIMATION","useEffect","_b","handleAssign","useCallback","handleOnPuzzleClick","showPuzzleLottie","onAnimationFinish","event","currentTime","jsx","Styled.PuzzleContainer","Styled.PuzzleAssignedWrapper","PuzzleAssigned","jsxs","FlexView","LottieAnimation","Styled.PuzzleContentWrapper","PuzzleCardContainer$1"],"mappings":"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"}
|
1
|
+
{"version":3,"file":"puzzle-container.js","sources":["../../../../src/features/puzzles/puzzle-container/puzzle-container.tsx"],"sourcesContent":["import type { TPuzzleCardAnimationPhases } from '../comps/puzzle-card-types';\nimport type { IPuzzleCardContainerProps } from './puzzle-container-types';\nimport type { FC } from 'react';\n\nimport { useState, useCallback, useEffect, useRef, memo } from 'react';\n\nimport Check2Icon from '../../../assets/line-icons/icons/check2';\nimport Image from '../../ui/image/image';\nimport Text from '../../ui/text/text';\nimport { usePostPuzzleToAssign } from '../api/puzzle-assign';\nimport PuzzleCard from '../comps/puzzle-card';\nimport * as Styled from './puzzle-container-styled';\n\nconst ASSIGNED_DISPLAY_DURATION = 1500; // ms\n\nconst PuzzleCardContainer: FC<IPuzzleCardContainerProps> = memo(\n ({\n userType,\n triggerReveal = false,\n onFullyHidden,\n onPuzzleClick,\n puzzleData,\n courseStream,\n studentId,\n }) => {\n const {\n image_hue: imageHue,\n image_url: imageUrl,\n assigned: externalAssigned,\n title,\n id: puzzleId,\n } = puzzleData;\n\n const [animationPhase, setAnimationPhase] = useState<TPuzzleCardAnimationPhases>('hidden');\n const [isAssigned, setIsAssigned] = useState(false);\n\n const assignedTimer = useRef<NodeJS.Timeout | null>(null);\n\n const { post: postPuzzleToAssign, isProcessing } = usePostPuzzleToAssign({\n onComplete: (error: string | null) => {\n if (error) {\n // Handle error (e.g., show a notification)\n setAnimationPhase('visible'); // Reset to visible if assignment fails\n } else {\n if (animationPhase === 'visible') {\n setAnimationPhase('assigning');\n }\n }\n },\n });\n\n // Main trigger to start or hide the card\n useEffect(() => {\n if (!externalAssigned) {\n if (triggerReveal) {\n if (isAssigned) {\n setAnimationPhase('assigned'); // Already assigned, show statically\n } else if (animationPhase === 'hidden') {\n setAnimationPhase('movingIn'); // Start the animation sequence\n }\n } else {\n // If trigger is removed, start hiding (unless already hidden/hiding)\n if (animationPhase !== 'hidden' && animationPhase !== 'movingOut') {\n setAnimationPhase('movingOut');\n }\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [triggerReveal, isAssigned, externalAssigned]);\n\n // Timer to auto-hide after the 'assigned' phase\n useEffect(() => {\n if (animationPhase === 'assigned' && !externalAssigned) {\n assignedTimer.current = setTimeout(() => {\n setAnimationPhase('movingOut');\n }, ASSIGNED_DISPLAY_DURATION);\n }\n\n return () => {\n if (assignedTimer.current) clearTimeout(assignedTimer.current);\n };\n }, [animationPhase, externalAssigned]);\n\n // State machine for animations\n const handleAnimationEnd = useCallback(() => {\n switch (animationPhase) {\n case 'movingIn':\n setAnimationPhase('revealing');\n break;\n case 'revealing':\n setAnimationPhase('visible');\n break;\n case 'assigning':\n setAnimationPhase('assigned');\n setIsAssigned(true);\n break;\n case 'movingOut':\n setAnimationPhase('hidden');\n onFullyHidden?.();\n break;\n default:\n break;\n }\n }, [animationPhase, onFullyHidden]);\n\n const handleAssign = useCallback(() => {\n if (externalAssigned) return; // Do nothing if already assigned\n\n postPuzzleToAssign(\n {\n puzzle_id: puzzleId,\n },\n {\n studentId,\n courseStream,\n },\n );\n }, [courseStream, externalAssigned, postPuzzleToAssign, puzzleId, studentId]);\n\n const handleOnPuzzleClick = useCallback(() => {\n onPuzzleClick();\n }, [onPuzzleClick]);\n\n // Render content only during specific phases\n const renderContent = () => {\n if (animationPhase === 'visible' || externalAssigned) {\n return (\n <>\n <Styled.PuzzleContent\n $justifyContent=\"center\"\n $alignItems=\"center\"\n $width=\"100%\"\n $height=\"100%\"\n onClick={handleOnPuzzleClick}\n title=\"Click to preview\"\n $flexGapX={1.5}\n >\n <Image width={136} height={136} src={imageUrl} withLoader={false} alt=\"Puzzle\" />\n <Text $renderAs=\"h4\">{title}</Text>\n\n {externalAssigned && (\n <Styled.AssignedTag $gap={4} $gutter={8} $background=\"BLACK_1\">\n <Text $renderAs=\"ac4\" $color=\"WHITE_1\">\n Assigned\n </Text>\n </Styled.AssignedTag>\n )}\n </Styled.PuzzleContent>\n\n {userType === 'TEACHER' && (\n <Styled.PuzzleButton\n $background=\"BLACK_1\"\n $widthX={15.75}\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $gapX={0.75}\n $gutterX={1}\n onClick={handleAssign}\n $disabled={externalAssigned || isProcessing}\n >\n <Text $renderAs=\"ub1-bold\" $color={externalAssigned ? 'BLACK_T_38' : 'WHITE_1'}>\n {externalAssigned ? 'Discuss in next class' : 'Assign'}\n </Text>\n </Styled.PuzzleButton>\n )}\n </>\n );\n }\n\n if (animationPhase === 'assigned') {\n return (\n <Styled.PuzzleText $alignItems=\"center\" $justifyContent=\"center\" $flexGap={8}>\n <Styled.CheckMarkIcon\n $widthX={2.5}\n $heightX={2.5}\n $background=\"WHITE\"\n $alignItems=\"center\"\n $justifyContent=\"center\"\n >\n <Check2Icon />\n </Styled.CheckMarkIcon>\n\n <Text $renderAs=\"ab1-bold\" $align=\"center\" $color=\"WHITE\">\n Puzzle assigned\n </Text>\n </Styled.PuzzleText>\n );\n }\n\n // No content during animations\n return null;\n };\n\n if (animationPhase === 'hidden' && !triggerReveal) {\n return null;\n }\n\n return (\n <Styled.PuzzleContainer>\n <PuzzleCard\n animationPhase={!externalAssigned ? animationPhase : undefined}\n onAnimationEnd={handleAnimationEnd}\n imageHue={imageHue ?? 'BLUE'}\n heightX={19}\n widthX={15.75}\n backgroundColor={externalAssigned ? `${imageHue}_2` : undefined}\n >\n {renderContent()}\n </PuzzleCard>\n </Styled.PuzzleContainer>\n );\n },\n);\n\nexport default PuzzleCardContainer;\n"],"names":["ASSIGNED_DISPLAY_DURATION","PuzzleCardContainer","memo","userType","triggerReveal","onFullyHidden","onPuzzleClick","puzzleData","courseStream","studentId","imageHue","imageUrl","externalAssigned","title","puzzleId","animationPhase","setAnimationPhase","useState","isAssigned","setIsAssigned","assignedTimer","useRef","postPuzzleToAssign","isProcessing","usePostPuzzleToAssign","error","useEffect","handleAnimationEnd","useCallback","handleAssign","handleOnPuzzleClick","renderContent","jsxs","Fragment","Styled.PuzzleContent","jsx","Image","Text","Styled.AssignedTag","Styled.PuzzleButton","Styled.PuzzleText","Styled.CheckMarkIcon","Check2Icon","Styled.PuzzleContainer","PuzzleCard","PuzzleCardContainer$1"],"mappings":"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"}
|
@@ -1,40 +1,25 @@
|
|
1
|
-
import { ILLUSTRATIONS as
|
2
|
-
import { LOTTIE as E } from "../../../assets/lottie/lottie.js";
|
1
|
+
import { ILLUSTRATIONS as P } from "../../../assets/illustrations/illustrations.js";
|
3
2
|
const {
|
4
|
-
PUZZLE_PATTERN_BLUE:
|
5
|
-
PUZZLE_PATTERN_GREEN:
|
6
|
-
PUZZLE_PATTERN_ORANGE:
|
7
|
-
PUZZLE_PATTERN_PURPLE:
|
8
|
-
PUZZLE_PATTERN_YELLOW:
|
9
|
-
} =
|
10
|
-
switch (
|
3
|
+
PUZZLE_PATTERN_BLUE: r,
|
4
|
+
PUZZLE_PATTERN_GREEN: e,
|
5
|
+
PUZZLE_PATTERN_ORANGE: t,
|
6
|
+
PUZZLE_PATTERN_PURPLE: L,
|
7
|
+
PUZZLE_PATTERN_YELLOW: R
|
8
|
+
} = P, N = (E) => {
|
9
|
+
switch (E) {
|
11
10
|
case "YELLOW":
|
12
|
-
return
|
11
|
+
return R;
|
13
12
|
case "GREEN":
|
14
|
-
return t;
|
15
|
-
case "ORANGE":
|
16
|
-
return P;
|
17
|
-
case "PURPLE":
|
18
|
-
return T;
|
19
|
-
default:
|
20
13
|
return e;
|
21
|
-
}
|
22
|
-
}, O = (L) => {
|
23
|
-
switch (L) {
|
24
|
-
case "YELLOW":
|
25
|
-
return E.PUZZLE_YELLOW_LOTTIE;
|
26
|
-
case "GREEN":
|
27
|
-
return E.PUZZLE_GREEN_LOTTIE;
|
28
14
|
case "ORANGE":
|
29
|
-
return
|
15
|
+
return t;
|
30
16
|
case "PURPLE":
|
31
|
-
return
|
17
|
+
return L;
|
32
18
|
default:
|
33
|
-
return
|
19
|
+
return r;
|
34
20
|
}
|
35
21
|
};
|
36
22
|
export {
|
37
|
-
|
38
|
-
U as getPuzzleCardPattern
|
23
|
+
N as getPuzzleCardPattern
|
39
24
|
};
|
40
25
|
//# sourceMappingURL=puzzle-pattern.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"puzzle-pattern.js","sources":["../../../../src/features/puzzles/utils/puzzle-pattern.ts"],"sourcesContent":["import type { THueNames } from '../../ui/types';\n\nimport { ILLUSTRATIONS } from '../../../assets/illustrations/illustrations';\
|
1
|
+
{"version":3,"file":"puzzle-pattern.js","sources":["../../../../src/features/puzzles/utils/puzzle-pattern.ts"],"sourcesContent":["import type { THueNames } from '../../ui/types';\n\nimport { ILLUSTRATIONS } from '../../../assets/illustrations/illustrations';\n\nconst {\n PUZZLE_PATTERN_BLUE,\n PUZZLE_PATTERN_GREEN,\n PUZZLE_PATTERN_ORANGE,\n PUZZLE_PATTERN_PURPLE,\n PUZZLE_PATTERN_YELLOW,\n} = ILLUSTRATIONS;\n\nconst getPuzzleCardPattern = (imageHue: THueNames) => {\n switch (imageHue) {\n case 'YELLOW':\n return PUZZLE_PATTERN_YELLOW;\n case 'GREEN':\n return PUZZLE_PATTERN_GREEN;\n case 'ORANGE':\n return PUZZLE_PATTERN_ORANGE;\n case 'PURPLE':\n return PUZZLE_PATTERN_PURPLE;\n\n default:\n return PUZZLE_PATTERN_BLUE;\n }\n};\n\nexport { getPuzzleCardPattern };\n"],"names":["PUZZLE_PATTERN_BLUE","PUZZLE_PATTERN_GREEN","PUZZLE_PATTERN_ORANGE","PUZZLE_PATTERN_PURPLE","PUZZLE_PATTERN_YELLOW","ILLUSTRATIONS","getPuzzleCardPattern","imageHue"],"mappings":";AAIA,MAAM;AAAA,EACJ,qBAAAA;AAAA,EACA,sBAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,uBAAAC;AACF,IAAIC,GAEEC,IAAuB,CAACC,MAAwB;AACpD,UAAQA,GAAU;AAAA,IAChB,KAAK;AACI,aAAAH;AAAA,IACT,KAAK;AACI,aAAAH;AAAA,IACT,KAAK;AACI,aAAAC;AAAA,IACT,KAAK;AACI,aAAAC;AAAA,IAET;AACS,aAAAH;AAAA,EACX;AACF;"}
|
@@ -0,0 +1,86 @@
|
|
1
|
+
import r from "styled-components";
|
2
|
+
const e = r.div`
|
3
|
+
position: relative;
|
4
|
+
width: ${({ $size: t }) => typeof t == "number" ? `${t}px` : t};
|
5
|
+
height: ${({ $size: t }) => typeof t == "number" ? `${t}px` : t};
|
6
|
+
cursor: ${({ $disabled: t }) => t ? "none" : "pointer"};
|
7
|
+
border-radius: 8px;
|
8
|
+
overflow: hidden;
|
9
|
+
display: flex;
|
10
|
+
align-items: center;
|
11
|
+
justify-content: center;
|
12
|
+
transition: all 0.2s ease;
|
13
|
+
background-color: transparent;
|
14
|
+
opacity: ${({ $disabled: t }) => t ? 0.5 : 1};
|
15
|
+
|
16
|
+
&:hover {
|
17
|
+
transform: ${({ $disabled: t }) => t ? "none" : "scale(1.1)"};
|
18
|
+
background-color: rgba(255, 255, 255, 0.1);
|
19
|
+
}
|
20
|
+
|
21
|
+
&:active {
|
22
|
+
transform: ${({ $disabled: t }) => t ? "none" : "scale(0.95)"};
|
23
|
+
}
|
24
|
+
`, n = r.div`
|
25
|
+
font-size: ${({ $size: t }) => typeof t == "number" ? `${t * 0.7}px` : "70%"};
|
26
|
+
line-height: 1;
|
27
|
+
display: flex;
|
28
|
+
align-items: center;
|
29
|
+
justify-content: center;
|
30
|
+
width: 100%;
|
31
|
+
height: 100%;
|
32
|
+
transition: opacity 0.2s ease;
|
33
|
+
`, a = r.div`
|
34
|
+
position: absolute;
|
35
|
+
top: 50%;
|
36
|
+
left: 50%;
|
37
|
+
width: ${({ $size: t }) => typeof t == "number" ? `${t * 0.7}px` : t};
|
38
|
+
height: ${({ $size: t }) => typeof t == "number" ? `${t * 0.7}px` : t};
|
39
|
+
opacity: 0;
|
40
|
+
transition: opacity 0.2s ease;
|
41
|
+
transform: translate(-50%, -50%);
|
42
|
+
pointer-events: none;
|
43
|
+
|
44
|
+
${e}:hover & {
|
45
|
+
opacity: 1;
|
46
|
+
}
|
47
|
+
`, i = r.div`
|
48
|
+
display: grid;
|
49
|
+
grid-template-columns: repeat(${({ $columns: t }) => t}, 1fr);
|
50
|
+
gap: ${({ $gap: t }) => t}px;
|
51
|
+
padding: 16px;
|
52
|
+
background-color: #2a2a2a;
|
53
|
+
border-radius: 12px;
|
54
|
+
max-height: 400px;
|
55
|
+
overflow-y: auto;
|
56
|
+
|
57
|
+
&::-webkit-scrollbar {
|
58
|
+
width: 8px;
|
59
|
+
}
|
60
|
+
|
61
|
+
&::-webkit-scrollbar-track {
|
62
|
+
background: rgba(255, 255, 255, 0.1);
|
63
|
+
border-radius: 4px;
|
64
|
+
}
|
65
|
+
|
66
|
+
&::-webkit-scrollbar-thumb {
|
67
|
+
background: rgba(255, 255, 255, 0.3);
|
68
|
+
border-radius: 4px;
|
69
|
+
}
|
70
|
+
|
71
|
+
&::-webkit-scrollbar-thumb:hover {
|
72
|
+
background: rgba(255, 255, 255, 0.5);
|
73
|
+
}
|
74
|
+
`, c = r.div`
|
75
|
+
width: 100%;
|
76
|
+
max-width: ${({ $width: t }) => t};
|
77
|
+
max-height: ${({ $height: t }) => t};
|
78
|
+
`;
|
79
|
+
export {
|
80
|
+
a as LottieContainer,
|
81
|
+
n as StaticEmoji,
|
82
|
+
e as StickerContainer,
|
83
|
+
i as StickerGrid,
|
84
|
+
c as StickerGridContainer
|
85
|
+
};
|
86
|
+
//# sourceMappingURL=sticker-grid-styles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"sticker-grid-styles.js","sources":["../../../../src/features/ui/sticker-grid/sticker-grid-styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StickerContainer = styled.div<{\n $size: number | string;\n $disabled?: boolean;\n}>`\n position: relative;\n width: ${({ $size }) => (typeof $size === 'number' ? `${$size}px` : $size)};\n height: ${({ $size }) => (typeof $size === 'number' ? `${$size}px` : $size)};\n cursor: ${({ $disabled }) => ($disabled ? 'none' : 'pointer')};\n border-radius: 8px;\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: all 0.2s ease;\n background-color: transparent;\n opacity: ${({ $disabled }) => ($disabled ? 0.5 : 1)};\n\n &:hover {\n transform: ${({ $disabled }) => ($disabled ? 'none' : 'scale(1.1)')};\n background-color: rgba(255, 255, 255, 0.1);\n }\n\n &:active {\n transform: ${({ $disabled }) => ($disabled ? 'none' : 'scale(0.95)')};\n }\n`;\n\nexport const StaticEmoji = styled.div<{ $size: number | string }>`\n font-size: ${({ $size }) => {\n if (typeof $size === 'number') {\n return `${$size * 0.7}px`;\n }\n\n return '70%';\n }};\n line-height: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n transition: opacity 0.2s ease;\n`;\n\nexport const LottieContainer = styled.div<{ $size: number | string }>`\n position: absolute;\n top: 50%;\n left: 50%;\n width: ${({ $size }) => (typeof $size === 'number' ? `${$size * 0.7}px` : $size)};\n height: ${({ $size }) => (typeof $size === 'number' ? `${$size * 0.7}px` : $size)};\n opacity: 0;\n transition: opacity 0.2s ease;\n transform: translate(-50%, -50%);\n pointer-events: none;\n\n ${StickerContainer}:hover & {\n opacity: 1;\n }\n`;\n\nexport const StickerGrid = styled.div<{\n $columns: number;\n $gap: number;\n}>`\n display: grid;\n grid-template-columns: repeat(${({ $columns }) => $columns}, 1fr);\n gap: ${({ $gap }) => $gap}px;\n padding: 16px;\n background-color: #2a2a2a;\n border-radius: 12px;\n max-height: 400px;\n overflow-y: auto;\n\n &::-webkit-scrollbar {\n width: 8px;\n }\n\n &::-webkit-scrollbar-track {\n background: rgba(255, 255, 255, 0.1);\n border-radius: 4px;\n }\n\n &::-webkit-scrollbar-thumb {\n background: rgba(255, 255, 255, 0.3);\n border-radius: 4px;\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background: rgba(255, 255, 255, 0.5);\n }\n`;\n\nexport const StickerGridContainer = styled.div<{\n $width: string;\n $height: string;\n}>`\n width: 100%;\n max-width: ${({ $width }) => $width};\n max-height: ${({ $height }) => $height};\n`;\n"],"names":["StickerContainer","styled","$size","$disabled","StaticEmoji","LottieContainer","StickerGrid","$columns","$gap","StickerGridContainer","$width","$height"],"mappings":";AAEO,MAAMA,IAAmBC,EAAO;AAAA;AAAA,WAK5B,CAAC,EAAE,OAAAC,EAAa,MAAA,OAAOA,KAAU,WAAW,GAAGA,CAAK,OAAOA,CAAM;AAAA,YAChE,CAAC,EAAE,OAAAA,EAAa,MAAA,OAAOA,KAAU,WAAW,GAAGA,CAAK,OAAOA,CAAM;AAAA,YACjE,CAAC,EAAE,WAAAC,EAAA,MAAiBA,IAAY,SAAS,SAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAQlD,CAAC,EAAE,WAAAA,EAAA,MAAiBA,IAAY,MAAM,CAAE;AAAA;AAAA;AAAA,iBAGpC,CAAC,EAAE,WAAAA,EAAA,MAAiBA,IAAY,SAAS,YAAa;AAAA;AAAA;AAAA;AAAA;AAAA,iBAKtD,CAAC,EAAE,WAAAA,EAAA,MAAiBA,IAAY,SAAS,aAAc;AAAA;AAAA,GAI3DC,IAAcH,EAAO;AAAA,eACnB,CAAC,EAAE,OAAAC,QACV,OAAOA,KAAU,WACZ,GAAGA,IAAQ,GAAG,OAGhB,KACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAUUG,IAAkBJ,EAAO;AAAA;AAAA;AAAA;AAAA,WAI3B,CAAC,EAAE,OAAAC,QAAa,OAAOA,KAAU,WAAW,GAAGA,IAAQ,GAAG,OAAOA,CAAM;AAAA,YACtE,CAAC,EAAE,OAAAA,QAAa,OAAOA,KAAU,WAAW,GAAGA,IAAQ,GAAG,OAAOA,CAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAM/EF,CAAgB;AAAA;AAAA;AAAA,GAKPM,IAAcL,EAAO;AAAA;AAAA,kCAKA,CAAC,EAAE,UAAAM,EAAS,MAAMA,CAAQ;AAAA,SACnD,CAAC,EAAE,MAAAC,EAAK,MAAMA,CAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GA0BdC,IAAuBR,EAAO;AAAA;AAAA,eAK5B,CAAC,EAAE,QAAAS,EAAO,MAAMA,CAAM;AAAA,gBACrB,CAAC,EAAE,SAAAC,EAAQ,MAAMA,CAAO;AAAA;"}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
2
|
+
import { memo as d } from "react";
|
3
|
+
import n from "./sticker.js";
|
4
|
+
import { StickerGridContainer as a, StickerGrid as f } from "./sticker-grid-styles.js";
|
5
|
+
const h = ({
|
6
|
+
stickers: t,
|
7
|
+
columns: i = 4,
|
8
|
+
gap: e = 8,
|
9
|
+
stickerSize: p = 48,
|
10
|
+
onStickerClick: o
|
11
|
+
}) => /* @__PURE__ */ m(a, { $width: "350px", $height: "400px", children: /* @__PURE__ */ m(f, { $columns: i, $gap: e, children: t.map((r) => /* @__PURE__ */ m(
|
12
|
+
n,
|
13
|
+
{
|
14
|
+
emoji: r.emoji,
|
15
|
+
lottieUrl: r.lottieUrl,
|
16
|
+
size: p,
|
17
|
+
onClick: () => o == null ? void 0 : o(r)
|
18
|
+
},
|
19
|
+
r.id
|
20
|
+
)) }) }), $ = d(h);
|
21
|
+
export {
|
22
|
+
$ as default
|
23
|
+
};
|
24
|
+
//# sourceMappingURL=sticker-grid.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"sticker-grid.js","sources":["../../../../src/features/ui/sticker-grid/sticker-grid.tsx"],"sourcesContent":["import type { IStickerGridProps } from './sticker-grid-types';\n\nimport React, { memo } from 'react';\n\nimport Sticker from './sticker';\nimport { StickerGrid, StickerGridContainer } from './sticker-grid-styles';\n\nconst StickerGridComponent: React.FC<IStickerGridProps> = ({\n stickers,\n columns = 4,\n gap = 8,\n stickerSize = 48,\n onStickerClick,\n}) => {\n return (\n <StickerGridContainer $width=\"350px\" $height=\"400px\">\n <StickerGrid $columns={columns} $gap={gap}>\n {stickers.map(sticker => (\n <Sticker\n key={sticker.id}\n emoji={sticker.emoji}\n lottieUrl={sticker.lottieUrl}\n size={stickerSize}\n onClick={() => onStickerClick?.(sticker)}\n />\n ))}\n </StickerGrid>\n </StickerGridContainer>\n );\n};\n\nexport default memo(StickerGridComponent);\n"],"names":["StickerGridComponent","stickers","columns","gap","stickerSize","onStickerClick","jsx","StickerGridContainer","StickerGrid","sticker","Sticker","stickerGrid","memo"],"mappings":";;;;AAOA,MAAMA,IAAoD,CAAC;AAAA,EACzD,UAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,KAAAC,IAAM;AAAA,EACN,aAAAC,IAAc;AAAA,EACd,gBAAAC;AACF,MAEK,gBAAAC,EAAAC,GAAA,EAAqB,QAAO,SAAQ,SAAQ,SAC3C,UAAA,gBAAAD,EAACE,GAAY,EAAA,UAAUN,GAAS,MAAMC,GACnC,UAAAF,EAAS,IAAI,CACZQ,MAAA,gBAAAH;AAAA,EAACI;AAAA,EAAA;AAAA,IAEC,OAAOD,EAAQ;AAAA,IACf,WAAWA,EAAQ;AAAA,IACnB,MAAML;AAAA,IACN,SAAS,MAAMC,KAAA,gBAAAA,EAAiBI;AAAA,EAAO;AAAA,EAJlCA,EAAQ;AAAA,CAMhB,GACH,EACF,CAAA,GAIWE,IAAAC,EAAKZ,CAAoB;"}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import { jsxs as p, jsx as s } from "react/jsx-runtime";
|
2
|
+
import { memo as S, useState as v, useRef as L, useLayoutEffect as M, useCallback as i, useMemo as $ } from "react";
|
3
|
+
import g from "../lottie-animation/lottie-animation.js";
|
4
|
+
import { StickerContainer as k, StaticEmoji as E, LottieContainer as j } from "./sticker-grid-styles.js";
|
5
|
+
const x = ({
|
6
|
+
emoji: a,
|
7
|
+
lottieUrl: c,
|
8
|
+
size: t = 48,
|
9
|
+
onClick: o,
|
10
|
+
disabled: e = !1
|
11
|
+
}) => {
|
12
|
+
const [r, u] = v(!1), n = L(null);
|
13
|
+
M(() => {
|
14
|
+
n.current && n.current.playSegments([0, 1], !0);
|
15
|
+
}, []);
|
16
|
+
const f = i(() => {
|
17
|
+
e || u(!0);
|
18
|
+
}, [e]), m = i(() => {
|
19
|
+
e || u(!1);
|
20
|
+
}, [e]), l = i(() => {
|
21
|
+
!e && o && o();
|
22
|
+
}, [e, o]), h = $(
|
23
|
+
() => ({
|
24
|
+
loop: !0,
|
25
|
+
renderer: "canvas",
|
26
|
+
autoplay: r
|
27
|
+
}),
|
28
|
+
[r]
|
29
|
+
);
|
30
|
+
return /* @__PURE__ */ p(
|
31
|
+
k,
|
32
|
+
{
|
33
|
+
$size: t,
|
34
|
+
$disabled: e,
|
35
|
+
onMouseEnter: f,
|
36
|
+
onMouseLeave: m,
|
37
|
+
onClick: l,
|
38
|
+
children: [
|
39
|
+
!r && /* @__PURE__ */ s(E, { $size: t, children: a }),
|
40
|
+
c && /* @__PURE__ */ s(j, { $size: t, children: /* @__PURE__ */ s(
|
41
|
+
g,
|
42
|
+
{
|
43
|
+
ref: n,
|
44
|
+
src: c,
|
45
|
+
width: "100%",
|
46
|
+
height: "100%",
|
47
|
+
settings: h
|
48
|
+
}
|
49
|
+
) })
|
50
|
+
]
|
51
|
+
}
|
52
|
+
);
|
53
|
+
}, d = S(x);
|
54
|
+
export {
|
55
|
+
d as default
|
56
|
+
};
|
57
|
+
//# sourceMappingURL=sticker.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"sticker.js","sources":["../../../../src/features/ui/sticker-grid/sticker.tsx"],"sourcesContent":["import type { ILottieAnimationRef } from '../lottie-animation/types';\nimport type { IStickerProps } from './sticker-grid-types';\n\nimport React, { useCallback, useMemo, useRef, useState, memo, useLayoutEffect } from 'react';\n\nimport LottieAnimation from '../lottie-animation/lottie-animation';\nimport { StickerContainer, StaticEmoji, LottieContainer } from './sticker-grid-styles';\n\nconst Sticker: React.FC<IStickerProps> = ({\n emoji,\n lottieUrl,\n size = 48,\n onClick,\n disabled = false,\n}) => {\n const [isHovered, setIsHovered] = useState(false);\n const lottieRef = useRef<ILottieAnimationRef>(null);\n\n useLayoutEffect(() => {\n if (lottieRef.current) {\n lottieRef.current.playSegments([0, 1], true);\n }\n }, []);\n\n const handleMouseEnter = useCallback(() => {\n if (!disabled) setIsHovered(true);\n }, [disabled]);\n\n const handleMouseLeave = useCallback(() => {\n if (!disabled) setIsHovered(false);\n }, [disabled]);\n\n const handleClick = useCallback(() => {\n if (!disabled && onClick) onClick();\n }, [disabled, onClick]);\n\n const lottieSettings = useMemo(\n () => ({\n loop: true,\n renderer: 'canvas',\n autoplay: isHovered,\n }),\n [isHovered],\n );\n\n return (\n <StickerContainer\n $size={size}\n $disabled={disabled}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onClick={handleClick}\n >\n {!isHovered && <StaticEmoji $size={size}>{emoji}</StaticEmoji>}\n\n {lottieUrl && (\n <LottieContainer $size={size}>\n <LottieAnimation\n ref={lottieRef}\n src={lottieUrl}\n width=\"100%\"\n height=\"100%\"\n settings={lottieSettings}\n />\n </LottieContainer>\n )}\n </StickerContainer>\n );\n};\n\nexport default memo(Sticker);\n"],"names":["Sticker","emoji","lottieUrl","size","onClick","disabled","isHovered","setIsHovered","useState","lottieRef","useRef","useLayoutEffect","handleMouseEnter","useCallback","handleMouseLeave","handleClick","lottieSettings","useMemo","jsxs","StickerContainer","jsx","StaticEmoji","LottieContainer","LottieAnimation","Sticker$1","memo"],"mappings":";;;;AAQA,MAAMA,IAAmC,CAAC;AAAA,EACxC,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,SAAAC;AAAA,EACA,UAAAC,IAAW;AACb,MAAM;AACJ,QAAM,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAK,GAC1CC,IAAYC,EAA4B,IAAI;AAElD,EAAAC,EAAgB,MAAM;AACpB,IAAIF,EAAU,WACZA,EAAU,QAAQ,aAAa,CAAC,GAAG,CAAC,GAAG,EAAI;AAAA,EAE/C,GAAG,CAAE,CAAA;AAEC,QAAAG,IAAmBC,EAAY,MAAM;AACrC,IAACR,KAAUE,EAAa,EAAI;AAAA,EAAA,GAC/B,CAACF,CAAQ,CAAC,GAEPS,IAAmBD,EAAY,MAAM;AACrC,IAACR,KAAUE,EAAa,EAAK;AAAA,EAAA,GAChC,CAACF,CAAQ,CAAC,GAEPU,IAAcF,EAAY,MAAM;AAChC,IAAA,CAACR,KAAYD,KAAiBA;EAAA,GACjC,CAACC,GAAUD,CAAO,CAAC,GAEhBY,IAAiBC;AAAA,IACrB,OAAO;AAAA,MACL,MAAM;AAAA,MACN,UAAU;AAAA,MACV,UAAUX;AAAA,IAAA;AAAA,IAEZ,CAACA,CAAS;AAAA,EAAA;AAIV,SAAA,gBAAAY;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,OAAOhB;AAAA,MACP,WAAWE;AAAA,MACX,cAAcO;AAAA,MACd,cAAcE;AAAA,MACd,SAASC;AAAA,MAER,UAAA;AAAA,QAAA,CAACT,KAAa,gBAAAc,EAACC,GAAY,EAAA,OAAOlB,GAAO,UAAMF,GAAA;AAAA,QAE/CC,KACC,gBAAAkB,EAACE,GAAgB,EAAA,OAAOnB,GACtB,UAAA,gBAAAiB;AAAA,UAACG;AAAA,UAAA;AAAA,YACC,KAAKd;AAAA,YACL,KAAKP;AAAA,YACL,OAAM;AAAA,YACN,QAAO;AAAA,YACP,UAAUc;AAAA,UAAA;AAAA,QAAA,GAEd;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR,GAEeQ,IAAAC,EAAKzB,CAAO;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../src/features/ui/stickers/constants.ts"],"sourcesContent":["export const STICKER_MIN_SIZE = 32;\nexport const STICKER_MAX_SIZE = 48;\n"],"names":["STICKER_MIN_SIZE","STICKER_MAX_SIZE"],"mappings":"AAAO,MAAMA,IAAmB,IACnBC,IAAmB;"}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
import { keyframes as r, css as t } from "styled-components";
|
2
|
+
import { randomizeDuration as o } from "./stickers-utils.js";
|
3
|
+
const s = r`
|
4
|
+
0% {
|
5
|
+
transform: translateY(0vh);
|
6
|
+
opacity: 1;
|
7
|
+
}
|
8
|
+
100% {
|
9
|
+
transform: translateY(-100vh);
|
10
|
+
opacity: 0;
|
11
|
+
}
|
12
|
+
`, n = r`
|
13
|
+
0% {
|
14
|
+
transform: translateY(0vh);
|
15
|
+
opacity: 1;
|
16
|
+
}
|
17
|
+
100% {
|
18
|
+
transform: translateY(100vh);
|
19
|
+
opacity: 0;
|
20
|
+
}
|
21
|
+
`, e = r`
|
22
|
+
0% {
|
23
|
+
transform: translateX(var(--from-x)) translateY(var(--from-y)) scale(1);
|
24
|
+
opacity: 1;
|
25
|
+
}
|
26
|
+
100% {
|
27
|
+
transform: translateX(0vw) translateY(0vh) scale(1.25);
|
28
|
+
opacity: 0;
|
29
|
+
}
|
30
|
+
`, m = r`
|
31
|
+
0% {
|
32
|
+
transform: translateX(0) translateY(0vh);
|
33
|
+
opacity: 1;
|
34
|
+
}
|
35
|
+
35% {
|
36
|
+
transform: translateX(0) translateY(-50vh) scale(1.25);
|
37
|
+
opacity: 1;
|
38
|
+
}
|
39
|
+
60% {
|
40
|
+
transform: translateX(var(--from-x)) translateY(var(--from-y)) scale(1.25);
|
41
|
+
opacity: 0.75;
|
42
|
+
}
|
43
|
+
100% {
|
44
|
+
transform: translateX(var(--from-x)) translateY(-110vh) scale(1.25);
|
45
|
+
opacity: 0;
|
46
|
+
}
|
47
|
+
`, i = {
|
48
|
+
float_up: (a) => t`
|
49
|
+
animation: ${s} ${o(a)}ms ease-out forwards;
|
50
|
+
`,
|
51
|
+
fall_down: (a) => t`
|
52
|
+
animation: ${n} ${o(a)}ms ease-out forwards;
|
53
|
+
`,
|
54
|
+
burst_from_edges: (a) => t`
|
55
|
+
animation: ${e} ${o(a)}ms linear forwards;
|
56
|
+
`,
|
57
|
+
pop_expand: (a) => t`
|
58
|
+
animation: ${m} ${a}ms cubic-bezier(0.5, 0.1, 0.7, 1) forwards;
|
59
|
+
`
|
60
|
+
};
|
61
|
+
export {
|
62
|
+
i as effectAnimations
|
63
|
+
};
|
64
|
+
//# sourceMappingURL=stickers-effects.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"stickers-effects.js","sources":["../../../../src/features/ui/stickers/stickers-effects.ts"],"sourcesContent":["import type { StickersProps } from './stickers-types';\n\nimport { keyframes, css } from 'styled-components';\n\nimport { randomizeDuration } from './stickers-utils';\n\nconst floatUp = keyframes`\n 0% {\n transform: translateY(0vh);\n opacity: 1;\n }\n 100% {\n transform: translateY(-100vh);\n opacity: 0;\n }\n`;\n\nconst fallDown = keyframes`\n 0% {\n transform: translateY(0vh);\n opacity: 1;\n }\n 100% {\n transform: translateY(100vh);\n opacity: 0;\n }\n`;\n\nconst burstFromEdges = keyframes`\n 0% {\n transform: translateX(var(--from-x)) translateY(var(--from-y)) scale(1);\n opacity: 1;\n }\n 100% {\n transform: translateX(0vw) translateY(0vh) scale(1.25);\n opacity: 0;\n }\n`;\n\nconst popExpand = keyframes`\n 0% {\n transform: translateX(0) translateY(0vh);\n opacity: 1;\n }\n 35% {\n transform: translateX(0) translateY(-50vh) scale(1.25);\n opacity: 1;\n }\n 60% {\n transform: translateX(var(--from-x)) translateY(var(--from-y)) scale(1.25);\n opacity: 0.75;\n }\n 100% {\n transform: translateX(var(--from-x)) translateY(-110vh) scale(1.25);\n opacity: 0;\n }\n`;\n\nexport const effectAnimations: Record<\n StickersProps['effect'],\n (duration: number) => ReturnType<typeof css>\n> = {\n float_up: (duration: number) => css`\n animation: ${floatUp} ${randomizeDuration(duration)}ms ease-out forwards;\n `,\n fall_down: (duration: number) => css`\n animation: ${fallDown} ${randomizeDuration(duration)}ms ease-out forwards;\n `,\n burst_from_edges: (duration: number) => css`\n animation: ${burstFromEdges} ${randomizeDuration(duration)}ms linear forwards;\n `,\n pop_expand: (duration: number) => css`\n animation: ${popExpand} ${duration}ms cubic-bezier(0.5, 0.1, 0.7, 1) forwards;\n `,\n};\n"],"names":["floatUp","keyframes","fallDown","burstFromEdges","popExpand","effectAnimations","duration","css","randomizeDuration"],"mappings":";;AAMA,MAAMA,IAAUC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAWVC,IAAWD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAWXE,IAAiBF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAWjBG,IAAYH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAmBLI,IAGT;AAAA,EACF,UAAU,CAACC,MAAqBC;AAAA,iBACjBP,CAAO,IAAIQ,EAAkBF,CAAQ,CAAC;AAAA;AAAA,EAErD,WAAW,CAACA,MAAqBC;AAAA,iBAClBL,CAAQ,IAAIM,EAAkBF,CAAQ,CAAC;AAAA;AAAA,EAEtD,kBAAkB,CAACA,MAAqBC;AAAA,iBACzBJ,CAAc,IAAIK,EAAkBF,CAAQ,CAAC;AAAA;AAAA,EAE5D,YAAY,CAACA,MAAqBC;AAAA,iBACnBH,CAAS,IAAIE,CAAQ;AAAA;AAEtC;"}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import $, { css as s } from "styled-components";
|
2
|
+
import { effectAnimations as n } from "./stickers-effects.js";
|
3
|
+
const h = $.div`
|
4
|
+
position: relative;
|
5
|
+
width: 100vw;
|
6
|
+
height: 100vh;
|
7
|
+
background: transparent;
|
8
|
+
pointer-events: none;
|
9
|
+
`, a = $.div`
|
10
|
+
position: absolute;
|
11
|
+
z-index: 10;
|
12
|
+
|
13
|
+
left: ${({ x: t }) => `${t}%`};
|
14
|
+
top: ${({ y: t }) => `${t}%`};
|
15
|
+
width: ${({ size: t }) => `${t}px`};
|
16
|
+
height: ${({ size: t }) => `${t}px`};
|
17
|
+
font-size: ${({ size: t }) => `${t}px`};
|
18
|
+
|
19
|
+
${({ effect: t, duration: i, fromX: o, fromY: e }) => o && e ? s`
|
20
|
+
${n[t](i)}
|
21
|
+
--from-x: ${o};
|
22
|
+
--from-y: ${e};
|
23
|
+
` : n[t](i)}
|
24
|
+
`;
|
25
|
+
export {
|
26
|
+
h as Container,
|
27
|
+
a as Sticker
|
28
|
+
};
|
29
|
+
//# sourceMappingURL=stickers-styled.js.map
|