@opexa/portal-components 0.0.70 → 0.0.72

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.
Files changed (142) hide show
  1. package/dist/client/hooks/useGamesQuery.d.ts +2 -2
  2. package/dist/client/hooks/useGamesQuery.js +2 -2
  3. package/dist/components/BetRecords/BetRecords.js +10 -15
  4. package/dist/components/CashbackBonus/CashbackBonus.client.d.ts +2 -0
  5. package/dist/components/CashbackBonus/CashbackBonus.client.js +9 -0
  6. package/dist/components/CashbackBonus/CashbackBonus.d.ts +10 -0
  7. package/dist/components/CashbackBonus/CashbackBonus.js +5 -0
  8. package/dist/components/CashbackBonus/index.d.ts +1 -0
  9. package/dist/components/CashbackBonus/index.js +1 -0
  10. package/dist/components/GameProviders/GameProviders.d.ts +14 -2
  11. package/dist/components/GameProviders/GameProviders.js +12 -2
  12. package/dist/components/JackpotCounter/JackpotCounterItem.module.css +184 -184
  13. package/dist/components/Jackpots/JackpotItemDesktop.d.ts +1 -9
  14. package/dist/components/Jackpots/JackpotItemDesktop.js +5 -3
  15. package/dist/components/Jackpots/JackpotItemMobile.d.ts +1 -9
  16. package/dist/components/Jackpots/JackpotItemMobile.js +5 -3
  17. package/dist/components/Jackpots/JackpotRules.d.ts +0 -1
  18. package/dist/components/Jackpots/JackpotRules.js +3 -1
  19. package/dist/components/Jackpots/Jackpots.client.js +2 -1
  20. package/dist/components/Jackpots/Jackpots.d.ts +3 -5
  21. package/dist/components/Jackpots/JackpotsContext.d.ts +4 -0
  22. package/dist/components/Jackpots/JackpotsContext.js +3 -0
  23. package/dist/components/Jackpots/useJackpotItemData.d.ts +2 -8
  24. package/dist/components/Jackpots/useJackpotItemData.js +7 -1
  25. package/dist/components/Search/Search.d.ts +15 -0
  26. package/dist/components/Search/Search.js +32 -5
  27. package/dist/components/TopWins/TopWins.client.js +3 -3
  28. package/dist/components/Tournaments/TournamentDesktop.d.ts +1 -0
  29. package/dist/components/Tournaments/TournamentDesktop.js +57 -0
  30. package/dist/components/Tournaments/TournamentMobile.d.ts +1 -0
  31. package/dist/components/Tournaments/TournamentMobile.js +55 -0
  32. package/dist/components/Tournaments/TournamentRules.d.ts +0 -1
  33. package/dist/components/Tournaments/TournamentRules.js +3 -1
  34. package/dist/components/Tournaments/Tournaments.client.js +4 -3
  35. package/dist/components/Tournaments/Tournaments.d.ts +2 -4
  36. package/dist/components/Tournaments/TournamentsContext.d.ts +4 -0
  37. package/dist/components/Tournaments/TournamentsContext.js +3 -0
  38. package/dist/components/Tournaments/useTournamentData.d.ts +10 -0
  39. package/dist/components/Tournaments/useTournamentData.js +72 -0
  40. package/dist/components/TransactionRecords/DepositRecordsTable.js +1 -0
  41. package/dist/components/TransactionRecords/TableFilters.d.ts +1 -7
  42. package/dist/components/TransactionRecords/TableFilters.js +1 -53
  43. package/dist/components/TransactionRecords/TransactionRecords.d.ts +0 -3
  44. package/dist/components/TransactionRecords/TransactionRecords.js +0 -1
  45. package/dist/components/TransactionRecords/TransactionRecordsTable.js +1 -0
  46. package/dist/components/TransactionRecords/WithdrawalRecordsTable.js +1 -0
  47. package/dist/constants/envVars.d.ts +5 -0
  48. package/dist/constants/envVars.js +28 -0
  49. package/dist/constants/gameProviders.d.ts +4 -0
  50. package/dist/constants/gameProviders.js +319 -0
  51. package/dist/constants/gameTypes.d.ts +4 -0
  52. package/dist/constants/gameTypes.js +64 -0
  53. package/dist/constants/headerKeys.d.ts +1 -0
  54. package/dist/constants/headerKeys.js +1 -0
  55. package/dist/constants/index.d.ts +6 -12
  56. package/dist/constants/index.js +6 -88
  57. package/dist/constants/secretQuestions.d.ts +3 -0
  58. package/dist/constants/secretQuestions.js +24 -0
  59. package/dist/constants/storageKeys.d.ts +2 -0
  60. package/dist/constants/storageKeys.js +2 -0
  61. package/dist/images/game-providers/ALIZE.png +0 -0
  62. package/dist/images/game-providers/BGAMING.png +0 -0
  63. package/dist/images/game-providers/BOOOONGO.png +0 -0
  64. package/dist/images/game-providers/BTI.png +0 -0
  65. package/dist/images/game-providers/CQ9.png +0 -0
  66. package/dist/images/game-providers/DARWIN.png +0 -0
  67. package/dist/images/game-providers/DG.png +0 -0
  68. package/dist/images/game-providers/DRBINGO.png +0 -0
  69. package/dist/images/game-providers/E2E.png +0 -0
  70. package/dist/images/game-providers/EVOLUTION.png +0 -0
  71. package/dist/images/game-providers/EVOLUTION_NETENT.png +0 -0
  72. package/dist/images/game-providers/EVOLUTION_REDTIGER.png +0 -0
  73. package/dist/images/game-providers/EVOPLAY.png +0 -0
  74. package/dist/images/game-providers/EZUGI.png +0 -0
  75. package/dist/images/game-providers/FACHAI.png +0 -0
  76. package/dist/images/game-providers/HABANERO.png +0 -0
  77. package/dist/images/game-providers/HACKSAW.png +0 -0
  78. package/dist/images/game-providers/HOLLYWOODTV.png +0 -0
  79. package/dist/images/game-providers/JDB.png +0 -0
  80. package/dist/images/game-providers/JDB_GTF.png +0 -0
  81. package/dist/images/game-providers/JDB_SPRIBE.png +0 -0
  82. package/dist/images/game-providers/JILI.png +0 -0
  83. package/dist/images/game-providers/JOKER.png +0 -0
  84. package/dist/images/game-providers/KINGMAKER.png +0 -0
  85. package/dist/images/game-providers/KINGMIDAS.png +0 -0
  86. package/dist/images/game-providers/MEGA2SPIN.png +0 -0
  87. package/dist/images/game-providers/MEGABALL.png +0 -0
  88. package/dist/images/game-providers/MICROGAMING.png +0 -0
  89. package/dist/images/game-providers/ONEAPI.png +0 -0
  90. package/dist/images/game-providers/PGSOFT.png +0 -0
  91. package/dist/images/game-providers/PLAYTECH.png +0 -0
  92. package/dist/images/game-providers/PRAGMATIC_PLAY.png +0 -0
  93. package/dist/images/game-providers/RELAX_GAMING.png +0 -0
  94. package/dist/images/game-providers/RTG.png +0 -0
  95. package/dist/images/game-providers/SABA.png +0 -0
  96. package/dist/images/game-providers/SPINIX.png +0 -0
  97. package/dist/images/game-providers/SPRIBE.png +0 -0
  98. package/dist/images/game-providers/YELLOWBAT.png +0 -0
  99. package/dist/middleware.d.ts +3 -2
  100. package/dist/middleware.js +7 -4
  101. package/dist/server/utils/prefetchGamesQuery.d.ts +2 -2
  102. package/dist/server/utils/prefetchGamesQuery.js +2 -2
  103. package/dist/styles/theme.css +696 -696
  104. package/dist/types/index.d.ts +6 -1
  105. package/dist/ui/AlertDialog/AlertDialog.d.ts +88 -88
  106. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +8 -8
  107. package/dist/ui/Badge/Badge.d.ts +12 -12
  108. package/dist/ui/Badge/badge.recipe.d.ts +3 -3
  109. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  110. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  111. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  112. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  113. package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
  114. package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
  115. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  116. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  117. package/dist/ui/DatePicker/DatePicker.d.ts +336 -336
  118. package/dist/ui/DatePicker/datePicker.recipe.d.ts +14 -14
  119. package/dist/ui/Dialog/Dialog.d.ts +88 -88
  120. package/dist/ui/Dialog/dialog.recipe.d.ts +8 -8
  121. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  122. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  123. package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
  124. package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
  125. package/dist/ui/Popover/Popover.d.ts +88 -88
  126. package/dist/ui/Popover/popover.recipe.d.ts +8 -8
  127. package/dist/ui/Progress/Progress.d.ts +27 -27
  128. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  129. package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
  130. package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
  131. package/dist/ui/Select/Select.d.ts +45 -45
  132. package/dist/ui/Select/select.recipe.d.ts +3 -3
  133. package/dist/ui/Table/Table.d.ts +21 -21
  134. package/dist/ui/Table/table.recipe.d.ts +3 -3
  135. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  136. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  137. package/dist/utils/callIfFn.d.ts +1 -0
  138. package/dist/utils/callIfFn.js +6 -0
  139. package/dist/utils/index.d.ts +1 -0
  140. package/dist/utils/index.js +1 -0
  141. package/dist/utils/queryKeys.d.ts +2 -2
  142. package/package.json +160 -157
