@opexa/portal-components 0.0.85 β 0.0.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/hooks/useCreateGCashDepositMutation.js +2 -1
- package/dist/client/hooks/useCreateGCashWithdrawalMutation.js +2 -1
- package/dist/client/hooks/useCreateGameSessionMutation.js +2 -1
- package/dist/client/hooks/useCreateInstapayWithdrawalMutation.js +2 -1
- package/dist/client/hooks/useCreateMayaAppDepositMutation.js +2 -1
- package/dist/client/hooks/useCreateMayaAppWithdrawalMutation.js +2 -1
- package/dist/client/hooks/useCreateMayaDepositMutation.js +2 -1
- package/dist/client/hooks/useCreateMayaWithdrawalMutation.js +2 -1
- package/dist/client/hooks/useCreateOnlineBankDepositMutation.js +2 -1
- package/dist/client/hooks/useCreateQRPHDepositMutation.js +2 -1
- package/dist/components/Account/Account.d.ts +0 -2
- package/dist/components/Account/Account.js +10 -8
- package/dist/components/Account/AccountTrigger.d.ts +1 -2
- package/dist/components/Account/AccountTrigger.js +18 -6
- package/dist/components/Bonuses/BonusesTrigger.d.ts +1 -1
- package/dist/components/Bonuses/BonusesTrigger.js +3 -3
- package/dist/components/DepositWithdrawal/DepositWithdrawal.d.ts +1 -6
- package/dist/components/DepositWithdrawal/DepositWithdrawal.js +8 -19
- package/dist/components/DepositWithdrawal/DepositWithdrawalTrigger.d.ts +1 -1
- package/dist/components/DepositWithdrawal/DepositWithdrawalTrigger.js +12 -4
- package/dist/components/Jackpots/Jackpots.d.ts +3 -9
- package/dist/components/Jackpots/Jackpots.js +8 -2
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarousel.d.ts +20 -0
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarousel.js +64 -0
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselContext.d.ts +2 -0
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselContext.js +2 -0
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.d.ts +9 -0
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.js +107 -0
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +184 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsList.d.ts +11 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsList.js +29 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListContext.d.ts +4 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListContext.js +3 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +184 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItemDesktop.d.ts +1 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItemDesktop.js +44 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItemGameProviders.d.ts +5 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItemGameProviders.js +40 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItemMobile.d.ts +1 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItemMobile.js +45 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItemRules.d.ts +2 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItemRules.js +10 -0
- package/dist/components/Jackpots/JackpotsList/useJackpotsListItemData.d.ts +14 -0
- package/dist/components/Jackpots/JackpotsList/useJackpotsListItemData.js +92 -0
- package/dist/components/Messages/Message.d.ts +1 -4
- package/dist/components/Messages/Message.js +8 -9
- package/dist/components/Messages/MessageContext.d.ts +2 -0
- package/dist/components/Messages/MessageContext.js +2 -0
- package/dist/components/Messages/Messages.d.ts +0 -1
- package/dist/components/Messages/Messages.js +9 -8
- package/dist/components/Messages/MessagesTrigger.d.ts +1 -1
- package/dist/components/Messages/MessagesTrigger.js +8 -4
- package/dist/components/PortalProvider/Providers.js +1 -5
- package/dist/components/SignUp/SignUpForm.js +2 -1
- package/dist/components/Tournaments/Tournaments.d.ts +3 -7
- package/dist/components/Tournaments/Tournaments.js +8 -2
- package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarousel.d.ts +9 -0
- package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarousel.js +51 -0
- package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselContext.d.ts +2 -0
- package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselContext.js +2 -0
- package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.d.ts +6 -0
- package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.js +107 -0
- package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.module.css +184 -0
- package/dist/components/Tournaments/TournamentsList/TournamentItem.module.css +184 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsList.d.ts +9 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsList.js +20 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsListContext.d.ts +4 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsListContext.js +3 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsListItemDesktop.d.ts +1 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsListItemDesktop.js +55 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsListItemGameProviders.d.ts +5 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsListItemGameProviders.js +37 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsListItemMobile.d.ts +1 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsListItemMobile.js +55 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsListItemRules.d.ts +2 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsListItemRules.js +9 -0
- package/dist/components/Tournaments/TournamentsList/useTournamentListItemData.d.ts +10 -0
- package/dist/components/Tournaments/TournamentsList/useTournamentListItemData.js +71 -0
- package/dist/components/index.d.ts +0 -2
- package/dist/components/index.js +0 -2
- package/dist/handlers.js +1 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +1 -0
- package/dist/services/ObjectId.d.ts +0 -14
- package/dist/services/ObjectId.js +62 -76
- package/dist/services/ObjectType.d.ts +10 -0
- package/dist/services/ObjectType.js +10 -0
- package/dist/services/index.d.ts +4 -3
- package/dist/services/index.js +4 -3
- package/dist/styles/theme.css +2 -2
- package/dist/ui/AlertDialog/AlertDialog.d.ts +89 -89
- package/dist/ui/AlertDialog/AlertDialog.js +2 -1
- package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +8 -8
- package/dist/ui/AlertDialog/alertDialog.recipe.js +1 -1
- package/dist/ui/Avatar/Avatar.d.ts +1 -1
- package/dist/ui/Avatar/Avatar.js +1 -1
- package/dist/ui/Avatar/avatar.recipe.js +1 -1
- package/dist/ui/Badge/Badge.js +1 -1
- package/dist/ui/Button/Button.js +1 -1
- package/dist/ui/Checkbox/Checkbox.d.ts +24 -24
- package/dist/ui/Checkbox/Checkbox.js +1 -1
- package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
- package/dist/ui/Checkbox/checkbox.recipe.js +1 -1
- package/dist/ui/Clipboard/Clipboard.d.ts +19 -19
- package/dist/ui/Clipboard/Clipboard.js +1 -1
- package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
- package/dist/ui/Clipboard/clipboard.recipe.js +1 -1
- package/dist/ui/Collapsible/Collapsible.d.ts +21 -21
- package/dist/ui/Collapsible/Collapsible.js +1 -1
- package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
- package/dist/ui/Collapsible/collapsible.recipe.js +1 -1
- package/dist/ui/Combobox/Combobox.d.ts +43 -43
- package/dist/ui/Combobox/Combobox.js +1 -1
- package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
- package/dist/ui/Combobox/combobox.recipe.js +1 -1
- package/dist/ui/DatePicker/DatePicker.d.ts +265 -265
- package/dist/ui/DatePicker/DatePicker.js +1 -1
- package/dist/ui/DatePicker/datePicker.recipe.d.ts +11 -11
- package/dist/ui/DatePicker/datePicker.recipe.js +1 -1
- package/dist/ui/Dialog/Dialog.d.ts +89 -89
- package/dist/ui/Dialog/Dialog.js +2 -1
- package/dist/ui/Dialog/dialog.recipe.d.ts +8 -8
- package/dist/ui/Dialog/dialog.recipe.js +1 -1
- package/dist/ui/Drawer/Drawer.d.ts +34 -34
- package/dist/ui/Drawer/Drawer.js +2 -1
- package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
- package/dist/ui/Drawer/drawer.recipe.js +1 -1
- package/dist/ui/Field/Field.d.ts +1 -1
- package/dist/ui/Field/Field.js +1 -1
- package/dist/ui/Field/field.recipe.js +1 -1
- package/dist/ui/IconButton/IconButton.js +1 -1
- package/dist/ui/NumberInput/NumberInput.d.ts +1 -1
- package/dist/ui/NumberInput/NumberInput.js +1 -1
- package/dist/ui/NumberInput/numberInput.recipe.js +1 -1
- package/dist/ui/PasswordInput/PasswordInput.d.ts +1 -1
- package/dist/ui/PasswordInput/PasswordInput.js +1 -1
- package/dist/ui/PasswordInput/passwordInput.recipe.js +1 -1
- package/dist/ui/PinInput/PinInput.d.ts +1 -1
- package/dist/ui/PinInput/PinInput.js +1 -1
- package/dist/ui/PinInput/pinInput.recipe.js +1 -1
- package/dist/ui/Popover/Popover.d.ts +56 -56
- package/dist/ui/Popover/Popover.js +1 -1
- package/dist/ui/Popover/popover.recipe.d.ts +5 -5
- package/dist/ui/Popover/popover.recipe.js +1 -1
- package/dist/ui/Progress/Progress.d.ts +1 -1
- package/dist/ui/Progress/Progress.js +1 -1
- package/dist/ui/Progress/progress.recipe.js +1 -1
- package/dist/ui/SegmentGroup/SegmentGroup.d.ts +1 -1
- package/dist/ui/SegmentGroup/SegmentGroup.js +1 -1
- package/dist/ui/SegmentGroup/segmentGroup.recipe.js +1 -1
- package/dist/ui/Select/Select.d.ts +46 -46
- package/dist/ui/Select/Select.js +1 -1
- package/dist/ui/Select/select.recipe.d.ts +3 -3
- package/dist/ui/Select/select.recipe.js +1 -1
- package/dist/ui/Table/Table.d.ts +21 -21
- package/dist/ui/Table/Table.js +1 -1
- package/dist/ui/Table/table.recipe.d.ts +3 -3
- package/dist/ui/Tabs/Tabs.d.ts +16 -16
- package/dist/ui/Tabs/Tabs.js +1 -1
- package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
- package/dist/ui/Tabs/tabs.recipe.js +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/isStyleEntries.d.ts +2 -0
- package/dist/utils/isStyleEntries.js +5 -0
- package/package.json +27 -30
- package/dist/utils/graphqlRequest.d.ts +0 -4
- package/dist/utils/graphqlRequest.js +0 -255
- package/dist/utils/httpRequest.d.ts +0 -6
- package/dist/utils/httpRequest.js +0 -87
- package/dist/utils/sha256.d.ts +0 -4
- package/dist/utils/sha256.js +0 -16
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ObjectId } from '@opexa/object-id';
|
|
1
2
|
import { useMutation } from '@tanstack/react-query';
|
|
2
3
|
import invariant from 'tiny-invariant';
|
|
3
4
|
import { createGCashDeposit, getDeposit, } from '../../services/index.js';
|
|
4
|
-
import {
|
|
5
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
5
6
|
import { createPoll, getCreateGCashDepositMutationKey, getDepositsCountQueryKey, getQueryClient, } from '../../utils/index.js';
|
|
6
7
|
import { getSession } from '../services/index.js';
|
|
7
8
|
export const useCreateGCashDepositMutation = (config) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ObjectId } from '@opexa/object-id';
|
|
1
2
|
import { useMutation } from '@tanstack/react-query';
|
|
2
3
|
import invariant from 'tiny-invariant';
|
|
3
4
|
import { createGCashWithdrawal, } from '../../services/index.js';
|
|
4
|
-
import {
|
|
5
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
5
6
|
import { getCreateGCashWithdrawalMutationKey } from '../../utils/index.js';
|
|
6
7
|
import { getSession } from '../services/index.js';
|
|
7
8
|
export const useCreateGCashWithdrawalMutation = (config) => {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { ObjectId } from '@opexa/object-id';
|
|
1
2
|
import { useMutation } from '@tanstack/react-query';
|
|
2
3
|
import invariant from 'tiny-invariant';
|
|
3
4
|
import { LEGACY_GAME_PROVIDERS } from '../../constants/index.js';
|
|
4
5
|
import { createGameSession, createGameSession__legacy, getGameSession, getGameSession__legacy, } from '../../services/index.js';
|
|
5
|
-
import {
|
|
6
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
6
7
|
import { createPoll, getCreateGameSessionMutationKey } from '../../utils/index.js';
|
|
7
8
|
import { getSession } from '../services/index.js';
|
|
8
9
|
export const useCreateGameSessionMutation = (config) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ObjectId } from '@opexa/object-id';
|
|
1
2
|
import { useMutation } from '@tanstack/react-query';
|
|
2
3
|
import invariant from 'tiny-invariant';
|
|
3
4
|
import { createAIOInstapayWithdrawal, } from '../../services/index.js';
|
|
4
|
-
import {
|
|
5
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
5
6
|
import { getCreateInstapayWithdrawalMutationKey } from '../../utils/index.js';
|
|
6
7
|
import { getSession } from '../services/index.js';
|
|
7
8
|
export const useCreateInstapayWithdrawalMutation = (config) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ObjectId } from '@opexa/object-id';
|
|
1
2
|
import { useMutation } from '@tanstack/react-query';
|
|
2
3
|
import invariant from 'tiny-invariant';
|
|
3
4
|
import { createMayaAppDeposit, getDeposit, } from '../../services/index.js';
|
|
4
|
-
import {
|
|
5
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
5
6
|
import { createPoll, getCreateMayaAppDepositMutationKey, getDepositsCountQueryKey, getQueryClient, } from '../../utils/index.js';
|
|
6
7
|
import { getSession } from '../services/index.js';
|
|
7
8
|
export const useCreateMayaAppDepositMutation = (config) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ObjectId } from '@opexa/object-id';
|
|
1
2
|
import { useMutation } from '@tanstack/react-query';
|
|
2
3
|
import invariant from 'tiny-invariant';
|
|
3
4
|
import { createMayaAppWithdrawal, } from '../../services/index.js';
|
|
4
|
-
import {
|
|
5
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
5
6
|
import { getCreateMayaAppWithdrawalMutationKey } from '../../utils/index.js';
|
|
6
7
|
import { getSession } from '../services/index.js';
|
|
7
8
|
export const useCreateMayaAppWithdrawalMutation = (config) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ObjectId } from '@opexa/object-id';
|
|
1
2
|
import { useMutation } from '@tanstack/react-query';
|
|
2
3
|
import invariant from 'tiny-invariant';
|
|
3
4
|
import { createMayaDeposit, getDeposit, } from '../../services/index.js';
|
|
4
|
-
import {
|
|
5
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
5
6
|
import { createPoll, getCreateMayaDepositMutationKey, getDepositsCountQueryKey, getQueryClient, } from '../../utils/index.js';
|
|
6
7
|
import { getSession } from '../services/index.js';
|
|
7
8
|
export const useCreateMayaDepositMutation = (config) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ObjectId } from '@opexa/object-id';
|
|
1
2
|
import { useMutation } from '@tanstack/react-query';
|
|
2
3
|
import invariant from 'tiny-invariant';
|
|
3
4
|
import { createMayaWithdrawal, } from '../../services/index.js';
|
|
4
|
-
import {
|
|
5
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
5
6
|
import { getCreateMayaWithdrawalMutationKey } from '../../utils/index.js';
|
|
6
7
|
import { getSession } from '../services/index.js';
|
|
7
8
|
export const useCreateMayaWithdrawalMutation = (config) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ObjectId } from '@opexa/object-id';
|
|
1
2
|
import { useMutation } from '@tanstack/react-query';
|
|
2
3
|
import invariant from 'tiny-invariant';
|
|
3
4
|
import { createAIOOnlineBankDeposit, getDeposit, } from '../../services/index.js';
|
|
4
|
-
import {
|
|
5
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
5
6
|
import { createPoll, getCreateOnlineBankDepositMutationKey, getDepositsCountQueryKey, getQueryClient, } from '../../utils/index.js';
|
|
6
7
|
import { getSession } from '../services/index.js';
|
|
7
8
|
export const useCreateOnlineBankDepositMutation = (config) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ObjectId } from '@opexa/object-id';
|
|
1
2
|
import { useMutation } from '@tanstack/react-query';
|
|
2
3
|
import invariant from 'tiny-invariant';
|
|
3
4
|
import { createAIOQRPHDeposit, getDeposit, } from '../../services/index.js';
|
|
4
|
-
import {
|
|
5
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
5
6
|
import { createPoll, getCreateQRPHDepositMutationKey, getDepositsCountQueryKey, getQueryClient, } from '../../utils/index.js';
|
|
6
7
|
import { getSession } from '../services/index.js';
|
|
7
8
|
export const useCreateQRPHDepositMutation = (config) => {
|
|
@@ -6,9 +6,9 @@ import Link from 'next/link';
|
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
import { useShallow } from 'zustand/shallow';
|
|
8
8
|
import { useAccountQuery, useGlobalStore, useLocaleInfo, useSignOutMutation, useUnreadMessagesCountQuery, useWalletQuery, } from '../../client/hooks/index.js';
|
|
9
|
-
import { AlertCircleIcon, Bell01Icon, ChevronRightIcon, CoinsStacked02Icon, CoinsSwap02Icon, Gift01Icon, Logout01Icon, Settings02Icon,
|
|
9
|
+
import { AlertCircleIcon, Bell01Icon, ChevronRightIcon, CoinsStacked02Icon, CoinsSwap02Icon, Gift01Icon, Logout01Icon, Settings02Icon, } from '../../icons/index.js';
|
|
10
10
|
import avatarPlaceholder from '../../images/placeholder-avatar.png';
|
|
11
|
-
import { Badge, Button, Drawer,
|
|
11
|
+
import { Badge, Button, Drawer, Popover } from '../../ui/index.js';
|
|
12
12
|
import { formatNumber, parseDecimal } from '../../utils/index.js';
|
|
13
13
|
import { accountRecipe } from './account.recipe.js';
|
|
14
14
|
const recipe = accountRecipe();
|
|
@@ -25,17 +25,19 @@ export function Account(props) {
|
|
|
25
25
|
const [mobileOffsetTop, desktopOffsetTop] = Array.isArray(props.offsetTop)
|
|
26
26
|
? props.offsetTop
|
|
27
27
|
: [props.offsetTop ?? '0px', props.offsetTop ?? '0px'];
|
|
28
|
-
return (_jsxs(_Fragment, { children: [
|
|
28
|
+
return (_jsxs(_Fragment, { children: [_jsx(Drawer.Root, { open: globalStore.account__mobile.open, onOpenChange: (details) => {
|
|
29
29
|
globalStore.account__mobile.setOpen(details.open);
|
|
30
|
-
}, lazyMount: true, unmountOnExit: true, children:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
}, lazyMount: true, unmountOnExit: true, children: _jsx(Portal, { children: _jsx(Drawer.Positioner, { children: _jsxs(Drawer.Content, { className: twMerge('relative', 'flex', 'flex-col', 'top-[var(--offset-top-mobile)]', 'h-[calc(100%-var(--offset-top-mobile))]', 'w-full', 'px-xl', 'py-6', 'lg:top-[var(--offset-top-desktop)]', 'lg:h-[calc(100%-var(--offset-top-desktop))]'), style: {
|
|
31
|
+
['--offset-top-mobile']: mobileOffsetTop,
|
|
32
|
+
['--offset-top-desktop']: desktopOffsetTop,
|
|
33
|
+
}, children: [_jsx(Profile, {}), _jsx(Wallet, {}), _jsx(Links, { rewardsUrl: rewardsUrl, betRecordsUrl: betRecordsUrl, transactionsUrl: transactionsUrl, accountSettingsUrl: accountSettingsUrl, shouldShowSettings: shouldShowSettings })] }) }) }) }), _jsx(Popover.Root, { open: globalStore.account.open, onOpenChange: (details) => {
|
|
34
34
|
globalStore.account.setOpen(details.open);
|
|
35
35
|
}, lazyMount: true, unmountOnExit: true, positioning: {
|
|
36
36
|
placement: 'bottom',
|
|
37
37
|
strategy: 'fixed',
|
|
38
|
-
},
|
|
38
|
+
}, ids: {
|
|
39
|
+
trigger: 'opexa-portal-components:account-trigger',
|
|
40
|
+
}, children: _jsx(Portal, { children: _jsx(Popover.Positioner, { children: _jsxs(Popover.Content, { className: "border-border-primary bg-bg-primary relative z-popover w-[23.438rem] overflow-hidden rounded-xl border p-xl ui-open:animate-fade-in ui-closed:animate-fade-out", children: [_jsx(Profile, {}), _jsx(Wallet, {}), _jsx(Links, { rewardsUrl: rewardsUrl, betRecordsUrl: betRecordsUrl, transactionsUrl: transactionsUrl, accountSettingsUrl: accountSettingsUrl, shouldShowSettings: shouldShowSettings })] }) }) }) })] }));
|
|
39
41
|
}
|
|
40
42
|
function Profile() {
|
|
41
43
|
const accountQuery = useAccountQuery();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef } from 'react';
|
|
2
2
|
export interface AccountTriggerProps extends ComponentPropsWithRef<'button'> {
|
|
3
|
-
mobile?: boolean;
|
|
4
3
|
asChild?: boolean;
|
|
5
4
|
}
|
|
6
|
-
export declare function AccountTrigger(props: AccountTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function AccountTrigger({ asChild, children, ...props }: AccountTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { ark } from '@ark-ui/react';
|
|
4
|
+
import Image from 'next/image';
|
|
5
|
+
import { useMediaQuery } from 'usehooks-ts';
|
|
4
6
|
import { useShallow } from 'zustand/shallow';
|
|
5
7
|
import { useGlobalStore } from '../../client/hooks/index.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
import avatarPlaceholder from '../../images/placeholder-avatar.png';
|
|
9
|
+
import { IconButton } from '../../ui/index.js';
|
|
10
|
+
export function AccountTrigger({ asChild, children, ...props }) {
|
|
11
|
+
const desktop = useMediaQuery('(min-width: 1024px)', {
|
|
12
|
+
defaultValue: true,
|
|
13
|
+
});
|
|
14
|
+
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
15
|
+
account: ctx.account,
|
|
16
|
+
account__mobile: ctx.account__mobile,
|
|
17
|
+
})));
|
|
18
|
+
const disclosure = desktop
|
|
19
|
+
? globalStore.account
|
|
20
|
+
: globalStore.account__mobile;
|
|
21
|
+
return (_jsx(ark.button, { type: "button", "aria-label": "Toggle account menu", "data-open": disclosure.open ? 'open' : 'closed', ...props, onClick: (e) => {
|
|
22
|
+
disclosure.setOpen(!disclosure.open);
|
|
11
23
|
return props.onClick?.(e);
|
|
12
|
-
} }));
|
|
24
|
+
}, asChild: !children ? true : asChild, children: children ?? (_jsx(IconButton, { id: "opexa-portal-components:account-trigger", size: "sm", colorScheme: "gray", children: _jsx(Image, { src: avatarPlaceholder, alt: "", width: 64, height: 64, className: "size-10" }) })) }));
|
|
13
25
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef } from 'react';
|
|
2
2
|
interface BonusesTriggerProps extends ComponentPropsWithRef<'a'> {
|
|
3
3
|
}
|
|
4
|
-
export declare function BonusesTrigger(props: BonusesTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function BonusesTrigger({ children, className, ...props }: BonusesTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export {};
|
|
@@ -5,7 +5,7 @@ import { twMerge } from 'tailwind-merge';
|
|
|
5
5
|
import { useBonusesQuery, useCashbackBonusesQuery } from '../../client/hooks/index.js';
|
|
6
6
|
import { Gift01Icon } from '../../icons/index.js';
|
|
7
7
|
import { iconButtonRecipe } from '../../ui/IconButton/iconButton.recipe.js';
|
|
8
|
-
export function BonusesTrigger(props) {
|
|
8
|
+
export function BonusesTrigger({ children, className, ...props }) {
|
|
9
9
|
const bonusesQuery = useBonusesQuery({
|
|
10
10
|
refetchInterval: 10000,
|
|
11
11
|
});
|
|
@@ -18,6 +18,6 @@ export function BonusesTrigger(props) {
|
|
|
18
18
|
return (_jsx(Link, { "aria-label": "View Rewards", "data-count": totalCount, ...props, href: props.href ?? '/rewards', className: iconButtonRecipe({
|
|
19
19
|
size: 'sm',
|
|
20
20
|
colorScheme: 'gray',
|
|
21
|
-
className: twMerge('relative',
|
|
22
|
-
}), children:
|
|
21
|
+
className: twMerge('relative', className),
|
|
22
|
+
}), children: children ?? (_jsxs(_Fragment, { children: [totalCount > 0 && (_jsx("div", { className: "bg-brand-500 leading-4.5 text-button-primary-fg absolute -right-1.5 -top-1.5 min-w-5 rounded-full border px-1.5 text-2xs font-semibold", children: totalCount })), _jsx(Gift01Icon, {})] })) }));
|
|
23
23
|
}
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
|
|
2
|
-
interface DepositWithdrawalProps {
|
|
3
|
-
children?: ReactNode;
|
|
4
|
-
}
|
|
5
|
-
export declare function DepositWithdrawal(props: DepositWithdrawalProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export {};
|
|
1
|
+
export declare function DepositWithdrawal(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Portal } from '@ark-ui/react';
|
|
4
|
-
import { twMerge } from 'tailwind-merge';
|
|
5
4
|
import { z } from 'zod';
|
|
6
5
|
import { useShallow } from 'zustand/shallow';
|
|
7
6
|
import { useGlobalStore, useLocaleInfo, useWalletQuery, } from '../../client/hooks/index.js';
|
|
@@ -10,7 +9,7 @@ import { Dialog, IconButton, Tabs } from '../../ui/index.js';
|
|
|
10
9
|
import { formatNumber } from '../../utils/index.js';
|
|
11
10
|
import { Deposit } from './Deposit/Deposit.js';
|
|
12
11
|
import { Withdrawal } from './Withdrawal/Withdrawal.js';
|
|
13
|
-
export function DepositWithdrawal(
|
|
12
|
+
export function DepositWithdrawal() {
|
|
14
13
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
15
14
|
depositWithdrawal: ctx.depositWithdrawal,
|
|
16
15
|
})));
|
|
@@ -18,22 +17,12 @@ export function DepositWithdrawal(props) {
|
|
|
18
17
|
const walletQuery = useWalletQuery({
|
|
19
18
|
refetchInterval: 5000,
|
|
20
19
|
});
|
|
21
|
-
return (
|
|
20
|
+
return (_jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: globalStore.depositWithdrawal.open, onOpenChange: (details) => {
|
|
22
21
|
globalStore.depositWithdrawal.setOpen(details.open);
|
|
23
|
-
}, closeOnEscape: false, closeOnInteractOutside: false, children:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
function DefaulTrigger(props) {
|
|
31
|
-
const localeInfo = useLocaleInfo();
|
|
32
|
-
const walletQuery = useWalletQuery({
|
|
33
|
-
refetchInterval: 5000,
|
|
34
|
-
});
|
|
35
|
-
return (_jsxs("button", { type: "button", ...props, className: twMerge('flex', props.className), children: [_jsx("div", { className: "border-border-primary flex h-10 items-center rounded-l-md border border-r-0 px-3.5", children: formatNumber(walletQuery.data?.balance, {
|
|
36
|
-
currency: localeInfo.currency.code,
|
|
37
|
-
minDecimalPlaces: 2,
|
|
38
|
-
}) }), _jsx("div", { className: "bg-button-primary-bg text-button-primary-fg flex h-10 items-center gap-1.5 rounded-r-md px-3.5 text-sm font-semibold", children: "Deposit" })] }));
|
|
22
|
+
}, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)]", children: _jsxs(Dialog.Content, { className: "lg:min-h-auto mx-auto min-h-full w-full px-4 py-3xl lg:w-[480px] lg:rounded-xl", children: [_jsxs(Dialog.Header, { className: "flex items-center gap-xl", children: [_jsx("div", { className: "border-border-primary shadow-xs text-gray-700 text-text-secondary-700 flex size-10 items-center justify-center rounded-md border", children: _jsx(Wallet02Icon, { className: "size-5" }) }), _jsx(Dialog.Title, { className: "grow text-lg font-semibold", children: "Wallet" }), _jsx(Dialog.Context, { children: (api) => (_jsx(IconButton, { size: "sm", variant: "outline", colorScheme: "gray", onClick: () => api.setOpen(false), children: _jsx(XIcon, {}) })) })] }), _jsxs(Dialog.Body, { className: "mt-3xl", children: [_jsx("p", { className: "text-text-secondary-700 text-center text-sm", children: "Deposit Balance" }), _jsx("p", { className: "text-center text-3xl font-bold leading-tight tracking-tight", children: formatNumber(walletQuery.data?.balance, {
|
|
23
|
+
currency: localeInfo.currency.code,
|
|
24
|
+
minDecimalPlaces: 2,
|
|
25
|
+
}) }), _jsxs(Tabs.Root, { value: globalStore.depositWithdrawal.tab, onValueChange: (details) => {
|
|
26
|
+
globalStore.depositWithdrawal.setTab(z.enum(['DEPOSIT', 'WITHDRAWAL']).parse(details.value));
|
|
27
|
+
}, lazyMount: true, unmountOnExit: true, className: "mt-3xl space-y-4xl", children: [_jsxs(Tabs.List, { className: "w-full", children: [_jsx(Tabs.Trigger, { value: "DEPOSIT", className: "grow", children: "Deposit" }), _jsx(Tabs.Trigger, { value: "WITHDRAWAL", className: "grow", children: "Withdrawal" }), _jsx(Tabs.Indicator, {})] }), _jsx(Tabs.Content, { value: "DEPOSIT", className: "space-y-3xl", children: _jsx(Deposit, {}) }), _jsx(Tabs.Content, { value: "WITHDRAWAL", className: "space-y-3xl", children: _jsx(Withdrawal, {}) })] })] })] }) })] }) }));
|
|
39
28
|
}
|
|
@@ -2,4 +2,4 @@ import type { ComponentPropsWithRef } from 'react';
|
|
|
2
2
|
export interface DepositWithdrawalTriggerProps extends ComponentPropsWithRef<'button'> {
|
|
3
3
|
asChild?: boolean;
|
|
4
4
|
}
|
|
5
|
-
export declare function DepositWithdrawalTrigger(props: DepositWithdrawalTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function DepositWithdrawalTrigger({ asChild, children, ...props }: DepositWithdrawalTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { ark } from '@ark-ui/react';
|
|
4
4
|
import { useShallow } from 'zustand/shallow';
|
|
5
|
-
import { useGlobalStore, useSessionQuery } from '../../client/hooks/index.js';
|
|
6
|
-
|
|
5
|
+
import { useGlobalStore, useLocaleInfo, useSessionQuery, useWalletQuery, } from '../../client/hooks/index.js';
|
|
6
|
+
import { formatNumber } from '../../utils/index.js';
|
|
7
|
+
export function DepositWithdrawalTrigger({ asChild, children, ...props }) {
|
|
7
8
|
const sessionQuery = useSessionQuery();
|
|
8
9
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
9
10
|
depositWithdrawal: ctx.depositWithdrawal,
|
|
10
11
|
})));
|
|
12
|
+
const localeInfo = useLocaleInfo();
|
|
13
|
+
const walletQuery = useWalletQuery({
|
|
14
|
+
refetchInterval: 5000,
|
|
15
|
+
});
|
|
11
16
|
const disabled = sessionQuery.data?.status === 'unauthenticated'
|
|
12
17
|
? true
|
|
13
18
|
: globalStore.depositWithdrawal.open
|
|
@@ -17,5 +22,8 @@ export function DepositWithdrawalTrigger(props) {
|
|
|
17
22
|
props.onClick?.(e);
|
|
18
23
|
globalStore.depositWithdrawal.setTab('DEPOSIT');
|
|
19
24
|
globalStore.depositWithdrawal.setOpen(true);
|
|
20
|
-
}
|
|
25
|
+
}, asChild: !children ? true : asChild, children: children ?? (_jsxs("button", { type: "button", ...props, className: "flex", children: [_jsx("div", { className: "border-border-primary flex h-10 items-center rounded-l-md border border-r-0 px-3.5", children: formatNumber(walletQuery.data?.balance, {
|
|
26
|
+
currency: localeInfo.currency.code,
|
|
27
|
+
minDecimalPlaces: 2,
|
|
28
|
+
}) }), _jsx("div", { className: "bg-button-primary-bg text-button-primary-fg flex h-10 items-center gap-1.5 rounded-r-md px-3.5 text-sm font-semibold", children: "Deposit" })] })) }));
|
|
21
29
|
}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type
|
|
3
|
-
export
|
|
4
|
-
/** @default "Jackpots" */
|
|
5
|
-
heading?: string;
|
|
6
|
-
className?: string;
|
|
7
|
-
gameProviders: GameProvider[];
|
|
8
|
-
gameProviderImages?: Partial<Record<GameProvider, ImageProps['src']>>;
|
|
9
|
-
}
|
|
1
|
+
import { type JackpotsCarouselProps } from './JackpotsCarousel/JackpotsCarousel';
|
|
2
|
+
import { type JackpotsListProps } from './JackpotsList/JackpotsList';
|
|
3
|
+
export type JackpotsProps = JackpotsCarouselProps | JackpotsListProps;
|
|
10
4
|
export declare function Jackpots(props: JackpotsProps): Promise<import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { prefetchJackpotsQuery } from '../../server/utils/index.js';
|
|
3
|
-
import {
|
|
3
|
+
import { JackpotsCarousel, } from './JackpotsCarousel/JackpotsCarousel.js';
|
|
4
|
+
import { JackpotsList, } from './JackpotsList/JackpotsList.js';
|
|
4
5
|
export async function Jackpots(props) {
|
|
5
6
|
await prefetchJackpotsQuery({
|
|
6
7
|
first: 100,
|
|
@@ -17,5 +18,10 @@ export async function Jackpots(props) {
|
|
|
17
18
|
order: 'DESC',
|
|
18
19
|
},
|
|
19
20
|
});
|
|
20
|
-
|
|
21
|
+
if (props.layout === 'carousel') {
|
|
22
|
+
return _jsx(JackpotsCarousel, { ...props });
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return _jsx(JackpotsList, { ...props });
|
|
26
|
+
}
|
|
21
27
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
export interface ClassNameEntries {
|
|
3
|
+
root?: string;
|
|
4
|
+
itemRoot?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface StyleEntries {
|
|
7
|
+
root?: CSSProperties;
|
|
8
|
+
itemRoot?: CSSProperties;
|
|
9
|
+
}
|
|
10
|
+
export interface JackpotsCarouselProps {
|
|
11
|
+
layout: 'carousel';
|
|
12
|
+
/** @default "Promos" */
|
|
13
|
+
heading?: string;
|
|
14
|
+
/** @default "/jackpots" */
|
|
15
|
+
viewAllUrl?: string;
|
|
16
|
+
className?: string | ClassNameEntries;
|
|
17
|
+
style?: CSSProperties | StyleEntries;
|
|
18
|
+
animate?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare function JackpotsCarousel({ style, className, ...props }: JackpotsCarouselProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import useEmblaCarousel from 'embla-carousel-react';
|
|
4
|
+
import { isString } from 'lodash-es';
|
|
5
|
+
import Link from 'next/link';
|
|
6
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
7
|
+
import { useJackpotsQuery } from '../../../client/hooks/index.js';
|
|
8
|
+
import { ArrowLeftIcon, ArrowRightIcon, ChevronRightIcon, } from '../../../icons/index.js';
|
|
9
|
+
import { Button } from '../../../ui/index.js';
|
|
10
|
+
import { isStyleEntries } from '../../../utils/index.js';
|
|
11
|
+
import { JackpotsCarouselItemContext } from './JackpotsCarouselContext.js';
|
|
12
|
+
import { JackpotsCarouselItem } from './JackpotsCarouselItem.js';
|
|
13
|
+
export function JackpotsCarousel({ style, className, ...props }) {
|
|
14
|
+
const [emblaRef, emblaApi] = useEmblaCarousel({
|
|
15
|
+
align: 'start',
|
|
16
|
+
slidesToScroll: 1,
|
|
17
|
+
});
|
|
18
|
+
const scrollPrev = useCallback(() => {
|
|
19
|
+
if (emblaApi)
|
|
20
|
+
emblaApi.scrollPrev();
|
|
21
|
+
}, [emblaApi]);
|
|
22
|
+
const scrollNext = useCallback(() => {
|
|
23
|
+
if (emblaApi)
|
|
24
|
+
emblaApi.scrollNext();
|
|
25
|
+
}, [emblaApi]);
|
|
26
|
+
const [canScrollPrev, setCanScrollPrev] = useState(false);
|
|
27
|
+
const [canScrollNext, setCanScrollNext] = useState(false);
|
|
28
|
+
const onSelect = useCallback(() => {
|
|
29
|
+
if (!emblaApi)
|
|
30
|
+
return;
|
|
31
|
+
setCanScrollPrev(emblaApi.canScrollPrev());
|
|
32
|
+
setCanScrollNext(emblaApi.canScrollNext());
|
|
33
|
+
}, [emblaApi]);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (!emblaApi)
|
|
36
|
+
return;
|
|
37
|
+
onSelect();
|
|
38
|
+
emblaApi.on('select', onSelect);
|
|
39
|
+
emblaApi.on('reInit', onSelect);
|
|
40
|
+
}, [emblaApi, onSelect]);
|
|
41
|
+
const jackpotsQuery = useJackpotsQuery({
|
|
42
|
+
first: 100,
|
|
43
|
+
filter: {
|
|
44
|
+
status: {
|
|
45
|
+
equal: 'ACTIVE',
|
|
46
|
+
},
|
|
47
|
+
deleted: {
|
|
48
|
+
equal: false,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
sort: {
|
|
52
|
+
cursor: 'POOL',
|
|
53
|
+
order: 'DESC',
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
const jackpots = jackpotsQuery.data?.pages[0].edges.map((edge) => edge.node) ?? [];
|
|
57
|
+
if (jackpots.length <= 0)
|
|
58
|
+
return null;
|
|
59
|
+
const styles = isStyleEntries(style) ? style : { root: style };
|
|
60
|
+
const classNames = isString(className)
|
|
61
|
+
? { root: className }
|
|
62
|
+
: (className ?? {});
|
|
63
|
+
return (_jsxs("div", { style: styles.root, className: classNames.root, children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-lg font-semibold", children: props.heading ?? 'Jackpots' }), _jsxs("div", { className: "flex items-center md:gap-3xl", children: [_jsxs(Link, { href: props.viewAllUrl ?? '/jackpots', className: "text-button-tertiary-fg flex gap-sm text-sm font-semibold", children: ["See All", _jsx(ChevronRightIcon, { className: "size-5 lg:hidden" })] }), _jsxs("div", { className: "hidden lg:flex", children: [_jsx(Button, { disabled: !canScrollPrev, onClick: scrollPrev, variant: "outline", colorScheme: "gray", className: "rounded-r-none border-r-0", "aria-label": "Previous", children: _jsx(ArrowLeftIcon, { className: "size-5" }) }), _jsxs(Button, { disabled: !canScrollNext, onClick: scrollNext, variant: "outline", colorScheme: "gray", className: "rounded-l-none", "aria-label": "Next", children: [_jsx("span", { className: "sr-only", children: "Next" }), _jsx(ArrowRightIcon, { className: "size-5" })] })] })] })] }), _jsx("div", { className: "relative mt-lg lg:overflow-hidden", ref: emblaRef, children: _jsx("div", { className: "flex gap-2.5", children: jackpots.map((jackpot) => (_jsx(JackpotsCarouselItemContext, { value: jackpot, children: _jsx(JackpotsCarouselItem, { style: styles.itemRoot, className: classNames.itemRoot, viewAllUrl: props.viewAllUrl, animate: props.animate }) }, jackpot.id))) }) })] }));
|
|
64
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
export interface JackpotsCarouselItemProps {
|
|
3
|
+
style?: CSSProperties;
|
|
4
|
+
className?: string;
|
|
5
|
+
/** @default "/jackpots" */
|
|
6
|
+
viewAllUrl?: string;
|
|
7
|
+
animate?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function JackpotsCarouselItem({ style, className, viewAllUrl, animate, }: JackpotsCarouselItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Progress } from '@ark-ui/react';
|
|
4
|
+
import Image from 'next/image';
|
|
5
|
+
import Link from 'next/link';
|
|
6
|
+
import { useCallback, useMemo } from 'react';
|
|
7
|
+
import { twMerge } from 'tailwind-merge';
|
|
8
|
+
import { useLocaleInfo } from '../../../client/hooks/index.js';
|
|
9
|
+
import { useJackpotPayoutsQuery } from '../../../client/hooks/useJackpotPayoutsQuery.js';
|
|
10
|
+
import { ArrowNarrowUpRightIcon, ChevronLeftIcon, ChevronRightIcon, Trophy01Icon, User01Icon, } from '../../../icons/index.js';
|
|
11
|
+
import { StarIcon } from '../../../icons/StarIcon.js';
|
|
12
|
+
import closeChest from '../../../images/close-chest.png';
|
|
13
|
+
import firstPlace from '../../../images/first-place.png';
|
|
14
|
+
import leaderboard from '../../../images/leaderboard.png';
|
|
15
|
+
import openChest from '../../../images/open-chest.png';
|
|
16
|
+
import { formatNumber, getPercentage, mask } from '../../../utils/index.js';
|
|
17
|
+
import { useJackpotsCarouselItemContext } from './JackpotsCarouselContext.js';
|
|
18
|
+
import styles from './JackpotsCarouselItem.module.css';
|
|
19
|
+
export function JackpotsCarouselItem({ style, className, viewAllUrl, animate = true, }) {
|
|
20
|
+
const jackpot = useJackpotsCarouselItemContext();
|
|
21
|
+
const jackpotPayoutsQuery = useJackpotPayoutsQuery({
|
|
22
|
+
first: 30,
|
|
23
|
+
filter: {
|
|
24
|
+
jackpot: {
|
|
25
|
+
equal: jackpot.id,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
sort: {
|
|
29
|
+
cursor: 'AMOUNT',
|
|
30
|
+
order: 'DESC',
|
|
31
|
+
},
|
|
32
|
+
}, {
|
|
33
|
+
enabled: typeof window !== 'undefined',
|
|
34
|
+
});
|
|
35
|
+
const jackpotPayouts = jackpotPayoutsQuery.data?.pages[0].edges.map((edge) => edge.node) ?? [];
|
|
36
|
+
const topJackpotPayout = jackpotPayouts[0] ?? [];
|
|
37
|
+
const localeInfo = useLocaleInfo();
|
|
38
|
+
const isPayingOut = jackpot.drawing;
|
|
39
|
+
const jackpotAmount = isPayingOut
|
|
40
|
+
? jackpot.maximumJackpotPoolLimit
|
|
41
|
+
: jackpot.pool;
|
|
42
|
+
const Arrow = useCallback(({ index }) => {
|
|
43
|
+
const Icon = isPayingOut ? ChevronLeftIcon : ChevronRightIcon;
|
|
44
|
+
return (_jsx(Icon, { className: twMerge('scale-400 lg:scale-250 text-brand-300 min-w-2.5 lg:min-w-4', isPayingOut
|
|
45
|
+
? styles['animate-wave-color-error']
|
|
46
|
+
: styles['animate-wave-color-success']), style: {
|
|
47
|
+
animationDelay: isPayingOut
|
|
48
|
+
? `${(40 - index - 1) * 0.1}s`
|
|
49
|
+
: `${index * 0.1}s`,
|
|
50
|
+
} }));
|
|
51
|
+
}, [isPayingOut]);
|
|
52
|
+
const arrowImages = useMemo(() => Array.from({ length: 40 }, (_, i) => (_jsx(Arrow, { isFirst: i === 0, index: i }, i))), [Arrow]);
|
|
53
|
+
return (_jsxs("div", { className: twMerge('bg-bg-tertiary border-border-primary relative flex w-full shrink-0 rounded-2xl border p-3 text-center lg:gap-4 lg:p-5', className), style: style, 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: _jsxs("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, {
|
|
54
|
+
currency: localeInfo.currency.code,
|
|
55
|
+
minDecimalPlaces: 2,
|
|
56
|
+
maxDecimalPlaces: 2,
|
|
57
|
+
}) })] }), _jsx("div", { className: "z-1 bottom-[-60] right-0 lg:absolute", children: _jsx(Image, { width: 150, height: 150, src: isPayingOut ? openChest : closeChest, alt: "closeChest", quality: 100, className: "h-25 w-25 lg:h-37.5 lg:w-37.5 size-full p-2" }) })] }), topJackpotPayout.amount ? (_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: topJackpotPayout.member.name }), _jsx("div", { className: "text-brand-400 text-2xl", children: formatNumber(topJackpotPayout.amount, {
|
|
58
|
+
currency: localeInfo.currency.code,
|
|
59
|
+
minDecimalPlaces: 2,
|
|
60
|
+
maxDecimalPlaces: 2,
|
|
61
|
+
}) })] })] }) })) : (_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: "firstPlace", 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: "mt-3 lg:mt-4", children: [_jsxs("div", { className: "mb-1 flex justify-between", children: [_jsx("div", { className: "text-text-primary-900 text-xs font-semibold", children: formatNumber(0, {
|
|
62
|
+
currency: localeInfo.currency.code,
|
|
63
|
+
compact: true,
|
|
64
|
+
}) }), _jsxs("div", { className: "relative flex items-center justify-end gap-1.5", children: [isPayingOut ? (_jsxs("div", { className: "flex w-6 items-center", children: [_jsx("div", { className: twMerge('absolute left-0', styles['animate-arrow-red-flash-1']), children: _jsx(ChevronLeftIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge('absolute left-1.5', styles['animate-arrow-red-flash-2']), children: _jsx(ChevronLeftIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge('absolute left-3', styles['animate-arrow-red-flash-3']), children: _jsx(ChevronLeftIcon, { className: "size-4.5" }) })] })) : (_jsxs("div", { className: "flex w-6 items-center", children: [_jsx("div", { className: twMerge('absolute left-0', styles['animate-arrow-green-flash-1']), children: _jsx(ChevronRightIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge('absolute left-1.5', styles['animate-arrow-green-flash-2']), children: _jsx(ChevronRightIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge('absolute left-3', styles['animate-arrow-green-flash-3']), children: _jsx(ChevronRightIcon, { className: "size-4.5" }) })] })), _jsx("div", { className: "text-text-primary-900 text-xs font-semibold", children: formatNumber(jackpot?.maximumJackpotPoolLimit, {
|
|
65
|
+
currency: localeInfo.currency.code,
|
|
66
|
+
compact: true,
|
|
67
|
+
}) })] })] }), _jsx(Progress.Root, { className: "bg-bg-primary h-2 w-full rounded-full lg:h-4", max: 100, value: getPercentage(jackpot.pool, jackpot.maximumJackpotPoolLimit), children: _jsx(Progress.Track, { className: "bg-bg-primary h-full overflow-hidden rounded-full", children: _jsx(Progress.Range, { className: "bg-brand-500 relative h-full overflow-hidden rounded-full pl-1.5", children: _jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-start pl-1.5", "aria-hidden": "true", children: arrowImages }) }) }) }), _jsx("div", { className: "mt-1 block text-start text-2xs lg:hidden", children: isPayingOut
|
|
68
|
+
? `The pot has hit ${formatNumber(jackpot?.maximumJackpotPoolLimit, {
|
|
69
|
+
currency: localeInfo.currency.code,
|
|
70
|
+
compact: true,
|
|
71
|
+
})} Play now for your chance to win big! π₯`
|
|
72
|
+
: getAccumulatingJackpotDescription(Number(jackpot?.pool) ?? 0, Number(jackpot?.maximumJackpotPoolLimit) ?? 0) })] })] }), _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 gap-2", children: [_jsx(Image, { width: 24, height: 24, src: leaderboard, quality: 100, alt: "leaderboardIcon", className: "size-full h-auto w-6" }), _jsx("div", { className: "text-text-primary-900 text-lg font-semibold", children: jackpotPayouts.length ? 'Recent payouts' : 'Starting soon!' })] }), _jsxs(Link, { className: "text-button-tertiary-fg flex text-sm font-semibold", href: viewAllUrl ?? '/jackpots', children: ["See details", _jsx(ChevronRightIcon, { className: "size-5" })] })] }), _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", { 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-sm", children: [_jsx("td", { className: "border-border-secondary h-12 border-t-2", children: mask(jackpotPayout.member.name, {
|
|
73
|
+
totalCharsCount: 6,
|
|
74
|
+
}) }), _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, {
|
|
75
|
+
currency: localeInfo.currency.code,
|
|
76
|
+
minDecimalPlaces: 2,
|
|
77
|
+
maxDecimalPlaces: 2,
|
|
78
|
+
}) })] }, 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))) })) })] }) }) })] }), isPayingOut && animate && (_jsx("div", { className: twMerge(styles['light-rays'], 'absolute right-0 top-0 rounded-2xl [--light-rays-top:25%] lg:[--light-rays-top:150px]') }))] }));
|
|
79
|
+
}
|
|
80
|
+
const getAccumulatingJackpotDescription = (part, total) => {
|
|
81
|
+
const percentage = total === 0 ? 0 : (part / total) * 100;
|
|
82
|
+
return percentage <= 90
|
|
83
|
+
? 'The jackpot is heating up! Keep playing to stay in the action and watch it grow!'
|
|
84
|
+
: 'π₯ Itβs about to pop! Stay in the game for your shot at the prize!';
|
|
85
|
+
};
|
|
86
|
+
const starTierStyles = [
|
|
87
|
+
{
|
|
88
|
+
starColor: 'text-yellow-400',
|
|
89
|
+
numberColor: 'text-bg-primary',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
starColor: 'text-utility-gray-700',
|
|
93
|
+
numberColor: 'text-bg-primary',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
starColor: 'text-yellow-700',
|
|
97
|
+
numberColor: 'text-bg-primary',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
starColor: 'text-bg-quaternary',
|
|
101
|
+
numberColor: 'text-text-primary-900',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
starColor: 'text-bg-quaternary',
|
|
105
|
+
numberColor: 'text-text-primary-900',
|
|
106
|
+
},
|
|
107
|
+
];
|