@opexa/portal-components 0.0.85 → 0.0.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/hooks/useCreateGCashDepositMutation.js +2 -1
- package/dist/client/hooks/useCreateGCashWithdrawalMutation.js +2 -1
- package/dist/client/hooks/useCreateGameSessionMutation.js +2 -1
- package/dist/client/hooks/useCreateInstapayWithdrawalMutation.js +2 -1
- package/dist/client/hooks/useCreateMayaAppDepositMutation.js +2 -1
- package/dist/client/hooks/useCreateMayaAppWithdrawalMutation.js +2 -1
- package/dist/client/hooks/useCreateMayaDepositMutation.js +2 -1
- package/dist/client/hooks/useCreateMayaWithdrawalMutation.js +2 -1
- package/dist/client/hooks/useCreateOnlineBankDepositMutation.js +2 -1
- package/dist/client/hooks/useCreateQRPHDepositMutation.js +2 -1
- package/dist/components/Account/Account.d.ts +0 -2
- package/dist/components/Account/Account.js +10 -8
- package/dist/components/Account/AccountTrigger.d.ts +1 -2
- package/dist/components/Account/AccountTrigger.js +18 -6
- package/dist/components/Bonuses/BonusesTrigger.d.ts +1 -1
- package/dist/components/Bonuses/BonusesTrigger.js +3 -3
- package/dist/components/DepositWithdrawal/DepositWithdrawal.d.ts +1 -6
- package/dist/components/DepositWithdrawal/DepositWithdrawal.js +8 -19
- package/dist/components/DepositWithdrawal/DepositWithdrawalTrigger.d.ts +1 -1
- package/dist/components/DepositWithdrawal/DepositWithdrawalTrigger.js +12 -4
- package/dist/components/Jackpots/Jackpots.d.ts +3 -9
- package/dist/components/Jackpots/Jackpots.js +8 -2
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarousel.d.ts +20 -0
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarousel.js +64 -0
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselContext.d.ts +2 -0
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselContext.js +2 -0
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.d.ts +9 -0
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.js +107 -0
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +184 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsList.d.ts +11 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsList.js +29 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListContext.d.ts +4 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListContext.js +3 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +184 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItemDesktop.d.ts +1 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItemDesktop.js +44 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItemGameProviders.d.ts +5 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItemGameProviders.js +40 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItemMobile.d.ts +1 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItemMobile.js +45 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItemRules.d.ts +2 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItemRules.js +10 -0
- package/dist/components/Jackpots/JackpotsList/useJackpotsListItemData.d.ts +14 -0
- package/dist/components/Jackpots/JackpotsList/useJackpotsListItemData.js +92 -0
- package/dist/components/Messages/Message.d.ts +1 -4
- package/dist/components/Messages/Message.js +8 -9
- package/dist/components/Messages/MessageContext.d.ts +2 -0
- package/dist/components/Messages/MessageContext.js +2 -0
- package/dist/components/Messages/Messages.d.ts +0 -1
- package/dist/components/Messages/Messages.js +9 -8
- package/dist/components/Messages/MessagesTrigger.d.ts +1 -1
- package/dist/components/Messages/MessagesTrigger.js +8 -4
- package/dist/components/PortalProvider/Providers.js +1 -5
- package/dist/components/SignUp/SignUpForm.js +2 -1
- package/dist/components/Tournaments/Tournaments.d.ts +3 -7
- package/dist/components/Tournaments/Tournaments.js +8 -2
- package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarousel.d.ts +9 -0
- package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarousel.js +51 -0
- package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselContext.d.ts +2 -0
- package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselContext.js +2 -0
- package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.d.ts +6 -0
- package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.js +107 -0
- package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.module.css +184 -0
- package/dist/components/Tournaments/TournamentsList/TournamentItem.module.css +184 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsList.d.ts +9 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsList.js +20 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsListContext.d.ts +4 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsListContext.js +3 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsListItemDesktop.d.ts +1 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsListItemDesktop.js +55 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsListItemGameProviders.d.ts +5 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsListItemGameProviders.js +37 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsListItemMobile.d.ts +1 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsListItemMobile.js +55 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsListItemRules.d.ts +2 -0
- package/dist/components/Tournaments/TournamentsList/TournamentsListItemRules.js +9 -0
- package/dist/components/Tournaments/TournamentsList/useTournamentListItemData.d.ts +10 -0
- package/dist/components/Tournaments/TournamentsList/useTournamentListItemData.js +71 -0
- package/dist/components/index.d.ts +0 -2
- package/dist/components/index.js +0 -2
- package/dist/handlers.js +1 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +1 -0
- package/dist/services/ObjectId.d.ts +0 -14
- package/dist/services/ObjectId.js +62 -76
- package/dist/services/ObjectType.d.ts +10 -0
- package/dist/services/ObjectType.js +10 -0
- package/dist/services/index.d.ts +4 -3
- package/dist/services/index.js +4 -3
- package/dist/styles/theme.css +2 -2
- package/dist/ui/AlertDialog/AlertDialog.d.ts +89 -89
- package/dist/ui/AlertDialog/AlertDialog.js +2 -1
- package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +8 -8
- package/dist/ui/AlertDialog/alertDialog.recipe.js +1 -1
- package/dist/ui/Avatar/Avatar.d.ts +1 -1
- package/dist/ui/Avatar/Avatar.js +1 -1
- package/dist/ui/Avatar/avatar.recipe.js +1 -1
- package/dist/ui/Badge/Badge.js +1 -1
- package/dist/ui/Button/Button.js +1 -1
- package/dist/ui/Checkbox/Checkbox.d.ts +24 -24
- package/dist/ui/Checkbox/Checkbox.js +1 -1
- package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
- package/dist/ui/Checkbox/checkbox.recipe.js +1 -1
- package/dist/ui/Clipboard/Clipboard.d.ts +19 -19
- package/dist/ui/Clipboard/Clipboard.js +1 -1
- package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
- package/dist/ui/Clipboard/clipboard.recipe.js +1 -1
- package/dist/ui/Collapsible/Collapsible.d.ts +21 -21
- package/dist/ui/Collapsible/Collapsible.js +1 -1
- package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
- package/dist/ui/Collapsible/collapsible.recipe.js +1 -1
- package/dist/ui/Combobox/Combobox.d.ts +43 -43
- package/dist/ui/Combobox/Combobox.js +1 -1
- package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
- package/dist/ui/Combobox/combobox.recipe.js +1 -1
- package/dist/ui/DatePicker/DatePicker.d.ts +265 -265
- package/dist/ui/DatePicker/DatePicker.js +1 -1
- package/dist/ui/DatePicker/datePicker.recipe.d.ts +11 -11
- package/dist/ui/DatePicker/datePicker.recipe.js +1 -1
- package/dist/ui/Dialog/Dialog.d.ts +89 -89
- package/dist/ui/Dialog/Dialog.js +2 -1
- package/dist/ui/Dialog/dialog.recipe.d.ts +8 -8
- package/dist/ui/Dialog/dialog.recipe.js +1 -1
- package/dist/ui/Drawer/Drawer.d.ts +34 -34
- package/dist/ui/Drawer/Drawer.js +2 -1
- package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
- package/dist/ui/Drawer/drawer.recipe.js +1 -1
- package/dist/ui/Field/Field.d.ts +1 -1
- package/dist/ui/Field/Field.js +1 -1
- package/dist/ui/Field/field.recipe.js +1 -1
- package/dist/ui/IconButton/IconButton.js +1 -1
- package/dist/ui/NumberInput/NumberInput.d.ts +1 -1
- package/dist/ui/NumberInput/NumberInput.js +1 -1
- package/dist/ui/NumberInput/numberInput.recipe.js +1 -1
- package/dist/ui/PasswordInput/PasswordInput.d.ts +1 -1
- package/dist/ui/PasswordInput/PasswordInput.js +1 -1
- package/dist/ui/PasswordInput/passwordInput.recipe.js +1 -1
- package/dist/ui/PinInput/PinInput.d.ts +1 -1
- package/dist/ui/PinInput/PinInput.js +1 -1
- package/dist/ui/PinInput/pinInput.recipe.js +1 -1
- package/dist/ui/Popover/Popover.d.ts +56 -56
- package/dist/ui/Popover/Popover.js +1 -1
- package/dist/ui/Popover/popover.recipe.d.ts +5 -5
- package/dist/ui/Popover/popover.recipe.js +1 -1
- package/dist/ui/Progress/Progress.d.ts +1 -1
- package/dist/ui/Progress/Progress.js +1 -1
- package/dist/ui/Progress/progress.recipe.js +1 -1
- package/dist/ui/SegmentGroup/SegmentGroup.d.ts +1 -1
- package/dist/ui/SegmentGroup/SegmentGroup.js +1 -1
- package/dist/ui/SegmentGroup/segmentGroup.recipe.js +1 -1
- package/dist/ui/Select/Select.d.ts +46 -46
- package/dist/ui/Select/Select.js +1 -1
- package/dist/ui/Select/select.recipe.d.ts +3 -3
- package/dist/ui/Select/select.recipe.js +1 -1
- package/dist/ui/Table/Table.d.ts +21 -21
- package/dist/ui/Table/Table.js +1 -1
- package/dist/ui/Table/table.recipe.d.ts +3 -3
- package/dist/ui/Tabs/Tabs.d.ts +16 -16
- package/dist/ui/Tabs/Tabs.js +1 -1
- package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
- package/dist/ui/Tabs/tabs.recipe.js +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/isStyleEntries.d.ts +2 -0
- package/dist/utils/isStyleEntries.js +5 -0
- package/package.json +27 -30
- package/dist/utils/graphqlRequest.d.ts +0 -4
- package/dist/utils/graphqlRequest.js +0 -255
- package/dist/utils/httpRequest.d.ts +0 -6
- package/dist/utils/httpRequest.js +0 -87
- package/dist/utils/sha256.d.ts +0 -4
- package/dist/utils/sha256.js +0 -16
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useMemo } from 'react';
|
|
3
|
+
import { twMerge } from 'tailwind-merge';
|
|
4
|
+
import { useLocaleInfo } from '../../../client/hooks/index.js';
|
|
5
|
+
import { useJackpotPayoutsQuery } from '../../../client/hooks/useJackpotPayoutsQuery.js';
|
|
6
|
+
import { GAME_PROVIDER_DATA } from '../../../constants/index.js';
|
|
7
|
+
import { ChevronLeftIcon, ChevronRightIcon } from '../../../icons/index.js';
|
|
8
|
+
import { useJackpotsListItemContext, useJackpotsListPropsContext, } from './JackpotsListContext.js';
|
|
9
|
+
import styles from './JackpotsListItem.module.css';
|
|
10
|
+
export function useJackpotsListItemData() {
|
|
11
|
+
const jackpotsListProps = useJackpotsListPropsContext();
|
|
12
|
+
const jackpot = useJackpotsListItemContext();
|
|
13
|
+
const gameProviders = jackpotsListProps.gameProviders.map((provider) => GAME_PROVIDER_DATA[provider]);
|
|
14
|
+
const jackpotPayoutsQuery = useJackpotPayoutsQuery({
|
|
15
|
+
first: 30,
|
|
16
|
+
filter: {
|
|
17
|
+
jackpot: {
|
|
18
|
+
equal: jackpot.id,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
sort: {
|
|
22
|
+
cursor: 'AMOUNT',
|
|
23
|
+
order: 'DESC',
|
|
24
|
+
},
|
|
25
|
+
}, {
|
|
26
|
+
enabled: typeof window !== 'undefined',
|
|
27
|
+
});
|
|
28
|
+
const jackpotPayouts = jackpotPayoutsQuery.data?.pages[0].edges.map((edge) => edge.node) ?? [];
|
|
29
|
+
const topJackpotPayout = jackpotPayouts[0] ?? [];
|
|
30
|
+
const enabledJackpotGameProviders = useMemo(() => {
|
|
31
|
+
const gameProvider = Object.entries(jackpot?.jackpotTurnoverContributionPercentagePerGameProvider ?? {})
|
|
32
|
+
.filter(([, value]) => Number(value) > 0)
|
|
33
|
+
.map(([key]) => key);
|
|
34
|
+
return gameProvider;
|
|
35
|
+
}, [jackpot]);
|
|
36
|
+
const filteredGameProviders = gameProviders.filter((provider) => enabledJackpotGameProviders.includes(provider.id));
|
|
37
|
+
const localeInfo = useLocaleInfo();
|
|
38
|
+
const isPayingOut = jackpot.drawing;
|
|
39
|
+
const jackpotAmount = isPayingOut
|
|
40
|
+
? jackpot.maximumJackpotPoolLimit
|
|
41
|
+
: jackpot.pool;
|
|
42
|
+
const Arrow = useCallback(({ index }) => {
|
|
43
|
+
const Icon = isPayingOut ? ChevronLeftIcon : ChevronRightIcon;
|
|
44
|
+
return (_jsx(Icon, { className: twMerge('scale-400 lg:scale-250 text-brand-300 min-w-2.5 lg:min-w-4', isPayingOut
|
|
45
|
+
? styles['animate-wave-color-error']
|
|
46
|
+
: styles['animate-wave-color-success']), style: {
|
|
47
|
+
animationDelay: isPayingOut
|
|
48
|
+
? `${(40 - index - 1) * 0.1}s`
|
|
49
|
+
: `${index * 0.1}s`,
|
|
50
|
+
} }));
|
|
51
|
+
}, [isPayingOut]);
|
|
52
|
+
const arrowImages = useMemo(() => Array.from({ length: 40 }, (_, i) => (_jsx(Arrow, { isFirst: i === 0, index: i }, i))), [Arrow]);
|
|
53
|
+
const getAccumulatingJackpotDescription = (part, total) => {
|
|
54
|
+
const percentage = total === 0 ? 0 : (part / total) * 100;
|
|
55
|
+
return percentage <= 90
|
|
56
|
+
? 'The jackpot is heating up! Keep playing to stay in the action and watch it grow!'
|
|
57
|
+
: '🔥 It’s about to pop! Stay in the game for your shot at the prize!';
|
|
58
|
+
};
|
|
59
|
+
const starTierStyles = [
|
|
60
|
+
{
|
|
61
|
+
starColor: 'text-yellow-400',
|
|
62
|
+
numberColor: 'text-bg-primary',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
starColor: 'text-utility-gray-700',
|
|
66
|
+
numberColor: 'text-bg-primary',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
starColor: 'text-yellow-700',
|
|
70
|
+
numberColor: 'text-bg-primary',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
starColor: 'text-bg-quaternary',
|
|
74
|
+
numberColor: 'text-text-primary-900',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
starColor: 'text-bg-quaternary',
|
|
78
|
+
numberColor: 'text-text-primary-900',
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
return {
|
|
82
|
+
jackpotPayouts,
|
|
83
|
+
topJackpotPayout,
|
|
84
|
+
filteredGameProviders,
|
|
85
|
+
localeInfo,
|
|
86
|
+
isPayingOut,
|
|
87
|
+
jackpotAmount,
|
|
88
|
+
arrowImages,
|
|
89
|
+
getAccumulatingJackpotDescription,
|
|
90
|
+
starTierStyles,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
@@ -4,31 +4,30 @@ import { format } from 'date-fns';
|
|
|
4
4
|
import Link from 'next/link';
|
|
5
5
|
import { useShallow } from 'zustand/shallow';
|
|
6
6
|
import { useGlobalStore, useLocaleInfo, useMarkMessageAsReadMutation, } from '../../client/hooks/index.js';
|
|
7
|
+
import { useMessageContext } from './MessageContext.js';
|
|
7
8
|
import { getMessageIcon } from './utils.js';
|
|
8
|
-
export function Message(
|
|
9
|
-
const
|
|
10
|
-
/**/
|
|
11
|
-
id, icon, title, content, actions, markedAsRead, dateTimeCreated, } = message;
|
|
9
|
+
export function Message() {
|
|
10
|
+
const message = useMessageContext();
|
|
12
11
|
const localeInfo = useLocaleInfo();
|
|
13
12
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
14
13
|
message: ctx.message,
|
|
15
14
|
messages: ctx.messages,
|
|
16
15
|
})));
|
|
17
16
|
const markMessageAsReadMutation = useMarkMessageAsReadMutation();
|
|
18
|
-
const Icon = getMessageIcon(icon);
|
|
17
|
+
const Icon = getMessageIcon(message.icon);
|
|
19
18
|
const handleViewMessage = async () => {
|
|
20
19
|
globalStore.message.setData(message);
|
|
21
20
|
globalStore.message.setOpen(true);
|
|
22
21
|
globalStore.messages.setOpen(false);
|
|
23
|
-
if (!markedAsRead)
|
|
24
|
-
markMessageAsReadMutation.mutate(id);
|
|
22
|
+
if (!message.markedAsRead)
|
|
23
|
+
markMessageAsReadMutation.mutate(message.id);
|
|
25
24
|
};
|
|
26
25
|
const handleActionClick = (e) => {
|
|
27
26
|
e.stopPropagation();
|
|
28
27
|
globalStore.messages.setOpen(false);
|
|
29
28
|
globalStore.messages.setTab('ALL');
|
|
30
29
|
};
|
|
31
|
-
return (_jsxs("div", { role: "button", tabIndex: 0, className: "border-border-secondary rounded-xs bg-bg-secondary flex h-auto flex-shrink-0 cursor-pointer flex-col border px-3.5 py-2.5", onClick: handleViewMessage, "aria-pressed": "false", children: [_jsxs("div", { className: "flex items-center space-x-2", children: [_jsx("p", { className: "text-text-tertiary-600 text-xs font-normal", children: format(new Date(dateTimeCreated), 'M/d/yyyy - h:mma', {
|
|
30
|
+
return (_jsxs("div", { role: "button", tabIndex: 0, className: "border-border-secondary rounded-xs bg-bg-secondary flex h-auto flex-shrink-0 cursor-pointer flex-col border px-3.5 py-2.5", onClick: handleViewMessage, "aria-pressed": "false", children: [_jsxs("div", { className: "flex items-center space-x-2", children: [_jsx("p", { className: "text-text-tertiary-600 text-xs font-normal", children: format(new Date(message.dateTimeCreated), 'M/d/yyyy - h:mma', {
|
|
32
31
|
in: tz(localeInfo.timezone),
|
|
33
|
-
}) }), !markedAsRead && (_jsx("div", { className: "bg-utility-success-500 h-2.5 w-2.5 rounded-full" }))] }), _jsxs("div", { className: "mb-2 flex items-center space-x-2", children: [_jsx(Icon, { className: "text-brand-400" }), _jsx("p", { className: "text-text-primary-brand text-sm font-semibold", children: title })] }), _jsx("p", { className: "line-clamp-3 text-wrap text-sm font-normal", dangerouslySetInnerHTML: { __html: content } }), actions.length > 0 && (_jsx("div", { className: "mt-2 flex flex-wrap items-center justify-end gap-2", children: actions.map((action, index) => (_jsx(Link, { className: "border-button-secondary-border text-button-secondary-fg rounded-md border px-3 py-2 text-sm", href: action.url, onClick: handleActionClick, children: action.name }, index))) }))] }));
|
|
32
|
+
}) }), !message.markedAsRead && (_jsx("div", { className: "bg-utility-success-500 h-2.5 w-2.5 rounded-full" }))] }), _jsxs("div", { className: "mb-2 flex items-center space-x-2", children: [_jsx(Icon, { className: "text-brand-400" }), _jsx("p", { className: "text-text-primary-brand text-sm font-semibold", children: message.title })] }), _jsx("p", { className: "line-clamp-3 text-wrap text-sm font-normal", dangerouslySetInnerHTML: { __html: message.content } }), message.actions.length > 0 && (_jsx("div", { className: "mt-2 flex flex-wrap items-center justify-end gap-2", children: message.actions.map((action, index) => (_jsx(Link, { className: "border-button-secondary-border text-button-secondary-fg rounded-md border px-3 py-2 text-sm", href: action.url, onClick: handleActionClick, children: action.name }, index))) }))] }));
|
|
34
33
|
}
|
|
@@ -5,10 +5,11 @@ import { twMerge } from 'tailwind-merge';
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { useShallow } from 'zustand/shallow';
|
|
7
7
|
import { useGlobalStore, useMessagesQuery, useUnreadMessagesCountQuery, } from '../../client/hooks/index.js';
|
|
8
|
-
import {
|
|
9
|
-
import { Drawer,
|
|
8
|
+
import { SpinnerIcon, XIcon } from '../../icons/index.js';
|
|
9
|
+
import { Drawer, Tabs } from '../../ui/index.js';
|
|
10
10
|
import { InfiniteScroll } from '../InfiniteScroll.js';
|
|
11
11
|
import { Message } from './Message.js';
|
|
12
|
+
import { MessageContext } from './MessageContext.js';
|
|
12
13
|
import { MessagePopup } from './MessagePopup.js';
|
|
13
14
|
const TABS = ['ALL', 'UNREAD'];
|
|
14
15
|
export function Messages(props) {
|
|
@@ -29,10 +30,10 @@ export function Messages(props) {
|
|
|
29
30
|
const [mobileOffsetTop, desktopOffsetTop] = Array.isArray(props.offsetTop)
|
|
30
31
|
? props.offsetTop
|
|
31
32
|
: [props.offsetTop ?? '0px', props.offsetTop ?? '0px'];
|
|
32
|
-
return (_jsxs(_Fragment, { children: [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
return (_jsxs(_Fragment, { children: [_jsx(Drawer.Root, { open: globalStore.messages.open, onOpenChange: ({ open }) => globalStore.messages.setOpen(open), lazyMount: true, unmountOnExit: true, children: _jsx(Portal, { children: _jsx(Drawer.Positioner, { children: _jsx(Drawer.Content, { className: twMerge('flex', 'flex-col', 'border-border-secondary', 'top-[var(--offset-top-mobile)]', 'h-[calc(100%-var(--offset-top-mobile))]', 'lg:border-l', 'lg:top-[var(--offset-top-desktop)]', 'lg:h-[calc(100%-var(--offset-top-desktop))]'), style: {
|
|
34
|
+
['--offset-top-mobile']: mobileOffsetTop,
|
|
35
|
+
['--offset-top-desktop']: desktopOffsetTop,
|
|
36
|
+
}, children: _jsxs("div", { className: "flex flex-col space-y-6", children: [_jsxs("div", { className: "flex items-end justify-between px-4 pt-6", children: [_jsx("p", { className: "text-text-primary-brand text-xl font-semibold", children: "Notifications" }), _jsx(Drawer.CloseTrigger, { className: "p-2", children: _jsx(XIcon, {}) })] }), _jsxs(Tabs.Root, { value: globalStore.messages.tab, onValueChange: (details) => globalStore.messages.setTab(z.enum(TABS).parse(details.value)), lazyMount: true, unmountOnExit: true, children: [_jsx("div", { className: "mb-4 w-full px-4", children: _jsxs(Tabs.List, { className: "border-border-secondary w-full border", children: [_jsx(Tabs.Trigger, { value: "ALL", className: "flex-1/5 ui-selected:text-text-primary-brand text-text-tertiary-600", children: "All" }), _jsxs(Tabs.Trigger, { value: "UNREAD", className: "flex-1/5 ui-selected:text-text-primary-brand text-text-tertiary-600 flex items-center justify-center space-x-2", children: [_jsx("div", { children: "Unread" }), !!unreadMessagesCount && (_jsx("div", { className: "border-border-primary bg-bg-secondary rounded-full border px-2 py-0.5", children: unreadMessagesCount }))] }), _jsx(Tabs.Indicator, { className: "bg-bg-active" })] }) }), _jsx("div", { className: "border-border-secondary w-full border-t" }), TABS.map((tab) => (_jsxs(Tabs.Content, { value: tab, className: "scrollbar:w-2 scrollbar-track:bg-bg-primary-alt scrollbar-track:rounded-full scrollbar-thumb:bg-bg-quaternary scrollbar-thumb:rounded-full max-h-[calc(100vh-197px)] overflow-y-auto p-xl", style: { scrollbarGutter: 'stable' }, children: [messages.length > 0 && (_jsx("div", { className: "flex flex-col space-y-4", children: messages.map((message) => (_jsx(MessageContext, { value: message, children: _jsx(Message, {}) }, message.id))) })), _jsx(InfiniteScroll, { loader: _jsx(SpinnerIcon, { className: "mx-auto size-5" }), hasMore: !!messagesQuery.hasNextPage, loadMore: async () => {
|
|
37
|
+
await messagesQuery.fetchNextPage();
|
|
38
|
+
}, className: "mt-4" })] }, tab)))] })] }) }) }) }) }), _jsx(MessagePopup, {})] }));
|
|
38
39
|
}
|
|
@@ -2,5 +2,5 @@ import type { ComponentPropsWithRef } from 'react';
|
|
|
2
2
|
interface MessagesTriggerProps extends ComponentPropsWithRef<'button'> {
|
|
3
3
|
asChild?: boolean;
|
|
4
4
|
}
|
|
5
|
-
export declare function MessagesTrigger(props: MessagesTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function MessagesTrigger({ asChild, children, ...props }: MessagesTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { ark } from '@ark-ui/react';
|
|
4
4
|
import { useShallow } from 'zustand/shallow';
|
|
5
|
-
import { useGlobalStore } from '../../client/hooks/index.js';
|
|
6
|
-
|
|
5
|
+
import { useGlobalStore, useUnreadMessagesCountQuery, } from '../../client/hooks/index.js';
|
|
6
|
+
import { Bell01Icon } from '../../icons/index.js';
|
|
7
|
+
import { IconButton } from '../../ui/index.js';
|
|
8
|
+
export function MessagesTrigger({ asChild, children, ...props }) {
|
|
7
9
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
8
10
|
messages: ctx.messages,
|
|
9
11
|
})));
|
|
12
|
+
const unreadMessagesCountQuery = useUnreadMessagesCountQuery({}, { refetchInterval: 5000 });
|
|
13
|
+
const unreadMessagesCount = unreadMessagesCountQuery.data ?? 0;
|
|
10
14
|
return (_jsx(ark.button, { type: "button", "aria-label": "Toggle messages panel", "data-state": globalStore.messages.open ? 'open' : 'closed', ...props, onClick: (e) => {
|
|
11
15
|
globalStore.messages.setOpen(!globalStore.messages.open);
|
|
12
16
|
return props.onClick?.(e);
|
|
13
|
-
} }));
|
|
17
|
+
}, asChild: !children ? true : asChild, children: children ?? (_jsxs(IconButton, { size: "sm", colorScheme: "gray", className: "relative", children: [!!unreadMessagesCount && (_jsx("div", { className: "bg-brand-500 leading-4.5 text-button-primary-fg absolute -right-1.5 -top-1.5 rounded-full border px-1.5 text-2xs font-semibold", children: unreadMessagesCount })), _jsx(Bell01Icon, {})] })) }));
|
|
14
18
|
}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { QueryClientProvider } from '@tanstack/react-query';
|
|
4
|
-
import dynamic from 'next/dynamic';
|
|
5
4
|
import { getQueryClient } from '../../utils/index.js';
|
|
6
|
-
const ThemeProvider = dynamic(() => import('next-themes').then((mod) => mod.ThemeProvider), {
|
|
7
|
-
ssr: false,
|
|
8
|
-
});
|
|
9
5
|
export function Providers({ children }) {
|
|
10
6
|
const queryClient = getQueryClient();
|
|
11
|
-
return (_jsx(QueryClientProvider, { client: queryClient, children:
|
|
7
|
+
return (_jsx(QueryClientProvider, { client: queryClient, children: children }));
|
|
12
8
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useDialogContext } from '@ark-ui/react';
|
|
4
4
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
5
|
+
import { ObjectId } from '@opexa/object-id';
|
|
5
6
|
import { useSearchParams } from 'next/navigation';
|
|
6
7
|
import { useState } from 'react';
|
|
7
8
|
import { Controller, useForm } from 'react-hook-form';
|
|
@@ -10,7 +11,7 @@ import { useShallow } from 'zustand/shallow';
|
|
|
10
11
|
import { useCooldown, useGlobalStore, useLocaleInfo, useMobileNumberParser, useSendVerificationCodeMutation, useSignInMutation, useSignUpMutation, } from '../../client/hooks/index.js';
|
|
11
12
|
import { toaster } from '../../client/utils/index.js';
|
|
12
13
|
import { ArrowLeftIcon, CheckIcon } from '../../icons/index.js';
|
|
13
|
-
import {
|
|
14
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
14
15
|
import { Button, Checkbox, Field, PinInput } from '../../ui/index.js';
|
|
15
16
|
export function SignUpForm() {
|
|
16
17
|
const [step, setStep] = useState(1);
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
heading?: string;
|
|
5
|
-
className?: string;
|
|
6
|
-
gameProviders: GameProvider[];
|
|
7
|
-
}
|
|
1
|
+
import { type TournamentsCarouselProps } from './TournamentsCarousel/TournamentsCarousel';
|
|
2
|
+
import { type TournamentsListProps } from './TournamentsList/TournamentsList';
|
|
3
|
+
export type TournamentsProps = TournamentsListProps | TournamentsCarouselProps;
|
|
8
4
|
export declare function Tournaments(props: TournamentsProps): Promise<import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { prefetchTournamentsQuery } from '../../server/utils/index.js';
|
|
3
|
-
import {
|
|
3
|
+
import { TournamentsCarousel, } from './TournamentsCarousel/TournamentsCarousel.js';
|
|
4
|
+
import { TournamentsList, } from './TournamentsList/TournamentsList.js';
|
|
4
5
|
export async function Tournaments(props) {
|
|
5
6
|
await prefetchTournamentsQuery({
|
|
6
7
|
first: 100,
|
|
@@ -10,5 +11,10 @@ export async function Tournaments(props) {
|
|
|
10
11
|
},
|
|
11
12
|
},
|
|
12
13
|
});
|
|
13
|
-
|
|
14
|
+
if (props.layout === 'list') {
|
|
15
|
+
return _jsx(TournamentsList, { ...props });
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return _jsx(TournamentsCarousel, { ...props });
|
|
19
|
+
}
|
|
14
20
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface TournamentsCarouselProps {
|
|
2
|
+
layout: 'carousel';
|
|
3
|
+
/** @default "Tournaments" */
|
|
4
|
+
heading?: string;
|
|
5
|
+
/** @default "/tournaments" */
|
|
6
|
+
viewAllUrl?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function TournamentsCarousel(props: TournamentsCarouselProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import useEmblaCarousel from 'embla-carousel-react';
|
|
4
|
+
import Link from 'next/link';
|
|
5
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
6
|
+
import { useTournamentsQuery } from '../../../client/hooks/index.js';
|
|
7
|
+
import { ArrowLeftIcon, ArrowRightIcon, ChevronRightIcon, } from '../../../icons/index.js';
|
|
8
|
+
import { Button } from '../../../ui/index.js';
|
|
9
|
+
import { TournamentsCarouselItemContext } from './TournamentsCarouselContext.js';
|
|
10
|
+
import { TournamentsCarouselItem } from './TournamentsCarouselItem.js';
|
|
11
|
+
export function TournamentsCarousel(props) {
|
|
12
|
+
const [emblaRef, emblaApi] = useEmblaCarousel({
|
|
13
|
+
align: 'start',
|
|
14
|
+
slidesToScroll: 1,
|
|
15
|
+
});
|
|
16
|
+
const scrollPrev = useCallback(() => {
|
|
17
|
+
if (emblaApi)
|
|
18
|
+
emblaApi.scrollPrev();
|
|
19
|
+
}, [emblaApi]);
|
|
20
|
+
const scrollNext = useCallback(() => {
|
|
21
|
+
if (emblaApi)
|
|
22
|
+
emblaApi.scrollNext();
|
|
23
|
+
}, [emblaApi]);
|
|
24
|
+
const [canScrollPrev, setCanScrollPrev] = useState(false);
|
|
25
|
+
const [canScrollNext, setCanScrollNext] = useState(false);
|
|
26
|
+
const onSelect = useCallback(() => {
|
|
27
|
+
if (!emblaApi)
|
|
28
|
+
return;
|
|
29
|
+
setCanScrollPrev(emblaApi.canScrollPrev());
|
|
30
|
+
setCanScrollNext(emblaApi.canScrollNext());
|
|
31
|
+
}, [emblaApi]);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (!emblaApi)
|
|
34
|
+
return;
|
|
35
|
+
onSelect();
|
|
36
|
+
emblaApi.on('select', onSelect);
|
|
37
|
+
emblaApi.on('reInit', onSelect);
|
|
38
|
+
}, [emblaApi, onSelect]);
|
|
39
|
+
const tournamentsQuery = useTournamentsQuery({
|
|
40
|
+
first: 100,
|
|
41
|
+
filter: {
|
|
42
|
+
status: {
|
|
43
|
+
equal: 'ACTIVE',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
const tournaments = tournamentsQuery.data?.pages[0].edges.map((edge) => edge.node) ?? [];
|
|
48
|
+
if (tournaments.length <= 0)
|
|
49
|
+
return null;
|
|
50
|
+
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) => (_jsx(TournamentsCarouselItemContext, { value: tournament, children: _jsx(TournamentsCarouselItem, { viewAllUrl: props.viewAllUrl, className: "w-full" }) }, tournament.id))) }) })] }));
|
|
51
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface TournamentsCarouselItemProps {
|
|
2
|
+
className?: string;
|
|
3
|
+
/** @default "/tournaments" */
|
|
4
|
+
viewAllUrl?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function TournamentsCarouselItem({ className, viewAllUrl, }: TournamentsCarouselItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { pick } from 'lodash-es';
|
|
4
|
+
import Image from 'next/image';
|
|
5
|
+
import Link from 'next/link';
|
|
6
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
7
|
+
import { twMerge } from 'tailwind-merge';
|
|
8
|
+
import { useLocaleInfo } from '../../../client/hooks/index.js';
|
|
9
|
+
import { Award01Icon, ChevronRightIcon, Trophy01Icon, User01Icon, } from '../../../icons/index.js';
|
|
10
|
+
import { StarIcon } from '../../../icons/StarIcon.js';
|
|
11
|
+
import firstPlace from '../../../images/first-place.png';
|
|
12
|
+
import trophyTwo from '../../../images/trophy-two.png';
|
|
13
|
+
import trophy from '../../../images/trophy.png';
|
|
14
|
+
import { formatNumber, mask } from '../../../utils/index.js';
|
|
15
|
+
import { useTournamentsCarouselItemContext } from './TournamentsCarouselContext.js';
|
|
16
|
+
import styles from './TournamentsCarouselItem.module.css';
|
|
17
|
+
export function TournamentsCarouselItem({ className, viewAllUrl, }) {
|
|
18
|
+
const tournament = useTournamentsCarouselItemContext();
|
|
19
|
+
const localeInfo = useLocaleInfo();
|
|
20
|
+
const [timeRemaining, setTimeRemaining] = useState({
|
|
21
|
+
days: 0,
|
|
22
|
+
hours: 0,
|
|
23
|
+
minutes: 0,
|
|
24
|
+
seconds: 0,
|
|
25
|
+
isPast: false,
|
|
26
|
+
});
|
|
27
|
+
const activationEndDateTime = useMemo(() => new Date(tournament.activationEndDateTime), [tournament.activationEndDateTime]);
|
|
28
|
+
const calculateRemainingTime = React.useCallback(() => {
|
|
29
|
+
const now = new Date();
|
|
30
|
+
const diffMs = activationEndDateTime.getTime() - now.getTime();
|
|
31
|
+
if (diffMs <= 0) {
|
|
32
|
+
setTimeRemaining({
|
|
33
|
+
days: 0,
|
|
34
|
+
hours: 0,
|
|
35
|
+
minutes: 0,
|
|
36
|
+
seconds: 0,
|
|
37
|
+
isPast: true,
|
|
38
|
+
});
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const diffSeconds = Math.floor(diffMs / 1000);
|
|
42
|
+
const days = Math.floor(diffSeconds / (3600 * 24));
|
|
43
|
+
const hours = Math.floor((diffSeconds % (3600 * 24)) / 3600);
|
|
44
|
+
const minutes = Math.floor((diffSeconds % 3600) / 60);
|
|
45
|
+
const seconds = diffSeconds % 60;
|
|
46
|
+
const updated = pick({ days, hours, minutes, seconds, isPast: false }, [
|
|
47
|
+
'days',
|
|
48
|
+
'hours',
|
|
49
|
+
'minutes',
|
|
50
|
+
'seconds',
|
|
51
|
+
'isPast',
|
|
52
|
+
]);
|
|
53
|
+
setTimeRemaining(updated);
|
|
54
|
+
}, [activationEndDateTime]);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
calculateRemainingTime();
|
|
57
|
+
const interval = setInterval(calculateRemainingTime, 1000); // Update every second
|
|
58
|
+
return () => clearInterval(interval);
|
|
59
|
+
}, [activationEndDateTime, calculateRemainingTime]);
|
|
60
|
+
const timeParts = [
|
|
61
|
+
{ label: 'Day', value: timeRemaining.days },
|
|
62
|
+
{ label: 'Hour', value: timeRemaining.hours },
|
|
63
|
+
{ label: 'Min', value: timeRemaining.minutes },
|
|
64
|
+
{ label: 'Sec', value: timeRemaining.seconds },
|
|
65
|
+
];
|
|
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, {
|
|
71
|
+
currency: localeInfo.currency.code,
|
|
72
|
+
minDecimalPlaces: 2,
|
|
73
|
+
maxDecimalPlaces: 2,
|
|
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: mask(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: mask(tournament.node.username) }), _jsxs("td", { className: "border-border-secondary h-12 border-t-2", children: [tournament.node.multiplier, "x"] }), i + 1 <= prizeAmountsByRank.length ? (_jsx("td", { className: "border-border-secondary text-brand-400 h-12 border-t-2", children: formatNumber(prizeAmountsByRank[i], {
|
|
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))) })) })] }) }) })] })] }));
|
|
85
|
+
}
|
|
86
|
+
const starTierStyles = [
|
|
87
|
+
{
|
|
88
|
+
starColor: 'text-yellow-400',
|
|
89
|
+
numberColor: 'text-bg-primary',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
starColor: 'text-utility-gray-700',
|
|
93
|
+
numberColor: 'text-bg-primary',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
starColor: 'text-yellow-700',
|
|
97
|
+
numberColor: 'text-bg-primary',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
starColor: 'text-bg-quaternary',
|
|
101
|
+
numberColor: 'text-text-primary-900',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
starColor: 'text-bg-quaternary',
|
|
105
|
+
numberColor: 'text-text-primary-900',
|
|
106
|
+
},
|
|
107
|
+
];
|