@dubsdotapp/expo 0.5.14 → 0.5.16
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/index.js +299 -211
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +246 -160
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useHighlights.ts +38 -0
- package/src/hooks/useShorts.ts +36 -0
- package/src/index.ts +4 -0
- package/src/ui/game/JoinGameSheet.tsx +43 -11
- package/dist/index.d.mts +0 -1500
- package/dist/index.d.ts +0 -1500
package/dist/index.js
CHANGED
|
@@ -83,9 +83,11 @@ __export(index_exports, {
|
|
|
83
83
|
useGame: () => useGame,
|
|
84
84
|
useGames: () => useGames,
|
|
85
85
|
useHasClaimed: () => useHasClaimed,
|
|
86
|
+
useHighlights: () => useHighlights,
|
|
86
87
|
useJoinGame: () => useJoinGame,
|
|
87
88
|
useNetworkGames: () => useNetworkGames,
|
|
88
89
|
usePushNotifications: () => usePushNotifications,
|
|
90
|
+
useShorts: () => useShorts,
|
|
89
91
|
useUFCFightCard: () => useUFCFightCard,
|
|
90
92
|
useUFCFighterDetail: () => useUFCFighterDetail
|
|
91
93
|
});
|
|
@@ -731,7 +733,7 @@ function createSecureStoreStorage() {
|
|
|
731
733
|
}
|
|
732
734
|
|
|
733
735
|
// src/provider.tsx
|
|
734
|
-
var
|
|
736
|
+
var import_react26 = require("react");
|
|
735
737
|
|
|
736
738
|
// src/ui/theme.ts
|
|
737
739
|
var import_react = require("react");
|
|
@@ -1789,7 +1791,7 @@ function ManagedWalletProvider({
|
|
|
1789
1791
|
}
|
|
1790
1792
|
|
|
1791
1793
|
// src/ui/AuthGate.tsx
|
|
1792
|
-
var
|
|
1794
|
+
var import_react25 = __toESM(require("react"));
|
|
1793
1795
|
var import_react_native8 = require("react-native");
|
|
1794
1796
|
|
|
1795
1797
|
// src/hooks/useEvents.ts
|
|
@@ -2479,25 +2481,79 @@ function useUFCFighterDetail(athleteId) {
|
|
|
2479
2481
|
return { data, loading, error, refetch: fetchData };
|
|
2480
2482
|
}
|
|
2481
2483
|
|
|
2482
|
-
// src/hooks/
|
|
2484
|
+
// src/hooks/useHighlights.ts
|
|
2483
2485
|
var import_react16 = require("react");
|
|
2486
|
+
function useHighlights(league, limit = 8) {
|
|
2487
|
+
const { client } = useDubs();
|
|
2488
|
+
const [data, setData] = (0, import_react16.useState)(null);
|
|
2489
|
+
const [loading, setLoading] = (0, import_react16.useState)(true);
|
|
2490
|
+
const [error, setError] = (0, import_react16.useState)(null);
|
|
2491
|
+
const fetchData = (0, import_react16.useCallback)(async () => {
|
|
2492
|
+
setLoading(true);
|
|
2493
|
+
setError(null);
|
|
2494
|
+
try {
|
|
2495
|
+
const qs = new URLSearchParams();
|
|
2496
|
+
if (league) qs.set("league", league);
|
|
2497
|
+
qs.set("limit", String(limit));
|
|
2498
|
+
const res = await client.request("GET", `/highlights?${qs.toString()}`);
|
|
2499
|
+
setData(res.videos || []);
|
|
2500
|
+
} catch (err) {
|
|
2501
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
2502
|
+
} finally {
|
|
2503
|
+
setLoading(false);
|
|
2504
|
+
}
|
|
2505
|
+
}, [client, league, limit]);
|
|
2506
|
+
(0, import_react16.useEffect)(() => {
|
|
2507
|
+
fetchData();
|
|
2508
|
+
}, [fetchData]);
|
|
2509
|
+
return { data, loading, error, refetch: fetchData };
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
// src/hooks/useShorts.ts
|
|
2513
|
+
var import_react17 = require("react");
|
|
2514
|
+
function useShorts(league = "NBA", limit = 20) {
|
|
2515
|
+
const { client } = useDubs();
|
|
2516
|
+
const [data, setData] = (0, import_react17.useState)(null);
|
|
2517
|
+
const [loading, setLoading] = (0, import_react17.useState)(true);
|
|
2518
|
+
const [error, setError] = (0, import_react17.useState)(null);
|
|
2519
|
+
const fetchData = (0, import_react17.useCallback)(async () => {
|
|
2520
|
+
setLoading(true);
|
|
2521
|
+
setError(null);
|
|
2522
|
+
try {
|
|
2523
|
+
const qs = new URLSearchParams({ league, limit: String(limit) });
|
|
2524
|
+
const res = await client.request("GET", `/shorts?${qs.toString()}`);
|
|
2525
|
+
setData(res.videos || []);
|
|
2526
|
+
} catch (err) {
|
|
2527
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
2528
|
+
} finally {
|
|
2529
|
+
setLoading(false);
|
|
2530
|
+
}
|
|
2531
|
+
}, [client, league, limit]);
|
|
2532
|
+
(0, import_react17.useEffect)(() => {
|
|
2533
|
+
fetchData();
|
|
2534
|
+
}, [fetchData]);
|
|
2535
|
+
return { data, loading, error, refetch: fetchData };
|
|
2536
|
+
}
|
|
2537
|
+
|
|
2538
|
+
// src/hooks/usePushNotifications.ts
|
|
2539
|
+
var import_react18 = require("react");
|
|
2484
2540
|
var import_react_native6 = require("react-native");
|
|
2485
2541
|
function usePushNotifications() {
|
|
2486
2542
|
const { client, appName, pushEnabled } = useDubs();
|
|
2487
|
-
const channelId = (0,
|
|
2488
|
-
const [hasPermission, setHasPermission] = (0,
|
|
2489
|
-
const [pushToken, setPushToken] = (0,
|
|
2490
|
-
const [loading, setLoading] = (0,
|
|
2491
|
-
const [error, setError] = (0,
|
|
2492
|
-
const registering = (0,
|
|
2493
|
-
const getNotificationsModule = (0,
|
|
2543
|
+
const channelId = (0, import_react18.useMemo)(() => appName.toLowerCase().replace(/[^a-z0-9-]/g, ""), [appName]);
|
|
2544
|
+
const [hasPermission, setHasPermission] = (0, import_react18.useState)(false);
|
|
2545
|
+
const [pushToken, setPushToken] = (0, import_react18.useState)(null);
|
|
2546
|
+
const [loading, setLoading] = (0, import_react18.useState)(false);
|
|
2547
|
+
const [error, setError] = (0, import_react18.useState)(null);
|
|
2548
|
+
const registering = (0, import_react18.useRef)(false);
|
|
2549
|
+
const getNotificationsModule = (0, import_react18.useCallback)(() => {
|
|
2494
2550
|
try {
|
|
2495
2551
|
return require("expo-notifications");
|
|
2496
2552
|
} catch {
|
|
2497
2553
|
return null;
|
|
2498
2554
|
}
|
|
2499
2555
|
}, []);
|
|
2500
|
-
const getDeviceName = (0,
|
|
2556
|
+
const getDeviceName = (0, import_react18.useCallback)(() => {
|
|
2501
2557
|
try {
|
|
2502
2558
|
const Device = require("expo-device");
|
|
2503
2559
|
return Device.deviceName || null;
|
|
@@ -2505,7 +2561,7 @@ function usePushNotifications() {
|
|
|
2505
2561
|
return null;
|
|
2506
2562
|
}
|
|
2507
2563
|
}, []);
|
|
2508
|
-
const setupAndroidChannels = (0,
|
|
2564
|
+
const setupAndroidChannels = (0, import_react18.useCallback)((Notifications) => {
|
|
2509
2565
|
if (import_react_native6.Platform.OS === "android") {
|
|
2510
2566
|
Notifications.setNotificationChannelAsync(channelId || "default", {
|
|
2511
2567
|
name: appName || "Default",
|
|
@@ -2515,7 +2571,7 @@ function usePushNotifications() {
|
|
|
2515
2571
|
});
|
|
2516
2572
|
}
|
|
2517
2573
|
}, [channelId, appName]);
|
|
2518
|
-
const registerTokenWithServer = (0,
|
|
2574
|
+
const registerTokenWithServer = (0, import_react18.useCallback)(async (token) => {
|
|
2519
2575
|
const deviceName = getDeviceName();
|
|
2520
2576
|
await client.registerPushToken({
|
|
2521
2577
|
token,
|
|
@@ -2523,7 +2579,7 @@ function usePushNotifications() {
|
|
|
2523
2579
|
deviceName: deviceName || void 0
|
|
2524
2580
|
});
|
|
2525
2581
|
}, [client, getDeviceName]);
|
|
2526
|
-
const register = (0,
|
|
2582
|
+
const register = (0, import_react18.useCallback)(async () => {
|
|
2527
2583
|
if (!pushEnabled) return false;
|
|
2528
2584
|
if (registering.current) return false;
|
|
2529
2585
|
registering.current = true;
|
|
@@ -2564,7 +2620,7 @@ function usePushNotifications() {
|
|
|
2564
2620
|
return false;
|
|
2565
2621
|
}
|
|
2566
2622
|
}, [getNotificationsModule, registerTokenWithServer, setupAndroidChannels]);
|
|
2567
|
-
const unregister = (0,
|
|
2623
|
+
const unregister = (0, import_react18.useCallback)(async () => {
|
|
2568
2624
|
if (!pushToken) return;
|
|
2569
2625
|
try {
|
|
2570
2626
|
await client.unregisterPushToken(pushToken);
|
|
@@ -2573,7 +2629,7 @@ function usePushNotifications() {
|
|
|
2573
2629
|
console.error("[usePushNotifications] Unregister error:", err);
|
|
2574
2630
|
}
|
|
2575
2631
|
}, [client, pushToken]);
|
|
2576
|
-
const restoreIfGranted = (0,
|
|
2632
|
+
const restoreIfGranted = (0, import_react18.useCallback)(async () => {
|
|
2577
2633
|
if (!pushEnabled) return;
|
|
2578
2634
|
try {
|
|
2579
2635
|
const Notifications = getNotificationsModule();
|
|
@@ -2591,8 +2647,8 @@ function usePushNotifications() {
|
|
|
2591
2647
|
console.log("[usePushNotifications] Restore skipped:", err instanceof Error ? err.message : err);
|
|
2592
2648
|
}
|
|
2593
2649
|
}, [getNotificationsModule, registerTokenWithServer, setupAndroidChannels]);
|
|
2594
|
-
const didMount = (0,
|
|
2595
|
-
(0,
|
|
2650
|
+
const didMount = (0, import_react18.useRef)(false);
|
|
2651
|
+
(0, import_react18.useEffect)(() => {
|
|
2596
2652
|
if (didMount.current) return;
|
|
2597
2653
|
didMount.current = true;
|
|
2598
2654
|
const Notifications = getNotificationsModule();
|
|
@@ -2622,13 +2678,13 @@ function usePushNotifications() {
|
|
|
2622
2678
|
}
|
|
2623
2679
|
|
|
2624
2680
|
// src/hooks/useArcadePools.ts
|
|
2625
|
-
var
|
|
2681
|
+
var import_react19 = require("react");
|
|
2626
2682
|
function useArcadePools(gameSlug) {
|
|
2627
2683
|
const { client } = useDubs();
|
|
2628
|
-
const [pools, setPools] = (0,
|
|
2629
|
-
const [loading, setLoading] = (0,
|
|
2630
|
-
const [error, setError] = (0,
|
|
2631
|
-
const fetch2 = (0,
|
|
2684
|
+
const [pools, setPools] = (0, import_react19.useState)([]);
|
|
2685
|
+
const [loading, setLoading] = (0, import_react19.useState)(false);
|
|
2686
|
+
const [error, setError] = (0, import_react19.useState)(null);
|
|
2687
|
+
const fetch2 = (0, import_react19.useCallback)(async () => {
|
|
2632
2688
|
setLoading(true);
|
|
2633
2689
|
setError(null);
|
|
2634
2690
|
try {
|
|
@@ -2640,22 +2696,22 @@ function useArcadePools(gameSlug) {
|
|
|
2640
2696
|
setLoading(false);
|
|
2641
2697
|
}
|
|
2642
2698
|
}, [client, gameSlug]);
|
|
2643
|
-
(0,
|
|
2699
|
+
(0, import_react19.useEffect)(() => {
|
|
2644
2700
|
fetch2();
|
|
2645
2701
|
}, [fetch2]);
|
|
2646
2702
|
return { pools, loading, error, refetch: fetch2 };
|
|
2647
2703
|
}
|
|
2648
2704
|
|
|
2649
2705
|
// src/hooks/useArcadePool.ts
|
|
2650
|
-
var
|
|
2706
|
+
var import_react20 = require("react");
|
|
2651
2707
|
function useArcadePool(poolId) {
|
|
2652
2708
|
const { client } = useDubs();
|
|
2653
|
-
const [pool, setPool] = (0,
|
|
2654
|
-
const [stats, setStats] = (0,
|
|
2655
|
-
const [leaderboard, setLeaderboard] = (0,
|
|
2656
|
-
const [loading, setLoading] = (0,
|
|
2657
|
-
const [error, setError] = (0,
|
|
2658
|
-
const fetch2 = (0,
|
|
2709
|
+
const [pool, setPool] = (0, import_react20.useState)(null);
|
|
2710
|
+
const [stats, setStats] = (0, import_react20.useState)(null);
|
|
2711
|
+
const [leaderboard, setLeaderboard] = (0, import_react20.useState)([]);
|
|
2712
|
+
const [loading, setLoading] = (0, import_react20.useState)(false);
|
|
2713
|
+
const [error, setError] = (0, import_react20.useState)(null);
|
|
2714
|
+
const fetch2 = (0, import_react20.useCallback)(async () => {
|
|
2659
2715
|
if (!poolId) return;
|
|
2660
2716
|
setLoading(true);
|
|
2661
2717
|
setError(null);
|
|
@@ -2673,22 +2729,22 @@ function useArcadePool(poolId) {
|
|
|
2673
2729
|
setLoading(false);
|
|
2674
2730
|
}
|
|
2675
2731
|
}, [client, poolId]);
|
|
2676
|
-
(0,
|
|
2732
|
+
(0, import_react20.useEffect)(() => {
|
|
2677
2733
|
fetch2();
|
|
2678
2734
|
}, [fetch2]);
|
|
2679
2735
|
return { pool, stats, leaderboard, loading, error, refetch: fetch2 };
|
|
2680
2736
|
}
|
|
2681
2737
|
|
|
2682
2738
|
// src/hooks/useArcadeGame.ts
|
|
2683
|
-
var
|
|
2739
|
+
var import_react21 = require("react");
|
|
2684
2740
|
function useArcadeGame(poolId, maxLives = 3) {
|
|
2685
2741
|
const { client } = useDubs();
|
|
2686
2742
|
const { user } = useAuth();
|
|
2687
|
-
const [entry, setEntry] = (0,
|
|
2688
|
-
const [loading, setLoading] = (0,
|
|
2689
|
-
const [error, setError] = (0,
|
|
2743
|
+
const [entry, setEntry] = (0, import_react21.useState)(null);
|
|
2744
|
+
const [loading, setLoading] = (0, import_react21.useState)(false);
|
|
2745
|
+
const [error, setError] = (0, import_react21.useState)(null);
|
|
2690
2746
|
const walletAddress = user?.walletAddress || "";
|
|
2691
|
-
const refreshEntry = (0,
|
|
2747
|
+
const refreshEntry = (0, import_react21.useCallback)(async () => {
|
|
2692
2748
|
if (!poolId || !walletAddress) return;
|
|
2693
2749
|
setLoading(true);
|
|
2694
2750
|
setError(null);
|
|
@@ -2705,7 +2761,7 @@ function useArcadeGame(poolId, maxLives = 3) {
|
|
|
2705
2761
|
setLoading(false);
|
|
2706
2762
|
}
|
|
2707
2763
|
}, [client, poolId, walletAddress]);
|
|
2708
|
-
const startAttempt = (0,
|
|
2764
|
+
const startAttempt = (0, import_react21.useCallback)(async () => {
|
|
2709
2765
|
if (!poolId || !walletAddress) throw new Error("Not ready");
|
|
2710
2766
|
setError(null);
|
|
2711
2767
|
try {
|
|
@@ -2717,7 +2773,7 @@ function useArcadeGame(poolId, maxLives = 3) {
|
|
|
2717
2773
|
throw e;
|
|
2718
2774
|
}
|
|
2719
2775
|
}, [client, poolId, walletAddress]);
|
|
2720
|
-
const submitScore = (0,
|
|
2776
|
+
const submitScore = (0, import_react21.useCallback)(async (sessionToken, score, durationMs) => {
|
|
2721
2777
|
if (!poolId || !walletAddress) throw new Error("Not ready");
|
|
2722
2778
|
setError(null);
|
|
2723
2779
|
try {
|
|
@@ -2754,19 +2810,19 @@ function useArcadeGame(poolId, maxLives = 3) {
|
|
|
2754
2810
|
}
|
|
2755
2811
|
|
|
2756
2812
|
// src/hooks/useEnterArcadePool.ts
|
|
2757
|
-
var
|
|
2813
|
+
var import_react22 = require("react");
|
|
2758
2814
|
function useEnterArcadePool() {
|
|
2759
2815
|
const { client, wallet, connection } = useDubs();
|
|
2760
2816
|
const { user } = useAuth();
|
|
2761
|
-
const [status, setStatus] = (0,
|
|
2762
|
-
const [error, setError] = (0,
|
|
2763
|
-
const [data, setData] = (0,
|
|
2764
|
-
const reset = (0,
|
|
2817
|
+
const [status, setStatus] = (0, import_react22.useState)("idle");
|
|
2818
|
+
const [error, setError] = (0, import_react22.useState)(null);
|
|
2819
|
+
const [data, setData] = (0, import_react22.useState)(null);
|
|
2820
|
+
const reset = (0, import_react22.useCallback)(() => {
|
|
2765
2821
|
setStatus("idle");
|
|
2766
2822
|
setError(null);
|
|
2767
2823
|
setData(null);
|
|
2768
2824
|
}, []);
|
|
2769
|
-
const execute = (0,
|
|
2825
|
+
const execute = (0, import_react22.useCallback)(async (poolId) => {
|
|
2770
2826
|
if (!wallet.publicKey) throw new Error("Wallet not connected");
|
|
2771
2827
|
const walletAddress = wallet.publicKey.toBase58();
|
|
2772
2828
|
setStatus("building");
|
|
@@ -2814,7 +2870,7 @@ function useEnterArcadePool() {
|
|
|
2814
2870
|
}
|
|
2815
2871
|
|
|
2816
2872
|
// src/hooks/useArcadeCountdown.ts
|
|
2817
|
-
var
|
|
2873
|
+
var import_react23 = require("react");
|
|
2818
2874
|
function formatCountdown(ms) {
|
|
2819
2875
|
if (ms <= 0) return "Ended";
|
|
2820
2876
|
const s2 = Math.floor(ms / 1e3);
|
|
@@ -2827,9 +2883,9 @@ function formatCountdown(ms) {
|
|
|
2827
2883
|
return `${s2}s`;
|
|
2828
2884
|
}
|
|
2829
2885
|
function useArcadeCountdown(nextResolution) {
|
|
2830
|
-
const [now, setNow] = (0,
|
|
2831
|
-
const intervalRef = (0,
|
|
2832
|
-
(0,
|
|
2886
|
+
const [now, setNow] = (0, import_react23.useState)(Date.now());
|
|
2887
|
+
const intervalRef = (0, import_react23.useRef)(null);
|
|
2888
|
+
(0, import_react23.useEffect)(() => {
|
|
2833
2889
|
if (!nextResolution) return;
|
|
2834
2890
|
intervalRef.current = setInterval(() => setNow(Date.now()), 1e3);
|
|
2835
2891
|
return () => {
|
|
@@ -2858,7 +2914,7 @@ function useArcadeCountdown(nextResolution) {
|
|
|
2858
2914
|
}
|
|
2859
2915
|
|
|
2860
2916
|
// src/hooks/useArcadeBridge.ts
|
|
2861
|
-
var
|
|
2917
|
+
var import_react24 = require("react");
|
|
2862
2918
|
var PROTOCOL_VERSION = "1.0";
|
|
2863
2919
|
function useArcadeBridge({
|
|
2864
2920
|
canPlay,
|
|
@@ -2868,14 +2924,14 @@ function useArcadeBridge({
|
|
|
2868
2924
|
onScoreSubmitted,
|
|
2869
2925
|
onError
|
|
2870
2926
|
}) {
|
|
2871
|
-
const webviewRef = (0,
|
|
2872
|
-
const sessionTokenRef = (0,
|
|
2873
|
-
const gameStartTimeRef = (0,
|
|
2874
|
-
const canPlayRef = (0,
|
|
2927
|
+
const webviewRef = (0, import_react24.useRef)(null);
|
|
2928
|
+
const sessionTokenRef = (0, import_react24.useRef)(null);
|
|
2929
|
+
const gameStartTimeRef = (0, import_react24.useRef)(0);
|
|
2930
|
+
const canPlayRef = (0, import_react24.useRef)(canPlay);
|
|
2875
2931
|
canPlayRef.current = canPlay;
|
|
2876
|
-
const [lastResult, setLastResult] = (0,
|
|
2877
|
-
const [bridgeLoading, setBridgeLoading] = (0,
|
|
2878
|
-
const injectSession = (0,
|
|
2932
|
+
const [lastResult, setLastResult] = (0, import_react24.useState)(null);
|
|
2933
|
+
const [bridgeLoading, setBridgeLoading] = (0, import_react24.useState)(false);
|
|
2934
|
+
const injectSession = (0, import_react24.useCallback)((token, attemptNumber) => {
|
|
2879
2935
|
webviewRef.current?.injectJavaScript(`
|
|
2880
2936
|
window.ARCADE_SESSION_TOKEN = ${JSON.stringify(token)};
|
|
2881
2937
|
window.ARCADE_ATTEMPT_NUMBER = ${attemptNumber};
|
|
@@ -2884,7 +2940,7 @@ function useArcadeBridge({
|
|
|
2884
2940
|
true;
|
|
2885
2941
|
`);
|
|
2886
2942
|
}, []);
|
|
2887
|
-
const triggerPlay = (0,
|
|
2943
|
+
const triggerPlay = (0, import_react24.useCallback)(async () => {
|
|
2888
2944
|
if (!canPlay) return;
|
|
2889
2945
|
setBridgeLoading(true);
|
|
2890
2946
|
try {
|
|
@@ -2901,7 +2957,7 @@ function useArcadeBridge({
|
|
|
2901
2957
|
setBridgeLoading(false);
|
|
2902
2958
|
}
|
|
2903
2959
|
}, [canPlay, startAttempt, injectSession, onPlayStarted, onError]);
|
|
2904
|
-
const handleMessage = (0,
|
|
2960
|
+
const handleMessage = (0, import_react24.useCallback)(
|
|
2905
2961
|
async (event) => {
|
|
2906
2962
|
let data;
|
|
2907
2963
|
try {
|
|
@@ -3107,11 +3163,11 @@ function AuthGate({
|
|
|
3107
3163
|
}) {
|
|
3108
3164
|
const { client, pushEnabled } = useDubs();
|
|
3109
3165
|
const auth = useAuth();
|
|
3110
|
-
const [phase, setPhase] = (0,
|
|
3111
|
-
const [registrationPhase, setRegistrationPhase] = (0,
|
|
3112
|
-
const [showPushSetup, setShowPushSetup] = (0,
|
|
3113
|
-
const [isRestoredSession, setIsRestoredSession] = (0,
|
|
3114
|
-
(0,
|
|
3166
|
+
const [phase, setPhase] = (0, import_react25.useState)("init");
|
|
3167
|
+
const [registrationPhase, setRegistrationPhase] = (0, import_react25.useState)(false);
|
|
3168
|
+
const [showPushSetup, setShowPushSetup] = (0, import_react25.useState)(false);
|
|
3169
|
+
const [isRestoredSession, setIsRestoredSession] = (0, import_react25.useState)(false);
|
|
3170
|
+
(0, import_react25.useEffect)(() => {
|
|
3115
3171
|
let cancelled = false;
|
|
3116
3172
|
(async () => {
|
|
3117
3173
|
try {
|
|
@@ -3138,23 +3194,23 @@ function AuthGate({
|
|
|
3138
3194
|
cancelled = true;
|
|
3139
3195
|
};
|
|
3140
3196
|
}, []);
|
|
3141
|
-
(0,
|
|
3197
|
+
(0, import_react25.useEffect)(() => {
|
|
3142
3198
|
if (auth.status === "needsRegistration") setRegistrationPhase(true);
|
|
3143
3199
|
}, [auth.status]);
|
|
3144
|
-
(0,
|
|
3200
|
+
(0, import_react25.useEffect)(() => {
|
|
3145
3201
|
if (pushEnabled && auth.status === "authenticated" && registrationPhase && !isRestoredSession) {
|
|
3146
3202
|
setShowPushSetup(true);
|
|
3147
3203
|
}
|
|
3148
3204
|
}, [pushEnabled, auth.status, registrationPhase, isRestoredSession]);
|
|
3149
|
-
(0,
|
|
3205
|
+
(0, import_react25.useEffect)(() => {
|
|
3150
3206
|
if (auth.token) onSaveToken(auth.token);
|
|
3151
3207
|
}, [auth.token]);
|
|
3152
|
-
const retry = (0,
|
|
3208
|
+
const retry = (0, import_react25.useCallback)(() => {
|
|
3153
3209
|
setRegistrationPhase(false);
|
|
3154
3210
|
auth.reset();
|
|
3155
3211
|
auth.authenticate();
|
|
3156
3212
|
}, [auth]);
|
|
3157
|
-
const handleRegister = (0,
|
|
3213
|
+
const handleRegister = (0, import_react25.useCallback)(
|
|
3158
3214
|
(username, referralCode, avatarUrl) => {
|
|
3159
3215
|
auth.register(username, referralCode, avatarUrl);
|
|
3160
3216
|
},
|
|
@@ -3254,7 +3310,7 @@ function DefaultErrorScreen({ error, onRetry, appName, accentColor }) {
|
|
|
3254
3310
|
function StepIndicator({ currentStep }) {
|
|
3255
3311
|
const t = useDubsTheme();
|
|
3256
3312
|
const steps = [0, 1, 2, 3];
|
|
3257
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native8.View, { style: s.stepRow, children: steps.map((i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
3313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native8.View, { style: s.stepRow, children: steps.map((i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react25.default.Fragment, { children: [
|
|
3258
3314
|
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native8.View, { style: [s.stepLine, { backgroundColor: i <= currentStep ? t.success : t.border }] }),
|
|
3259
3315
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
3260
3316
|
import_react_native8.View,
|
|
@@ -3278,20 +3334,20 @@ function DefaultRegistrationScreen({
|
|
|
3278
3334
|
}) {
|
|
3279
3335
|
const t = useDubsTheme();
|
|
3280
3336
|
const accent = accentColor || t.accent;
|
|
3281
|
-
const [step, setStep] = (0,
|
|
3282
|
-
const [avatarSeed, setAvatarSeed] = (0,
|
|
3283
|
-
const [avatarStyle, setAvatarStyle] = (0,
|
|
3284
|
-
const [avatarBg, setAvatarBg] = (0,
|
|
3285
|
-
const [showStyles, setShowStyles] = (0,
|
|
3286
|
-
const [username, setUsername] = (0,
|
|
3287
|
-
const [referralCode, setReferralCode] = (0,
|
|
3288
|
-
const [checking, setChecking] = (0,
|
|
3289
|
-
const [availability, setAvailability] = (0,
|
|
3290
|
-
const debounceRef = (0,
|
|
3291
|
-
const fadeAnim = (0,
|
|
3292
|
-
const slideAnim = (0,
|
|
3337
|
+
const [step, setStep] = (0, import_react25.useState)(0);
|
|
3338
|
+
const [avatarSeed, setAvatarSeed] = (0, import_react25.useState)(generateSeed);
|
|
3339
|
+
const [avatarStyle, setAvatarStyle] = (0, import_react25.useState)("adventurer");
|
|
3340
|
+
const [avatarBg, setAvatarBg] = (0, import_react25.useState)("1a1a2e");
|
|
3341
|
+
const [showStyles, setShowStyles] = (0, import_react25.useState)(false);
|
|
3342
|
+
const [username, setUsername] = (0, import_react25.useState)("");
|
|
3343
|
+
const [referralCode, setReferralCode] = (0, import_react25.useState)("");
|
|
3344
|
+
const [checking, setChecking] = (0, import_react25.useState)(false);
|
|
3345
|
+
const [availability, setAvailability] = (0, import_react25.useState)(null);
|
|
3346
|
+
const debounceRef = (0, import_react25.useRef)(null);
|
|
3347
|
+
const fadeAnim = (0, import_react25.useRef)(new import_react_native8.Animated.Value(1)).current;
|
|
3348
|
+
const slideAnim = (0, import_react25.useRef)(new import_react_native8.Animated.Value(0)).current;
|
|
3293
3349
|
const avatarUrl = getAvatarUrl(avatarStyle, avatarSeed, avatarBg);
|
|
3294
|
-
(0,
|
|
3350
|
+
(0, import_react25.useEffect)(() => {
|
|
3295
3351
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
3296
3352
|
const trimmed = username.trim();
|
|
3297
3353
|
if (trimmed.length < 3) {
|
|
@@ -3314,7 +3370,7 @@ function DefaultRegistrationScreen({
|
|
|
3314
3370
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
3315
3371
|
};
|
|
3316
3372
|
}, [username, client]);
|
|
3317
|
-
const animateToStep = (0,
|
|
3373
|
+
const animateToStep = (0, import_react25.useCallback)((newStep) => {
|
|
3318
3374
|
const dir = newStep > step ? 1 : -1;
|
|
3319
3375
|
import_react_native8.Keyboard.dismiss();
|
|
3320
3376
|
import_react_native8.Animated.parallel([
|
|
@@ -3553,8 +3609,8 @@ function DefaultRegistrationScreen({
|
|
|
3553
3609
|
}
|
|
3554
3610
|
function PushTokenRestorer() {
|
|
3555
3611
|
const push = usePushNotifications();
|
|
3556
|
-
const restored = (0,
|
|
3557
|
-
(0,
|
|
3612
|
+
const restored = (0, import_react25.useRef)(false);
|
|
3613
|
+
(0, import_react25.useEffect)(() => {
|
|
3558
3614
|
if (restored.current) return;
|
|
3559
3615
|
restored.current = true;
|
|
3560
3616
|
push.restoreIfGranted();
|
|
@@ -3569,9 +3625,9 @@ function PushSetupScreen({
|
|
|
3569
3625
|
const t = useDubsTheme();
|
|
3570
3626
|
const accent = accentColor || t.accent;
|
|
3571
3627
|
const push = usePushNotifications();
|
|
3572
|
-
const fadeAnim = (0,
|
|
3573
|
-
const slideAnim = (0,
|
|
3574
|
-
(0,
|
|
3628
|
+
const fadeAnim = (0, import_react25.useRef)(new import_react_native8.Animated.Value(0)).current;
|
|
3629
|
+
const slideAnim = (0, import_react25.useRef)(new import_react_native8.Animated.Value(30)).current;
|
|
3630
|
+
(0, import_react25.useEffect)(() => {
|
|
3575
3631
|
import_react_native8.Animated.parallel([
|
|
3576
3632
|
import_react_native8.Animated.timing(fadeAnim, { toValue: 1, duration: 300, useNativeDriver: true }),
|
|
3577
3633
|
import_react_native8.Animated.timing(slideAnim, { toValue: 0, duration: 300, useNativeDriver: true })
|
|
@@ -3707,7 +3763,7 @@ var s = import_react_native8.StyleSheet.create({
|
|
|
3707
3763
|
|
|
3708
3764
|
// src/provider.tsx
|
|
3709
3765
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
3710
|
-
var DubsContext = (0,
|
|
3766
|
+
var DubsContext = (0, import_react26.createContext)(null);
|
|
3711
3767
|
function DubsProvider({
|
|
3712
3768
|
apiKey,
|
|
3713
3769
|
children,
|
|
@@ -3729,11 +3785,11 @@ function DubsProvider({
|
|
|
3729
3785
|
const config = NETWORK_CONFIG[network];
|
|
3730
3786
|
const baseUrl = baseUrlOverride || config.baseUrl;
|
|
3731
3787
|
const rpcUrl = rpcUrlOverride || config.rpcUrl;
|
|
3732
|
-
const client = (0,
|
|
3733
|
-
const storage = (0,
|
|
3734
|
-
const [uiConfig, setUiConfig] = (0,
|
|
3735
|
-
const [resolvedNetwork, setResolvedNetwork] = (0,
|
|
3736
|
-
(0,
|
|
3788
|
+
const client = (0, import_react26.useMemo)(() => new DubsClient({ apiKey, baseUrl }), [apiKey, baseUrl]);
|
|
3789
|
+
const storage = (0, import_react26.useMemo)(() => tokenStorage || createSecureStoreStorage(), [tokenStorage]);
|
|
3790
|
+
const [uiConfig, setUiConfig] = (0, import_react26.useState)(null);
|
|
3791
|
+
const [resolvedNetwork, setResolvedNetwork] = (0, import_react26.useState)(network);
|
|
3792
|
+
(0, import_react26.useEffect)(() => {
|
|
3737
3793
|
client.getAppConfig().then((cfg) => {
|
|
3738
3794
|
console.log("[DubsProvider] UI config loaded:", JSON.stringify(cfg));
|
|
3739
3795
|
setUiConfig(cfg);
|
|
@@ -3749,7 +3805,7 @@ function DubsProvider({
|
|
|
3749
3805
|
const resolvedConfig = NETWORK_CONFIG[resolvedNetwork];
|
|
3750
3806
|
const resolvedRpcUrl = rpcUrlOverride || resolvedConfig.rpcUrl;
|
|
3751
3807
|
const cluster = resolvedConfig.cluster;
|
|
3752
|
-
const connection = (0,
|
|
3808
|
+
const connection = (0, import_react26.useMemo)(() => new import_web34.Connection(resolvedRpcUrl, { commitment: "confirmed" }), [resolvedRpcUrl]);
|
|
3753
3809
|
if (uiConfig === null) return null;
|
|
3754
3810
|
const themeOverrides = {};
|
|
3755
3811
|
if (uiConfig.accentColor) {
|
|
@@ -3825,11 +3881,11 @@ function ManagedInner({
|
|
|
3825
3881
|
children
|
|
3826
3882
|
}) {
|
|
3827
3883
|
const managedDisconnect = useDisconnect();
|
|
3828
|
-
const disconnect = (0,
|
|
3884
|
+
const disconnect = (0, import_react26.useCallback)(async () => {
|
|
3829
3885
|
client.setToken(null);
|
|
3830
3886
|
await managedDisconnect?.();
|
|
3831
3887
|
}, [client, managedDisconnect]);
|
|
3832
|
-
const value = (0,
|
|
3888
|
+
const value = (0, import_react26.useMemo)(
|
|
3833
3889
|
() => ({ client, wallet, connection, appName, network, disconnect, uiConfig, pushEnabled }),
|
|
3834
3890
|
[client, wallet, connection, appName, network, disconnect, uiConfig, pushEnabled]
|
|
3835
3891
|
);
|
|
@@ -3866,13 +3922,13 @@ function ExternalWalletProvider({
|
|
|
3866
3922
|
pushEnabled,
|
|
3867
3923
|
children
|
|
3868
3924
|
}) {
|
|
3869
|
-
const disconnect = (0,
|
|
3925
|
+
const disconnect = (0, import_react26.useCallback)(async () => {
|
|
3870
3926
|
client.setToken(null);
|
|
3871
3927
|
await storage.deleteItem(STORAGE_KEYS.JWT_TOKEN).catch(() => {
|
|
3872
3928
|
});
|
|
3873
3929
|
await wallet.disconnect?.();
|
|
3874
3930
|
}, [client, storage, wallet]);
|
|
3875
|
-
const value = (0,
|
|
3931
|
+
const value = (0, import_react26.useMemo)(
|
|
3876
3932
|
() => ({ client, wallet, connection, appName, network, disconnect, uiConfig, pushEnabled }),
|
|
3877
3933
|
[client, wallet, connection, appName, network, disconnect, uiConfig, pushEnabled]
|
|
3878
3934
|
);
|
|
@@ -3897,14 +3953,14 @@ function ExternalWalletProvider({
|
|
|
3897
3953
|
) });
|
|
3898
3954
|
}
|
|
3899
3955
|
function useDubs() {
|
|
3900
|
-
const ctx = (0,
|
|
3956
|
+
const ctx = (0, import_react26.useContext)(DubsContext);
|
|
3901
3957
|
if (!ctx) {
|
|
3902
3958
|
throw new Error("useDubs must be used within a <DubsProvider>");
|
|
3903
3959
|
}
|
|
3904
3960
|
return ctx;
|
|
3905
3961
|
}
|
|
3906
3962
|
function useAppConfig() {
|
|
3907
|
-
const ctx = (0,
|
|
3963
|
+
const ctx = (0, import_react26.useContext)(DubsContext);
|
|
3908
3964
|
return ctx?.uiConfig || {};
|
|
3909
3965
|
}
|
|
3910
3966
|
|
|
@@ -3962,7 +4018,7 @@ var styles3 = import_react_native9.StyleSheet.create({
|
|
|
3962
4018
|
});
|
|
3963
4019
|
|
|
3964
4020
|
// src/ui/UserProfileCard.tsx
|
|
3965
|
-
var
|
|
4021
|
+
var import_react27 = require("react");
|
|
3966
4022
|
var import_react_native10 = require("react-native");
|
|
3967
4023
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
3968
4024
|
function truncateAddress(address, chars = 4) {
|
|
@@ -3982,7 +4038,7 @@ function UserProfileCard({
|
|
|
3982
4038
|
memberSince
|
|
3983
4039
|
}) {
|
|
3984
4040
|
const t = useDubsTheme();
|
|
3985
|
-
const imageUri = (0,
|
|
4041
|
+
const imageUri = (0, import_react27.useMemo)(
|
|
3986
4042
|
() => ensurePngAvatar(avatarUrl) || `https://api.dicebear.com/9.x/avataaars/png?seed=${walletAddress}&size=128`,
|
|
3987
4043
|
[avatarUrl, walletAddress]
|
|
3988
4044
|
);
|
|
@@ -4175,7 +4231,7 @@ var styles5 = import_react_native11.StyleSheet.create({
|
|
|
4175
4231
|
});
|
|
4176
4232
|
|
|
4177
4233
|
// src/ui/UserProfileSheet.tsx
|
|
4178
|
-
var
|
|
4234
|
+
var import_react28 = require("react");
|
|
4179
4235
|
var import_react_native12 = require("react-native");
|
|
4180
4236
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
4181
4237
|
function truncateAddress3(address, chars = 4) {
|
|
@@ -4193,31 +4249,31 @@ function UserProfileSheet({
|
|
|
4193
4249
|
const { client } = useDubs();
|
|
4194
4250
|
const { refreshUser } = useAuth();
|
|
4195
4251
|
const push = usePushNotifications();
|
|
4196
|
-
const overlayOpacity = (0,
|
|
4197
|
-
const parsed = (0,
|
|
4198
|
-
const [avatarStyle, setAvatarStyle] = (0,
|
|
4199
|
-
const [avatarSeed, setAvatarSeed] = (0,
|
|
4200
|
-
const [bgColor, setBgColor] = (0,
|
|
4201
|
-
const [saving, setSaving] = (0,
|
|
4202
|
-
const [error, setError] = (0,
|
|
4203
|
-
(0,
|
|
4252
|
+
const overlayOpacity = (0, import_react28.useRef)(new import_react_native12.Animated.Value(0)).current;
|
|
4253
|
+
const parsed = (0, import_react28.useMemo)(() => parseAvatarUrl(user.avatar), [user.avatar]);
|
|
4254
|
+
const [avatarStyle, setAvatarStyle] = (0, import_react28.useState)(parsed.style);
|
|
4255
|
+
const [avatarSeed, setAvatarSeed] = (0, import_react28.useState)(parsed.seed);
|
|
4256
|
+
const [bgColor, setBgColor] = (0, import_react28.useState)(parsed.bg);
|
|
4257
|
+
const [saving, setSaving] = (0, import_react28.useState)(false);
|
|
4258
|
+
const [error, setError] = (0, import_react28.useState)(null);
|
|
4259
|
+
(0, import_react28.useEffect)(() => {
|
|
4204
4260
|
const p = parseAvatarUrl(user.avatar);
|
|
4205
4261
|
setAvatarStyle(p.style);
|
|
4206
4262
|
setAvatarSeed(p.seed);
|
|
4207
4263
|
setBgColor(p.bg);
|
|
4208
4264
|
}, [user.avatar]);
|
|
4209
|
-
(0,
|
|
4265
|
+
(0, import_react28.useEffect)(() => {
|
|
4210
4266
|
import_react_native12.Animated.timing(overlayOpacity, {
|
|
4211
4267
|
toValue: visible ? 1 : 0,
|
|
4212
4268
|
duration: 250,
|
|
4213
4269
|
useNativeDriver: true
|
|
4214
4270
|
}).start();
|
|
4215
4271
|
}, [visible, overlayOpacity]);
|
|
4216
|
-
(0,
|
|
4272
|
+
(0, import_react28.useEffect)(() => {
|
|
4217
4273
|
if (visible) setError(null);
|
|
4218
4274
|
}, [visible]);
|
|
4219
4275
|
const currentAvatarUrl = getAvatarUrl(avatarStyle, avatarSeed, bgColor);
|
|
4220
|
-
const saveAvatar = (0,
|
|
4276
|
+
const saveAvatar = (0, import_react28.useCallback)(async (newUrl) => {
|
|
4221
4277
|
setSaving(true);
|
|
4222
4278
|
setError(null);
|
|
4223
4279
|
try {
|
|
@@ -4230,16 +4286,16 @@ function UserProfileSheet({
|
|
|
4230
4286
|
setSaving(false);
|
|
4231
4287
|
}
|
|
4232
4288
|
}, [client, refreshUser, onAvatarUpdated]);
|
|
4233
|
-
const handleStyleChange = (0,
|
|
4289
|
+
const handleStyleChange = (0, import_react28.useCallback)((style) => {
|
|
4234
4290
|
setAvatarStyle(style);
|
|
4235
4291
|
saveAvatar(getAvatarUrl(style, avatarSeed, bgColor));
|
|
4236
4292
|
}, [avatarSeed, bgColor, saveAvatar]);
|
|
4237
|
-
const handleShuffle = (0,
|
|
4293
|
+
const handleShuffle = (0, import_react28.useCallback)(() => {
|
|
4238
4294
|
const newSeed = generateSeed();
|
|
4239
4295
|
setAvatarSeed(newSeed);
|
|
4240
4296
|
saveAvatar(getAvatarUrl(avatarStyle, newSeed, bgColor));
|
|
4241
4297
|
}, [avatarStyle, bgColor, saveAvatar]);
|
|
4242
|
-
const handleBgChange = (0,
|
|
4298
|
+
const handleBgChange = (0, import_react28.useCallback)((color) => {
|
|
4243
4299
|
setBgColor(color);
|
|
4244
4300
|
saveAvatar(getAvatarUrl(avatarStyle, avatarSeed, color));
|
|
4245
4301
|
}, [avatarStyle, avatarSeed, saveAvatar]);
|
|
@@ -4519,7 +4575,7 @@ var styles6 = import_react_native12.StyleSheet.create({
|
|
|
4519
4575
|
});
|
|
4520
4576
|
|
|
4521
4577
|
// src/ui/game/GamePoster.tsx
|
|
4522
|
-
var
|
|
4578
|
+
var import_react29 = require("react");
|
|
4523
4579
|
var import_react_native13 = require("react-native");
|
|
4524
4580
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
4525
4581
|
function computeCountdown(lockTimestamp) {
|
|
@@ -4569,7 +4625,7 @@ function GamePoster({ game, ImageComponent }) {
|
|
|
4569
4625
|
] });
|
|
4570
4626
|
}
|
|
4571
4627
|
function TeamLogoInternal({ url, size, Img }) {
|
|
4572
|
-
const [failed, setFailed] = (0,
|
|
4628
|
+
const [failed, setFailed] = (0, import_react29.useState)(false);
|
|
4573
4629
|
if (!url || failed) {
|
|
4574
4630
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native13.View, { style: [styles7.logoPlaceholder, { width: size, height: size, borderRadius: size / 2 }] });
|
|
4575
4631
|
}
|
|
@@ -4670,7 +4726,7 @@ var styles7 = import_react_native13.StyleSheet.create({
|
|
|
4670
4726
|
});
|
|
4671
4727
|
|
|
4672
4728
|
// src/ui/game/LivePoolsCard.tsx
|
|
4673
|
-
var
|
|
4729
|
+
var import_react30 = require("react");
|
|
4674
4730
|
var import_react_native14 = require("react-native");
|
|
4675
4731
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
4676
4732
|
function LivePoolsCard({
|
|
@@ -4686,7 +4742,7 @@ function LivePoolsCard({
|
|
|
4686
4742
|
const homePool = game.homePool || 0;
|
|
4687
4743
|
const awayPool = game.awayPool || 0;
|
|
4688
4744
|
const totalPool = game.totalPool || 0;
|
|
4689
|
-
const { homePercent, awayPercent, homeOdds, awayOdds } = (0,
|
|
4745
|
+
const { homePercent, awayPercent, homeOdds, awayOdds } = (0, import_react30.useMemo)(() => {
|
|
4690
4746
|
return {
|
|
4691
4747
|
homePercent: totalPool > 0 ? homePool / totalPool * 100 : 50,
|
|
4692
4748
|
awayPercent: totalPool > 0 ? awayPool / totalPool * 100 : 50,
|
|
@@ -4749,7 +4805,7 @@ var styles8 = import_react_native14.StyleSheet.create({
|
|
|
4749
4805
|
});
|
|
4750
4806
|
|
|
4751
4807
|
// src/ui/game/PickWinnerCard.tsx
|
|
4752
|
-
var
|
|
4808
|
+
var import_react31 = require("react");
|
|
4753
4809
|
var import_react_native15 = require("react-native");
|
|
4754
4810
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
4755
4811
|
function PickWinnerCard({
|
|
@@ -4767,7 +4823,7 @@ function PickWinnerCard({
|
|
|
4767
4823
|
const totalPool = game.totalPool || 0;
|
|
4768
4824
|
const homePool = game.homePool || 0;
|
|
4769
4825
|
const awayPool = game.awayPool || 0;
|
|
4770
|
-
const { homeOdds, awayOdds, homeBets, awayBets } = (0,
|
|
4826
|
+
const { homeOdds, awayOdds, homeBets, awayBets } = (0, import_react31.useMemo)(() => ({
|
|
4771
4827
|
homeOdds: homePool > 0 ? (totalPool / homePool).toFixed(2) : "\u2014",
|
|
4772
4828
|
awayOdds: awayPool > 0 ? (totalPool / awayPool).toFixed(2) : "\u2014",
|
|
4773
4829
|
homeBets: bettors.filter((b) => b.team === "home").length,
|
|
@@ -4820,7 +4876,7 @@ function TeamOption({
|
|
|
4820
4876
|
ImageComponent,
|
|
4821
4877
|
t
|
|
4822
4878
|
}) {
|
|
4823
|
-
const [imgFailed, setImgFailed] = (0,
|
|
4879
|
+
const [imgFailed, setImgFailed] = (0, import_react31.useState)(false);
|
|
4824
4880
|
const Img = ImageComponent || require("react-native").Image;
|
|
4825
4881
|
const showImage = imageUrl && !imgFailed;
|
|
4826
4882
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
@@ -4861,7 +4917,7 @@ var styles9 = import_react_native15.StyleSheet.create({
|
|
|
4861
4917
|
});
|
|
4862
4918
|
|
|
4863
4919
|
// src/ui/game/PlayersCard.tsx
|
|
4864
|
-
var
|
|
4920
|
+
var import_react32 = require("react");
|
|
4865
4921
|
var import_react_native16 = require("react-native");
|
|
4866
4922
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
4867
4923
|
function truncateWallet(addr, chars) {
|
|
@@ -4910,7 +4966,7 @@ function BettorRow({
|
|
|
4910
4966
|
ImageComponent,
|
|
4911
4967
|
t
|
|
4912
4968
|
}) {
|
|
4913
|
-
const [imgFailed, setImgFailed] = (0,
|
|
4969
|
+
const [imgFailed, setImgFailed] = (0, import_react32.useState)(false);
|
|
4914
4970
|
const Img = ImageComponent || require("react-native").Image;
|
|
4915
4971
|
const showAvatar = bettor.avatar && !imgFailed;
|
|
4916
4972
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native16.View, { style: [styles10.row, !isFirst && { borderTopColor: t.border, borderTopWidth: 1 }], children: [
|
|
@@ -4937,7 +4993,7 @@ var styles10 = import_react_native16.StyleSheet.create({
|
|
|
4937
4993
|
});
|
|
4938
4994
|
|
|
4939
4995
|
// src/ui/game/JoinGameButton.tsx
|
|
4940
|
-
var
|
|
4996
|
+
var import_react33 = require("react");
|
|
4941
4997
|
var import_react_native17 = require("react-native");
|
|
4942
4998
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
4943
4999
|
var STATUS_LABELS = {
|
|
@@ -4948,7 +5004,7 @@ var STATUS_LABELS = {
|
|
|
4948
5004
|
};
|
|
4949
5005
|
function JoinGameButton({ game, walletAddress, selectedTeam, status, onJoin }) {
|
|
4950
5006
|
const t = useDubsTheme();
|
|
4951
|
-
const alreadyJoined = (0,
|
|
5007
|
+
const alreadyJoined = (0, import_react33.useMemo)(() => {
|
|
4952
5008
|
if (!walletAddress) return false;
|
|
4953
5009
|
return (game.bettors || []).some((b) => b.wallet === walletAddress);
|
|
4954
5010
|
}, [game.bettors, walletAddress]);
|
|
@@ -4989,7 +5045,7 @@ var styles11 = import_react_native17.StyleSheet.create({
|
|
|
4989
5045
|
});
|
|
4990
5046
|
|
|
4991
5047
|
// src/ui/game/CreateCustomGameSheet.tsx
|
|
4992
|
-
var
|
|
5048
|
+
var import_react34 = require("react");
|
|
4993
5049
|
var import_react_native18 = require("react-native");
|
|
4994
5050
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
4995
5051
|
var STATUS_LABELS2 = {
|
|
@@ -5015,18 +5071,18 @@ function CreateCustomGameSheet({
|
|
|
5015
5071
|
const t = useDubsTheme();
|
|
5016
5072
|
const { wallet } = useDubs();
|
|
5017
5073
|
const mutation = useCreateCustomGame();
|
|
5018
|
-
const [selectedAmount, setSelectedAmount] = (0,
|
|
5019
|
-
const [customAmount, setCustomAmount] = (0,
|
|
5020
|
-
const [isCustom, setIsCustom] = (0,
|
|
5021
|
-
const overlayOpacity = (0,
|
|
5022
|
-
(0,
|
|
5074
|
+
const [selectedAmount, setSelectedAmount] = (0, import_react34.useState)(null);
|
|
5075
|
+
const [customAmount, setCustomAmount] = (0, import_react34.useState)("");
|
|
5076
|
+
const [isCustom, setIsCustom] = (0, import_react34.useState)(false);
|
|
5077
|
+
const overlayOpacity = (0, import_react34.useRef)(new import_react_native18.Animated.Value(0)).current;
|
|
5078
|
+
(0, import_react34.useEffect)(() => {
|
|
5023
5079
|
import_react_native18.Animated.timing(overlayOpacity, {
|
|
5024
5080
|
toValue: visible ? 1 : 0,
|
|
5025
5081
|
duration: 250,
|
|
5026
5082
|
useNativeDriver: true
|
|
5027
5083
|
}).start();
|
|
5028
5084
|
}, [visible, overlayOpacity]);
|
|
5029
|
-
(0,
|
|
5085
|
+
(0, import_react34.useEffect)(() => {
|
|
5030
5086
|
if (visible) {
|
|
5031
5087
|
setSelectedAmount(defaultAmount ?? null);
|
|
5032
5088
|
setCustomAmount("");
|
|
@@ -5034,7 +5090,7 @@ function CreateCustomGameSheet({
|
|
|
5034
5090
|
mutation.reset();
|
|
5035
5091
|
}
|
|
5036
5092
|
}, [visible]);
|
|
5037
|
-
(0,
|
|
5093
|
+
(0, import_react34.useEffect)(() => {
|
|
5038
5094
|
if (mutation.status === "success" && mutation.data) {
|
|
5039
5095
|
onSuccess?.(mutation.data);
|
|
5040
5096
|
const timer = setTimeout(() => {
|
|
@@ -5043,23 +5099,23 @@ function CreateCustomGameSheet({
|
|
|
5043
5099
|
return () => clearTimeout(timer);
|
|
5044
5100
|
}
|
|
5045
5101
|
}, [mutation.status, mutation.data]);
|
|
5046
|
-
(0,
|
|
5102
|
+
(0, import_react34.useEffect)(() => {
|
|
5047
5103
|
if (mutation.status === "error" && mutation.error) {
|
|
5048
5104
|
onError?.(mutation.error);
|
|
5049
5105
|
}
|
|
5050
5106
|
}, [mutation.status, mutation.error]);
|
|
5051
|
-
const handlePresetSelect = (0,
|
|
5107
|
+
const handlePresetSelect = (0, import_react34.useCallback)((amount) => {
|
|
5052
5108
|
setSelectedAmount(amount);
|
|
5053
5109
|
setIsCustom(false);
|
|
5054
5110
|
setCustomAmount("");
|
|
5055
5111
|
onAmountChange?.(amount);
|
|
5056
5112
|
}, [onAmountChange]);
|
|
5057
|
-
const handleCustomSelect = (0,
|
|
5113
|
+
const handleCustomSelect = (0, import_react34.useCallback)(() => {
|
|
5058
5114
|
setIsCustom(true);
|
|
5059
5115
|
setSelectedAmount(null);
|
|
5060
5116
|
onAmountChange?.(null);
|
|
5061
5117
|
}, [onAmountChange]);
|
|
5062
|
-
const handleCustomAmountChange = (0,
|
|
5118
|
+
const handleCustomAmountChange = (0, import_react34.useCallback)((text) => {
|
|
5063
5119
|
const cleaned = text.replace(/[^0-9.]/g, "").replace(/(\..*?)\..*/g, "$1");
|
|
5064
5120
|
setCustomAmount(cleaned);
|
|
5065
5121
|
const parsed = parseFloat(cleaned);
|
|
@@ -5074,7 +5130,7 @@ function CreateCustomGameSheet({
|
|
|
5074
5130
|
const winnerTakes = pot * (1 - fee / 100);
|
|
5075
5131
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
5076
5132
|
const canCreate = finalAmount !== null && finalAmount > 0 && !isMutating && mutation.status !== "success";
|
|
5077
|
-
const handleCreate = (0,
|
|
5133
|
+
const handleCreate = (0, import_react34.useCallback)(async () => {
|
|
5078
5134
|
if (!finalAmount || !wallet.publicKey) return;
|
|
5079
5135
|
try {
|
|
5080
5136
|
await mutation.execute({
|
|
@@ -5343,11 +5399,11 @@ var styles12 = import_react_native18.StyleSheet.create({
|
|
|
5343
5399
|
});
|
|
5344
5400
|
|
|
5345
5401
|
// src/ui/game/JoinGameSheet.tsx
|
|
5346
|
-
var
|
|
5402
|
+
var import_react37 = require("react");
|
|
5347
5403
|
var import_react_native21 = require("react-native");
|
|
5348
5404
|
|
|
5349
5405
|
// src/ui/game/SolSlider.tsx
|
|
5350
|
-
var
|
|
5406
|
+
var import_react35 = require("react");
|
|
5351
5407
|
var import_react_native19 = require("react-native");
|
|
5352
5408
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
5353
5409
|
var THUMB_SIZE = 32;
|
|
@@ -5366,9 +5422,9 @@ function SolSlider({
|
|
|
5366
5422
|
}) {
|
|
5367
5423
|
const t = useDubsTheme();
|
|
5368
5424
|
const accent = accentColor || t.accent;
|
|
5369
|
-
const trackRef = (0,
|
|
5370
|
-
const trackWidth = (0,
|
|
5371
|
-
const lastTickValue = (0,
|
|
5425
|
+
const trackRef = (0, import_react35.useRef)(null);
|
|
5426
|
+
const trackWidth = (0, import_react35.useRef)(0);
|
|
5427
|
+
const lastTickValue = (0, import_react35.useRef)(value);
|
|
5372
5428
|
const clamp = (v) => {
|
|
5373
5429
|
const stepped = Math.round(v / step) * step;
|
|
5374
5430
|
return Math.max(min, Math.min(max, parseFloat(stepped.toFixed(4))));
|
|
@@ -5381,7 +5437,7 @@ function SolSlider({
|
|
|
5381
5437
|
const ratio2 = Math.max(0, Math.min(1, x / trackWidth.current));
|
|
5382
5438
|
return clamp(min + ratio2 * (max - min));
|
|
5383
5439
|
};
|
|
5384
|
-
const panResponder = (0,
|
|
5440
|
+
const panResponder = (0, import_react35.useRef)(
|
|
5385
5441
|
import_react_native19.PanResponder.create({
|
|
5386
5442
|
onStartShouldSetPanResponder: () => !disabled,
|
|
5387
5443
|
onMoveShouldSetPanResponder: () => !disabled,
|
|
@@ -5536,7 +5592,7 @@ var styles13 = import_react_native19.StyleSheet.create({
|
|
|
5536
5592
|
});
|
|
5537
5593
|
|
|
5538
5594
|
// src/ui/game/TeamButton.tsx
|
|
5539
|
-
var
|
|
5595
|
+
var import_react36 = require("react");
|
|
5540
5596
|
var import_react_native20 = require("react-native");
|
|
5541
5597
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
5542
5598
|
function TeamButton({
|
|
@@ -5550,7 +5606,7 @@ function TeamButton({
|
|
|
5550
5606
|
ImageComponent,
|
|
5551
5607
|
t
|
|
5552
5608
|
}) {
|
|
5553
|
-
const [imgFailed, setImgFailed] = (0,
|
|
5609
|
+
const [imgFailed, setImgFailed] = (0, import_react36.useState)(false);
|
|
5554
5610
|
const Img = ImageComponent || require("react-native").Image;
|
|
5555
5611
|
const showImage = imageUrl && !imgFailed;
|
|
5556
5612
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
@@ -5641,6 +5697,7 @@ function JoinGameSheet({
|
|
|
5641
5697
|
shortName,
|
|
5642
5698
|
homeColor = "#3B82F6",
|
|
5643
5699
|
awayColor = "#EF4444",
|
|
5700
|
+
drawColor = "#F59E0B",
|
|
5644
5701
|
onSuccess,
|
|
5645
5702
|
onError,
|
|
5646
5703
|
onTeamSelect,
|
|
@@ -5653,20 +5710,20 @@ function JoinGameSheet({
|
|
|
5653
5710
|
const { wallet } = useDubs();
|
|
5654
5711
|
const mutation = useJoinGame();
|
|
5655
5712
|
const isCustomGame = game.gameMode === CUSTOM_GAME_MODE;
|
|
5656
|
-
const [selectedTeam, setSelectedTeam] = (0,
|
|
5657
|
-
const [wager, setWager] = (0,
|
|
5658
|
-
const [showSuccess, setShowSuccess] = (0,
|
|
5659
|
-
const overlayOpacity = (0,
|
|
5660
|
-
const successScale = (0,
|
|
5661
|
-
const successOpacity = (0,
|
|
5662
|
-
(0,
|
|
5713
|
+
const [selectedTeam, setSelectedTeam] = (0, import_react37.useState)(null);
|
|
5714
|
+
const [wager, setWager] = (0, import_react37.useState)(game.buyIn);
|
|
5715
|
+
const [showSuccess, setShowSuccess] = (0, import_react37.useState)(false);
|
|
5716
|
+
const overlayOpacity = (0, import_react37.useRef)(new import_react_native21.Animated.Value(0)).current;
|
|
5717
|
+
const successScale = (0, import_react37.useRef)(new import_react_native21.Animated.Value(0)).current;
|
|
5718
|
+
const successOpacity = (0, import_react37.useRef)(new import_react_native21.Animated.Value(0)).current;
|
|
5719
|
+
(0, import_react37.useEffect)(() => {
|
|
5663
5720
|
import_react_native21.Animated.timing(overlayOpacity, {
|
|
5664
5721
|
toValue: visible ? 1 : 0,
|
|
5665
5722
|
duration: 250,
|
|
5666
5723
|
useNativeDriver: true
|
|
5667
5724
|
}).start();
|
|
5668
5725
|
}, [visible, overlayOpacity]);
|
|
5669
|
-
(0,
|
|
5726
|
+
(0, import_react37.useEffect)(() => {
|
|
5670
5727
|
if (visible) {
|
|
5671
5728
|
setSelectedTeam(isPoolModeEnabled ? "home" : isCustomGame ? "away" : null);
|
|
5672
5729
|
setWager(game.buyIn);
|
|
@@ -5676,7 +5733,7 @@ function JoinGameSheet({
|
|
|
5676
5733
|
mutation.reset();
|
|
5677
5734
|
}
|
|
5678
5735
|
}, [visible]);
|
|
5679
|
-
(0,
|
|
5736
|
+
(0, import_react37.useEffect)(() => {
|
|
5680
5737
|
if (mutation.status === "success" && mutation.data) {
|
|
5681
5738
|
setShowSuccess(true);
|
|
5682
5739
|
onSuccess?.(mutation.data);
|
|
@@ -5693,7 +5750,7 @@ function JoinGameSheet({
|
|
|
5693
5750
|
return () => clearTimeout(timer);
|
|
5694
5751
|
}
|
|
5695
5752
|
}, [mutation.status, mutation.data]);
|
|
5696
|
-
(0,
|
|
5753
|
+
(0, import_react37.useEffect)(() => {
|
|
5697
5754
|
if (mutation.status === "error" && mutation.error) {
|
|
5698
5755
|
onError?.(mutation.error);
|
|
5699
5756
|
}
|
|
@@ -5703,22 +5760,33 @@ function JoinGameSheet({
|
|
|
5703
5760
|
const totalPool = game.totalPool || 0;
|
|
5704
5761
|
const homePool = game.homePool || 0;
|
|
5705
5762
|
const awayPool = game.awayPool || 0;
|
|
5763
|
+
const drawPool = game.drawPool || 0;
|
|
5706
5764
|
const buyIn = game.buyIn;
|
|
5765
|
+
const drawBettors = bettors.filter((b) => b.team === "draw");
|
|
5766
|
+
const hasDrawOption = drawPool > 0 || drawBettors.length > 0 || game.league && ["English Premier League", "EPL", "MLS", "La Liga", "Serie A", "Bundesliga", "Ligue 1"].some((l) => (game.league || "").includes(l));
|
|
5707
5767
|
const poolAfterJoin = totalPool + wager;
|
|
5708
|
-
const { homeOdds, awayOdds, homeBets, awayBets } = (0,
|
|
5768
|
+
const { homeOdds, awayOdds, drawOdds, homeBets, awayBets, drawBets } = (0, import_react37.useMemo)(() => {
|
|
5769
|
+
const homeBetsCount = bettors.filter((b) => b.team === "home").length;
|
|
5770
|
+
const awayBetsCount = bettors.filter((b) => b.team === "away").length;
|
|
5771
|
+
const drawBetsCount = bettors.filter((b) => b.team === "draw").length;
|
|
5709
5772
|
const newPool = totalPool + wager;
|
|
5773
|
+
const newHome = homePool + (selectedTeam === "home" ? wager : 0);
|
|
5774
|
+
const newAway = awayPool + (selectedTeam === "away" ? wager : 0);
|
|
5775
|
+
const newDraw = drawPool + (selectedTeam === "draw" ? wager : 0);
|
|
5710
5776
|
return {
|
|
5711
|
-
homeOdds:
|
|
5712
|
-
awayOdds:
|
|
5713
|
-
|
|
5714
|
-
|
|
5777
|
+
homeOdds: newHome > 0 ? (newPool / newHome).toFixed(2) : "\u2014",
|
|
5778
|
+
awayOdds: newAway > 0 ? (newPool / newAway).toFixed(2) : "\u2014",
|
|
5779
|
+
drawOdds: newDraw > 0 ? (newPool / newDraw).toFixed(2) : "\u2014",
|
|
5780
|
+
homeBets: homeBetsCount,
|
|
5781
|
+
awayBets: awayBetsCount,
|
|
5782
|
+
drawBets: drawBetsCount
|
|
5715
5783
|
};
|
|
5716
|
-
}, [totalPool, homePool, awayPool, bettors, wager, selectedTeam]);
|
|
5717
|
-
const selectedOdds = selectedTeam === "home" ? homeOdds : selectedTeam === "away" ? awayOdds : "\u2014";
|
|
5784
|
+
}, [totalPool, homePool, awayPool, drawPool, bettors, wager, selectedTeam]);
|
|
5785
|
+
const selectedOdds = selectedTeam === "home" ? homeOdds : selectedTeam === "away" ? awayOdds : selectedTeam === "draw" ? drawOdds : "\u2014";
|
|
5718
5786
|
const potentialWinnings = selectedOdds !== "\u2014" ? formatSol(parseFloat(selectedOdds) * wager) : "\u2014";
|
|
5719
5787
|
const homeName = shortName ? shortName(opponents[0]?.name) : opponents[0]?.name || "Home";
|
|
5720
5788
|
const awayName = shortName ? shortName(opponents[1]?.name) : opponents[1]?.name || "Away";
|
|
5721
|
-
const myBet = (0,
|
|
5789
|
+
const myBet = (0, import_react37.useMemo)(() => {
|
|
5722
5790
|
if (!wallet.publicKey) return null;
|
|
5723
5791
|
const addr = wallet.publicKey.toBase58();
|
|
5724
5792
|
return bettors.find((b) => b.wallet === addr) ?? null;
|
|
@@ -5726,7 +5794,7 @@ function JoinGameSheet({
|
|
|
5726
5794
|
const alreadyJoined = myBet !== null;
|
|
5727
5795
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
5728
5796
|
const canJoin = selectedTeam !== null && !isMutating && mutation.status !== "success" && !alreadyJoined;
|
|
5729
|
-
const handleJoin = (0,
|
|
5797
|
+
const handleJoin = (0, import_react37.useCallback)(async () => {
|
|
5730
5798
|
if (!selectedTeam || !wallet.publicKey) return;
|
|
5731
5799
|
try {
|
|
5732
5800
|
await mutation.execute({
|
|
@@ -5823,11 +5891,26 @@ function JoinGameSheet({
|
|
|
5823
5891
|
t
|
|
5824
5892
|
}
|
|
5825
5893
|
)
|
|
5826
|
-
] })
|
|
5894
|
+
] }),
|
|
5895
|
+
hasDrawOption && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.View, { style: styles15.drawRow, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5896
|
+
TeamButton,
|
|
5897
|
+
{
|
|
5898
|
+
name: "Draw",
|
|
5899
|
+
odds: drawOdds,
|
|
5900
|
+
bets: drawBets,
|
|
5901
|
+
color: drawColor,
|
|
5902
|
+
selected: selectedTeam === "draw",
|
|
5903
|
+
onPress: () => {
|
|
5904
|
+
setSelectedTeam("draw");
|
|
5905
|
+
onTeamSelect?.("draw");
|
|
5906
|
+
},
|
|
5907
|
+
t
|
|
5908
|
+
}
|
|
5909
|
+
) })
|
|
5827
5910
|
] }),
|
|
5828
|
-
alreadyJoined && myBet && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: [styles15.myBetCard, { backgroundColor: (myBet.team === "home" ? homeColor : awayColor) + "15", borderColor: myBet.team === "home" ? homeColor : awayColor }], children: [
|
|
5829
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.myBetLabel, { color: myBet.team === "home" ? homeColor : awayColor }], children: "YOUR BET" }),
|
|
5830
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.myBetTeam, { color: t.text }], children: myBet.team === "home" ? homeName : awayName }),
|
|
5911
|
+
alreadyJoined && myBet && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: [styles15.myBetCard, { backgroundColor: (myBet.team === "home" ? homeColor : myBet.team === "away" ? awayColor : drawColor) + "15", borderColor: myBet.team === "home" ? homeColor : myBet.team === "away" ? awayColor : drawColor }], children: [
|
|
5912
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.myBetLabel, { color: myBet.team === "home" ? homeColor : myBet.team === "away" ? awayColor : drawColor }], children: "YOUR BET" }),
|
|
5913
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.myBetTeam, { color: t.text }], children: myBet.team === "home" ? homeName : myBet.team === "away" ? awayName : "Draw" }),
|
|
5831
5914
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.Text, { style: [styles15.myBetAmount, { color: t.textMuted }], children: [
|
|
5832
5915
|
formatSol(myBet.amount),
|
|
5833
5916
|
" SOL"
|
|
@@ -6026,6 +6109,9 @@ var styles15 = import_react_native21.StyleSheet.create({
|
|
|
6026
6109
|
flexDirection: "row",
|
|
6027
6110
|
gap: 12
|
|
6028
6111
|
},
|
|
6112
|
+
drawRow: {
|
|
6113
|
+
marginTop: 8
|
|
6114
|
+
},
|
|
6029
6115
|
summaryCard: {
|
|
6030
6116
|
marginTop: 20,
|
|
6031
6117
|
borderRadius: 16,
|
|
@@ -6101,7 +6187,7 @@ var styles15 = import_react_native21.StyleSheet.create({
|
|
|
6101
6187
|
});
|
|
6102
6188
|
|
|
6103
6189
|
// src/ui/game/ClaimPrizeSheet.tsx
|
|
6104
|
-
var
|
|
6190
|
+
var import_react38 = require("react");
|
|
6105
6191
|
var import_react_native22 = require("react-native");
|
|
6106
6192
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
6107
6193
|
var STATUS_LABELS4 = {
|
|
@@ -6122,18 +6208,18 @@ function ClaimPrizeSheet({
|
|
|
6122
6208
|
const t = useDubsTheme();
|
|
6123
6209
|
const { wallet } = useDubs();
|
|
6124
6210
|
const mutation = useClaim();
|
|
6125
|
-
const overlayOpacity = (0,
|
|
6126
|
-
const celebrationScale = (0,
|
|
6127
|
-
const celebrationOpacity = (0,
|
|
6128
|
-
const [showCelebration, setShowCelebration] = (0,
|
|
6129
|
-
(0,
|
|
6211
|
+
const overlayOpacity = (0, import_react38.useRef)(new import_react_native22.Animated.Value(0)).current;
|
|
6212
|
+
const celebrationScale = (0, import_react38.useRef)(new import_react_native22.Animated.Value(0)).current;
|
|
6213
|
+
const celebrationOpacity = (0, import_react38.useRef)(new import_react_native22.Animated.Value(0)).current;
|
|
6214
|
+
const [showCelebration, setShowCelebration] = (0, import_react38.useState)(false);
|
|
6215
|
+
(0, import_react38.useEffect)(() => {
|
|
6130
6216
|
import_react_native22.Animated.timing(overlayOpacity, {
|
|
6131
6217
|
toValue: visible ? 1 : 0,
|
|
6132
6218
|
duration: 250,
|
|
6133
6219
|
useNativeDriver: true
|
|
6134
6220
|
}).start();
|
|
6135
6221
|
}, [visible, overlayOpacity]);
|
|
6136
|
-
(0,
|
|
6222
|
+
(0, import_react38.useEffect)(() => {
|
|
6137
6223
|
if (visible) {
|
|
6138
6224
|
mutation.reset();
|
|
6139
6225
|
setShowCelebration(false);
|
|
@@ -6141,7 +6227,7 @@ function ClaimPrizeSheet({
|
|
|
6141
6227
|
celebrationOpacity.setValue(0);
|
|
6142
6228
|
}
|
|
6143
6229
|
}, [visible]);
|
|
6144
|
-
(0,
|
|
6230
|
+
(0, import_react38.useEffect)(() => {
|
|
6145
6231
|
if (mutation.status === "success" && mutation.data) {
|
|
6146
6232
|
setShowCelebration(true);
|
|
6147
6233
|
import_react_native22.Animated.parallel([
|
|
@@ -6164,14 +6250,14 @@ function ClaimPrizeSheet({
|
|
|
6164
6250
|
return () => clearTimeout(timer);
|
|
6165
6251
|
}
|
|
6166
6252
|
}, [mutation.status, mutation.data]);
|
|
6167
|
-
(0,
|
|
6253
|
+
(0, import_react38.useEffect)(() => {
|
|
6168
6254
|
if (mutation.status === "error" && mutation.error) {
|
|
6169
6255
|
onError?.(mutation.error);
|
|
6170
6256
|
}
|
|
6171
6257
|
}, [mutation.status, mutation.error]);
|
|
6172
6258
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
6173
6259
|
const canClaim = !isMutating && mutation.status !== "success" && !!wallet.publicKey;
|
|
6174
|
-
const handleClaim = (0,
|
|
6260
|
+
const handleClaim = (0, import_react38.useCallback)(async () => {
|
|
6175
6261
|
if (!wallet.publicKey) return;
|
|
6176
6262
|
try {
|
|
6177
6263
|
await mutation.execute({
|
|
@@ -6404,7 +6490,7 @@ var styles16 = import_react_native22.StyleSheet.create({
|
|
|
6404
6490
|
});
|
|
6405
6491
|
|
|
6406
6492
|
// src/ui/game/ClaimButton.tsx
|
|
6407
|
-
var
|
|
6493
|
+
var import_react39 = require("react");
|
|
6408
6494
|
var import_react_native23 = require("react-native");
|
|
6409
6495
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
6410
6496
|
function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
@@ -6412,9 +6498,9 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
6412
6498
|
const { wallet } = useDubs();
|
|
6413
6499
|
const game = useGame(gameId);
|
|
6414
6500
|
const claimStatus = useHasClaimed(gameId);
|
|
6415
|
-
const [sheetVisible, setSheetVisible] = (0,
|
|
6501
|
+
const [sheetVisible, setSheetVisible] = (0, import_react39.useState)(false);
|
|
6416
6502
|
const walletAddress = wallet.publicKey?.toBase58() ?? null;
|
|
6417
|
-
const myBet = (0,
|
|
6503
|
+
const myBet = (0, import_react39.useMemo)(() => {
|
|
6418
6504
|
if (!walletAddress || !game.data?.bettors) return null;
|
|
6419
6505
|
return game.data.bettors.find((b) => b.wallet === walletAddress) ?? null;
|
|
6420
6506
|
}, [walletAddress, game.data?.bettors]);
|
|
@@ -6423,7 +6509,7 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
6423
6509
|
const isWinner = isResolved && myBet != null && myBet.team === game.data?.winnerSide;
|
|
6424
6510
|
const isEligible = myBet != null && isResolved && (isWinner || isRefund);
|
|
6425
6511
|
const prizeAmount = isRefund ? myBet?.amount ?? 0 : game.data?.totalPool ?? 0;
|
|
6426
|
-
const handleSuccess = (0,
|
|
6512
|
+
const handleSuccess = (0, import_react39.useCallback)(
|
|
6427
6513
|
(result) => {
|
|
6428
6514
|
claimStatus.refetch();
|
|
6429
6515
|
onSuccess?.(result);
|
|
@@ -6510,7 +6596,7 @@ var styles17 = import_react_native23.StyleSheet.create({
|
|
|
6510
6596
|
});
|
|
6511
6597
|
|
|
6512
6598
|
// src/ui/game/EnterArcadePoolSheet.tsx
|
|
6513
|
-
var
|
|
6599
|
+
var import_react40 = require("react");
|
|
6514
6600
|
var import_react_native24 = require("react-native");
|
|
6515
6601
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
6516
6602
|
var STATUS_LABELS5 = {
|
|
@@ -6531,20 +6617,20 @@ function EnterArcadePoolSheet({
|
|
|
6531
6617
|
const t = useDubsTheme();
|
|
6532
6618
|
const { wallet } = useDubs();
|
|
6533
6619
|
const mutation = useEnterArcadePool();
|
|
6534
|
-
const overlayOpacity = (0,
|
|
6535
|
-
(0,
|
|
6620
|
+
const overlayOpacity = (0, import_react40.useRef)(new import_react_native24.Animated.Value(0)).current;
|
|
6621
|
+
(0, import_react40.useEffect)(() => {
|
|
6536
6622
|
import_react_native24.Animated.timing(overlayOpacity, {
|
|
6537
6623
|
toValue: visible ? 1 : 0,
|
|
6538
6624
|
duration: 250,
|
|
6539
6625
|
useNativeDriver: true
|
|
6540
6626
|
}).start();
|
|
6541
6627
|
}, [visible, overlayOpacity]);
|
|
6542
|
-
(0,
|
|
6628
|
+
(0, import_react40.useEffect)(() => {
|
|
6543
6629
|
if (visible) {
|
|
6544
6630
|
mutation.reset();
|
|
6545
6631
|
}
|
|
6546
6632
|
}, [visible]);
|
|
6547
|
-
(0,
|
|
6633
|
+
(0, import_react40.useEffect)(() => {
|
|
6548
6634
|
if (mutation.status === "success" && mutation.data) {
|
|
6549
6635
|
onSuccess?.(mutation.data);
|
|
6550
6636
|
const timer = setTimeout(() => {
|
|
@@ -6553,7 +6639,7 @@ function EnterArcadePoolSheet({
|
|
|
6553
6639
|
return () => clearTimeout(timer);
|
|
6554
6640
|
}
|
|
6555
6641
|
}, [mutation.status, mutation.data]);
|
|
6556
|
-
(0,
|
|
6642
|
+
(0, import_react40.useEffect)(() => {
|
|
6557
6643
|
if (mutation.status === "error" && mutation.error) {
|
|
6558
6644
|
onError?.(mutation.error);
|
|
6559
6645
|
}
|
|
@@ -6565,7 +6651,7 @@ function EnterArcadePoolSheet({
|
|
|
6565
6651
|
const potSol = (pool.buy_in_lamports * Number(totalBuyIns) / 1e9).toFixed(4);
|
|
6566
6652
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
6567
6653
|
const canJoin = !isMutating && mutation.status !== "success";
|
|
6568
|
-
const handleJoin = (0,
|
|
6654
|
+
const handleJoin = (0, import_react40.useCallback)(async () => {
|
|
6569
6655
|
if (!wallet.publicKey) return;
|
|
6570
6656
|
try {
|
|
6571
6657
|
await mutation.execute(pool.id);
|
|
@@ -6716,7 +6802,7 @@ var styles18 = import_react_native24.StyleSheet.create({
|
|
|
6716
6802
|
});
|
|
6717
6803
|
|
|
6718
6804
|
// src/ui/game/ArcadeLeaderboardSheet.tsx
|
|
6719
|
-
var
|
|
6805
|
+
var import_react41 = require("react");
|
|
6720
6806
|
var import_react_native25 = require("react-native");
|
|
6721
6807
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
6722
6808
|
function RankLabel({ index }) {
|
|
@@ -6733,15 +6819,15 @@ function ArcadeLeaderboardSheet({
|
|
|
6733
6819
|
}) {
|
|
6734
6820
|
const t = useDubsTheme();
|
|
6735
6821
|
const { pool, leaderboard, stats, loading, refetch } = useArcadePool(poolId);
|
|
6736
|
-
const overlayOpacity = (0,
|
|
6737
|
-
(0,
|
|
6822
|
+
const overlayOpacity = (0, import_react41.useRef)(new import_react_native25.Animated.Value(0)).current;
|
|
6823
|
+
(0, import_react41.useEffect)(() => {
|
|
6738
6824
|
import_react_native25.Animated.timing(overlayOpacity, {
|
|
6739
6825
|
toValue: visible ? 1 : 0,
|
|
6740
6826
|
duration: 250,
|
|
6741
6827
|
useNativeDriver: true
|
|
6742
6828
|
}).start();
|
|
6743
6829
|
}, [visible, overlayOpacity]);
|
|
6744
|
-
(0,
|
|
6830
|
+
(0, import_react41.useEffect)(() => {
|
|
6745
6831
|
if (visible) refetch();
|
|
6746
6832
|
}, [visible]);
|
|
6747
6833
|
const renderItem = ({ item, index }) => {
|
|
@@ -6888,7 +6974,7 @@ var styles19 = import_react_native25.StyleSheet.create({
|
|
|
6888
6974
|
});
|
|
6889
6975
|
|
|
6890
6976
|
// src/ui/game/CreateGameSheet.tsx
|
|
6891
|
-
var
|
|
6977
|
+
var import_react42 = require("react");
|
|
6892
6978
|
var import_react_native26 = require("react-native");
|
|
6893
6979
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
6894
6980
|
var STATUS_LABELS6 = {
|
|
@@ -6917,20 +7003,20 @@ function CreateGameSheet({
|
|
|
6917
7003
|
const t = useDubsTheme();
|
|
6918
7004
|
const { wallet } = useDubs();
|
|
6919
7005
|
const mutation = useCreateGame();
|
|
6920
|
-
const [selectedTeam, setSelectedTeam] = (0,
|
|
6921
|
-
const [wager, setWager] = (0,
|
|
6922
|
-
const [showSuccess, setShowSuccess] = (0,
|
|
6923
|
-
const overlayOpacity = (0,
|
|
6924
|
-
const successScale = (0,
|
|
6925
|
-
const successOpacity = (0,
|
|
6926
|
-
(0,
|
|
7006
|
+
const [selectedTeam, setSelectedTeam] = (0, import_react42.useState)(null);
|
|
7007
|
+
const [wager, setWager] = (0, import_react42.useState)(0.01);
|
|
7008
|
+
const [showSuccess, setShowSuccess] = (0, import_react42.useState)(false);
|
|
7009
|
+
const overlayOpacity = (0, import_react42.useRef)(new import_react_native26.Animated.Value(0)).current;
|
|
7010
|
+
const successScale = (0, import_react42.useRef)(new import_react_native26.Animated.Value(0)).current;
|
|
7011
|
+
const successOpacity = (0, import_react42.useRef)(new import_react_native26.Animated.Value(0)).current;
|
|
7012
|
+
(0, import_react42.useEffect)(() => {
|
|
6927
7013
|
import_react_native26.Animated.timing(overlayOpacity, {
|
|
6928
7014
|
toValue: visible ? 1 : 0,
|
|
6929
7015
|
duration: 250,
|
|
6930
7016
|
useNativeDriver: true
|
|
6931
7017
|
}).start();
|
|
6932
7018
|
}, [visible]);
|
|
6933
|
-
(0,
|
|
7019
|
+
(0, import_react42.useEffect)(() => {
|
|
6934
7020
|
if (visible) {
|
|
6935
7021
|
setSelectedTeam(null);
|
|
6936
7022
|
setWager(0.01);
|
|
@@ -6940,7 +7026,7 @@ function CreateGameSheet({
|
|
|
6940
7026
|
mutation.reset();
|
|
6941
7027
|
}
|
|
6942
7028
|
}, [visible]);
|
|
6943
|
-
(0,
|
|
7029
|
+
(0, import_react42.useEffect)(() => {
|
|
6944
7030
|
if (mutation.status === "success" && mutation.data) {
|
|
6945
7031
|
setShowSuccess(true);
|
|
6946
7032
|
onSuccess?.(mutation.data);
|
|
@@ -6957,7 +7043,7 @@ function CreateGameSheet({
|
|
|
6957
7043
|
return () => clearTimeout(timer);
|
|
6958
7044
|
}
|
|
6959
7045
|
}, [mutation.status, mutation.data]);
|
|
6960
|
-
(0,
|
|
7046
|
+
(0, import_react42.useEffect)(() => {
|
|
6961
7047
|
if (mutation.status === "error" && mutation.error) {
|
|
6962
7048
|
onError?.(mutation.error);
|
|
6963
7049
|
}
|
|
@@ -6967,7 +7053,7 @@ function CreateGameSheet({
|
|
|
6967
7053
|
const awayName = shortName ? shortName(opponents[1]?.name) : opponents[1]?.name || "Away";
|
|
6968
7054
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
6969
7055
|
const canCreate = selectedTeam !== null && !isMutating && mutation.status !== "success";
|
|
6970
|
-
const handleCreate = (0,
|
|
7056
|
+
const handleCreate = (0, import_react42.useCallback)(async () => {
|
|
6971
7057
|
if (!selectedTeam || !wallet.publicKey) return;
|
|
6972
7058
|
try {
|
|
6973
7059
|
await mutation.execute({
|
|
@@ -7168,9 +7254,11 @@ var styles20 = import_react_native26.StyleSheet.create({
|
|
|
7168
7254
|
useGame,
|
|
7169
7255
|
useGames,
|
|
7170
7256
|
useHasClaimed,
|
|
7257
|
+
useHighlights,
|
|
7171
7258
|
useJoinGame,
|
|
7172
7259
|
useNetworkGames,
|
|
7173
7260
|
usePushNotifications,
|
|
7261
|
+
useShorts,
|
|
7174
7262
|
useUFCFightCard,
|
|
7175
7263
|
useUFCFighterDetail
|
|
7176
7264
|
});
|