@@ -13,9 +13,11 @@ import { formatNumber, getPercentage, mask } from '../../utils/index.js';
13
13
  import styles from '../JackpotCounter/JackpotCounterItem.module.css';
14
14
  import { JackpotGameProviders } from './JackpotGameProviders.js';
15
15
  import { JackpotRules } from './JackpotRules.js';
16
+ import { useJackpotContext } from './JackpotsContext.js';
16
17
  import { useJackpotItemData } from './useJackpotItemData.js';
17
- export function JackpotItemMobile({ jackpot, gameProviders, }) {
18
- const { jackpotPayouts, topJackpotPayout, filteredGameProviders, localeInfo, isPayingOut, jackpotAmount, arrowImages, getAccumulatingJackpotDescription, starTierStyles, } = useJackpotItemData({ jackpot, gameProviders });
18
+ export function JackpotItemMobile() {
19
+ const jackpot = useJackpotContext();
20
+ const { jackpotPayouts, topJackpotPayout, filteredGameProviders, localeInfo, isPayingOut, jackpotAmount, arrowImages, getAccumulatingJackpotDescription, starTierStyles, } = useJackpotItemData();
19
21
  const [isDetailsVisible, setIsDetailsVisible] = useState(false);
20
22
  return (_jsxs("div", { className: "bg-bg-primary border-border-primary rounded-2xl border", children: [_jsxs("div", { className: twMerge('bg-bg-tertiary relative flex shrink-0 rounded-2xl p-3 text-center lg:gap-4 lg:p-5'), children: [_jsxs("div", { className: "z-1 relative flex flex-1 flex-col", children: [_jsx("div", { className: "flex h-full flex-col justify-between", children: _jsx("div", { className: "flex w-full justify-between", children: _jsx("div", { className: "flex w-full flex-col", children: _jsxs("div", { className: "relative flex w-full justify-between", children: [_jsxs("div", { children: [isPayingOut ? (_jsxs("div", { className: "border-utility-success-200 bg-utility-success-50 text-utility-success-700 flex w-fit items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium", children: [_jsx("span", { className: "full bg-utility-success-500 size-1.5 animate-pulse rounded" }), "Paying Out"] })) : (_jsxs("div", { className: "border-utility-blue-200 bg-utility-blue-50 text-utility-blue-700 flex w-fit items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium", children: [_jsx(ArrowNarrowUpRightIcon, { className: "text-utility-blue-500 size-3.5" }), "Accumulating"] })), _jsx("div", { className: "text-text-primary-900 mt-1 text-left text-lg font-medium lg:mt-5 lg:text-2xl", children: jackpot.name }), _jsx("div", { className: "bg-bg-primary text-brand-400 mt-1.5 w-fit rounded-md px-2 py-1 text-2xl font-bold lg:mt-2 lg:text-4xl", children: formatNumber(jackpotAmount, {
21
23
  currency: localeInfo.currency.code,
@@ -36,7 +38,7 @@ export function JackpotItemMobile({ jackpot, gameProviders, }) {
36
38
  currency: localeInfo.currency.code,
37
39
  minDecimalPlaces: 2,
38
40
  maxDecimalPlaces: 2,
39
- }) })] })] }) })) : (_jsxs("div", { className: "bg-bg-primary relative mt-4 flex w-full gap-4 rounded-lg p-4", children: [_jsx(Image, { width: 66, height: 87, src: firstPlace, alt: "closeChest", className: "size-full h-auto w-[66px] mix-blend-luminosity" }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700 flex h-fit w-fit items-center gap-1 rounded-sm border px-2 py-0.5 text-xs font-medium", children: [_jsx(Trophy01Icon, { className: "text-utility-brand-600 size-3.5" }), "Top Payout"] }), _jsx("div", { className: "font-semibold", children: "No winners yet" }), _jsx("div", { className: "text-text-secondary-700 text-xs", children: "You could be the first to win the tournament!" })] })] })), _jsx(Button, { variant: "outline", className: twMerge('mt-5.5 px-3.5 py-2.5 text-sm', isDetailsVisible ? 'hidden' : 'flex'), onClick: () => setIsDetailsVisible(!isDetailsVisible), children: _jsxs("div", { className: "flex gap-1.5", children: ["See Details", _jsx(ArrowNarrowDownIcon, { className: "size-5" })] }) })] }), isPayingOut && (_jsx("div", { className: twMerge(styles['light-rays'], 'absolute right-0 top-0 rounded-2xl [--light-rays-top:15%] lg:[--light-rays-top:150px]') }))] }), isDetailsVisible && (_jsxs("div", { children: [_jsxs("div", { className: "z-1 flex-1", children: [_jsxs("div", { className: "flex items-center justify-between p-3", children: [_jsx("div", { className: "flex gap-2", children: _jsx("div", { className: "text-text-primary-900 text-lg font-semibold", children: jackpotPayouts.length ? 'Leaderboard' : 'Starting soon!' }) }), _jsx(JackpotRules, { jackpotRules: jackpot.description })] }), _jsx("div", { children: _jsx("div", { className: "border-gray-200 overflow-hidden", children: _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-bg-secondary text-text-tertiary-600 h-8 text-center text-xs font-medium", children: [_jsx("th", { className: "w-[52px]", children: "#" }), _jsx("th", { children: "Player" }), _jsx("th", { children: "Multiplier" }), _jsx("th", { children: "Prize" })] }) }), _jsx("tbody", { children: jackpotPayouts.length ? (_jsx(_Fragment, { children: jackpotPayouts.map((jackpotPayout, i) => (_jsxs("tr", { className: "bg-bg-primary text-text-secondary-700 text-center text-sm", children: [_jsx("td", { className: "border-border-secondary h-12 w-[52px] border-t-2", children: i + 1 < 6 ? (_jsxs("div", { className: "relative", children: [_jsx(StarIcon, { className: twMerge('mx-auto size-6.5', starTierStyles[i].starColor) }), _jsx("span", { className: twMerge('absolute inset-0 mt-0.5 flex items-center justify-center text-2xs font-bold', starTierStyles[i].numberColor), children: i + 1 })] })) : (i + 1) }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: mask(jackpotPayout.member.name) }), _jsxs("td", { className: "border-border-secondary h-12 border-t-2", children: [jackpotPayout.multiplier, "x"] }), _jsx("td", { className: "border-border-secondary text-brand-400 h-12 border-t-2", children: formatNumber(jackpotPayout.amount, {
41
+ }) })] })] }) })) : (_jsxs("div", { className: "bg-bg-primary relative mt-4 flex w-full gap-4 rounded-lg p-4", children: [_jsx(Image, { width: 66, height: 87, src: firstPlace, alt: "closeChest", className: "size-full h-auto w-[66px] mix-blend-luminosity" }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700 flex h-fit w-fit items-center gap-1 rounded-sm border px-2 py-0.5 text-xs font-medium", children: [_jsx(Trophy01Icon, { className: "text-utility-brand-600 size-3.5" }), "Top Payout"] }), _jsx("div", { className: "font-semibold", children: "No winners yet" }), _jsx("div", { className: "text-text-secondary-700 text-xs", children: "You could be the first to win the tournament!" })] })] })), _jsx(Button, { variant: "outline", className: twMerge('mt-5.5 px-3.5 py-2.5 text-sm', isDetailsVisible ? 'hidden' : 'flex'), onClick: () => setIsDetailsVisible(!isDetailsVisible), children: _jsxs("div", { className: "flex gap-1.5", children: ["See Details", _jsx(ArrowNarrowDownIcon, { className: "size-5" })] }) })] }), isPayingOut && (_jsx("div", { className: twMerge(styles['light-rays'], 'absolute right-0 top-0 rounded-2xl [--light-rays-top:15%] lg:[--light-rays-top:150px]') }))] }), isDetailsVisible && (_jsxs("div", { children: [_jsxs("div", { className: "z-1 flex-1", children: [_jsxs("div", { className: "flex items-center justify-between p-3", children: [_jsx("div", { className: "flex gap-2", children: _jsx("div", { className: "text-text-primary-900 text-lg font-semibold", children: jackpotPayouts.length ? 'Leaderboard' : 'Starting soon!' }) }), _jsx(JackpotRules, {})] }), _jsx("div", { children: _jsx("div", { className: "border-gray-200 overflow-hidden", children: _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-bg-secondary text-text-tertiary-600 h-8 text-center text-xs font-medium", children: [_jsx("th", { className: "w-[52px]", children: "#" }), _jsx("th", { children: "Player" }), _jsx("th", { children: "Multiplier" }), _jsx("th", { children: "Prize" })] }) }), _jsx("tbody", { children: jackpotPayouts.length ? (_jsx(_Fragment, { children: jackpotPayouts.map((jackpotPayout, i) => (_jsxs("tr", { className: "bg-bg-primary text-text-secondary-700 text-center text-sm", children: [_jsx("td", { className: "border-border-secondary h-12 w-[52px] border-t-2", children: i + 1 < 6 ? (_jsxs("div", { className: "relative", children: [_jsx(StarIcon, { className: twMerge('mx-auto size-6.5', starTierStyles[i].starColor) }), _jsx("span", { className: twMerge('absolute inset-0 mt-0.5 flex items-center justify-center text-2xs font-bold', starTierStyles[i].numberColor), children: i + 1 })] })) : (i + 1) }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: mask(jackpotPayout.member.name) }), _jsxs("td", { className: "border-border-secondary h-12 border-t-2", children: [jackpotPayout.multiplier, "x"] }), _jsx("td", { className: "border-border-secondary text-brand-400 h-12 border-t-2", children: formatNumber(jackpotPayout.amount, {
40
42
  currency: localeInfo.currency.code,
41
43
  minDecimalPlaces: 2,
42
44
  maxDecimalPlaces: 2,
@@ -1,6 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
2
  export interface JackpotRulesProps {
3
3
  children?: ReactNode;
4
- jackpotRules: string;
5
4
  }
6
5
  export declare function JackpotRules(props: JackpotRulesProps): import("react/jsx-runtime").JSX.Element;
@@ -4,6 +4,8 @@ import { Portal } from '@ark-ui/react';
4
4
  import { XIcon } from '../../icons/index.js';
5
5
  import { Flag06Icon } from '../../icons/Flag06Icon.js';
6
6
  import { Dialog } from '../../ui/index.js';
7
+ import { useJackpotContext } from './JackpotsContext.js';
7
8
  export function JackpotRules(props) {
8
- return (_jsxs(Dialog.Root, { lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: [_jsx(Dialog.Trigger, { asChild: true, children: props.children ?? (_jsx("button", { type: "button", className: "text-button-tertiary-fg flex text-sm font-semibold", children: "Jackpot Rules" })) }), _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: "bg-bg-primary-alt mx-auto h-full w-full items-start lg:h-auto lg:w-[640px] lg:rounded-xl", children: [_jsxs("div", { className: "p-3xl", children: [_jsxs("div", { className: "mb-3 flex justify-between", children: [_jsx("div", { className: "bg-bg-tertiary border-border-primary flex h-12 w-12 items-center justify-center rounded-lg border", children: _jsx(Flag06Icon, { className: "text-text-tertiary-600 size-full p-3" }) }), _jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) })] }), _jsx("div", { className: "text-text-primary-900 text-lg font-semibold", children: "Jackpot Rules" }), _jsx("div", { className: "text-text-tertiary-600 mt-1 text-sm", children: "Terms and Conditions" })] }), _jsx("div", { className: "border-gray-800 border-t-1 pb-3", children: _jsx("div", { dangerouslySetInnerHTML: { __html: props.jackpotRules }, className: "px-3xl py-3" }) })] }) })] })] }));
9
+ const jackpot = useJackpotContext();
10
+ return (_jsxs(Dialog.Root, { lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: [_jsx(Dialog.Trigger, { asChild: true, children: props.children ?? (_jsx("button", { type: "button", className: "text-button-tertiary-fg flex text-sm font-semibold", children: "Jackpot Rules" })) }), _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: "bg-bg-primary-alt mx-auto h-full w-full items-start lg:h-auto lg:w-[640px] lg:rounded-xl", children: [_jsxs("div", { className: "p-3xl", children: [_jsxs("div", { className: "mb-3 flex justify-between", children: [_jsx("div", { className: "bg-bg-tertiary border-border-primary flex h-12 w-12 items-center justify-center rounded-lg border", children: _jsx(Flag06Icon, { className: "text-text-tertiary-600 size-full p-3" }) }), _jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) })] }), _jsx("div", { className: "text-text-primary-900 text-lg font-semibold", children: "Jackpot Rules" }), _jsx("div", { className: "text-text-tertiary-600 mt-1 text-sm", children: "Terms and Conditions" })] }), _jsx("div", { className: "border-gray-800 border-t-1 pb-3", children: _jsx("div", { dangerouslySetInnerHTML: { __html: jackpot.description }, className: "px-3xl py-3" }) })] }) })] })] }));
9
11
  }
@@ -5,6 +5,7 @@ import { useJackpotsQuery } from '../../client/hooks/index.js';
5
5
  import closeChest from '../../images/close-chest.png';
6
6
  import { JackpotItemDesktop } from './JackpotItemDesktop.js';
7
7
  import { JackpotItemMobile } from './JackpotItemMobile.js';
8
+ import { JackpotContext, JackpotsPropsContext } from './JackpotsContext.js';
8
9
  export function Jackpots__client(props) {
9
10
  const jackpotsQuery = useJackpotsQuery({
10
11
  first: 100,
@@ -24,5 +25,5 @@ export function Jackpots__client(props) {
24
25
  const jackpots = jackpotsQuery.data?.pages[0].edges.map((edge) => edge.node) ?? [];
25
26
  if (jackpots.length <= 0)
26
27
  return null;
27
- return (_jsxs("div", { className: props.className, children: [_jsx("div", { className: "mb-3 text-lg font-semibold lg:mb-4.5", children: props.heading ?? 'Jackpots' }), jackpots.length > 0 ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "hidden flex-col gap-6 lg:flex", children: jackpots.map((jackpot) => (_jsx(JackpotItemDesktop, { gameProviders: props.gameProviders, jackpot: jackpot, viewAllUrl: props.viewAllUrl }, jackpot.id))) }), _jsx("div", { className: "flex flex-col gap-6 lg:hidden", children: jackpots.map((jackpot) => (_jsx(JackpotItemMobile, { gameProviders: props.gameProviders, jackpot: jackpot, viewAllUrl: props.viewAllUrl }, jackpot.id))) })] })) : (_jsxs("div", { className: "mt-11 flex flex-col items-center justify-center", children: [_jsx(Image, { width: 100, height: 100, src: closeChest, alt: "closeChest", quality: 100, className: "h-29.5 w-29.5 lg:h-25 lg:w-25 size-full mix-blend-luminosity" }), _jsx("div", { className: "text-text-primary-900 mt-4 text-base font-semibold", children: props.heading ?? 'Jackpots' }), _jsxs("div", { className: "text-text-tertiary-600 mt-1 text-center text-sm", children: ["No ", props.heading?.toLocaleLowerCase() ?? 'jackpots', " are running at the moment. ", _jsx("br", {}), "Please check back later!"] })] }))] }));
28
+ return (_jsx(JackpotsPropsContext, { value: props, children: _jsxs("div", { className: props.className, children: [_jsx("div", { className: "mb-3 text-lg font-semibold lg:mb-4.5", children: props.heading ?? 'Jackpots' }), jackpots.length > 0 ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "hidden flex-col gap-6 lg:flex", children: jackpots.map((jackpot) => (_jsx(JackpotContext, { value: jackpot, children: _jsx(JackpotItemDesktop, {}) }, jackpot.id))) }), _jsx("div", { className: "flex flex-col gap-6 lg:hidden", children: jackpots.map((jackpot) => (_jsx(JackpotContext, { value: jackpot, children: _jsx(JackpotItemMobile, {}) }, jackpot.id))) })] })) : (_jsxs("div", { className: "mt-11 flex flex-col items-center justify-center", children: [_jsx(Image, { width: 100, height: 100, src: closeChest, alt: "closeChest", quality: 100, className: "h-29.5 w-29.5 lg:h-25 lg:w-25 size-full mix-blend-luminosity" }), _jsx("div", { className: "text-text-primary-900 mt-4 text-base font-semibold", children: props.heading ?? 'Jackpots' }), _jsxs("div", { className: "text-text-tertiary-600 mt-1 text-center text-sm", children: ["No ", props.heading?.toLocaleLowerCase() ?? 'jackpots', " are running at the moment. ", _jsx("br", {}), "Please check back later!"] })] }))] }) }));
28
29
  }
@@ -1,10 +1,8 @@
1
- import type { GameProviderData } from '../../types';
1
+ import type { GameProvider } from '@opexa/portal-sdk-core';
2
2
  export interface JackpotsProps {
3
- /** @default "Promos" */
3
+ /** @default "Jackpots" */
4
4
  heading?: string;
5
- /** @default "/jackpots" */
6
- viewAllUrl?: string;
7
5
  className?: string;
8
- gameProviders: GameProviderData[];
6
+ gameProviders: GameProvider[];
9
7
  }
10
8
  export declare function Jackpots(props: JackpotsProps): Promise<import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1,4 @@
1
+ import type { Jackpot } from '@opexa/portal-sdk-core';
2
+ import type { JackpotsProps } from './Jackpots';
3
+ export declare const JackpotsPropsContext: import("react").Context<JackpotsProps>, useJackpotsPropsContext: () => JackpotsProps;
4
+ export declare const JackpotContext: import("react").Context<Jackpot>, useJackpotContext: () => Jackpot;
@@ -0,0 +1,3 @@
1
+ import { createContext } from '../../client/utils/index.js';
2
+ export const [JackpotsPropsContext, useJackpotsPropsContext] = createContext();
3
+ export const [JackpotContext, useJackpotContext] = createContext();
@@ -1,13 +1,7 @@
1
- import type { Jackpot } from '@opexa/portal-sdk-core';
2
- import type { GameProviderData } from '../../types';
3
- export interface JackpotItemProps {
4
- jackpot: Jackpot;
5
- gameProviders: GameProviderData[];
6
- }
7
- export declare function useJackpotItemData({ jackpot, gameProviders, }: JackpotItemProps): {
1
+ export declare function useJackpotItemData(): {
8
2
  jackpotPayouts: import("@opexa/portal-sdk-core").JackpotPayout[];
9
3
  topJackpotPayout: import("@opexa/portal-sdk-core").JackpotPayout;
10
- filteredGameProviders: GameProviderData[];
4
+ filteredGameProviders: import("../../types").GameProviderData[];
11
5
  localeInfo: import("../../utils").LocaleInfo;
12
6
  isPayingOut: boolean;
13
7
  jackpotAmount: string;
@@ -1,11 +1,17 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ // useJackpotItemData.ts
2
3
  import { useCallback, useMemo } from 'react';
3
4
  import { twMerge } from 'tailwind-merge';
4
5
  import { useLocaleInfo } from '../../client/hooks/index.js';
5
6
  import { useJackpotPayoutsQuery } from '../../client/hooks/useJackpotPayoutsQuery.js';
7
+ import { GAME_PROVIDER_DATA } from '../../constants/index.js';
6
8
  import { ChevronLeftIcon, ChevronRightIcon } from '../../icons/index.js';
7
9
  import styles from '../JackpotCounter/JackpotCounterItem.module.css';
8
- export function useJackpotItemData({ jackpot, gameProviders, }) {
10
+ import { useJackpotContext, useJackpotsPropsContext } from './JackpotsContext.js';
11
+ export function useJackpotItemData() {
12
+ const jackpotsProps = useJackpotsPropsContext();
13
+ const jackpot = useJackpotContext();
14
+ const gameProviders = jackpotsProps.gameProviders.map((provider) => GAME_PROVIDER_DATA[provider]);
9
15
  const jackpotPayoutsQuery = useJackpotPayoutsQuery({
10
16
  first: 30,
11
17
  filter: {
@@ -1,6 +1,21 @@
1
+ import type { GameProvider, GameType } from '@opexa/portal-sdk-core';
1
2
  import { type ImageProps } from 'next/image';
3
+ import type { GameProviderData } from '../../types';
2
4
  interface SearchProps {
3
5
  logo: ImageProps['src'];
6
+ gameTypes: GameType[];
7
+ gameProviders: GameProvider[];
8
+ /**
9
+ * @default '/providers/<slug>'
10
+ * @example
11
+ * ```ts
12
+ * '/bingo/:slug' // '/bingo/jili'
13
+ * '/bingo/:id' // '/bingo/JILI'
14
+ * // or using a function
15
+ * ({slug}) => `/bingo/${slug}`
16
+ * ```
17
+ */
18
+ viewGamesUrl?: string | ((gameProvider: GameProviderData) => string);
4
19
  }
5
20
  export declare function Search(props: SearchProps): import("react/jsx-runtime").JSX.Element;
6
21
  export {};
@@ -2,12 +2,14 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { Portal } from '@ark-ui/react';
4
4
  import Image, {} from 'next/image';
5
+ import Link from 'next/link';
5
6
  import { useRef, useState } from 'react';
6
7
  import { useShallow } from 'zustand/shallow';
7
8
  import { useGamesQuery, useGlobalStore } from '../../client/hooks/index.js';
9
+ import { GAME_PROVIDER_DATA } from '../../constants/index.js';
8
10
  import { SearchLgIcon, XIcon } from '../../icons/index.js';
9
- import providerHacksaw from '../../images/hacksaw-gaming.png';
10
11
  import { Button, Dialog, Field, IconButton, Presence } from '../../ui/index.js';
12
+ import { callIfFn } from '../../utils/index.js';
11
13
  import { GameLaunchTrigger } from '../GameLaunch/index.js';
12
14
  export function Search(props) {
13
15
  const globalStore = useGlobalStore(useShallow((ctx) => ({
@@ -18,20 +20,45 @@ export function Search(props) {
18
20
  const gamesQuery = useGamesQuery({
19
21
  first: 18,
20
22
  search,
23
+ filter: {
24
+ type: {
25
+ in: props.gameTypes,
26
+ },
27
+ provider: {
28
+ in: props.gameProviders,
29
+ },
30
+ },
21
31
  }, {
22
32
  enabled: search.length >= 3,
23
33
  });
24
34
  const games = gamesQuery.data?.pages
25
35
  .map((page) => page.edges.map((edge) => edge.node))
26
36
  .flat() ?? [];
27
- return (_jsx(Dialog.Root, { open: globalStore.search.open, onOpenChange: (details) => globalStore.search.setOpen(details.open), lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: "bg-bg-primary lg:min-h-auto mx-auto min-h-full w-full pt-xl lg:mt-[132px] lg:max-w-[1136px] lg:bg-unset lg:pt-0", children: [_jsx(Dialog.Context, { children: (api) => (_jsxs("div", { className: "flex items-center justify-between px-4 lg:hidden", children: [_jsx(Image, { src: props.logo, alt: "", width: 200, height: 40, className: "h-8 w-auto" }), _jsx(IconButton, { size: "sm", colorScheme: "gray", onClick: () => api.setOpen(false), children: _jsx(XIcon, { className: "text-text-quinary size-6" }) })] })) }), _jsx("div", { className: "flex justify-end", children: _jsx(Dialog.Context, { children: (api) => (_jsx("button", { type: "button", onClick: () => api.setOpen(false), className: "hidden size-9 items-center justify-center rounded-md bg-white/20 lg:flex", children: _jsx(XIcon, { className: "size-5 text-white" }) })) }) }), _jsx("div", { className: "mt-2xl px-4 lg:mt-xl lg:px-0", children: _jsxs("div", { className: "relative", children: [_jsx(SearchLgIcon, { className: "text-text-quinary pointer-events-none absolute left-3.5 top-1/2 size-5 -translate-y-1/2" }), _jsx(Field.Input, { ref: inputRef, type: "search", value: search, onChange: (e) => {
37
+ const gameProviders = props.gameProviders
38
+ .map((provider) => GAME_PROVIDER_DATA[provider])
39
+ .filter((provider) => provider.name
40
+ .toLowerCase()
41
+ .replace(/\s+/g, '')
42
+ .includes(search.toLowerCase().replace(/\s+/g, '')));
43
+ const empty = games.length <= 0 && gameProviders.length <= 0;
44
+ const viewGamesUrl = (data) => {
45
+ return props.viewGamesUrl
46
+ ? callIfFn(props.viewGamesUrl, data)
47
+ .replace(':id', data.id)
48
+ .replace(':slug', data.slug)
49
+ : `/providers/${data.slug}`;
50
+ };
51
+ return (_jsx(Dialog.Root, { open: globalStore.search.open, onOpenChange: (details) => {
52
+ globalStore.search.setOpen(details.open);
53
+ setSearch('');
54
+ }, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: "bg-bg-primary lg:min-h-auto mx-auto min-h-full w-full pt-xl lg:mt-[132px] lg:max-w-[1136px] lg:bg-unset lg:pt-0", children: [_jsx(Dialog.Context, { children: (api) => (_jsxs("div", { className: "flex items-center justify-between px-4 lg:hidden", children: [_jsx(Image, { src: props.logo, alt: "", width: 200, height: 40, className: "h-8 w-auto" }), _jsx(IconButton, { size: "sm", colorScheme: "gray", onClick: () => api.setOpen(false), children: _jsx(XIcon, { className: "text-text-quinary size-6" }) })] })) }), _jsx("div", { className: "flex justify-end", children: _jsx(Dialog.Context, { children: (api) => (_jsx("button", { type: "button", onClick: () => api.setOpen(false), className: "hidden size-9 items-center justify-center rounded-md bg-white/20 lg:flex", children: _jsx(XIcon, { className: "size-5 text-white" }) })) }) }), _jsx("div", { className: "mt-2xl px-4 lg:mt-xl lg:px-0", children: _jsxs("div", { className: "relative", children: [_jsx(SearchLgIcon, { className: "text-text-quinary pointer-events-none absolute left-3.5 top-1/2 size-5 -translate-y-1/2" }), _jsx(Field.Input, { ref: inputRef, type: "search", value: search, onChange: (e) => {
28
55
  setSearch(e.target.value);
29
56
  }, className: "pl-10 pr-16", placeholder: "Search", autoComplete: "off" }), _jsx(Presence, { present: search.length > 0, asChild: true, lazyMount: true, children: _jsx("button", { type: "button", className: "text-text-secondary-700 absolute right-3.5 top-1/2 -translate-y-1/2 font-semibold", onClick: () => {
30
57
  setSearch('');
31
58
  inputRef.current?.focus();
32
- }, children: "Clear" }) })] }) }), _jsx("div", { className: "lg:bg-bg-primary lg:border-border-primary mt-2xl p-xl pb-3xl lg:mt-2 lg:rounded-xl lg:border", children: search.length <= 0 ? (_jsx(Alert, { message: "Search for your favorite game or provider." })) : search.length >= 1 && search.length <= 2 ? (_jsx(Alert, { message: "Search requires at least 3 characters." })) : (_jsxs(_Fragment, { children: [games.length <= 0 && _jsx(Alert, { message: "No results found" }), games.length > 0 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "text-lg font-semibold", children: "Providers" }), _jsx("div", { className: "mb-3xl mt-3.5 grid grid-cols-3 gap-1.5 lg:grid-cols-9 lg:gap-3.5", children: _jsx("div", { className: "bg-gray-800 flex h-14 w-full items-center rounded-md", children: _jsx(Image, { src: providerHacksaw, alt: "", width: 100, height: 50, className: "mx-auto h-auto w-full" }) }) }), _jsx("h2", { className: "text-lg font-semibold", children: "Games" }), _jsx("div", { className: "mt-3.5 grid grid-cols-3 gap-1.5 lg:grid-cols-9 lg:gap-3.5", children: games.map((game) => (_jsxs(GameLaunchTrigger, { game: game, className: "block w-full shadow-sm", onClick: () => {
33
- globalStore.search.setOpen(false);
34
- }, children: [_jsx(Image, { src: game.image, alt: "", width: 200, height: 200, priority: true, className: "aspect-square w-full rounded-t-md object-cover" }), _jsx("span", { className: "bg-bg-tertiary text-text-primary-brand block w-full truncate rounded-b-md px-2 py-2.5 text-center text-xs font-semibold", children: game.name })] }, game.id))) }), _jsx(Presence, { present: gamesQuery.hasNextPage, children: _jsx(Button, { variant: "outline", className: "mx-auto mt-12 w-fit", onClick: () => gamesQuery.fetchNextPage(), children: "Load More" }) })] }))] })) })] }) })] }) }));
59
+ }, children: "Clear" }) })] }) }), _jsx("div", { className: "lg:bg-bg-primary lg:border-border-primary mt-2xl p-xl pb-3xl lg:mt-2 lg:rounded-xl lg:border", children: search.length <= 0 ? (_jsx(Alert, { message: "Search for your favorite game or provider." })) : search.length >= 1 && search.length <= 2 ? (_jsx(Alert, { message: "Search requires at least 3 characters." })) : (_jsxs(_Fragment, { children: [empty && _jsx(Alert, { message: "No results found" }), !empty && (_jsxs(_Fragment, { children: [gameProviders.length > 0 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "text-lg font-semibold", children: "Providers" }), _jsx("div", { className: "mt-3.5 grid grid-cols-3 gap-1.5 lg:grid-cols-9 lg:gap-3.5", children: gameProviders.map((provider) => (_jsx(Link, { href: viewGamesUrl(provider), "aria-label": `View ${provider.name} games`, className: "bg-gray-800 flex h-14 w-full items-center rounded-md", children: _jsx(Image, { src: provider.logo, alt: "", width: 100, height: 50, className: "mx-auto h-auto w-full" }) }, provider.id))) })] })), games.length > 0 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-3xl text-lg font-semibold", children: "Games" }), _jsx("div", { className: "mt-3.5 grid grid-cols-3 gap-1.5 lg:grid-cols-9 lg:gap-3.5", children: games.map((game) => (_jsxs(GameLaunchTrigger, { game: game, className: "block w-full shadow-sm", onClick: () => {
60
+ globalStore.search.setOpen(false);
61
+ }, children: [_jsx(Image, { src: game.image, alt: "", width: 200, height: 200, priority: true, className: "aspect-square w-full rounded-t-md object-cover" }), _jsx("span", { className: "bg-bg-tertiary text-text-primary-brand block w-full truncate rounded-b-md px-2 py-2.5 text-center text-xs font-semibold", children: game.name })] }, game.id))) })] })), _jsx(Presence, { present: gamesQuery.hasNextPage, children: _jsx(Button, { variant: "outline", className: "mx-auto mt-12 w-fit", onClick: () => gamesQuery.fetchNextPage(), children: "Load More" }) })] }))] })) })] }) })] }) }));
35
62
  }
