@dubsdotapp/expo 0.5.15 → 0.5.17
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 +414 -223
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +361 -171
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useShorts.ts +36 -0
- package/src/index.ts +2 -1
- package/src/ui/game/JoinGameSheet.tsx +172 -15
package/dist/index.js
CHANGED
|
@@ -87,6 +87,7 @@ __export(index_exports, {
|
|
|
87
87
|
useJoinGame: () => useJoinGame,
|
|
88
88
|
useNetworkGames: () => useNetworkGames,
|
|
89
89
|
usePushNotifications: () => usePushNotifications,
|
|
90
|
+
useShorts: () => useShorts,
|
|
90
91
|
useUFCFightCard: () => useUFCFightCard,
|
|
91
92
|
useUFCFighterDetail: () => useUFCFighterDetail
|
|
92
93
|
});
|
|
@@ -732,7 +733,7 @@ function createSecureStoreStorage() {
|
|
|
732
733
|
}
|
|
733
734
|
|
|
734
735
|
// src/provider.tsx
|
|
735
|
-
var
|
|
736
|
+
var import_react26 = require("react");
|
|
736
737
|
|
|
737
738
|
// src/ui/theme.ts
|
|
738
739
|
var import_react = require("react");
|
|
@@ -1790,7 +1791,7 @@ function ManagedWalletProvider({
|
|
|
1790
1791
|
}
|
|
1791
1792
|
|
|
1792
1793
|
// src/ui/AuthGate.tsx
|
|
1793
|
-
var
|
|
1794
|
+
var import_react25 = __toESM(require("react"));
|
|
1794
1795
|
var import_react_native8 = require("react-native");
|
|
1795
1796
|
|
|
1796
1797
|
// src/hooks/useEvents.ts
|
|
@@ -2508,25 +2509,51 @@ function useHighlights(league, limit = 8) {
|
|
|
2508
2509
|
return { data, loading, error, refetch: fetchData };
|
|
2509
2510
|
}
|
|
2510
2511
|
|
|
2511
|
-
// src/hooks/
|
|
2512
|
+
// src/hooks/useShorts.ts
|
|
2512
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");
|
|
2513
2540
|
var import_react_native6 = require("react-native");
|
|
2514
2541
|
function usePushNotifications() {
|
|
2515
2542
|
const { client, appName, pushEnabled } = useDubs();
|
|
2516
|
-
const channelId = (0,
|
|
2517
|
-
const [hasPermission, setHasPermission] = (0,
|
|
2518
|
-
const [pushToken, setPushToken] = (0,
|
|
2519
|
-
const [loading, setLoading] = (0,
|
|
2520
|
-
const [error, setError] = (0,
|
|
2521
|
-
const registering = (0,
|
|
2522
|
-
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)(() => {
|
|
2523
2550
|
try {
|
|
2524
2551
|
return require("expo-notifications");
|
|
2525
2552
|
} catch {
|
|
2526
2553
|
return null;
|
|
2527
2554
|
}
|
|
2528
2555
|
}, []);
|
|
2529
|
-
const getDeviceName = (0,
|
|
2556
|
+
const getDeviceName = (0, import_react18.useCallback)(() => {
|
|
2530
2557
|
try {
|
|
2531
2558
|
const Device = require("expo-device");
|
|
2532
2559
|
return Device.deviceName || null;
|
|
@@ -2534,7 +2561,7 @@ function usePushNotifications() {
|
|
|
2534
2561
|
return null;
|
|
2535
2562
|
}
|
|
2536
2563
|
}, []);
|
|
2537
|
-
const setupAndroidChannels = (0,
|
|
2564
|
+
const setupAndroidChannels = (0, import_react18.useCallback)((Notifications) => {
|
|
2538
2565
|
if (import_react_native6.Platform.OS === "android") {
|
|
2539
2566
|
Notifications.setNotificationChannelAsync(channelId || "default", {
|
|
2540
2567
|
name: appName || "Default",
|
|
@@ -2544,7 +2571,7 @@ function usePushNotifications() {
|
|
|
2544
2571
|
});
|
|
2545
2572
|
}
|
|
2546
2573
|
}, [channelId, appName]);
|
|
2547
|
-
const registerTokenWithServer = (0,
|
|
2574
|
+
const registerTokenWithServer = (0, import_react18.useCallback)(async (token) => {
|
|
2548
2575
|
const deviceName = getDeviceName();
|
|
2549
2576
|
await client.registerPushToken({
|
|
2550
2577
|
token,
|
|
@@ -2552,7 +2579,7 @@ function usePushNotifications() {
|
|
|
2552
2579
|
deviceName: deviceName || void 0
|
|
2553
2580
|
});
|
|
2554
2581
|
}, [client, getDeviceName]);
|
|
2555
|
-
const register = (0,
|
|
2582
|
+
const register = (0, import_react18.useCallback)(async () => {
|
|
2556
2583
|
if (!pushEnabled) return false;
|
|
2557
2584
|
if (registering.current) return false;
|
|
2558
2585
|
registering.current = true;
|
|
@@ -2593,7 +2620,7 @@ function usePushNotifications() {
|
|
|
2593
2620
|
return false;
|
|
2594
2621
|
}
|
|
2595
2622
|
}, [getNotificationsModule, registerTokenWithServer, setupAndroidChannels]);
|
|
2596
|
-
const unregister = (0,
|
|
2623
|
+
const unregister = (0, import_react18.useCallback)(async () => {
|
|
2597
2624
|
if (!pushToken) return;
|
|
2598
2625
|
try {
|
|
2599
2626
|
await client.unregisterPushToken(pushToken);
|
|
@@ -2602,7 +2629,7 @@ function usePushNotifications() {
|
|
|
2602
2629
|
console.error("[usePushNotifications] Unregister error:", err);
|
|
2603
2630
|
}
|
|
2604
2631
|
}, [client, pushToken]);
|
|
2605
|
-
const restoreIfGranted = (0,
|
|
2632
|
+
const restoreIfGranted = (0, import_react18.useCallback)(async () => {
|
|
2606
2633
|
if (!pushEnabled) return;
|
|
2607
2634
|
try {
|
|
2608
2635
|
const Notifications = getNotificationsModule();
|
|
@@ -2620,8 +2647,8 @@ function usePushNotifications() {
|
|
|
2620
2647
|
console.log("[usePushNotifications] Restore skipped:", err instanceof Error ? err.message : err);
|
|
2621
2648
|
}
|
|
2622
2649
|
}, [getNotificationsModule, registerTokenWithServer, setupAndroidChannels]);
|
|
2623
|
-
const didMount = (0,
|
|
2624
|
-
(0,
|
|
2650
|
+
const didMount = (0, import_react18.useRef)(false);
|
|
2651
|
+
(0, import_react18.useEffect)(() => {
|
|
2625
2652
|
if (didMount.current) return;
|
|
2626
2653
|
didMount.current = true;
|
|
2627
2654
|
const Notifications = getNotificationsModule();
|
|
@@ -2651,13 +2678,13 @@ function usePushNotifications() {
|
|
|
2651
2678
|
}
|
|
2652
2679
|
|
|
2653
2680
|
// src/hooks/useArcadePools.ts
|
|
2654
|
-
var
|
|
2681
|
+
var import_react19 = require("react");
|
|
2655
2682
|
function useArcadePools(gameSlug) {
|
|
2656
2683
|
const { client } = useDubs();
|
|
2657
|
-
const [pools, setPools] = (0,
|
|
2658
|
-
const [loading, setLoading] = (0,
|
|
2659
|
-
const [error, setError] = (0,
|
|
2660
|
-
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 () => {
|
|
2661
2688
|
setLoading(true);
|
|
2662
2689
|
setError(null);
|
|
2663
2690
|
try {
|
|
@@ -2669,22 +2696,22 @@ function useArcadePools(gameSlug) {
|
|
|
2669
2696
|
setLoading(false);
|
|
2670
2697
|
}
|
|
2671
2698
|
}, [client, gameSlug]);
|
|
2672
|
-
(0,
|
|
2699
|
+
(0, import_react19.useEffect)(() => {
|
|
2673
2700
|
fetch2();
|
|
2674
2701
|
}, [fetch2]);
|
|
2675
2702
|
return { pools, loading, error, refetch: fetch2 };
|
|
2676
2703
|
}
|
|
2677
2704
|
|
|
2678
2705
|
// src/hooks/useArcadePool.ts
|
|
2679
|
-
var
|
|
2706
|
+
var import_react20 = require("react");
|
|
2680
2707
|
function useArcadePool(poolId) {
|
|
2681
2708
|
const { client } = useDubs();
|
|
2682
|
-
const [pool, setPool] = (0,
|
|
2683
|
-
const [stats, setStats] = (0,
|
|
2684
|
-
const [leaderboard, setLeaderboard] = (0,
|
|
2685
|
-
const [loading, setLoading] = (0,
|
|
2686
|
-
const [error, setError] = (0,
|
|
2687
|
-
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 () => {
|
|
2688
2715
|
if (!poolId) return;
|
|
2689
2716
|
setLoading(true);
|
|
2690
2717
|
setError(null);
|
|
@@ -2702,22 +2729,22 @@ function useArcadePool(poolId) {
|
|
|
2702
2729
|
setLoading(false);
|
|
2703
2730
|
}
|
|
2704
2731
|
}, [client, poolId]);
|
|
2705
|
-
(0,
|
|
2732
|
+
(0, import_react20.useEffect)(() => {
|
|
2706
2733
|
fetch2();
|
|
2707
2734
|
}, [fetch2]);
|
|
2708
2735
|
return { pool, stats, leaderboard, loading, error, refetch: fetch2 };
|
|
2709
2736
|
}
|
|
2710
2737
|
|
|
2711
2738
|
// src/hooks/useArcadeGame.ts
|
|
2712
|
-
var
|
|
2739
|
+
var import_react21 = require("react");
|
|
2713
2740
|
function useArcadeGame(poolId, maxLives = 3) {
|
|
2714
2741
|
const { client } = useDubs();
|
|
2715
2742
|
const { user } = useAuth();
|
|
2716
|
-
const [entry, setEntry] = (0,
|
|
2717
|
-
const [loading, setLoading] = (0,
|
|
2718
|
-
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);
|
|
2719
2746
|
const walletAddress = user?.walletAddress || "";
|
|
2720
|
-
const refreshEntry = (0,
|
|
2747
|
+
const refreshEntry = (0, import_react21.useCallback)(async () => {
|
|
2721
2748
|
if (!poolId || !walletAddress) return;
|
|
2722
2749
|
setLoading(true);
|
|
2723
2750
|
setError(null);
|
|
@@ -2734,7 +2761,7 @@ function useArcadeGame(poolId, maxLives = 3) {
|
|
|
2734
2761
|
setLoading(false);
|
|
2735
2762
|
}
|
|
2736
2763
|
}, [client, poolId, walletAddress]);
|
|
2737
|
-
const startAttempt = (0,
|
|
2764
|
+
const startAttempt = (0, import_react21.useCallback)(async () => {
|
|
2738
2765
|
if (!poolId || !walletAddress) throw new Error("Not ready");
|
|
2739
2766
|
setError(null);
|
|
2740
2767
|
try {
|
|
@@ -2746,7 +2773,7 @@ function useArcadeGame(poolId, maxLives = 3) {
|
|
|
2746
2773
|
throw e;
|
|
2747
2774
|
}
|
|
2748
2775
|
}, [client, poolId, walletAddress]);
|
|
2749
|
-
const submitScore = (0,
|
|
2776
|
+
const submitScore = (0, import_react21.useCallback)(async (sessionToken, score, durationMs) => {
|
|
2750
2777
|
if (!poolId || !walletAddress) throw new Error("Not ready");
|
|
2751
2778
|
setError(null);
|
|
2752
2779
|
try {
|
|
@@ -2783,19 +2810,19 @@ function useArcadeGame(poolId, maxLives = 3) {
|
|
|
2783
2810
|
}
|
|
2784
2811
|
|
|
2785
2812
|
// src/hooks/useEnterArcadePool.ts
|
|
2786
|
-
var
|
|
2813
|
+
var import_react22 = require("react");
|
|
2787
2814
|
function useEnterArcadePool() {
|
|
2788
2815
|
const { client, wallet, connection } = useDubs();
|
|
2789
2816
|
const { user } = useAuth();
|
|
2790
|
-
const [status, setStatus] = (0,
|
|
2791
|
-
const [error, setError] = (0,
|
|
2792
|
-
const [data, setData] = (0,
|
|
2793
|
-
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)(() => {
|
|
2794
2821
|
setStatus("idle");
|
|
2795
2822
|
setError(null);
|
|
2796
2823
|
setData(null);
|
|
2797
2824
|
}, []);
|
|
2798
|
-
const execute = (0,
|
|
2825
|
+
const execute = (0, import_react22.useCallback)(async (poolId) => {
|
|
2799
2826
|
if (!wallet.publicKey) throw new Error("Wallet not connected");
|
|
2800
2827
|
const walletAddress = wallet.publicKey.toBase58();
|
|
2801
2828
|
setStatus("building");
|
|
@@ -2843,7 +2870,7 @@ function useEnterArcadePool() {
|
|
|
2843
2870
|
}
|
|
2844
2871
|
|
|
2845
2872
|
// src/hooks/useArcadeCountdown.ts
|
|
2846
|
-
var
|
|
2873
|
+
var import_react23 = require("react");
|
|
2847
2874
|
function formatCountdown(ms) {
|
|
2848
2875
|
if (ms <= 0) return "Ended";
|
|
2849
2876
|
const s2 = Math.floor(ms / 1e3);
|
|
@@ -2856,9 +2883,9 @@ function formatCountdown(ms) {
|
|
|
2856
2883
|
return `${s2}s`;
|
|
2857
2884
|
}
|
|
2858
2885
|
function useArcadeCountdown(nextResolution) {
|
|
2859
|
-
const [now, setNow] = (0,
|
|
2860
|
-
const intervalRef = (0,
|
|
2861
|
-
(0,
|
|
2886
|
+
const [now, setNow] = (0, import_react23.useState)(Date.now());
|
|
2887
|
+
const intervalRef = (0, import_react23.useRef)(null);
|
|
2888
|
+
(0, import_react23.useEffect)(() => {
|
|
2862
2889
|
if (!nextResolution) return;
|
|
2863
2890
|
intervalRef.current = setInterval(() => setNow(Date.now()), 1e3);
|
|
2864
2891
|
return () => {
|
|
@@ -2887,7 +2914,7 @@ function useArcadeCountdown(nextResolution) {
|
|
|
2887
2914
|
}
|
|
2888
2915
|
|
|
2889
2916
|
// src/hooks/useArcadeBridge.ts
|
|
2890
|
-
var
|
|
2917
|
+
var import_react24 = require("react");
|
|
2891
2918
|
var PROTOCOL_VERSION = "1.0";
|
|
2892
2919
|
function useArcadeBridge({
|
|
2893
2920
|
canPlay,
|
|
@@ -2897,14 +2924,14 @@ function useArcadeBridge({
|
|
|
2897
2924
|
onScoreSubmitted,
|
|
2898
2925
|
onError
|
|
2899
2926
|
}) {
|
|
2900
|
-
const webviewRef = (0,
|
|
2901
|
-
const sessionTokenRef = (0,
|
|
2902
|
-
const gameStartTimeRef = (0,
|
|
2903
|
-
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);
|
|
2904
2931
|
canPlayRef.current = canPlay;
|
|
2905
|
-
const [lastResult, setLastResult] = (0,
|
|
2906
|
-
const [bridgeLoading, setBridgeLoading] = (0,
|
|
2907
|
-
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) => {
|
|
2908
2935
|
webviewRef.current?.injectJavaScript(`
|
|
2909
2936
|
window.ARCADE_SESSION_TOKEN = ${JSON.stringify(token)};
|
|
2910
2937
|
window.ARCADE_ATTEMPT_NUMBER = ${attemptNumber};
|
|
@@ -2913,7 +2940,7 @@ function useArcadeBridge({
|
|
|
2913
2940
|
true;
|
|
2914
2941
|
`);
|
|
2915
2942
|
}, []);
|
|
2916
|
-
const triggerPlay = (0,
|
|
2943
|
+
const triggerPlay = (0, import_react24.useCallback)(async () => {
|
|
2917
2944
|
if (!canPlay) return;
|
|
2918
2945
|
setBridgeLoading(true);
|
|
2919
2946
|
try {
|
|
@@ -2930,7 +2957,7 @@ function useArcadeBridge({
|
|
|
2930
2957
|
setBridgeLoading(false);
|
|
2931
2958
|
}
|
|
2932
2959
|
}, [canPlay, startAttempt, injectSession, onPlayStarted, onError]);
|
|
2933
|
-
const handleMessage = (0,
|
|
2960
|
+
const handleMessage = (0, import_react24.useCallback)(
|
|
2934
2961
|
async (event) => {
|
|
2935
2962
|
let data;
|
|
2936
2963
|
try {
|
|
@@ -3136,11 +3163,11 @@ function AuthGate({
|
|
|
3136
3163
|
}) {
|
|
3137
3164
|
const { client, pushEnabled } = useDubs();
|
|
3138
3165
|
const auth = useAuth();
|
|
3139
|
-
const [phase, setPhase] = (0,
|
|
3140
|
-
const [registrationPhase, setRegistrationPhase] = (0,
|
|
3141
|
-
const [showPushSetup, setShowPushSetup] = (0,
|
|
3142
|
-
const [isRestoredSession, setIsRestoredSession] = (0,
|
|
3143
|
-
(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)(() => {
|
|
3144
3171
|
let cancelled = false;
|
|
3145
3172
|
(async () => {
|
|
3146
3173
|
try {
|
|
@@ -3167,23 +3194,23 @@ function AuthGate({
|
|
|
3167
3194
|
cancelled = true;
|
|
3168
3195
|
};
|
|
3169
3196
|
}, []);
|
|
3170
|
-
(0,
|
|
3197
|
+
(0, import_react25.useEffect)(() => {
|
|
3171
3198
|
if (auth.status === "needsRegistration") setRegistrationPhase(true);
|
|
3172
3199
|
}, [auth.status]);
|
|
3173
|
-
(0,
|
|
3200
|
+
(0, import_react25.useEffect)(() => {
|
|
3174
3201
|
if (pushEnabled && auth.status === "authenticated" && registrationPhase && !isRestoredSession) {
|
|
3175
3202
|
setShowPushSetup(true);
|
|
3176
3203
|
}
|
|
3177
3204
|
}, [pushEnabled, auth.status, registrationPhase, isRestoredSession]);
|
|
3178
|
-
(0,
|
|
3205
|
+
(0, import_react25.useEffect)(() => {
|
|
3179
3206
|
if (auth.token) onSaveToken(auth.token);
|
|
3180
3207
|
}, [auth.token]);
|
|
3181
|
-
const retry = (0,
|
|
3208
|
+
const retry = (0, import_react25.useCallback)(() => {
|
|
3182
3209
|
setRegistrationPhase(false);
|
|
3183
3210
|
auth.reset();
|
|
3184
3211
|
auth.authenticate();
|
|
3185
3212
|
}, [auth]);
|
|
3186
|
-
const handleRegister = (0,
|
|
3213
|
+
const handleRegister = (0, import_react25.useCallback)(
|
|
3187
3214
|
(username, referralCode, avatarUrl) => {
|
|
3188
3215
|
auth.register(username, referralCode, avatarUrl);
|
|
3189
3216
|
},
|
|
@@ -3283,7 +3310,7 @@ function DefaultErrorScreen({ error, onRetry, appName, accentColor }) {
|
|
|
3283
3310
|
function StepIndicator({ currentStep }) {
|
|
3284
3311
|
const t = useDubsTheme();
|
|
3285
3312
|
const steps = [0, 1, 2, 3];
|
|
3286
|
-
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: [
|
|
3287
3314
|
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native8.View, { style: [s.stepLine, { backgroundColor: i <= currentStep ? t.success : t.border }] }),
|
|
3288
3315
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
3289
3316
|
import_react_native8.View,
|
|
@@ -3307,20 +3334,20 @@ function DefaultRegistrationScreen({
|
|
|
3307
3334
|
}) {
|
|
3308
3335
|
const t = useDubsTheme();
|
|
3309
3336
|
const accent = accentColor || t.accent;
|
|
3310
|
-
const [step, setStep] = (0,
|
|
3311
|
-
const [avatarSeed, setAvatarSeed] = (0,
|
|
3312
|
-
const [avatarStyle, setAvatarStyle] = (0,
|
|
3313
|
-
const [avatarBg, setAvatarBg] = (0,
|
|
3314
|
-
const [showStyles, setShowStyles] = (0,
|
|
3315
|
-
const [username, setUsername] = (0,
|
|
3316
|
-
const [referralCode, setReferralCode] = (0,
|
|
3317
|
-
const [checking, setChecking] = (0,
|
|
3318
|
-
const [availability, setAvailability] = (0,
|
|
3319
|
-
const debounceRef = (0,
|
|
3320
|
-
const fadeAnim = (0,
|
|
3321
|
-
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;
|
|
3322
3349
|
const avatarUrl = getAvatarUrl(avatarStyle, avatarSeed, avatarBg);
|
|
3323
|
-
(0,
|
|
3350
|
+
(0, import_react25.useEffect)(() => {
|
|
3324
3351
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
3325
3352
|
const trimmed = username.trim();
|
|
3326
3353
|
if (trimmed.length < 3) {
|
|
@@ -3343,7 +3370,7 @@ function DefaultRegistrationScreen({
|
|
|
3343
3370
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
3344
3371
|
};
|
|
3345
3372
|
}, [username, client]);
|
|
3346
|
-
const animateToStep = (0,
|
|
3373
|
+
const animateToStep = (0, import_react25.useCallback)((newStep) => {
|
|
3347
3374
|
const dir = newStep > step ? 1 : -1;
|
|
3348
3375
|
import_react_native8.Keyboard.dismiss();
|
|
3349
3376
|
import_react_native8.Animated.parallel([
|
|
@@ -3582,8 +3609,8 @@ function DefaultRegistrationScreen({
|
|
|
3582
3609
|
}
|
|
3583
3610
|
function PushTokenRestorer() {
|
|
3584
3611
|
const push = usePushNotifications();
|
|
3585
|
-
const restored = (0,
|
|
3586
|
-
(0,
|
|
3612
|
+
const restored = (0, import_react25.useRef)(false);
|
|
3613
|
+
(0, import_react25.useEffect)(() => {
|
|
3587
3614
|
if (restored.current) return;
|
|
3588
3615
|
restored.current = true;
|
|
3589
3616
|
push.restoreIfGranted();
|
|
@@ -3598,9 +3625,9 @@ function PushSetupScreen({
|
|
|
3598
3625
|
const t = useDubsTheme();
|
|
3599
3626
|
const accent = accentColor || t.accent;
|
|
3600
3627
|
const push = usePushNotifications();
|
|
3601
|
-
const fadeAnim = (0,
|
|
3602
|
-
const slideAnim = (0,
|
|
3603
|
-
(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)(() => {
|
|
3604
3631
|
import_react_native8.Animated.parallel([
|
|
3605
3632
|
import_react_native8.Animated.timing(fadeAnim, { toValue: 1, duration: 300, useNativeDriver: true }),
|
|
3606
3633
|
import_react_native8.Animated.timing(slideAnim, { toValue: 0, duration: 300, useNativeDriver: true })
|
|
@@ -3736,7 +3763,7 @@ var s = import_react_native8.StyleSheet.create({
|
|
|
3736
3763
|
|
|
3737
3764
|
// src/provider.tsx
|
|
3738
3765
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
3739
|
-
var DubsContext = (0,
|
|
3766
|
+
var DubsContext = (0, import_react26.createContext)(null);
|
|
3740
3767
|
function DubsProvider({
|
|
3741
3768
|
apiKey,
|
|
3742
3769
|
children,
|
|
@@ -3758,11 +3785,11 @@ function DubsProvider({
|
|
|
3758
3785
|
const config = NETWORK_CONFIG[network];
|
|
3759
3786
|
const baseUrl = baseUrlOverride || config.baseUrl;
|
|
3760
3787
|
const rpcUrl = rpcUrlOverride || config.rpcUrl;
|
|
3761
|
-
const client = (0,
|
|
3762
|
-
const storage = (0,
|
|
3763
|
-
const [uiConfig, setUiConfig] = (0,
|
|
3764
|
-
const [resolvedNetwork, setResolvedNetwork] = (0,
|
|
3765
|
-
(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)(() => {
|
|
3766
3793
|
client.getAppConfig().then((cfg) => {
|
|
3767
3794
|
console.log("[DubsProvider] UI config loaded:", JSON.stringify(cfg));
|
|
3768
3795
|
setUiConfig(cfg);
|
|
@@ -3778,7 +3805,7 @@ function DubsProvider({
|
|
|
3778
3805
|
const resolvedConfig = NETWORK_CONFIG[resolvedNetwork];
|
|
3779
3806
|
const resolvedRpcUrl = rpcUrlOverride || resolvedConfig.rpcUrl;
|
|
3780
3807
|
const cluster = resolvedConfig.cluster;
|
|
3781
|
-
const connection = (0,
|
|
3808
|
+
const connection = (0, import_react26.useMemo)(() => new import_web34.Connection(resolvedRpcUrl, { commitment: "confirmed" }), [resolvedRpcUrl]);
|
|
3782
3809
|
if (uiConfig === null) return null;
|
|
3783
3810
|
const themeOverrides = {};
|
|
3784
3811
|
if (uiConfig.accentColor) {
|
|
@@ -3854,11 +3881,11 @@ function ManagedInner({
|
|
|
3854
3881
|
children
|
|
3855
3882
|
}) {
|
|
3856
3883
|
const managedDisconnect = useDisconnect();
|
|
3857
|
-
const disconnect = (0,
|
|
3884
|
+
const disconnect = (0, import_react26.useCallback)(async () => {
|
|
3858
3885
|
client.setToken(null);
|
|
3859
3886
|
await managedDisconnect?.();
|
|
3860
3887
|
}, [client, managedDisconnect]);
|
|
3861
|
-
const value = (0,
|
|
3888
|
+
const value = (0, import_react26.useMemo)(
|
|
3862
3889
|
() => ({ client, wallet, connection, appName, network, disconnect, uiConfig, pushEnabled }),
|
|
3863
3890
|
[client, wallet, connection, appName, network, disconnect, uiConfig, pushEnabled]
|
|
3864
3891
|
);
|
|
@@ -3895,13 +3922,13 @@ function ExternalWalletProvider({
|
|
|
3895
3922
|
pushEnabled,
|
|
3896
3923
|
children
|
|
3897
3924
|
}) {
|
|
3898
|
-
const disconnect = (0,
|
|
3925
|
+
const disconnect = (0, import_react26.useCallback)(async () => {
|
|
3899
3926
|
client.setToken(null);
|
|
3900
3927
|
await storage.deleteItem(STORAGE_KEYS.JWT_TOKEN).catch(() => {
|
|
3901
3928
|
});
|
|
3902
3929
|
await wallet.disconnect?.();
|
|
3903
3930
|
}, [client, storage, wallet]);
|
|
3904
|
-
const value = (0,
|
|
3931
|
+
const value = (0, import_react26.useMemo)(
|
|
3905
3932
|
() => ({ client, wallet, connection, appName, network, disconnect, uiConfig, pushEnabled }),
|
|
3906
3933
|
[client, wallet, connection, appName, network, disconnect, uiConfig, pushEnabled]
|
|
3907
3934
|
);
|
|
@@ -3926,14 +3953,14 @@ function ExternalWalletProvider({
|
|
|
3926
3953
|
) });
|
|
3927
3954
|
}
|
|
3928
3955
|
function useDubs() {
|
|
3929
|
-
const ctx = (0,
|
|
3956
|
+
const ctx = (0, import_react26.useContext)(DubsContext);
|
|
3930
3957
|
if (!ctx) {
|
|
3931
3958
|
throw new Error("useDubs must be used within a <DubsProvider>");
|
|
3932
3959
|
}
|
|
3933
3960
|
return ctx;
|
|
3934
3961
|
}
|
|
3935
3962
|
function useAppConfig() {
|
|
3936
|
-
const ctx = (0,
|
|
3963
|
+
const ctx = (0, import_react26.useContext)(DubsContext);
|
|
3937
3964
|
return ctx?.uiConfig || {};
|
|
3938
3965
|
}
|
|
3939
3966
|
|
|
@@ -3991,7 +4018,7 @@ var styles3 = import_react_native9.StyleSheet.create({
|
|
|
3991
4018
|
});
|
|
3992
4019
|
|
|
3993
4020
|
// src/ui/UserProfileCard.tsx
|
|
3994
|
-
var
|
|
4021
|
+
var import_react27 = require("react");
|
|
3995
4022
|
var import_react_native10 = require("react-native");
|
|
3996
4023
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
3997
4024
|
function truncateAddress(address, chars = 4) {
|
|
@@ -4011,7 +4038,7 @@ function UserProfileCard({
|
|
|
4011
4038
|
memberSince
|
|
4012
4039
|
}) {
|
|
4013
4040
|
const t = useDubsTheme();
|
|
4014
|
-
const imageUri = (0,
|
|
4041
|
+
const imageUri = (0, import_react27.useMemo)(
|
|
4015
4042
|
() => ensurePngAvatar(avatarUrl) || `https://api.dicebear.com/9.x/avataaars/png?seed=${walletAddress}&size=128`,
|
|
4016
4043
|
[avatarUrl, walletAddress]
|
|
4017
4044
|
);
|
|
@@ -4204,7 +4231,7 @@ var styles5 = import_react_native11.StyleSheet.create({
|
|
|
4204
4231
|
});
|
|
4205
4232
|
|
|
4206
4233
|
// src/ui/UserProfileSheet.tsx
|
|
4207
|
-
var
|
|
4234
|
+
var import_react28 = require("react");
|
|
4208
4235
|
var import_react_native12 = require("react-native");
|
|
4209
4236
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
4210
4237
|
function truncateAddress3(address, chars = 4) {
|
|
@@ -4222,31 +4249,31 @@ function UserProfileSheet({
|
|
|
4222
4249
|
const { client } = useDubs();
|
|
4223
4250
|
const { refreshUser } = useAuth();
|
|
4224
4251
|
const push = usePushNotifications();
|
|
4225
|
-
const overlayOpacity = (0,
|
|
4226
|
-
const parsed = (0,
|
|
4227
|
-
const [avatarStyle, setAvatarStyle] = (0,
|
|
4228
|
-
const [avatarSeed, setAvatarSeed] = (0,
|
|
4229
|
-
const [bgColor, setBgColor] = (0,
|
|
4230
|
-
const [saving, setSaving] = (0,
|
|
4231
|
-
const [error, setError] = (0,
|
|
4232
|
-
(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)(() => {
|
|
4233
4260
|
const p = parseAvatarUrl(user.avatar);
|
|
4234
4261
|
setAvatarStyle(p.style);
|
|
4235
4262
|
setAvatarSeed(p.seed);
|
|
4236
4263
|
setBgColor(p.bg);
|
|
4237
4264
|
}, [user.avatar]);
|
|
4238
|
-
(0,
|
|
4265
|
+
(0, import_react28.useEffect)(() => {
|
|
4239
4266
|
import_react_native12.Animated.timing(overlayOpacity, {
|
|
4240
4267
|
toValue: visible ? 1 : 0,
|
|
4241
4268
|
duration: 250,
|
|
4242
4269
|
useNativeDriver: true
|
|
4243
4270
|
}).start();
|
|
4244
4271
|
}, [visible, overlayOpacity]);
|
|
4245
|
-
(0,
|
|
4272
|
+
(0, import_react28.useEffect)(() => {
|
|
4246
4273
|
if (visible) setError(null);
|
|
4247
4274
|
}, [visible]);
|
|
4248
4275
|
const currentAvatarUrl = getAvatarUrl(avatarStyle, avatarSeed, bgColor);
|
|
4249
|
-
const saveAvatar = (0,
|
|
4276
|
+
const saveAvatar = (0, import_react28.useCallback)(async (newUrl) => {
|
|
4250
4277
|
setSaving(true);
|
|
4251
4278
|
setError(null);
|
|
4252
4279
|
try {
|
|
@@ -4259,16 +4286,16 @@ function UserProfileSheet({
|
|
|
4259
4286
|
setSaving(false);
|
|
4260
4287
|
}
|
|
4261
4288
|
}, [client, refreshUser, onAvatarUpdated]);
|
|
4262
|
-
const handleStyleChange = (0,
|
|
4289
|
+
const handleStyleChange = (0, import_react28.useCallback)((style) => {
|
|
4263
4290
|
setAvatarStyle(style);
|
|
4264
4291
|
saveAvatar(getAvatarUrl(style, avatarSeed, bgColor));
|
|
4265
4292
|
}, [avatarSeed, bgColor, saveAvatar]);
|
|
4266
|
-
const handleShuffle = (0,
|
|
4293
|
+
const handleShuffle = (0, import_react28.useCallback)(() => {
|
|
4267
4294
|
const newSeed = generateSeed();
|
|
4268
4295
|
setAvatarSeed(newSeed);
|
|
4269
4296
|
saveAvatar(getAvatarUrl(avatarStyle, newSeed, bgColor));
|
|
4270
4297
|
}, [avatarStyle, bgColor, saveAvatar]);
|
|
4271
|
-
const handleBgChange = (0,
|
|
4298
|
+
const handleBgChange = (0, import_react28.useCallback)((color) => {
|
|
4272
4299
|
setBgColor(color);
|
|
4273
4300
|
saveAvatar(getAvatarUrl(avatarStyle, avatarSeed, color));
|
|
4274
4301
|
}, [avatarStyle, avatarSeed, saveAvatar]);
|
|
@@ -4548,7 +4575,7 @@ var styles6 = import_react_native12.StyleSheet.create({
|
|
|
4548
4575
|
});
|
|
4549
4576
|
|
|
4550
4577
|
// src/ui/game/GamePoster.tsx
|
|
4551
|
-
var
|
|
4578
|
+
var import_react29 = require("react");
|
|
4552
4579
|
var import_react_native13 = require("react-native");
|
|
4553
4580
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
4554
4581
|
function computeCountdown(lockTimestamp) {
|
|
@@ -4598,7 +4625,7 @@ function GamePoster({ game, ImageComponent }) {
|
|
|
4598
4625
|
] });
|
|
4599
4626
|
}
|
|
4600
4627
|
function TeamLogoInternal({ url, size, Img }) {
|
|
4601
|
-
const [failed, setFailed] = (0,
|
|
4628
|
+
const [failed, setFailed] = (0, import_react29.useState)(false);
|
|
4602
4629
|
if (!url || failed) {
|
|
4603
4630
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native13.View, { style: [styles7.logoPlaceholder, { width: size, height: size, borderRadius: size / 2 }] });
|
|
4604
4631
|
}
|
|
@@ -4699,7 +4726,7 @@ var styles7 = import_react_native13.StyleSheet.create({
|
|
|
4699
4726
|
});
|
|
4700
4727
|
|
|
4701
4728
|
// src/ui/game/LivePoolsCard.tsx
|
|
4702
|
-
var
|
|
4729
|
+
var import_react30 = require("react");
|
|
4703
4730
|
var import_react_native14 = require("react-native");
|
|
4704
4731
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
4705
4732
|
function LivePoolsCard({
|
|
@@ -4715,7 +4742,7 @@ function LivePoolsCard({
|
|
|
4715
4742
|
const homePool = game.homePool || 0;
|
|
4716
4743
|
const awayPool = game.awayPool || 0;
|
|
4717
4744
|
const totalPool = game.totalPool || 0;
|
|
4718
|
-
const { homePercent, awayPercent, homeOdds, awayOdds } = (0,
|
|
4745
|
+
const { homePercent, awayPercent, homeOdds, awayOdds } = (0, import_react30.useMemo)(() => {
|
|
4719
4746
|
return {
|
|
4720
4747
|
homePercent: totalPool > 0 ? homePool / totalPool * 100 : 50,
|
|
4721
4748
|
awayPercent: totalPool > 0 ? awayPool / totalPool * 100 : 50,
|
|
@@ -4778,7 +4805,7 @@ var styles8 = import_react_native14.StyleSheet.create({
|
|
|
4778
4805
|
});
|
|
4779
4806
|
|
|
4780
4807
|
// src/ui/game/PickWinnerCard.tsx
|
|
4781
|
-
var
|
|
4808
|
+
var import_react31 = require("react");
|
|
4782
4809
|
var import_react_native15 = require("react-native");
|
|
4783
4810
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
4784
4811
|
function PickWinnerCard({
|
|
@@ -4796,7 +4823,7 @@ function PickWinnerCard({
|
|
|
4796
4823
|
const totalPool = game.totalPool || 0;
|
|
4797
4824
|
const homePool = game.homePool || 0;
|
|
4798
4825
|
const awayPool = game.awayPool || 0;
|
|
4799
|
-
const { homeOdds, awayOdds, homeBets, awayBets } = (0,
|
|
4826
|
+
const { homeOdds, awayOdds, homeBets, awayBets } = (0, import_react31.useMemo)(() => ({
|
|
4800
4827
|
homeOdds: homePool > 0 ? (totalPool / homePool).toFixed(2) : "\u2014",
|
|
4801
4828
|
awayOdds: awayPool > 0 ? (totalPool / awayPool).toFixed(2) : "\u2014",
|
|
4802
4829
|
homeBets: bettors.filter((b) => b.team === "home").length,
|
|
@@ -4849,7 +4876,7 @@ function TeamOption({
|
|
|
4849
4876
|
ImageComponent,
|
|
4850
4877
|
t
|
|
4851
4878
|
}) {
|
|
4852
|
-
const [imgFailed, setImgFailed] = (0,
|
|
4879
|
+
const [imgFailed, setImgFailed] = (0, import_react31.useState)(false);
|
|
4853
4880
|
const Img = ImageComponent || require("react-native").Image;
|
|
4854
4881
|
const showImage = imageUrl && !imgFailed;
|
|
4855
4882
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
@@ -4890,7 +4917,7 @@ var styles9 = import_react_native15.StyleSheet.create({
|
|
|
4890
4917
|
});
|
|
4891
4918
|
|
|
4892
4919
|
// src/ui/game/PlayersCard.tsx
|
|
4893
|
-
var
|
|
4920
|
+
var import_react32 = require("react");
|
|
4894
4921
|
var import_react_native16 = require("react-native");
|
|
4895
4922
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
4896
4923
|
function truncateWallet(addr, chars) {
|
|
@@ -4939,7 +4966,7 @@ function BettorRow({
|
|
|
4939
4966
|
ImageComponent,
|
|
4940
4967
|
t
|
|
4941
4968
|
}) {
|
|
4942
|
-
const [imgFailed, setImgFailed] = (0,
|
|
4969
|
+
const [imgFailed, setImgFailed] = (0, import_react32.useState)(false);
|
|
4943
4970
|
const Img = ImageComponent || require("react-native").Image;
|
|
4944
4971
|
const showAvatar = bettor.avatar && !imgFailed;
|
|
4945
4972
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native16.View, { style: [styles10.row, !isFirst && { borderTopColor: t.border, borderTopWidth: 1 }], children: [
|
|
@@ -4966,7 +4993,7 @@ var styles10 = import_react_native16.StyleSheet.create({
|
|
|
4966
4993
|
});
|
|
4967
4994
|
|
|
4968
4995
|
// src/ui/game/JoinGameButton.tsx
|
|
4969
|
-
var
|
|
4996
|
+
var import_react33 = require("react");
|
|
4970
4997
|
var import_react_native17 = require("react-native");
|
|
4971
4998
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
4972
4999
|
var STATUS_LABELS = {
|
|
@@ -4977,7 +5004,7 @@ var STATUS_LABELS = {
|
|
|
4977
5004
|
};
|
|
4978
5005
|
function JoinGameButton({ game, walletAddress, selectedTeam, status, onJoin }) {
|
|
4979
5006
|
const t = useDubsTheme();
|
|
4980
|
-
const alreadyJoined = (0,
|
|
5007
|
+
const alreadyJoined = (0, import_react33.useMemo)(() => {
|
|
4981
5008
|
if (!walletAddress) return false;
|
|
4982
5009
|
return (game.bettors || []).some((b) => b.wallet === walletAddress);
|
|
4983
5010
|
}, [game.bettors, walletAddress]);
|
|
@@ -5018,7 +5045,7 @@ var styles11 = import_react_native17.StyleSheet.create({
|
|
|
5018
5045
|
});
|
|
5019
5046
|
|
|
5020
5047
|
// src/ui/game/CreateCustomGameSheet.tsx
|
|
5021
|
-
var
|
|
5048
|
+
var import_react34 = require("react");
|
|
5022
5049
|
var import_react_native18 = require("react-native");
|
|
5023
5050
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
5024
5051
|
var STATUS_LABELS2 = {
|
|
@@ -5044,18 +5071,18 @@ function CreateCustomGameSheet({
|
|
|
5044
5071
|
const t = useDubsTheme();
|
|
5045
5072
|
const { wallet } = useDubs();
|
|
5046
5073
|
const mutation = useCreateCustomGame();
|
|
5047
|
-
const [selectedAmount, setSelectedAmount] = (0,
|
|
5048
|
-
const [customAmount, setCustomAmount] = (0,
|
|
5049
|
-
const [isCustom, setIsCustom] = (0,
|
|
5050
|
-
const overlayOpacity = (0,
|
|
5051
|
-
(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)(() => {
|
|
5052
5079
|
import_react_native18.Animated.timing(overlayOpacity, {
|
|
5053
5080
|
toValue: visible ? 1 : 0,
|
|
5054
5081
|
duration: 250,
|
|
5055
5082
|
useNativeDriver: true
|
|
5056
5083
|
}).start();
|
|
5057
5084
|
}, [visible, overlayOpacity]);
|
|
5058
|
-
(0,
|
|
5085
|
+
(0, import_react34.useEffect)(() => {
|
|
5059
5086
|
if (visible) {
|
|
5060
5087
|
setSelectedAmount(defaultAmount ?? null);
|
|
5061
5088
|
setCustomAmount("");
|
|
@@ -5063,7 +5090,7 @@ function CreateCustomGameSheet({
|
|
|
5063
5090
|
mutation.reset();
|
|
5064
5091
|
}
|
|
5065
5092
|
}, [visible]);
|
|
5066
|
-
(0,
|
|
5093
|
+
(0, import_react34.useEffect)(() => {
|
|
5067
5094
|
if (mutation.status === "success" && mutation.data) {
|
|
5068
5095
|
onSuccess?.(mutation.data);
|
|
5069
5096
|
const timer = setTimeout(() => {
|
|
@@ -5072,23 +5099,23 @@ function CreateCustomGameSheet({
|
|
|
5072
5099
|
return () => clearTimeout(timer);
|
|
5073
5100
|
}
|
|
5074
5101
|
}, [mutation.status, mutation.data]);
|
|
5075
|
-
(0,
|
|
5102
|
+
(0, import_react34.useEffect)(() => {
|
|
5076
5103
|
if (mutation.status === "error" && mutation.error) {
|
|
5077
5104
|
onError?.(mutation.error);
|
|
5078
5105
|
}
|
|
5079
5106
|
}, [mutation.status, mutation.error]);
|
|
5080
|
-
const handlePresetSelect = (0,
|
|
5107
|
+
const handlePresetSelect = (0, import_react34.useCallback)((amount) => {
|
|
5081
5108
|
setSelectedAmount(amount);
|
|
5082
5109
|
setIsCustom(false);
|
|
5083
5110
|
setCustomAmount("");
|
|
5084
5111
|
onAmountChange?.(amount);
|
|
5085
5112
|
}, [onAmountChange]);
|
|
5086
|
-
const handleCustomSelect = (0,
|
|
5113
|
+
const handleCustomSelect = (0, import_react34.useCallback)(() => {
|
|
5087
5114
|
setIsCustom(true);
|
|
5088
5115
|
setSelectedAmount(null);
|
|
5089
5116
|
onAmountChange?.(null);
|
|
5090
5117
|
}, [onAmountChange]);
|
|
5091
|
-
const handleCustomAmountChange = (0,
|
|
5118
|
+
const handleCustomAmountChange = (0, import_react34.useCallback)((text) => {
|
|
5092
5119
|
const cleaned = text.replace(/[^0-9.]/g, "").replace(/(\..*?)\..*/g, "$1");
|
|
5093
5120
|
setCustomAmount(cleaned);
|
|
5094
5121
|
const parsed = parseFloat(cleaned);
|
|
@@ -5103,7 +5130,7 @@ function CreateCustomGameSheet({
|
|
|
5103
5130
|
const winnerTakes = pot * (1 - fee / 100);
|
|
5104
5131
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
5105
5132
|
const canCreate = finalAmount !== null && finalAmount > 0 && !isMutating && mutation.status !== "success";
|
|
5106
|
-
const handleCreate = (0,
|
|
5133
|
+
const handleCreate = (0, import_react34.useCallback)(async () => {
|
|
5107
5134
|
if (!finalAmount || !wallet.publicKey) return;
|
|
5108
5135
|
try {
|
|
5109
5136
|
await mutation.execute({
|
|
@@ -5372,11 +5399,11 @@ var styles12 = import_react_native18.StyleSheet.create({
|
|
|
5372
5399
|
});
|
|
5373
5400
|
|
|
5374
5401
|
// src/ui/game/JoinGameSheet.tsx
|
|
5375
|
-
var
|
|
5402
|
+
var import_react37 = require("react");
|
|
5376
5403
|
var import_react_native21 = require("react-native");
|
|
5377
5404
|
|
|
5378
5405
|
// src/ui/game/SolSlider.tsx
|
|
5379
|
-
var
|
|
5406
|
+
var import_react35 = require("react");
|
|
5380
5407
|
var import_react_native19 = require("react-native");
|
|
5381
5408
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
5382
5409
|
var THUMB_SIZE = 32;
|
|
@@ -5395,9 +5422,9 @@ function SolSlider({
|
|
|
5395
5422
|
}) {
|
|
5396
5423
|
const t = useDubsTheme();
|
|
5397
5424
|
const accent = accentColor || t.accent;
|
|
5398
|
-
const trackRef = (0,
|
|
5399
|
-
const trackWidth = (0,
|
|
5400
|
-
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);
|
|
5401
5428
|
const clamp = (v) => {
|
|
5402
5429
|
const stepped = Math.round(v / step) * step;
|
|
5403
5430
|
return Math.max(min, Math.min(max, parseFloat(stepped.toFixed(4))));
|
|
@@ -5410,7 +5437,7 @@ function SolSlider({
|
|
|
5410
5437
|
const ratio2 = Math.max(0, Math.min(1, x / trackWidth.current));
|
|
5411
5438
|
return clamp(min + ratio2 * (max - min));
|
|
5412
5439
|
};
|
|
5413
|
-
const panResponder = (0,
|
|
5440
|
+
const panResponder = (0, import_react35.useRef)(
|
|
5414
5441
|
import_react_native19.PanResponder.create({
|
|
5415
5442
|
onStartShouldSetPanResponder: () => !disabled,
|
|
5416
5443
|
onMoveShouldSetPanResponder: () => !disabled,
|
|
@@ -5565,7 +5592,7 @@ var styles13 = import_react_native19.StyleSheet.create({
|
|
|
5565
5592
|
});
|
|
5566
5593
|
|
|
5567
5594
|
// src/ui/game/TeamButton.tsx
|
|
5568
|
-
var
|
|
5595
|
+
var import_react36 = require("react");
|
|
5569
5596
|
var import_react_native20 = require("react-native");
|
|
5570
5597
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
5571
5598
|
function TeamButton({
|
|
@@ -5579,7 +5606,7 @@ function TeamButton({
|
|
|
5579
5606
|
ImageComponent,
|
|
5580
5607
|
t
|
|
5581
5608
|
}) {
|
|
5582
|
-
const [imgFailed, setImgFailed] = (0,
|
|
5609
|
+
const [imgFailed, setImgFailed] = (0, import_react36.useState)(false);
|
|
5583
5610
|
const Img = ImageComponent || require("react-native").Image;
|
|
5584
5611
|
const showImage = imageUrl && !imgFailed;
|
|
5585
5612
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
@@ -5683,20 +5710,20 @@ function JoinGameSheet({
|
|
|
5683
5710
|
const { wallet } = useDubs();
|
|
5684
5711
|
const mutation = useJoinGame();
|
|
5685
5712
|
const isCustomGame = game.gameMode === CUSTOM_GAME_MODE;
|
|
5686
|
-
const [selectedTeam, setSelectedTeam] = (0,
|
|
5687
|
-
const [wager, setWager] = (0,
|
|
5688
|
-
const [showSuccess, setShowSuccess] = (0,
|
|
5689
|
-
const overlayOpacity = (0,
|
|
5690
|
-
const successScale = (0,
|
|
5691
|
-
const successOpacity = (0,
|
|
5692
|
-
(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)(() => {
|
|
5693
5720
|
import_react_native21.Animated.timing(overlayOpacity, {
|
|
5694
5721
|
toValue: visible ? 1 : 0,
|
|
5695
5722
|
duration: 250,
|
|
5696
5723
|
useNativeDriver: true
|
|
5697
5724
|
}).start();
|
|
5698
5725
|
}, [visible, overlayOpacity]);
|
|
5699
|
-
(0,
|
|
5726
|
+
(0, import_react37.useEffect)(() => {
|
|
5700
5727
|
if (visible) {
|
|
5701
5728
|
setSelectedTeam(isPoolModeEnabled ? "home" : isCustomGame ? "away" : null);
|
|
5702
5729
|
setWager(game.buyIn);
|
|
@@ -5706,7 +5733,7 @@ function JoinGameSheet({
|
|
|
5706
5733
|
mutation.reset();
|
|
5707
5734
|
}
|
|
5708
5735
|
}, [visible]);
|
|
5709
|
-
(0,
|
|
5736
|
+
(0, import_react37.useEffect)(() => {
|
|
5710
5737
|
if (mutation.status === "success" && mutation.data) {
|
|
5711
5738
|
setShowSuccess(true);
|
|
5712
5739
|
onSuccess?.(mutation.data);
|
|
@@ -5723,7 +5750,7 @@ function JoinGameSheet({
|
|
|
5723
5750
|
return () => clearTimeout(timer);
|
|
5724
5751
|
}
|
|
5725
5752
|
}, [mutation.status, mutation.data]);
|
|
5726
|
-
(0,
|
|
5753
|
+
(0, import_react37.useEffect)(() => {
|
|
5727
5754
|
if (mutation.status === "error" && mutation.error) {
|
|
5728
5755
|
onError?.(mutation.error);
|
|
5729
5756
|
}
|
|
@@ -5738,7 +5765,7 @@ function JoinGameSheet({
|
|
|
5738
5765
|
const drawBettors = bettors.filter((b) => b.team === "draw");
|
|
5739
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));
|
|
5740
5767
|
const poolAfterJoin = totalPool + wager;
|
|
5741
|
-
const { homeOdds, awayOdds, drawOdds, homeBets, awayBets, drawBets } = (0,
|
|
5768
|
+
const { homeOdds, awayOdds, drawOdds, homeBets, awayBets, drawBets } = (0, import_react37.useMemo)(() => {
|
|
5742
5769
|
const homeBetsCount = bettors.filter((b) => b.team === "home").length;
|
|
5743
5770
|
const awayBetsCount = bettors.filter((b) => b.team === "away").length;
|
|
5744
5771
|
const drawBetsCount = bettors.filter((b) => b.team === "draw").length;
|
|
@@ -5759,7 +5786,7 @@ function JoinGameSheet({
|
|
|
5759
5786
|
const potentialWinnings = selectedOdds !== "\u2014" ? formatSol(parseFloat(selectedOdds) * wager) : "\u2014";
|
|
5760
5787
|
const homeName = shortName ? shortName(opponents[0]?.name) : opponents[0]?.name || "Home";
|
|
5761
5788
|
const awayName = shortName ? shortName(opponents[1]?.name) : opponents[1]?.name || "Away";
|
|
5762
|
-
const myBet = (0,
|
|
5789
|
+
const myBet = (0, import_react37.useMemo)(() => {
|
|
5763
5790
|
if (!wallet.publicKey) return null;
|
|
5764
5791
|
const addr = wallet.publicKey.toBase58();
|
|
5765
5792
|
return bettors.find((b) => b.wallet === addr) ?? null;
|
|
@@ -5767,7 +5794,7 @@ function JoinGameSheet({
|
|
|
5767
5794
|
const alreadyJoined = myBet !== null;
|
|
5768
5795
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
5769
5796
|
const canJoin = selectedTeam !== null && !isMutating && mutation.status !== "success" && !alreadyJoined;
|
|
5770
|
-
const handleJoin = (0,
|
|
5797
|
+
const handleJoin = (0, import_react37.useCallback)(async () => {
|
|
5771
5798
|
if (!selectedTeam || !wallet.publicKey) return;
|
|
5772
5799
|
try {
|
|
5773
5800
|
await mutation.execute({
|
|
@@ -5827,13 +5854,15 @@ function JoinGameSheet({
|
|
|
5827
5854
|
] }) })
|
|
5828
5855
|
] })
|
|
5829
5856
|
] }),
|
|
5830
|
-
!isCustomGame && !isPoolModeEnabled && !alreadyJoined &&
|
|
5831
|
-
/*
|
|
5832
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: styles15.
|
|
5857
|
+
!isCustomGame && !isPoolModeEnabled && !alreadyJoined && (hasDrawOption ? (
|
|
5858
|
+
/* ── 3-way layout: Home / VS / Away / OR / Draw ── */
|
|
5859
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: styles15.section, children: [
|
|
5860
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.sectionLabel, { color: t.textSecondary }], children: "Who will win?" }),
|
|
5833
5861
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5834
|
-
|
|
5862
|
+
PickRow,
|
|
5835
5863
|
{
|
|
5836
5864
|
name: homeName,
|
|
5865
|
+
subtitle: "Home Team",
|
|
5837
5866
|
imageUrl: opponents[0]?.imageUrl,
|
|
5838
5867
|
odds: homeOdds,
|
|
5839
5868
|
bets: homeBets,
|
|
@@ -5847,10 +5876,16 @@ function JoinGameSheet({
|
|
|
5847
5876
|
t
|
|
5848
5877
|
}
|
|
5849
5878
|
),
|
|
5879
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: styles15.dividerRow, children: [
|
|
5880
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.View, { style: [styles15.dividerLine, { backgroundColor: t.border }] }),
|
|
5881
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.dividerText, { color: t.textMuted }], children: "VS" }),
|
|
5882
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.View, { style: [styles15.dividerLine, { backgroundColor: t.border }] })
|
|
5883
|
+
] }),
|
|
5850
5884
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5851
|
-
|
|
5885
|
+
PickRow,
|
|
5852
5886
|
{
|
|
5853
5887
|
name: awayName,
|
|
5888
|
+
subtitle: "Away Team",
|
|
5854
5889
|
imageUrl: opponents[1]?.imageUrl,
|
|
5855
5890
|
odds: awayOdds,
|
|
5856
5891
|
bets: awayBets,
|
|
@@ -5863,24 +5898,71 @@ function JoinGameSheet({
|
|
|
5863
5898
|
ImageComponent,
|
|
5864
5899
|
t
|
|
5865
5900
|
}
|
|
5901
|
+
),
|
|
5902
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: styles15.dividerRow, children: [
|
|
5903
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.View, { style: [styles15.dividerLine, { backgroundColor: t.border }] }),
|
|
5904
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.dividerText, { color: t.textMuted }], children: "OR" }),
|
|
5905
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.View, { style: [styles15.dividerLine, { backgroundColor: t.border }] })
|
|
5906
|
+
] }),
|
|
5907
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5908
|
+
PickRow,
|
|
5909
|
+
{
|
|
5910
|
+
name: "Draw",
|
|
5911
|
+
subtitle: "Match ends in a tie",
|
|
5912
|
+
odds: drawOdds,
|
|
5913
|
+
bets: drawBets,
|
|
5914
|
+
color: drawColor,
|
|
5915
|
+
selected: selectedTeam === "draw",
|
|
5916
|
+
onPress: () => {
|
|
5917
|
+
setSelectedTeam("draw");
|
|
5918
|
+
onTeamSelect?.("draw");
|
|
5919
|
+
},
|
|
5920
|
+
t
|
|
5921
|
+
}
|
|
5866
5922
|
)
|
|
5867
|
-
] })
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5923
|
+
] })
|
|
5924
|
+
) : (
|
|
5925
|
+
/* ── 2-way layout: side by side ── */
|
|
5926
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: styles15.section, children: [
|
|
5927
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.sectionLabel, { color: t.textSecondary }], children: "Pick Your Side" }),
|
|
5928
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: styles15.teamsRow, children: [
|
|
5929
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5930
|
+
TeamButton,
|
|
5931
|
+
{
|
|
5932
|
+
name: homeName,
|
|
5933
|
+
imageUrl: opponents[0]?.imageUrl,
|
|
5934
|
+
odds: homeOdds,
|
|
5935
|
+
bets: homeBets,
|
|
5936
|
+
color: homeColor,
|
|
5937
|
+
selected: selectedTeam === "home",
|
|
5938
|
+
onPress: () => {
|
|
5939
|
+
setSelectedTeam("home");
|
|
5940
|
+
onTeamSelect?.("home");
|
|
5941
|
+
},
|
|
5942
|
+
ImageComponent,
|
|
5943
|
+
t
|
|
5944
|
+
}
|
|
5945
|
+
),
|
|
5946
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5947
|
+
TeamButton,
|
|
5948
|
+
{
|
|
5949
|
+
name: awayName,
|
|
5950
|
+
imageUrl: opponents[1]?.imageUrl,
|
|
5951
|
+
odds: awayOdds,
|
|
5952
|
+
bets: awayBets,
|
|
5953
|
+
color: awayColor,
|
|
5954
|
+
selected: selectedTeam === "away",
|
|
5955
|
+
onPress: () => {
|
|
5956
|
+
setSelectedTeam("away");
|
|
5957
|
+
onTeamSelect?.("away");
|
|
5958
|
+
},
|
|
5959
|
+
ImageComponent,
|
|
5960
|
+
t
|
|
5961
|
+
}
|
|
5962
|
+
)
|
|
5963
|
+
] })
|
|
5964
|
+
] })
|
|
5965
|
+
)),
|
|
5884
5966
|
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: [
|
|
5885
5967
|
/* @__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" }),
|
|
5886
5968
|
/* @__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" }),
|
|
@@ -5963,6 +6045,100 @@ function JoinGameSheet({
|
|
|
5963
6045
|
}
|
|
5964
6046
|
);
|
|
5965
6047
|
}
|
|
6048
|
+
function PickRow({
|
|
6049
|
+
name,
|
|
6050
|
+
subtitle,
|
|
6051
|
+
imageUrl,
|
|
6052
|
+
odds,
|
|
6053
|
+
bets,
|
|
6054
|
+
color,
|
|
6055
|
+
selected,
|
|
6056
|
+
onPress,
|
|
6057
|
+
ImageComponent,
|
|
6058
|
+
t
|
|
6059
|
+
}) {
|
|
6060
|
+
const [imgFailed, setImgFailed] = (0, import_react37.useState)(false);
|
|
6061
|
+
const Img = ImageComponent || require("react-native").Image;
|
|
6062
|
+
const showImage = imageUrl && !imgFailed;
|
|
6063
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
6064
|
+
import_react_native21.TouchableOpacity,
|
|
6065
|
+
{
|
|
6066
|
+
style: [pickStyles.row, { borderColor: selected ? color : t.border, backgroundColor: selected ? color + "12" : t.background }],
|
|
6067
|
+
onPress,
|
|
6068
|
+
activeOpacity: 0.7,
|
|
6069
|
+
children: [
|
|
6070
|
+
showImage ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Img, { source: { uri: imageUrl }, style: pickStyles.logo, resizeMode: "contain", onError: () => setImgFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.View, { style: [pickStyles.logoPlaceholder, { backgroundColor: color + "20" }], children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [pickStyles.logoEmoji, { color }], children: name === "Draw" ? "\u{1F91D}" : name.charAt(0) }) }),
|
|
6071
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: pickStyles.info, children: [
|
|
6072
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [pickStyles.name, { color: t.text }], children: name }),
|
|
6073
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [pickStyles.subtitle, { color: t.textMuted }], children: subtitle })
|
|
6074
|
+
] }),
|
|
6075
|
+
odds !== "\u2014" && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.Text, { style: [pickStyles.odds, { color }], children: [
|
|
6076
|
+
odds,
|
|
6077
|
+
"x"
|
|
6078
|
+
] }),
|
|
6079
|
+
bets > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [pickStyles.bets, { color: t.textMuted }], children: bets }),
|
|
6080
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.View, { style: [pickStyles.check, { backgroundColor: color }], children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: pickStyles.checkText, children: "\u2713" }) })
|
|
6081
|
+
]
|
|
6082
|
+
}
|
|
6083
|
+
);
|
|
6084
|
+
}
|
|
6085
|
+
var pickStyles = import_react_native21.StyleSheet.create({
|
|
6086
|
+
row: {
|
|
6087
|
+
flexDirection: "row",
|
|
6088
|
+
alignItems: "center",
|
|
6089
|
+
borderWidth: 1.5,
|
|
6090
|
+
borderRadius: 14,
|
|
6091
|
+
paddingVertical: 12,
|
|
6092
|
+
paddingHorizontal: 14,
|
|
6093
|
+
gap: 12
|
|
6094
|
+
},
|
|
6095
|
+
logo: {
|
|
6096
|
+
width: 36,
|
|
6097
|
+
height: 36,
|
|
6098
|
+
borderRadius: 18
|
|
6099
|
+
},
|
|
6100
|
+
logoPlaceholder: {
|
|
6101
|
+
width: 36,
|
|
6102
|
+
height: 36,
|
|
6103
|
+
borderRadius: 18,
|
|
6104
|
+
alignItems: "center",
|
|
6105
|
+
justifyContent: "center"
|
|
6106
|
+
},
|
|
6107
|
+
logoEmoji: {
|
|
6108
|
+
fontSize: 16,
|
|
6109
|
+
fontWeight: "800"
|
|
6110
|
+
},
|
|
6111
|
+
info: {
|
|
6112
|
+
flex: 1
|
|
6113
|
+
},
|
|
6114
|
+
name: {
|
|
6115
|
+
fontSize: 15,
|
|
6116
|
+
fontWeight: "700"
|
|
6117
|
+
},
|
|
6118
|
+
subtitle: {
|
|
6119
|
+
fontSize: 12,
|
|
6120
|
+
marginTop: 1
|
|
6121
|
+
},
|
|
6122
|
+
odds: {
|
|
6123
|
+
fontSize: 16,
|
|
6124
|
+
fontWeight: "800"
|
|
6125
|
+
},
|
|
6126
|
+
bets: {
|
|
6127
|
+
fontSize: 12
|
|
6128
|
+
},
|
|
6129
|
+
check: {
|
|
6130
|
+
width: 22,
|
|
6131
|
+
height: 22,
|
|
6132
|
+
borderRadius: 11,
|
|
6133
|
+
alignItems: "center",
|
|
6134
|
+
justifyContent: "center"
|
|
6135
|
+
},
|
|
6136
|
+
checkText: {
|
|
6137
|
+
color: "#FFF",
|
|
6138
|
+
fontSize: 13,
|
|
6139
|
+
fontWeight: "800"
|
|
6140
|
+
}
|
|
6141
|
+
});
|
|
5966
6142
|
var styles15 = import_react_native21.StyleSheet.create({
|
|
5967
6143
|
overlay: {
|
|
5968
6144
|
...import_react_native21.StyleSheet.absoluteFillObject,
|
|
@@ -6085,6 +6261,20 @@ var styles15 = import_react_native21.StyleSheet.create({
|
|
|
6085
6261
|
drawRow: {
|
|
6086
6262
|
marginTop: 8
|
|
6087
6263
|
},
|
|
6264
|
+
dividerRow: {
|
|
6265
|
+
flexDirection: "row",
|
|
6266
|
+
alignItems: "center",
|
|
6267
|
+
gap: 12,
|
|
6268
|
+
marginVertical: 6
|
|
6269
|
+
},
|
|
6270
|
+
dividerLine: {
|
|
6271
|
+
flex: 1,
|
|
6272
|
+
height: 1
|
|
6273
|
+
},
|
|
6274
|
+
dividerText: {
|
|
6275
|
+
fontSize: 12,
|
|
6276
|
+
fontWeight: "700"
|
|
6277
|
+
},
|
|
6088
6278
|
summaryCard: {
|
|
6089
6279
|
marginTop: 20,
|
|
6090
6280
|
borderRadius: 16,
|
|
@@ -6160,7 +6350,7 @@ var styles15 = import_react_native21.StyleSheet.create({
|
|
|
6160
6350
|
});
|
|
6161
6351
|
|
|
6162
6352
|
// src/ui/game/ClaimPrizeSheet.tsx
|
|
6163
|
-
var
|
|
6353
|
+
var import_react38 = require("react");
|
|
6164
6354
|
var import_react_native22 = require("react-native");
|
|
6165
6355
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
6166
6356
|
var STATUS_LABELS4 = {
|
|
@@ -6181,18 +6371,18 @@ function ClaimPrizeSheet({
|
|
|
6181
6371
|
const t = useDubsTheme();
|
|
6182
6372
|
const { wallet } = useDubs();
|
|
6183
6373
|
const mutation = useClaim();
|
|
6184
|
-
const overlayOpacity = (0,
|
|
6185
|
-
const celebrationScale = (0,
|
|
6186
|
-
const celebrationOpacity = (0,
|
|
6187
|
-
const [showCelebration, setShowCelebration] = (0,
|
|
6188
|
-
(0,
|
|
6374
|
+
const overlayOpacity = (0, import_react38.useRef)(new import_react_native22.Animated.Value(0)).current;
|
|
6375
|
+
const celebrationScale = (0, import_react38.useRef)(new import_react_native22.Animated.Value(0)).current;
|
|
6376
|
+
const celebrationOpacity = (0, import_react38.useRef)(new import_react_native22.Animated.Value(0)).current;
|
|
6377
|
+
const [showCelebration, setShowCelebration] = (0, import_react38.useState)(false);
|
|
6378
|
+
(0, import_react38.useEffect)(() => {
|
|
6189
6379
|
import_react_native22.Animated.timing(overlayOpacity, {
|
|
6190
6380
|
toValue: visible ? 1 : 0,
|
|
6191
6381
|
duration: 250,
|
|
6192
6382
|
useNativeDriver: true
|
|
6193
6383
|
}).start();
|
|
6194
6384
|
}, [visible, overlayOpacity]);
|
|
6195
|
-
(0,
|
|
6385
|
+
(0, import_react38.useEffect)(() => {
|
|
6196
6386
|
if (visible) {
|
|
6197
6387
|
mutation.reset();
|
|
6198
6388
|
setShowCelebration(false);
|
|
@@ -6200,7 +6390,7 @@ function ClaimPrizeSheet({
|
|
|
6200
6390
|
celebrationOpacity.setValue(0);
|
|
6201
6391
|
}
|
|
6202
6392
|
}, [visible]);
|
|
6203
|
-
(0,
|
|
6393
|
+
(0, import_react38.useEffect)(() => {
|
|
6204
6394
|
if (mutation.status === "success" && mutation.data) {
|
|
6205
6395
|
setShowCelebration(true);
|
|
6206
6396
|
import_react_native22.Animated.parallel([
|
|
@@ -6223,14 +6413,14 @@ function ClaimPrizeSheet({
|
|
|
6223
6413
|
return () => clearTimeout(timer);
|
|
6224
6414
|
}
|
|
6225
6415
|
}, [mutation.status, mutation.data]);
|
|
6226
|
-
(0,
|
|
6416
|
+
(0, import_react38.useEffect)(() => {
|
|
6227
6417
|
if (mutation.status === "error" && mutation.error) {
|
|
6228
6418
|
onError?.(mutation.error);
|
|
6229
6419
|
}
|
|
6230
6420
|
}, [mutation.status, mutation.error]);
|
|
6231
6421
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
6232
6422
|
const canClaim = !isMutating && mutation.status !== "success" && !!wallet.publicKey;
|
|
6233
|
-
const handleClaim = (0,
|
|
6423
|
+
const handleClaim = (0, import_react38.useCallback)(async () => {
|
|
6234
6424
|
if (!wallet.publicKey) return;
|
|
6235
6425
|
try {
|
|
6236
6426
|
await mutation.execute({
|
|
@@ -6463,7 +6653,7 @@ var styles16 = import_react_native22.StyleSheet.create({
|
|
|
6463
6653
|
});
|
|
6464
6654
|
|
|
6465
6655
|
// src/ui/game/ClaimButton.tsx
|
|
6466
|
-
var
|
|
6656
|
+
var import_react39 = require("react");
|
|
6467
6657
|
var import_react_native23 = require("react-native");
|
|
6468
6658
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
6469
6659
|
function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
@@ -6471,9 +6661,9 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
6471
6661
|
const { wallet } = useDubs();
|
|
6472
6662
|
const game = useGame(gameId);
|
|
6473
6663
|
const claimStatus = useHasClaimed(gameId);
|
|
6474
|
-
const [sheetVisible, setSheetVisible] = (0,
|
|
6664
|
+
const [sheetVisible, setSheetVisible] = (0, import_react39.useState)(false);
|
|
6475
6665
|
const walletAddress = wallet.publicKey?.toBase58() ?? null;
|
|
6476
|
-
const myBet = (0,
|
|
6666
|
+
const myBet = (0, import_react39.useMemo)(() => {
|
|
6477
6667
|
if (!walletAddress || !game.data?.bettors) return null;
|
|
6478
6668
|
return game.data.bettors.find((b) => b.wallet === walletAddress) ?? null;
|
|
6479
6669
|
}, [walletAddress, game.data?.bettors]);
|
|
@@ -6482,7 +6672,7 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
6482
6672
|
const isWinner = isResolved && myBet != null && myBet.team === game.data?.winnerSide;
|
|
6483
6673
|
const isEligible = myBet != null && isResolved && (isWinner || isRefund);
|
|
6484
6674
|
const prizeAmount = isRefund ? myBet?.amount ?? 0 : game.data?.totalPool ?? 0;
|
|
6485
|
-
const handleSuccess = (0,
|
|
6675
|
+
const handleSuccess = (0, import_react39.useCallback)(
|
|
6486
6676
|
(result) => {
|
|
6487
6677
|
claimStatus.refetch();
|
|
6488
6678
|
onSuccess?.(result);
|
|
@@ -6569,7 +6759,7 @@ var styles17 = import_react_native23.StyleSheet.create({
|
|
|
6569
6759
|
});
|
|
6570
6760
|
|
|
6571
6761
|
// src/ui/game/EnterArcadePoolSheet.tsx
|
|
6572
|
-
var
|
|
6762
|
+
var import_react40 = require("react");
|
|
6573
6763
|
var import_react_native24 = require("react-native");
|
|
6574
6764
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
6575
6765
|
var STATUS_LABELS5 = {
|
|
@@ -6590,20 +6780,20 @@ function EnterArcadePoolSheet({
|
|
|
6590
6780
|
const t = useDubsTheme();
|
|
6591
6781
|
const { wallet } = useDubs();
|
|
6592
6782
|
const mutation = useEnterArcadePool();
|
|
6593
|
-
const overlayOpacity = (0,
|
|
6594
|
-
(0,
|
|
6783
|
+
const overlayOpacity = (0, import_react40.useRef)(new import_react_native24.Animated.Value(0)).current;
|
|
6784
|
+
(0, import_react40.useEffect)(() => {
|
|
6595
6785
|
import_react_native24.Animated.timing(overlayOpacity, {
|
|
6596
6786
|
toValue: visible ? 1 : 0,
|
|
6597
6787
|
duration: 250,
|
|
6598
6788
|
useNativeDriver: true
|
|
6599
6789
|
}).start();
|
|
6600
6790
|
}, [visible, overlayOpacity]);
|
|
6601
|
-
(0,
|
|
6791
|
+
(0, import_react40.useEffect)(() => {
|
|
6602
6792
|
if (visible) {
|
|
6603
6793
|
mutation.reset();
|
|
6604
6794
|
}
|
|
6605
6795
|
}, [visible]);
|
|
6606
|
-
(0,
|
|
6796
|
+
(0, import_react40.useEffect)(() => {
|
|
6607
6797
|
if (mutation.status === "success" && mutation.data) {
|
|
6608
6798
|
onSuccess?.(mutation.data);
|
|
6609
6799
|
const timer = setTimeout(() => {
|
|
@@ -6612,7 +6802,7 @@ function EnterArcadePoolSheet({
|
|
|
6612
6802
|
return () => clearTimeout(timer);
|
|
6613
6803
|
}
|
|
6614
6804
|
}, [mutation.status, mutation.data]);
|
|
6615
|
-
(0,
|
|
6805
|
+
(0, import_react40.useEffect)(() => {
|
|
6616
6806
|
if (mutation.status === "error" && mutation.error) {
|
|
6617
6807
|
onError?.(mutation.error);
|
|
6618
6808
|
}
|
|
@@ -6624,7 +6814,7 @@ function EnterArcadePoolSheet({
|
|
|
6624
6814
|
const potSol = (pool.buy_in_lamports * Number(totalBuyIns) / 1e9).toFixed(4);
|
|
6625
6815
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
6626
6816
|
const canJoin = !isMutating && mutation.status !== "success";
|
|
6627
|
-
const handleJoin = (0,
|
|
6817
|
+
const handleJoin = (0, import_react40.useCallback)(async () => {
|
|
6628
6818
|
if (!wallet.publicKey) return;
|
|
6629
6819
|
try {
|
|
6630
6820
|
await mutation.execute(pool.id);
|
|
@@ -6775,7 +6965,7 @@ var styles18 = import_react_native24.StyleSheet.create({
|
|
|
6775
6965
|
});
|
|
6776
6966
|
|
|
6777
6967
|
// src/ui/game/ArcadeLeaderboardSheet.tsx
|
|
6778
|
-
var
|
|
6968
|
+
var import_react41 = require("react");
|
|
6779
6969
|
var import_react_native25 = require("react-native");
|
|
6780
6970
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
6781
6971
|
function RankLabel({ index }) {
|
|
@@ -6792,15 +6982,15 @@ function ArcadeLeaderboardSheet({
|
|
|
6792
6982
|
}) {
|
|
6793
6983
|
const t = useDubsTheme();
|
|
6794
6984
|
const { pool, leaderboard, stats, loading, refetch } = useArcadePool(poolId);
|
|
6795
|
-
const overlayOpacity = (0,
|
|
6796
|
-
(0,
|
|
6985
|
+
const overlayOpacity = (0, import_react41.useRef)(new import_react_native25.Animated.Value(0)).current;
|
|
6986
|
+
(0, import_react41.useEffect)(() => {
|
|
6797
6987
|
import_react_native25.Animated.timing(overlayOpacity, {
|
|
6798
6988
|
toValue: visible ? 1 : 0,
|
|
6799
6989
|
duration: 250,
|
|
6800
6990
|
useNativeDriver: true
|
|
6801
6991
|
}).start();
|
|
6802
6992
|
}, [visible, overlayOpacity]);
|
|
6803
|
-
(0,
|
|
6993
|
+
(0, import_react41.useEffect)(() => {
|
|
6804
6994
|
if (visible) refetch();
|
|
6805
6995
|
}, [visible]);
|
|
6806
6996
|
const renderItem = ({ item, index }) => {
|
|
@@ -6947,7 +7137,7 @@ var styles19 = import_react_native25.StyleSheet.create({
|
|
|
6947
7137
|
});
|
|
6948
7138
|
|
|
6949
7139
|
// src/ui/game/CreateGameSheet.tsx
|
|
6950
|
-
var
|
|
7140
|
+
var import_react42 = require("react");
|
|
6951
7141
|
var import_react_native26 = require("react-native");
|
|
6952
7142
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
6953
7143
|
var STATUS_LABELS6 = {
|
|
@@ -6976,20 +7166,20 @@ function CreateGameSheet({
|
|
|
6976
7166
|
const t = useDubsTheme();
|
|
6977
7167
|
const { wallet } = useDubs();
|
|
6978
7168
|
const mutation = useCreateGame();
|
|
6979
|
-
const [selectedTeam, setSelectedTeam] = (0,
|
|
6980
|
-
const [wager, setWager] = (0,
|
|
6981
|
-
const [showSuccess, setShowSuccess] = (0,
|
|
6982
|
-
const overlayOpacity = (0,
|
|
6983
|
-
const successScale = (0,
|
|
6984
|
-
const successOpacity = (0,
|
|
6985
|
-
(0,
|
|
7169
|
+
const [selectedTeam, setSelectedTeam] = (0, import_react42.useState)(null);
|
|
7170
|
+
const [wager, setWager] = (0, import_react42.useState)(0.01);
|
|
7171
|
+
const [showSuccess, setShowSuccess] = (0, import_react42.useState)(false);
|
|
7172
|
+
const overlayOpacity = (0, import_react42.useRef)(new import_react_native26.Animated.Value(0)).current;
|
|
7173
|
+
const successScale = (0, import_react42.useRef)(new import_react_native26.Animated.Value(0)).current;
|
|
7174
|
+
const successOpacity = (0, import_react42.useRef)(new import_react_native26.Animated.Value(0)).current;
|
|
7175
|
+
(0, import_react42.useEffect)(() => {
|
|
6986
7176
|
import_react_native26.Animated.timing(overlayOpacity, {
|
|
6987
7177
|
toValue: visible ? 1 : 0,
|
|
6988
7178
|
duration: 250,
|
|
6989
7179
|
useNativeDriver: true
|
|
6990
7180
|
}).start();
|
|
6991
7181
|
}, [visible]);
|
|
6992
|
-
(0,
|
|
7182
|
+
(0, import_react42.useEffect)(() => {
|
|
6993
7183
|
if (visible) {
|
|
6994
7184
|
setSelectedTeam(null);
|
|
6995
7185
|
setWager(0.01);
|
|
@@ -6999,7 +7189,7 @@ function CreateGameSheet({
|
|
|
6999
7189
|
mutation.reset();
|
|
7000
7190
|
}
|
|
7001
7191
|
}, [visible]);
|
|
7002
|
-
(0,
|
|
7192
|
+
(0, import_react42.useEffect)(() => {
|
|
7003
7193
|
if (mutation.status === "success" && mutation.data) {
|
|
7004
7194
|
setShowSuccess(true);
|
|
7005
7195
|
onSuccess?.(mutation.data);
|
|
@@ -7016,7 +7206,7 @@ function CreateGameSheet({
|
|
|
7016
7206
|
return () => clearTimeout(timer);
|
|
7017
7207
|
}
|
|
7018
7208
|
}, [mutation.status, mutation.data]);
|
|
7019
|
-
(0,
|
|
7209
|
+
(0, import_react42.useEffect)(() => {
|
|
7020
7210
|
if (mutation.status === "error" && mutation.error) {
|
|
7021
7211
|
onError?.(mutation.error);
|
|
7022
7212
|
}
|
|
@@ -7026,7 +7216,7 @@ function CreateGameSheet({
|
|
|
7026
7216
|
const awayName = shortName ? shortName(opponents[1]?.name) : opponents[1]?.name || "Away";
|
|
7027
7217
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
7028
7218
|
const canCreate = selectedTeam !== null && !isMutating && mutation.status !== "success";
|
|
7029
|
-
const handleCreate = (0,
|
|
7219
|
+
const handleCreate = (0, import_react42.useCallback)(async () => {
|
|
7030
7220
|
if (!selectedTeam || !wallet.publicKey) return;
|
|
7031
7221
|
try {
|
|
7032
7222
|
await mutation.execute({
|
|
@@ -7231,6 +7421,7 @@ var styles20 = import_react_native26.StyleSheet.create({
|
|
|
7231
7421
|
useJoinGame,
|
|
7232
7422
|
useNetworkGames,
|
|
7233
7423
|
usePushNotifications,
|
|
7424
|
+
useShorts,
|
|
7234
7425
|
useUFCFightCard,
|
|
7235
7426
|
useUFCFighterDetail
|
|
7236
7427
|
});
|