@opexa/portal-components 0.0.50 → 0.0.51
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/useGlobalStore.d.ts +3 -3
- package/dist/client/hooks/useGlobalStore.js +3 -3
- package/dist/components/Account/AccountTrigger.d.ts +6 -0
- package/dist/components/Account/AccountTrigger.js +13 -0
- package/dist/components/Account/index.d.ts +1 -0
- package/dist/components/Account/index.js +1 -0
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts +2 -2
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts +1 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositContext.d.ts +2 -2
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/useQRPHDeposit.d.ts +1 -1
- package/dist/components/DepositWithdrawal/DepositWithdrawalTrigger.js +3 -2
- package/dist/components/GameLaunch/GameLaunchTrigger.js +13 -10
- package/dist/components/Games/Game.js +1 -1
- package/dist/components/GamesSearch/GamesSearch.d.ts +4 -2
- package/dist/components/GamesSearch/GamesSearch.js +28 -21
- package/dist/components/GamesSearch/index.d.ts +0 -1
- package/dist/components/GamesSearch/index.js +0 -1
- package/dist/components/Messages/MessagesTrigger.js +2 -2
- package/dist/components/Quests/WageringQuest/WageringQuest.d.ts +4 -1
- package/dist/components/Quests/WageringQuest/WageringQuest.js +9 -7
- package/dist/components/Quests/WageringQuest/WageringQuestModal.d.ts +1 -0
- package/dist/components/Quests/WageringQuest/WageringQuestModal.js +1 -1
- package/dist/components/Search/Search.d.ts +6 -0
- package/dist/components/Search/Search.js +38 -0
- package/dist/components/Search/SearchTrigger.d.ts +5 -0
- package/dist/components/Search/SearchTrigger.js +14 -0
- package/dist/components/Search/index.d.ts +2 -0
- package/dist/components/Search/index.js +2 -0
- package/dist/components/SignIn/SignInTrigger.js +2 -2
- package/dist/components/SignUp/SignUpTrigger.js +2 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/styles/theme.css +24 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/ui/Combobox/Combobox.d.ts +840 -798
- package/dist/ui/Combobox/combobox.recipe.d.ts +54 -51
- package/dist/ui/Combobox/combobox.recipe.js +59 -1
- package/package.json +1 -1
|
@@ -24,12 +24,12 @@ type GameLaunchDetails = {
|
|
|
24
24
|
game: Game | FavoriteGame;
|
|
25
25
|
session?: null;
|
|
26
26
|
};
|
|
27
|
-
interface GamesSearchStore extends PopupStore {
|
|
28
|
-
}
|
|
29
27
|
interface GameLaunchStore {
|
|
30
28
|
details: GameLaunchDetails;
|
|
31
29
|
setDetails: (details: GameLaunchDetails) => void;
|
|
32
30
|
}
|
|
31
|
+
interface SearchStore extends PopupStore {
|
|
32
|
+
}
|
|
33
33
|
type DepositWithdrawalTab = 'DEPOSIT' | 'WITHDRAWAL';
|
|
34
34
|
type MessagesTab = 'ALL' | 'UNREAD';
|
|
35
35
|
interface MessageStore extends PopupStore {
|
|
@@ -50,7 +50,7 @@ interface GlobalStore {
|
|
|
50
50
|
disclaimer: PopupStore;
|
|
51
51
|
depositWithdrawal: DepositWithdrawalStore;
|
|
52
52
|
gameLaunch: GameLaunchStore;
|
|
53
|
-
|
|
53
|
+
search: SearchStore;
|
|
54
54
|
account: PopupStore;
|
|
55
55
|
account__mobile: PopupStore;
|
|
56
56
|
messages: MessagesStore;
|
|
@@ -126,12 +126,12 @@ export const useGlobalStore = create((set) => ({
|
|
|
126
126
|
}));
|
|
127
127
|
},
|
|
128
128
|
},
|
|
129
|
-
|
|
129
|
+
search: {
|
|
130
130
|
open: false,
|
|
131
131
|
setOpen(open) {
|
|
132
132
|
set((prev) => ({
|
|
133
|
-
|
|
134
|
-
...prev.
|
|
133
|
+
search: {
|
|
134
|
+
...prev.search,
|
|
135
135
|
open,
|
|
136
136
|
},
|
|
137
137
|
}));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef } from 'react';
|
|
2
|
+
export interface AccountTriggerProps extends ComponentPropsWithRef<'button'> {
|
|
3
|
+
mobile?: boolean;
|
|
4
|
+
asChild?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function AccountTrigger(props: AccountTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { ark } from '@ark-ui/react';
|
|
4
|
+
import { useShallow } from 'zustand/shallow';
|
|
5
|
+
import { useGlobalStore } from '../../client/hooks/index.js';
|
|
6
|
+
export function AccountTrigger(props) {
|
|
7
|
+
const { mobile, ...rest } = props;
|
|
8
|
+
const { open, setOpen } = useGlobalStore(useShallow((ctx) => (mobile ? ctx.account__mobile : ctx.account)));
|
|
9
|
+
return (_jsx(ark.button, { type: "button", "aria-label": "Toggle account menu", "data-open": open ? 'open' : 'closed', ...rest, onClick: (e) => {
|
|
10
|
+
setOpen(!open);
|
|
11
|
+
return props.onClick?.(e);
|
|
12
|
+
} }));
|
|
13
|
+
}
|
package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const OnlineBankDepositContext: import("react").Context<{
|
|
2
|
-
view: "
|
|
2
|
+
view: "form" | "vca";
|
|
3
3
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
4
4
|
verify: () => void;
|
|
5
5
|
reset: () => void;
|
|
@@ -10,7 +10,7 @@ export declare const OnlineBankDepositContext: import("react").Context<{
|
|
|
10
10
|
}) => void;
|
|
11
11
|
} | null>;
|
|
12
12
|
export declare const useOnlineBankDepositContext: () => {
|
|
13
|
-
view: "
|
|
13
|
+
view: "form" | "vca";
|
|
14
14
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
15
15
|
verify: () => void;
|
|
16
16
|
reset: () => void;
|
package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Deposit } from '@opexa/portal-sdk-core';
|
|
2
2
|
export type UseOnlineBankDepositReturn = ReturnType<typeof useOnlineBankDeposit>;
|
|
3
3
|
export declare function useOnlineBankDeposit(): {
|
|
4
|
-
view: "
|
|
4
|
+
view: "form" | "vca";
|
|
5
5
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
6
6
|
verify: () => void;
|
|
7
7
|
reset: () => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const QRPHDepositContext: import("react").Context<{
|
|
2
|
-
view: "
|
|
2
|
+
view: "form" | "qrCode";
|
|
3
3
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
4
4
|
verify: () => void;
|
|
5
5
|
reset: () => void;
|
|
@@ -10,7 +10,7 @@ export declare const QRPHDepositContext: import("react").Context<{
|
|
|
10
10
|
}) => void;
|
|
11
11
|
} | null>;
|
|
12
12
|
export declare const useQRPHDepositContext: () => {
|
|
13
|
-
view: "
|
|
13
|
+
view: "form" | "qrCode";
|
|
14
14
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
15
15
|
verify: () => void;
|
|
16
16
|
reset: () => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Deposit } from '@opexa/portal-sdk-core';
|
|
2
2
|
export type UseQRPHDepositReturn = ReturnType<typeof useQRPHDeposit>;
|
|
3
3
|
export declare function useQRPHDeposit(): {
|
|
4
|
-
view: "
|
|
4
|
+
view: "form" | "qrCode";
|
|
5
5
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
6
6
|
verify: () => void;
|
|
7
7
|
reset: () => void;
|
|
@@ -13,8 +13,9 @@ export function DepositWithdrawalTrigger(props) {
|
|
|
13
13
|
: globalStore.depositWithdrawal.open
|
|
14
14
|
? true
|
|
15
15
|
: props.disabled;
|
|
16
|
-
return (_jsx(ark.button, { type: "button", ...props, onClick: async (e) => {
|
|
16
|
+
return (_jsx(ark.button, { type: "button", "aria-label": "Deposit or Withdraw", "data-state": globalStore.depositWithdrawal.open ? 'open' : 'closed', ...props, disabled: disabled, onClick: async (e) => {
|
|
17
17
|
props.onClick?.(e);
|
|
18
|
+
globalStore.depositWithdrawal.setTab('DEPOSIT');
|
|
18
19
|
globalStore.depositWithdrawal.setOpen(true);
|
|
19
|
-
}
|
|
20
|
+
} }));
|
|
20
21
|
}
|
|
@@ -16,10 +16,16 @@ export function GameLaunchTrigger(props) {
|
|
|
16
16
|
: globalStore.gameLaunch.details.status !== 'WAITING'
|
|
17
17
|
? true
|
|
18
18
|
: props.disabled;
|
|
19
|
-
return (_jsx(ark.button, { type: "button",
|
|
20
|
-
|
|
19
|
+
return (_jsx(ark.button, { type: "button", "aria-label": `Play ${props.game.name}`, "data-state": sessionQuery.data?.status === 'unauthenticated'
|
|
20
|
+
? globalStore.signIn.open
|
|
21
|
+
? 'open'
|
|
22
|
+
: 'closed'
|
|
23
|
+
: globalStore.gameLaunch.details.status === 'WAITING'
|
|
24
|
+
? 'closed'
|
|
25
|
+
: 'open', ...props, disabled: disabled, onClick: async (e) => {
|
|
21
26
|
if (sessionQuery.data?.status === 'unauthenticated') {
|
|
22
|
-
|
|
27
|
+
globalStore.signIn.setOpen(true);
|
|
28
|
+
return props.onClick?.(e);
|
|
23
29
|
}
|
|
24
30
|
globalStore.gameLaunch.setDetails({
|
|
25
31
|
game: props.game,
|
|
@@ -44,11 +50,8 @@ export function GameLaunchTrigger(props) {
|
|
|
44
50
|
description: error instanceof Error ? error.message : 'Failed to launch game',
|
|
45
51
|
});
|
|
46
52
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
: globalStore.gameLaunch.details.status === 'WAITING'
|
|
52
|
-
? 'closed'
|
|
53
|
-
: 'open' }));
|
|
53
|
+
finally {
|
|
54
|
+
return props.onClick?.(e);
|
|
55
|
+
}
|
|
56
|
+
} }));
|
|
54
57
|
}
|
|
@@ -17,7 +17,7 @@ export function Game(props) {
|
|
|
17
17
|
const markGameAsFavoriteMutation = useMarkGameAsFavoriteMutation();
|
|
18
18
|
const unmarkGameAsFavoriteMutation = useUnmarkGameAsFavoriteMutation();
|
|
19
19
|
const markedAsFavorite = favoriteGames.some((favoriteGame) => favoriteGame.id === game.id);
|
|
20
|
-
return (_jsxs(GameLaunchTrigger, { game: game, className: "relative block w-full shadow-sm", children: [props.badge === 'new' && (_jsx(BadgeNew, { className: "absolute left-0 top-0 size-[3.75rem]" })), props.badge === 'top' && (_jsx(BadgeTop, { className: "absolute left-0 top-0 size-[3.75rem]" })), props.badge === 'popular' && (_jsx(BadgePopular, { className: "absolute left-0 top-0 size-[3.75rem]" })), session?.status === 'authenticated' && (_jsx("div", { role: "button", onClick: (e) => {
|
|
20
|
+
return (_jsxs(GameLaunchTrigger, { game: game, className: "animate-scale-in relative block w-full shadow-sm", children: [props.badge === 'new' && (_jsx(BadgeNew, { className: "absolute left-0 top-0 size-[3.75rem]" })), props.badge === 'top' && (_jsx(BadgeTop, { className: "absolute left-0 top-0 size-[3.75rem]" })), props.badge === 'popular' && (_jsx(BadgePopular, { className: "absolute left-0 top-0 size-[3.75rem]" })), session?.status === 'authenticated' && (_jsx("div", { role: "button", onClick: (e) => {
|
|
21
21
|
e.preventDefault();
|
|
22
22
|
e.stopPropagation();
|
|
23
23
|
if (markGameAsFavoriteMutation.isPending)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { GamesInput } from '@opexa/portal-sdk-core';
|
|
2
2
|
interface GamesSearchProps {
|
|
3
|
-
|
|
3
|
+
first?: number;
|
|
4
|
+
filter?: GamesInput['filter'];
|
|
5
|
+
className?: string;
|
|
4
6
|
}
|
|
5
7
|
export declare function GamesSearch(props: GamesSearchProps): import("react/jsx-runtime").JSX.Element;
|
|
6
8
|
export {};
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { Portal } from '@ark-ui/react';
|
|
4
|
-
import Image
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import providerHacksaw from '../../images/hacksaw-gaming.png';
|
|
10
|
-
import { Button, Dialog, Field, IconButton, Presence } from '../../ui/index.js';
|
|
3
|
+
import { createListCollection, Portal } from '@ark-ui/react';
|
|
4
|
+
import Image from 'next/image';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
import { useGamesQuery } from '../../client/hooks/index.js';
|
|
7
|
+
import { SearchLgIcon } from '../../icons/index.js';
|
|
8
|
+
import { Button, Combobox, Presence } from '../../ui/index.js';
|
|
11
9
|
import { GameLaunchTrigger } from '../GameLaunch/index.js';
|
|
12
10
|
export function GamesSearch(props) {
|
|
13
|
-
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
14
|
-
gamesSearch: ctx.gamesSearch,
|
|
15
|
-
})));
|
|
16
|
-
const inputRef = useRef(null);
|
|
17
11
|
const [search, setSearch] = useState('');
|
|
18
12
|
const gamesQuery = useGamesQuery({
|
|
19
|
-
first: 18,
|
|
13
|
+
first: props.first ?? 18,
|
|
14
|
+
filter: props.filter,
|
|
20
15
|
search,
|
|
21
16
|
}, {
|
|
22
17
|
enabled: search.length >= 3,
|
|
@@ -24,14 +19,26 @@ export function GamesSearch(props) {
|
|
|
24
19
|
const games = gamesQuery.data?.pages
|
|
25
20
|
.map((page) => page.edges.map((edge) => edge.node))
|
|
26
21
|
.flat() ?? [];
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
22
|
+
const collection = createListCollection({
|
|
23
|
+
items: games,
|
|
24
|
+
itemToValue: (item) => item.id,
|
|
25
|
+
itemToString: (item) => item.name,
|
|
26
|
+
});
|
|
27
|
+
return (_jsx("div", { className: props.className, children: _jsxs(Combobox.Root, { collection: collection, positioning: {
|
|
28
|
+
sameWidth: true,
|
|
29
|
+
placement: 'bottom',
|
|
30
|
+
}, inputValue: search, onInputValueChange: (details) => {
|
|
31
|
+
setSearch(details.inputValue);
|
|
32
|
+
}, selectionBehavior: "preserve", allowCustomValue: true, children: [_jsxs(Combobox.Control, { children: [_jsx(Combobox.Input, {}), _jsx(Combobox.Context, { children: (api) => {
|
|
33
|
+
if (api.inputValue.length <= 0)
|
|
34
|
+
return null;
|
|
35
|
+
return (_jsx("span", { className: "text-text-secondary-700 px-3.5 font-semibold", tabIndex: 0, onClick: () => {
|
|
36
|
+
api.setInputValue('');
|
|
37
|
+
api.focus();
|
|
38
|
+
}, children: "Clear" }));
|
|
39
|
+
} })] }), _jsx(Portal, { children: _jsx(Combobox.Positioner, { children: search.trim().length > 0 && (_jsx(Combobox.Content, { className: "max-h-[33.25rem] overflow-y-auto p-0", children: search.length >= 1 && search.length <= 2 ? (_jsx(Alert, { message: "Search requires at least 3 characters." })) : (_jsxs(_Fragment, { children: [games.length <= 0 && _jsx(Alert, { message: "No results found" }), games.length > 0 && (_jsxs("div", { className: "p-xl", children: [_jsx(Combobox.Context, { children: (api) => (_jsx("div", { className: "grid grid-cols-9 gap-3.5", children: games.map((game) => (_jsxs(GameLaunchTrigger, { game: game, onClick: () => {
|
|
40
|
+
api.setOpen(false);
|
|
41
|
+
}, className: "block w-full shadow-sm", children: [_jsx(Image, { src: game.image, alt: "", width: 200, height: 200, priority: true, className: "aspect-square w-full rounded-t-md object-cover" }), _jsx("span", { className: "bg-bg-tertiary text-text-primary-brand block w-full truncate rounded-b-md px-2 py-2.5 text-center text-xs font-semibold", children: game.name })] }, game.id))) })) }), _jsx(Presence, { present: gamesQuery.hasNextPage, children: _jsx(Button, { variant: "outline", className: "mx-auto mt-4xl w-fit", onClick: () => gamesQuery.fetchNextPage(), children: "Load More" }) })] }))] })) })) }) })] }) }));
|
|
35
42
|
}
|
|
36
43
|
function Alert({ message }) {
|
|
37
44
|
return (_jsxs("div", { className: "py-lg", role: "alert", "aria-live": "polite", children: [_jsx("div", { className: "bg-bg-secondary shadow-xs border-border-primary mx-auto flex size-12 items-center justify-center rounded-lg border", children: _jsx(SearchLgIcon, { className: "text-text-secondary-700 size-6" }) }), _jsx("p", { className: "text-text-secondary-700 mt-4 text-center", children: message })] }));
|
|
@@ -7,8 +7,8 @@ export function MessagesTrigger(props) {
|
|
|
7
7
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
8
8
|
messages: ctx.messages,
|
|
9
9
|
})));
|
|
10
|
-
return (_jsx(ark.button, { type: "button", ...props, onClick: (e) => {
|
|
10
|
+
return (_jsx(ark.button, { type: "button", "aria-label": "Toggle messages panel", "data-state": globalStore.messages.open ? 'open' : 'closed', ...props, onClick: (e) => {
|
|
11
11
|
globalStore.messages.setOpen(!globalStore.messages.open);
|
|
12
12
|
return props.onClick?.(e);
|
|
13
|
-
}
|
|
13
|
+
} }));
|
|
14
14
|
}
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { ClockStopWatchIcon, InfoCircleIcon } from '../../../icons/index.js';
|
|
5
|
-
import { Button } from '../../../ui/index.js';
|
|
6
5
|
import { WageringQuestModal } from './WageringQuestModal.js';
|
|
7
|
-
|
|
6
|
+
import CountdownTimer from '../CountdownTimer.js';
|
|
7
|
+
import { twMerge } from 'tailwind-merge';
|
|
8
|
+
export default function WageringQuest({ quest }) {
|
|
8
9
|
const [showRules, setShowRules] = useState(false);
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
return (_jsxs(_Fragment, { children: [_jsx(WageringQuestModal, { modalState: {
|
|
10
|
+
const [isExpired, setIsExpired] = useState(false);
|
|
11
|
+
const { progressPercentage, turnover, targetTurnover, name, description, endDateTime, bonus, status, } = quest;
|
|
12
|
+
return (_jsxs(_Fragment, { children: [_jsx(WageringQuestModal, { questName: name, modalState: {
|
|
13
13
|
isOpen: showRules,
|
|
14
14
|
setIsOpen: setShowRules,
|
|
15
|
-
} }), _jsxs("div", { className: "border-border-primary bg-bg-tertiary flex h-full w-full min-w-[343px] flex-col space-y-6 rounded-2xl border px-4 pb-6 pt-5", children: [_jsxs("div", { className: "flex flex-col space-y-2", children: [_jsxs("div", { className: "flex max-h-7.5 items-start justify-between", children: [_jsxs("div", { className: "border-utility-brand-200 bg-utility-brand-50 rounded-xs flex items-center space-x-1 border py-1 pl-2 pr-2.5", children: [_jsx(ClockStopWatchIcon, { className: "text-brand-400" }),
|
|
15
|
+
} }), _jsxs("div", { className: "border-border-primary bg-bg-tertiary flex h-full w-full min-w-[343px] flex-col space-y-6 rounded-2xl border px-4 pb-6 pt-5", children: [_jsxs("div", { className: "flex flex-col space-y-2", children: [_jsxs("div", { className: "flex max-h-7.5 items-start justify-between", children: [_jsx(CountdownTimer, { endDateTime: endDateTime, renderAction: (timeLeft) => (_jsxs("div", { className: "border-utility-brand-200 bg-utility-brand-50 rounded-xs flex items-center space-x-1 border py-1 pl-2 pr-2.5", children: [_jsx(ClockStopWatchIcon, { className: "text-brand-400" }), _jsxs("p", { className: "text-utility-brand-700 text-sm font-medium", children: [timeLeft.days, "d:", timeLeft.hours, "h:", timeLeft.minutes, "m:", timeLeft.seconds, "s"] })] })), onEnd: () => setIsExpired(true) }), _jsx("div", { role: "button", className: "bg-bg-primary border-border-secondary cursor-pointer rounded-md border p-2", onClick: () => setShowRules((prev) => !prev), children: _jsx(InfoCircleIcon, { className: "text-text-disabled" }) })] }), _jsx("p", { className: "text-xl font-semibold", children: name }), _jsx("p", { className: "text-text-secondary-700 text-wrap text-sm font-normal", dangerouslySetInnerHTML: { __html: description } })] }), _jsxs("div", { className: "flex w-full flex-col space-y-2", children: [_jsxs("div", { className: "text-text-primary-brand group flex items-center justify-between", children: [_jsxs("p", { children: ["Progress ", parseInt(progressPercentage).toFixed(2), "%"] }), _jsxs("p", { children: [turnover, _jsxs("span", { className: "text-text-quarterary-brand", children: ["/", targetTurnover, " PHP"] })] })] }), _jsx("div", { className: "bg-bg-primary h-2 w-full overflow-hidden rounded-full", children: _jsx("div", { className: "bg-utility-brand-600 h-full rounded-full transition-all duration-300", style: { width: `${progressPercentage}%` } }) })] }), _jsx("div", { className: "flex h-full items-end", children: _jsx("div", { className: "bg-button-secondary-bg border-bg-primary-hover w-full rounded-md border px-3.5 py-2.5 text-center text-white", children: _jsxs("p", { className: twMerge(isExpired || status === 'COMPLETED' || status === 'FAILED'
|
|
16
|
+
? ['opacity-50 grayscale']
|
|
17
|
+
: ''), children: ["Complete to get ", _jsxs("span", { className: "text-brand-400", children: ["\u20B1", bonus] }), ' ', "bonus!"] }) }) })] })] }));
|
|
16
18
|
}
|
|
@@ -4,5 +4,5 @@ import { Portal } from '@ark-ui/react';
|
|
|
4
4
|
import { XIcon } from '../../../icons/index.js';
|
|
5
5
|
import { Button, Dialog } from '../../../ui/index.js';
|
|
6
6
|
export function WageringQuestModal(props) {
|
|
7
|
-
return (_jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: props.modalState.isOpen, onOpenChange: ({ open }) => props.modalState.setIsOpen(open), closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "min-h-auto mx-auto max-w-[343px] rounded-xl px-4 pb-0 pt-5", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "flex flex-col space-y-5", children: [_jsx("p", { className: "text-text-primary-900 text-[18px] font-semibold", children:
|
|
7
|
+
return (_jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: props.modalState.isOpen, onOpenChange: ({ open }) => props.modalState.setIsOpen(open), closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "min-h-auto mx-auto max-w-[343px] rounded-xl px-4 pb-0 pt-5", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "flex flex-col space-y-5", children: [_jsx("p", { className: "text-text-primary-900 text-[18px] font-semibold", children: props.questName }), _jsxs("ul", { className: "text-text-tertiary-600 group list-disc text-wrap pl-4 text-sm font-normal", children: [_jsx("li", { children: "Earn extra rewards just by playing Slots, every bet counts, win or lose!" }), _jsx("li", { children: "Reach the wagering requirement in bets to complete the quest and claim your reward." })] })] }), _jsx("div", { className: "pb-4 pt-6", children: _jsx(Button, { onClick: () => props.modalState.setIsOpen(false), children: "Ok" }) })] }) })] }) }));
|
|
8
8
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Portal } from '@ark-ui/react';
|
|
4
|
+
import Image, {} from 'next/image';
|
|
5
|
+
import { useRef, useState } from 'react';
|
|
6
|
+
import { useShallow } from 'zustand/shallow';
|
|
7
|
+
import { useGamesQuery, useGlobalStore } from '../../client/hooks/index.js';
|
|
8
|
+
import { SearchLgIcon, XIcon } from '../../icons/index.js';
|
|
9
|
+
import providerHacksaw from '../../images/hacksaw-gaming.png';
|
|
10
|
+
import { Button, Dialog, Field, IconButton, Presence } from '../../ui/index.js';
|
|
11
|
+
import { GameLaunchTrigger } from '../GameLaunch/index.js';
|
|
12
|
+
export function Search(props) {
|
|
13
|
+
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
14
|
+
search: ctx.search,
|
|
15
|
+
})));
|
|
16
|
+
const inputRef = useRef(null);
|
|
17
|
+
const [search, setSearch] = useState('');
|
|
18
|
+
const gamesQuery = useGamesQuery({
|
|
19
|
+
first: 18,
|
|
20
|
+
search,
|
|
21
|
+
}, {
|
|
22
|
+
enabled: search.length >= 3,
|
|
23
|
+
});
|
|
24
|
+
const games = gamesQuery.data?.pages
|
|
25
|
+
.map((page) => page.edges.map((edge) => edge.node))
|
|
26
|
+
.flat() ?? [];
|
|
27
|
+
return (_jsx(Dialog.Root, { open: globalStore.search.open, onOpenChange: (details) => globalStore.search.setOpen(details.open), lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: "bg-bg-primary lg:min-h-auto mx-auto min-h-full w-full pt-xl lg:mt-[132px] lg:max-w-[1136px] lg:bg-unset lg:pt-0", children: [_jsx(Dialog.Context, { children: (api) => (_jsxs("div", { className: "flex items-center justify-between px-4 lg:hidden", children: [_jsx(Image, { src: props.logo, alt: "", width: 200, height: 40, className: "h-8 w-auto" }), _jsx(IconButton, { size: "sm", colorScheme: "gray", onClick: () => api.setOpen(false), children: _jsx(XIcon, { className: "text-text-quinary size-6" }) })] })) }), _jsx("div", { className: "flex justify-end", children: _jsx(Dialog.Context, { children: (api) => (_jsx("button", { type: "button", onClick: () => api.setOpen(false), className: "hidden size-9 items-center justify-center rounded-md bg-white/20 lg:flex", children: _jsx(XIcon, { className: "size-5 text-white" }) })) }) }), _jsx("div", { className: "mt-2xl px-4 lg:mt-xl lg:px-0", children: _jsxs("div", { className: "relative", children: [_jsx(SearchLgIcon, { className: "text-text-quinary pointer-events-none absolute left-3.5 top-1/2 size-5 -translate-y-1/2" }), _jsx(Field.Input, { ref: inputRef, type: "search", value: search, onChange: (e) => {
|
|
28
|
+
setSearch(e.target.value);
|
|
29
|
+
}, className: "pl-10 pr-16", placeholder: "Search", autoComplete: "off" }), _jsx(Presence, { present: search.length > 0, asChild: true, lazyMount: true, children: _jsx("button", { type: "button", className: "text-text-secondary-700 absolute right-3.5 top-1/2 -translate-y-1/2 font-semibold", onClick: () => {
|
|
30
|
+
setSearch('');
|
|
31
|
+
inputRef.current?.focus();
|
|
32
|
+
}, children: "Clear" }) })] }) }), _jsx("div", { className: "lg:bg-bg-primary lg:border-border-primary mt-2xl p-xl pb-3xl lg:mt-2 lg:rounded-xl lg:border", children: search.length <= 0 ? (_jsx(Alert, { message: "Search for your favorite game or provider." })) : search.length >= 1 && search.length <= 2 ? (_jsx(Alert, { message: "Search requires at least 3 characters." })) : (_jsxs(_Fragment, { children: [games.length <= 0 && _jsx(Alert, { message: "No results found" }), games.length > 0 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "text-lg font-semibold", children: "Providers" }), _jsx("div", { className: "mb-3xl mt-3.5 grid grid-cols-3 gap-1.5 lg:grid-cols-9 lg:gap-3.5", children: _jsx("div", { className: "bg-gray-800 flex h-14 w-full items-center rounded-md", children: _jsx(Image, { src: providerHacksaw, alt: "", width: 100, height: 50, className: "mx-auto h-auto w-full" }) }) }), _jsx("h2", { className: "text-lg font-semibold", children: "Games" }), _jsx("div", { className: "mt-3.5 grid grid-cols-3 gap-1.5 lg:grid-cols-9 lg:gap-3.5", children: games.map((game) => (_jsxs(GameLaunchTrigger, { game: game, className: "block w-full shadow-sm", onClick: () => {
|
|
33
|
+
globalStore.search.setOpen(false);
|
|
34
|
+
}, children: [_jsx(Image, { src: game.image, alt: "", width: 200, height: 200, priority: true, className: "aspect-square w-full rounded-t-md object-cover" }), _jsx("span", { className: "bg-bg-tertiary text-text-primary-brand block w-full truncate rounded-b-md px-2 py-2.5 text-center text-xs font-semibold", children: game.name })] }, game.id))) }), _jsx(Presence, { present: gamesQuery.hasNextPage, children: _jsx(Button, { variant: "outline", className: "mx-auto mt-12 w-fit", onClick: () => gamesQuery.fetchNextPage(), children: "Load More" }) })] }))] })) })] }) })] }) }));
|
|
35
|
+
}
|
|
36
|
+
function Alert({ message }) {
|
|
37
|
+
return (_jsxs("div", { className: "py-lg", role: "alert", "aria-live": "polite", children: [_jsx("div", { className: "bg-bg-secondary shadow-xs border-border-primary mx-auto flex size-12 items-center justify-center rounded-lg border", children: _jsx(SearchLgIcon, { className: "text-text-secondary-700 size-6" }) }), _jsx("p", { className: "text-text-secondary-700 mt-4 text-center", children: message })] }));
|
|
38
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { ark } from '@ark-ui/react';
|
|
4
|
+
import { useShallow } from 'zustand/shallow';
|
|
5
|
+
import { useGlobalStore } from '../../client/hooks/index.js';
|
|
6
|
+
export function SearchTrigger(props) {
|
|
7
|
+
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
8
|
+
search: ctx.search,
|
|
9
|
+
})));
|
|
10
|
+
return (_jsx(ark.button, { type: "button", "aria-label": "Search", "data-state": globalStore.search.open ? 'open' : 'closed', ...props, onClick: (e) => {
|
|
11
|
+
globalStore.search.setOpen(!globalStore.search.open);
|
|
12
|
+
return props.onClick?.(e);
|
|
13
|
+
} }));
|
|
14
|
+
}
|
|
@@ -7,8 +7,8 @@ export function SignInTrigger(props) {
|
|
|
7
7
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
8
8
|
signIn: ctx.signIn,
|
|
9
9
|
})));
|
|
10
|
-
return (_jsx(ark.button, { type: "button", ...props, onClick: (e) => {
|
|
10
|
+
return (_jsx(ark.button, { type: "button", "aria-label": "Sign in", "data-state": globalStore.signIn.open ? 'open' : 'closed', ...props, onClick: (e) => {
|
|
11
11
|
globalStore.signIn.setOpen(!globalStore.signIn.open);
|
|
12
12
|
return props.onClick?.(e);
|
|
13
|
-
}
|
|
13
|
+
} }));
|
|
14
14
|
}
|
|
@@ -7,8 +7,8 @@ export function SignUpTrigger(props) {
|
|
|
7
7
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
8
8
|
signUp: ctx.signUp,
|
|
9
9
|
})));
|
|
10
|
-
return (_jsx(ark.button, { type: "button", ...props, onClick: (e) => {
|
|
10
|
+
return (_jsx(ark.button, { type: "button", "aria-label": "Sign up", "data-state": globalStore.signUp.open ? 'open' : 'closed', ...props, onClick: (e) => {
|
|
11
11
|
globalStore.signUp.setOpen(!globalStore.signUp.open);
|
|
12
12
|
return props.onClick?.(e);
|
|
13
|
-
}
|
|
13
|
+
} }));
|
|
14
14
|
}
|
package/dist/components/index.js
CHANGED
|
@@ -23,6 +23,7 @@ export * from './Promo/index.js';
|
|
|
23
23
|
export * from './Promos/index.js';
|
|
24
24
|
export * from './Protected/index.js';
|
|
25
25
|
export * from './Quests/index.js';
|
|
26
|
+
export * from './Search/index.js';
|
|
26
27
|
export * from './SignIn/index.js';
|
|
27
28
|
export * from './SignUp/index.js';
|
|
28
29
|
export * from './TopWins/index.js';
|
package/dist/styles/theme.css
CHANGED
|
@@ -360,6 +360,8 @@
|
|
|
360
360
|
cubic-bezier(0.3, 0, 0.8, 0.15);
|
|
361
361
|
--animate-slide-in-down: slide-in-down 400ms cubic-bezier(0.05, 0.7, 0.1, 1);
|
|
362
362
|
--animate-slide-out-down: slide-out-down 250ms cubic-bezier(0.3, 0, 0.8, 0.15);
|
|
363
|
+
--animate-scale-in: scale-in 400ms cubic-bezier(0.05, 0.7, 0.1, 1);
|
|
364
|
+
--animate-scale-out: scale-out 250ms cubic-bezier(0.3, 0, 0.8, 0.15);
|
|
363
365
|
--animate-marquee: marquee 10s linear infinite forwards;
|
|
364
366
|
|
|
365
367
|
@keyframes fade-in {
|
|
@@ -624,6 +626,28 @@
|
|
|
624
626
|
}
|
|
625
627
|
}
|
|
626
628
|
|
|
629
|
+
@keyframes scale-in {
|
|
630
|
+
from {
|
|
631
|
+
transform: scale(0.85);
|
|
632
|
+
opacity: 0;
|
|
633
|
+
}
|
|
634
|
+
to {
|
|
635
|
+
transform: scale(1);
|
|
636
|
+
opacity: 1;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
@keyframes scale-out {
|
|
641
|
+
from {
|
|
642
|
+
transform: scale(1);
|
|
643
|
+
opacity: 1;
|
|
644
|
+
}
|
|
645
|
+
to {
|
|
646
|
+
transform: scale(0.85);
|
|
647
|
+
opacity: 0;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
|
|
627
651
|
@keyframes marquee {
|
|
628
652
|
to {
|
|
629
653
|
transform: translateX(-100%);
|