@cuemath/leap 2.8.25-rj-5 → 2.8.25-rj-7

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.
@@ -1,20 +1,21 @@
1
- import { useState as E, useCallback as d, useEffect as p } from "react";
1
+ import { useState as d, useCallback as E, useEffect as p } from "react";
2
2
  import { useGetCircleHomeAPI as u } from "../../api/get-content-for-today/get-circle-home-api.js";
3
3
  import { ProjectType as r } from "../../../games/web-view/enums/project-type-enum.js";
4
4
  const O = (o, e, n) => {
5
- const [c, _] = E(null), { data: a, get: m, isProcessed: s, ...l } = u(), R = d(() => {
6
- e !== "" && m("", {
5
+ const [m, _] = d(null), { data: a, get: c, isProcessed: s, ...l } = u(), R = E(() => {
6
+ e !== "" && c("", {
7
7
  user_id: o,
8
8
  country_code: e,
9
9
  grade: n
10
10
  });
11
- }, [m, o, e, n]);
11
+ }, [c, o, e, n]);
12
12
  return p(() => {
13
13
  let i = null;
14
14
  s && a && (i = {
15
15
  points: a.points,
16
16
  streakDays: a.streak_days,
17
17
  streakReduction: a.streak_reduction,
18
+ streakDaysBeforeReduction: a.streak_days_before_reduction,
18
19
  streakStatus: a.streak_status,
19
20
  tournamentRank: a.tournament_rank,
20
21
  projects: {
@@ -75,7 +76,7 @@ const O = (o, e, n) => {
75
76
  status: t.status
76
77
  }))
77
78
  })), _(i);
78
- }, [a, s]), { data: c, isProcessed: s, getCircleHomeDetails: R, ...l };
79
+ }, [a, s]), { data: m, isProcessed: s, getCircleHomeDetails: R, ...l };
79
80
  };