36
63
  function Alert({ message }) {
37
64
  return (_jsxs("div", { className: "py-lg", role: "alert", "aria-live": "polite", children: [_jsx("div", { className: "bg-bg-secondary shadow-xs border-border-primary mx-auto flex size-12 items-center justify-center rounded-lg border", children: _jsx(SearchLgIcon, { className: "text-text-secondary-700 size-6" }) }), _jsx("p", { className: "text-text-secondary-700 mt-4 text-center", children: message })] }));
@@ -17,7 +17,7 @@ export function TopWins__client(props) {
17
17
  return (_jsxs("div", { className: props.className, children: [_jsx("div", { className: "mb-3 text-lg font-semibold md:mb-4", children: props.heading ?? 'Recent Big Wins' }), _jsx("div", { ref: emblaRef, className: "relative lg:overflow-hidden", children: _jsx("div", { className: "flex gap-sm lg:gap-md", children: topWins.map((topWin) => (_jsxs("div", { className: "bg-bg-tertiary border-border-primary flex w-[calc((100%-(0.375rem*2))/3)] shrink-0 flex-col space-y-2 rounded-sm border p-2 text-center lg:w-[calc((100%-(0.5rem*5))/6)] xl:w-[calc((100%-(0.5rem*9))/10)]", children: [_jsx("div", { className: "mx-auto aspect-square w-full", children: topWin.game && (_jsx(Image, { width: 100, height: 100, src: getGameImageUrl(topWin.game), alt: "", className: "size-full rounded-sm object-cover" })) }), _jsxs("div", { className: "space-y-0.5", children: [_jsx("div", { className: "text-text-secondary-700 text-xs", children: topWin.member.name }), _jsx("div", { className: "text-text-primary-brand text-sm font-semibold", children: formatNumber(topWin.payout, {
18
18
  currency: localeInfo.currency.code,
19
19
  minDecimalPlaces: 2,
20
- }) }), _jsx("div", { className: "text-text-secondary-700 text-xs", children: formatNumber(topWin.multiplier, {
21
- minDecimalPlaces: 2,
22
- }) })] })] }, topWin.id))) }) })] }));
20
+ }) }), _jsxs("div", { className: "text-text-secondary-700 text-xs", children: [formatNumber(topWin.multiplier, {
21
+ minDecimalPlaces: 2,
22
+ }), "x"] })] })] }, topWin.id))) }) })] }));
23
23
  }
