@opexa/portal-components 0.0.69 → 0.0.71
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/useGamesQuery.d.ts +2 -2
- package/dist/client/hooks/useGamesQuery.js +2 -2
- package/dist/components/Account/Account.d.ts +2 -0
- package/dist/components/Account/Account.js +17 -16
- package/dist/components/BetRecords/BetRecords.js +10 -15
- package/dist/components/GameProviders/GameProviders.d.ts +14 -2
- package/dist/components/GameProviders/GameProviders.js +12 -2
- package/dist/components/Jackpots/JackpotItemDesktop.d.ts +1 -9
- package/dist/components/Jackpots/JackpotItemDesktop.js +5 -3
- package/dist/components/Jackpots/JackpotItemMobile.d.ts +1 -9
- package/dist/components/Jackpots/JackpotItemMobile.js +5 -3
- package/dist/components/Jackpots/JackpotRules.d.ts +0 -1
- package/dist/components/Jackpots/JackpotRules.js +3 -1
- package/dist/components/Jackpots/Jackpots.client.js +2 -1
- package/dist/components/Jackpots/Jackpots.d.ts +3 -5
- package/dist/components/Jackpots/JackpotsContext.d.ts +4 -0
- package/dist/components/Jackpots/JackpotsContext.js +3 -0
- package/dist/components/Jackpots/useJackpotItemData.d.ts +2 -8
- package/dist/components/Jackpots/useJackpotItemData.js +7 -1
- package/dist/components/Search/Search.d.ts +15 -0
- package/dist/components/Search/Search.js +32 -5
- package/dist/components/TopWins/TopWins.client.js +3 -3
- package/dist/components/Tournaments/TournamentDesktop.d.ts +1 -0
- package/dist/components/Tournaments/TournamentDesktop.js +57 -0
- package/dist/components/Tournaments/TournamentMobile.d.ts +1 -0
- package/dist/components/Tournaments/TournamentMobile.js +55 -0
- package/dist/components/Tournaments/TournamentRules.d.ts +0 -1
- package/dist/components/Tournaments/TournamentRules.js +3 -1
- package/dist/components/Tournaments/Tournaments.client.js +4 -3
- package/dist/components/Tournaments/Tournaments.d.ts +2 -4
- package/dist/components/Tournaments/TournamentsContext.d.ts +4 -0
- package/dist/components/Tournaments/TournamentsContext.js +3 -0
- package/dist/components/Tournaments/useTournamentData.d.ts +10 -0
- package/dist/components/Tournaments/useTournamentData.js +72 -0
- package/dist/components/TransactionRecords/DepositRecordsTable.js +1 -0
- package/dist/components/TransactionRecords/TableFilters.d.ts +1 -7
- package/dist/components/TransactionRecords/TableFilters.js +1 -53
- package/dist/components/TransactionRecords/TransactionRecords.d.ts +0 -3
- package/dist/components/TransactionRecords/TransactionRecords.js +0 -1
- package/dist/components/TransactionRecords/TransactionRecordsTable.js +1 -0
- package/dist/components/TransactionRecords/WithdrawalRecordsTable.js +1 -0
- package/dist/constants/envVars.d.ts +5 -0
- package/dist/constants/envVars.js +28 -0
- package/dist/constants/gameProviders.d.ts +4 -0
- package/dist/constants/gameProviders.js +311 -0
- package/dist/constants/gameTypes.d.ts +4 -0
- package/dist/constants/gameTypes.js +64 -0
- package/dist/constants/headerKeys.d.ts +1 -0
- package/dist/constants/headerKeys.js +1 -0
- package/dist/constants/index.d.ts +6 -12
- package/dist/constants/index.js +6 -88
- package/dist/constants/secretQuestions.d.ts +3 -0
- package/dist/constants/secretQuestions.js +24 -0
- package/dist/constants/storageKeys.d.ts +2 -0
- package/dist/constants/storageKeys.js +2 -0
- package/dist/images/game-providers/ALIZE.png +0 -0
- package/dist/images/game-providers/BGAMING.png +0 -0
- package/dist/images/game-providers/BOOOONGO.png +0 -0
- package/dist/images/game-providers/BTI.png +0 -0
- package/dist/images/game-providers/CQ9.png +0 -0
- package/dist/images/game-providers/DG.png +0 -0
- package/dist/images/game-providers/E2E.png +0 -0
- package/dist/images/game-providers/EVOLUTION_NETENT.png +0 -0
- package/dist/images/game-providers/EVOPLAY.png +0 -0
- package/dist/images/game-providers/EZUGI.png +0 -0
- package/dist/images/game-providers/FACHAI.png +0 -0
- package/dist/images/game-providers/HABANERO.png +0 -0
- package/dist/images/game-providers/HACKSAW.png +0 -0
- package/dist/images/game-providers/JDB.png +0 -0
- package/dist/images/game-providers/JDB_GTF.png +0 -0
- package/dist/images/game-providers/JDB_SPRIBE.png +0 -0
- package/dist/images/game-providers/JILI.png +0 -0
- package/dist/images/game-providers/JOKER.png +0 -0
- package/dist/images/game-providers/KINGMAKER.png +0 -0
- package/dist/images/game-providers/KINGMIDAS.png +0 -0
- package/dist/images/game-providers/MICROGAMING.png +0 -0
- package/dist/images/game-providers/ONEAPI.png +0 -0
- package/dist/images/game-providers/PGSOFT.png +0 -0
- package/dist/images/game-providers/PLAYTECH.png +0 -0
- package/dist/images/game-providers/PRAGMATIC_PLAY.png +0 -0
- package/dist/images/game-providers/RELAX_GAMING.png +0 -0
- package/dist/images/game-providers/SABA.png +0 -0
- package/dist/images/game-providers/SPINIX.png +0 -0
- package/dist/images/game-providers/SPRIBE.png +0 -0
- package/dist/images/game-providers/YELLOWBAT.png +0 -0
- package/dist/server/utils/prefetchGamesQuery.d.ts +2 -2
- package/dist/server/utils/prefetchGamesQuery.js +2 -2
- package/dist/types/index.d.ts +6 -1
- package/dist/ui/AlertDialog/AlertDialog.d.ts +88 -88
- package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +8 -8
- package/dist/ui/Badge/Badge.d.ts +12 -12
- package/dist/ui/Badge/badge.recipe.d.ts +3 -3
- package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
- package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
- package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
- package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
- package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
- package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
- package/dist/ui/Combobox/Combobox.d.ts +42 -42
- package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
- package/dist/ui/DatePicker/DatePicker.d.ts +336 -336
- package/dist/ui/DatePicker/datePicker.recipe.d.ts +14 -14
- package/dist/ui/Dialog/Dialog.d.ts +88 -88
- package/dist/ui/Dialog/dialog.recipe.d.ts +8 -8
- package/dist/ui/Drawer/Drawer.d.ts +33 -33
- package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
- package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
- package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
- package/dist/ui/Popover/Popover.d.ts +88 -88
- package/dist/ui/Popover/popover.recipe.d.ts +8 -8
- package/dist/ui/Progress/Progress.d.ts +27 -27
- package/dist/ui/Progress/progress.recipe.d.ts +3 -3
- package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
- package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
- package/dist/ui/Select/Select.d.ts +45 -45
- package/dist/ui/Select/select.recipe.d.ts +3 -3
- package/dist/ui/Table/Table.d.ts +21 -21
- package/dist/ui/Table/table.recipe.d.ts +3 -3
- package/dist/ui/Tabs/Tabs.d.ts +15 -15
- package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
- package/dist/utils/callIfFn.d.ts +1 -0
- package/dist/utils/callIfFn.js +6 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/queryKeys.d.ts +2 -2
- package/package.json +6 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type Game, type
|
|
1
|
+
import { type Game, type GamesInput__Next, type PaginatedQueryResult } from '@opexa/portal-sdk-core';
|
|
2
2
|
import type { InfiniteQuery } from '../../types';
|
|
3
|
-
export declare const useGamesQuery: InfiniteQuery<PaginatedQueryResult<Game>,
|
|
3
|
+
export declare const useGamesQuery: InfiniteQuery<PaginatedQueryResult<Game>, GamesInput__Next>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getGames__next, } from '@opexa/portal-sdk-core';
|
|
2
2
|
import { useInfiniteQuery } from '@tanstack/react-query';
|
|
3
3
|
import { ENVIRONMENT, PLATFORM_ID, SITE_ID } from '../../constants/index.js';
|
|
4
4
|
import { getGamesQueryKey } from '../../utils/index.js';
|
|
@@ -10,7 +10,7 @@ export const useGamesQuery = (input, config) => {
|
|
|
10
10
|
...config,
|
|
11
11
|
queryKey: getGamesQueryKey(input),
|
|
12
12
|
queryFn: ({ pageParam, signal }) => {
|
|
13
|
-
return
|
|
13
|
+
return getGames__next({
|
|
14
14
|
...input,
|
|
15
15
|
after: pageParam,
|
|
16
16
|
}, {
|
|
@@ -6,7 +6,7 @@ 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, ChevronRightIcon, CoinsStacked02Icon, CoinsSwap02Icon, Gift01Icon, Logout01Icon, Settings02Icon, XIcon, } from '../../icons/index.js';
|
|
9
|
+
import { AlertCircleIcon, Bell01Icon, ChevronRightIcon, CoinsStacked02Icon, CoinsSwap02Icon, Gift01Icon, Logout01Icon, Settings02Icon, XIcon, } from '../../icons/index.js';
|
|
10
10
|
import avatarPlaceholder from '../../images/placeholder-avatar.png';
|
|
11
11
|
import { Badge, Button, Drawer, IconButton, Popover } from '../../ui/index.js';
|
|
12
12
|
import { formatNumber, parseDecimal } from '../../utils/index.js';
|
|
@@ -21,6 +21,7 @@ export function Account(props) {
|
|
|
21
21
|
const betRecordsUrl = props.betRecordsUrl ?? '/bet-records';
|
|
22
22
|
const transactionsUrl = props.transactionsUrl ?? '/transactions';
|
|
23
23
|
const accountSettingsUrl = props.accountSettingsUrl ?? '/account';
|
|
24
|
+
const shouldShowSettings = props.shouldShowSettings ?? true;
|
|
24
25
|
const [mobileOffsetTop, desktopOffsetTop] = Array.isArray(props.offsetTop)
|
|
25
26
|
? props.offsetTop
|
|
26
27
|
: [props.offsetTop ?? '0px', props.offsetTop ?? '0px'];
|
|
@@ -29,12 +30,12 @@ export function Account(props) {
|
|
|
29
30
|
}, lazyMount: true, unmountOnExit: true, children: [_jsx(Drawer.Trigger, { asChild: true, className: "lg:hidden", children: props.children ?? (_jsx(IconButton, { size: "sm", colorScheme: "gray", children: globalStore.account__mobile.open ? (_jsx(XIcon, {})) : (_jsx(Image, { src: avatarPlaceholder, alt: "", width: 100, height: 100, className: "size-10" })) })) }), _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: {
|
|
30
31
|
['--offset-top-mobile']: mobileOffsetTop,
|
|
31
32
|
['--offset-top-desktop']: desktopOffsetTop,
|
|
32
|
-
}, children: [_jsx(Profile, {}), _jsx(Wallet, {}), _jsx(Links, { rewardsUrl: rewardsUrl, betRecordsUrl: betRecordsUrl, transactionsUrl: transactionsUrl, accountSettingsUrl: accountSettingsUrl })] }) }) })] }), _jsxs(Popover.Root, { open: globalStore.account.open, onOpenChange: (details) => {
|
|
33
|
+
}, children: [_jsx(Profile, {}), _jsx(Wallet, {}), _jsx(Links, { rewardsUrl: rewardsUrl, betRecordsUrl: betRecordsUrl, transactionsUrl: transactionsUrl, accountSettingsUrl: accountSettingsUrl, shouldShowSettings: shouldShowSettings })] }) }) })] }), _jsxs(Popover.Root, { open: globalStore.account.open, onOpenChange: (details) => {
|
|
33
34
|
globalStore.account.setOpen(details.open);
|
|
34
35
|
}, lazyMount: true, unmountOnExit: true, positioning: {
|
|
35
36
|
placement: 'bottom',
|
|
36
37
|
strategy: 'fixed',
|
|
37
|
-
}, children: [_jsx(Popover.Trigger, { className: "hidden lg:flex", asChild: true, children: props.children ?? (_jsx(IconButton, { size: "sm", colorScheme: "gray", children: _jsx(Image, { src: avatarPlaceholder, alt: "", width: 48, height: 48, className: "size-10" }) })) }), _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 })] }) }) })] })] }));
|
|
38
|
+
}, children: [_jsx(Popover.Trigger, { className: "hidden lg:flex", asChild: true, children: props.children ?? (_jsx(IconButton, { size: "sm", colorScheme: "gray", children: _jsx(Image, { src: avatarPlaceholder, alt: "", width: 48, height: 48, className: "size-10" }) })) }), _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 })] }) }) })] })] }));
|
|
38
39
|
}
|
|
39
40
|
function Profile() {
|
|
40
41
|
const accountQuery = useAccountQuery();
|
|
@@ -54,16 +55,16 @@ function Wallet() {
|
|
|
54
55
|
const depositBalance = parseDecimal(walletQuery.data?.balance, 0);
|
|
55
56
|
const bonusBalance = parseDecimal(walletQuery.data?.bonus, 0);
|
|
56
57
|
const totalBalance = depositBalance + bonusBalance;
|
|
57
|
-
return (_jsxs("div", { className: "border-border-primary bg-bg-tertiary mt-3 rounded-xl border p-xl", children: [_jsx("div", { className: "text-text-secondary-700 text-sm", children: "Total Balance" }), _jsx("div", { className: "text-3xl font-bold", children: formatNumber(totalBalance, {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "border-border-primary bg-bg-tertiary mt-3 rounded-xl border p-xl", children: [_jsx("div", { className: "text-text-secondary-700 text-sm", children: "Total Balance" }), _jsx("div", { className: "text-3xl font-bold", children: formatNumber(totalBalance, {
|
|
59
|
+
currency: localeInfo?.currency.code,
|
|
60
|
+
minDecimalPlaces: 2,
|
|
61
|
+
}) }), _jsxs("div", { className: "mt-1.5 flex gap-7xl", children: [_jsxs("div", { children: [_jsx("p", { className: "text-text-secondary-700 text-2xs", children: "Deposit Balance" }), _jsx("p", { className: "text-medium text-text-primary-brand", children: formatNumber(depositBalance, {
|
|
62
|
+
currency: localeInfo?.currency.code,
|
|
63
|
+
minDecimalPlaces: 2,
|
|
64
|
+
}) })] }), _jsxs("div", { children: [_jsx("p", { className: "text-text-secondary-700 text-2xs", children: "Bonus Balance" }), _jsx("p", { className: "text-medium text-text-primary-brand", children: formatNumber(bonusBalance, {
|
|
65
|
+
currency: localeInfo?.currency.code,
|
|
66
|
+
minDecimalPlaces: 2,
|
|
67
|
+
}) })] })] })] }), ' ', _jsxs("div", { className: "mt-3 flex gap-lg", children: [_jsx(Button, { size: "xs", variant: "outline", onClick: () => {
|
|
67
68
|
globalStore.depositWithdrawal.setOpen(true);
|
|
68
69
|
globalStore.depositWithdrawal.setTab('WITHDRAWAL');
|
|
69
70
|
globalStore.profile.setOpen(false);
|
|
@@ -87,13 +88,13 @@ function Links(props) {
|
|
|
87
88
|
globalStore.account.setOpen(false);
|
|
88
89
|
globalStore.account__mobile.setOpen(false);
|
|
89
90
|
globalStore.messages.setOpen(true);
|
|
90
|
-
}, children: [_jsx(
|
|
91
|
+
}, children: [_jsx(Bell01Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Notifications" }), _jsx("span", { className: recipe.navItemBadge(), "data-type": "warning", children: unreadMessagesCountQuery.data ?? 0 }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }), _jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.rewardsUrl, className: recipe.navItemLink(), onClick: () => {
|
|
91
92
|
globalStore.account.setOpen(false);
|
|
92
93
|
globalStore.account__mobile.setOpen(false);
|
|
93
|
-
}, children: [_jsx(Gift01Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Rewards" }), _jsx("span", { className: recipe.navItemBadge(), "data-type": "warning", children: "0" }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) })] }), _jsx("ul", { children: _jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.accountSettingsUrl, className: recipe.navItemLink(), onClick: () => {
|
|
94
|
+
}, children: [_jsx(Gift01Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Rewards" }), _jsx("span", { className: recipe.navItemBadge(), "data-type": "warning", children: "0" }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) })] }), props.shouldShowSettings && (_jsx("ul", { children: _jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.accountSettingsUrl, className: recipe.navItemLink(), onClick: () => {
|
|
94
95
|
globalStore.account.setOpen(false);
|
|
95
96
|
globalStore.account__mobile.setOpen(false);
|
|
96
|
-
}, children: [_jsx(Settings02Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Settings" }), _jsx("span", { className: recipe.navItemBadge(), "data-type": "error", children: _jsx(AlertCircleIcon, {}) }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }) }), _jsxs("ul", { children: [_jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.betRecordsUrl, className: recipe.navItemLink(), onClick: () => {
|
|
97
|
+
}, children: [_jsx(Settings02Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Settings" }), _jsx("span", { className: recipe.navItemBadge(), "data-type": "error", children: _jsx(AlertCircleIcon, {}) }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }) })), _jsxs("ul", { children: [_jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.betRecordsUrl, className: recipe.navItemLink(), onClick: () => {
|
|
97
98
|
globalStore.account.setOpen(false);
|
|
98
99
|
globalStore.account__mobile.setOpen(false);
|
|
99
100
|
}, children: [_jsx(CoinsStacked02Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Bet Records" }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }), _jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.transactionsUrl, className: recipe.navItemLink(), onClick: () => {
|
|
@@ -7,27 +7,28 @@ import { useReducer, useState } from 'react';
|
|
|
7
7
|
import { twMerge } from 'tailwind-merge';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { useBetRecordsQuery, useInfiniteQueryHelper, useLocaleInfo, } from '../../client/hooks/index.js';
|
|
10
|
+
import { GAME_PROVIDER_DATA, GAME_TYPE_DATA, GAME_TYPES, } from '../../constants/index.js';
|
|
10
11
|
import { CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, File02Icon, SpinnerIcon, } from '../../icons/index.js';
|
|
11
12
|
import { Badge, DatePicker, IconButton, SegmentGroup, Select, Table, } from '../../ui/index.js';
|
|
12
13
|
import { capitalize, formatNumber } from '../../utils/index.js';
|
|
13
14
|
import { Empty } from '../Empty.js';
|
|
14
15
|
export function BetRecords(props) {
|
|
15
16
|
const [tab, setTab] = useState('all');
|
|
17
|
+
const gameTypes = props.gameTypes.map((type) => GAME_TYPE_DATA[type]);
|
|
18
|
+
const gameProviders = props.gameProviders.map((provider) => GAME_PROVIDER_DATA[provider]);
|
|
16
19
|
const [state, setState] = useReducer((prev, next) => ({
|
|
17
20
|
...prev,
|
|
18
21
|
...next,
|
|
19
22
|
}), {
|
|
20
23
|
page: 1,
|
|
21
24
|
pageSize: 10,
|
|
22
|
-
type:
|
|
25
|
+
type: gameTypes[0].id,
|
|
23
26
|
});
|
|
24
27
|
const localeInfo = useLocaleInfo();
|
|
25
28
|
const providerCollection = createListCollection({
|
|
26
|
-
items:
|
|
27
|
-
itemToValue: (item) => item,
|
|
28
|
-
itemToString: (item) =>
|
|
29
|
-
delimiter: capitalize.delimiters.UNDERSCORE,
|
|
30
|
-
}),
|
|
29
|
+
items: gameProviders,
|
|
30
|
+
itemToValue: (item) => item.id,
|
|
31
|
+
itemToString: (item) => item.name,
|
|
31
32
|
});
|
|
32
33
|
const { page, hasNextPage, hasPrevPage, next, prev, rows, totalPages, loading, firstPage, } = useInfiniteQueryHelper(useBetRecordsQuery, {
|
|
33
34
|
filter: {
|
|
@@ -61,13 +62,9 @@ export function BetRecords(props) {
|
|
|
61
62
|
return (_jsxs("div", { className: props.className, children: [_jsx("h2", { className: "text-sm font-semibold leading-tight lg:text-lg", children: "Bet Records" }), _jsx("p", { className: "text-text-tertiary-600 mt-xs text-sm leading-tight", children: "Review your betting history" }), _jsx("div", { className: "mt-lg lg:mt-2xl", children: _jsxs(SegmentGroup.Root, { value: state.type, onValueChange: (details) => {
|
|
62
63
|
firstPage();
|
|
63
64
|
setState({
|
|
64
|
-
type: z
|
|
65
|
-
.enum((props.gameTypes ?? []))
|
|
66
|
-
.safeParse(details.value).data ?? null,
|
|
65
|
+
type: z.enum(GAME_TYPES).safeParse(details.value).data ?? null,
|
|
67
66
|
});
|
|
68
|
-
}, children: [
|
|
69
|
-
delimiter: capitalize.delimiters.UNDERSCORE,
|
|
70
|
-
}) }), _jsx(SegmentGroup.ItemControl, {}), _jsx(SegmentGroup.ItemHiddenInput, {})] }, type))), _jsx(SegmentGroup.Indicator, {})] }) }), _jsx("div", { className: "border-border-secondary mt-2xl hidden border-t lg:block" }), _jsx("h3", { className: "text-text-secondary-700 mt-3xl text-sm font-semibold", children: "Table" }), _jsxs("div", { className: "mt-xl flex flex-col gap-lg lg:flex-row lg:items-center", children: [_jsxs(DatePicker.Root, { lazyMount: true, unmountOnExit: true, value: [state.timestamp?.start, state.timestamp?.end]
|
|
67
|
+
}, children: [gameTypes.map((type) => (_jsxs(SegmentGroup.Item, { value: type.id, children: [_jsx(SegmentGroup.ItemText, { children: type.name }), _jsx(SegmentGroup.ItemControl, {}), _jsx(SegmentGroup.ItemHiddenInput, {})] }, type.id))), _jsx(SegmentGroup.Indicator, {})] }) }), _jsx("div", { className: "border-border-secondary mt-2xl hidden border-t lg:block" }), _jsx("h3", { className: "text-text-secondary-700 mt-3xl text-sm font-semibold", children: "Table" }), _jsxs("div", { className: "mt-xl flex flex-col gap-lg lg:flex-row lg:items-center", children: [_jsxs(DatePicker.Root, { lazyMount: true, unmountOnExit: true, value: [state.timestamp?.start, state.timestamp?.end]
|
|
71
68
|
.filter(Boolean)
|
|
72
69
|
.map((d) => parseDate(d)), onValueChange: (details) => {
|
|
73
70
|
firstPage();
|
|
@@ -116,9 +113,7 @@ export function BetRecords(props) {
|
|
|
116
113
|
sameWidth: true,
|
|
117
114
|
}, children: [_jsxs(Select.Trigger, { className: "w-full lg:w-[14rem]", children: [_jsx(Select.ValueText, { placeholder: "Game Vendor" }), _jsx(Select.Context, { children: (api) => (_jsx(_Fragment, { children: api.value.length ? (_jsx(Select.ClearTrigger, { asChild: true, children: _jsx("span", { onClick: (e) => {
|
|
118
115
|
e.stopPropagation();
|
|
119
|
-
}, children: "Clear" }) })) : (_jsx(Select.Indicator, { asChild: true, children: _jsx(ChevronDownIcon, {}) })) })) })] }), _jsx(Portal, { children: _jsx(Select.Positioner, { children: _jsx(Select.Content, { children: _jsx(Select.ItemGroup, { children: providerCollection.items.map((provider) => (_jsxs(Select.Item, { item: provider, children: [_jsx(Select.ItemText, { children:
|
|
120
|
-
delimiter: capitalize.delimiters.UNDERSCORE,
|
|
121
|
-
}) }), _jsx(Select.ItemIndicator, { asChild: true, children: _jsx(CheckIcon, {}) })] }, provider))) }) }) }) })] }), _jsxs(Select.Root, { collection: statusCollection, value: state.status ? [state.status] : [], onValueChange: (details) => {
|
|
116
|
+
}, children: "Clear" }) })) : (_jsx(Select.Indicator, { asChild: true, children: _jsx(ChevronDownIcon, {}) })) })) })] }), _jsx(Portal, { children: _jsx(Select.Positioner, { children: _jsx(Select.Content, { children: _jsx(Select.ItemGroup, { children: providerCollection.items.map((provider) => (_jsxs(Select.Item, { item: provider, children: [_jsx(Select.ItemText, { children: provider.name }), _jsx(Select.ItemIndicator, { asChild: true, children: _jsx(CheckIcon, {}) })] }, provider.id))) }) }) }) })] }), _jsxs(Select.Root, { collection: statusCollection, value: state.status ? [state.status] : [], onValueChange: (details) => {
|
|
122
117
|
const value = z
|
|
123
118
|
.enum(BET_RECORD_STATUSES)
|
|
124
119
|
.safeParse(details.value.at(0)).data;
|
|
@@ -1,11 +1,23 @@
|
|
|
1
|
+
import type { GameProvider } from '@opexa/portal-sdk-core';
|
|
1
2
|
import type { GameProviderData } from '../../types';
|
|
2
3
|
export interface GameProvidersProps {
|
|
3
|
-
gameProviders:
|
|
4
|
+
gameProviders: GameProvider[];
|
|
4
5
|
heading?: string;
|
|
5
6
|
/**
|
|
6
|
-
* @default '/
|
|
7
|
+
* @default '/providers'
|
|
7
8
|
*/
|
|
8
9
|
viewAllUrl?: string;
|
|
10
|
+
/**
|
|
11
|
+
* @default '/providers/<slug>'
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* '/bingo/:slug' // '/bingo/jili'
|
|
15
|
+
* '/bingo/:id' // '/bingo/JILI'
|
|
16
|
+
* // or using a function
|
|
17
|
+
* ({slug}) => `/bingo/${slug}`
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
viewGamesUrl?: string | ((gameProvider: GameProviderData) => string);
|
|
9
21
|
className?: string;
|
|
10
22
|
gameProviderContainerClass?: string;
|
|
11
23
|
gameProviderImageClass?: string;
|
|
@@ -5,8 +5,10 @@ import Image from 'next/image';
|
|
|
5
5
|
import Link from 'next/link';
|
|
6
6
|
import { useCallback, useEffect, useState } from 'react';
|
|
7
7
|
import { twMerge } from 'tailwind-merge';
|
|
8
|
+
import { GAME_PROVIDER_DATA } from '../../constants/index.js';
|
|
8
9
|
import { ArrowLeftIcon, ArrowRightIcon, ChevronRightIcon } from '../../icons/index.js';
|
|
9
10
|
import { Button } from '../../ui/index.js';
|
|
11
|
+
import { callIfFn } from '../../utils/index.js';
|
|
10
12
|
export function GameProviders(props) {
|
|
11
13
|
const [emblaRef, emblaApi] = useEmblaCarousel({
|
|
12
14
|
align: 'start',
|
|
@@ -28,6 +30,14 @@ export function GameProviders(props) {
|
|
|
28
30
|
onSelect(emblaApi);
|
|
29
31
|
emblaApi.on('reInit', onSelect).on('select', onSelect);
|
|
30
32
|
}, [emblaApi, onSelect]);
|
|
31
|
-
const viewAllUrl = props.viewAllUrl ?? '/
|
|
32
|
-
|
|
33
|
+
const viewAllUrl = props.viewAllUrl ?? '/providers';
|
|
34
|
+
const viewGamesUrl = (data) => {
|
|
35
|
+
return props.viewGamesUrl
|
|
36
|
+
? callIfFn(props.viewGamesUrl, data)
|
|
37
|
+
.replace(':id', data.id)
|
|
38
|
+
.replace(':slug', data.slug)
|
|
39
|
+
: `/providers/${data.slug}`;
|
|
40
|
+
};
|
|
41
|
+
const gameProviders = props.gameProviders.map((provider) => GAME_PROVIDER_DATA[provider]);
|
|
42
|
+
return (_jsxs("div", { className: props.className, children: [_jsxs("div", { className: "flex items-center", children: [_jsx("h2", { className: "text-lg font-semibold", children: props.heading ?? 'Providers' }), _jsx("div", { className: "grow" }), _jsxs("div", { className: "flex items-center justify-center gap-xl", children: [_jsxs(Link, { href: viewAllUrl, 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, { variant: "outline", colorScheme: "gray", className: "rounded-r-none border-r-0", onClick: onPrevButtonClick, disabled: prevBtnDisabled, "aria-label": "Previous", children: _jsx(ArrowLeftIcon, { className: "size-5" }) }), _jsx(Button, { variant: "outline", colorScheme: "gray", className: "rounded-l-none", onClick: onNextButtonClick, disabled: nextBtnDisabled, "aria-label": "Next", children: _jsx(ArrowRightIcon, { className: "size-5" }) })] })] })] }), _jsx("div", { ref: emblaRef, className: "relative mt-lg lg:overflow-hidden", children: _jsx("div", { className: "grid auto-cols-[calc((100%-(0.375rem*2))/3)] grid-flow-col grid-rows-1 gap-sm lg:auto-cols-[calc((100%-(0.5rem*5))/6)] lg:gap-md", children: gameProviders.map((provider) => (_jsx(Link, { href: viewGamesUrl(provider), className: twMerge('bg-gray-800 flex h-full w-full items-center overflow-hidden rounded-md lg:h-[5.75rem]', props.gameProviderContainerClass), "aria-label": `View ${provider.name} games`, children: _jsx(Image, { src: provider.logo, alt: "", width: 300, height: 150, className: twMerge('mx-auto h-auto w-full', props.gameProviderImageClass) }) }, provider.id))) }) })] }));
|
|
33
43
|
}
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { GameProviderData } from '../../types';
|
|
3
|
-
export interface JackpotItemProps {
|
|
4
|
-
jackpot: Jackpot;
|
|
5
|
-
/** @default "/jackpots" */
|
|
6
|
-
viewAllUrl?: string;
|
|
7
|
-
gameProviders: GameProviderData[];
|
|
8
|
-
}
|
|
9
|
-
export declare function JackpotItemDesktop({ jackpot, gameProviders, }: JackpotItemProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare function JackpotItemDesktop(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -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 JackpotItemDesktop(
|
|
18
|
-
const
|
|
18
|
+
export function JackpotItemDesktop() {
|
|
19
|
+
const jackpot = useJackpotContext();
|
|
20
|
+
const { jackpotPayouts, topJackpotPayout, filteredGameProviders, localeInfo, isPayingOut, jackpotAmount, arrowImages, getAccumulatingJackpotDescription, starTierStyles, } = useJackpotItemData();
|
|
19
21
|
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-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: _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, {
|
|
20
22
|
currency: localeInfo.currency.code,
|
|
21
23
|
minDecimalPlaces: 2,
|
|
@@ -35,7 +37,7 @@ export function JackpotItemDesktop({ jackpot, gameProviders, }) {
|
|
|
35
37
|
currency: localeInfo.currency.code,
|
|
36
38
|
compact: true,
|
|
37
39
|
})} Play now for your chance to win big! 🔥`
|
|
38
|
-
: 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 ? 'Leaderboard' : 'Starting soon!' })] }), _jsx(JackpotRules, {
|
|
40
|
+
: 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 ? 'Leaderboard' : 'Starting soon!' })] }), _jsx(JackpotRules, {})] }), _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: 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 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, {
|
|
39
41
|
currency: localeInfo.currency.code,
|
|
40
42
|
minDecimalPlaces: 2,
|
|
41
43
|
maxDecimalPlaces: 2,
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { GameProviderData } from '../../types';
|
|
3
|
-
export interface JackpotItemMobileProps {
|
|
4
|
-
jackpot: Jackpot;
|
|
5
|
-
/** @default "/jackpots" */
|
|
6
|
-
viewAllUrl?: string;
|
|
7
|
-
gameProviders: GameProviderData[];
|
|
8
|
-
}
|
|
9
|
-
export declare function JackpotItemMobile({ jackpot, gameProviders, }: JackpotItemMobileProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare function JackpotItemMobile(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -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(
|
|
18
|
-
const
|
|
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, {
|
|
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,
|
|
@@ -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
|
-
|
|
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(
|
|
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 {
|
|
1
|
+
import type { GameProvider } from '@opexa/portal-sdk-core';
|
|
2
2
|
export interface JackpotsProps {
|
|
3
|
-
/** @default "
|
|
3
|
+
/** @default "Jackpots" */
|
|
4
4
|
heading?: string;
|
|
5
|
-
/** @default "/jackpots" */
|
|
6
|
-
viewAllUrl?: string;
|
|
7
5
|
className?: string;
|
|
8
|
-
gameProviders:
|
|
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;
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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: [
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
}) }),
|
|
21
|
-
|
|
22
|
-
|
|
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;
|