@cuemath/leap 2.8.25-rj-9 → 2.8.25-rj-11
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/circle-games/leaderboard/comps/info-bar/info-bar-styled.js +12 -0
- package/dist/features/circle-games/leaderboard/comps/info-bar/info-bar-styled.js.map +1 -0
- package/dist/features/circle-games/leaderboard/comps/info-bar/info-bar.js +11 -0
- package/dist/features/circle-games/leaderboard/comps/info-bar/info-bar.js.map +1 -0
- package/dist/features/circle-games/leaderboard/comps/leaderboard-item/leaderboard-item.js +6 -6
- package/dist/features/circle-games/leaderboard/comps/leaderboard-item/leaderboard-item.js.map +1 -1
- package/dist/features/circle-games/leaderboard/comps/streak-reduction-infobar/constants.js +5 -0
- package/dist/features/circle-games/leaderboard/comps/streak-reduction-infobar/constants.js.map +1 -0
- package/dist/features/circle-games/leaderboard/comps/streak-reduction-infobar/streak-reduction-infobar.js +41 -0
- package/dist/features/circle-games/leaderboard/comps/streak-reduction-infobar/streak-reduction-infobar.js.map +1 -0
- package/dist/features/circle-games/leaderboard/hooks/{useIntersectionObserver.js → use-intersection-observer/use-intersection-observer.tsx.js} +1 -1
- package/dist/features/circle-games/leaderboard/hooks/use-intersection-observer/use-intersection-observer.tsx.js.map +1 -0
- package/dist/features/circle-games/leaderboard/hooks/{useTimer.js → use-timer/use-timer.js} +1 -1
- package/dist/features/circle-games/leaderboard/hooks/use-timer/use-timer.js.map +1 -0
- package/dist/features/circle-games/leaderboard/leaderboard.js +77 -75
- package/dist/features/circle-games/leaderboard/leaderboard.js.map +1 -1
- package/dist/features/circle-games/utils/streak-reduction-localstorage-util.js +25 -0
- package/dist/features/circle-games/utils/streak-reduction-localstorage-util.js.map +1 -0
- package/dist/index.d.ts +23 -3
- package/dist/index.js +211 -207
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/features/circle-games/leaderboard/hooks/useIntersectionObserver.js.map +0 -1
- package/dist/features/circle-games/leaderboard/hooks/useTimer.js.map +0 -1
@@ -0,0 +1,12 @@
|
|
1
|
+
import r from "styled-components";
|
2
|
+
import o from "../../../../ui/layout/flex-view.js";
|
3
|
+
const d = r(o)`
|
4
|
+
padding: 16px;
|
5
|
+
margin: 16px;
|
6
|
+
border-width: 1px;
|
7
|
+
border-style: solid;
|
8
|
+
`;
|
9
|
+
export {
|
10
|
+
d as InfoBarWrapper
|
11
|
+
};
|
12
|
+
//# sourceMappingURL=info-bar-styled.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"info-bar-styled.js","sources":["../../../../../../src/features/circle-games/leaderboard/comps/info-bar/info-bar-styled.tsx"],"sourcesContent":["import styled from 'styled-components';\n\nimport FlexView from '../../../../ui/layout/flex-view';\n\nexport const InfoBarWrapper = styled(FlexView)`\n padding: 16px;\n margin: 16px;\n border-width: 1px;\n border-style: solid;\n`;\n"],"names":["InfoBarWrapper","styled","FlexView"],"mappings":";;AAIa,MAAAA,IAAiBC,EAAOC,CAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
2
|
+
import { useMemo as m } from "react";
|
3
|
+
import { InfoBarWrapper as c } from "./info-bar-styled.js";
|
4
|
+
const p = (o) => ({ backgroundColor: `${o}_6`, borderColor: `${o}_4` }), l = ({ children: o, hue: r }) => {
|
5
|
+
const { backgroundColor: n, borderColor: t } = m(() => p(r), [r]);
|
6
|
+
return /* @__PURE__ */ e(c, { $background: n, $borderColor: t, children: o });
|
7
|
+
};
|
8
|
+
export {
|
9
|
+
l as InfoBar
|
10
|
+
};
|
11
|
+
//# sourceMappingURL=info-bar.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"info-bar.js","sources":["../../../../../../src/features/circle-games/leaderboard/comps/info-bar/info-bar.tsx"],"sourcesContent":["import type { TColorNames, THueNames } from '../../../../ui/types';\nimport type { IInfoBarProps } from './info-bar-types';\n\nimport { useMemo } from 'react';\n\nimport * as Styled from './info-bar-styled';\n\nconst computeColorsFromHue = (\n hue: THueNames,\n): { backgroundColor: TColorNames; borderColor: TColorNames } => {\n return { backgroundColor: `${hue}_6`, borderColor: `${hue}_4` };\n};\n\nexport const InfoBar: React.FC<IInfoBarProps> = ({ children, hue }) => {\n const { backgroundColor, borderColor } = useMemo(() => computeColorsFromHue(hue), [hue]);\n\n return (\n <Styled.InfoBarWrapper $background={backgroundColor} $borderColor={borderColor}>\n {children}\n </Styled.InfoBarWrapper>\n );\n};\n"],"names":["computeColorsFromHue","hue","InfoBar","children","backgroundColor","borderColor","useMemo","jsx","Styled.InfoBarWrapper"],"mappings":";;;AAOA,MAAMA,IAAuB,CAC3BC,OAEO,EAAE,iBAAiB,GAAGA,CAAG,MAAM,aAAa,GAAGA,CAAG,SAG9CC,IAAmC,CAAC,EAAE,UAAAC,GAAU,KAAAF,QAAU;AAC/D,QAAA,EAAE,iBAAAG,GAAiB,aAAAC,EAAA,IAAgBC,EAAQ,MAAMN,EAAqBC,CAAG,GAAG,CAACA,CAAG,CAAC;AAGrF,SAAA,gBAAAM,EAACC,GAAA,EAAsB,aAAaJ,GAAiB,cAAcC,GAChE,UAAAF,EACH,CAAA;AAEJ;"}
|
@@ -1,16 +1,16 @@
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
2
2
|
import { memo as f } from "react";
|
3
3
|
import { ELeaderboardType as t } from "../../enums/leaderboard-type-enum.js";
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
4
|
+
import { useIntersectionObserver as u } from "../../hooks/use-intersection-observer/use-intersection-observer.tsx.js";
|
5
|
+
import { PlayerProgressListItem as E } from "../progress-list-item/progress-list-item.js";
|
6
|
+
import { AnimatedItem as I } from "./leaderboard-item-styled.js";
|
7
7
|
const h = f(
|
8
8
|
({ player: e, rank: o, maxStreakDays: m, maxPoints: i, leaderboardType: r, isActive: a }) => {
|
9
|
-
const { isVisible: n, elementRef: A } =
|
9
|
+
const { isVisible: n, elementRef: A } = u({
|
10
10
|
threshold: 0.5
|
11
11
|
}), L = r === t.ALL_TIME_STREAK ? m : i, d = r === t.ALL_TIME_STREAK ? e.streakDays : e.points;
|
12
|
-
return /* @__PURE__ */ s(
|
13
|
-
|
12
|
+
return /* @__PURE__ */ s(I, { isVisible: n, ref: A, children: /* @__PURE__ */ s(
|
13
|
+
E,
|
14
14
|
{
|
15
15
|
index: o,
|
16
16
|
maxValue: L,
|
package/dist/features/circle-games/leaderboard/comps/leaderboard-item/leaderboard-item.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"leaderboard-item.js","sources":["../../../../../../src/features/circle-games/leaderboard/comps/leaderboard-item/leaderboard-item.tsx"],"sourcesContent":["import type {\n ILeaderboardPlayerWithPoints,\n ILeaderboardPlayerWithStreak,\n} from '../../dal/use-get-leaderboard-dal/use-get-leaderboard-dal-types';\nimport type { ILeaderboardItemProps } from './leaderboard-item-types';\n\nimport React, { memo } from 'react';\n\nimport { ELeaderboardType } from '../../enums/leaderboard-type-enum';\nimport { useIntersectionObserver } from '../../hooks';\nimport { PlayerProgressListItem } from '../progress-list-item/progress-list-item';\nimport * as Styled from './leaderboard-item-styled';\n\nexport const LeaderboardItemWithObserver: React.FC<ILeaderboardItemProps> = memo(\n ({ player, rank, maxStreakDays, maxPoints, leaderboardType, isActive }) => {\n const { isVisible, elementRef } = useIntersectionObserver<HTMLDivElement>({\n threshold: 0.5,\n });\n\n const maxValue =\n leaderboardType === ELeaderboardType.ALL_TIME_STREAK ? maxStreakDays : maxPoints;\n\n const value =\n leaderboardType === ELeaderboardType.ALL_TIME_STREAK\n ? (player as ILeaderboardPlayerWithStreak).streakDays\n : (player as ILeaderboardPlayerWithPoints).points;\n\n return (\n <Styled.AnimatedItem key={player.rank} isVisible={isVisible} ref={elementRef}>\n <PlayerProgressListItem\n index={rank}\n maxValue={maxValue}\n value={value}\n isActive={isActive}\n avatar={player.userAvatar}\n grade={player.grade}\n displayText={player.username}\n displayValueAs={\n leaderboardType === ELeaderboardType.ALL_TIME_STREAK ? 'streak' : 'points'\n }\n />\n </Styled.AnimatedItem>\n );\n },\n);\n"],"names":["LeaderboardItemWithObserver","memo","player","rank","maxStreakDays","maxPoints","leaderboardType","isActive","isVisible","elementRef","useIntersectionObserver","maxValue","ELeaderboardType","value","Styled.AnimatedItem","jsx","PlayerProgressListItem"],"mappings":";;;;;;AAaO,MAAMA,IAA+DC;AAAA,EAC1E,CAAC,EAAE,QAAAC,GAAQ,MAAAC,GAAM,eAAAC,GAAe,WAAAC,GAAW,iBAAAC,GAAiB,UAAAC,QAAe;AACzE,UAAM,EAAE,WAAAC,GAAW,YAAAC,EAAW,IAAIC,EAAwC;AAAA,MACxE,WAAW;AAAA,IAAA,CACZ,GAEKC,IACJL,MAAoBM,EAAiB,kBAAkBR,IAAgBC,GAEnEQ,IACJP,MAAoBM,EAAiB,kBAChCV,EAAwC,aACxCA,EAAwC;AAE/C,6BACGY,GAAA,EAAsC,WAAAN,GAAsB,KAAKC,GAChE,UAAA,gBAAAM;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,OAAOb;AAAA,QACP,UAAAQ;AAAA,QACA,OAAAE;AAAA,QACA,UAAAN;AAAA,QACA,QAAQL,EAAO;AAAA,QACf,OAAOA,EAAO;AAAA,QACd,aAAaA,EAAO;AAAA,QACpB,gBACEI,MAAoBM,EAAiB,kBAAkB,WAAW;AAAA,MAAA;AAAA,IAAA,KAV9CV,EAAO,IAajC;AAAA,EAEJ;AACF;"}
|
1
|
+
{"version":3,"file":"leaderboard-item.js","sources":["../../../../../../src/features/circle-games/leaderboard/comps/leaderboard-item/leaderboard-item.tsx"],"sourcesContent":["import type {\n ILeaderboardPlayerWithPoints,\n ILeaderboardPlayerWithStreak,\n} from '../../dal/use-get-leaderboard-dal/use-get-leaderboard-dal-types';\nimport type { ILeaderboardItemProps } from './leaderboard-item-types';\n\nimport React, { memo } from 'react';\n\nimport { ELeaderboardType } from '../../enums/leaderboard-type-enum';\nimport { useIntersectionObserver } from '../../hooks/use-intersection-observer/use-intersection-observer.tsx';\nimport { PlayerProgressListItem } from '../progress-list-item/progress-list-item';\nimport * as Styled from './leaderboard-item-styled';\n\nexport const LeaderboardItemWithObserver: React.FC<ILeaderboardItemProps> = memo(\n ({ player, rank, maxStreakDays, maxPoints, leaderboardType, isActive }) => {\n const { isVisible, elementRef } = useIntersectionObserver<HTMLDivElement>({\n threshold: 0.5,\n });\n\n const maxValue =\n leaderboardType === ELeaderboardType.ALL_TIME_STREAK ? maxStreakDays : maxPoints;\n\n const value =\n leaderboardType === ELeaderboardType.ALL_TIME_STREAK\n ? (player as ILeaderboardPlayerWithStreak).streakDays\n : (player as ILeaderboardPlayerWithPoints).points;\n\n return (\n <Styled.AnimatedItem key={player.rank} isVisible={isVisible} ref={elementRef}>\n <PlayerProgressListItem\n index={rank}\n maxValue={maxValue}\n value={value}\n isActive={isActive}\n avatar={player.userAvatar}\n grade={player.grade}\n displayText={player.username}\n displayValueAs={\n leaderboardType === ELeaderboardType.ALL_TIME_STREAK ? 'streak' : 'points'\n }\n />\n </Styled.AnimatedItem>\n );\n },\n);\n"],"names":["LeaderboardItemWithObserver","memo","player","rank","maxStreakDays","maxPoints","leaderboardType","isActive","isVisible","elementRef","useIntersectionObserver","maxValue","ELeaderboardType","value","Styled.AnimatedItem","jsx","PlayerProgressListItem"],"mappings":";;;;;;AAaO,MAAMA,IAA+DC;AAAA,EAC1E,CAAC,EAAE,QAAAC,GAAQ,MAAAC,GAAM,eAAAC,GAAe,WAAAC,GAAW,iBAAAC,GAAiB,UAAAC,QAAe;AACzE,UAAM,EAAE,WAAAC,GAAW,YAAAC,EAAW,IAAIC,EAAwC;AAAA,MACxE,WAAW;AAAA,IAAA,CACZ,GAEKC,IACJL,MAAoBM,EAAiB,kBAAkBR,IAAgBC,GAEnEQ,IACJP,MAAoBM,EAAiB,kBAChCV,EAAwC,aACxCA,EAAwC;AAE/C,6BACGY,GAAA,EAAsC,WAAAN,GAAsB,KAAKC,GAChE,UAAA,gBAAAM;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,OAAOb;AAAA,QACP,UAAAQ;AAAA,QACA,OAAAE;AAAA,QACA,UAAAN;AAAA,QACA,QAAQL,EAAO;AAAA,QACf,OAAOA,EAAO;AAAA,QACd,aAAaA,EAAO;AAAA,QACpB,gBACEI,MAAoBM,EAAiB,kBAAkB,WAAW;AAAA,MAAA;AAAA,IAAA,KAV9CV,EAAO,IAajC;AAAA,EAEJ;AACF;"}
|
package/dist/features/circle-games/leaderboard/comps/streak-reduction-infobar/constants.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../../../src/features/circle-games/leaderboard/comps/streak-reduction-infobar/constants.ts"],"sourcesContent":["export const STREAK_REDUCTION_LEADERBOARD_INFOBAR_TIMESTAMP =\n 'STREAK_REDUCTION_LEADERBOARD_INFOBAR_TIMESTAMP';\n"],"names":["STREAK_REDUCTION_LEADERBOARD_INFOBAR_TIMESTAMP"],"mappings":"AAAO,MAAMA,IACX;"}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
2
|
+
import { useState as f, useMemo as u, useCallback as h } from "react";
|
3
|
+
import I from "../../../../../assets/line-icons/icons/cross.js";
|
4
|
+
import c from "../../../../ui/layout/flex-view.js";
|
5
|
+
import o from "../../../../ui/text/text.js";
|
6
|
+
import { StreakReductionLocalStorageUtil as s } from "../../../utils/streak-reduction-localstorage-util.js";
|
7
|
+
import { InfoBar as k } from "../info-bar/info-bar.js";
|
8
|
+
import { STREAK_REDUCTION_LEADERBOARD_INFOBAR_TIMESTAMP as a } from "./constants.js";
|
9
|
+
const T = ({
|
10
|
+
startTimestampToday: r,
|
11
|
+
streakReduction: t
|
12
|
+
}) => {
|
13
|
+
const [l, d] = f(
|
14
|
+
s.showStreakReduction(
|
15
|
+
a,
|
16
|
+
r
|
17
|
+
)
|
18
|
+
), n = u(() => t > 0, [t]), m = h(() => {
|
19
|
+
s.markStreakReductionDismissed(
|
20
|
+
a,
|
21
|
+
r
|
22
|
+
), d(!1);
|
23
|
+
}, [r]);
|
24
|
+
return l ? /* @__PURE__ */ e(
|
25
|
+
k,
|
26
|
+
{
|
27
|
+
children: /* @__PURE__ */ i(c, { $flexDirection: "row", $alignItems: "center", $justifyContent: "space-between", children: [
|
28
|
+
n ? /* @__PURE__ */ i(c, { children: [
|
29
|
+
/* @__PURE__ */ e(o, { $renderAs: "ab2", $color: "WHITE_T_87", children: "Keep building your streak by completing an activity each day." }),
|
30
|
+
/* @__PURE__ */ e(o, { $renderAs: "ab2", $color: "WHITE_T_87", children: "For each day missed, your streak reduces by 1." })
|
31
|
+
] }) : /* @__PURE__ */ e(o, { $renderAs: "ab2", $color: "WHITE_T_87", children: "Streak saved for the day! Come back tomorrow to keep increasing it." }),
|
32
|
+
/* @__PURE__ */ e(I, { cursor: "pointer", color: "WHITE", onClick: m })
|
33
|
+
] }),
|
34
|
+
hue: n ? "YELLOW" : "GREEN"
|
35
|
+
}
|
36
|
+
) : null;
|
37
|
+
};
|
38
|
+
export {
|
39
|
+
T as StreakReductionInfoBar
|
40
|
+
};
|
41
|
+
//# sourceMappingURL=streak-reduction-infobar.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"streak-reduction-infobar.js","sources":["../../../../../../src/features/circle-games/leaderboard/comps/streak-reduction-infobar/streak-reduction-infobar.tsx"],"sourcesContent":["import type { IUseStreakReductionLeaderboard } from './streak-reduction-infobar-types';\n\nimport { useCallback, useMemo, useState } from 'react';\n\nimport CrossIcon from '../../../../../assets/line-icons/icons/cross';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { StreakReductionLocalStorageUtil } from '../../../utils/streak-reduction-localstorage-util';\nimport { InfoBar } from '../info-bar/info-bar';\nimport { STREAK_REDUCTION_LEADERBOARD_INFOBAR_TIMESTAMP } from './constants';\n\nexport const StreakReductionInfoBar = ({\n startTimestampToday,\n streakReduction,\n}: IUseStreakReductionLeaderboard) => {\n const [showInfoBar, setShowInfoBar] = useState(\n StreakReductionLocalStorageUtil.showStreakReduction(\n STREAK_REDUCTION_LEADERBOARD_INFOBAR_TIMESTAMP,\n startTimestampToday,\n ),\n );\n\n const hasStreakReduced = useMemo(() => streakReduction > 0, [streakReduction]);\n\n const onInfoBarClose = useCallback(() => {\n StreakReductionLocalStorageUtil.markStreakReductionDismissed(\n STREAK_REDUCTION_LEADERBOARD_INFOBAR_TIMESTAMP,\n startTimestampToday,\n );\n setShowInfoBar(false);\n }, [startTimestampToday]);\n\n if (!showInfoBar) {\n return null;\n }\n\n return (\n <InfoBar\n children={\n <FlexView $flexDirection=\"row\" $alignItems=\"center\" $justifyContent=\"space-between\">\n {hasStreakReduced ? (\n <FlexView>\n <Text $renderAs=\"ab2\" $color=\"WHITE_T_87\">\n Keep building your streak by completing an activity each day.\n </Text>\n <Text $renderAs=\"ab2\" $color=\"WHITE_T_87\">\n For each day missed, your streak reduces by 1.\n </Text>\n </FlexView>\n ) : (\n <Text $renderAs=\"ab2\" $color=\"WHITE_T_87\">\n Streak saved for the day! Come back tomorrow to keep increasing it.\n </Text>\n )}\n <CrossIcon cursor={'pointer'} color=\"WHITE\" onClick={onInfoBarClose} />\n </FlexView>\n }\n hue={hasStreakReduced ? 'YELLOW' : 'GREEN'}\n />\n );\n};\n"],"names":["StreakReductionInfoBar","startTimestampToday","streakReduction","showInfoBar","setShowInfoBar","useState","StreakReductionLocalStorageUtil","STREAK_REDUCTION_LEADERBOARD_INFOBAR_TIMESTAMP","hasStreakReduced","useMemo","onInfoBarClose","useCallback","jsx","InfoBar","FlexView","Text","CrossIcon"],"mappings":";;;;;;;;AAWO,MAAMA,IAAyB,CAAC;AAAA,EACrC,qBAAAC;AAAA,EACA,iBAAAC;AACF,MAAsC;AAC9B,QAAA,CAACC,GAAaC,CAAc,IAAIC;AAAA,IACpCC,EAAgC;AAAA,MAC9BC;AAAA,MACAN;AAAA,IACF;AAAA,EAAA,GAGIO,IAAmBC,EAAQ,MAAMP,IAAkB,GAAG,CAACA,CAAe,CAAC,GAEvEQ,IAAiBC,EAAY,MAAM;AACP,IAAAL,EAAA;AAAA,MAC9BC;AAAA,MACAN;AAAA,IAAA,GAEFG,EAAe,EAAK;AAAA,EAAA,GACnB,CAACH,CAAmB,CAAC;AAExB,SAAKE,IAKH,gBAAAS;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,4BACGC,GAAS,EAAA,gBAAe,OAAM,aAAY,UAAS,iBAAgB,iBACjE,UAAA;AAAA,QAAAN,sBACEM,GACC,EAAA,UAAA;AAAA,UAAA,gBAAAF,EAACG,GAAK,EAAA,WAAU,OAAM,QAAO,cAAa,UAE1C,iEAAA;AAAA,4BACCA,GAAK,EAAA,WAAU,OAAM,QAAO,cAAa,UAE1C,kDAAA;AAAA,QAAA,EAAA,CACF,IAEC,gBAAAH,EAAAG,GAAA,EAAK,WAAU,OAAM,QAAO,cAAa,UAE1C,uEAAA;AAAA,0BAEDC,GAAU,EAAA,QAAQ,WAAW,OAAM,SAAQ,SAASN,GAAgB;AAAA,MAAA,GACvE;AAAA,MAEF,KAAKF,IAAmB,WAAW;AAAA,IAAA;AAAA,EAAA,IAxB9B;AA2BX;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"use-intersection-observer.tsx.js","sources":["../../../../../../src/features/circle-games/leaderboard/hooks/use-intersection-observer/use-intersection-observer.tsx.tsx"],"sourcesContent":["import { useState, useEffect, useRef } from 'react';\n\ninterface IntersectionObserverOptions {\n root?: Element | null;\n rootMargin?: string;\n threshold?: number | number[];\n}\n\nexport const useIntersectionObserver = <T extends HTMLElement>(\n options?: IntersectionObserverOptions,\n) => {\n const [isVisible, setIsVisible] = useState(false);\n const elementRef = useRef<T | null>(null);\n\n useEffect(() => {\n const element = elementRef.current;\n\n if (!element) return;\n\n const observer = new IntersectionObserver(\n ([entry]) => entry && setIsVisible(entry.isIntersecting),\n options,\n );\n\n observer.observe(element);\n\n return () => {\n if (element) observer.unobserve(element);\n };\n }, [options]);\n\n return { isVisible, elementRef };\n};\n"],"names":["useIntersectionObserver","options","isVisible","setIsVisible","useState","elementRef","useRef","useEffect","element","observer","entry"],"mappings":";AAQa,MAAAA,IAA0B,CACrCC,MACG;AACH,QAAM,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAK,GAC1CC,IAAaC,EAAiB,IAAI;AAExC,SAAAC,EAAU,MAAM;AACd,UAAMC,IAAUH,EAAW;AAE3B,QAAI,CAACG,EAAS;AAEd,UAAMC,IAAW,IAAI;AAAA,MACnB,CAAC,CAACC,CAAK,MAAMA,KAASP,EAAaO,EAAM,cAAc;AAAA,MACvDT;AAAA,IAAA;AAGF,WAAAQ,EAAS,QAAQD,CAAO,GAEjB,MAAM;AACP,MAAAA,KAAkBC,EAAA,UAAUD,CAAO;AAAA,IAAA;AAAA,EACzC,GACC,CAACP,CAAO,CAAC,GAEL,EAAE,WAAAC,GAAW,YAAAG;AACtB;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"use-timer.js","sources":["../../../../../../src/features/circle-games/leaderboard/hooks/use-timer/use-timer.tsx"],"sourcesContent":["import type { Dispatch, SetStateAction } from 'react';\n\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nexport function useTimer(value: number) {\n const [timer, setTimer] = useState<number>(value);\n const timerId = useRef<ReturnType<typeof setInterval>>();\n\n const initTimer = useCallback(() => {\n timerId.current = setInterval(() => {\n setTimer(prev => prev + 1000);\n }, 1000);\n }, []);\n\n const clearTimer = useCallback(() => {\n clearInterval(timerId.current);\n }, []);\n\n useEffect(() => {\n initTimer();\n\n return () => {\n clearTimer();\n };\n }, [clearTimer, initTimer]);\n\n return [\n timer as number,\n setTimer as Dispatch<SetStateAction<number>>,\n initTimer,\n clearTimer,\n ] as const;\n}\n"],"names":["useTimer","value","timer","setTimer","useState","timerId","useRef","initTimer","useCallback","prev","clearTimer","useEffect"],"mappings":";AAIO,SAASA,EAASC,GAAe;AACtC,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAiBH,CAAK,GAC1CI,IAAUC,KAEVC,IAAYC,EAAY,MAAM;AAC1B,IAAAH,EAAA,UAAU,YAAY,MAAM;AACzB,MAAAF,EAAA,CAAAM,MAAQA,IAAO,GAAI;AAAA,OAC3B,GAAI;AAAA,EACT,GAAG,CAAE,CAAA,GAECC,IAAaF,EAAY,MAAM;AACnC,kBAAcH,EAAQ,OAAO;AAAA,EAC/B,GAAG,CAAE,CAAA;AAEL,SAAAM,EAAU,OACEJ,KAEH,MAAM;AACA,IAAAG;EAAA,IAEZ,CAACA,GAAYH,CAAS,CAAC,GAEnB;AAAA,IACLL;AAAA,IACAC;AAAA,IACAI;AAAA,IACAG;AAAA,EAAA;AAEJ;"}
|
@@ -1,151 +1,153 @@
|
|
1
|
-
import { jsx as e, jsxs as
|
2
|
-
import { useState as T, useEffect as
|
1
|
+
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
2
|
+
import { useState as T, useEffect as P } from "react";
|
3
3
|
import { ILLUSTRATIONS as v } from "../../../assets/illustrations/illustrations.js";
|
4
4
|
import { CircularLoader as w } from "../../ui/loader/circular-loader/circular-loader.js";
|
5
5
|
import H from "../../ui/text/text.js";
|
6
6
|
import { useCircleSounds as U } from "../hooks/use-circle-sounds/use-circle-sounds.js";
|
7
|
-
import { Banner as
|
7
|
+
import { Banner as d } from "./comps/banner/banner.js";
|
8
8
|
import { LeaderboardItemWithObserver as q } from "./comps/leaderboard-item/leaderboard-item.js";
|
9
9
|
import { NavigationButton as z } from "./comps/navigation-button/navigation-button.js";
|
10
|
-
import {
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import { useTimer as
|
14
|
-
|
15
|
-
|
16
|
-
[
|
17
|
-
[
|
18
|
-
|
10
|
+
import { StreakReductionInfoBar as G } from "./comps/streak-reduction-infobar/streak-reduction-infobar.js";
|
11
|
+
import { Timer as J } from "./comps/timer/timer.js";
|
12
|
+
import { ELeaderboardType as r } from "./enums/leaderboard-type-enum.js";
|
13
|
+
import { useTimer as Q } from "./hooks/use-timer/use-timer.js";
|
14
|
+
import { Leaderboard as V, LeaderboardContainer as X, BannerWrapper as Z, TournamentBannerCustContainer as D, TrophyWrapper as ee, ItemsWrapper as re, Banner as te, ActionButtonWrapper as ne } from "./leaderboard-styled.js";
|
15
|
+
const u = {
|
16
|
+
[r.ALL_TIME_STREAK]: () => import("../../../assets/lotties/circle/elite-circle-lottie.json.js"),
|
17
|
+
[r.ALL_TIME]: () => import("../../../assets/lotties/circle/elite-circle-lottie.json.js"),
|
18
|
+
[r.BI_WEEKLY]: () => import("../../../assets/lotties/circle/tournament-ripple-lottie.json.js")
|
19
|
+
}, o = [
|
19
20
|
{
|
20
21
|
name: "TOURNAMENT",
|
21
|
-
type:
|
22
|
+
type: r.BI_WEEKLY
|
22
23
|
},
|
23
24
|
{
|
24
25
|
name: "STREAK STARS",
|
25
|
-
type:
|
26
|
+
type: r.ALL_TIME_STREAK
|
26
27
|
},
|
27
28
|
{
|
28
29
|
name: "ALL TIME",
|
29
|
-
type:
|
30
|
+
type: r.ALL_TIME
|
30
31
|
}
|
31
|
-
],
|
32
|
+
], he = ({
|
32
33
|
leaderboardData: m,
|
33
|
-
type:
|
34
|
-
userId:
|
34
|
+
type: E = r.BI_WEEKLY,
|
35
|
+
userId: K,
|
35
36
|
onClose: W,
|
36
37
|
isLoading: p,
|
37
|
-
|
38
|
-
onLeaderboardTypeChange: L
|
38
|
+
streakInfo: L
|
39
39
|
}) => {
|
40
|
-
var A, S, _,
|
41
|
-
const [
|
42
|
-
|
43
|
-
), [
|
40
|
+
var y, A, S, _, R, B, x, b;
|
41
|
+
const [i, l] = T(
|
42
|
+
o.findIndex((t) => E === t.type)
|
43
|
+
), [n, M] = T(((y = m == null ? void 0 : m[E]) == null ? void 0 : y.leaderboardPlayers) || []), [I, k] = T({
|
44
44
|
current: 0,
|
45
45
|
end: 0
|
46
|
-
}), [N,
|
47
|
-
|
46
|
+
}), [N, h] = Q(0), [c, Y] = T(!1), F = (A = n == null ? void 0 : n[0]) == null ? void 0 : A.points, O = ((S = n == null ? void 0 : n[0]) == null ? void 0 : S.streakDays) || 0, { playButtonSound: f } = U(), $ = () => {
|
47
|
+
f(), l((t) => t - 1 < 0 ? o.length - 1 : t - 1);
|
48
48
|
}, j = () => {
|
49
|
-
|
49
|
+
f(), l((t) => t + 1 === o.length ? 0 : t + 1);
|
50
50
|
};
|
51
|
-
return
|
52
|
-
|
53
|
-
}, [
|
54
|
-
var
|
55
|
-
const
|
56
|
-
if (
|
57
|
-
const
|
58
|
-
|
59
|
-
current:
|
60
|
-
end:
|
61
|
-
}),
|
51
|
+
return P(() => {
|
52
|
+
h(0);
|
53
|
+
}, [h]), P(() => {
|
54
|
+
var g;
|
55
|
+
const t = (g = o[i]) == null ? void 0 : g.type, s = t && (m == null ? void 0 : m[t]);
|
56
|
+
if (s) {
|
57
|
+
const C = s.leaderboardPlayers || [];
|
58
|
+
t === r.BI_WEEKLY && (k({
|
59
|
+
current: s.currentTimestamp,
|
60
|
+
end: s.endTimestamp
|
61
|
+
}), s.currentTimestamp > s.endTimestamp && (C.splice(10), Y(!0))), M([...C]);
|
62
62
|
}
|
63
|
-
}, [
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
}, [o, L]), /* @__PURE__ */ e(J, { children: /* @__PURE__ */ c(Q, { children: [
|
68
|
-
/* @__PURE__ */ c(V, { children: [
|
69
|
-
((x = s[o]) == null ? void 0 : x.type) === t.BI_WEEKLY && /* @__PURE__ */ e(
|
70
|
-
u,
|
63
|
+
}, [i, m]), /* @__PURE__ */ e(V, { children: /* @__PURE__ */ a(X, { children: [
|
64
|
+
/* @__PURE__ */ a(Z, { children: [
|
65
|
+
((_ = o[i]) == null ? void 0 : _.type) === r.BI_WEEKLY && /* @__PURE__ */ e(
|
66
|
+
d,
|
71
67
|
{
|
72
|
-
isLoading: p ||
|
68
|
+
isLoading: p || n.length === 0,
|
73
69
|
bgFromTopPosition: -120,
|
74
70
|
bgFromRightPosition: -110,
|
75
|
-
primaryText:
|
76
|
-
secondaryText:
|
71
|
+
primaryText: c ? /* @__PURE__ */ e("span", { children: "New Tournament" }) : /* @__PURE__ */ e("span", { children: "Tournament" }),
|
72
|
+
secondaryText: c ? /* @__PURE__ */ e("span", { children: "Starts Soon" }) : /* @__PURE__ */ a("span", { children: [
|
77
73
|
" ",
|
78
74
|
/* @__PURE__ */ e(
|
79
|
-
|
75
|
+
J,
|
80
76
|
{
|
81
|
-
fromTimestamp: N +
|
82
|
-
endTimestamp:
|
77
|
+
fromTimestamp: N + I.current,
|
78
|
+
endTimestamp: I.end
|
83
79
|
}
|
84
80
|
),
|
85
81
|
" ",
|
86
82
|
"left"
|
87
83
|
] }),
|
88
|
-
lottiePromise:
|
89
|
-
custEle: /* @__PURE__ */ e(
|
84
|
+
lottiePromise: u[r.BI_WEEKLY],
|
85
|
+
custEle: /* @__PURE__ */ e(D, { children: /* @__PURE__ */ e(ee, { children: /* @__PURE__ */ e("img", { src: v.TROPHY_CIRCLE }) }) })
|
90
86
|
}
|
91
87
|
),
|
92
|
-
((
|
93
|
-
|
88
|
+
((R = o[i]) == null ? void 0 : R.type) === r.ALL_TIME_STREAK && /* @__PURE__ */ e(
|
89
|
+
d,
|
94
90
|
{
|
95
91
|
isLoading: p,
|
96
92
|
bgFromTopPosition: -140,
|
97
93
|
bgFromRightPosition: -90,
|
98
94
|
primaryText: /* @__PURE__ */ e("span", { children: "Streak Stars" }),
|
99
95
|
secondaryText: /* @__PURE__ */ e("span", { children: "Top 50" }),
|
100
|
-
lottiePromise:
|
96
|
+
lottiePromise: u[r.ALL_TIME_STREAK]
|
101
97
|
}
|
102
98
|
),
|
103
|
-
((
|
104
|
-
|
99
|
+
((B = o[i]) == null ? void 0 : B.type) === r.ALL_TIME && /* @__PURE__ */ e(
|
100
|
+
d,
|
105
101
|
{
|
106
102
|
isLoading: p,
|
107
103
|
bgFromTopPosition: -140,
|
108
104
|
bgFromRightPosition: -90,
|
109
105
|
primaryText: /* @__PURE__ */ e("span", { children: "Elite Circle" }),
|
110
106
|
secondaryText: /* @__PURE__ */ e("span", { children: "Top 50" }),
|
111
|
-
lottiePromise:
|
107
|
+
lottiePromise: u[r.ALL_TIME]
|
112
108
|
}
|
113
109
|
)
|
114
110
|
] }),
|
115
111
|
p && /* @__PURE__ */ e(w, {}),
|
116
|
-
!p &&
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
112
|
+
!p && n && /* @__PURE__ */ a(re, { topInset: 0, children: [
|
113
|
+
((x = o[i]) == null ? void 0 : x.type) === r.ALL_TIME_STREAK && /* @__PURE__ */ e(
|
114
|
+
G,
|
115
|
+
{
|
116
|
+
startTimestampToday: L.startTimestampToday,
|
117
|
+
streakReduction: L.streakReduction
|
118
|
+
}
|
119
|
+
),
|
120
|
+
c && ((b = o[i]) == null ? void 0 : b.type) === r.BI_WEEKLY && /* @__PURE__ */ e(te, { children: /* @__PURE__ */ e(H, { $renderAs: "ab3", $color: "WHITE", children: "Congratulating winners of the last tournament!" }) }),
|
121
|
+
n.map((t) => {
|
122
|
+
var s;
|
121
123
|
return /* @__PURE__ */ e(
|
122
124
|
q,
|
123
125
|
{
|
124
|
-
player:
|
125
|
-
rank:
|
126
|
+
player: t,
|
127
|
+
rank: t.rank,
|
126
128
|
maxStreakDays: O,
|
127
129
|
maxPoints: F,
|
128
|
-
leaderboardType: (
|
129
|
-
isActive:
|
130
|
+
leaderboardType: (s = o[i]) == null ? void 0 : s.type,
|
131
|
+
isActive: t.userId === K
|
130
132
|
},
|
131
|
-
|
133
|
+
t.rank
|
132
134
|
);
|
133
135
|
})
|
134
136
|
] }),
|
135
|
-
/* @__PURE__ */ e(
|
137
|
+
/* @__PURE__ */ e(ne, { children: /* @__PURE__ */ e(
|
136
138
|
z,
|
137
139
|
{
|
138
|
-
labels: Object.values(
|
140
|
+
labels: Object.values(r),
|
139
141
|
onLeftClick: $,
|
140
142
|
onRightClick: j,
|
141
|
-
currIndex:
|
143
|
+
currIndex: i,
|
142
144
|
onClose: W,
|
143
|
-
disableSwipe: p ||
|
145
|
+
disableSwipe: p || n.length === 0
|
144
146
|
}
|
145
147
|
) })
|
146
148
|
] }) });
|
147
149
|
};
|
148
150
|
export {
|
149
|
-
|
151
|
+
he as Leaderboard
|
150
152
|
};
|
151
153
|
//# sourceMappingURL=leaderboard.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"leaderboard.js","sources":["../../../../src/features/circle-games/leaderboard/leaderboard.tsx"],"sourcesContent":["import type {\n ILeaderboardPlayerWithPoints,\n ILeaderboardPlayerWithStreak,\n} from './dal/use-get-leaderboard-dal/use-get-leaderboard-dal-types';\nimport type { ILeaderboardProps } from './leaderboard-types';\n\nimport { useEffect, useState } from 'react';\n\nimport { ILLUSTRATIONS } from '../../../assets/illustrations/illustrations';\nimport { CircularLoader } from '../../ui/loader/circular-loader/circular-loader';\nimport Text from '../../ui/text/text';\nimport { useCircleSounds } from '../hooks/use-circle-sounds/use-circle-sounds';\nimport { Banner } from './comps/banner/banner';\nimport { LeaderboardItemWithObserver } from './comps/leaderboard-item/leaderboard-item';\nimport { NavigationButton } from './comps/navigation-button/navigation-button';\nimport { Timer } from './comps/timer/timer';\nimport { ELeaderboardType } from './enums/leaderboard-type-enum';\nimport { useTimer } from './hooks';\nimport * as Styled from './leaderboard-styled';\n\n// lazy load banner lotties\nconst BANNER_LOTTIES: Record<ELeaderboardType, () => Promise<Record<string, unknown>>> = {\n [ELeaderboardType.ALL_TIME_STREAK]: () =>\n import('../../../assets/lotties/circle/elite-circle-lottie.json'),\n [ELeaderboardType.ALL_TIME]: () =>\n import('../../../assets/lotties/circle/elite-circle-lottie.json'),\n [ELeaderboardType.BI_WEEKLY]: () =>\n import('../../../assets/lotties/circle/tournament-ripple-lottie.json'),\n};\n\nconst leaderboards = [\n {\n name: 'TOURNAMENT',\n type: ELeaderboardType.BI_WEEKLY,\n },\n {\n name: 'STREAK STARS',\n type: ELeaderboardType.ALL_TIME_STREAK,\n },\n {\n name: 'ALL TIME',\n type: ELeaderboardType.ALL_TIME,\n },\n];\n\nexport const Leaderboard = ({\n leaderboardData,\n type = ELeaderboardType.BI_WEEKLY,\n userId,\n onClose,\n isLoading,\n listHeaderElement,\n onLeaderboardTypeChange,\n}: ILeaderboardProps) => {\n const [currentLeaderBoardIndex, setCurrentLeaderboardIndex] = useState(\n leaderboards.findIndex(leaderboard => type === leaderboard.type),\n );\n\n const [currLeaderboardData, setCurrLeaderboardData] = useState<\n (ILeaderboardPlayerWithPoints | ILeaderboardPlayerWithStreak)[] | []\n >(leaderboardData?.[type]?.leaderboardPlayers || []);\n\n const [currLeaderboardTimeStamps, setCurrLeaderboardTimeStamps] = useState<{\n current: number;\n end: number;\n }>({\n current: 0,\n end: 0,\n });\n\n const [time, setTimer] = useTimer(0);\n const [isTournamentEnded, setIsTournamentEnded] = useState(false);\n const maxPoints = (currLeaderboardData?.[0] as ILeaderboardPlayerWithPoints)?.points;\n const maxStreakDays = (currLeaderboardData?.[0] as ILeaderboardPlayerWithStreak)?.streakDays || 0;\n const { playButtonSound } = useCircleSounds();\n\n const handlePrevious = () => {\n playButtonSound();\n setCurrentLeaderboardIndex(prev => {\n if (prev - 1 < 0) {\n return leaderboards.length - 1;\n }\n\n return prev - 1;\n });\n };\n\n const handleNext = () => {\n playButtonSound();\n setCurrentLeaderboardIndex(prev => {\n if (prev + 1 === leaderboards.length) {\n return 0;\n }\n\n return prev + 1;\n });\n };\n\n useEffect(() => {\n setTimer(0);\n }, [setTimer]);\n\n useEffect(() => {\n const currType = leaderboards[currentLeaderBoardIndex]?.type;\n const currLeaderboard = currType && leaderboardData?.[currType];\n\n if (currLeaderboard) {\n const leaderboardList = currLeaderboard.leaderboardPlayers || [];\n\n if (currType === ELeaderboardType.BI_WEEKLY) {\n setCurrLeaderboardTimeStamps({\n current: currLeaderboard.currentTimestamp,\n end: currLeaderboard.endTimestamp,\n });\n\n if (currLeaderboard.currentTimestamp > currLeaderboard.endTimestamp) {\n leaderboardList.splice(10);\n setIsTournamentEnded(true);\n }\n }\n\n setCurrLeaderboardData([...leaderboardList]);\n }\n }, [currentLeaderBoardIndex, leaderboardData]);\n\n useEffect(() => {\n const currType = leaderboards[currentLeaderBoardIndex]?.type;\n\n if (currType) {\n onLeaderboardTypeChange(currType);\n }\n }, [currentLeaderBoardIndex, onLeaderboardTypeChange]);\n\n return (\n <Styled.Leaderboard>\n <Styled.LeaderboardContainer>\n <Styled.BannerWrapper>\n {/* tournament banner */}\n {leaderboards[currentLeaderBoardIndex]?.type === ELeaderboardType.BI_WEEKLY && (\n <Banner\n isLoading={isLoading || currLeaderboardData.length === 0}\n bgFromTopPosition={-120}\n bgFromRightPosition={-110}\n primaryText={\n isTournamentEnded ? <span>New Tournament</span> : <span>Tournament</span>\n }\n secondaryText={\n isTournamentEnded ? (\n <span>Starts Soon</span>\n ) : (\n <span>\n {' '}\n <Timer\n fromTimestamp={(time as number) + currLeaderboardTimeStamps.current}\n endTimestamp={currLeaderboardTimeStamps.end}\n />{' '}\n {'left'}\n </span>\n )\n }\n lottiePromise={BANNER_LOTTIES[ELeaderboardType.BI_WEEKLY]}\n custEle={\n <Styled.TournamentBannerCustContainer>\n <Styled.TrophyWrapper>\n <img src={ILLUSTRATIONS.TROPHY_CIRCLE} />\n </Styled.TrophyWrapper>\n </Styled.TournamentBannerCustContainer>\n }\n />\n )}\n\n {/* top streak banner */}\n {leaderboards[currentLeaderBoardIndex]?.type === ELeaderboardType.ALL_TIME_STREAK && (\n <Banner\n isLoading={isLoading}\n bgFromTopPosition={-140}\n bgFromRightPosition={-90}\n primaryText={<span>Streak Stars</span>}\n secondaryText={<span>Top 50</span>}\n lottiePromise={BANNER_LOTTIES[ELeaderboardType.ALL_TIME_STREAK]}\n />\n )}\n\n {/* elite circle banner */}\n {leaderboards[currentLeaderBoardIndex]?.type === ELeaderboardType.ALL_TIME && (\n <Banner\n isLoading={isLoading}\n bgFromTopPosition={-140}\n bgFromRightPosition={-90}\n primaryText={<span>Elite Circle</span>}\n secondaryText={<span>Top 50</span>}\n lottiePromise={BANNER_LOTTIES[ELeaderboardType.ALL_TIME]}\n />\n )}\n </Styled.BannerWrapper>\n\n {isLoading && <CircularLoader />}\n\n {!isLoading && currLeaderboardData && (\n <Styled.ItemsWrapper topInset={0}>\n {listHeaderElement}\n {isTournamentEnded &&\n leaderboards[currentLeaderBoardIndex]?.type === ELeaderboardType.BI_WEEKLY && (\n <Styled.Banner>\n <Text $renderAs=\"ab3\" $color=\"WHITE\">\n Congratulating winners of the last tournament!\n </Text>\n </Styled.Banner>\n )}\n {currLeaderboardData.map(player => {\n return (\n <LeaderboardItemWithObserver\n key={player.rank}\n player={player}\n rank={player.rank}\n maxStreakDays={maxStreakDays}\n maxPoints={maxPoints}\n leaderboardType={leaderboards[currentLeaderBoardIndex]?.type}\n isActive={player.userId === userId}\n />\n );\n })}\n </Styled.ItemsWrapper>\n )}\n\n <Styled.ActionButtonWrapper>\n <NavigationButton\n labels={Object.values(ELeaderboardType)}\n onLeftClick={handlePrevious}\n onRightClick={handleNext}\n currIndex={currentLeaderBoardIndex}\n onClose={onClose}\n disableSwipe={isLoading || currLeaderboardData.length === 0}\n />\n </Styled.ActionButtonWrapper>\n </Styled.LeaderboardContainer>\n </Styled.Leaderboard>\n );\n};\n"],"names":["BANNER_LOTTIES","ELeaderboardType","leaderboards","Leaderboard","leaderboardData","type","userId","onClose","isLoading","listHeaderElement","onLeaderboardTypeChange","currentLeaderBoardIndex","setCurrentLeaderboardIndex","useState","leaderboard","currLeaderboardData","setCurrLeaderboardData","_a","currLeaderboardTimeStamps","setCurrLeaderboardTimeStamps","time","setTimer","useTimer","isTournamentEnded","setIsTournamentEnded","maxPoints","_b","maxStreakDays","_c","playButtonSound","useCircleSounds","handlePrevious","prev","handleNext","useEffect","currType","currLeaderboard","leaderboardList","Styled.Leaderboard","jsxs","Styled.LeaderboardContainer","Styled.BannerWrapper","_d","jsx","Banner","Timer","Styled.TournamentBannerCustContainer","Styled.TrophyWrapper","ILLUSTRATIONS","_e","_f","CircularLoader","Styled.ItemsWrapper","_g","Styled.Banner","Text","player","LeaderboardItemWithObserver","Styled.ActionButtonWrapper","NavigationButton"],"mappings":";;;;;;;;;;;;;AAqBA,MAAMA,IAAmF;AAAA,EACvF,CAACC,EAAiB,eAAe,GAAG,MAClC,OAAO,4DAAyD;AAAA,EAClE,CAACA,EAAiB,QAAQ,GAAG,MAC3B,OAAO,4DAAyD;AAAA,EAClE,CAACA,EAAiB,SAAS,GAAG,MAC5B,OAAO,iEAA8D;AACzE,GAEMC,IAAe;AAAA,EACnB;AAAA,IACE,MAAM;AAAA,IACN,MAAMD,EAAiB;AAAA,EACzB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAMA,EAAiB;AAAA,EACzB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAMA,EAAiB;AAAA,EACzB;AACF,GAEaE,KAAc,CAAC;AAAA,EAC1B,iBAAAC;AAAA,EACA,MAAAC,IAAOJ,EAAiB;AAAA,EACxB,QAAAK;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,yBAAAC;AACF,MAAyB;;AACjB,QAAA,CAACC,GAAyBC,CAA0B,IAAIC;AAAA,IAC5DX,EAAa,UAAU,CAAeY,MAAAT,MAASS,EAAY,IAAI;AAAA,EAAA,GAG3D,CAACC,GAAqBC,CAAsB,IAAIH,IAEpDI,IAAAb,KAAA,gBAAAA,EAAkBC,OAAlB,gBAAAY,EAAyB,uBAAsB,CAAA,CAAE,GAE7C,CAACC,GAA2BC,CAA4B,IAAIN,EAG/D;AAAA,IACD,SAAS;AAAA,IACT,KAAK;AAAA,EAAA,CACN,GAEK,CAACO,GAAMC,CAAQ,IAAIC,GAAS,CAAC,GAC7B,CAACC,GAAmBC,CAAoB,IAAIX,EA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AAAA,MAAA;AAAA,IAAA,GAE9D;AAAA,EAAA,EACF,CAAA,EACF,CAAA;AAEJ;"}
|
1
|
+
{"version":3,"file":"leaderboard.js","sources":["../../../../src/features/circle-games/leaderboard/leaderboard.tsx"],"sourcesContent":["import type {\n ILeaderboardPlayerWithPoints,\n ILeaderboardPlayerWithStreak,\n} from './dal/use-get-leaderboard-dal/use-get-leaderboard-dal-types';\nimport type { ILeaderboardProps } from './leaderboard-types';\n\nimport { useEffect, useState } from 'react';\n\nimport { ILLUSTRATIONS } from '../../../assets/illustrations/illustrations';\nimport { CircularLoader } from '../../ui/loader/circular-loader/circular-loader';\nimport Text from '../../ui/text/text';\nimport { useCircleSounds } from '../hooks/use-circle-sounds/use-circle-sounds';\nimport { Banner } from './comps/banner/banner';\nimport { LeaderboardItemWithObserver } from './comps/leaderboard-item/leaderboard-item';\nimport { NavigationButton } from './comps/navigation-button/navigation-button';\nimport { StreakReductionInfoBar } from './comps/streak-reduction-infobar/streak-reduction-infobar';\nimport { Timer } from './comps/timer/timer';\nimport { ELeaderboardType } from './enums/leaderboard-type-enum';\nimport { useTimer } from './hooks/use-timer/use-timer';\nimport * as Styled from './leaderboard-styled';\n\n// lazy load banner lotties\nconst BANNER_LOTTIES: Record<ELeaderboardType, () => Promise<Record<string, unknown>>> = {\n [ELeaderboardType.ALL_TIME_STREAK]: () =>\n import('../../../assets/lotties/circle/elite-circle-lottie.json'),\n [ELeaderboardType.ALL_TIME]: () =>\n import('../../../assets/lotties/circle/elite-circle-lottie.json'),\n [ELeaderboardType.BI_WEEKLY]: () =>\n import('../../../assets/lotties/circle/tournament-ripple-lottie.json'),\n};\n\nconst leaderboards = [\n {\n name: 'TOURNAMENT',\n type: ELeaderboardType.BI_WEEKLY,\n },\n {\n name: 'STREAK STARS',\n type: ELeaderboardType.ALL_TIME_STREAK,\n },\n {\n name: 'ALL TIME',\n type: ELeaderboardType.ALL_TIME,\n },\n];\n\nexport const Leaderboard = ({\n leaderboardData,\n type = ELeaderboardType.BI_WEEKLY,\n userId,\n onClose,\n isLoading,\n streakInfo,\n}: ILeaderboardProps) => {\n const [currentLeaderBoardIndex, setCurrentLeaderboardIndex] = useState(\n leaderboards.findIndex(leaderboard => type === leaderboard.type),\n );\n\n const [currLeaderboardData, setCurrLeaderboardData] = useState<\n (ILeaderboardPlayerWithPoints | ILeaderboardPlayerWithStreak)[] | []\n >(leaderboardData?.[type]?.leaderboardPlayers || []);\n\n const [currLeaderboardTimeStamps, setCurrLeaderboardTimeStamps] = useState<{\n current: number;\n end: number;\n }>({\n current: 0,\n end: 0,\n });\n\n const [time, setTimer] = useTimer(0);\n const [isTournamentEnded, setIsTournamentEnded] = useState(false);\n const maxPoints = (currLeaderboardData?.[0] as ILeaderboardPlayerWithPoints)?.points;\n const maxStreakDays = (currLeaderboardData?.[0] as ILeaderboardPlayerWithStreak)?.streakDays || 0;\n const { playButtonSound } = useCircleSounds();\n\n const handlePrevious = () => {\n playButtonSound();\n setCurrentLeaderboardIndex(prev => {\n if (prev - 1 < 0) {\n return leaderboards.length - 1;\n }\n\n return prev - 1;\n });\n };\n\n const handleNext = () => {\n playButtonSound();\n setCurrentLeaderboardIndex(prev => {\n if (prev + 1 === leaderboards.length) {\n return 0;\n }\n\n return prev + 1;\n });\n };\n\n useEffect(() => {\n setTimer(0);\n }, [setTimer]);\n\n useEffect(() => {\n const currType = leaderboards[currentLeaderBoardIndex]?.type;\n const currLeaderboard = currType && leaderboardData?.[currType];\n\n if (currLeaderboard) {\n const leaderboardList = currLeaderboard.leaderboardPlayers || [];\n\n if (currType === ELeaderboardType.BI_WEEKLY) {\n setCurrLeaderboardTimeStamps({\n current: currLeaderboard.currentTimestamp,\n end: currLeaderboard.endTimestamp,\n });\n\n if (currLeaderboard.currentTimestamp > currLeaderboard.endTimestamp) {\n leaderboardList.splice(10);\n setIsTournamentEnded(true);\n }\n }\n\n setCurrLeaderboardData([...leaderboardList]);\n }\n }, [currentLeaderBoardIndex, leaderboardData]);\n\n return (\n <Styled.Leaderboard>\n <Styled.LeaderboardContainer>\n <Styled.BannerWrapper>\n {/* tournament banner */}\n {leaderboards[currentLeaderBoardIndex]?.type === ELeaderboardType.BI_WEEKLY && (\n <Banner\n isLoading={isLoading || currLeaderboardData.length === 0}\n bgFromTopPosition={-120}\n bgFromRightPosition={-110}\n primaryText={\n isTournamentEnded ? <span>New Tournament</span> : <span>Tournament</span>\n }\n secondaryText={\n isTournamentEnded ? (\n <span>Starts Soon</span>\n ) : (\n <span>\n {' '}\n <Timer\n fromTimestamp={(time as number) + currLeaderboardTimeStamps.current}\n endTimestamp={currLeaderboardTimeStamps.end}\n />{' '}\n {'left'}\n </span>\n )\n }\n lottiePromise={BANNER_LOTTIES[ELeaderboardType.BI_WEEKLY]}\n custEle={\n <Styled.TournamentBannerCustContainer>\n <Styled.TrophyWrapper>\n <img src={ILLUSTRATIONS.TROPHY_CIRCLE} />\n </Styled.TrophyWrapper>\n </Styled.TournamentBannerCustContainer>\n }\n />\n )}\n\n {/* top streak banner */}\n {leaderboards[currentLeaderBoardIndex]?.type === ELeaderboardType.ALL_TIME_STREAK && (\n <Banner\n isLoading={isLoading}\n bgFromTopPosition={-140}\n bgFromRightPosition={-90}\n primaryText={<span>Streak Stars</span>}\n secondaryText={<span>Top 50</span>}\n lottiePromise={BANNER_LOTTIES[ELeaderboardType.ALL_TIME_STREAK]}\n />\n )}\n\n {/* elite circle banner */}\n {leaderboards[currentLeaderBoardIndex]?.type === ELeaderboardType.ALL_TIME && (\n <Banner\n isLoading={isLoading}\n bgFromTopPosition={-140}\n bgFromRightPosition={-90}\n primaryText={<span>Elite Circle</span>}\n secondaryText={<span>Top 50</span>}\n lottiePromise={BANNER_LOTTIES[ELeaderboardType.ALL_TIME]}\n />\n )}\n </Styled.BannerWrapper>\n\n {isLoading && <CircularLoader />}\n\n {!isLoading && currLeaderboardData && (\n <Styled.ItemsWrapper topInset={0}>\n {leaderboards[currentLeaderBoardIndex]?.type === ELeaderboardType.ALL_TIME_STREAK && (\n <StreakReductionInfoBar\n startTimestampToday={streakInfo.startTimestampToday}\n streakReduction={streakInfo.streakReduction}\n />\n )}\n {isTournamentEnded &&\n leaderboards[currentLeaderBoardIndex]?.type === ELeaderboardType.BI_WEEKLY && (\n <Styled.Banner>\n <Text $renderAs=\"ab3\" $color=\"WHITE\">\n Congratulating winners of the last tournament!\n </Text>\n </Styled.Banner>\n )}\n {currLeaderboardData.map(player => {\n return (\n <LeaderboardItemWithObserver\n key={player.rank}\n player={player}\n rank={player.rank}\n maxStreakDays={maxStreakDays}\n maxPoints={maxPoints}\n leaderboardType={leaderboards[currentLeaderBoardIndex]?.type}\n isActive={player.userId === userId}\n />\n );\n })}\n </Styled.ItemsWrapper>\n )}\n\n <Styled.ActionButtonWrapper>\n <NavigationButton\n labels={Object.values(ELeaderboardType)}\n onLeftClick={handlePrevious}\n onRightClick={handleNext}\n currIndex={currentLeaderBoardIndex}\n onClose={onClose}\n disableSwipe={isLoading || currLeaderboardData.length === 0}\n />\n </Styled.ActionButtonWrapper>\n </Styled.LeaderboardContainer>\n </Styled.Leaderboard>\n );\n};\n"],"names":["BANNER_LOTTIES","ELeaderboardType","leaderboards","Leaderboard","leaderboardData","type","userId","onClose","isLoading","streakInfo","currentLeaderBoardIndex","setCurrentLeaderboardIndex","useState","leaderboard","currLeaderboardData","setCurrLeaderboardData","_a","currLeaderboardTimeStamps","setCurrLeaderboardTimeStamps","time","setTimer","useTimer","isTournamentEnded","setIsTournamentEnded","maxPoints","_b","maxStreakDays","_c","playButtonSound","useCircleSounds","handlePrevious","prev","handleNext","useEffect","currType","currLeaderboard","leaderboardList","Styled.Leaderboard","jsxs","Styled.LeaderboardContainer","Styled.BannerWrapper","_d","jsx","Banner","Timer","Styled.TournamentBannerCustContainer","Styled.TrophyWrapper","ILLUSTRATIONS","_e","_f","CircularLoader","Styled.ItemsWrapper","_g","StreakReductionInfoBar","_h","Styled.Banner","Text","player","LeaderboardItemWithObserver","Styled.ActionButtonWrapper","NavigationButton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ction(e, t) {
|
6
|
+
try {
|
7
|
+
if (!t)
|
8
|
+
return !1;
|
9
|
+
const r = localStorage.getItem(e);
|
10
|
+
return !r || !(r === `${t}`);
|
11
|
+
} catch {
|
12
|
+
return !0;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
/**
|
16
|
+
* Call this when the user has dismissed the streak reduction.
|
17
|
+
*/
|
18
|
+
static markStreakReductionDismissed(e, t) {
|
19
|
+
localStorage.setItem(e, t.toString());
|
20
|
+
}
|
21
|
+
}
|
22
|
+
export {
|
23
|
+
s as StreakReductionLocalStorageUtil
|
24
|
+
};
|
25
|
+
//# sourceMappingURL=streak-reduction-localstorage-util.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"streak-reduction-localstorage-util.js","sources":["../../../../src/features/circle-games/utils/streak-reduction-localstorage-util.ts"],"sourcesContent":["export class StreakReductionLocalStorageUtil {\n /**\n * Determines whether the streak reduction should be shown today.\n */\n static showStreakReduction(storeKey: string, startTimestamp: number): boolean {\n try {\n if (!startTimestamp) {\n return false;\n }\n\n const storedTimestamp = localStorage.getItem(storeKey);\n\n // If there's no stored timestamp, show the button\n if (!storedTimestamp) return true;\n\n // If stored timestamp is not from today, show the button\n const isSameDay = storedTimestamp === `${startTimestamp}`;\n\n if (!isSameDay) {\n return true;\n }\n\n return false;\n } catch (error) {\n return true;\n }\n }\n\n /**\n * Call this when the user has dismissed the streak reduction.\n */\n static markStreakReductionDismissed(storeKey: string, startTimestamp: number): void {\n localStorage.setItem(storeKey, startTimestamp.toString());\n }\n}\n"],"names":["StreakReductionLocalStorageUtil","storeKey","startTimestamp","storedTimestamp"],"mappings":"AAAO,MAAMA,EAAgC;AAAA;AAAA;AAAA;AAAA,EAI3C,OAAO,oBAAoBC,GAAkBC,GAAiC;AACxE,QAAA;AACF,UAAI,CAACA;AACI,eAAA;AAGH,YAAAC,IAAkB,aAAa,QAAQF,CAAQ;AAQrD,aALI,CAACE,KAKD,EAFcA,MAAoB,GAAGD,CAAc;AAAA,YAOzC;AACP,aAAA;AAAA,IACT;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,6BAA6BD,GAAkBC,GAA8B;AAClF,iBAAa,QAAQD,GAAUC,EAAe,SAAU,CAAA;AAAA,EAC1D;AACF;"}
|
package/dist/index.d.ts
CHANGED
@@ -1207,6 +1207,11 @@ declare interface IIconButtonProps extends Omit<IButtonProps, 'label' | 'shape'
|
|
1207
1207
|
customBgColor?: TColorNames;
|
1208
1208
|
}
|
1209
1209
|
|
1210
|
+
declare interface IInfoBarProps {
|
1211
|
+
hue: THueNames;
|
1212
|
+
children: React.ReactNode;
|
1213
|
+
}
|
1214
|
+
|
1210
1215
|
export declare interface IInfoMessage {
|
1211
1216
|
message: string;
|
1212
1217
|
position: 'top' | 'bottom';
|
@@ -1350,8 +1355,10 @@ declare interface ILeaderboardProps {
|
|
1350
1355
|
userId: string;
|
1351
1356
|
onClose: () => void;
|
1352
1357
|
isLoading: boolean;
|
1353
|
-
|
1354
|
-
|
1358
|
+
streakInfo: {
|
1359
|
+
streakReduction: number;
|
1360
|
+
startTimestampToday: number;
|
1361
|
+
};
|
1355
1362
|
}
|
1356
1363
|
|
1357
1364
|
declare interface ILearningSheetData {
|
@@ -1980,6 +1987,8 @@ export declare enum IndicatorType {
|
|
1980
1987
|
|
1981
1988
|
export declare const Info2Icon: React_2.FC<React_2.SVGProps<SVGSVGElement>>;
|
1982
1989
|
|
1990
|
+
export declare const InfoBar: React.FC<IInfoBarProps>;
|
1991
|
+
|
1983
1992
|
export declare const InfoIcon: React.FC<React.SVGProps<SVGSVGElement>>;
|
1984
1993
|
|
1985
1994
|
export declare interface INudgeProps {
|
@@ -3258,7 +3267,7 @@ export declare const JourneyProvider: FC<{
|
|
3258
3267
|
children: ReactNode;
|
3259
3268
|
}>;
|
3260
3269
|
|
3261
|
-
export declare const Leaderboard: ({ leaderboardData, type, userId, onClose, isLoading,
|
3270
|
+
export declare const Leaderboard: ({ leaderboardData, type, userId, onClose, isLoading, streakInfo, }: ILeaderboardProps) => JSX_2.Element;
|
3262
3271
|
|
3263
3272
|
export declare const LearnosityPreloader: FC<PropsWithChildren<ILearnosityPreloaderProps>>;
|
3264
3273
|
|
@@ -3757,6 +3766,17 @@ declare const STICKER_BADGE: {
|
|
3757
3766
|
|
3758
3767
|
export declare const StreakIcon: React_2.FC<IStreakIconProps>;
|
3759
3768
|
|
3769
|
+
export declare class StreakReductionLocalStorageUtil {
|
3770
|
+
/**
|
3771
|
+
* Determines whether the streak reduction should be shown today.
|
3772
|
+
*/
|
3773
|
+
static showStreakReduction(storeKey: string, startTimestamp: number): boolean;
|
3774
|
+
/**
|
3775
|
+
* Call this when the user has dismissed the streak reduction.
|
3776
|
+
*/
|
3777
|
+
static markStreakReductionDismissed(storeKey: string, startTimestamp: number): void;
|
3778
|
+
}
|
3779
|
+
|
3760
3780
|
export declare const StrikedEyeIcon: React.FC<React.SVGProps<SVGSVGElement>>;
|
3761
3781
|
|
3762
3782
|
export declare const StudentDetails: FC<IStudentDetailsProps>;
|