@@ -0,0 +1 @@
1
+ export declare function TournamentItemDesktop(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,57 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import Image from 'next/image';
3
+ import React from 'react';
4
+ import { twMerge } from 'tailwind-merge';
5
+ import { Trophy01Icon, User01Icon } from '../../icons/index.js';
6
+ import { Award01Icon } from '../../icons/Award01Icon.js';
7
+ import { StarIcon } from '../../icons/StarIcon.js';
8
+ import firstPlace from '../../images/first-place.png';
9
+ import trophyTwo from '../../images/trophy-two.png';
10
+ import trophy from '../../images/trophy.png';
11
+ import { formatNumber, mask } from '../../utils/index.js';
12
+ import styles from '../JackpotCounter/JackpotCounterItem.module.css';
13
+ import { TournamentGameProviders } from './TournamentGameProviders.js';
14
+ import { TournamentRules } from './TournamentRules.js';
15
+ import { useTournamentContext } from './TournamentsContext.js';
16
+ import { useTournamentData } from './useTournamentData.js';
17
+ export function TournamentItemDesktop() {
18
+ const tournament = useTournamentContext();
19
+ const { prizeAmountsByRank, timeParts, tournamentReward, filteredGameProviders, localeInfo, } = useTournamentData();
20
+ return (_jsxs("div", { className: twMerge('bg-bg-tertiary border-border-primary rounded-2xl border'), children: [_jsxs("div", { className: twMerge('relative flex shrink-0 p-3 text-center lg:gap-6 lg:p-5'), children: [_jsx("div", { className: "z-1 relative flex flex-1 flex-col", children: _jsx("div", { className: "flex h-full flex-col justify-between", children: _jsx("div", { className: "flex w-full justify-between", children: _jsxs("div", { className: "flex w-full flex-col", children: [_jsxs("div", { className: "relative flex w-full justify-between", children: [_jsxs("div", { className: "w-full", children: [_jsxs("div", { className: "flex w-full justify-between", children: [_jsxs("div", { className: "border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700 flex h-fit w-fit items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium", children: [_jsx(Award01Icon, { className: "text-utility-brand-500 size-3.5" }), "Multiplier"] }), _jsx("div", { className: "flex h-fit", children: timeParts.map((part, idx) => (_jsxs(React.Fragment, { children: [_jsxs("div", { className: twMerge('bg-bg-primary text-text-primary-900 flex h-fit w-8 flex-col items-center rounded-[4px] pb-1.5'), children: [_jsx("span", { className: "text-base font-medium", children: String(part.value).padStart(2, '0') }), _jsx("span", { className: "text-[8px]", children: part.label })] }), idx < timeParts.length - 1 && (_jsxs("div", { className: "flex flex-col justify-center gap-[6px] px-[6px]", children: [_jsx("div", { className: "bg-bg-primary h-1 w-1 rounded-full" }), _jsx("div", { className: "bg-bg-primary h-1 w-1 rounded-full" })] }))] }, part.label))) })] }), _jsx("div", { className: "text-text-primary-900 mt-1 text-left text-lg font-medium lg:mt-5 lg:text-2xl", children: tournament.name }), _jsx("div", { className: "bg-bg-primary text-brand-400 mt-1.5 w-fit rounded-md px-2 py-1 text-2xl font-bold lg:mt-2 lg:text-4xl", children: formatNumber(tournamentReward, {
21
+ currency: localeInfo.currency.code,
22
+ minDecimalPlaces: 2,
23
+ maxDecimalPlaces: 2,
24
+ }) })] }), _jsx("div", { className: "z-1 bottom-[-60] right-0 block lg:absolute", children: _jsx("div", { className: "h-[155px] w-auto shrink-0", children: _jsx(Image, { quality: 100, width: 155, height: 155, src: trophy, alt: "trophy", className: "px-6 py-2.5" }) }) })] }), tournament.topPayouts.length ? (_jsx("div", { children: _jsxs("div", { className: "bg-bg-primary relative mt-4 hidden w-full gap-4 rounded-lg p-4 lg:flex", children: [_jsxs("div", { className: "bg-bg-tertiary relative flex h-18 w-18 items-center justify-center rounded-full", children: [_jsx(User01Icon, { className: "text-text-quarterary-500 size-9" }), _jsx("div", { className: "bg-yellow-400 text-brand-950 border-bg-primary absolute bottom-0 right-0 flex h-6 w-6 items-center justify-center rounded-full border-[1.5px] text-xs font-bold", children: "1st" })] }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700 flex h-fit w-fit items-center gap-1 rounded-sm border px-2 py-0.5 text-xs font-medium", children: [_jsx(Trophy01Icon, { className: "text-utility-brand-600 size-3.5" }), "Top Payout"] }), _jsx("div", { className: "font-semibold", children: mask(tournament?.topPayouts[0]?.member?.name || '') }), _jsx("div", { className: "text-brand-400 text-2xl", children: formatNumber(tournament?.topPayouts[0]?.amount, {
25
+ currency: localeInfo.currency.code,
26
+ minDecimalPlaces: 2,
27
+ maxDecimalPlaces: 2,
28
+ }) })] })] }) })) : (_jsxs("div", { className: "bg-bg-primary relative mt-4 hidden w-full gap-4 rounded-lg p-4 lg:flex", children: [_jsx(Image, { width: 66, height: 87, src: firstPlace, alt: "closeChest", className: "size-full h-auto w-[66px] mix-blend-luminosity" }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700 flex h-fit w-fit items-center gap-1 rounded-sm border px-2 py-0.5 text-xs font-medium", children: [_jsx(Trophy01Icon, { className: "text-utility-brand-600 size-3.5" }), "Top Payout"] }), _jsx("div", { className: "font-semibold", children: "No winners yet" }), _jsx("div", { className: "text-text-secondary-700 text-xs", children: "You could be the first to win the tournament!" })] })] }))] }) }) }) }), _jsxs("div", { className: "z-1 hidden flex-1 space-y-4 lg:block", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Image, { width: 24, height: 24, src: trophyTwo, quality: 100, alt: "leaderboardIcon", className: "size-full w-6" }), _jsx("div", { className: "text-text-primary-900 text-lg font-semibold", children: tournament.currentLeaderboard.edges.length
29
+ ? 'Leaderboard'
30
+ : 'Starting soon!' })] }), _jsx(TournamentRules, {})] }), _jsx("div", { className: twMerge('max-h-[272px] overflow-y-scroll', styles['scrollArea']), children: _jsx("div", { className: "border-gray-200 overflow-hidden rounded-xl", children: _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-bg-secondary text-text-tertiary-600 h-8 text-xs font-medium", children: [_jsx("th", { className: "w-[52px]", children: "#" }), _jsx("th", { children: "Player" }), _jsx("th", { children: "Multiplier" }), _jsx("th", { children: "Prize" })] }) }), _jsx("tbody", { children: tournament.currentLeaderboard.edges.length ? (_jsx(_Fragment, { children: tournament.currentLeaderboard.edges.map((tournament, i) => (_jsxs("tr", { className: "bg-bg-primary text-text-secondary-700 text-sm", children: [_jsx("td", { className: "border-border-secondary h-12 w-[52px] border-t-2", children: i + 1 < 6 ? (_jsxs("div", { className: "relative", children: [_jsx(StarIcon, { className: twMerge('mx-auto size-6.5', starTierStyles[i].starColor) }), _jsx("span", { className: twMerge('absolute inset-0 mt-0.5 flex items-center justify-center text-2xs font-bold', starTierStyles[i].numberColor), children: i + 1 })] })) : (i + 1) }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: mask(tournament.node.username) }), _jsxs("td", { className: "border-border-secondary h-12 border-t-2", children: [tournament.node.multiplier, "x"] }), i + 1 <= prizeAmountsByRank.length ? (_jsx("td", { className: "border-border-secondary text-brand-400 h-12 border-t-2", children: formatNumber(prizeAmountsByRank[i], {
31
+ currency: localeInfo.currency.code,
32
+ minDecimalPlaces: 2,
33
+ maxDecimalPlaces: 2,
34
+ }) })) : (_jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }))] }, i))) })) : (_jsx(_Fragment, { children: Array.from({ length: 10 }).map((_, i) => (_jsxs("tr", { className: "bg-bg-primary text-text-secondary-700 text-sm", children: [_jsx("td", { className: "border-border-secondary h-12 w-[52px] border-t-2", children: i + 1 < 6 ? (_jsxs("div", { className: "relative", children: [_jsx(StarIcon, { className: twMerge('mx-auto size-6.5', starTierStyles[i].starColor) }), _jsx("span", { className: twMerge('absolute inset-0 mt-0.5 flex items-center justify-center text-2xs font-bold', starTierStyles[i].numberColor), children: i + 1 })] })) : (i + 1) }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" })] }, i))) })) })] }) }) })] })] }), Boolean(filteredGameProviders.length) && (_jsx(TournamentGameProviders, { gameProviders: filteredGameProviders }))] }));
35
+ }
36
+ const starTierStyles = [
37
+ {
38
+ starColor: 'text-yellow-400',
39
+ numberColor: 'text-bg-primary',
40
+ },
41
+ {
42
+ starColor: 'text-utility-gray-700',
43
+ numberColor: 'text-bg-primary',
44
+ },
45
+ {
46
+ starColor: 'text-yellow-700',
47
+ numberColor: 'text-bg-primary',
48
+ },
49
+ {
50
+ starColor: 'text-bg-quaternary',
51
+ numberColor: 'text-text-primary-900',
52
+ },
53
+ {
54
+ starColor: 'text-bg-quaternary',
55
+ numberColor: 'text-text-primary-900',
56
+ },
57
+ ];
@@ -0,0 +1 @@
1
+ export declare function TournamentItemMobile(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,55 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import Image from 'next/image';
3
+ import React, { useState } from 'react';
4
+ import { twMerge } from 'tailwind-merge';
5
+ import { ArrowNarrowDownIcon, ArrowNarrowUpIcon, Award01Icon, StarIcon, Trophy01Icon, User01Icon, } from '../../icons/index.js';
6
+ import firstPlace from '../../images/first-place.png';
7
+ import trophy from '../../images/trophy.png';
8
+ import { Button } from '../../ui/index.js';
9
+ import { formatNumber, mask } from '../../utils/index.js';
10
+ import { TournamentGameProviders } from './TournamentGameProviders.js';
11
+ import { TournamentRules } from './TournamentRules.js';
12
+ import { useTournamentContext } from './TournamentsContext.js';
13
+ import { useTournamentData } from './useTournamentData.js';
14
+ export function TournamentItemMobile() {
15
+ const tournament = useTournamentContext();
16
+ const [isDetailsVisible, setIsDetailsVisible] = useState(false);
17
+ const { prizeAmountsByRank, timeParts, tournamentReward, filteredGameProviders, localeInfo, } = useTournamentData();
18
+ return (_jsxs("div", { className: "bg-bg-primary border-border-primary rounded-2xl border", children: [_jsx("div", { className: twMerge('bg-bg-tertiary relative flex shrink-0 rounded-2xl p-3 text-center lg:gap-4 lg:p-5'), children: _jsxs("div", { className: "z-1 relative flex flex-1 flex-col", children: [_jsx("div", { className: "flex h-full flex-col justify-between", children: _jsx("div", { className: "flex w-full justify-between", children: _jsx("div", { className: "flex w-full flex-col", children: _jsxs("div", { className: "relative flex w-full justify-between", children: [_jsxs("div", { className: "w-full", children: [_jsxs("div", { className: "flex w-full justify-between", children: [_jsxs("div", { className: "border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700 flex h-fit w-fit items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium", children: [_jsx(Award01Icon, { className: "text-utility-brand-500 size-3.5" }), "Multiplier"] }), _jsx("div", { className: "flex h-fit", children: timeParts.map((part, idx) => (_jsxs(React.Fragment, { children: [_jsxs("div", { className: twMerge('bg-bg-primary text-text-primary-900 flex h-fit w-8 flex-col items-center rounded-[4px] pb-1.5'), children: [_jsx("span", { className: "text-base font-medium", children: String(part.value).padStart(2, '0') }), _jsx("span", { className: "text-[8px]", children: part.label })] }), idx < timeParts.length - 1 && (_jsxs("div", { className: "flex flex-col justify-center gap-[6px] px-[6px]", children: [_jsx("div", { className: "bg-bg-primary h-1 w-1 rounded-full" }), _jsx("div", { className: "bg-bg-primary h-1 w-1 rounded-full" })] }))] }, part.label))) })] }), _jsx("div", { className: "text-text-primary-900 mt-2.5 text-left text-lg font-medium lg:mt-5 lg:text-2xl", children: tournament.name }), _jsx("div", { className: "bg-bg-primary text-brand-400 mt-1.5 w-fit rounded-md px-2 py-1 text-2xl font-bold lg:mt-2 lg:text-4xl", children: formatNumber(tournamentReward, {
19
+ currency: localeInfo.currency.code,
20
+ minDecimalPlaces: 2,
21
+ maxDecimalPlaces: 2,
22
+ }) })] }), _jsx("div", { className: "z-1 absolute bottom-[-60] right-0", children: _jsx(Image, { width: 72.94, height: 93, src: trophy, alt: "trophy", quality: 100, className: "size-full" }) })] }) }) }) }), tournament.topPayouts.length ? (_jsx("div", { children: _jsxs("div", { className: "bg-bg-primary relative mt-4 flex w-full gap-4 rounded-lg p-4", children: [_jsxs("div", { className: "bg-bg-tertiary relative flex h-18 w-18 items-center justify-center rounded-full", children: [_jsx(User01Icon, { className: "text-text-quarterary-500 size-9" }), _jsx("div", { className: "bg-yellow-400 text-brand-950 border-bg-primary absolute bottom-0 right-0 flex h-6 w-6 items-center justify-center rounded-full border-[1.5px] text-xs font-bold", children: "1st" })] }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700 flex h-fit w-fit items-center gap-1 rounded-sm border px-2 py-0.5 text-xs font-medium", children: [_jsx(Trophy01Icon, { className: "text-utility-brand-600 size-3.5" }), "Top Payout"] }), _jsx("div", { className: "font-semibold", children: mask(tournament?.topPayouts[0]?.member?.name || '') }), _jsx("div", { className: "text-brand-400 text-2xl", children: formatNumber(tournament?.topPayouts[0]?.amount, {
23
+ currency: localeInfo.currency.code,
24
+ minDecimalPlaces: 2,
25
+ maxDecimalPlaces: 2,
26
+ }) })] })] }) })) : (_jsxs("div", { className: "bg-bg-primary relative mt-4 flex w-full gap-4 rounded-lg p-4", children: [_jsx(Image, { width: 66, height: 87, src: firstPlace, alt: "closeChest", className: "size-full h-auto w-[66px] mix-blend-luminosity" }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700 flex h-fit w-fit items-center gap-1 rounded-sm border px-2 py-0.5 text-xs font-medium", children: [_jsx(Trophy01Icon, { className: "text-utility-brand-600 size-3.5" }), "Top Payout"] }), _jsx("div", { className: "font-semibold", children: "No winners yet" }), _jsx("div", { className: "text-text-secondary-700 text-xs", children: "You could be the first to win the tournament!" })] })] })), _jsx(Button, { variant: "outline", className: twMerge('mt-5.5 px-3.5 py-2.5 text-sm', isDetailsVisible ? 'hidden' : 'flex'), onClick: () => setIsDetailsVisible(!isDetailsVisible), children: _jsxs("div", { className: "flex gap-1.5", children: ["See Details", _jsx(ArrowNarrowDownIcon, { className: "size-5" })] }) })] }) }), isDetailsVisible && (_jsxs("div", { children: [_jsxs("div", { className: "z-1 flex-1", children: [_jsxs("div", { className: "flex items-center justify-between p-3", children: [_jsx("div", { className: "flex gap-2", children: _jsx("div", { className: "text-text-primary-900 text-lg font-semibold", children: tournament.currentLeaderboard.edges.length
27
+ ? 'Leaderboard'
28
+ : 'Starting soon!' }) }), _jsx(TournamentRules, {})] }), _jsx("div", { children: _jsx("div", { className: "border-gray-200 overflow-hidden", children: _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-bg-secondary text-text-tertiary-600 h-8 text-center text-xs font-medium", children: [_jsx("th", { className: "w-[52px]", children: "#" }), _jsx("th", { children: "Player" }), _jsx("th", { children: "Multiplier" }), _jsx("th", { children: "Prize" })] }) }), _jsx("tbody", { children: tournament.currentLeaderboard.edges.length ? (_jsx(_Fragment, { children: tournament.currentLeaderboard.edges.map((tournament, i) => (_jsxs("tr", { className: "bg-bg-primary text-text-secondary-700 text-center text-sm", children: [_jsx("td", { className: "border-border-secondary h-12 w-[52px] border-t-2", children: i + 1 < 6 ? (_jsxs("div", { className: "relative", children: [_jsx(StarIcon, { className: twMerge('mx-auto size-6.5', starTierStyles[i].starColor) }), _jsx("span", { className: twMerge('absolute inset-0 mt-0.5 flex items-center justify-center text-2xs font-bold', starTierStyles[i].numberColor), children: i + 1 })] })) : (i + 1) }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: mask(tournament.node.username) }), _jsxs("td", { className: "border-border-secondary h-12 border-t-2", children: [tournament.node.multiplier, "x"] }), i + 1 <= prizeAmountsByRank.length ? (_jsx("td", { className: "border-border-secondary text-brand-400 h-12 border-t-2", children: formatNumber(prizeAmountsByRank[i], {
29
+ currency: localeInfo.currency.code,
30
+ minDecimalPlaces: 2,
31
+ maxDecimalPlaces: 2,
32
+ }) })) : (_jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }))] }, i))) })) : (_jsx(_Fragment, { children: Array.from({ length: 5 }).map((_, i) => (_jsxs("tr", { className: "bg-bg-primary text-text-secondary-700 text-center text-sm", children: [_jsx("td", { className: "border-border-secondary h-12 w-[52px] border-t-2", children: i + 1 < 6 ? (_jsxs("div", { className: "relative", children: [_jsx(StarIcon, { className: twMerge('mx-auto size-6.5', starTierStyles[i].starColor) }), _jsx("span", { className: twMerge('absolute inset-0 mt-0.5 flex items-center justify-center text-2xs font-bold', starTierStyles[i].numberColor), children: i + 1 })] })) : (i + 1) }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" })] }, i))) })) })] }) }) })] }), Boolean(filteredGameProviders.length) && (_jsx(TournamentGameProviders, { gameProviders: filteredGameProviders })), _jsx("div", { className: "m-3", children: _jsx(Button, { variant: "outline", className: twMerge('px-3.5 py-2.5 text-sm', !isDetailsVisible ? 'hidden' : 'flex'), onClick: () => setIsDetailsVisible(!isDetailsVisible), children: _jsxs("div", { className: "flex gap-1.5", children: ["Hide", _jsx(ArrowNarrowUpIcon, { className: "size-5" })] }) }) })] }))] }));
33
+ }
34
+ const starTierStyles = [
35
+ {
36
+ starColor: 'text-yellow-400',
37
+ numberColor: 'text-bg-primary',
38
+ },
39
+ {
40
+ starColor: 'text-utility-gray-700',
41
+ numberColor: 'text-bg-primary',
42
+ },
43
+ {
44
+ starColor: 'text-yellow-700',
45
+ numberColor: 'text-bg-primary',
46
+ },
47
+ {
48
+ starColor: 'text-bg-quaternary',
49
+ numberColor: 'text-text-primary-900',
50
+ },
51
+ {
52
+ starColor: 'text-bg-quaternary',
53
+ numberColor: 'text-text-primary-900',
54
+ },
55
+ ];
@@ -1,6 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
2
  export interface TournamentRulesProps {
3
3
  children?: ReactNode;
4
- jackpotRules: string;
5
4
  }
6
5
  export declare function TournamentRules(props: TournamentRulesProps): import("react/jsx-runtime").JSX.Element;
@@ -4,6 +4,8 @@ import { Portal } from '@ark-ui/react';
4
4
  import { XIcon } from '../../icons/index.js';
5
5
  import { Flag06Icon } from '../../icons/Flag06Icon.js';
6
6
  import { Dialog } from '../../ui/index.js';
7
+ import { useTournamentContext } from './TournamentsContext.js';
7
8
  export function TournamentRules(props) {
8
- return (_jsxs(Dialog.Root, { lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: [_jsx(Dialog.Trigger, { asChild: true, children: props.children ?? (_jsx("button", { type: "button", className: "text-button-tertiary-fg flex text-sm font-semibold", children: "Tournament Rules" })) }), _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: "bg-bg-primary-alt mx-auto h-full w-full items-start lg:h-auto lg:w-[640px] lg:rounded-xl", children: [_jsxs("div", { className: "p-3xl", children: [_jsxs("div", { className: "mb-3 flex justify-between", children: [_jsx("div", { className: "bg-bg-tertiary border-border-primary flex h-12 w-12 items-center justify-center rounded-lg border", children: _jsx(Flag06Icon, { className: "text-text-tertiary-600 size-full p-3" }) }), _jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) })] }), _jsx("div", { className: "text-text-primary-900 text-lg font-semibold", children: "Tournament Rules" }), _jsx("div", { className: "text-text-tertiary-600 mt-1 text-sm", children: "Terms and Conditions" })] }), _jsx("div", { className: "border-gray-800 border-t-1 pb-3", children: _jsx("div", { dangerouslySetInnerHTML: { __html: props.jackpotRules }, className: "px-3xl py-3" }) })] }) })] })] }));
9
+ const tournament = useTournamentContext();
10
+ return (_jsxs(Dialog.Root, { lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: [_jsx(Dialog.Trigger, { asChild: true, children: props.children ?? (_jsx("button", { type: "button", className: "text-button-tertiary-fg flex text-sm font-semibold", children: "Tournament Rules" })) }), _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: "bg-bg-primary-alt mx-auto h-full w-full items-start lg:h-auto lg:w-[640px] lg:rounded-xl", children: [_jsxs("div", { className: "p-3xl", children: [_jsxs("div", { className: "mb-3 flex justify-between", children: [_jsx("div", { className: "bg-bg-tertiary border-border-primary flex h-12 w-12 items-center justify-center rounded-lg border", children: _jsx(Flag06Icon, { className: "text-text-tertiary-600 size-full p-3" }) }), _jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) })] }), _jsx("div", { className: "text-text-primary-900 text-lg font-semibold", children: "Tournament Rules" }), _jsx("div", { className: "text-text-tertiary-600 mt-1 text-sm", children: "Terms and Conditions" })] }), _jsx("div", { className: "border-gray-800 border-t-1 pb-3", children: _jsx("div", { dangerouslySetInnerHTML: { __html: tournament.description }, className: "px-3xl py-3" }) })] }) })] })] }));
9
11
  }
