@cuemath/leap 3.0.10 → 3.0.11-akm-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/features/chapters/chapters-list/chapter-item/chapter-item-styled.js +36 -27
- package/dist/features/chapters/chapters-list/chapter-item/chapter-item-styled.js.map +1 -1
- package/dist/features/chapters/chapters-list/chapter-item/chapter-item.js +43 -31
- package/dist/features/chapters/chapters-list/chapter-item/chapter-item.js.map +1 -1
- package/dist/features/chapters/chapters-list/chapters-list.js +16 -15
- package/dist/features/chapters/chapters-list/chapters-list.js.map +1 -1
- package/dist/features/chapters-v2/chapter-details/block-sections/block-section-view.js +2 -2
- package/dist/features/chapters-v2/chapter-details/block-sections/block-section-view.js.map +1 -1
- package/dist/features/chapters-v2/chapter-details/block-sections/block-sections.js +30 -30
- package/dist/features/chapters-v2/chapter-details/block-sections/block-sections.js.map +1 -1
- package/dist/features/chapters-v2/chapter-details/chapter-details.js +35 -35
- package/dist/features/chapters-v2/chapter-details/chapter-details.js.map +1 -1
- package/dist/features/chapters-v2/comps/node-card/teacher-actions/teacher-actions.js +44 -44
- package/dist/features/chapters-v2/comps/node-card/teacher-actions/teacher-actions.js.map +1 -1
- package/dist/features/circle-games/hooks/use-circle-sounds/use-circle-sounds.js +74 -74
- package/dist/features/circle-games/hooks/use-circle-sounds/use-circle-sounds.js.map +1 -1
- package/dist/features/homework/homework-card.js +146 -131
- package/dist/features/homework/homework-card.js.map +1 -1
- package/dist/features/journey/hooks/use-chapter-journey.js +28 -28
- package/dist/features/journey/hooks/use-chapter-journey.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-list.js +40 -38
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-list.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-tabs/milestone-tabs.js +53 -50
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-tabs/milestone-tabs.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget.js +64 -62
- package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-widget.js.map +1 -1
- package/dist/features/milestone/milestone-list-container/milestone-list-container.js +44 -42
- package/dist/features/milestone/milestone-list-container/milestone-list-container.js.map +1 -1
- package/dist/features/milestone/milestone-resources/resources-list/resources-list.js +39 -37
- package/dist/features/milestone/milestone-resources/resources-list/resources-list.js.map +1 -1
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-container.js +38 -31
- package/dist/features/milestone/milestone-tests/test-list-v2/test-list-container.js.map +1 -1
- package/dist/features/post-game-stats/accuracy/accuracy.js +40 -39
- package/dist/features/post-game-stats/accuracy/accuracy.js.map +1 -1
- package/dist/features/post-game-stats/clock/clock.js +45 -45
- package/dist/features/post-game-stats/clock/clock.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/package.json +1 -1
|
@@ -1,80 +1,81 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { memo as
|
|
4
|
-
import { LOTTIE as
|
|
5
|
-
import { useCircleSounds as
|
|
6
|
-
import { CircleSoundKey as
|
|
1
|
+
import { jsxs as X, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import M from "lottie-web";
|
|
3
|
+
import { memo as W, useRef as a, useState as d, useCallback as b, useEffect as k } from "react";
|
|
4
|
+
import { LOTTIE as h } from "../../../assets/lottie/lottie.js";
|
|
5
|
+
import { useCircleSounds as H } from "../../circle-games/hooks/use-circle-sounds/use-circle-sounds.js";
|
|
6
|
+
import { CircleSoundKey as C } from "../../circle-games/hooks/use-circle-sounds/use-circle-sounds-enums.js";
|
|
7
7
|
import { delay as s } from "../../utils/utils.js";
|
|
8
|
-
import { AnimatedPercentTextInput as
|
|
9
|
-
import { Accuracy as
|
|
10
|
-
import { getAccuracyFramesToPlay as
|
|
11
|
-
import { NEEDLE_HOLD_TIME as
|
|
12
|
-
const
|
|
13
|
-
const { play: c } =
|
|
8
|
+
import { AnimatedPercentTextInput as K } from "./accuracy-comps.js";
|
|
9
|
+
import { Accuracy as q, AccuracyMeterLottie as z, AnimatedAccuracyNeedleContainer as B, AccuracyNeedleLottie as G, TextWrapper as J, PercentTextWrapper as Q } from "./accuracy-styled.js";
|
|
10
|
+
import { getAccuracyFramesToPlay as V } from "./accuracy-utils.js";
|
|
11
|
+
import { NEEDLE_HOLD_TIME as O, METER as F, TEXT_DISAPPEAR_DELAY as Z, TEXT_DISAPPEAR_DURATION as ee, TEXT_APPEAR_DURATION as te, NEEDLE as U, NEEDLE_LOTTIE_FPS as g } from "./constants.js";
|
|
12
|
+
const fe = W(({ show: u, onComplete: n, accuracy: l, helperText: E }) => {
|
|
13
|
+
const { play: c } = H(), y = a(null), p = a(null), o = a(), e = a(), [w, x] = d(!0), [m, T] = d(!1), [R, $] = d(!1), v = a(0), _ = (U.IN_FRAMES[1] - U.IN_FRAMES[0]) / g * 1e3, L = b(async () => {
|
|
14
14
|
var A;
|
|
15
15
|
try {
|
|
16
|
-
await s(
|
|
17
|
-
} catch (
|
|
18
|
-
console.log(
|
|
16
|
+
await s(O), x(!1), T(!1), c(C.ACCURACY_OUT), (A = o.current) == null || A.playSegments(F.OUT_FRAMES, !0), await s(Z), $(!0), n == null || n();
|
|
17
|
+
} catch (t) {
|
|
18
|
+
console.log(t);
|
|
19
19
|
}
|
|
20
20
|
}, [n, c]);
|
|
21
|
-
return
|
|
21
|
+
return k(() => {
|
|
22
22
|
if (u)
|
|
23
23
|
return (async () => {
|
|
24
|
-
var
|
|
25
|
-
const [
|
|
26
|
-
fetch(
|
|
27
|
-
fetch(
|
|
24
|
+
var S;
|
|
25
|
+
const [t, i] = await Promise.all([
|
|
26
|
+
fetch(h.ACCURACY_METER),
|
|
27
|
+
fetch(h.ACCURACY_NEEDLE)
|
|
28
28
|
]), [Y, j] = await Promise.all([
|
|
29
|
-
|
|
29
|
+
t.json(),
|
|
30
30
|
i.json()
|
|
31
31
|
]);
|
|
32
|
-
o.current =
|
|
32
|
+
o.current = M.loadAnimation({
|
|
33
33
|
container: y.current,
|
|
34
34
|
animationData: Y,
|
|
35
35
|
autoplay: !1,
|
|
36
36
|
loop: !1,
|
|
37
37
|
renderer: "svg"
|
|
38
|
-
}),
|
|
38
|
+
}), e.current = M.loadAnimation({
|
|
39
39
|
container: p.current,
|
|
40
40
|
animationData: j,
|
|
41
41
|
autoplay: !1,
|
|
42
42
|
loop: !1,
|
|
43
43
|
renderer: "svg"
|
|
44
|
-
}), c(
|
|
44
|
+
}), c(C.ACCURACY_IN), (S = o.current) == null || S.playSegments(F.IN_FRAMES, !0), s(_).then(() => {
|
|
45
45
|
var D, P, N;
|
|
46
|
-
const f =
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
const f = V(l);
|
|
47
|
+
v.current = f, (D = e.current) == null || D.setSpeed(f / g), (P = e.current) == null || P.playSegments([0, f], !0), T(!0), (N = e.current) == null || N.addEventListener("complete", () => {
|
|
48
|
+
var I;
|
|
49
|
+
(I = e.current) == null || I.removeEventListener("complete"), s(O).then(() => L());
|
|
49
50
|
});
|
|
50
51
|
});
|
|
51
52
|
})(), () => {
|
|
52
|
-
var
|
|
53
|
-
(
|
|
53
|
+
var t, i;
|
|
54
|
+
(t = o.current) == null || t.destroy(), (i = e.current) == null || i.destroy();
|
|
54
55
|
};
|
|
55
|
-
}, [u, l, _,
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
|
|
58
|
-
E && /* @__PURE__ */
|
|
59
|
-
|
|
56
|
+
}, [u, l, _, L, c]), u ? /* @__PURE__ */ X(q, { children: [
|
|
57
|
+
/* @__PURE__ */ r(z, { ref: y }),
|
|
58
|
+
w && /* @__PURE__ */ r(B, { children: /* @__PURE__ */ r(G, { ref: p }) }),
|
|
59
|
+
E && /* @__PURE__ */ r(
|
|
60
|
+
J,
|
|
60
61
|
{
|
|
61
62
|
$delay: 1e3,
|
|
62
63
|
$animationType: R ? "fadeout" : "fadein",
|
|
63
|
-
$duration: R ?
|
|
64
|
+
$duration: R ? ee : te,
|
|
64
65
|
children: E
|
|
65
66
|
}
|
|
66
67
|
),
|
|
67
|
-
m && /* @__PURE__ */
|
|
68
|
-
|
|
68
|
+
m && /* @__PURE__ */ r(
|
|
69
|
+
Q,
|
|
69
70
|
{
|
|
70
71
|
$animationType: m ? "fadein" : "fadeout",
|
|
71
72
|
$duration: 200,
|
|
72
|
-
children: /* @__PURE__ */
|
|
73
|
+
children: /* @__PURE__ */ r(K, { accuracy: Math.round(l), time: 1e3 })
|
|
73
74
|
}
|
|
74
75
|
)
|
|
75
76
|
] }) : null;
|
|
76
77
|
});
|
|
77
78
|
export {
|
|
78
|
-
|
|
79
|
+
fe as Accuracy
|
|
79
80
|
};
|
|
80
81
|
//# sourceMappingURL=accuracy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accuracy.js","sources":["../../../../src/features/post-game-stats/accuracy/accuracy.tsx"],"sourcesContent":["import type { IAccuracyProps } from './accuracy-types';\nimport type { AnimationItem } from 'lottie-web';\nimport type { FC } from 'react';\n\nimport Lottie from 'lottie-web';\nimport { memo, useEffect, useRef, useState, useCallback } from 'react';\n\nimport { LOTTIE } from '../../../assets/lottie/lottie';\nimport { useCircleSounds } from '../../circle-games/hooks/use-circle-sounds/use-circle-sounds';\nimport { CircleSoundKey } from '../../circle-games/hooks/use-circle-sounds/use-circle-sounds-enums';\nimport { delay } from '../../utils/utils';\nimport { AnimatedPercentTextInput } from './accuracy-comps';\nimport * as Styled from './accuracy-styled';\nimport { getAccuracyFramesToPlay } from './accuracy-utils';\nimport {\n METER,\n NEEDLE,\n NEEDLE_HOLD_TIME,\n TEXT_APPEAR_DURATION,\n TEXT_DISAPPEAR_DELAY,\n TEXT_DISAPPEAR_DURATION,\n NEEDLE_LOTTIE_FPS,\n} from './constants';\n\nexport const Accuracy: FC<IAccuracyProps> = memo(({ show, onComplete, accuracy, helperText }) => {\n const { play } = useCircleSounds();\n const accuracyMeterRef = useRef<HTMLDivElement>(null);\n const accuracyNeedleRef = useRef<HTMLDivElement>(null);\n const accuracyMeterAnimationRef = useRef<AnimationItem>();\n const accuracyNeedleAnimationRef = useRef<AnimationItem>();\n\n const [showAccuracy, setShowAccuracy] = useState(true);\n const [showPercent, setShowPercent] = useState(false);\n const [fadeOut, setFadeOut] = useState(false);\n const needleFramesToPlay = useRef(0);\n\n const percentStartAnimationDelayInMs =\n ((NEEDLE.IN_FRAMES[1] - NEEDLE.IN_FRAMES[0]) / NEEDLE_LOTTIE_FPS) * 1000;\n\n const playExitAnimation = useCallback(async () => {\n try {\n await delay(NEEDLE_HOLD_TIME);\n setShowAccuracy(false);\n setShowPercent(false);\n play(CircleSoundKey.ACCURACY_OUT);\n accuracyMeterAnimationRef.current?.playSegments(METER.OUT_FRAMES, true);\n await delay(TEXT_DISAPPEAR_DELAY);\n setFadeOut(true);\n onComplete?.();\n } catch (err) {\n /* eslint-disable no-console */\n console.log(err);\n }\n }, [onComplete, play]);\n\n useEffect(() => {\n if (show) {\n const loadAnimations = async () => {\n const [meterLottie, needleLottie] = await Promise.all([\n fetch(LOTTIE.ACCURACY_METER),\n fetch(LOTTIE.ACCURACY_NEEDLE),\n ]);\n const [meterLottieData, needleLottieData] = await Promise.all([\n meterLottie.json(),\n needleLottie.json(),\n ]);\n\n accuracyMeterAnimationRef.current = Lottie.loadAnimation({\n container: accuracyMeterRef.current as Element,\n animationData: meterLottieData,\n autoplay: false,\n loop: false,\n renderer: 'svg',\n });\n\n accuracyNeedleAnimationRef.current = Lottie.loadAnimation({\n container: accuracyNeedleRef.current as Element,\n animationData: needleLottieData,\n autoplay: false,\n loop: false,\n renderer: 'svg',\n });\n\n play(CircleSoundKey.ACCURACY_IN);\n accuracyMeterAnimationRef.current?.playSegments(METER.IN_FRAMES, true);\n\n delay(percentStartAnimationDelayInMs).then(() => {\n const frames = getAccuracyFramesToPlay(accuracy);\n\n needleFramesToPlay.current = frames;\n accuracyNeedleAnimationRef.current?.setSpeed(frames / NEEDLE_LOTTIE_FPS);\n accuracyNeedleAnimationRef.current?.playSegments([0, frames], true);\n setShowPercent(true);\n\n accuracyNeedleAnimationRef.current?.addEventListener('complete', () => {\n delay(NEEDLE_HOLD_TIME).then(() => playExitAnimation());\n });\n });\n };\n\n loadAnimations();\n\n return () => {\n accuracyMeterAnimationRef.current?.destroy();\n accuracyNeedleAnimationRef.current?.destroy();\n };\n }\n }, [show, accuracy, percentStartAnimationDelayInMs, playExitAnimation, play]);\n\n if (show) {\n return (\n <Styled.Accuracy>\n <Styled.AccuracyMeterLottie ref={accuracyMeterRef} />\n {showAccuracy && (\n <Styled.AnimatedAccuracyNeedleContainer>\n <Styled.AccuracyNeedleLottie ref={accuracyNeedleRef} />\n </Styled.AnimatedAccuracyNeedleContainer>\n )}\n {helperText && (\n <Styled.TextWrapper\n $delay={1000}\n $animationType={fadeOut ? 'fadeout' : 'fadein'}\n $duration={fadeOut ? TEXT_DISAPPEAR_DURATION : TEXT_APPEAR_DURATION}\n >\n {helperText}\n </Styled.TextWrapper>\n )}\n {showPercent && (\n <Styled.PercentTextWrapper\n $animationType={showPercent ? 'fadein' : 'fadeout'}\n $duration={showPercent ? 200 : 200}\n >\n <AnimatedPercentTextInput accuracy={Math.round(accuracy)} time={1000} />\n </Styled.PercentTextWrapper>\n )}\n </Styled.Accuracy>\n );\n }\n\n return null;\n});\n"],"names":["Accuracy","memo","show","onComplete","accuracy","helperText","play","useCircleSounds","accuracyMeterRef","useRef","accuracyNeedleRef","accuracyMeterAnimationRef","accuracyNeedleAnimationRef","showAccuracy","setShowAccuracy","useState","showPercent","setShowPercent","fadeOut","setFadeOut","needleFramesToPlay","percentStartAnimationDelayInMs","NEEDLE","NEEDLE_LOTTIE_FPS","playExitAnimation","useCallback","delay","NEEDLE_HOLD_TIME","CircleSoundKey","_a","METER","TEXT_DISAPPEAR_DELAY","err","useEffect","meterLottie","needleLottie","LOTTIE","meterLottieData","needleLottieData","Lottie","frames","getAccuracyFramesToPlay","_b","_c","jsxs","Styled.Accuracy","jsx","Styled.AccuracyMeterLottie","Styled.AnimatedAccuracyNeedleContainer","Styled.AccuracyNeedleLottie","Styled.TextWrapper","TEXT_DISAPPEAR_DURATION","TEXT_APPEAR_DURATION","Styled.PercentTextWrapper","AnimatedPercentTextInput"],"mappings":";;;;;;;;;;;AAwBa,MAAAA,KAA+BC,EAAK,CAAC,EAAE,MAAAC,GAAM,YAAAC,GAAY,UAAAC,GAAU,YAAAC,QAAiB;AACzF,QAAA,EAAE,MAAAC,MAASC,KACXC,IAAmBC,EAAuB,IAAI,GAC9CC,IAAoBD,EAAuB,IAAI,GAC/CE,IAA4BF,KAC5BG,IAA6BH,KAE7B,CAACI,GAAcC,CAAe,IAAIC,EAAS,EAAI,GAC/C,CAACC,GAAaC,CAAc,IAAIF,EAAS,EAAK,GAC9C,CAACG,GAASC,CAAU,IAAIJ,EAAS,EAAK,GACtCK,IAAqBX,EAAO,CAAC,GAE7BY,KACFC,EAAO,UAAU,CAAC,IAAIA,EAAO,UAAU,CAAC,KAAKC,IAAqB,KAEhEC,IAAoBC,EAAY,YAAY;;AAC5C,QAAA;AACF,YAAMC,EAAMC,CAAgB,GAC5Bb,EAAgB,EAAK,GACrBG,EAAe,EAAK,GACpBX,EAAKsB,EAAe,YAAY,IAChCC,IAAAlB,EAA0B,YAA1B,QAAAkB,EAAmC,aAAaC,EAAM,YAAY,KAClE,MAAMJ,EAAMK,CAAoB,GAChCZ,EAAW,EAAI,GACFhB,KAAA,QAAAA;AAAA,aACN6B,GAAK;AAEZ,cAAQ,IAAIA,CAAG;AAAA,IACjB;AAAA,EAAA,GACC,CAAC7B,GAAYG,CAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"accuracy.js","sources":["../../../../src/features/post-game-stats/accuracy/accuracy.tsx"],"sourcesContent":["import type { IAccuracyProps } from './accuracy-types';\nimport type { AnimationItem } from 'lottie-web';\nimport type { FC } from 'react';\n\nimport Lottie from 'lottie-web';\nimport { memo, useEffect, useRef, useState, useCallback } from 'react';\n\nimport { LOTTIE } from '../../../assets/lottie/lottie';\nimport { useCircleSounds } from '../../circle-games/hooks/use-circle-sounds/use-circle-sounds';\nimport { CircleSoundKey } from '../../circle-games/hooks/use-circle-sounds/use-circle-sounds-enums';\nimport { delay } from '../../utils/utils';\nimport { AnimatedPercentTextInput } from './accuracy-comps';\nimport * as Styled from './accuracy-styled';\nimport { getAccuracyFramesToPlay } from './accuracy-utils';\nimport {\n METER,\n NEEDLE,\n NEEDLE_HOLD_TIME,\n TEXT_APPEAR_DURATION,\n TEXT_DISAPPEAR_DELAY,\n TEXT_DISAPPEAR_DURATION,\n NEEDLE_LOTTIE_FPS,\n} from './constants';\n\nexport const Accuracy: FC<IAccuracyProps> = memo(({ show, onComplete, accuracy, helperText }) => {\n const { play } = useCircleSounds();\n const accuracyMeterRef = useRef<HTMLDivElement>(null);\n const accuracyNeedleRef = useRef<HTMLDivElement>(null);\n const accuracyMeterAnimationRef = useRef<AnimationItem>();\n const accuracyNeedleAnimationRef = useRef<AnimationItem>();\n\n const [showAccuracy, setShowAccuracy] = useState(true);\n const [showPercent, setShowPercent] = useState(false);\n const [fadeOut, setFadeOut] = useState(false);\n const needleFramesToPlay = useRef(0);\n\n const percentStartAnimationDelayInMs =\n ((NEEDLE.IN_FRAMES[1] - NEEDLE.IN_FRAMES[0]) / NEEDLE_LOTTIE_FPS) * 1000;\n\n const playExitAnimation = useCallback(async () => {\n try {\n await delay(NEEDLE_HOLD_TIME);\n setShowAccuracy(false);\n setShowPercent(false);\n play(CircleSoundKey.ACCURACY_OUT);\n accuracyMeterAnimationRef.current?.playSegments(METER.OUT_FRAMES, true);\n await delay(TEXT_DISAPPEAR_DELAY);\n setFadeOut(true);\n onComplete?.();\n } catch (err) {\n /* eslint-disable no-console */\n console.log(err);\n }\n }, [onComplete, play]);\n\n useEffect(() => {\n if (show) {\n const loadAnimations = async () => {\n const [meterLottie, needleLottie] = await Promise.all([\n fetch(LOTTIE.ACCURACY_METER),\n fetch(LOTTIE.ACCURACY_NEEDLE),\n ]);\n const [meterLottieData, needleLottieData] = await Promise.all([\n meterLottie.json(),\n needleLottie.json(),\n ]);\n\n accuracyMeterAnimationRef.current = Lottie.loadAnimation({\n container: accuracyMeterRef.current as Element,\n animationData: meterLottieData,\n autoplay: false,\n loop: false,\n renderer: 'svg',\n });\n\n accuracyNeedleAnimationRef.current = Lottie.loadAnimation({\n container: accuracyNeedleRef.current as Element,\n animationData: needleLottieData,\n autoplay: false,\n loop: false,\n renderer: 'svg',\n });\n\n play(CircleSoundKey.ACCURACY_IN);\n accuracyMeterAnimationRef.current?.playSegments(METER.IN_FRAMES, true);\n\n delay(percentStartAnimationDelayInMs).then(() => {\n const frames = getAccuracyFramesToPlay(accuracy);\n\n needleFramesToPlay.current = frames;\n accuracyNeedleAnimationRef.current?.setSpeed(frames / NEEDLE_LOTTIE_FPS);\n accuracyNeedleAnimationRef.current?.playSegments([0, frames], true);\n setShowPercent(true);\n\n accuracyNeedleAnimationRef.current?.addEventListener('complete', () => {\n accuracyNeedleAnimationRef.current?.removeEventListener('complete');\n delay(NEEDLE_HOLD_TIME).then(() => playExitAnimation());\n });\n });\n };\n\n loadAnimations();\n\n return () => {\n accuracyMeterAnimationRef.current?.destroy();\n accuracyNeedleAnimationRef.current?.destroy();\n };\n }\n }, [show, accuracy, percentStartAnimationDelayInMs, playExitAnimation, play]);\n\n if (show) {\n return (\n <Styled.Accuracy>\n <Styled.AccuracyMeterLottie ref={accuracyMeterRef} />\n {showAccuracy && (\n <Styled.AnimatedAccuracyNeedleContainer>\n <Styled.AccuracyNeedleLottie ref={accuracyNeedleRef} />\n </Styled.AnimatedAccuracyNeedleContainer>\n )}\n {helperText && (\n <Styled.TextWrapper\n $delay={1000}\n $animationType={fadeOut ? 'fadeout' : 'fadein'}\n $duration={fadeOut ? TEXT_DISAPPEAR_DURATION : TEXT_APPEAR_DURATION}\n >\n {helperText}\n </Styled.TextWrapper>\n )}\n {showPercent && (\n <Styled.PercentTextWrapper\n $animationType={showPercent ? 'fadein' : 'fadeout'}\n $duration={showPercent ? 200 : 200}\n >\n <AnimatedPercentTextInput accuracy={Math.round(accuracy)} time={1000} />\n </Styled.PercentTextWrapper>\n )}\n </Styled.Accuracy>\n );\n }\n\n return null;\n});\n"],"names":["Accuracy","memo","show","onComplete","accuracy","helperText","play","useCircleSounds","accuracyMeterRef","useRef","accuracyNeedleRef","accuracyMeterAnimationRef","accuracyNeedleAnimationRef","showAccuracy","setShowAccuracy","useState","showPercent","setShowPercent","fadeOut","setFadeOut","needleFramesToPlay","percentStartAnimationDelayInMs","NEEDLE","NEEDLE_LOTTIE_FPS","playExitAnimation","useCallback","delay","NEEDLE_HOLD_TIME","CircleSoundKey","_a","METER","TEXT_DISAPPEAR_DELAY","err","useEffect","meterLottie","needleLottie","LOTTIE","meterLottieData","needleLottieData","Lottie","frames","getAccuracyFramesToPlay","_b","_c","jsxs","Styled.Accuracy","jsx","Styled.AccuracyMeterLottie","Styled.AnimatedAccuracyNeedleContainer","Styled.AccuracyNeedleLottie","Styled.TextWrapper","TEXT_DISAPPEAR_DURATION","TEXT_APPEAR_DURATION","Styled.PercentTextWrapper","AnimatedPercentTextInput"],"mappings":";;;;;;;;;;;AAwBa,MAAAA,KAA+BC,EAAK,CAAC,EAAE,MAAAC,GAAM,YAAAC,GAAY,UAAAC,GAAU,YAAAC,QAAiB;AACzF,QAAA,EAAE,MAAAC,MAASC,KACXC,IAAmBC,EAAuB,IAAI,GAC9CC,IAAoBD,EAAuB,IAAI,GAC/CE,IAA4BF,KAC5BG,IAA6BH,KAE7B,CAACI,GAAcC,CAAe,IAAIC,EAAS,EAAI,GAC/C,CAACC,GAAaC,CAAc,IAAIF,EAAS,EAAK,GAC9C,CAACG,GAASC,CAAU,IAAIJ,EAAS,EAAK,GACtCK,IAAqBX,EAAO,CAAC,GAE7BY,KACFC,EAAO,UAAU,CAAC,IAAIA,EAAO,UAAU,CAAC,KAAKC,IAAqB,KAEhE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1,75 +1,75 @@
|
|
|
1
|
-
import { jsxs as K, jsx as
|
|
2
|
-
import
|
|
3
|
-
import { memo as g, useState as h, useRef as o, useCallback as
|
|
4
|
-
import { LOTTIE as
|
|
1
|
+
import { jsxs as K, jsx as T } from "react/jsx-runtime";
|
|
2
|
+
import k from "lottie-web";
|
|
3
|
+
import { memo as g, useState as h, useRef as o, useCallback as f, useEffect as j } from "react";
|
|
4
|
+
import { LOTTIE as R } from "../../../assets/lottie/lottie.js";
|
|
5
5
|
import { useCircleSounds as x } from "../../circle-games/hooks/use-circle-sounds/use-circle-sounds.js";
|
|
6
|
-
import { CircleSoundKey as
|
|
7
|
-
import { delay as
|
|
6
|
+
import { CircleSoundKey as D } from "../../circle-games/hooks/use-circle-sounds/use-circle-sounds-enums.js";
|
|
7
|
+
import { delay as v } from "../../utils/utils.js";
|
|
8
8
|
import { Clock as U, ClockLottie as $, ClockTimeSpentLottie as w, TextWrapper as X } from "./clock-styled.js";
|
|
9
9
|
import { getClockTimeSpentFramesToPlay as Y } from "./clock-util.js";
|
|
10
10
|
import { CLOCK_TIME_SPENT_FPS as H, CLOCK as N, CLOCK_INFRAME_LOTTIE_TO_PLAY as W, TIME_LOTTIE_TO_PLAY_IN as b, TEXT_DISAPPEAR_DURATION as q, TEXT_APPEAR_DURATION as z, TIME_SHOWN_HOLD_TIME as B, TEXT_DISAPPEAR_DELAY as G } from "./constants.js";
|
|
11
|
-
const
|
|
12
|
-
const { play: c } = x(), [
|
|
13
|
-
var
|
|
14
|
-
const r = Y(
|
|
15
|
-
r && (
|
|
16
|
-
}, [
|
|
17
|
-
var r,
|
|
18
|
-
await
|
|
19
|
-
var
|
|
20
|
-
c(
|
|
11
|
+
const ie = g(({ show: m, onComplete: i, timeInMs: p, helperText: L }) => {
|
|
12
|
+
const { play: c } = x(), [E, F] = h(!1), l = o(!1), u = o(0), d = o(null), _ = o(null), a = o(), n = o(), S = f(() => {
|
|
13
|
+
var e, t;
|
|
14
|
+
const r = Y(p);
|
|
15
|
+
r && (u.current = r, (e = n.current) == null || e.setSpeed(r / H), (t = n.current) == null || t.playSegments([0, r], !0), l.current = !0);
|
|
16
|
+
}, [p]), A = f(async () => {
|
|
17
|
+
var r, e;
|
|
18
|
+
await v(B), (r = n.current) == null || r.playSegments([u.current, 0], !0), await v(G), F(!0), l.current && ((e = n.current) == null || e.addEventListener("complete", () => {
|
|
19
|
+
var t, s;
|
|
20
|
+
(t = n.current) == null || t.removeEventListener("complete"), c(D.CLOCK_OUT), (s = a.current) == null || s.playSegments(N.OUT_FRAMES, !0);
|
|
21
21
|
}));
|
|
22
|
-
}, [
|
|
22
|
+
}, [u, c]), O = f(() => {
|
|
23
23
|
i == null || i();
|
|
24
24
|
}, [i]);
|
|
25
25
|
return j(() => {
|
|
26
|
-
if (
|
|
26
|
+
if (m)
|
|
27
27
|
return (async () => {
|
|
28
|
-
var
|
|
29
|
-
const [
|
|
30
|
-
fetch(
|
|
31
|
-
fetch(
|
|
32
|
-
]), [
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
var C, y, P;
|
|
29
|
+
const [e, t] = await Promise.all([
|
|
30
|
+
fetch(R.TOTAL_TIME),
|
|
31
|
+
fetch(R.TOTAL_TIME_SPENT)
|
|
32
|
+
]), [s, M] = await Promise.all([
|
|
33
|
+
e.json(),
|
|
34
|
+
t.json()
|
|
35
35
|
]);
|
|
36
|
-
a.current =
|
|
36
|
+
a.current = k.loadAnimation({
|
|
37
37
|
container: d.current,
|
|
38
|
-
animationData:
|
|
38
|
+
animationData: s,
|
|
39
39
|
autoplay: !1,
|
|
40
40
|
loop: !1,
|
|
41
41
|
renderer: "canvas"
|
|
42
|
-
}), n.current =
|
|
43
|
-
container:
|
|
44
|
-
animationData:
|
|
42
|
+
}), n.current = k.loadAnimation({
|
|
43
|
+
container: _.current,
|
|
44
|
+
animationData: M,
|
|
45
45
|
autoplay: !1,
|
|
46
46
|
loop: !1,
|
|
47
47
|
renderer: "canvas"
|
|
48
|
-
}), c(
|
|
49
|
-
|
|
50
|
-
}), (
|
|
51
|
-
var
|
|
52
|
-
(
|
|
48
|
+
}), c(D.CLOCK_IN), (C = a.current) == null || C.playSegments(N.IN_FRAMES, !0), (y = a.current) == null || y.addEventListener("complete", () => {
|
|
49
|
+
l.current ? O() : S();
|
|
50
|
+
}), (P = n.current) == null || P.addEventListener("complete", () => {
|
|
51
|
+
var I;
|
|
52
|
+
(I = n.current) == null || I.removeEventListener("complete"), A();
|
|
53
53
|
});
|
|
54
54
|
})(), () => {
|
|
55
|
-
var
|
|
56
|
-
(
|
|
55
|
+
var e, t;
|
|
56
|
+
(e = a.current) == null || e.destroy(), (t = n.current) == null || t.destroy();
|
|
57
57
|
};
|
|
58
|
-
}, [
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
|
|
58
|
+
}, [m, S, O, A, c]), m ? /* @__PURE__ */ K(U, { children: [
|
|
59
|
+
/* @__PURE__ */ T($, { ref: d }),
|
|
60
|
+
/* @__PURE__ */ T(w, { ref: _ }),
|
|
61
|
+
L && /* @__PURE__ */ T(
|
|
62
62
|
X,
|
|
63
63
|
{
|
|
64
64
|
$delay: W + b,
|
|
65
|
-
$animationType:
|
|
66
|
-
$duration:
|
|
67
|
-
children:
|
|
65
|
+
$animationType: E ? "fadeout" : "fadein",
|
|
66
|
+
$duration: E ? q : z,
|
|
67
|
+
children: L
|
|
68
68
|
}
|
|
69
69
|
)
|
|
70
70
|
] }) : null;
|
|
71
71
|
});
|
|
72
72
|
export {
|
|
73
|
-
|
|
73
|
+
ie as Clock
|
|
74
74
|
};
|
|
75
75
|
//# sourceMappingURL=clock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clock.js","sources":["../../../../src/features/post-game-stats/clock/clock.tsx"],"sourcesContent":["import type { IClockProps } from './clock-types';\nimport type { AnimationItem } from 'lottie-web';\nimport type { FC } from 'react';\n\nimport Lottie from 'lottie-web';\nimport { memo, useCallback, useEffect, useRef, useState } from 'react';\n\nimport { LOTTIE } from '../../../assets/lottie/lottie';\nimport { useCircleSounds } from '../../circle-games/hooks/use-circle-sounds/use-circle-sounds';\nimport { CircleSoundKey } from '../../circle-games/hooks/use-circle-sounds/use-circle-sounds-enums';\nimport { delay } from '../../utils/utils';\nimport * as Styled from './clock-styled';\nimport { getClockTimeSpentFramesToPlay } from './clock-util';\nimport {\n CLOCK,\n CLOCK_TIME_SPENT_FPS,\n TIME_SHOWN_HOLD_TIME,\n TEXT_APPEAR_DURATION,\n TEXT_DISAPPEAR_DELAY,\n TEXT_DISAPPEAR_DURATION,\n CLOCK_INFRAME_LOTTIE_TO_PLAY,\n TIME_LOTTIE_TO_PLAY_IN,\n} from './constants';\n\nexport const Clock: FC<IClockProps> = memo(({ show, onComplete, timeInMs, helperText }) => {\n const { play } = useCircleSounds();\n const [fadeOut, setFadeOut] = useState(false);\n const isClockTimeSpentShown = useRef(false);\n const framesToPlay = useRef(0);\n\n const clockLottieContainerRef = useRef<HTMLDivElement>(null);\n const clockTimeSpentLottieContainerRef = useRef<HTMLDivElement>(null);\n const clockLottieAnimationRef = useRef<AnimationItem>();\n const clockTimeSpentLottieAnimationRef = useRef<AnimationItem>();\n\n const setClockTimeSpentFrames = useCallback(() => {\n const frames = getClockTimeSpentFramesToPlay(timeInMs);\n\n if (frames) {\n framesToPlay.current = frames;\n // Speed adjustment\n clockTimeSpentLottieAnimationRef.current?.setSpeed(frames / CLOCK_TIME_SPENT_FPS);\n clockTimeSpentLottieAnimationRef.current?.playSegments([0, frames], true);\n isClockTimeSpentShown.current = true;\n }\n }, [timeInMs]);\n\n const onClockTimeSpentExitAnimationFinished = useCallback(async () => {\n await delay(TIME_SHOWN_HOLD_TIME);\n\n // Reverse play time spent animation\n clockTimeSpentLottieAnimationRef.current?.playSegments([framesToPlay.current, 0], true);\n\n await delay(TEXT_DISAPPEAR_DELAY);\n setFadeOut(true);\n\n if (isClockTimeSpentShown.current) {\n clockTimeSpentLottieAnimationRef.current?.addEventListener('complete', () => {\n play(CircleSoundKey.CLOCK_OUT);\n clockLottieAnimationRef.current?.playSegments(CLOCK.OUT_FRAMES, true);\n });\n }\n }, [framesToPlay, play]);\n\n const onAnimationEnd = useCallback(() => {\n onComplete?.();\n }, [onComplete]);\n\n // Play entry animation\n useEffect(() => {\n if (show) {\n const loadAnimations = async () => {\n const [timeLottiePath, timeSpentLottiePath] = await Promise.all([\n fetch(LOTTIE.TOTAL_TIME),\n fetch(LOTTIE.TOTAL_TIME_SPENT),\n ]);\n const [timeLottieData, timeSpentLottieData] = await Promise.all([\n timeLottiePath.json(),\n timeSpentLottiePath.json(),\n ]);\n\n // Clock Lottie\n clockLottieAnimationRef.current = Lottie.loadAnimation({\n container: clockLottieContainerRef.current as Element,\n animationData: timeLottieData,\n autoplay: false,\n loop: false,\n renderer: 'canvas',\n });\n\n // Clock Time Spent Lottie\n clockTimeSpentLottieAnimationRef.current = Lottie.loadAnimation({\n container: clockTimeSpentLottieContainerRef.current as Element,\n animationData: timeSpentLottieData,\n autoplay: false,\n loop: false,\n renderer: 'canvas',\n });\n\n // Play clock in animation sounds and lottie\n play(CircleSoundKey.CLOCK_IN);\n clockLottieAnimationRef.current?.playSegments(CLOCK.IN_FRAMES, true);\n\n clockLottieAnimationRef.current?.addEventListener('complete', () => {\n if (!isClockTimeSpentShown.current) {\n setClockTimeSpentFrames();\n } else {\n onAnimationEnd();\n }\n });\n\n // Setup event listener for time spent animation\n clockTimeSpentLottieAnimationRef.current?.addEventListener('complete', () => {\n clockTimeSpentLottieAnimationRef.current?.removeEventListener('complete');\n onClockTimeSpentExitAnimationFinished();\n });\n };\n\n loadAnimations();\n\n return () => {\n clockLottieAnimationRef.current?.destroy();\n clockTimeSpentLottieAnimationRef.current?.destroy();\n };\n }\n }, [show, setClockTimeSpentFrames, onAnimationEnd, onClockTimeSpentExitAnimationFinished, play]);\n\n if (show) {\n return (\n <Styled.Clock>\n <Styled.ClockLottie ref={clockLottieContainerRef} />\n <Styled.ClockTimeSpentLottie ref={clockTimeSpentLottieContainerRef} />\n {helperText && (\n <Styled.TextWrapper\n $delay={CLOCK_INFRAME_LOTTIE_TO_PLAY + TIME_LOTTIE_TO_PLAY_IN}\n $animationType={fadeOut ? 'fadeout' : 'fadein'}\n $duration={fadeOut ? TEXT_DISAPPEAR_DURATION : TEXT_APPEAR_DURATION}\n >\n {helperText}\n </Styled.TextWrapper>\n )}\n </Styled.Clock>\n );\n }\n\n return null;\n});\n"],"names":["Clock","memo","show","onComplete","timeInMs","helperText","play","useCircleSounds","fadeOut","setFadeOut","useState","isClockTimeSpentShown","useRef","framesToPlay","clockLottieContainerRef","clockTimeSpentLottieContainerRef","clockLottieAnimationRef","clockTimeSpentLottieAnimationRef","setClockTimeSpentFrames","useCallback","frames","getClockTimeSpentFramesToPlay","_a","CLOCK_TIME_SPENT_FPS","_b","onClockTimeSpentExitAnimationFinished","delay","TIME_SHOWN_HOLD_TIME","TEXT_DISAPPEAR_DELAY","CircleSoundKey","CLOCK","onAnimationEnd","useEffect","timeLottiePath","timeSpentLottiePath","LOTTIE","timeLottieData","timeSpentLottieData","Lottie","_c","jsxs","Styled.Clock","jsx","Styled.ClockLottie","Styled.ClockTimeSpentLottie","Styled.TextWrapper","CLOCK_INFRAME_LOTTIE_TO_PLAY","TIME_LOTTIE_TO_PLAY_IN","TEXT_DISAPPEAR_DURATION","TEXT_APPEAR_DURATION"],"mappings":";;;;;;;;;;AAwBa,MAAAA,KAAyBC,EAAK,CAAC,EAAE,MAAAC,GAAM,YAAAC,GAAY,UAAAC,GAAU,YAAAC,QAAiB;AACnF,QAAA,EAAE,MAAAC,MAASC,KACX,CAACC,GAASC,CAAU,IAAIC,EAAS,EAAK,GACtCC,IAAwBC,EAAO,EAAK,GACpCC,IAAeD,EAAO,CAAC,GAEvBE,IAA0BF,EAAuB,IAAI,GACrDG,IAAmCH,EAAuB,IAAI,GAC9DI,IAA0BJ,KAC1BK,IAAmCL,KAEnCM,IAA0BC,EAAY,MAAM;;AAC1C,UAAAC,IAASC,EAA8BjB,CAAQ;AAErD,IAAIgB,MACFP,EAAa,UAAUO,IAEUE,IAAAL,EAAA,YAAA,QAAAK,EAAS,SAASF,IAASG,KAC5DC,IAAAP,EAAiC,YAAjC,QAAAO,EAA0C,aAAa,CAAC,GAAGJ,CAAM,GAAG,KACpET,EAAsB,UAAU;AAAA,EAClC,GACC,CAACP,CAAQ,CAAC,GAEPqB,IAAwCN,EAAY,YAAY;;AACpE,UAAMO,EAAMC,CAAoB,IAGhCL,IAAAL,EAAiC,YAAjC,QAAAK,EAA0C,aAAa,CAACT,EAAa,SAAS,CAAC,GAAG,KAElF,MAAMa,EAAME,CAAoB,GAChCnB,EAAW,EAAI,GAEXE,EAAsB,aACSa,IAAAP,EAAA,YAAA,QAAAO,EAAS,iBAAiB,YAAY,MAAM;;
|
|
1
|
+
{"version":3,"file":"clock.js","sources":["../../../../src/features/post-game-stats/clock/clock.tsx"],"sourcesContent":["import type { IClockProps } from './clock-types';\nimport type { AnimationItem } from 'lottie-web';\nimport type { FC } from 'react';\n\nimport Lottie from 'lottie-web';\nimport { memo, useCallback, useEffect, useRef, useState } from 'react';\n\nimport { LOTTIE } from '../../../assets/lottie/lottie';\nimport { useCircleSounds } from '../../circle-games/hooks/use-circle-sounds/use-circle-sounds';\nimport { CircleSoundKey } from '../../circle-games/hooks/use-circle-sounds/use-circle-sounds-enums';\nimport { delay } from '../../utils/utils';\nimport * as Styled from './clock-styled';\nimport { getClockTimeSpentFramesToPlay } from './clock-util';\nimport {\n CLOCK,\n CLOCK_TIME_SPENT_FPS,\n TIME_SHOWN_HOLD_TIME,\n TEXT_APPEAR_DURATION,\n TEXT_DISAPPEAR_DELAY,\n TEXT_DISAPPEAR_DURATION,\n CLOCK_INFRAME_LOTTIE_TO_PLAY,\n TIME_LOTTIE_TO_PLAY_IN,\n} from './constants';\n\nexport const Clock: FC<IClockProps> = memo(({ show, onComplete, timeInMs, helperText }) => {\n const { play } = useCircleSounds();\n const [fadeOut, setFadeOut] = useState(false);\n const isClockTimeSpentShown = useRef(false);\n const framesToPlay = useRef(0);\n\n const clockLottieContainerRef = useRef<HTMLDivElement>(null);\n const clockTimeSpentLottieContainerRef = useRef<HTMLDivElement>(null);\n const clockLottieAnimationRef = useRef<AnimationItem>();\n const clockTimeSpentLottieAnimationRef = useRef<AnimationItem>();\n\n const setClockTimeSpentFrames = useCallback(() => {\n const frames = getClockTimeSpentFramesToPlay(timeInMs);\n\n if (frames) {\n framesToPlay.current = frames;\n // Speed adjustment\n clockTimeSpentLottieAnimationRef.current?.setSpeed(frames / CLOCK_TIME_SPENT_FPS);\n clockTimeSpentLottieAnimationRef.current?.playSegments([0, frames], true);\n isClockTimeSpentShown.current = true;\n }\n }, [timeInMs]);\n\n const onClockTimeSpentExitAnimationFinished = useCallback(async () => {\n await delay(TIME_SHOWN_HOLD_TIME);\n\n // Reverse play time spent animation\n clockTimeSpentLottieAnimationRef.current?.playSegments([framesToPlay.current, 0], true);\n\n await delay(TEXT_DISAPPEAR_DELAY);\n setFadeOut(true);\n\n if (isClockTimeSpentShown.current) {\n clockTimeSpentLottieAnimationRef.current?.addEventListener('complete', () => {\n clockTimeSpentLottieAnimationRef.current?.removeEventListener('complete');\n play(CircleSoundKey.CLOCK_OUT);\n clockLottieAnimationRef.current?.playSegments(CLOCK.OUT_FRAMES, true);\n });\n }\n }, [framesToPlay, play]);\n\n const onAnimationEnd = useCallback(() => {\n onComplete?.();\n }, [onComplete]);\n\n // Play entry animation\n useEffect(() => {\n if (show) {\n const loadAnimations = async () => {\n const [timeLottiePath, timeSpentLottiePath] = await Promise.all([\n fetch(LOTTIE.TOTAL_TIME),\n fetch(LOTTIE.TOTAL_TIME_SPENT),\n ]);\n const [timeLottieData, timeSpentLottieData] = await Promise.all([\n timeLottiePath.json(),\n timeSpentLottiePath.json(),\n ]);\n\n // Clock Lottie\n clockLottieAnimationRef.current = Lottie.loadAnimation({\n container: clockLottieContainerRef.current as Element,\n animationData: timeLottieData,\n autoplay: false,\n loop: false,\n renderer: 'canvas',\n });\n\n // Clock Time Spent Lottie\n clockTimeSpentLottieAnimationRef.current = Lottie.loadAnimation({\n container: clockTimeSpentLottieContainerRef.current as Element,\n animationData: timeSpentLottieData,\n autoplay: false,\n loop: false,\n renderer: 'canvas',\n });\n\n // Play clock in animation sounds and lottie\n play(CircleSoundKey.CLOCK_IN);\n clockLottieAnimationRef.current?.playSegments(CLOCK.IN_FRAMES, true);\n\n clockLottieAnimationRef.current?.addEventListener('complete', () => {\n if (!isClockTimeSpentShown.current) {\n setClockTimeSpentFrames();\n } else {\n onAnimationEnd();\n }\n });\n\n // Setup event listener for time spent animation\n clockTimeSpentLottieAnimationRef.current?.addEventListener('complete', () => {\n clockTimeSpentLottieAnimationRef.current?.removeEventListener('complete');\n onClockTimeSpentExitAnimationFinished();\n });\n };\n\n loadAnimations();\n\n return () => {\n clockLottieAnimationRef.current?.destroy();\n clockTimeSpentLottieAnimationRef.current?.destroy();\n };\n }\n }, [show, setClockTimeSpentFrames, onAnimationEnd, onClockTimeSpentExitAnimationFinished, play]);\n\n if (show) {\n return (\n <Styled.Clock>\n <Styled.ClockLottie ref={clockLottieContainerRef} />\n <Styled.ClockTimeSpentLottie ref={clockTimeSpentLottieContainerRef} />\n {helperText && (\n <Styled.TextWrapper\n $delay={CLOCK_INFRAME_LOTTIE_TO_PLAY + TIME_LOTTIE_TO_PLAY_IN}\n $animationType={fadeOut ? 'fadeout' : 'fadein'}\n $duration={fadeOut ? TEXT_DISAPPEAR_DURATION : TEXT_APPEAR_DURATION}\n >\n {helperText}\n </Styled.TextWrapper>\n )}\n </Styled.Clock>\n );\n }\n\n return null;\n});\n"],"names":["Clock","memo","show","onComplete","timeInMs","helperText","play","useCircleSounds","fadeOut","setFadeOut","useState","isClockTimeSpentShown","useRef","framesToPlay","clockLottieContainerRef","clockTimeSpentLottieContainerRef","clockLottieAnimationRef","clockTimeSpentLottieAnimationRef","setClockTimeSpentFrames","useCallback","frames","getClockTimeSpentFramesToPlay","_a","CLOCK_TIME_SPENT_FPS","_b","onClockTimeSpentExitAnimationFinished","delay","TIME_SHOWN_HOLD_TIME","TEXT_DISAPPEAR_DELAY","CircleSoundKey","CLOCK","onAnimationEnd","useEffect","timeLottiePath","timeSpentLottiePath","LOTTIE","timeLottieData","timeSpentLottieData","Lottie","_c","jsxs","Styled.Clock","jsx","Styled.ClockLottie","Styled.ClockTimeSpentLottie","Styled.TextWrapper","CLOCK_INFRAME_LOTTIE_TO_PLAY","TIME_LOTTIE_TO_PLAY_IN","TEXT_DISAPPEAR_DURATION","TEXT_APPEAR_DURATION"],"mappings":";;;;;;;;;;AAwBa,MAAAA,KAAyBC,EAAK,CAAC,EAAE,MAAAC,GAAM,YAAAC,GAAY,UAAAC,GAAU,YAAAC,QAAiB;AACnF,QAAA,EAAE,MAAAC,MAASC,KACX,CAACC,GAASC,CAAU,IAAIC,EAAS,EAAK,GACtCC,IAAwBC,EAAO,EAAK,GACpCC,IAAeD,EAAO,CAAC,GAEvBE,IAA0BF,EAAuB,IAAI,GACrDG,IAAmCH,EAAuB,IAAI,GAC9DI,IAA0BJ,KAC1BK,IAAmCL,KAEnCM,IAA0BC,EAAY,MAAM;;AAC1C,UAAAC,IAASC,EAA8BjB,CAAQ;AAErD,IAAIgB,MACFP,EAAa,UAAUO,IAEUE,IAAAL,EAAA,YAAA,QAAAK,EAAS,SAASF,IAASG,KAC5DC,IAAAP,EAAiC,YAAjC,QAAAO,EAA0C,aAAa,CAAC,GAAGJ,CAAM,GAAG,KACpET,EAAsB,UAAU;AAAA,EAClC,GACC,CAACP,CAAQ,CAAC,GAEPqB,IAAwCN,EAAY,YAAY;;AACpE,UAAMO,EAAMC,CAAoB,IAGhCL,IAAAL,EAAiC,YAAjC,QAAAK,EAA0C,aAAa,CAACT,EAAa,SAAS,CAAC,GAAG,KAElF,MAAMa,EAAME,CAAoB,GAChCnB,EAAW,EAAI,GAEXE,EAAsB,aACSa,IAAAP,EAAA,YAAA,QAA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YAAY,MAAM;;AAC1C,WAAAjB,IAAAL,EAAA,YAAA,QAAAK,EAAS,oBAAoB,aACxBG;QAAA;AAAA,MACvC,MAKI,MAAM;;AACX,SAAAH,IAAAN,EAAwB,YAAxB,QAAAM,EAAiC,YACjCE,IAAAP,EAAiC,YAAjC,QAAAO,EAA0C;AAAA,MAAQ;AAAA,EAEtD,GACC,CAACtB,GAAMgB,GAAyBa,GAAgBN,GAAuCnB,CAAI,CAAC,GAE3FJ,IAEA,gBAAAsC,EAACC,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAA,EAAmB,KAAK7B,EAAyB,CAAA;AAAA,IACjD,gBAAA4B,EAAAE,GAAA,EAA4B,KAAK7B,EAAkC,CAAA;AAAA,IACnEV,KACC,gBAAAqC;AAAA,MAACG;AAAAA,MAAA;AAAA,QACC,QAAQC,IAA+BC;AAAA,QACvC,gBAAgBvC,IAAU,YAAY;AAAA,QACtC,WAAWA,IAAUwC,IAA0BC;AAAA,QAE9C,UAAA5C;AAAA,MAAA;AAAA,IACH;AAAA,EAEJ,EAAA,CAAA,IAIG;AACT,CAAC;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2207,7 +2207,7 @@ declare interface INodeCardCallbacks {
|
|
|
2207
2207
|
onNodeView?: (nodeData: INodeDataProps, milestoneId?: string) => void;
|
|
2208
2208
|
onNodeReview?: (nodeData: INodeDataProps, milestoneId?: string, homeworkId?: string) => void;
|
|
2209
2209
|
onNodeReattempt?: (nodeData: INodeDataProps, milestoneId?: string) => void;
|
|
2210
|
-
|
|
2210
|
+
onNodeAssignAsHomework?: (nodeData: INodeDataProps, milestoneId?: string) => void;
|
|
2211
2211
|
onNodeMarkAsDone?: (nodeData: INodeDataProps) => void;
|
|
2212
2212
|
onNodeReset?: (nodeData: INodeDataProps, milestoneId?: string) => void;
|
|
2213
2213
|
onNodeUnassign?: (nodeData: INodeDataProps, milestoneId?: string) => void;
|
|
@@ -2230,6 +2230,7 @@ export declare interface INodeDataProps {
|
|
|
2230
2230
|
learnosity_activity_ref: string;
|
|
2231
2231
|
marked_as_completed: boolean;
|
|
2232
2232
|
node_id: string;
|
|
2233
|
+
id: string;
|
|
2233
2234
|
node_type: TNodeTypes_2;
|
|
2234
2235
|
sheet_statement: string;
|
|
2235
2236
|
permissions: INodePermissions;
|
|
@@ -3054,6 +3055,7 @@ declare interface ITestsListProps {
|
|
|
3054
3055
|
isChaptersAvailable?: boolean;
|
|
3055
3056
|
canUpdatePlan?: boolean;
|
|
3056
3057
|
onNodeReattempt?: (sheetData: INodeDataProps, milestoneId?: string) => void;
|
|
3058
|
+
onNodeAssignAsHomework?: (sheetData: INodeDataProps, milestoneId?: string) => void;
|
|
3057
3059
|
onTestPreview?: (sheetData: INodeDataProps, milestoneId: string) => void;
|
|
3058
3060
|
onTestStart?: (sheetData: INodeDataProps) => void;
|
|
3059
3061
|
onTestReview?: (sheetData: INodeDataProps, milestoneId: string) => void;
|