80
81
  export {
81
82
  O as useGetCircleHomeDetailsDal
@@ -1 +1 @@
1
- {"version":3,"file":"use-get-circle-home-details-dal.js","sources":["../../../../../../src/features/circle-games/game-launcher/dal/use-get-circle-home-details-dal/use-get-circle-home-details-dal.ts"],"sourcesContent":["import type { ICircleHomeDetails, TStreakStatus } from './use-get-circle-home-dal-types';\n\nimport { useCallback, useEffect, useState } from 'react';\n\nimport { ProjectType } from '../../../games/web-view/enums';\nimport { useGetCircleHomeAPI } from '../../api/get-content-for-today/get-circle-home-api';\n\nexport const useGetCircleHomeDetailsDal = (\n userId: string,\n countryCode: string,\n grade: string,\n): Omit<ReturnType<typeof useGetCircleHomeAPI>, 'data' | 'get'> & {\n data: ICircleHomeDetails | null;\n getCircleHomeDetails: () => void;\n} => {\n const [contentForToday, setContentForToday] = useState<ICircleHomeDetails | null>(null);\n const { data, get: getHomeDetails, isProcessed, ...rest } = useGetCircleHomeAPI();\n\n const getCircleHomeDetails = useCallback(() => {\n if (countryCode === '') {\n return;\n }\n\n getHomeDetails('', {\n user_id: userId,\n country_code: countryCode,\n grade: grade,\n });\n }, [getHomeDetails, userId, countryCode, grade]);\n\n useEffect(() => {\n let circleHomeDetails: ICircleHomeDetails | null = null;\n\n if (isProcessed && data) {\n circleHomeDetails = {\n points: data.points,\n streakDays: data.streak_days,\n streakReduction: data.streak_reduction,\n streakStatus: data.streak_status as TStreakStatus,\n tournamentRank: data.tournament_rank,\n projects: {\n games: {\n label: data.projects.games.label,\n type: ProjectType.GAME,\n initialProgressValue: 0,\n data: data.projects.games.data.map(game => ({\n id: game.id,\n name: game.name,\n cardLottie: game.card,\n tutorial: game.tutorial,\n variant: game.variant,\n isPlayed: game.played,\n })),\n },\n puzzles: {\n label: data.projects.puzzles.label,\n type: ProjectType.PUZZLE,\n initialProgressValue: 0,\n data: data.projects.puzzles.data.map(puzzle => ({\n id: puzzle.id,\n name: puzzle.name,\n cardLottie: puzzle.card,\n tutorial: puzzle.tutorial,\n variant: puzzle.variant,\n question: puzzle.question,\n isHintSeen: puzzle.is_hint_seen,\n solved: puzzle.solved,\n })),\n },\n },\n timestamps: {\n startTimestamp: data.timestamps.start_timestamp,\n endTimestamp: data.timestamps.end_timestamp,\n current: data.timestamps.current,\n },\n coachmarkProgress: {\n CIRCLE_ACTIVITIES_INTRO_JOURNEY:\n data.coachmark_completion.CIRCLE_ACTIVITIES_INTRO_JOURNEY,\n CIRCLE_LEADERBOARD_INTRO_JOURNEY:\n data.coachmark_completion.CIRCLE_LEADERBOARD_INTRO_JOURNEY,\n CIRCLE_POINTS_REWARD_JOURNEY: data.coachmark_completion.CIRCLE_POINTS_REWARD_JOURNEY,\n CIRCLE_STREAK_UPDATE_JOURNEY: data.coachmark_completion.CIRCLE_STREAK_UPDATE_JOURNEY,\n CIRCLE_TUTORIAL_JOURNEY: data.coachmark_completion.CIRCLE_TUTORIAL_JOURNEY,\n },\n };\n\n if (data.projects.lessons) {\n circleHomeDetails.projects.lessons = {\n label: data.projects.lessons.label,\n type: ProjectType.LESSON,\n initialProgressValue: 0,\n data: data.projects.lessons.data.map(lesson => ({\n id: lesson.id,\n name: lesson.name,\n cardLottie: lesson.card,\n tutorial: lesson.tutorial,\n variant: lesson.variant,\n sessionId: lesson.session_id,\n miniGameIdentifier: lesson.mini_game_identifier,\n targetQuestions: lesson.target_questions,\n status: lesson.status,\n })),\n };\n }\n }\n setContentForToday(circleHomeDetails);\n }, [data, isProcessed]);\n\n return { data: contentForToday, isProcessed, getCircleHomeDetails, ...rest };\n};\n"],"names":["useGetCircleHomeDetailsDal","userId","countryCode","grade","contentForToday","setContentForToday","useState","data","getHomeDetails","isProcessed","rest","useGetCircleHomeAPI","getCircleHomeDetails","useCallback","useEffect","circleHomeDetails","ProjectType","game","puzzle","lesson"],"mappings":";;;AAOO,MAAMA,IAA6B,CACxCC,GACAC,GACAC,MAIG;AACH,QAAM,CAACC,GAAiBC,CAAkB,IAAIC,EAAoC,IAAI,GAChF,EAAE,MAAAC,GAAM,KAAKC,GAAgB,aAAAC,GAAa,GAAGC,EAAA,IAASC,KAEtDC,IAAuBC,EAAY,MAAM;AAC7C,IAAIX,MAAgB,MAIpBM,EAAe,IAAI;AAAA,MACjB,SAASP;AAAA,MACT,cAAcC;AAAA,MACd,OAAAC;AAAA,IAAA,CACD;AAAA,KACA,CAACK,GAAgBP,GAAQC,GAAaC,CAAK,CAAC;AAE/C,SAAAW,EAAU,MAAM;AACd,Q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xD,yBAAyBA,EAAK,qBAAqB;AAAA,MACrD;AAAA,IAAA,GAGEA,EAAK,SAAS,YAChBQ,EAAkB,SAAS,UAAU;AAAA,MACnC,OAAOR,EAAK,SAAS,QAAQ;AAAA,MAC7B,MAAMS,EAAY;AAAA,MAClB,sBAAsB;AAAA,MACtB,MAAMT,EAAK,SAAS,QAAQ,KAAK,IAAI,CAAWY,OAAA;AAAA,QAC9C,IAAIA,EAAO;AAAA,QACX,MAAMA,EAAO;AAAA,QACb,YAAYA,EAAO;AAAA,QACnB,UAAUA,EAAO;AAAA,QACjB,SAASA,EAAO;AAAA,QAChB,WAAWA,EAAO;AAAA,QAClB,oBAAoBA,EAAO;AAAA,QAC3B,iBAAiBA,EAAO;AAAA,QACxB,QAAQA,EAAO;AAAA,MAAA,EACf;AAAA,IAAA,KAIRd,EAAmBU,CAAiB;AAAA,EAAA,GACnC,CAACR,GAAME,CAAW,CAAC,GAEf,EAAE,MAAML,GAAiB,aAAAK,GAAa,sBAAAG,GAAsB,GAAGF;AACxE;"}
1
+ {"version":3,"file":"use-get-circle-home-details-dal.js","sources":["../../../../../../src/features/circle-games/game-launcher/dal/use-get-circle-home-details-dal/use-get-circle-home-details-dal.ts"],"sourcesContent":["import type { ICircleHomeDetails, TStreakStatus } from './use-get-circle-home-dal-types';\n\nimport { useCallback, useEffect, useState } from 'react';\n\nimport { ProjectType } from '../../../games/web-view/enums';\nimport { useGetCircleHomeAPI } from '../../api/get-content-for-today/get-circle-home-api';\n\nexport const useGetCircleHomeDetailsDal = (\n userId: string,\n countryCode: string,\n grade: string,\n): Omit<ReturnType<typeof useGetCircleHomeAPI>, 'data' | 'get'> & {\n data: ICircleHomeDetails | null;\n getCircleHomeDetails: () => void;\n} => {\n const [contentForToday, setContentForToday] = useState<ICircleHomeDetails | null>(null);\n const { data, get: getHomeDetails, isProcessed, ...rest } = useGetCircleHomeAPI();\n\n const getCircleHomeDetails = useCallback(() => {\n if (countryCode === '') {\n return;\n }\n\n getHomeDetails('', {\n user_id: userId,\n country_code: countryCode,\n grade: grade,\n });\n }, [getHomeDetails, userId, countryCode, grade]);\n\n useEffect(() => {\n let circleHomeDetails: ICircleHomeDetails | null = null;\n\n if (isProcessed && data) {\n circleHomeDetails = {\n points: data.points,\n streakDays: data.streak_days,\n streakReduction: data.streak_reduction,\n streakDaysBeforeReduction: data.streak_days_before_reduction,\n streakStatus: data.streak_status as TStreakStatus,\n tournamentRank: data.tournament_rank,\n projects: {\n games: {\n label: data.projects.games.label,\n type: ProjectType.GAME,\n initialProgressValue: 0,\n data: data.projects.games.data.map(game => ({\n id: game.id,\n name: game.name,\n cardLottie: game.card,\n tutorial: game.tutorial,\n variant: game.variant,\n isPlayed: game.played,\n })),\n },\n puzzles: {\n label: data.projects.puzzles.label,\n type: ProjectType.PUZZLE,\n initialProgressValue: 0,\n data: data.projects.puzzles.data.map(puzzle => ({\n id: puzzle.id,\n name: puzzle.name,\n cardLottie: puzzle.card,\n tutorial: puzzle.tutorial,\n variant: puzzle.variant,\n question: puzzle.question,\n isHintSeen: puzzle.is_hint_seen,\n solved: puzzle.solved,\n })),\n },\n },\n timestamps: {\n startTimestamp: data.timestamps.start_timestamp,\n endTimestamp: data.timestamps.end_timestamp,\n current: data.timestamps.current,\n },\n coachmarkProgress: {\n CIRCLE_ACTIVITIES_INTRO_JOURNEY:\n data.coachmark_completion.CIRCLE_ACTIVITIES_INTRO_JOURNEY,\n CIRCLE_LEADERBOARD_INTRO_JOURNEY:\n data.coachmark_completion.CIRCLE_LEADERBOARD_INTRO_JOURNEY,\n CIRCLE_POINTS_REWARD_JOURNEY: data.coachmark_completion.CIRCLE_POINTS_REWARD_JOURNEY,\n CIRCLE_STREAK_UPDATE_JOURNEY: data.coachmark_completion.CIRCLE_STREAK_UPDATE_JOURNEY,\n CIRCLE_TUTORIAL_JOURNEY: data.coachmark_completion.CIRCLE_TUTORIAL_JOURNEY,\n },\n };\n\n if (data.projects.lessons) {\n circleHomeDetails.projects.lessons = {\n label: data.projects.lessons.label,\n type: ProjectType.LESSON,\n initialProgressValue: 0,\n data: data.projects.lessons.data.map(lesson => ({\n id: lesson.id,\n name: lesson.name,\n cardLottie: lesson.card,\n tutorial: lesson.tutorial,\n variant: lesson.variant,\n sessionId: lesson.session_id,\n miniGameIdentifier: lesson.mini_game_identifier,\n targetQuestions: lesson.target_questions,\n status: lesson.status,\n })),\n };\n }\n }\n setContentForToday(circleHomeDetails);\n }, [data, isProcessed]);\n\n return { data: contentForToday, isProcessed, getCircleHomeDetails, ...rest };\n};\n"],"names":["useGetCircleHomeDetailsDal","userId","countryCode","grade","contentForToday","setContentForToday","useState","data","getHomeDetails","isProcessed","rest","useGetCircleHomeAPI","getCircleHomeDetails","useCallback","useEffect","circleHomeDetails","ProjectType","game","puzzle","lesson"],"mappings":";;;AAOO,MAAMA,IAA6B,CACxCC,GACAC,GACAC,MAIG;AACH,QAAM,CAACC,GAAiBC,CAAkB,IAAIC,EAAoC,IAAI,GAChF,EAAE,MAAAC,GAAM,KAAKC,GAAgB,aAAAC,GAAa,GAAGC,EAAA,IAASC,KAEtDC,IAAuBC,EAAY,MAAM;AAC7C,IAAIX,MAAgB,MAIpBM,EAAe,IAAI;AAAA,MACjB,SAASP;AAAA,MACT,cAAcC;AAAA,MACd,OAAAC;AAAA,IAAA,CACD;AAAA,KACA,CAACK,GAAgBP,GAAQC,GAAaC,CAAK,CAAC;AAE/C,SAAAW,EAAU,MAAM;AACd,QAAIC,IAA+C;AAEnD,IAAIN,KAAeF,MACGQ,IAAA;AAAA,MAClB,QAAQR,EAAK;AAAA,MACb,YAAYA,EAAK;AAAA,MACjB,iBAAiBA,EAAK;AAAA,MACtB,2BAA2BA,EAAK;AAAA,MAChC,cAAcA,EAAK;AAAA,MACnB,gBAAgBA,EAAK;AAAA,MACrB,UAAU;AAAA,QACR,OAAO;AAAA,UACL,OAAOA,EAAK,SAAS,MAAM;AAAA,UAC3B,MAAMS,EAAY;AAAA,UAClB,sBAAsB;AAAA,UACtB,MA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AAYA,EAAO;AAAA,QACnB,UAAUA,EAAO;AAAA,QACjB,SAASA,EAAO;AAAA,QAChB,WAAWA,EAAO;AAAA,QAClB,oBAAoBA,EAAO;AAAA,QAC3B,iBAAiBA,EAAO;AAAA,QACxB,QAAQA,EAAO;AAAA,MAAA,EACf;AAAA,IAAA,KAIRd,EAAmBU,CAAiB;AAAA,EAAA,GACnC,CAACR,GAAME,CAAW,CAAC,GAEf,EAAE,MAAML,GAAiB,aAAAK,GAAa,sBAAAG,GAAsB,GAAGF;AACxE;"}
@@ -1,199 +1,146 @@
1
1
  import { jsx as e, jsxs as c } from "react/jsx-runtime";
2
- import { useState as p, useCallback as J, useEffect as K } from "react";
3
- import { ILLUSTRATIONS as Q } from "../../../assets/illustrations/illustrations.js";
4
- import Y from "../../../assets/line-icons/icons/cross.js";
5
- import T from "../../ui/layout/flex-view.js";
6
- import { CircularLoader as Z } from "../../ui/loader/circular-loader/circular-loader.js";
7
- import d from "../../ui/text/text.js";
8
- import { useCircleSounds as D } from "../hooks/use-circle-sounds/use-circle-sounds.js";
9
- import { Banner as u } from "./comps/banner/banner.js";
10
- import w from "./comps/info-bar/info-bar.js";
11
- import { LeaderboardItemWithObserver as ee } from "./comps/leaderboard-item/leaderboard-item.js";
12
- import { NavigationButton as re } from "./comps/navigation-button/navigation-button.js";
13
- import { Timer as ne } from "./comps/timer/timer.js";
14
- import { ELeaderboardType as n } from "./enums/leaderboard-type-enum.js";
15
- import { Leaderboard as te, LeaderboardContainer as oe, BannerWrapper as ie, TournamentBannerCustContainer as se, TrophyWrapper as me, ItemsWrapper as ce, Banner as ae, ActionButtonWrapper as pe } from "./leaderboard-styled.js";
16
- import { useTimer as de } from "./hooks/useTimer.js";
17
- const h = {
18
- [n.ALL_TIME_STREAK]: () => import("../../../assets/lotties/circle/elite-circle-lottie.json.js"),
19
- [n.ALL_TIME]: () => import("../../../assets/lotties/circle/elite-circle-lottie.json.js"),
20
- [n.BI_WEEKLY]: () => import("../../../assets/lotties/circle/tournament-ripple-lottie.json.js")
2
+ import { useState as T, useEffect as g } from "react";
3
+ import { ILLUSTRATIONS as j } from "../../../assets/illustrations/illustrations.js";
4
+ import { CircularLoader as v } from "../../ui/loader/circular-loader/circular-loader.js";
5
+ import w from "../../ui/text/text.js";
6
+ import { useCircleSounds as H } from "../hooks/use-circle-sounds/use-circle-sounds.js";
7
+ import { Banner as d } from "./comps/banner/banner.js";
8
+ import { LeaderboardItemWithObserver as U } from "./comps/leaderboard-item/leaderboard-item.js";
9
+ import { NavigationButton as q } from "./comps/navigation-button/navigation-button.js";
10
+ import { Timer as z } from "./comps/timer/timer.js";
11
+ import { ELeaderboardType as t } from "./enums/leaderboard-type-enum.js";
12
+ import { Leaderboard as G, LeaderboardContainer as J, BannerWrapper as Q, TournamentBannerCustContainer as V, TrophyWrapper as X, ItemsWrapper as Z, Banner as D, ActionButtonWrapper as ee } from "./leaderboard-styled.js";
13
+ import { useTimer as re } from "./hooks/useTimer.js";
14
+ const u = {
15
+ [t.ALL_TIME_STREAK]: () => import("../../../assets/lotties/circle/elite-circle-lottie.json.js"),
16
+ [t.ALL_TIME]: () => import("../../../assets/lotties/circle/elite-circle-lottie.json.js"),
17
+ [t.BI_WEEKLY]: () => import("../../../assets/lotties/circle/tournament-ripple-lottie.json.js")
21
18
  }, i = [
22
19
  {
23
20
  name: "TOURNAMENT",
24
- type: n.BI_WEEKLY
21
+ type: t.BI_WEEKLY
25
22
  },
26
23
  {
27
24
  name: "STREAK STARS",
28
- type: n.ALL_TIME_STREAK
25
+ type: t.ALL_TIME_STREAK
29
26
  },
30
27
  {
31
28
  name: "ALL TIME",
32
- type: n.ALL_TIME
29
+ type: t.ALL_TIME
33
30
  }
34
- ], xe = ({
31
+ ], le = ({
35
32
  leaderboardData: m,
36
- type: E = n.BI_WEEKLY,
37
- userId: M,
38
- onClose: N,
39
- isLoading: a,
40
- showInfoBar: F,
41
- onInfoBarDismiss: I,
42
- streakReduction: H
33
+ type: E = t.BI_WEEKLY,
34
+ userId: C,
35
+ onClose: P,
36
+ isLoading: p,
37
+ listHeaderElement: W
43
38
  }) => {
44
- var S, B, C, x, W, k, R;
45
- const [s, f] = p(
39
+ var f, y, A, S, _, x, B;
40
+ const [s, l] = T(
46
41
  i.findIndex((r) => E === r.type)
47
- ), [t, O] = p(((S = m == null ? void 0 : m[E]) == null ? void 0 : S.leaderboardPlayers) || []), [L, j] = p({
42
+ ), [n, K] = T(((f = m == null ? void 0 : m[E]) == null ? void 0 : f.leaderboardPlayers) || []), [L, M] = T({
48
43
  current: 0,
49
44
  end: 0
50
- }), [v, y] = de(0), [l, X] = p(!1), U = (B = t == null ? void 0 : t[0]) == null ? void 0 : B.points, G = ((C = t == null ? void 0 : t[0]) == null ? void 0 : C.streakDays) || 0, { playButtonSound: g } = D(), [_, V] = p(F), b = H > 0, A = J(() => {
51
- V(!1), I();
52
- }, [I]), q = () => {
53
- g(), f((r) => r - 1 < 0 ? i.length - 1 : r - 1);
54
- }, z = () => {
55
- g(), f((r) => r + 1 === i.length ? 0 : r + 1);
45
+ }), [k, h] = re(0), [a, N] = T(!1), Y = (y = n == null ? void 0 : n[0]) == null ? void 0 : y.points, F = ((A = n == null ? void 0 : n[0]) == null ? void 0 : A.streakDays) || 0, { playButtonSound: I } = H(), O = () => {
46
+ I(), l((r) => r - 1 < 0 ? i.length - 1 : r - 1);
47
+ }, $ = () => {
48
+ I(), l((r) => r + 1 === i.length ? 0 : r + 1);
56
49
  };
57
- return K(() => {
58
- y(0);
59
- }, [y]), K(() => {
60
- var $;
61
- const r = ($ = i[s]) == null ? void 0 : $.type, o = r && (m == null ? void 0 : m[r]);
50
+ return g(() => {
51
+ h(0);
52
+ }, [h]), g(() => {
53
+ var R;
54
+ const r = (R = i[s]) == null ? void 0 : R.type, o = r && (m == null ? void 0 : m[r]);
62
55
  if (o) {
63
- const P = o.leaderboardPlayers || [];
64
- r === n.BI_WEEKLY && (j({
56
+ const b = o.leaderboardPlayers || [];
57
+ r === t.BI_WEEKLY && (M({
65
58
  current: o.currentTimestamp,
66
59
  end: o.endTimestamp
67
- }), o.currentTimestamp > o.endTimestamp && (P.splice(10), X(!0))), O([...P]);
60
+ }), o.currentTimestamp > o.endTimestamp && (b.splice(10), N(!0))), K([...b]);
68
61
  }
69
- }, [s, m]), /* @__PURE__ */ e(te, { children: /* @__PURE__ */ c(oe, { children: [
70
- /* @__PURE__ */ c(ie, { children: [
71
- ((x = i[s]) == null ? void 0 : x.type) === n.BI_WEEKLY && /* @__PURE__ */ e(
72
- u,
62
+ }, [s, m]), /* @__PURE__ */ e(G, { children: /* @__PURE__ */ c(J, { children: [
63
+ /* @__PURE__ */ c(Q, { children: [
64
+ ((S = i[s]) == null ? void 0 : S.type) === t.BI_WEEKLY && /* @__PURE__ */ e(
65
+ d,
73
66
  {
74
- isLoading: a || t.length === 0,
67
+ isLoading: p || n.length === 0,
75
68
  bgFromTopPosition: -120,
76
69
  bgFromRightPosition: -110,
77
- primaryText: l ? /* @__PURE__ */ e("span", { children: "New Tournament" }) : /* @__PURE__ */ e("span", { children: "Tournament" }),
78
- secondaryText: l ? /* @__PURE__ */ e("span", { children: "Starts Soon" }) : /* @__PURE__ */ c("span", { children: [
70
+ primaryText: a ? /* @__PURE__ */ e("span", { children: "New Tournament" }) : /* @__PURE__ */ e("span", { children: "Tournament" }),
71
+ secondaryText: a ? /* @__PURE__ */ e("span", { children: "Starts Soon" }) : /* @__PURE__ */ c("span", { children: [
79
72
  " ",
80
73
  /* @__PURE__ */ e(
81
- ne,
74
+ z,
82
75
  {
83
- fromTimestamp: v + L.current,
76
+ fromTimestamp: k + L.current,
84
77
  endTimestamp: L.end
85
78
  }
86
79
  ),
87
80
  " ",
88
81
  "left"
89
82
  ] }),
90
- lottiePromise: h[n.BI_WEEKLY],
91
- custEle: /* @__PURE__ */ e(se, { children: /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e("img", { src: Q.TROPHY_CIRCLE }) }) })
83
+ lottiePromise: u[t.BI_WEEKLY],
84
+ custEle: /* @__PURE__ */ e(V, { children: /* @__PURE__ */ e(X, { children: /* @__PURE__ */ e("img", { src: j.TROPHY_CIRCLE }) }) })
92
85
  }
93
86
  ),
94
- ((W = i[s]) == null ? void 0 : W.type) === n.ALL_TIME_STREAK && /* @__PURE__ */ e(
95
- u,
87
+ ((_ = i[s]) == null ? void 0 : _.type) === t.ALL_TIME_STREAK && /* @__PURE__ */ e(
88
+ d,
96
89
  {
97
- isLoading: a,
90
+ isLoading: p,
98
91
  bgFromTopPosition: -140,
99
92
  bgFromRightPosition: -90,
100
93
  primaryText: /* @__PURE__ */ e("span", { children: "Streak Stars" }),
101
94
  secondaryText: /* @__PURE__ */ e("span", { children: "Top 50" }),
102
- lottiePromise: h[n.ALL_TIME_STREAK]
95
+ lottiePromise: u[t.ALL_TIME_STREAK]
103
96
  }
104
97
  ),
105
- ((k = i[s]) == null ? void 0 : k.type) === n.ALL_TIME && /* @__PURE__ */ e(
106
- u,
98
+ ((x = i[s]) == null ? void 0 : x.type) === t.ALL_TIME && /* @__PURE__ */ e(
99
+ d,
107
100
  {
108
- isLoading: a,
101
+ isLoading: p,
109
102
  bgFromTopPosition: -140,
110
103
  bgFromRightPosition: -90,
111
104
  primaryText: /* @__PURE__ */ e("span", { children: "Elite Circle" }),
112
105
  secondaryText: /* @__PURE__ */ e("span", { children: "Top 50" }),
113
- lottiePromise: h[n.ALL_TIME]
106
+ lottiePromise: u[t.ALL_TIME]
114
107
  }
115
108
  )
116
109
  ] }),
117
- a && /* @__PURE__ */ e(Z, {}),
118
- !a && t && /* @__PURE__ */ c(ce, { topInset: 0, children: [
119
- _ && !b && /* @__PURE__ */ e(
120
- w,
121
- {
122
- children: /* @__PURE__ */ c(
123
- T,
124
- {
125
- $flexDirection: "row",
126
- $alignItems: "center",
127
- $justifyContent: "space-between",
128
- children: [
129
- /* @__PURE__ */ e(d, { $renderAs: "ab2", $color: "WHITE_T_87", children: "Streak saved for the day! Come back tomorrow to keep increasing it." }),
130
- /* @__PURE__ */ e(Y, { cursor: "pointer", color: "WHITE", onClick: A })
131
- ]
132
- }
133
- ),
134
- hue: "GREEN",
135
- marginX: 16,
136
- marginY: 16,
137
- paddingX: 16,
138
- paddingY: 16
139
- }
140
- ),
141
- _ && b && /* @__PURE__ */ e(
142
- w,
143
- {
144
- children: /* @__PURE__ */ c(
145
- T,
146
- {
147
- $flexDirection: "row",
148
- $alignItems: "center",
149
- $justifyContent: "space-between",
150
- children: [
151
- /* @__PURE__ */ c(T, { children: [
152
- /* @__PURE__ */ e(d, { $renderAs: "ab2", $color: "WHITE_T_87", children: "Keep building your streak by completing an activity each day." }),
153
- /* @__PURE__ */ e(d, { $renderAs: "ab2", $color: "WHITE_T_87", children: "For each day missed, your streak reduces by 1." })
154
- ] }),
155
- /* @__PURE__ */ e(Y, { cursor: "pointer", color: "WHITE", onClick: A })
156
- ]
157
- }
158
- ),
159
- hue: "YELLOW",
160
- marginX: 16,
161
- marginY: 16,
162
- paddingX: 16,
163
- paddingY: 16
164
- }
165
- ),
166
- l && ((R = i[s]) == null ? void 0 : R.type) === n.BI_WEEKLY && /* @__PURE__ */ e(ae, { children: /* @__PURE__ */ e(d, { $renderAs: "ab3", $color: "WHITE", children: "Congratulating winners of the last tournament!" }) }),
167
- t.map((r) => {
110
+ p && /* @__PURE__ */ e(v, {}),
111
+ !p && n && /* @__PURE__ */ c(Z, { topInset: 0, children: [
112
+ W,
113
+ a && ((B = i[s]) == null ? void 0 : B.type) === t.BI_WEEKLY && /* @__PURE__ */ e(D, { children: /* @__PURE__ */ e(w, { $renderAs: "ab3", $color: "WHITE", children: "Congratulating winners of the last tournament!" }) }),
114
+ n.map((r) => {
168
115
  var o;
169
116
  return /* @__PURE__ */ e(
170
- ee,
117
+ U,
171
118
  {
172
119
  player: r,
173
120
  rank: r.rank,
174
- maxStreakDays: G,
175
- maxPoints: U,
121
+ maxStreakDays: F,
122
+ maxPoints: Y,
176
123
  leaderboardType: (o = i[s]) == null ? void 0 : o.type,
177
- isActive: r.userId === M
124
+ isActive: r.userId === C
178
125
  },
179
126
  r.rank
180
127
  );
181
128
  })
182
129
  ] }),
183
- /* @__PURE__ */ e(pe, { children: /* @__PURE__ */ e(
184
- re,
130
+ /* @__PURE__ */ e(ee, { children: /* @__PURE__ */ e(
131
+ q,
185
132
  {
186
- labels: Object.values(n),
187
- onLeftClick: q,
188
- onRightClick: z,
133
+ labels: Object.values(t),
134
+ onLeftClick: O,
135
+ onRightClick: $,
189
136
  currIndex: s,
190
- onClose: N,
191
- disableSwipe: a || t.length === 0
137
+ onClose: P,
138
+ disableSwipe: p || n.length === 0
192
139
  }
193
140
  ) })
194
141
  ] }) });
195
142
  };
196
143
  export {
197
- xe as Leaderboard
144
+ le as Leaderboard
198
145
  };
199
146
  //# 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 { useState, useEffect, useCallback } from 'react';\n\nimport { ILLUSTRATIONS } from '../../../assets/illustrations/illustrations';\nimport CrossIcon from '../../../assets/line-icons/icons/cross';\nimport FlexView from '../../ui/layout/flex-view';\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 InfoBar from './comps/info-bar/info-bar';\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 showInfoBar: showInfoBarByDefault,\n onInfoBarDismiss,\n streakReduction,\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 const [showInfoBar, setShowInfoBar] = useState(showInfoBarByDefault);\n\n const hasStreakReduced = streakReduction > 0;\n const handleInfoBarDismiss = useCallback(() => {\n setShowInfoBar(false);\n onInfoBarDismiss();\n }, [onInfoBarDismiss]);\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 {showInfoBar && !hasStreakReduced && (\n <InfoBar\n children={\n <FlexView\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $justifyContent=\"space-between\"\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 <CrossIcon cursor={'pointer'} color=\"WHITE\" onClick={handleInfoBarDismiss} />\n </FlexView>\n }\n hue=\"GREEN\"\n marginX={16}\n marginY={16}\n paddingX={16}\n paddingY={16}\n />\n )}\n\n {showInfoBar && hasStreakReduced && (\n <InfoBar\n children={\n <FlexView\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $justifyContent=\"space-between\"\n >\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 <CrossIcon cursor={'pointer'} color=\"WHITE\" onClick={handleInfoBarDismiss} />\n </FlexView>\n }\n hue=\"YELLOW\"\n marginX={16}\n marginY={16}\n paddingX={16}\n paddingY={16}\n />\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","showInfoBarByDefault","onInfoBarDismiss","streakReduction","currentLeaderBoardIndex","setCurrentLeaderboardIndex","useState","leaderboard","currLeaderboardData","setCurrLeaderboardData","_a","currLeaderboardTimeStamps","setCurrLeaderboardTimeStamps","time","setTimer","useTimer","isTournamentEnded","setIsTournamentEnded","maxPoints","_b","maxStreakDays","_c","playButtonSound","useCircleSounds","showInfoBar","setShowInfoBar","hasStreakReduced","handleInfoBarDismiss","useCallback","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","InfoBar","FlexView","Text","CrossIcon","_g","Styled.Banner","player","LeaderboardItemWithObserver","Styled.ActionButtonWrapper","NavigationButton"],"mappings":";;;;;;;;;;;;;;;;AAwBA,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,aAAaC;AAAA,EACb,kBAAAC;AAAA,EACA,iBAAAC;AACF,MAAyB;;AACjB,QAAA,CAACC,GAAyBC,CAA0B,IAAIC;AAAA,IAC5DZ,EAAa,UAAU,CAAea,MAAAV,MAASU,EAAY,IAAI;AAAA,EAAA,GAG3D,CAACC,GAAqBC,CAAsB,IAAIH,IAEpDI,IAAAd,KAAA,gBAAAA,EAAkBC,OAAlB,gBAAAa,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,EAAS,EAAK,GAC1DY,KAAaC,IAAAX,KAAA,gBAAAA,EAAsB,OAAtB,gBAAAW,EAA2D,QACxEC,MAAiBC,IAAAb,KA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kCACCC,GAAU,EAAA,QAAQ,WAAW,OAAM,SAAQ,SAAS3B,GAAsB;AAAA,cAAA;AAAA,YAAA;AAAA,UAC7E;AAAA,UAEF,KAAI;AAAA,UACJ,SAAS;AAAA,UACT,SAAS;AAAA,UACT,UAAU;AAAA,UACV,UAAU;AAAA,QAAA;AAAA,MACZ;AAAA,MAGDX,OACCuC,IAAA7D,EAAaU,CAAuB,MAApC,gBAAAmD,EAAuC,UAAS9D,EAAiB,aAC9D,gBAAAgD,EAAAe,IAAA,EACC,4BAACH,GAAK,EAAA,WAAU,OAAM,QAAO,SAAQ,2DAErC,CAAA,GACF;AAAA,MAEH7C,EAAoB,IAAI,CAAUiD,MAAA;;AAE/B,eAAA,gBAAAhB;AAAA,UAACiB;AAAA,UAAA;AAAA,YAEC,QAAAD;AAAA,YACA,MAAMA,EAAO;AAAA,YACb,eAAArC;AAAA,YACA,WAAAF;AAAA,YACA,kBAAiBR,IAAAhB,EAAaU,CAAuB,MAApC,gBAAAM,EAAuC;AAAA,YACxD,UAAU+C,EAAO,WAAW3D;AAAA,UAAA;AAAA,UANvB2D,EAAO;AAAA,QAAA;AAAA,MAOd,CAEH;AAAA,IAAA,GACH;AAAA,IAGF,gBAAAhB,EAACkB,IAAA,EACC,UAAA,gBAAAlB;AAAA,MAACmB;AAAA,MAAA;AAAA,QACC,QAAQ,OAAO,OAAOnE,CAAgB;AAAA,QACtC,aAAaoC;AAAA,QACb,cAAcE;AAAA,QACd,WAAW3B;AAAA,QACX,SAAAL;AAAA,QACA,cAAcC,KAAaQ,EAAoB,WAAW;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 { 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}: 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 {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","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;AA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,IAAAd,EAAaQ,CAAuB,MAApC,gBAAAM,EAAuC;AAAA,YACxD,UAAUuC,EAAO,WAAWjD;AAAA,UAAA;AAAA,UANvBiD,EAAO;AAAA,QAAA;AAAA,MAOd,CAEH;AAAA,IAAA,GACH;AAAA,IAGF,gBAAAb,EAACe,IAAA,EACC,UAAA,gBAAAf;AAAA,MAACgB;AAAA,MAAA;AAAA,QACC,QAAQ,OAAO,OAAOzD,CAAgB;AAAA,QACtC,aAAa6B;AAAA,QACb,cAAcE;AAAA,QACd,WAAWtB;AAAA,QACX,SAAAH;AAAA,QACA,cAAcC,KAAaM,EAAoB,WAAW;AAAA,MAAA;AAAA,IAAA,GAE9D;AAAA,EAAA,EACF,CAAA,EACF,CAAA;AAEJ;"}
package/dist/index.d.ts CHANGED
@@ -834,6 +834,7 @@ export declare interface ICircleHomeDetails {
834
834
  streakDays: number;
835
835
  streakStatus: TStreakStatus;
836
836
  streakReduction: number;
837
+ streakDaysBeforeReduction: number;
837
838
  tournamentRank: number;
838
839
  projects: IProjects;
839
840
  timestamps: ITodaysContentTimeStamps;
@@ -1123,6 +1124,7 @@ declare interface IGetCircleHomeResponseModel {
1123
1124
  tournament_rank: number;
1124
1125
  streak_days: number;
1125
1126
  streak_reduction: number;
1127
+ streak_days_before_reduction: number;
1126
1128
  streak_status: 'pending' | 'completed';
1127
1129
  projects: IProjects_2;
1128
1130
  timestamps: ITimeStampsResponseModel;
@@ -1348,9 +1350,7 @@ declare interface ILeaderboardProps {
1348
1350
  userId: string;
1349
1351
  onClose: () => void;
1350
1352
  isLoading: boolean;
1351
- showInfoBar: boolean;
1352
- streakReduction: number;
1353
- onInfoBarDismiss: () => void;
1353
+ listHeaderElement: ReactNode;
1354
1354
  }
1355
1355
 
1356
1356
  declare interface ILearningSheetData {
@@ -3257,7 +3257,7 @@ export declare const JourneyProvider: FC<{
3257
3257
  children: ReactNode;
3258
3258
  }>;
3259
3259
 
3260
- export declare const Leaderboard: ({ leaderboardData, type, userId, onClose, isLoading, showInfoBar: showInfoBarByDefault, onInfoBarDismiss, streakReduction, }: ILeaderboardProps) => JSX_2.Element;
3260
+ export declare const Leaderboard: ({ leaderboardData, type, userId, onClose, isLoading, listHeaderElement, }: ILeaderboardProps) => JSX_2.Element;
3261
3261
 
3262
3262
  export declare const LearnosityPreloader: FC<PropsWithChildren<ILearnosityPreloaderProps>>;
3263
3263
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuemath/leap",
3
- "version": "2.8.25-rj-5",
3
+ "version": "2.8.25-rj-7",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -1,12 +0,0 @@
1
- import o from "styled-components";
2
- import e from "../../../../ui/layout/flex-view.js";
3
- const t = o(e)`
4
- padding: ${({ paddingX: r, paddingY: p }) => `${p}px ${r}px`};
5
- margin: ${({ marginX: r, marginY: p }) => `${p}px ${r}px`};
6
- border-width: 1px;
7
- border-style: solid;
8
- `;
9
- export {
10
- t as InfoBarWrapper
11
- };
12
- //# sourceMappingURL=info-bar-styled.js.map
@@ -1 +0,0 @@
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 interface IInfoBarWrapperProps {\n paddingX?: number;\n paddingY?: number;\n marginX?: number;\n marginY?: number;\n}\n\nexport const InfoBarWrapper = styled(FlexView)<IInfoBarWrapperProps>`\n padding: ${({ paddingX, paddingY }) => `${paddingY}px ${paddingX}px`};\n margin: ${({ marginX, marginY }) => `${marginY}px ${marginX}px`};\n border-width: 1px;\n border-style: solid;\n`;\n"],"names":["InfoBarWrapper","styled","FlexView","paddingX","paddingY","marginX","marginY"],"mappings":";;AAWa,MAAAA,IAAiBC,EAAOC,CAAQ;AAAA,aAChC,CAAC,EAAE,UAAAC,GAAU,UAAAC,QAAe,GAAGA,CAAQ,MAAMD,CAAQ,IAAI;AAAA,YAC1D,CAAC,EAAE,SAAAE,GAAS,SAAAC,QAAc,GAAGA,CAAO,MAAMD,CAAO,IAAI;AAAA;AAAA;AAAA;"}
@@ -1,30 +0,0 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { useMemo as l } from "react";
3
- import p from "../../../../ui/text/text.js";
4
- import { InfoBarWrapper as s } from "./info-bar-styled.js";
5
- const b = (o) => ({ backgroundColor: `${o}_6`, borderColor: `${o}_4` }), $ = ({
6
- children: o,
7
- hue: r,
8
- marginX: t = 0,
9
- marginY: n = 0,
10
- paddingX: m = 0,
11
- paddingY: d = 0
12
- }) => {
13
- const { backgroundColor: a, borderColor: c } = l(() => b(r), [r]);
14
- return /* @__PURE__ */ e(
15
- s,
16
- {
17
- $background: a,
18
- $borderColor: c,
19
- marginX: t,
20
- marginY: n,
21
- paddingX: m,
22
- paddingY: d,
23
- children: /* @__PURE__ */ e(p, { $renderAs: "body2", children: o })
24
- }
25
- );
26
- };
27
- export {
28
- $ as default
29
- };
30
- //# sourceMappingURL=info-bar.js.map
@@ -1 +0,0 @@
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 Text from '../../../../ui/text/text';\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\nconst InfoBar: React.FC<IInfoBarProps> = ({\n children,\n hue,\n marginX = 0,\n marginY = 0,\n paddingX = 0,\n paddingY = 0,\n}) => {\n const { backgroundColor, borderColor } = useMemo(() => computeColorsFromHue(hue), [hue]);\n\n return (\n <Styled.InfoBarWrapper\n $background={backgroundColor}\n $borderColor={borderColor}\n marginX={marginX}\n marginY={marginY}\n paddingX={paddingX}\n paddingY={paddingY}\n >\n <Text $renderAs=\"body2\">{children}</Text>\n </Styled.InfoBarWrapper>\n );\n};\n\nexport default InfoBar;\n"],"names":["computeColorsFromHue","hue","InfoBar","children","marginX","marginY","paddingX","paddingY","backgroundColor","borderColor","useMemo","jsx","Styled.InfoBarWrapper","Text"],"mappings":";;;;AAQA,MAAMA,IAAuB,CAC3BC,OAEO,EAAE,iBAAiB,GAAGA,CAAG,MAAM,aAAa,GAAGA,CAAG,SAGrDC,IAAmC,CAAC;AAAA,EACxC,UAAAC;AAAA,EACA,KAAAF;AAAA,EACA,SAAAG,IAAU;AAAA,EACV,SAAAC,IAAU;AAAA,EACV,UAAAC,IAAW;AAAA,EACX,UAAAC,IAAW;AACb,MAAM;AACE,QAAA,EAAE,iBAAAC,GAAiB,aAAAC,EAAA,IAAgBC,EAAQ,MAAMV,EAAqBC,CAAG,GAAG,CAACA,CAAG,CAAC;AAGrF,SAAA,gBAAAU;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,aAAaJ;AAAA,MACb,cAAcC;AAAA,MACd,SAAAL;AAAA,MACA,SAAAC;AAAA,MACA,UAAAC;AAAA,MACA,UAAAC;AAAA,MAEA,UAAC,gBAAAI,EAAAE,GAAA,EAAK,WAAU,SAAS,UAAAV,GAAS;AAAA,IAAA;AAAA,EAAA;AAGxC;"}