@@ -3,8 +3,9 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
3
3
  import Image from 'next/image';
4
4
  import { useTournamentsQuery } from '../../client/hooks/index.js';
5
5
  import closeChest from '../../images/close-chest.png';
6
- import { TournamentItemDesktop } from './TournamentItemDesktop.js';
7
- import { TournamentItemMobile } from './TournamentItemMobile.js';
6
+ import { TournamentItemDesktop } from './TournamentDesktop.js';
7
+ import { TournamentItemMobile } from './TournamentMobile.js';
8
+ import { TournamentContext, TournamentsPropsContext, } from './TournamentsContext.js';
8
9
  export function Tournaments__client(props) {
9
10
  const tournamentsQuery = useTournamentsQuery({
10
11
  first: 100,
@@ -15,5 +16,5 @@ export function Tournaments__client(props) {
15
16
  },
16
17
  });
17
18
  const tournaments = tournamentsQuery.data?.pages[0].edges.map((edge) => edge.node) ?? [];
18
- return (_jsxs("div", { className: props.className, children: [_jsx("div", { className: "mb-3 text-lg font-semibold lg:mb-4.5", children: props.heading ?? 'Tournaments' }), tournaments.length > 0 ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "hidden flex-col gap-6 lg:flex", children: tournaments.map((tournament, i) => (_jsx(TournamentItemDesktop, { tournament: tournament, gameProviders: props.gameProviders }, i))) }), _jsx("div", { className: "flex flex-col gap-6 lg:hidden", children: tournaments.map((tournament, i) => (_jsx(TournamentItemMobile, { tournament: tournament, gameProviders: props.gameProviders }, i))) })] })) : (_jsxs("div", { className: "mt-11 flex flex-col items-center justify-center", children: [_jsx(Image, { width: 100, height: 100, src: closeChest, alt: "closeChest", quality: 100, className: "h-29.5 w-29.5 lg:h-25 lg:w-25 size-full mix-blend-luminosity" }), _jsx("div", { className: "text-text-primary-900 mt-4 text-base font-semibold", children: props.heading ?? 'Tournaments' }), _jsxs("div", { className: "text-text-tertiary-600 mt-1 text-center text-sm", children: ["No ", props.heading?.toLocaleLowerCase() ?? 'tournaments', " are running at the moment. ", _jsx("br", {}), "Please check back later!"] })] }))] }));
19
+ return (_jsx(TournamentsPropsContext, { value: props, children: _jsxs("div", { className: props.className, children: [_jsx("div", { className: "mb-3 text-lg font-semibold lg:mb-4.5", children: props.heading ?? 'Tournaments' }), tournaments.length > 0 ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "hidden flex-col gap-6 lg:flex", children: tournaments.map((tournament) => (_jsx(TournamentContext, { value: tournament, children: _jsx(TournamentItemDesktop, {}) }, tournament.id))) }), _jsx("div", { className: "flex flex-col gap-6 lg:hidden", children: tournaments.map((tournament) => (_jsx(TournamentContext, { value: tournament, children: _jsx(TournamentItemMobile, {}) }, tournament.id))) })] })) : (_jsxs("div", { className: "mt-11 flex flex-col items-center justify-center", children: [_jsx(Image, { width: 100, height: 100, src: closeChest, alt: "closeChest", quality: 100, className: "h-29.5 w-29.5 lg:h-25 lg:w-25 size-full mix-blend-luminosity" }), _jsx("div", { className: "text-text-primary-900 mt-4 text-base font-semibold", children: props.heading ?? 'Tournaments' }), _jsxs("div", { className: "text-text-tertiary-600 mt-1 text-center text-sm", children: ["No ", props.heading?.toLocaleLowerCase() ?? 'tournaments', " are running at the moment. ", _jsx("br", {}), "Please check back later!"] })] }))] }) }));
19
20
  }
