@opexa/portal-components 0.0.839 → 0.0.840
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/components/PortalProvider/AndroidOnlyComponents.d.ts +1 -0
- package/dist/components/PortalProvider/AndroidOnlyComponents.js +12 -0
- package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.d.ts +10 -0
- package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.js +16 -51
- package/dist/components/Tournaments/TournamentsList/TournamentsListItemDesktop.d.ts +13 -1
- package/dist/components/Tournaments/TournamentsList/TournamentsListItemDesktop.js +24 -6
- package/dist/components/Tournaments/TournamentsList/TournamentsListItemMobile.d.ts +12 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsListItemMobile.js +23 -12
- package/dist/components/Tournaments/TournamentsList/useTournamentTimer.d.ts +13 -0
- package/dist/components/Tournaments/TournamentsList/useTournamentTimer.js +45 -0
- package/dist/services/queries.d.ts +1 -1
- package/dist/services/queries.js +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/ui/AlertDialog/AlertDialog.d.ts +88 -88
- package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +8 -8
- 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 +72 -72
- package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
- package/dist/ui/Dialog/Dialog.d.ts +33 -33
- package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
- package/dist/ui/Drawer/Drawer.d.ts +33 -33
- package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
- package/dist/ui/Menu/Menu.d.ts +90 -90
- package/dist/ui/Menu/menu.recipe.d.ts +5 -5
- 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.anatomy.d.ts +1 -1
- 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/package.json +1 -1
- package/dist/components/AccountInfo/GoogleDisconnect.d.ts +0 -7
- package/dist/components/AccountInfo/GoogleDisconnect.js +0 -11
- package/dist/components/DepositWithdrawal/AiOPaymentMethods.d.ts +0 -11
- package/dist/components/DepositWithdrawal/AiOPaymentMethods.js +0 -55
- package/dist/components/DepositWithdrawal/Deposit/GCashWebpayDeposit /GCashWebpayDeposit .d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/GCashWebpayDeposit /GCashWebpayDeposit .js +0 -191
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Confirmed.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Confirmed.js +0 -11
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Failed.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Failed.js +0 -11
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Form.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Form.js +0 -126
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/GeneratingQrCode.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/GeneratingQrCode.js +0 -10
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QRPHDeposit.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QRPHDeposit.js +0 -12
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QRPHDepositContext.d.ts +0 -17
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QRPHDepositContext.js +0 -2
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QrCodeGenerated.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QrCodeGenerated.js +0 -41
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/useQRPHDeposit.d.ts +0 -13
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/useQRPHDeposit.js +0 -91
- package/dist/components/DigitainLauncher/Loading.d.ts +0 -1
- package/dist/components/DigitainLauncher/Loading.js +0 -5
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +0 -184
- package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +0 -184
- package/dist/components/KYC/BasicInformation.d.ts +0 -1
- package/dist/components/KYC/BasicInformation.js +0 -101
- package/dist/components/KYC/IdentityVerification.d.ts +0 -1
- package/dist/components/KYC/IdentityVerification.js +0 -120
- package/dist/components/KYC/Indicator.d.ts +0 -1
- package/dist/components/KYC/Indicator.js +0 -8
- package/dist/components/KYC/KYC.lazy.d.ts +0 -6
- package/dist/components/KYC/KYC.lazy.js +0 -45
- package/dist/components/KYC/KYCContext.d.ts +0 -6
- package/dist/components/KYC/KYCContext.js +0 -2
- package/dist/components/KYC/PersonalInformation.d.ts +0 -1
- package/dist/components/KYC/PersonalInformation.js +0 -122
- package/dist/components/KYC/useKYC.d.ts +0 -25
- package/dist/components/KYC/useKYC.js +0 -38
- package/dist/components/PortalProvider/CXDTokenObserver.d.ts +0 -1
- package/dist/components/PortalProvider/CXDTokenObserver.js +0 -30
- package/dist/components/PortalProvider/LinkGoogleAccountObserver.d.ts +0 -1
- package/dist/components/PortalProvider/LinkGoogleAccountObserver.js +0 -29
- package/dist/components/SessionWatcher/SessionWatcher.d.ts +0 -1
- package/dist/components/SessionWatcher/SessionWatcher.js +0 -20
- package/dist/components/SessionWatcher/index.d.ts +0 -1
- package/dist/components/SessionWatcher/index.js +0 -1
- package/dist/icons/LinkBrokenIcon.d.ts +0 -2
- package/dist/icons/LinkBrokenIcon.js +0 -4
- package/dist/images/responsible-gaming-yellow.png +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AndroidOnlyComponents(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Capacitor } from '@capacitor/core';
|
|
4
|
+
import { AndroidRoutingHandler } from './AndroidRoutingHandler.js';
|
|
5
|
+
import PushNotification from './PushNotifications.js';
|
|
6
|
+
export function AndroidOnlyComponents() {
|
|
7
|
+
const platform = Capacitor.getPlatform();
|
|
8
|
+
const isNative = platform === 'android' || platform === 'ios';
|
|
9
|
+
if (!isNative)
|
|
10
|
+
return null;
|
|
11
|
+
return (_jsxs(_Fragment, { children: [_jsx(PushNotification, {}), _jsx(AndroidRoutingHandler, {})] }));
|
|
12
|
+
}
|
|
@@ -4,12 +4,22 @@ interface ClassNameEntries {
|
|
|
4
4
|
badgeRoot?: string;
|
|
5
5
|
badgeLabel?: string;
|
|
6
6
|
badgeIcon?: string;
|
|
7
|
+
countdownHeading?: string;
|
|
8
|
+
countdownSubheading?: string;
|
|
9
|
+
countdownLabel?: string;
|
|
10
|
+
countdownTime?: string;
|
|
11
|
+
countdownSeparator?: string;
|
|
7
12
|
}
|
|
8
13
|
interface StyleEntries {
|
|
9
14
|
root?: CSSProperties;
|
|
10
15
|
badgeRoot?: CSSProperties;
|
|
11
16
|
badgeLabel?: CSSProperties;
|
|
12
17
|
badgeIcon?: CSSProperties;
|
|
18
|
+
countdownHeading?: CSSProperties;
|
|
19
|
+
countdownSubheading?: CSSProperties;
|
|
20
|
+
countdownLabel?: CSSProperties;
|
|
21
|
+
countdownTime?: CSSProperties;
|
|
22
|
+
countdownSeparator?: CSSProperties;
|
|
13
23
|
}
|
|
14
24
|
export interface TournamentsCarouselItemProps {
|
|
15
25
|
style?: CSSProperties | StyleEntries;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { format } from 'date-fns';
|
|
4
|
+
import { isString } from 'lodash-es';
|
|
4
5
|
import Image from 'next/image';
|
|
5
6
|
import Link from 'next/link';
|
|
6
|
-
import React, {
|
|
7
|
+
import React, {} from 'react';
|
|
7
8
|
import { twMerge } from 'tailwind-merge';
|
|
8
9
|
import { useLocaleInfo } from '../../../client/hooks/useLocaleInfo.js';
|
|
9
10
|
import { Award01Icon } from '../../../icons/Award01Icon.js';
|
|
@@ -12,62 +13,21 @@ import { StarIcon } from '../../../icons/StarIcon.js';
|
|
|
12
13
|
import { Trophy01Icon } from '../../../icons/Trophy01Icon.js';
|
|
13
14
|
import { User01Icon } from '../../../icons/User01Icon.js';
|
|
14
15
|
import firstPlace from '../../../images/first-place.png';
|
|
15
|
-
import trophy from '../../../images/trophy.png';
|
|
16
16
|
import trophyTwo from '../../../images/trophy-two.png';
|
|
17
|
+
import trophy from '../../../images/trophy.png';
|
|
17
18
|
import { formatNumber } from '../../../utils/formatNumber.js';
|
|
18
19
|
import { isStyleEntries } from '../../../utils/isStyleEntries.js';
|
|
19
20
|
import { maskFirstLast } from '../../../utils/mask.js';
|
|
21
|
+
import { useTournamentTimer } from '../TournamentsList/useTournamentTimer.js';
|
|
20
22
|
import { useTournamentsCarouselItemContext } from './TournamentsCarouselContext.js';
|
|
21
23
|
import css from './TournamentsCarouselItem.module.css';
|
|
22
24
|
export function TournamentsCarouselItem({ style, className, viewAllUrl, }) {
|
|
23
25
|
const tournament = useTournamentsCarouselItemContext();
|
|
24
26
|
const localeInfo = useLocaleInfo();
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
minutes: 0,
|
|
29
|
-
seconds: 0,
|
|
30
|
-
isPast: false,
|
|
27
|
+
const { isLaunchStarts, timeParts, now } = useTournamentTimer({
|
|
28
|
+
activationEndDateTime: tournament.activationEndDateTime,
|
|
29
|
+
activationStartDateTime: tournament.activationStartDateTime,
|
|
31
30
|
});
|
|
32
|
-
const activationEndDateTime = useMemo(() => new Date(tournament.activationEndDateTime), [tournament.activationEndDateTime]);
|
|
33
|
-
const calculateRemainingTime = React.useCallback(() => {
|
|
34
|
-
const now = new Date();
|
|
35
|
-
const diffMs = activationEndDateTime.getTime() - now.getTime();
|
|
36
|
-
if (diffMs <= 0) {
|
|
37
|
-
setTimeRemaining({
|
|
38
|
-
days: 0,
|
|
39
|
-
hours: 0,
|
|
40
|
-
minutes: 0,
|
|
41
|
-
seconds: 0,
|
|
42
|
-
isPast: true,
|
|
43
|
-
});
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const diffSeconds = Math.floor(diffMs / 1000);
|
|
47
|
-
const days = Math.floor(diffSeconds / (3600 * 24));
|
|
48
|
-
const hours = Math.floor((diffSeconds % (3600 * 24)) / 3600);
|
|
49
|
-
const minutes = Math.floor((diffSeconds % 3600) / 60);
|
|
50
|
-
const seconds = diffSeconds % 60;
|
|
51
|
-
const updated = pick({ days, hours, minutes, seconds, isPast: false }, [
|
|
52
|
-
'days',
|
|
53
|
-
'hours',
|
|
54
|
-
'minutes',
|
|
55
|
-
'seconds',
|
|
56
|
-
'isPast',
|
|
57
|
-
]);
|
|
58
|
-
setTimeRemaining(updated);
|
|
59
|
-
}, [activationEndDateTime]);
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
calculateRemainingTime();
|
|
62
|
-
const interval = setInterval(calculateRemainingTime, 1000); // Update every second
|
|
63
|
-
return () => clearInterval(interval);
|
|
64
|
-
}, [calculateRemainingTime]);
|
|
65
|
-
const timeParts = [
|
|
66
|
-
{ label: 'Day', value: timeRemaining.days },
|
|
67
|
-
{ label: 'Hour', value: timeRemaining.hours },
|
|
68
|
-
{ label: 'Min', value: timeRemaining.minutes },
|
|
69
|
-
{ label: 'Sec', value: timeRemaining.seconds },
|
|
70
|
-
];
|
|
71
31
|
const tournamentReward = Object.values(tournament.rewardSettings)
|
|
72
32
|
.map(Number)
|
|
73
33
|
.reduce((sum, val) => sum + val, 0);
|
|
@@ -83,18 +43,23 @@ export function TournamentsCarouselItem({ style, className, viewAllUrl, }) {
|
|
|
83
43
|
const classNames = isString(className)
|
|
84
44
|
? { root: className }
|
|
85
45
|
: (className ?? {});
|
|
86
|
-
|
|
46
|
+
const isEnded = new Date(tournament.activationEndDateTime) < now;
|
|
47
|
+
return (_jsxs("div", { className: twMerge('relative flex w-full shrink-0 rounded-2xl border border-border-primary bg-bg-tertiary p-3 text-center lg:gap-6 lg:p-5', classNames.root), style: styles.root, children: [_jsx("div", { className: "relative z-1 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", { style: styles.badgeRoot, className: twMerge('flex h-fit w-fit items-center gap-1 rounded-full border border-utility-brand-200 bg-utility-brand-50 px-2 py-0.5 font-medium text-utility-brand-700 text-xs', classNames.badgeRoot), children: [_jsx(Award01Icon, { style: styles.badgeIcon, className: twMerge('size-3.5 text-utility-brand-500', classNames.badgeIcon) }), _jsx("span", { style: styles.badgeLabel, className: classNames.badgeLabel, children: "Multiplier" })] }), _jsxs("div", { className: "flex flex-col", children: [isEnded && (_jsxs("div", { className: twMerge('mb-2 flex flex-col items-center justify-center whitespace-nowrap rounded-md bg-[#0C0E12] px-2 py-1.5 font-semibold text-[#EAAA08] text-sm', classNames.countdownHeading), children: [_jsx("span", { className: "font-semibold", children: "Ended" }), _jsx("span", { className: twMerge('text-[9px] text-white', classNames.countdownSubheading), children: format(tournament.activationEndDateTime, 'MMMM dd, yyyy') })] })), !isLaunchStarts && !isEnded && (_jsx("div", { className: twMerge('mb-2 flex items-center justify-center rounded-md bg-[#0C0E12] py-1 font-semibold text-[#EAAA08] text-sm', classNames.countdownHeading), children: "Launching Soon" })), !isEnded && (_jsx("div", { className: "flex h-fit", children: timeParts.map((part, idx) => (_jsxs(React.Fragment, { children: [_jsxs("div", { className: twMerge('flex h-fit w-8 flex-col items-center rounded-[0.25rem] bg-bg-primary pb-1.5 text-text-primary-900'), children: [_jsx("span", { className: "font-medium text-base", children: String(part.value).padStart(2, '0') }), _jsx("span", { className: "text-3xs", children: part.label })] }), idx < timeParts.length - 1 && (_jsxs("div", { className: "flex flex-col justify-center gap-1.5 px-1.5", children: [_jsx("div", { className: "h-1 w-1 rounded-full bg-bg-primary" }), _jsx("div", { className: "h-1 w-1 rounded-full bg-bg-primary" })] }))] }, part.label))) }))] })] }), _jsxs("div", { className: "flex justify-between", children: [_jsxs("div", { children: [_jsx("div", { className: "text-left font-medium text-lg text-text-primary-900 lg:text-2xl", children: tournament.name }), _jsx("div", { className: "mt-1.5 w-fit rounded-md bg-bg-primary px-2 py-1 font-bold text-2xl text-brand-400 lg:mt-2 lg:text-4xl", children: formatNumber(tournamentReward, {
|
|
87
48
|
currency: localeInfo.currency.code,
|
|
88
49
|
minDecimalPlaces: 2,
|
|
89
50
|
maxDecimalPlaces: 2,
|
|
90
|
-
}) }), _jsx("div", { className: "mt-4 block text-left text-base text-text-primary-900 lg:hidden", children: "Play and Win!" })] }), _jsx("div", { className: "flex items-end lg:hidden", children: _jsx(Image, { src: trophy, alt: "trophy", width: 155, height: 155, className: "h-23 w-auto" }) })] })] }), _jsx("div", { className: "-bottom-16
|
|
51
|
+
}) }), _jsx("div", { className: "mt-4 block text-left text-base text-text-primary-900 lg:hidden", children: "Play and Win!" })] }), _jsx("div", { className: "flex items-end lg:hidden", children: _jsx(Image, { src: trophy, alt: "trophy", width: 155, height: 155, className: "h-23 w-auto" }) })] })] }), _jsx("div", { className: "-bottom-16 -right-6 absolute z-1 hidden lg:block", children: _jsx(Image, { width: 155, height: 155, src: trophy, alt: "trophy", className: "px-6 py-2.5" }) })] }), tournament.topPayouts.length ? (_jsx("div", { children: _jsxs("div", { className: "relative mt-4 hidden w-full gap-4 rounded-lg bg-bg-primary p-4 lg:flex", children: [_jsxs("div", { className: "relative flex h-18 w-18 items-center justify-center rounded-full bg-bg-tertiary", children: [_jsx(User01Icon, { className: "size-9 text-text-quarterary-500" }), _jsx("div", { className: "absolute right-0 bottom-safe-area-inset-bottom flex h-6 w-6 items-center justify-center rounded-full border-[1.5px] border-bg-primary bg-yellow-400 font-bold text-brand-950 text-xs", children: "1st" })] }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "flex h-fit w-fit items-center gap-1 rounded-sm border border-utility-brand-200 bg-utility-brand-50 px-2 py-0.5 font-medium text-utility-brand-700 text-xs", children: [_jsx(Trophy01Icon, { className: "size-3.5 text-utility-brand-600" }), "Top Payout"] }), _jsx("div", { className: "font-semibold", children: maskFirstLast(tournament?.topPayouts[0]?.member?.name || '', {
|
|
52
|
+
midLength: 4,
|
|
53
|
+
}) }), _jsx("div", { className: "text-2xl text-brand-400", children: formatNumber(tournament?.topPayouts[0]?.amount, {
|
|
91
54
|
currency: localeInfo.currency.code,
|
|
92
55
|
minDecimalPlaces: 2,
|
|
93
56
|
maxDecimalPlaces: 2,
|
|
94
57
|
}) })] })] }) })) : (_jsxs("div", { className: "relative mt-4 hidden w-full gap-4 rounded-lg bg-bg-primary p-4 lg:flex", children: [_jsx(Image, { width: 66, height: 87, src: firstPlace, alt: "closeChest", className: "size-full h-auto w-[4.125rem] mix-blend-luminosity" }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "flex h-fit w-fit items-center gap-1 rounded-sm border border-utility-brand-200 bg-utility-brand-50 px-2 py-0.5 font-medium text-utility-brand-700 text-xs", children: [_jsx(Trophy01Icon, { className: "size-3.5 text-utility-brand-600" }), "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, alt: "leaderboardIcon", className: "size-full w-6" }), _jsx("div", { className: "font-semibold text-lg text-text-primary-900", children: tournament.currentLeaderboard.edges.length
|
|
95
58
|
? 'Leaderboard'
|
|
96
59
|
: 'Starting soon!' })] }), _jsxs(Link, { className: "flex font-semibold text-button-tertiary-fg text-sm", href: viewAllUrl ?? '/tournaments', children: ["See details", _jsx(ChevronRightIcon, { className: "size-5" })] })] }), _jsx("div", { className: twMerge('max-h-[17rem] overflow-y-scroll', css.scrollArea), children: _jsx("div", { className: "overflow-hidden rounded-xl border-gray-200", children: _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsxs("tr", { className: "h-8 bg-bg-secondary font-medium text-text-tertiary-600 text-xs", children: [_jsx("th", { className: "w-[3.25rem]", children: "#" }), _jsx("th", { children: "Player" }), _jsx("th", { children: "Multiplier" }), _jsx("th", { children: "Prize" })] }) }), _jsx("tbody", { children: tournament.currentLeaderboard.edges.length
|
|
97
|
-
? tournament.currentLeaderboard.edges.map((tournament, i) => (_jsxs("tr", { className: "bg-bg-primary text-sm text-text-secondary-700", children: [_jsx("td", { className: "h-12 w-[3.25rem] border-border-secondary 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 font-bold text-2xs', starTierStyles[i].numberColor), children: i + 1 })] })) : (i + 1) }), _jsx("td", { className: "h-12 border-border-secondary border-t-2", children: maskFirstLast(tournament.node.username
|
|
60
|
+
? tournament.currentLeaderboard.edges.map((tournament, i) => (_jsxs("tr", { className: "bg-bg-primary text-sm text-text-secondary-700", children: [_jsx("td", { className: "h-12 w-[3.25rem] border-border-secondary 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 font-bold text-2xs', starTierStyles[i].numberColor), children: i + 1 })] })) : (i + 1) }), _jsx("td", { className: "h-12 border-border-secondary border-t-2", children: maskFirstLast(tournament.node.username, {
|
|
61
|
+
midLength: 4,
|
|
62
|
+
}) }), _jsxs("td", { className: "h-12 border-border-secondary border-t-2", children: [tournament.node.multiplier, "x"] }), i + 1 <= prizeAmountsByRank.length ? (_jsx("td", { className: "h-12 border-border-secondary border-t-2 text-brand-400", children: formatNumber(prizeAmountsByRank[i], {
|
|
98
63
|
currency: localeInfo.currency.code,
|
|
99
64
|
minDecimalPlaces: 2,
|
|
100
65
|
maxDecimalPlaces: 2,
|
|
@@ -1,15 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
2
|
interface ClassNameEntries {
|
|
3
|
+
outerRoot?: string;
|
|
3
4
|
root?: string;
|
|
4
5
|
badgeRoot?: string;
|
|
5
6
|
badgeLabel?: string;
|
|
6
7
|
badgeIcon?: string;
|
|
8
|
+
countdownHeading?: string;
|
|
9
|
+
countdownSubheading?: string;
|
|
10
|
+
countdownLabel?: string;
|
|
11
|
+
countdownTime?: string;
|
|
12
|
+
countdownSeparator?: string;
|
|
7
13
|
}
|
|
8
14
|
interface StyleEntries {
|
|
15
|
+
outerRoot?: CSSProperties;
|
|
9
16
|
root?: CSSProperties;
|
|
10
17
|
badgeRoot?: CSSProperties;
|
|
11
18
|
badgeLabel?: CSSProperties;
|
|
12
19
|
badgeIcon?: CSSProperties;
|
|
20
|
+
countdownHeading?: CSSProperties;
|
|
21
|
+
countdownSubheading?: CSSProperties;
|
|
22
|
+
countdownLabel?: CSSProperties;
|
|
23
|
+
countdownTime?: CSSProperties;
|
|
24
|
+
countdownSeparator?: CSSProperties;
|
|
13
25
|
}
|
|
14
26
|
interface TournamentsListItemDesktopProps {
|
|
15
27
|
style?: CSSProperties | StyleEntries;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { format } from 'date-fns';
|
|
2
3
|
import { isString } from 'lodash-es';
|
|
3
4
|
import Image from 'next/image';
|
|
4
|
-
import React
|
|
5
|
+
import React from 'react';
|
|
5
6
|
import { twMerge } from 'tailwind-merge';
|
|
6
7
|
import { Award01Icon } from '../../../icons/Award01Icon.js';
|
|
7
8
|
import { StarIcon } from '../../../icons/StarIcon.js';
|
|
8
9
|
import { Trophy01Icon } from '../../../icons/Trophy01Icon.js';
|
|
9
10
|
import { User01Icon } from '../../../icons/User01Icon.js';
|
|
10
11
|
import firstPlace from '../../../images/first-place.png';
|
|
11
|
-
import trophy from '../../../images/trophy.png';
|
|
12
12
|
import trophyTwo from '../../../images/trophy-two.png';
|
|
13
|
+
import trophy from '../../../images/trophy.png';
|
|
13
14
|
import { formatNumber } from '../../../utils/formatNumber.js';
|
|
14
15
|
import { isStyleEntries } from '../../../utils/isStyleEntries.js';
|
|
15
16
|
import { maskFirstLast } from '../../../utils/mask.js';
|
|
@@ -18,9 +19,14 @@ import { useTournamentsListItemContext } from './TournamentsListContext.js';
|
|
|
18
19
|
import { TournamentsListItemGameProviders } from './TournamentsListItemGameProviders.js';
|
|
19
20
|
import { TournamentsListItemRules } from './TournamentsListItemRules.js';
|
|
20
21
|
import { useTournamentsListItemData } from './useTournamentListItemData.js';
|
|
22
|
+
import { useTournamentTimer } from './useTournamentTimer.js';
|
|
21
23
|
export function TournamentsListItemDesktop({ style, className, }) {
|
|
22
24
|
const tournament = useTournamentsListItemContext();
|
|
23
|
-
const {
|
|
25
|
+
const { isLaunchStarts, timeParts, now } = useTournamentTimer({
|
|
26
|
+
activationEndDateTime: tournament.activationEndDateTime,
|
|
27
|
+
activationStartDateTime: tournament.activationStartDateTime,
|
|
28
|
+
});
|
|
29
|
+
const { tournamentReward, filteredGameProviders, localeInfo } = useTournamentsListItemData();
|
|
24
30
|
const styles = isStyleEntries(style, [
|
|
25
31
|
'root',
|
|
26
32
|
'badgeRoot',
|
|
@@ -32,18 +38,30 @@ export function TournamentsListItemDesktop({ style, className, }) {
|
|
|
32
38
|
const classNames = isString(className)
|
|
33
39
|
? { root: className }
|
|
34
40
|
: (className ?? {});
|
|
35
|
-
|
|
41
|
+
const isEnded = new Date(tournament.activationEndDateTime) < now;
|
|
42
|
+
return (_jsxs("div", { style: styles.outerRoot, className: twMerge('overflow-hidden rounded-2xl border border-border-primary bg-[#13161B]', classNames.outerRoot), children: [_jsxs("div", { style: styles.root, className: twMerge('relative flex shrink-0 rounded-2xl p-3 text-center lg:gap-6 lg:p-5', classNames.root), children: [_jsx("div", { className: "relative z-1 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", { style: styles.badgeRoot, className: twMerge('flex h-fit w-fit items-center gap-1 rounded-full border border-utility-brand-200 bg-utility-brand-50 px-2 py-0.5 font-medium text-utility-brand-700 text-xs', classNames.badgeRoot), children: [_jsx(Award01Icon, { style: styles.badgeIcon, className: twMerge('size-3.5 text-utility-brand-500', classNames.badgeIcon) }), _jsx("span", { style: styles.badgeLabel, className: classNames.badgeLabel, children: "Multiplier" })] }), _jsx("div", { className: "mt-1 text-left font-medium text-lg text-text-primary-900 lg:mt-4.5 lg:text-2xl", children: tournament.name }), _jsx("div", { className: "mt-1.5 w-fit rounded-md bg-bg-primary px-2 py-1 font-bold text-2xl text-brand-400 lg:mt-2 lg:mb-5xl lg:text-4xl", children: formatNumber(tournamentReward, {
|
|
36
43
|
currency: localeInfo.currency.code,
|
|
37
44
|
minDecimalPlaces: 2,
|
|
38
45
|
maxDecimalPlaces: 2,
|
|
39
|
-
}) })] }),
|
|
46
|
+
}) })] }), _jsxs("div", { className: "flex h-fit flex-col", children: [isEnded && (_jsxs("div", { className: twMerge('mb-2 flex flex-col items-center justify-center whitespace-nowrap rounded-md bg-[#0C0E12] px-2 py-1.5 font-semibold text-[#EAAA08] text-sm', classNames.countdownHeading), children: [_jsx("span", { className: "font-semibold", children: "Ended" }), _jsx("span", { className: twMerge('text-[9px] text-white', classNames.countdownSubheading), children: format(tournament.activationEndDateTime, 'MMMM dd, yyyy') })] })), !isLaunchStarts && !isEnded && (_jsx("div", { className: twMerge('mb-2 flex items-center justify-center rounded-md bg-[#0C0E12] py-1 font-semibold text-[#EAAA08] text-sm', classNames.countdownHeading), children: "Launching Soon" })), !isEnded && (_jsx("div", { className: "flex justify-end space-x-2 text-center text-yellow-900", children: timeParts.map((part, idx) => {
|
|
47
|
+
return (_jsxs(React.Fragment, { children: [_jsxs("div", { className: "rounded-md bg-[#0C0E12] p-1", children: [_jsx("p", { className: twMerge('w-[32px] font-medium text-[#FFFFFF] text-xl', classNames.countdownTime), children: part.value }), _jsx("p", { className: "text-[#FFFFFF] text-[8px]", children: part.label })] }), idx < timeParts.length - 1 && (_jsxs("div", { className: "flex flex-col items-center justify-center gap-1.5", children: [_jsx("span", { className: twMerge('inline-flex h-1 w-1 rounded-full bg-[#0C0E12]', classNames.countdownSeparator) }), _jsx("span", { className: twMerge('inline-flex h-1 w-1 rounded-full bg-[#0C0E12]', classNames.countdownSeparator) })] }))] }, part.label));
|
|
48
|
+
}) }))] }), _jsx("div", { className: "-right-7 bottom-[-70px] z-1 block lg:absolute", children: _jsx("div", { className: "h-[9.688rem] w-auto shrink-0", children: _jsx(Image, { width: 155, height: 155, src: trophy, alt: "trophy", className: "px-6 py-2.5" }) }) })] }), tournament.topPayouts.length ? (_jsx("div", { children: _jsxs("div", { className: "relative mt-4 hidden w-full gap-4 rounded-lg bg-bg-primary p-4 lg:flex", children: [_jsxs("div", { className: "relative flex h-18 w-18 items-center justify-center rounded-full bg-bg-tertiary", children: [_jsx(User01Icon, { className: "size-9 text-text-quarterary-500" }), _jsx("div", { className: "absolute right-0 bottom-safe-area-inset-bottom flex h-6 w-6 items-center justify-center rounded-full border-[1.5px] border-bg-primary bg-yellow-400 font-bold text-brand-950 text-xs", children: "1st" })] }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "flex h-fit w-fit items-center gap-1 rounded-sm border border-utility-brand-200 bg-utility-brand-50 px-2 py-0.5 font-medium text-utility-brand-700 text-xs", children: [_jsx(Trophy01Icon, { className: "size-3.5 text-utility-brand-600" }), "Top Payout"] }), _jsx("div", { className: "font-semibold", children: maskFirstLast(tournament?.topPayouts[0]?.member?.name || '', { midLength: 4 }) }), _jsx("div", { className: "text-2xl text-brand-400", children: formatNumber(tournament?.topPayouts[0]?.amount, {
|
|
40
49
|
currency: localeInfo.currency.code,
|
|
41
50
|
minDecimalPlaces: 2,
|
|
42
51
|
maxDecimalPlaces: 2,
|
|
43
52
|
}) })] })] }) })) : (_jsxs("div", { className: "relative mt-4 hidden w-full gap-4 rounded-lg bg-bg-primary p-4 lg:flex", children: [_jsx(Image, { width: 66, height: 87, src: firstPlace, alt: "closeChest", className: "size-full h-auto w-[4.125rem] mix-blend-luminosity" }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "flex h-fit w-fit items-center gap-1 rounded-sm border border-utility-brand-200 bg-utility-brand-50 px-2 py-0.5 font-medium text-utility-brand-700 text-xs", children: [_jsx(Trophy01Icon, { className: "size-3.5 text-utility-brand-600" }), "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, alt: "leaderboardIcon", className: "size-full w-6" }), _jsx("div", { className: "font-semibold text-lg text-text-primary-900", children: tournament.currentLeaderboard.edges.length
|
|
44
53
|
? 'Leaderboard'
|
|
45
54
|
: 'Starting soon!' })] }), _jsx(TournamentsListItemRules, {})] }), _jsx("div", { className: twMerge('max-h-[17rem] overflow-y-scroll', css.scrollArea), children: _jsx("div", { className: "overflow-hidden rounded-xl border-gray-200", children: _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsxs("tr", { className: "h-8 bg-bg-secondary font-medium text-text-tertiary-600 text-xs", children: [_jsx("th", { className: "w-[3.25rem]", children: "#" }), _jsx("th", { children: "Player" }), _jsx("th", { children: "Multiplier" }), _jsx("th", { children: "Prize" })] }) }), _jsx("tbody", { children: tournament.currentLeaderboard.edges.length
|
|
46
|
-
?
|
|
55
|
+
? [
|
|
56
|
+
...tournament.currentLeaderboard.edges,
|
|
57
|
+
...Array(Math.max(0, 10 - tournament.currentLeaderboard.edges.length)).fill(''),
|
|
58
|
+
].map((tournament, i) => (_jsxs("tr", { className: "bg-bg-primary text-sm text-text-secondary-700", children: [_jsx("td", { className: "h-12 w-[3.25rem] border-border-secondary 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 font-bold text-2xs', starTierStyles[i].numberColor), children: i + 1 })] })) : (i + 1) }), _jsx("td", { className: "h-12 border-border-secondary border-t-2", children: tournament.node?.username
|
|
59
|
+
? maskFirstLast(tournament.node.username, {
|
|
60
|
+
midLength: 4,
|
|
61
|
+
})
|
|
62
|
+
: '-' }), _jsx("td", { className: "h-12 border-border-secondary border-t-2", children: tournament.node?.multiplier
|
|
63
|
+
? `${tournament.node.multiplier}x`
|
|
64
|
+
: '-' }), tournament.node?.prize ? (_jsx("td", { className: "h-12 border-border-secondary border-t-2 text-brand-400", children: formatNumber(tournament.node.prize, {
|
|
47
65
|
currency: localeInfo.currency.code,
|
|
48
66
|
minDecimalPlaces: 2,
|
|
49
67
|
maxDecimalPlaces: 2,
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import { type CSSProperties } from 'react';
|
|
2
2
|
interface ClassNameEntries {
|
|
3
|
+
outerRoot?: string;
|
|
3
4
|
root?: string;
|
|
4
5
|
badgeRoot?: string;
|
|
5
6
|
badgeLabel?: string;
|
|
6
7
|
badgeIcon?: string;
|
|
8
|
+
countdownHeading?: string;
|
|
9
|
+
countdownSubheading?: string;
|
|
10
|
+
countdownLabel?: string;
|
|
11
|
+
countdownTime?: string;
|
|
12
|
+
countdownSeparator?: string;
|
|
7
13
|
}
|
|
8
14
|
interface StyleEntries {
|
|
15
|
+
outerRoot?: CSSProperties;
|
|
9
16
|
root?: CSSProperties;
|
|
10
17
|
badgeRoot?: CSSProperties;
|
|
11
18
|
badgeLabel?: CSSProperties;
|
|
12
19
|
badgeIcon?: CSSProperties;
|
|
20
|
+
countdownHeading?: CSSProperties;
|
|
21
|
+
countdownSubheading?: CSSProperties;
|
|
22
|
+
countdownLabel?: CSSProperties;
|
|
23
|
+
countdownTime?: CSSProperties;
|
|
24
|
+
countdownSeparator?: CSSProperties;
|
|
13
25
|
}
|
|
14
26
|
interface TournamentsListItemMobileProps {
|
|
15
27
|
style?: CSSProperties | StyleEntries;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { format } from 'date-fns';
|
|
2
3
|
import { isString } from 'lodash-es';
|
|
3
4
|
import Image from 'next/image';
|
|
4
|
-
import {
|
|
5
|
+
import React, { useState } from 'react';
|
|
5
6
|
import { twMerge } from 'tailwind-merge';
|
|
6
7
|
import { ArrowNarrowDownIcon } from '../../../icons/ArrowNarrowDownIcon.js';
|
|
7
8
|
import { ArrowNarrowUpIcon } from '../../../icons/ArrowNarrowUpIcon.js';
|
|
@@ -19,10 +20,15 @@ import { useTournamentsListItemContext } from './TournamentsListContext.js';
|
|
|
19
20
|
import { TournamentsListItemGameProviders } from './TournamentsListItemGameProviders.js';
|
|
20
21
|
import { TournamentsListItemRules } from './TournamentsListItemRules.js';
|
|
21
22
|
import { useTournamentsListItemData } from './useTournamentListItemData.js';
|
|
23
|
+
import { useTournamentTimer } from './useTournamentTimer.js';
|
|
22
24
|
export function TournamentsListItemMobile({ style, className, }) {
|
|
23
25
|
const tournament = useTournamentsListItemContext();
|
|
26
|
+
const { isLaunchStarts, timeParts, now } = useTournamentTimer({
|
|
27
|
+
activationEndDateTime: tournament.activationEndDateTime,
|
|
28
|
+
activationStartDateTime: tournament.activationStartDateTime,
|
|
29
|
+
});
|
|
24
30
|
const [isDetailsVisible, setIsDetailsVisible] = useState(false);
|
|
25
|
-
const { prizeAmountsByRank,
|
|
31
|
+
const { prizeAmountsByRank, tournamentReward, filteredGameProviders, localeInfo, } = useTournamentsListItemData();
|
|
26
32
|
const styles = isStyleEntries(style, [
|
|
27
33
|
'root',
|
|
28
34
|
'badgeRoot',
|
|
@@ -34,23 +40,28 @@ export function TournamentsListItemMobile({ style, className, }) {
|
|
|
34
40
|
const classNames = isString(className)
|
|
35
41
|
? { root: className }
|
|
36
42
|
: (className ?? {});
|
|
37
|
-
|
|
43
|
+
const isEnded = new Date(tournament.activationEndDateTime) < now;
|
|
44
|
+
return (_jsxs("div", { style: styles.root, className: twMerge('overflow-hidden rounded-2xl border border-border-primary bg-bg-primary', classNames.outerRoot), children: [_jsx("div", { className: twMerge('relative flex shrink-0 rounded-2xl p-3 text-center lg:gap-4 lg:p-5', classNames.root), children: _jsxs("div", { className: "relative flex flex-1 flex-col", children: [_jsx("div", { className: "flex w-full justify-between", children: _jsxs("div", { className: "w-full", children: [_jsxs("div", { className: "flex justify-between", children: [_jsxs("div", { style: styles.badgeRoot, className: twMerge('flex h-fit w-fit items-center gap-1 rounded-full border border-utility-brand-200 bg-utility-brand-50 px-2 py-0.5 font-medium text-utility-brand-700 text-xs', classNames.badgeRoot), children: [_jsx(Award01Icon, { style: styles.badgeIcon, className: twMerge('size-3.5 text-utility-brand-500', classNames.badgeIcon) }), _jsx("span", { style: styles.badgeLabel, className: classNames.badgeLabel, children: "Multiplier" })] }), _jsxs("div", { className: "flex h-fit flex-col", children: [isEnded && (_jsxs("div", { className: twMerge('mb-2 flex flex-col items-center justify-center whitespace-nowrap rounded-md bg-[#0C0E12] px-2 py-1.5 font-semibold text-[#EAAA08] text-sm', classNames.countdownHeading), children: [_jsx("span", { className: "font-semibold", children: "Ended" }), _jsx("span", { className: twMerge('text-[#CECFD2] text-[9px]', classNames.countdownSubheading), children: format(tournament.activationEndDateTime, 'MMMM dd, yyyy') })] })), !isLaunchStarts && !isEnded && (_jsx("div", { className: twMerge('mb-2 flex items-center justify-center rounded-md bg-[#0C0E12] py-1 font-semibold text-[#EAAA08] text-sm', classNames.countdownHeading), children: "Launching Soon" })), !isEnded && (_jsx("div", { className: "flex justify-between text-center text-yellow-900", children: timeParts.map((part, idx) => {
|
|
45
|
+
return (_jsxs(React.Fragment, { children: [_jsxs("div", { className: "flex h-fit w-8 flex-col items-center rounded-[0.25rem] bg-bg-primary pb-1.5 text-text-primary-900", children: [_jsx("p", { className: twMerge('font-medium text-base', classNames.countdownTime), children: part.value }), _jsx("p", { className: "text-3xs", children: part.label })] }), idx < timeParts.length - 1 && (_jsxs("div", { className: "flex flex-col justify-center gap-1.5 px-1.5", children: [_jsx("span", { className: twMerge('h-1 w-1 rounded-full bg-bg-primary', classNames.countdownSeparator) }), _jsx("span", { className: twMerge('h-1 w-1 rounded-full bg-bg-primary', classNames.countdownSeparator) })] }))] }, part.label));
|
|
46
|
+
}) }))] })] }), _jsx("div", { className: "text-left font-medium text-lg text-text-primary-900 lg:mt-4.5 lg:text-2xl", children: tournament.name }), _jsx("div", { className: "mt-1.5 w-fit rounded-md bg-bg-primary px-2 py-1 font-bold text-2xl text-brand-400 lg:mt-2 lg:mb-5xl lg:text-4xl", children: formatNumber(tournamentReward, {
|
|
47
|
+
currency: localeInfo.currency.code,
|
|
48
|
+
minDecimalPlaces: 2,
|
|
49
|
+
maxDecimalPlaces: 2,
|
|
50
|
+
}) })] }) }), _jsxs("div", { className: "relative", children: [tournament.topPayouts.length ? (_jsx("div", { children: _jsxs("div", { className: "relative mt-4 flex w-full gap-4 rounded-lg bg-bg-primary p-4", children: [_jsxs("div", { className: "relative flex h-18 w-18 items-center justify-center rounded-full bg-bg-tertiary", children: [_jsx(User01Icon, { className: "size-9 text-text-quarterary-500" }), _jsx("div", { className: "absolute right-0 bottom-safe-area-inset-bottom flex h-6 w-6 items-center justify-center rounded-full border-[1.5px] border-bg-primary bg-yellow-400 font-bold text-brand-950 text-xs", children: "1st" })] }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "flex h-fit w-fit items-center gap-1 rounded-sm border border-utility-brand-200 bg-utility-brand-50 px-2 py-0.5 font-medium text-utility-brand-700 text-xs", children: [_jsx(Trophy01Icon, { className: "size-3.5 text-utility-brand-600" }), "Top Payout"] }), _jsx("div", { className: "font-semibold", children: maskFirstLast(tournament?.topPayouts[0]?.member?.name || '', {
|
|
51
|
+
midLength: 4,
|
|
52
|
+
}) }), _jsx("div", { className: "text-2xl text-brand-400", children: formatNumber(tournament?.topPayouts[0]?.amount, {
|
|
38
53
|
currency: localeInfo.currency.code,
|
|
39
54
|
minDecimalPlaces: 2,
|
|
40
55
|
maxDecimalPlaces: 2,
|
|
41
|
-
}) })] })
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}) })] })] }) })) : (_jsxs("div", { className: "relative mt-4 flex w-full gap-4 rounded-lg bg-bg-primary p-4", children: [_jsx(Image, { width: 66, height: 87, src: firstPlace, alt: "closeChest", className: "size-full h-auto w-[4.125rem] mix-blend-luminosity" }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "flex h-fit w-fit items-center gap-1 rounded-sm border border-utility-brand-200 bg-utility-brand-50 px-2 py-0.5 font-medium text-utility-brand-700 text-xs", children: [_jsx(Trophy01Icon, { className: "size-3.5 text-utility-brand-600" }), "Top Payout"] }), _jsx("div", { className: "font-semibold", children: "No winners yet" }), _jsx("div", { className: "text-text-secondary-700 text-xs", children: "You could be the first to win the tournament!" })] })] })), _jsx(Button, { variant: "outline", className: twMerge('mt-5.5 px-3.5 py-2.5 text-sm', isDetailsVisible ? 'hidden' : 'flex'), onClick: () => setIsDetailsVisible(!isDetailsVisible), children: _jsxs("div", { className: "flex gap-1.5", children: ["See Details", _jsx(ArrowNarrowDownIcon, { className: "size-5" })] }) })] }) }), isDetailsVisible && (_jsxs("div", { children: [_jsxs("div", { className: "z-1 flex-1", children: [_jsxs("div", { className: "flex items-center justify-between p-3", children: [_jsx("div", { className: "flex gap-2", children: _jsx("div", { className: "font-semibold text-lg text-text-primary-900", children: tournament.currentLeaderboard.edges.length
|
|
46
|
-
? 'Leaderboard'
|
|
47
|
-
: 'Starting soon!' }) }), _jsx(TournamentsListItemRules, {})] }), _jsx("div", { children: _jsx("div", { className: "overflow-hidden border-gray-200", children: _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsxs("tr", { className: "h-8 bg-bg-secondary text-center font-medium text-text-tertiary-600 text-xs", children: [_jsx("th", { className: "w-[3.25rem]", children: "#" }), _jsx("th", { children: "Player" }), _jsx("th", { children: "Multiplier" }), _jsx("th", { children: "Prize" })] }) }), _jsx("tbody", { children: tournament.currentLeaderboard.edges.length
|
|
48
|
-
? tournament.currentLeaderboard.edges.map((tournament, i) => (_jsxs("tr", { className: "bg-bg-primary text-center text-sm text-text-secondary-700", children: [_jsx("td", { className: "h-12 w-[3.25rem] border-border-secondary 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 font-bold text-2xs', starTierStyles[i].numberColor), children: i + 1 })] })) : (i + 1) }), _jsx("td", { className: "h-12 border-border-secondary border-t-2", children: maskFirstLast(tournament.node.username) }), _jsxs("td", { className: "h-12 border-border-secondary border-t-2", children: [tournament.node.multiplier, "x"] }), i + 1 <= prizeAmountsByRank.length ? (_jsx("td", { className: "h-12 border-border-secondary border-t-2 text-brand-400", children: formatNumber(prizeAmountsByRank[i], {
|
|
56
|
+
}) })] })] }) })) : (_jsxs("div", { className: "relative mt-4 flex w-fit gap-4 rounded-lg bg-bg-primary p-4", children: [_jsx(Image, { width: 66, height: 87, src: firstPlace, alt: "closeChest", className: "size-full h-auto w-[4.125rem] mix-blend-luminosity" }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "flex h-fit w-fit items-center gap-1 rounded-sm border border-utility-brand-200 bg-utility-brand-50 px-2 py-0.5 font-medium text-utility-brand-700 text-xs", children: [_jsx(Trophy01Icon, { className: "size-3.5 text-utility-brand-600" }), "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("div", { className: "-right-0 absolute bottom-[30px] z-1 block lg:absolute", children: _jsx("div", { className: "h-[9.688rem] w-auto shrink-0", children: _jsx(Image, { width: 72.941, height: 93, src: trophy, alt: "trophy" }) }) })] }), _jsx(Button, { variant: "outline", className: twMerge('mt-5.5 px-3.5 py-2.5 text-sm', isDetailsVisible ? 'hidden' : 'flex'), onClick: () => setIsDetailsVisible(!isDetailsVisible), children: _jsxs("div", { className: "flex gap-1.5", children: ["See Details", _jsx(ArrowNarrowDownIcon, { className: "size-5" })] }) })] }) }), isDetailsVisible && (_jsxs("div", { className: "bg-bg-primary", 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: "font-semibold text-lg text-text-primary-900", children: "Leaderboard" }) }), _jsx(TournamentsListItemRules, {})] }), _jsx("div", { children: _jsx("div", { className: "overflow-hidden border-gray-200", children: _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsxs("tr", { className: "h-8 bg-bg-secondary text-center font-medium text-text-tertiary-600 text-xs", children: [_jsx("th", { className: "w-[3.25rem]", children: "#" }), _jsx("th", { children: "Player" }), _jsx("th", { children: "Multiplier" }), _jsx("th", { children: "Prize" })] }) }), _jsx("tbody", { children: tournament.currentLeaderboard.edges.length
|
|
57
|
+
? tournament.currentLeaderboard.edges.map((tournament, i) => (_jsxs("tr", { className: "bg-bg-primary text-center text-sm text-text-secondary-700", children: [_jsx("td", { className: "h-12 w-[3.25rem] border-border-secondary 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 font-bold text-2xs', starTierStyles[i].numberColor), children: i + 1 })] })) : (i + 1) }), _jsx("td", { className: "h-12 border-border-secondary border-t-2", children: maskFirstLast(tournament.node.username, {
|
|
58
|
+
midLength: 4,
|
|
59
|
+
}) }), _jsxs("td", { className: "h-12 border-border-secondary border-t-2", children: [tournament.node.multiplier, "x"] }), i + 1 <= prizeAmountsByRank.length ? (_jsx("td", { className: "h-12 border-border-secondary border-t-2 text-brand-400", children: formatNumber(prizeAmountsByRank[i], {
|
|
49
60
|
currency: localeInfo.currency.code,
|
|
50
61
|
minDecimalPlaces: 2,
|
|
51
62
|
maxDecimalPlaces: 2,
|
|
52
63
|
}) })) : (_jsx("td", { className: "h-12 border-border-secondary border-t-2", children: "-" }))] }, i)))
|
|
53
|
-
: Array.from({ length: 5 }).map((_, i) => (_jsxs("tr", { className: "bg-bg-primary text-center text-sm text-text-secondary-700", children: [_jsx("td", { className: "h-12 w-[3.25rem] border-border-secondary 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 font-bold text-2xs', starTierStyles[i].numberColor), children: i + 1 })] })) : (i + 1) }), _jsx("td", { className: "h-12 border-border-secondary border-t-2", children: "-" }), _jsx("td", { className: "h-12 border-border-secondary border-t-2", children: "-" }), _jsx("td", { className: "h-12 border-border-secondary border-t-2", children: "-" })] }, i))) })] }) }) })] }), Boolean(filteredGameProviders.length) && (_jsx(TournamentsListItemGameProviders, { gameProviders: filteredGameProviders })), _jsx("div", { className: "
|
|
64
|
+
: Array.from({ length: 5 }).map((_, i) => (_jsxs("tr", { className: "bg-bg-primary text-center text-sm text-text-secondary-700", children: [_jsx("td", { className: "h-12 w-[3.25rem] border-border-secondary 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 font-bold text-2xs', starTierStyles[i].numberColor), children: i + 1 })] })) : (i + 1) }), _jsx("td", { className: "h-12 border-border-secondary border-t-2", children: "-" }), _jsx("td", { className: "h-12 border-border-secondary border-t-2", children: "-" }), _jsx("td", { className: "h-12 border-border-secondary border-t-2", children: "-" })] }, i))) })] }) }) })] }), Boolean(filteredGameProviders.length) && (_jsx(TournamentsListItemGameProviders, { gameProviders: filteredGameProviders })), _jsx("div", { className: "p-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" })] }) }) })] }))] }));
|
|
54
65
|
}
|
|
55
66
|
const starTierStyles = [
|
|
56
67
|
{
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type Tournament = {
|
|
2
|
+
activationStartDateTime: string;
|
|
3
|
+
activationEndDateTime: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function useTournamentTimer(tournament: Tournament): {
|
|
6
|
+
now: Date;
|
|
7
|
+
isLaunchStarts: boolean;
|
|
8
|
+
timeParts: {
|
|
9
|
+
label: string;
|
|
10
|
+
value: string;
|
|
11
|
+
}[];
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { intervalToDuration } from 'date-fns';
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
export function useTournamentTimer(tournament) {
|
|
4
|
+
const now = useNow(1000);
|
|
5
|
+
const launchStartDate = useMemo(() => new Date(tournament.activationStartDateTime), [tournament.activationStartDateTime]);
|
|
6
|
+
const isLaunchStarts = useMemo(() => launchStartDate < now, [launchStartDate, now]);
|
|
7
|
+
const [timeRemaining, setTimeRemaining] = useState(intervalToDuration({
|
|
8
|
+
start: now,
|
|
9
|
+
end: isLaunchStarts
|
|
10
|
+
? new Date(tournament.activationEndDateTime)
|
|
11
|
+
: launchStartDate,
|
|
12
|
+
}));
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
setTimeRemaining(intervalToDuration({
|
|
15
|
+
start: now,
|
|
16
|
+
end: isLaunchStarts
|
|
17
|
+
? new Date(tournament.activationEndDateTime)
|
|
18
|
+
: launchStartDate,
|
|
19
|
+
}));
|
|
20
|
+
}, [now, isLaunchStarts, launchStartDate, tournament.activationEndDateTime]);
|
|
21
|
+
const timeParts = useMemo(() => [
|
|
22
|
+
{ label: 'Day', value: String(timeRemaining.days ?? 0).padStart(2, '0') },
|
|
23
|
+
{
|
|
24
|
+
label: 'Hour',
|
|
25
|
+
value: String(timeRemaining.hours ?? 0).padStart(2, '0'),
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: 'Min',
|
|
29
|
+
value: String(timeRemaining.minutes ?? 0).padStart(2, '0'),
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: 'Sec',
|
|
33
|
+
value: String(timeRemaining.seconds ?? 0).padStart(2, '0'),
|
|
34
|
+
},
|
|
35
|
+
], [timeRemaining]);
|
|
36
|
+
return { now, isLaunchStarts, timeParts };
|
|
37
|
+
}
|
|
38
|
+
function useNow(intervalMs = 1000) {
|
|
39
|
+
const [now, setNow] = useState(new Date());
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
const id = setInterval(() => setNow(new Date()), intervalMs);
|
|
42
|
+
return () => clearInterval(id);
|
|
43
|
+
}, [intervalMs]);
|
|
44
|
+
return now;
|
|
45
|
+
}
|
|
@@ -136,6 +136,6 @@ export declare const FACEBOOK_CLIENT_ID = "\n query FacebookClientId {\n fac
|
|
|
136
136
|
export declare const REQUIRE_FIRST_DEPOSIT = "\n query RequireFirstDeposit {\n requireFirstDeposit\n }\n";
|
|
137
137
|
export declare const UNLINK_GOOGLE = "\n mutation UnlinkGoogle($input: UnlinkGoogleInput!) {\n unlinkGoogle(input: $input)\n }\n";
|
|
138
138
|
export declare const UNLINK_FACEBOOK = "\n mutation UnlinkFacebook($input: UnlinkFacebookInput!) {\n unlinkFacebook(input: $input)\n }\n";
|
|
139
|
-
export declare const TOURNAMENTS = "\n query Tournaments(\n $first: Int\n $after: Cursor\n $filter: TournamentFilterInput\n ) {\n tournaments(first: $first, after: $after, filter: $filter) {\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n node {\n ... on MultiplierTournament {\n id\n type\n name\n winnersCount\n status\n description\n activationStartDateTime\n activationEndDateTime\n topPayouts {\n id\n multiplier\n amount\n member {\n id\n name\n }\n }\n currentLeaderboard {\n totalCount\n edges {\n node {\n ... on TournamentLeaderboard {\n id\n username\n multiplier\n dateTimeCreated\n }\n }\n }\n }\n previousLeaderboard {\n totalCount\n edges {\n node {\n ... on TournamentLeaderboard {\n id\n username\n multiplier\n dateTimeCreated\n }\n }\n }\n }\n enabledGameProviders\n frequency\n mode\n mobileBanner {\n id\n url\n mimeType\n }\n webBanner {\n id\n url\n mimeType\n }\n rewardSettings\n }\n }\n }\n }\n }\n";
|
|
139
|
+
export declare const TOURNAMENTS = "\n query Tournaments(\n $first: Int\n $after: Cursor\n $filter: TournamentFilterInput\n ) {\n tournaments(first: $first, after: $after, filter: $filter) {\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n node {\n ... on MultiplierTournament {\n id\n type\n name\n winnersCount\n status\n description\n activationStartDateTime\n activationEndDateTime\n topPayouts {\n id\n multiplier\n amount\n member {\n id\n name\n }\n }\n currentLeaderboard {\n totalCount\n edges {\n node {\n ... on TournamentLeaderboard {\n id\n username\n multiplier\n dateTimeCreated\n prize\n }\n }\n }\n }\n previousLeaderboard {\n totalCount\n edges {\n node {\n ... on TournamentLeaderboard {\n id\n username\n multiplier\n dateTimeCreated\n prize\n }\n }\n }\n }\n enabledGameProviders\n frequency\n mode\n mobileBanner {\n id\n url\n mimeType\n }\n webBanner {\n id\n url\n mimeType\n }\n rewardSettings\n }\n }\n }\n }\n }\n";
|
|
140
140
|
export declare const TOURNAMENTS_COUNT = "\n query TournamentsCount($filter: TournamentFilterInput) {\n tournaments(filter: $filter) {\n totalCount\n }\n }\n";
|
|
141
141
|
export declare const GENERATE_SUMSUB_VERIFICATION_TOKEN = "\n mutation GenerateSumsubVerificationToken {\n generateSumsubVerificationToken\n }\n";
|
package/dist/services/queries.js
CHANGED
|
@@ -3105,6 +3105,7 @@ export const TOURNAMENTS = /* GraphQL */ `
|
|
|
3105
3105
|
username
|
|
3106
3106
|
multiplier
|
|
3107
3107
|
dateTimeCreated
|
|
3108
|
+
prize
|
|
3108
3109
|
}
|
|
3109
3110
|
}
|
|
3110
3111
|
}
|
|
@@ -3118,6 +3119,7 @@ export const TOURNAMENTS = /* GraphQL */ `
|
|
|
3118
3119
|
username
|
|
3119
3120
|
multiplier
|
|
3120
3121
|
dateTimeCreated
|
|
3122
|
+
prize
|
|
3121
3123
|
}
|
|
3122
3124
|
}
|
|
3123
3125
|
}
|