@opexa/portal-components 0.0.34 → 0.0.36
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/useInfiniteQueryHelper.d.ts +8 -0
- package/dist/client/hooks/useInfiniteQueryHelper.js +11 -9
- package/dist/client/hooks/useMemberVerificationQuery.js +0 -1
- package/dist/client/hooks/useMessagesQuery.js +0 -1
- package/dist/client/hooks/useTransactionRecordsQuery.js +0 -1
- package/dist/client/hooks/useWithdrawalRecordsQuery.js +0 -1
- package/dist/components/Account/Account.js +1 -1
- package/dist/components/AccountInfo/AccountInfo.js +1 -1
- package/dist/components/AccountSecurity/AccountSecurity.js +2 -2
- package/dist/components/AccountVerification/AccountVerification.d.ts +4 -1
- package/dist/components/AccountVerification/AccountVerification.js +36 -2
- package/dist/components/AccountVerification/VerificationCapture.d.ts +1 -0
- package/dist/components/AccountVerification/VerificationCapture.js +57 -0
- package/dist/components/AccountVerification/selfie.png +0 -0
- package/dist/components/AccountVerification/upload-id.png +0 -0
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositVCA.js +1 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositQrCode.js +1 -1
- package/dist/components/DepositWithdrawal/PaymentMethods.js +5 -5
- package/dist/components/Disclaimer/Disclaimer.js +2 -2
- package/dist/components/Games/Game.d.ts +1 -0
- package/dist/components/Games/Game.js +34 -0
- package/dist/components/Games/GameContext.d.ts +3 -0
- package/dist/components/{KYC/KYCContext.js → Games/GameContext.js} +4 -4
- package/dist/components/Games/Games.d.ts +7 -14
- package/dist/components/Games/Games.js +3 -8
- package/dist/components/Games/GamesCarousel.client.d.ts +2 -0
- package/dist/components/Games/{Games.client.js → GamesCarousel.client.js} +6 -32
- package/dist/components/Games/GamesCarousel.d.ts +15 -0
- package/dist/components/Games/GamesCarousel.js +11 -0
- package/dist/components/Games/GamesList.client.d.ts +2 -0
- package/dist/components/Games/GamesList.client.js +14 -0
- package/dist/components/Games/GamesList.d.ts +10 -0
- package/dist/components/Games/GamesList.js +10 -0
- package/dist/components/GamesSearch/GamesSearch.js +1 -1
- package/dist/components/JackpotCounter/JackpotCounterItem.d.ts +0 -1
- package/dist/components/JackpotCounter/JackpotCounterItem.js +11 -22
- package/dist/components/Jackpots/JackpotItemDesktop.js +12 -11
- package/dist/components/Jackpots/JackpotItemMobile.js +11 -10
- package/dist/components/Jackpots/Jackpots.js +4 -2
- package/dist/components/Jackpots/useJackpotItemData.d.ts +0 -1
- package/dist/components/Jackpots/useJackpotItemData.js +0 -7
- package/dist/components/PortalProvider/PortalProvider.client.js +25 -13
- package/dist/components/TournamentCounter/TournamentCounter.client.js +5 -12
- package/dist/components/TournamentCounter/TournamentCounterItem.d.ts +3 -4
- package/dist/components/TournamentCounter/TournamentCounterItem.js +24 -13
- package/dist/components/Tournaments/TournamentGameProviders.d.ts +5 -1
- package/dist/components/Tournaments/TournamentGameProviders.js +3 -4
- package/dist/components/Tournaments/TournamentItemDesktop.d.ts +7 -0
- package/dist/components/Tournaments/TournamentItemDesktop.js +57 -0
- package/dist/components/Tournaments/TournamentItemMobile.d.ts +6 -6
- package/dist/components/Tournaments/TournamentItemMobile.js +21 -61
- package/dist/components/Tournaments/Tournaments.d.ts +3 -1
- package/dist/components/Tournaments/Tournaments.js +8 -15
- package/dist/components/Tournaments/useTournamentItemData.d.ts +16 -0
- package/dist/components/Tournaments/useTournamentItemData.js +64 -0
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.js +0 -1
- package/dist/icons/CreditCardCheckIcon.d.ts +2 -0
- package/dist/icons/CreditCardCheckIcon.js +4 -0
- package/dist/icons/FaceIdIcon.d.ts +2 -0
- package/dist/icons/FaceIdIcon.js +4 -0
- package/dist/icons/FileSearch02Icon.d.ts +2 -0
- package/dist/icons/FileSearch02Icon.js +4 -0
- package/dist/icons/FileX02Icon.d.ts +2 -0
- package/dist/icons/FileX02Icon.js +4 -0
- package/dist/icons/Globe05Icon.d.ts +2 -0
- package/dist/icons/Globe05Icon.js +4 -0
- package/dist/icons/index.d.ts +5 -0
- package/dist/icons/index.js +5 -0
- package/dist/styles/theme.css +5 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/ui/Progress/progress.recipe.js +1 -1
- package/dist/utils/getPercentage.d.ts +1 -0
- package/dist/utils/getPercentage.js +5 -0
- package/dist/utils/maskDisplayName.d.ts +1 -0
- package/dist/utils/maskDisplayName.js +8 -0
- package/package.json +150 -150
- package/dist/components/Games/Games.client.d.ts +0 -2
- package/dist/components/KYC/KYC.d.ts +0 -5
- package/dist/components/KYC/KYC.js +0 -19
- package/dist/components/KYC/KYCContext.d.ts +0 -3
- package/dist/components/KYC/KYCTrigger.d.ts +0 -5
- package/dist/components/KYC/KYCTrigger.js +0 -14
- package/dist/components/KYC/Step1.d.ts +0 -1
- package/dist/components/KYC/Step1.js +0 -10
- package/dist/components/KYC/Step2.d.ts +0 -1
- package/dist/components/KYC/Step2.js +0 -15
- package/dist/components/KYC/Step3.d.ts +0 -1
- package/dist/components/KYC/Step3.js +0 -11
- package/dist/components/KYC/StepIndicator.d.ts +0 -1
- package/dist/components/KYC/StepIndicator.js +0 -13
- package/dist/components/KYC/UploadDocument.d.ts +0 -1
- package/dist/components/KYC/UploadDocument.js +0 -8
- package/dist/components/KYC/UploadSelfie.d.ts +0 -1
- package/dist/components/KYC/UploadSelfie.js +0 -8
- package/dist/components/KYC/index.d.ts +0 -2
- package/dist/components/KYC/index.js +0 -2
- package/dist/components/KYC/useKYC.d.ts +0 -14
- package/dist/components/KYC/useKYC.js +0 -32
- package/dist/components/KYC/utils.d.ts +0 -0
- package/dist/components/KYC/utils.js +0 -1
- package/dist/components/Tournaments/TournamentItem.d.ts +0 -5
- package/dist/components/Tournaments/TournamentItem.js +0 -97
- package/dist/config.d.ts +0 -272
- package/dist/config.js +0 -39
|
@@ -7,13 +7,15 @@ import { useCallback, useMemo } from 'react';
|
|
|
7
7
|
import { twMerge } from 'tailwind-merge';
|
|
8
8
|
import { useLocaleInfo } from '../../client/hooks/index.js';
|
|
9
9
|
import { useJackpotPayoutsQuery } from '../../client/hooks/useJackpotPayoutsQuery.js';
|
|
10
|
-
import { ArrowNarrowUpRightIcon, ChevronLeftIcon, ChevronRightIcon, Trophy01Icon, } from '../../icons/index.js';
|
|
10
|
+
import { ArrowNarrowUpRightIcon, ChevronLeftIcon, ChevronRightIcon, Trophy01Icon, User01Icon, } from '../../icons/index.js';
|
|
11
11
|
import { StarIcon } from '../../icons/StarIcon.js';
|
|
12
|
-
import closeChest from '
|
|
13
|
-
import firstPlace from '
|
|
14
|
-
import leaderboard from '
|
|
15
|
-
import openChest from '
|
|
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
16
|
import { formatNumber } from '../../utils/index.js';
|
|
17
|
+
import { getPercentage } from '../../utils/getPercentage.js';
|
|
18
|
+
import { maskDisplayName } from '../../utils/maskDisplayName.js';
|
|
17
19
|
import styles from './JackpotCounterItem.module.css';
|
|
18
20
|
export function JackpotCounterItem({ jackpot, className, viewAllUrl, }) {
|
|
19
21
|
const jackpotPayoutsQuery = useJackpotPayoutsQuery({
|
|
@@ -50,40 +52,27 @@ export function JackpotCounterItem({ jackpot, className, viewAllUrl, }) {
|
|
|
50
52
|
currency: localeInfo.currency.code,
|
|
51
53
|
minDecimalPlaces: 2,
|
|
52
54
|
maxDecimalPlaces: 2,
|
|
53
|
-
}) })] }), _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: [
|
|
55
|
+
}) })] }), _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: maskDisplayName(topJackpotPayout.member.name) }), _jsx("div", { className: "text-brand-400 text-2xl", children: formatNumber(topJackpotPayout.amount, {
|
|
54
56
|
currency: localeInfo.currency.code,
|
|
55
57
|
minDecimalPlaces: 2,
|
|
56
58
|
maxDecimalPlaces: 2,
|
|
57
|
-
}) })] })] }) })) : (_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: "
|
|
59
|
+
}) })] })] }) })) : (_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, {
|
|
58
60
|
currency: localeInfo.currency.code,
|
|
59
61
|
compact: true,
|
|
60
62
|
}) }), _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, {
|
|
61
63
|
currency: localeInfo.currency.code,
|
|
62
64
|
compact: true,
|
|
63
|
-
}) })] })] }), _jsx(Progress.Root, { className: "bg-bg-primary h-2 w-full rounded-full lg:h-4", max: 100, value:
|
|
65
|
+
}) })] })] }), _jsx(Progress.Root, { className: "bg-bg-primary h-2 w-full rounded-full lg:h-4", max: 100, value: getPercentage(Number(jackpot.pool), Number(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
|
|
64
66
|
? `The pot has hit ${formatNumber(jackpot?.maximumJackpotPoolLimit, {
|
|
65
67
|
currency: localeInfo.currency.code,
|
|
66
68
|
compact: true,
|
|
67
69
|
})} Play now for your chance to win big! 🔥`
|
|
68
|
-
: 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!' })] }), _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", { 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:
|
|
70
|
+
: 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!' })] }), _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", { 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: maskDisplayName(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, {
|
|
69
71
|
currency: localeInfo.currency.code,
|
|
70
72
|
minDecimalPlaces: 2,
|
|
71
73
|
maxDecimalPlaces: 2,
|
|
72
74
|
}) })] }, 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 && (_jsx("div", { className: twMerge(styles['light-rays'], 'absolute right-0 top-0 rounded-2xl [--light-rays-top:25%] lg:[--light-rays-top:150px]') }))] }));
|
|
73
75
|
}
|
|
74
|
-
export function maskName(name) {
|
|
75
|
-
if (name.length <= 7) {
|
|
76
|
-
return '*'.repeat(name.length);
|
|
77
|
-
}
|
|
78
|
-
const visiblePart = name.slice(0, 3);
|
|
79
|
-
const maskedPart = '*'.repeat(7);
|
|
80
|
-
return visiblePart + maskedPart;
|
|
81
|
-
}
|
|
82
|
-
const calculatePercentage = (part, total) => {
|
|
83
|
-
if (total === 0)
|
|
84
|
-
return 0;
|
|
85
|
-
return (part / total) * 100;
|
|
86
|
-
};
|
|
87
76
|
const getAccumulatingJackpotDescription = (part, total) => {
|
|
88
77
|
const percentage = total === 0 ? 0 : (part / total) * 100;
|
|
89
78
|
return percentage <= 90
|
|
@@ -3,25 +3,26 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { Progress } from '@ark-ui/react';
|
|
4
4
|
import Image from 'next/image';
|
|
5
5
|
import { twMerge } from 'tailwind-merge';
|
|
6
|
-
import { ArrowNarrowUpRightIcon, ChevronLeftIcon, ChevronRightIcon, Trophy01Icon, } from '../../icons/index.js';
|
|
6
|
+
import { ArrowNarrowUpRightIcon, ChevronLeftIcon, ChevronRightIcon, Trophy01Icon, User01Icon, } from '../../icons/index.js';
|
|
7
7
|
import { StarIcon } from '../../icons/StarIcon.js';
|
|
8
|
-
import closeChest from '
|
|
9
|
-
import firstPlace from '
|
|
10
|
-
import leaderboard from '
|
|
11
|
-
import openChest from '
|
|
8
|
+
import closeChest from '~/images/close-chest.png';
|
|
9
|
+
import firstPlace from '~/images/first-place.png';
|
|
10
|
+
import leaderboard from '~/images/leaderboard.png';
|
|
11
|
+
import openChest from '~/images/open-chest.png';
|
|
12
12
|
import { formatNumber } from '../../utils/index.js';
|
|
13
|
-
import {
|
|
13
|
+
import { getPercentage } from '../../utils/getPercentage.js';
|
|
14
|
+
import { maskDisplayName } from '../../utils/maskDisplayName.js';
|
|
14
15
|
import styles from '../JackpotCounter/JackpotCounterItem.module.css';
|
|
15
16
|
import { JackpotGameProviders } from './JackpotGameProviders.js';
|
|
16
17
|
import { JackpotRules } from './JackpotRules.js';
|
|
17
18
|
import { useJackpotItemData } from './useJackpotItemData.js';
|
|
18
19
|
export function JackpotItemDesktop({ jackpot, gameProviders, }) {
|
|
19
|
-
const { jackpotPayouts, topJackpotPayout, filteredGameProviders, localeInfo, isPayingOut, jackpotAmount, arrowImages,
|
|
20
|
+
const { jackpotPayouts, topJackpotPayout, filteredGameProviders, localeInfo, isPayingOut, jackpotAmount, arrowImages, getAccumulatingJackpotDescription, starTierStyles, } = useJackpotItemData({ jackpot, gameProviders });
|
|
20
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, {
|
|
21
22
|
currency: localeInfo.currency.code,
|
|
22
23
|
minDecimalPlaces: 2,
|
|
23
24
|
maxDecimalPlaces: 2,
|
|
24
|
-
}) })] }), _jsx("div", { className: "z-1 bottom-[-60] right-0 block 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: [
|
|
25
|
+
}) })] }), _jsx("div", { className: "z-1 bottom-[-60] right-0 block 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: maskDisplayName(topJackpotPayout.member.name) }), _jsx("div", { className: "text-brand-400 text-2xl", children: formatNumber(topJackpotPayout.amount, {
|
|
25
26
|
currency: localeInfo.currency.code,
|
|
26
27
|
minDecimalPlaces: 2,
|
|
27
28
|
maxDecimalPlaces: 2,
|
|
@@ -31,14 +32,14 @@ export function JackpotItemDesktop({ jackpot, gameProviders, }) {
|
|
|
31
32
|
}) }), _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, {
|
|
32
33
|
currency: localeInfo.currency.code,
|
|
33
34
|
compact: true,
|
|
34
|
-
}) })] })] }), _jsx(Progress.Root, { className: "bg-bg-primary h-2 w-full rounded-full lg:h-4", max: 100, value:
|
|
35
|
+
}) })] })] }), _jsx(Progress.Root, { className: "bg-bg-primary h-2 w-full rounded-full lg:h-4", max: 100, value: getPercentage(Number(jackpot.pool), Number(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
|
|
35
36
|
? `The pot has hit ${formatNumber(jackpot?.maximumJackpotPoolLimit, {
|
|
36
37
|
currency: localeInfo.currency.code,
|
|
37
38
|
compact: true,
|
|
38
39
|
})} Play now for your chance to win big! 🔥`
|
|
39
|
-
: 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, { jackpotRules: jackpot.description })] }), _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:
|
|
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, { jackpotRules: jackpot.description })] }), _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: maskDisplayName(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
41
|
currency: localeInfo.currency.code,
|
|
41
42
|
minDecimalPlaces: 2,
|
|
42
43
|
maxDecimalPlaces: 2,
|
|
43
|
-
}) })] }, 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 && (_jsx("div", { className: twMerge(styles['light-rays'], 'absolute right-0 top-0 rounded-2xl') }))] }), Boolean(filteredGameProviders.length) && (_jsx(JackpotGameProviders, { gameProviders:
|
|
44
|
+
}) })] }, 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 && (_jsx("div", { className: twMerge(styles['light-rays'], 'absolute right-0 top-0 rounded-2xl') }))] }), Boolean(filteredGameProviders.length) && (_jsx(JackpotGameProviders, { gameProviders: filteredGameProviders }))] }));
|
|
44
45
|
}
|
|
@@ -4,22 +4,23 @@ import { Progress } from '@ark-ui/react';
|
|
|
4
4
|
import Image from 'next/image';
|
|
5
5
|
import { useState } from 'react';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
|
-
import { ArrowNarrowUpRightIcon, ChevronLeftIcon, ChevronRightIcon, Trophy01Icon, } from '../../icons/index.js';
|
|
7
|
+
import { ArrowNarrowUpRightIcon, ChevronLeftIcon, ChevronRightIcon, Trophy01Icon, User01Icon, } from '../../icons/index.js';
|
|
8
8
|
import { ArrowNarrowDownIcon } from '../../icons/ArrowNarrowDownIcon.js';
|
|
9
9
|
import { ArrowNarrowUpIcon } from '../../icons/ArrowNarrowUpIcon.js';
|
|
10
10
|
import { StarIcon } from '../../icons/StarIcon.js';
|
|
11
|
-
import closeChest from '
|
|
12
|
-
import firstPlace from '
|
|
13
|
-
import openChest from '
|
|
11
|
+
import closeChest from '~/images/close-chest.png';
|
|
12
|
+
import firstPlace from '~/images/first-place.png';
|
|
13
|
+
import openChest from '~/images/open-chest.png';
|
|
14
14
|
import { Button } from '../../ui/index.js';
|
|
15
15
|
import { formatNumber } from '../../utils/index.js';
|
|
16
|
-
import {
|
|
16
|
+
import { getPercentage } from '../../utils/getPercentage.js';
|
|
17
|
+
import { maskDisplayName } from '../../utils/maskDisplayName.js';
|
|
17
18
|
import styles from '../JackpotCounter/JackpotCounterItem.module.css';
|
|
18
19
|
import { JackpotGameProviders } from './JackpotGameProviders.js';
|
|
19
20
|
import { JackpotRules } from './JackpotRules.js';
|
|
20
21
|
import { useJackpotItemData } from './useJackpotItemData.js';
|
|
21
22
|
export function JackpotItemMobile({ jackpot, gameProviders, }) {
|
|
22
|
-
const { jackpotPayouts, topJackpotPayout, filteredGameProviders, localeInfo, isPayingOut, jackpotAmount, arrowImages,
|
|
23
|
+
const { jackpotPayouts, topJackpotPayout, filteredGameProviders, localeInfo, isPayingOut, jackpotAmount, arrowImages, getAccumulatingJackpotDescription, starTierStyles, } = useJackpotItemData({ jackpot, gameProviders });
|
|
23
24
|
const [isDetailsVisible, setIsDetailsVisible] = useState(false);
|
|
24
25
|
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, {
|
|
25
26
|
currency: localeInfo.currency.code,
|
|
@@ -31,18 +32,18 @@ export function JackpotItemMobile({ jackpot, gameProviders, }) {
|
|
|
31
32
|
}) }), _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, {
|
|
32
33
|
currency: localeInfo.currency.code,
|
|
33
34
|
compact: true,
|
|
34
|
-
}) })] })] }), _jsx(Progress.Root, { className: "bg-bg-primary h-2 w-full rounded-full lg:h-4", max: 100, value:
|
|
35
|
+
}) })] })] }), _jsx(Progress.Root, { className: "bg-bg-primary h-2 w-full rounded-full lg:h-4", max: 100, value: getPercentage(Number(jackpot.pool), Number(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
|
|
35
36
|
? `The pot has hit ${formatNumber(jackpot?.maximumJackpotPoolLimit, {
|
|
36
37
|
currency: localeInfo.currency.code,
|
|
37
38
|
compact: true,
|
|
38
39
|
})} Play now for your chance to win big! 🔥`
|
|
39
|
-
: getAccumulatingJackpotDescription(Number(jackpot?.pool) ?? 0, Number(jackpot?.maximumJackpotPoolLimit) ?? 0) })] }), topJackpotPayout.amount ? (_jsx("div", { children: _jsxs("div", { className: "bg-bg-primary relative mt-4 flex w-full gap-4 rounded-lg p-4", children: [
|
|
40
|
+
: getAccumulatingJackpotDescription(Number(jackpot?.pool) ?? 0, Number(jackpot?.maximumJackpotPoolLimit) ?? 0) })] }), topJackpotPayout.amount ? (_jsx("div", { children: _jsxs("div", { className: "bg-bg-primary relative mt-4 flex w-full gap-4 rounded-lg p-4", children: [_jsxs("div", { className: "bg-bg-tertiary relative flex h-18 w-18 items-center justify-center rounded-full", children: [_jsx(User01Icon, { className: "text-text-quarterary-500 size-9" }), _jsx("div", { className: "bg-yellow-400 text-brand-950 border-bg-primary absolute bottom-0 right-0 flex h-6 w-6 items-center justify-center rounded-full border-[1.5px] text-xs font-bold", children: "1st" })] }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700 flex h-fit w-fit items-center gap-1 rounded-sm border px-2 py-0.5 text-xs font-medium", children: [_jsx(Trophy01Icon, { className: "text-utility-brand-600 size-3.5" }), "Top Payout"] }), _jsx("div", { className: "font-semibold", children: maskDisplayName(topJackpotPayout.member.name) }), _jsx("div", { className: "text-brand-400 text-2xl", children: formatNumber(topJackpotPayout.amount, {
|
|
40
41
|
currency: localeInfo.currency.code,
|
|
41
42
|
minDecimalPlaces: 2,
|
|
42
43
|
maxDecimalPlaces: 2,
|
|
43
|
-
}) })] })] }) })) : (_jsxs("div", { className: "bg-bg-primary relative mt-4 flex w-full gap-4 rounded-lg p-4", children: [_jsx(Image, { width: 66, height: 87, src: firstPlace, alt: "closeChest", className: "size-full h-auto w-[66px] mix-blend-luminosity" }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700 flex h-fit w-fit items-center gap-1 rounded-sm border px-2 py-0.5 text-xs font-medium", children: [_jsx(Trophy01Icon, { className: "text-utility-brand-600 size-3.5" }), "Top Payout"] }), _jsx("div", { className: "font-semibold", children: "No winners yet" }), _jsx("div", { className: "text-text-secondary-700 text-xs", children: "You could be the first to win the tournament!" })] })] })), _jsx(Button, { variant: "outline", className: twMerge('mt-5.5 px-3.5 py-2.5 text-sm', isDetailsVisible ? 'hidden' : 'flex'), onClick: () => setIsDetailsVisible(!isDetailsVisible), children: _jsxs("div", { className: "flex gap-1.5", children: ["See Details", _jsx(ArrowNarrowDownIcon, { className: "size-5" })] }) })] }), isPayingOut && (_jsx("div", { className: twMerge(styles['light-rays'], 'absolute right-0 top-0 rounded-2xl [--light-rays-top:15%] lg:[--light-rays-top:150px]') }))] }), isDetailsVisible && (_jsxs("div", { children: [_jsxs("div", { className: "z-1 flex-1", children: [_jsxs("div", { className: "flex items-center justify-between p-3", children: [_jsx("div", { className: "flex gap-2", children: _jsx("div", { className: "text-text-primary-900 text-lg font-semibold", children: jackpotPayouts.length ? 'Leaderboard' : 'Starting soon!' }) }), _jsx(JackpotRules, { jackpotRules: jackpot.description })] }), _jsx("div", { children: _jsx("div", { className: "border-gray-200 overflow-hidden", children: _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-bg-secondary text-text-tertiary-600 h-8 text-center text-xs font-medium", children: [_jsx("th", { className: "w-[52px]", children: "#" }), _jsx("th", { children: "Player" }), _jsx("th", { children: "Multiplier" }), _jsx("th", { children: "Prize" })] }) }), _jsx("tbody", { children: jackpotPayouts.length ? (_jsx(_Fragment, { children: jackpotPayouts.map((jackpotPayout, i) => (_jsxs("tr", { className: "bg-bg-primary text-text-secondary-700 text-center text-sm", children: [_jsx("td", { className: "border-border-secondary h-12 w-[52px] border-t-2", children: i + 1 < 6 ? (_jsxs("div", { className: "relative", children: [_jsx(StarIcon, { className: twMerge('mx-auto size-6.5', starTierStyles[i].starColor) }), _jsx("span", { className: twMerge('absolute inset-0 mt-0.5 flex items-center justify-center text-2xs font-bold', starTierStyles[i].numberColor), children: i + 1 })] })) : (i + 1) }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children:
|
|
44
|
+
}) })] })] }) })) : (_jsxs("div", { className: "bg-bg-primary relative mt-4 flex w-full gap-4 rounded-lg p-4", children: [_jsx(Image, { width: 66, height: 87, src: firstPlace, alt: "closeChest", className: "size-full h-auto w-[66px] mix-blend-luminosity" }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700 flex h-fit w-fit items-center gap-1 rounded-sm border px-2 py-0.5 text-xs font-medium", children: [_jsx(Trophy01Icon, { className: "text-utility-brand-600 size-3.5" }), "Top Payout"] }), _jsx("div", { className: "font-semibold", children: "No winners yet" }), _jsx("div", { className: "text-text-secondary-700 text-xs", children: "You could be the first to win the tournament!" })] })] })), _jsx(Button, { variant: "outline", className: twMerge('mt-5.5 px-3.5 py-2.5 text-sm', isDetailsVisible ? 'hidden' : 'flex'), onClick: () => setIsDetailsVisible(!isDetailsVisible), children: _jsxs("div", { className: "flex gap-1.5", children: ["See Details", _jsx(ArrowNarrowDownIcon, { className: "size-5" })] }) })] }), isPayingOut && (_jsx("div", { className: twMerge(styles['light-rays'], 'absolute right-0 top-0 rounded-2xl [--light-rays-top:15%] lg:[--light-rays-top:150px]') }))] }), isDetailsVisible && (_jsxs("div", { children: [_jsxs("div", { className: "z-1 flex-1", children: [_jsxs("div", { className: "flex items-center justify-between p-3", children: [_jsx("div", { className: "flex gap-2", children: _jsx("div", { className: "text-text-primary-900 text-lg font-semibold", children: jackpotPayouts.length ? 'Leaderboard' : 'Starting soon!' }) }), _jsx(JackpotRules, { jackpotRules: jackpot.description })] }), _jsx("div", { children: _jsx("div", { className: "border-gray-200 overflow-hidden", children: _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-bg-secondary text-text-tertiary-600 h-8 text-center text-xs font-medium", children: [_jsx("th", { className: "w-[52px]", children: "#" }), _jsx("th", { children: "Player" }), _jsx("th", { children: "Multiplier" }), _jsx("th", { children: "Prize" })] }) }), _jsx("tbody", { children: jackpotPayouts.length ? (_jsx(_Fragment, { children: jackpotPayouts.map((jackpotPayout, i) => (_jsxs("tr", { className: "bg-bg-primary text-text-secondary-700 text-center text-sm", children: [_jsx("td", { className: "border-border-secondary h-12 w-[52px] border-t-2", children: i + 1 < 6 ? (_jsxs("div", { className: "relative", children: [_jsx(StarIcon, { className: twMerge('mx-auto size-6.5', starTierStyles[i].starColor) }), _jsx("span", { className: twMerge('absolute inset-0 mt-0.5 flex items-center justify-center text-2xs font-bold', starTierStyles[i].numberColor), children: i + 1 })] })) : (i + 1) }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: maskDisplayName(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, {
|
|
44
45
|
currency: localeInfo.currency.code,
|
|
45
46
|
minDecimalPlaces: 2,
|
|
46
47
|
maxDecimalPlaces: 2,
|
|
47
|
-
}) })] }, i))) })) : (_jsx(_Fragment, { children: Array.from({ length: 10 }).map((_, i) => (_jsxs("tr", { className: "bg-bg-primary text-text-secondary-700 text-center text-sm", children: [_jsx("td", { className: "border-border-secondary h-12 w-[52px] border-t-2", children: i + 1 < 6 ? (_jsxs("div", { className: "relative", children: [_jsx(StarIcon, { className: twMerge('mx-auto size-6.5', starTierStyles[i].starColor) }), _jsx("span", { className: twMerge('absolute inset-0 mt-0.5 flex items-center justify-center text-2xs font-bold', starTierStyles[i].numberColor), children: i + 1 })] })) : (i + 1) }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" })] }, i))) })) })] }) }) })] }), Boolean(filteredGameProviders.length) && (_jsx(JackpotGameProviders, { gameProviders:
|
|
48
|
+
}) })] }, i))) })) : (_jsx(_Fragment, { children: Array.from({ length: 10 }).map((_, i) => (_jsxs("tr", { className: "bg-bg-primary text-text-secondary-700 text-center text-sm", children: [_jsx("td", { className: "border-border-secondary h-12 w-[52px] border-t-2", children: i + 1 < 6 ? (_jsxs("div", { className: "relative", children: [_jsx(StarIcon, { className: twMerge('mx-auto size-6.5', starTierStyles[i].starColor) }), _jsx("span", { className: twMerge('absolute inset-0 mt-0.5 flex items-center justify-center text-2xs font-bold', starTierStyles[i].numberColor), children: i + 1 })] })) : (i + 1) }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" })] }, i))) })) })] }) }) })] }), Boolean(filteredGameProviders.length) && (_jsx(JackpotGameProviders, { gameProviders: filteredGameProviders })), _jsx("div", { className: "m-3", children: _jsx(Button, { variant: "outline", className: twMerge('px-3.5 py-2.5 text-sm', !isDetailsVisible ? 'hidden' : 'flex'), onClick: () => setIsDetailsVisible(!isDetailsVisible), children: _jsxs("div", { className: "flex gap-1.5", children: ["Hide", _jsx(ArrowNarrowUpIcon, { className: "size-5" })] }) }) })] }))] }));
|
|
48
49
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import Image from 'next/image';
|
|
3
4
|
import { useJackpotsQuery } from '../../client/hooks/index.js';
|
|
5
|
+
import closeChest from '~/images/close-chest.png';
|
|
4
6
|
import { JackpotItemDesktop } from './JackpotItemDesktop.js';
|
|
5
7
|
import { JackpotItemMobile } from './JackpotItemMobile.js';
|
|
6
8
|
export function Jackpots(props) {
|
|
@@ -22,5 +24,5 @@ export function Jackpots(props) {
|
|
|
22
24
|
const jackpots = jackpotsQuery.data?.pages[0].edges.map((edge) => edge.node) ?? [];
|
|
23
25
|
if (jackpots.length <= 0)
|
|
24
26
|
return null;
|
|
25
|
-
return (_jsxs("div", { className: props.className, children: [_jsx("div", { className: "mb-3 text-lg font-semibold lg:mb-4.5", children: props.heading ?? 'Jackpots' }), _jsx("div", { className: "hidden flex-col gap-6 lg:flex", children: jackpots.map((jackpot) => (_jsx(JackpotItemDesktop, { gameProviders: props.gameProviders, jackpot: jackpot, viewAllUrl: props.viewAllUrl }, jackpot.id))) }), _jsx("div", { className: "flex flex-col gap-6 lg:hidden", children: jackpots.map((jackpot) => (_jsx(JackpotItemMobile, { gameProviders: props.gameProviders, jackpot: jackpot, viewAllUrl: props.viewAllUrl }, jackpot.id))) })] }));
|
|
27
|
+
return (_jsxs("div", { className: props.className, children: [_jsx("div", { className: "mb-3 text-lg font-semibold lg:mb-4.5", children: props.heading ?? 'Jackpots' }), jackpots.length > 0 ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "hidden flex-col gap-6 lg:flex", children: jackpots.map((jackpot) => (_jsx(JackpotItemDesktop, { gameProviders: props.gameProviders, jackpot: jackpot, viewAllUrl: props.viewAllUrl }, jackpot.id))) }), _jsx("div", { className: "flex flex-col gap-6 lg:hidden", children: jackpots.map((jackpot) => (_jsx(JackpotItemMobile, { gameProviders: props.gameProviders, jackpot: jackpot, viewAllUrl: props.viewAllUrl }, jackpot.id))) })] })) : (_jsxs("div", { className: "mt-11 flex flex-col items-center justify-center", children: [_jsx(Image, { width: 100, height: 100, src: closeChest, alt: "closeChest", quality: 100, className: "h-29.5 w-29.5 lg:h-25 lg:w-25 size-full mix-blend-luminosity" }), _jsx("div", { className: "text-text-primary-900 mt-4 text-base font-semibold", children: props.heading ?? 'Jackpots' }), _jsxs("div", { className: "text-text-tertiary-600 mt-1 text-center text-sm", children: ["No ", props.heading?.toLocaleLowerCase() ?? 'jackpots', " are running at the moment. ", _jsx("br", {}), "Please check back later!"] })] }))] }));
|
|
26
28
|
}
|
|
@@ -12,7 +12,6 @@ export declare function useJackpotItemData({ jackpot, gameProviders, }: JackpotI
|
|
|
12
12
|
isPayingOut: boolean;
|
|
13
13
|
jackpotAmount: string;
|
|
14
14
|
arrowImages: import("react/jsx-runtime").JSX.Element[];
|
|
15
|
-
calculatePercentage: (part: number, total: number) => number;
|
|
16
15
|
getAccumulatingJackpotDescription: (part: number, total: number) => string;
|
|
17
16
|
starTierStyles: {
|
|
18
17
|
starColor: string;
|
|
@@ -26,7 +26,6 @@ export function useJackpotItemData({ jackpot, gameProviders, }) {
|
|
|
26
26
|
.map(([key]) => key);
|
|
27
27
|
return gameProvider;
|
|
28
28
|
}, [jackpot]);
|
|
29
|
-
console.log('enabledJackpotGameProviders', enabledJackpotGameProviders);
|
|
30
29
|
const filteredGameProviders = gameProviders.filter((provider) => enabledJackpotGameProviders.includes(provider.id));
|
|
31
30
|
const localeInfo = useLocaleInfo();
|
|
32
31
|
const isPayingOut = jackpot.drawing;
|
|
@@ -44,11 +43,6 @@ export function useJackpotItemData({ jackpot, gameProviders, }) {
|
|
|
44
43
|
} }));
|
|
45
44
|
}, [isPayingOut]);
|
|
46
45
|
const arrowImages = useMemo(() => Array.from({ length: 40 }, (_, i) => (_jsx(Arrow, { isFirst: i === 0, index: i }, i))), [Arrow]);
|
|
47
|
-
const calculatePercentage = (part, total) => {
|
|
48
|
-
if (total === 0)
|
|
49
|
-
return 0;
|
|
50
|
-
return (part / total) * 100;
|
|
51
|
-
};
|
|
52
46
|
const getAccumulatingJackpotDescription = (part, total) => {
|
|
53
47
|
const percentage = total === 0 ? 0 : (part / total) * 100;
|
|
54
48
|
return percentage <= 90
|
|
@@ -85,7 +79,6 @@ export function useJackpotItemData({ jackpot, gameProviders, }) {
|
|
|
85
79
|
isPayingOut,
|
|
86
80
|
jackpotAmount,
|
|
87
81
|
arrowImages,
|
|
88
|
-
calculatePercentage,
|
|
89
82
|
getAccumulatingJackpotDescription,
|
|
90
83
|
starTierStyles,
|
|
91
84
|
};
|
|
@@ -10,17 +10,29 @@ import { FacebookPixel, GoogleRecaptcha } from '../../third-parties/index.js';
|
|
|
10
10
|
import { getQueryClient } from '../../utils/index.js';
|
|
11
11
|
export function PortalProvider__client({ googleAnalyticsId, googleTagManagerId, googleRecaptchaSiteKey, facebookPixelId, children, }) {
|
|
12
12
|
const queryClient = getQueryClient();
|
|
13
|
-
return (_jsxs(QueryClientProvider, { client: queryClient, children: [children, _jsx(Toaster, { toaster: toaster, children: (toast) => (_jsxs(Toast.Root, { className:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
return (_jsxs(QueryClientProvider, { client: queryClient, children: [children, _jsx(Toaster, { toaster: toaster, children: (toast) => (_jsxs(Toast.Root, { className: twMerge('group', 'p-xl', 'border', 'border-border-primary', 'bg-bg-primary-alt', 'flex', 'items-start', 'gap-lg', 'w-[21.438rem]', 'lg:w-[1200px]', 'max-w-full', 'rounded-xl', 'shadow-xs', 'h-[var(--height)]', 'z-[var(--z-index)]', 'scale-[var(--scale)]', 'opacity-[var(--opacity)]', '[translate:var(--x)_var(--y)_0]', 'transition-all', 'duration-300'), children: [_jsxs("div", { className: "flex grow flex-col gap-xl lg:flex-row lg:gap-lg", children: [_jsx("div", { className: twMerge('flex size-9.5 items-center justify-center rounded-full border-2', toast.type === 'error'
|
|
14
|
+
? 'border-text-error-primary/15'
|
|
15
|
+
: toast.type === 'warning'
|
|
16
|
+
? 'border-text-warning-primary/15'
|
|
17
|
+
: 'border-text-success-primary/15'), children: _jsx("div", { className: twMerge('flex size-7 items-center justify-center rounded-full border-2', toast.type === 'error'
|
|
18
|
+
? 'border-text-error-primary/35'
|
|
19
|
+
: toast.type === 'warning'
|
|
20
|
+
? 'border-text-warning-primary/35'
|
|
21
|
+
: 'border-text-success-primary/35'), children: _jsx(AlertCircleIcon, { className: twMerge('size-5', toast.type === 'error'
|
|
22
|
+
? 'text-text-error-primary'
|
|
23
|
+
: toast.type === 'warning'
|
|
24
|
+
? 'text-text-warning-primary'
|
|
25
|
+
: 'text-text-success-primary') }) }) }), _jsxs("div", { className: "grow text-sm leading-none", children: [_jsx(Toast.Title, { className: "text-text-secondary-700 font-semibold", children: toast.title
|
|
26
|
+
? toast.title
|
|
27
|
+
: toast.type === 'error'
|
|
28
|
+
? 'Error'
|
|
29
|
+
: toast.type === 'warning'
|
|
30
|
+
? 'Warning'
|
|
31
|
+
: 'Success' }), _jsx(Toast.Description, { className: "text-text-tertiary-600 mt-xs", children: toast.description
|
|
32
|
+
? toast.description
|
|
33
|
+
: toast.type === 'error'
|
|
34
|
+
? 'Something went wrong.'
|
|
35
|
+
: toast.type === 'warning'
|
|
36
|
+
? 'Please be cautious.'
|
|
37
|
+
: 'Operation completed successfully.' })] })] }), _jsx(Toast.CloseTrigger, { className: "text-text-secondary-700", children: _jsx(XIcon, { className: "size-5" }) })] }, toast.id)) }), facebookPixelId && _jsx(FacebookPixel, { fbId: facebookPixelId }), googleAnalyticsId && _jsx(GoogleAnalytics, { gaId: googleAnalyticsId }), googleTagManagerId && _jsx(GoogleTagManager, { gtmId: googleTagManagerId }), googleRecaptchaSiteKey && (_jsx(GoogleRecaptcha, { siteKey: googleRecaptchaSiteKey }))] }));
|
|
26
38
|
}
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import useEmblaCarousel from 'embla-carousel-react';
|
|
4
4
|
import Link from 'next/link';
|
|
5
5
|
import { useCallback, useEffect, useState } from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import { useTournamentsQuery } from '../../client/hooks/index.js';
|
|
7
7
|
import { ArrowLeftIcon, ArrowRightIcon, ChevronRightIcon } from '../../icons/index.js';
|
|
8
8
|
import { Button } from '../../ui/index.js';
|
|
9
9
|
import { TournamentCounterItem } from './TournamentCounterItem.js';
|
|
@@ -35,23 +35,16 @@ export function TournamentCounter__client(props) {
|
|
|
35
35
|
emblaApi.on('select', onSelect);
|
|
36
36
|
emblaApi.on('reInit', onSelect);
|
|
37
37
|
}, [emblaApi, onSelect]);
|
|
38
|
-
const
|
|
38
|
+
const tournamentsQuery = useTournamentsQuery({
|
|
39
39
|
first: 100,
|
|
40
40
|
filter: {
|
|
41
41
|
status: {
|
|
42
42
|
equal: 'ACTIVE',
|
|
43
43
|
},
|
|
44
|
-
deleted: {
|
|
45
|
-
equal: false,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
sort: {
|
|
49
|
-
cursor: 'POOL',
|
|
50
|
-
order: 'DESC',
|
|
51
44
|
},
|
|
52
45
|
});
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
46
|
+
const tournaments = tournamentsQuery.data?.pages[0].edges.map((edge) => edge.node) ?? [];
|
|
47
|
+
if (tournaments.length <= 0)
|
|
55
48
|
return null;
|
|
56
|
-
return (_jsxs("div", { className: props.className, children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-lg font-semibold", children: props.heading ?? 'Tournaments' }), _jsxs("div", { className: "flex items-center md:gap-3xl", children: [_jsxs(Link, { href: props.viewAllUrl ?? '/tournaments', 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:
|
|
49
|
+
return (_jsxs("div", { className: props.className, children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-lg font-semibold", children: props.heading ?? 'Tournaments' }), _jsxs("div", { className: "flex items-center md:gap-3xl", children: [_jsxs(Link, { href: props.viewAllUrl ?? '/tournaments', 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: tournaments.map((tournament, i) => (_jsx(TournamentCounterItem, { tournament: tournament, viewAllUrl: props.viewAllUrl, className: "w-full" }, i))) }) })] }));
|
|
57
50
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Tournament } from '@opexa/portal-sdk-core';
|
|
2
2
|
export interface TournamentCounterItemProps {
|
|
3
|
-
|
|
4
|
-
/** @default "/jackpots" */
|
|
3
|
+
tournament: Tournament;
|
|
5
4
|
className?: string;
|
|
6
5
|
/** @default "/tournaments" */
|
|
7
6
|
viewAllUrl?: string;
|
|
8
7
|
}
|
|
9
|
-
export declare function TournamentCounterItem({
|
|
8
|
+
export declare function TournamentCounterItem({ tournament, className, viewAllUrl, }: TournamentCounterItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { pick } from 'lodash-es';
|
|
4
4
|
import Image from 'next/image';
|
|
5
5
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
import { useLocaleInfo } from '../../client/hooks/index.js';
|
|
8
|
-
import { ChevronRightIcon, Trophy01Icon } from '../../icons/index.js';
|
|
8
|
+
import { ChevronRightIcon, Trophy01Icon, User01Icon } from '../../icons/index.js';
|
|
9
9
|
import { Award01Icon } from '../../icons/Award01Icon.js';
|
|
10
10
|
import { StarIcon } from '../../icons/StarIcon.js';
|
|
11
|
-
import firstPlace from '
|
|
12
|
-
import trophyTwo from '
|
|
13
|
-
import trophy from '
|
|
11
|
+
import firstPlace from '~/images/first-place.png';
|
|
12
|
+
import trophyTwo from '~/images/trophy-two.png';
|
|
13
|
+
import trophy from '~/images/trophy.png';
|
|
14
14
|
import Link from 'next/link';
|
|
15
15
|
import { formatNumber } from '../../utils/index.js';
|
|
16
|
+
import { maskDisplayName } from '../../utils/maskDisplayName.js';
|
|
16
17
|
import styles from '../JackpotCounter/JackpotCounterItem.module.css';
|
|
17
|
-
export function TournamentCounterItem({
|
|
18
|
+
export function TournamentCounterItem({ tournament, className, viewAllUrl, }) {
|
|
18
19
|
const localeInfo = useLocaleInfo();
|
|
19
20
|
const [timeRemaining, setTimeRemaining] = useState({
|
|
20
21
|
days: 0,
|
|
@@ -23,11 +24,7 @@ export function TournamentCounterItem({ jackpot, className, viewAllUrl, }) {
|
|
|
23
24
|
seconds: 0,
|
|
24
25
|
isPast: false,
|
|
25
26
|
});
|
|
26
|
-
|
|
27
|
-
const activationEndDateTime = useMemo(() => {
|
|
28
|
-
const now = new Date();
|
|
29
|
-
return new Date(now.setSeconds(now.getSeconds() + 2 * 24 * 60 * 60)); // Add 2 days in seconds
|
|
30
|
-
}, []);
|
|
27
|
+
const activationEndDateTime = useMemo(() => new Date(tournament.activationEndDateTime), [tournament.activationEndDateTime]);
|
|
31
28
|
const calculateRemainingTime = React.useCallback(() => {
|
|
32
29
|
const now = new Date();
|
|
33
30
|
const diffMs = activationEndDateTime.getTime() - now.getTime();
|
|
@@ -66,11 +63,25 @@ export function TournamentCounterItem({ jackpot, className, viewAllUrl, }) {
|
|
|
66
63
|
{ label: 'Min', value: timeRemaining.minutes },
|
|
67
64
|
{ label: 'Sec', value: timeRemaining.seconds },
|
|
68
65
|
];
|
|
69
|
-
|
|
66
|
+
const tournamentReward = Object.values(tournament.rewardSettings)
|
|
67
|
+
.map(Number)
|
|
68
|
+
.reduce((sum, val) => sum + val, 0);
|
|
69
|
+
const prizeAmountsByRank = Object.values(tournament.rewardSettings).map(Number);
|
|
70
|
+
return (_jsxs("div", { className: twMerge('bg-bg-tertiary border-border-primary relative flex shrink-0 rounded-2xl border p-3 text-center lg:gap-6 lg:p-5', className), children: [_jsx("div", { className: "z-1 relative flex flex-1 flex-col", children: _jsx("div", { className: "flex h-full flex-col justify-between", children: _jsx("div", { className: "flex w-full justify-between", children: _jsxs("div", { className: "flex w-full flex-col", children: [_jsxs("div", { className: "relative flex w-full justify-between", children: [_jsxs("div", { className: "w-full", children: [_jsxs("div", { className: "flex w-full justify-between", children: [_jsxs("div", { className: "border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700 flex h-fit w-fit items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium", children: [_jsx(Award01Icon, { className: "text-utility-brand-500 size-3.5" }), "Multiplier"] }), _jsx("div", { className: "flex h-fit", children: timeParts.map((part, idx) => (_jsxs(React.Fragment, { children: [_jsxs("div", { className: twMerge('bg-bg-primary text-text-primary-900 flex h-fit w-8 flex-col items-center rounded-[4px] pb-1.5'), children: [_jsx("span", { className: "text-base font-medium", children: String(part.value).padStart(2, '0') }), _jsx("span", { className: "text-[8px]", children: part.label })] }), idx < timeParts.length - 1 && (_jsxs("div", { className: "flex flex-col justify-center gap-[6px] px-[6px]", children: [_jsx("div", { className: "bg-bg-primary h-1 w-1 rounded-full" }), _jsx("div", { className: "bg-bg-primary h-1 w-1 rounded-full" })] }))] }, part.label))) })] }), _jsxs("div", { className: "flex justify-between", children: [_jsxs("div", { children: [_jsx("div", { className: "text-text-primary-900 mt-2.5 text-left text-lg font-medium lg:mt-5 lg:text-2xl", children: tournament.name }), _jsx("div", { className: "bg-bg-primary text-brand-400 mt-1.5 w-fit rounded-md px-2 py-1 text-2xl font-bold lg:mt-2 lg:text-4xl", children: formatNumber(tournamentReward, {
|
|
70
71
|
currency: localeInfo.currency.code,
|
|
71
72
|
minDecimalPlaces: 2,
|
|
72
73
|
maxDecimalPlaces: 2,
|
|
73
|
-
}) }), _jsx("div", { className: "text-text-primary-900 mt-4 block text-left text-base lg:hidden", children: "Play and Win!" })] }), _jsx("div", { className: "flex items-end lg:hidden", children: _jsx(Image, { src: trophy, alt: "trophy", quality: 100, width: 155, height: 155, className: "h-23 w-auto" }) })] })] }), _jsx("div", { className: "z-1 absolute -bottom-16 right-0 hidden lg:block", children: _jsx(Image, { quality: 100, width: 155, height: 155, src: trophy, alt: "trophy", className: "px-6 py-2.5" }) })] }), _jsxs("div", { className: "bg-bg-primary relative mt-4 hidden w-full gap-4 rounded-lg p-4 lg:flex", children: [
|
|
74
|
+
}) }), _jsx("div", { className: "text-text-primary-900 mt-4 block text-left text-base lg:hidden", children: "Play and Win!" })] }), _jsx("div", { className: "flex items-end lg:hidden", children: _jsx(Image, { src: trophy, alt: "trophy", quality: 100, width: 155, height: 155, className: "h-23 w-auto" }) })] })] }), _jsx("div", { className: "z-1 absolute -bottom-16 right-0 hidden lg:block", children: _jsx(Image, { quality: 100, width: 155, height: 155, src: trophy, alt: "trophy", className: "px-6 py-2.5" }) })] }), tournament.topPayouts.length ? (_jsx("div", { children: _jsxs("div", { className: "bg-bg-primary relative mt-4 hidden w-full gap-4 rounded-lg p-4 lg:flex", children: [_jsxs("div", { className: "bg-bg-tertiary relative flex h-18 w-18 items-center justify-center rounded-full", children: [_jsx(User01Icon, { className: "text-text-quarterary-500 size-9" }), _jsx("div", { className: "bg-yellow-400 text-brand-950 border-bg-primary absolute bottom-0 right-0 flex h-6 w-6 items-center justify-center rounded-full border-[1.5px] text-xs font-bold", children: "1st" })] }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700 flex h-fit w-fit items-center gap-1 rounded-sm border px-2 py-0.5 text-xs font-medium", children: [_jsx(Trophy01Icon, { className: "text-utility-brand-600 size-3.5" }), "Top Payout"] }), _jsx("div", { className: "font-semibold", children: maskDisplayName(tournament?.topPayouts[0]?.member?.name || '') }), _jsx("div", { className: "text-brand-400 text-2xl", children: formatNumber(tournament?.topPayouts[0]?.amount, {
|
|
75
|
+
currency: localeInfo.currency.code,
|
|
76
|
+
minDecimalPlaces: 2,
|
|
77
|
+
maxDecimalPlaces: 2,
|
|
78
|
+
}) })] })] }) })) : (_jsxs("div", { className: "bg-bg-primary relative mt-4 hidden w-full gap-4 rounded-lg p-4 lg:flex", children: [_jsx(Image, { width: 66, height: 87, src: firstPlace, alt: "closeChest", className: "size-full h-auto w-[66px] mix-blend-luminosity" }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700 flex h-fit w-fit items-center gap-1 rounded-sm border px-2 py-0.5 text-xs font-medium", children: [_jsx(Trophy01Icon, { className: "text-utility-brand-600 size-3.5" }), "Top Payout"] }), _jsx("div", { className: "font-semibold", children: "No winners yet" }), _jsx("div", { className: "text-text-secondary-700 text-xs", children: "You could be the first to win the tournament!" })] })] }))] }) }) }) }), _jsxs("div", { className: "z-1 hidden flex-1 space-y-4 lg:block", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Image, { width: 24, height: 24, src: trophyTwo, quality: 100, alt: "leaderboardIcon", className: "size-full w-6" }), _jsx("div", { className: "text-text-primary-900 text-lg font-semibold", children: tournament.currentLeaderboard.edges.length
|
|
79
|
+
? 'Leaderboard'
|
|
80
|
+
: 'Starting soon!' })] }), _jsxs(Link, { className: "text-button-tertiary-fg flex text-sm font-semibold", href: viewAllUrl ?? '/tournaments', 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", { className: "w-[52px]", children: "#" }), _jsx("th", { children: "Player" }), _jsx("th", { children: "Multiplier" }), _jsx("th", { children: "Prize" })] }) }), _jsx("tbody", { children: tournament.currentLeaderboard.edges.length ? (_jsx(_Fragment, { children: tournament.currentLeaderboard.edges.map((tournament, i) => (_jsxs("tr", { className: "bg-bg-primary text-text-secondary-700 text-sm", children: [_jsx("td", { className: "border-border-secondary h-12 w-[52px] border-t-2", children: i + 1 < 6 ? (_jsxs("div", { className: "relative", children: [_jsx(StarIcon, { className: twMerge('mx-auto size-6.5', starTierStyles[i].starColor) }), _jsx("span", { className: twMerge('absolute inset-0 mt-0.5 flex items-center justify-center text-2xs font-bold', starTierStyles[i].numberColor), children: i + 1 })] })) : (i + 1) }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: maskDisplayName(tournament.node.username) }), _jsxs("td", { className: "border-border-secondary h-12 border-t-2", children: [tournament.node.multiplier, "x"] }), i + 1 <= prizeAmountsByRank.length ? (_jsx("td", { className: "border-border-secondary text-brand-400 h-12 border-t-2", children: formatNumber(prizeAmountsByRank[i], {
|
|
81
|
+
currency: localeInfo.currency.code,
|
|
82
|
+
minDecimalPlaces: 2,
|
|
83
|
+
maxDecimalPlaces: 2,
|
|
84
|
+
}) })) : (_jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }))] }, i))) })) : (_jsx(_Fragment, { children: Array.from({ length: 10 }).map((_, i) => (_jsxs("tr", { className: "bg-bg-primary text-text-secondary-700 text-sm", children: [_jsx("td", { className: "border-border-secondary h-12 w-[52px] border-t-2", children: i + 1 < 6 ? (_jsxs("div", { className: "relative", children: [_jsx(StarIcon, { className: twMerge('mx-auto size-6.5', starTierStyles[i].starColor) }), _jsx("span", { className: twMerge('absolute inset-0 mt-0.5 flex items-center justify-center text-2xs font-bold', starTierStyles[i].numberColor), children: i + 1 })] })) : (i + 1) }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" })] }, i))) })) })] }) }) })] })] }));
|
|
74
85
|
}
|
|
75
86
|
const starTierStyles = [
|
|
76
87
|
{
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import type { GameProviderData } from '~/types';
|
|
2
|
+
export interface TournamentGameProvidersProps {
|
|
3
|
+
gameProviders: GameProviderData[];
|
|
4
|
+
}
|
|
5
|
+
export declare function TournamentGameProviders({ gameProviders, }: TournamentGameProvidersProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import useEmblaCarousel from 'embla-carousel-react';
|
|
4
4
|
import Image from 'next/image';
|
|
5
|
+
import Link from 'next/link';
|
|
5
6
|
import { useCallback, useEffect, useState } from 'react';
|
|
6
7
|
import { ArrowLeftIcon, ArrowRightIcon } from '../../icons/index.js';
|
|
7
|
-
import fantasmaGames from '../../images/fantasma-games.png';
|
|
8
|
-
import hackSaw from '../../images/hacksaw-gaming.png';
|
|
9
8
|
import { Button } from '../../ui/index.js';
|
|
10
|
-
export function TournamentGameProviders() {
|
|
9
|
+
export function TournamentGameProviders({ gameProviders, }) {
|
|
11
10
|
const [emblaRef, emblaApi] = useEmblaCarousel({
|
|
12
11
|
align: 'start',
|
|
13
12
|
slidesToScroll: 1,
|
|
@@ -35,5 +34,5 @@ export function TournamentGameProviders() {
|
|
|
35
34
|
emblaApi.on('select', onSelect);
|
|
36
35
|
emblaApi.on('reInit', onSelect);
|
|
37
36
|
}, [emblaApi, onSelect]);
|
|
38
|
-
return (_jsxs("div", { className: "p-4 pb-8", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-text-primary-900 text-lg font-semibold", children: "Tournament Game Providers" }), _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-3 overflow-hidden", ref: emblaRef, children: _jsx("div", { className: "flex gap-3.5", children:
|
|
37
|
+
return (_jsxs("div", { className: "p-4 pb-8", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-text-primary-900 text-lg font-semibold", children: "Tournament Game Providers" }), _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-3 overflow-hidden", ref: emblaRef, children: _jsx("div", { className: "flex gap-3.5", children: gameProviders.map((provider, i) => (_jsx(Link, { href: `/${provider.slug}`, className: "bg-gray-800 lg:bg-bg-primary-900 min-w-27.5 rounded-md", children: _jsx(Image, { src: provider.logo, alt: "provider", className: "size-full" }) }, i))) }) })] }));
|
|
39
38
|
}
|