@@ -1,10 +1,8 @@
1
- import type { GameProviderData } from '../../types';
1
+ import type { GameProvider } from '@opexa/portal-sdk-core';
2
2
  export interface TournamentsProps {
3
3
  /** @default "Tournaments" */
4
4
  heading?: string;
5
- /** @default "/tournaments" */
6
- viewAllUrl?: string;
7
5
  className?: string;
8
- gameProviders: GameProviderData[];
6
+ gameProviders: GameProvider[];
9
7
  }
10
8
  export declare function Tournaments(props: TournamentsProps): Promise<import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1,4 @@
1
+ import type { Tournament } from '@opexa/portal-sdk-core';
2
+ import type { TournamentsProps } from './Tournaments';
3
+ export declare const TournamentsPropsContext: import("react").Context<TournamentsProps>, useTournamentsPropsContext: () => TournamentsProps;
4
+ export declare const TournamentContext: import("react").Context<Tournament>, useTournamentContext: () => Tournament;
@@ -0,0 +1,3 @@
1
+ import { createContext } from '../../client/utils/index.js';
2
+ export const [TournamentsPropsContext, useTournamentsPropsContext] = createContext();
3
+ export const [TournamentContext, useTournamentContext] = createContext();
@@ -0,0 +1,10 @@
1
+ export declare function useTournamentData(): {
2
+ timeParts: {
3
+ label: string;
4
+ value: number;
5
+ }[];
6
+ tournamentReward: number;
7
+ prizeAmountsByRank: number[];
8
+ filteredGameProviders: import("../../types").GameProviderData[];
9
+ localeInfo: import("../../utils").LocaleInfo;
10
+ };
@@ -0,0 +1,72 @@
1
+ // useJackpotItemData.ts
2
+ import { pick } from 'lodash-es';
3
+ import React, { useEffect, useMemo, useState } from 'react';
4
+ import { useLocaleInfo } from '../../client/hooks/index.js';
5
+ import { GAME_PROVIDER_DATA } from '../../constants/index.js';
6
+ import { useTournamentContext, useTournamentsPropsContext, } from './TournamentsContext.js';
7
+ export function useTournamentData() {
8
+ const tournamentsProps = useTournamentsPropsContext();
9
+ const tournament = useTournamentContext();
10
+ const gameProviders = tournamentsProps.gameProviders.map((provider) => GAME_PROVIDER_DATA[provider]);
11
+ const localeInfo = useLocaleInfo();
12
+ const [timeRemaining, setTimeRemaining] = useState({
13
+ days: 0,
14
+ hours: 0,
15
+ minutes: 0,
16
+ seconds: 0,
17
+ isPast: false,
18
+ });
19
+ const activationEndDateTime = useMemo(() => new Date(tournament.activationEndDateTime), [tournament.activationEndDateTime]);
20
+ const calculateRemainingTime = React.useCallback(() => {
21
+ const now = new Date();
22
+ const diffMs = activationEndDateTime.getTime() - now.getTime();
23
+ if (diffMs <= 0) {
24
+ setTimeRemaining({
25
+ days: 0,
26
+ hours: 0,
27
+ minutes: 0,
28
+ seconds: 0,
29
+ isPast: true,
30
+ });
31
+ return;
32
+ }
33
+ const diffSeconds = Math.floor(diffMs / 1000);
34
+ const days = Math.floor(diffSeconds / (3600 * 24));
35
+ const hours = Math.floor((diffSeconds % (3600 * 24)) / 3600);
36
+ const minutes = Math.floor((diffSeconds % 3600) / 60);
37
+ const seconds = diffSeconds % 60;
38
+ const updated = pick({ days, hours, minutes, seconds, isPast: false }, [
39
+ 'days',
40
+ 'hours',
41
+ 'minutes',
42
+ 'seconds',
43
+ 'isPast',
44
+ ]);
45
+ setTimeRemaining(updated);
46
+ }, [activationEndDateTime]);
47
+ useEffect(() => {
48
+ calculateRemainingTime();
49
+ const interval = setInterval(calculateRemainingTime, 1000); // Update every second
50
+ return () => clearInterval(interval);
51
+ }, [activationEndDateTime, calculateRemainingTime]);
52
+ const timeParts = [
53
+ { label: 'Day', value: timeRemaining.days },
54
+ { label: 'Hour', value: timeRemaining.hours },
55
+ { label: 'Min', value: timeRemaining.minutes },
56
+ { label: 'Sec', value: timeRemaining.seconds },
57
+ ];
58
+ const tournamentReward = Object.values(tournament.rewardSettings)
59
+ .map(Number)
60
+ .reduce((sum, val) => sum + val, 0);
61
+ const prizeAmountsByRank = Object.values(tournament.rewardSettings).map(Number);
62
+ const filteredGameProviders = gameProviders.filter((provider) => {
63
+ return tournament.enabledGameProviders.includes(provider.id);
64
+ });
65
+ return {
66
+ timeParts,
67
+ tournamentReward,
68
+ prizeAmountsByRank,
69
+ filteredGameProviders,
70
+ localeInfo,
71
+ };
72
+ }
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
3
  import { tz, TZDateMini } from '@date-fns/tz';
3
4
  import {} from '@opexa/portal-sdk-core';