@dubsdotapp/expo 0.2.53 → 0.2.55
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.d.mts +31 -1
- package/dist/index.d.ts +31 -1
- package/dist/index.js +648 -399
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +322 -74
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -2
- package/src/client.ts +18 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/usePushNotifications.ts +169 -0
- package/src/index.ts +2 -0
- package/src/ui/AuthGate.tsx +151 -2
package/dist/index.js
CHANGED
|
@@ -72,6 +72,7 @@ __export(index_exports, {
|
|
|
72
72
|
useHasClaimed: () => useHasClaimed,
|
|
73
73
|
useJoinGame: () => useJoinGame,
|
|
74
74
|
useNetworkGames: () => useNetworkGames,
|
|
75
|
+
usePushNotifications: () => usePushNotifications,
|
|
75
76
|
useUFCFightCard: () => useUFCFightCard,
|
|
76
77
|
useUFCFighterDetail: () => useUFCFighterDetail
|
|
77
78
|
});
|
|
@@ -531,6 +532,21 @@ var DubsClient = class {
|
|
|
531
532
|
);
|
|
532
533
|
this._token = null;
|
|
533
534
|
}
|
|
535
|
+
// ── Push Notifications ──
|
|
536
|
+
async registerPushToken(params) {
|
|
537
|
+
await this.request(
|
|
538
|
+
"POST",
|
|
539
|
+
"/push/expo-token",
|
|
540
|
+
params
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
async unregisterPushToken(token) {
|
|
544
|
+
await this.request(
|
|
545
|
+
"DELETE",
|
|
546
|
+
"/push/expo-token",
|
|
547
|
+
{ token }
|
|
548
|
+
);
|
|
549
|
+
}
|
|
534
550
|
// ── Error Utilities ──
|
|
535
551
|
async parseError(error) {
|
|
536
552
|
const res = await this.request(
|
|
@@ -605,7 +621,7 @@ function createSecureStoreStorage() {
|
|
|
605
621
|
}
|
|
606
622
|
|
|
607
623
|
// src/provider.tsx
|
|
608
|
-
var
|
|
624
|
+
var import_react18 = require("react");
|
|
609
625
|
|
|
610
626
|
// src/ui/theme.ts
|
|
611
627
|
var import_react = require("react");
|
|
@@ -1663,8 +1679,8 @@ function ManagedWalletProvider({
|
|
|
1663
1679
|
}
|
|
1664
1680
|
|
|
1665
1681
|
// src/ui/AuthGate.tsx
|
|
1666
|
-
var
|
|
1667
|
-
var
|
|
1682
|
+
var import_react17 = __toESM(require("react"));
|
|
1683
|
+
var import_react_native7 = require("react-native");
|
|
1668
1684
|
|
|
1669
1685
|
// src/hooks/useEvents.ts
|
|
1670
1686
|
var import_react3 = require("react");
|
|
@@ -2329,6 +2345,126 @@ function useUFCFighterDetail(athleteId) {
|
|
|
2329
2345
|
return { data, loading, error, refetch: fetchData };
|
|
2330
2346
|
}
|
|
2331
2347
|
|
|
2348
|
+
// src/hooks/usePushNotifications.ts
|
|
2349
|
+
var import_react16 = require("react");
|
|
2350
|
+
var import_react_native6 = require("react-native");
|
|
2351
|
+
function usePushNotifications() {
|
|
2352
|
+
const { client, appName } = useDubs();
|
|
2353
|
+
const channelId = (0, import_react16.useMemo)(() => appName.toLowerCase().replace(/[^a-z0-9-]/g, ""), [appName]);
|
|
2354
|
+
const [hasPermission, setHasPermission] = (0, import_react16.useState)(false);
|
|
2355
|
+
const [expoPushToken, setExpoPushToken] = (0, import_react16.useState)(null);
|
|
2356
|
+
const [loading, setLoading] = (0, import_react16.useState)(false);
|
|
2357
|
+
const [error, setError] = (0, import_react16.useState)(null);
|
|
2358
|
+
const registering = (0, import_react16.useRef)(false);
|
|
2359
|
+
const getNotificationsModule = (0, import_react16.useCallback)(() => {
|
|
2360
|
+
try {
|
|
2361
|
+
return require("expo-notifications");
|
|
2362
|
+
} catch {
|
|
2363
|
+
return null;
|
|
2364
|
+
}
|
|
2365
|
+
}, []);
|
|
2366
|
+
const getDeviceName = (0, import_react16.useCallback)(() => {
|
|
2367
|
+
try {
|
|
2368
|
+
const Device = require("expo-device");
|
|
2369
|
+
return Device.deviceName || null;
|
|
2370
|
+
} catch {
|
|
2371
|
+
return null;
|
|
2372
|
+
}
|
|
2373
|
+
}, []);
|
|
2374
|
+
const setupAndroidChannels = (0, import_react16.useCallback)((Notifications) => {
|
|
2375
|
+
if (import_react_native6.Platform.OS === "android") {
|
|
2376
|
+
Notifications.setNotificationChannelAsync(channelId || "default", {
|
|
2377
|
+
name: appName || "Default",
|
|
2378
|
+
importance: Notifications.AndroidImportance?.MAX ?? 4,
|
|
2379
|
+
vibrationPattern: [0, 250, 250, 250]
|
|
2380
|
+
}).catch(() => {
|
|
2381
|
+
});
|
|
2382
|
+
}
|
|
2383
|
+
}, [channelId, appName]);
|
|
2384
|
+
const registerTokenWithServer = (0, import_react16.useCallback)(async (token) => {
|
|
2385
|
+
const deviceName = getDeviceName();
|
|
2386
|
+
await client.registerPushToken({
|
|
2387
|
+
token,
|
|
2388
|
+
platform: import_react_native6.Platform.OS,
|
|
2389
|
+
deviceName: deviceName || void 0
|
|
2390
|
+
});
|
|
2391
|
+
}, [client, getDeviceName]);
|
|
2392
|
+
const register = (0, import_react16.useCallback)(async () => {
|
|
2393
|
+
if (registering.current) return false;
|
|
2394
|
+
registering.current = true;
|
|
2395
|
+
setLoading(true);
|
|
2396
|
+
setError(null);
|
|
2397
|
+
try {
|
|
2398
|
+
const Notifications = getNotificationsModule();
|
|
2399
|
+
if (!Notifications) {
|
|
2400
|
+
throw new Error("expo-notifications is not installed");
|
|
2401
|
+
}
|
|
2402
|
+
const { status: existingStatus } = await Notifications.getPermissionsAsync();
|
|
2403
|
+
let finalStatus = existingStatus;
|
|
2404
|
+
if (existingStatus !== "granted") {
|
|
2405
|
+
const { status } = await Notifications.requestPermissionsAsync();
|
|
2406
|
+
finalStatus = status;
|
|
2407
|
+
}
|
|
2408
|
+
if (finalStatus !== "granted") {
|
|
2409
|
+
setHasPermission(false);
|
|
2410
|
+
setLoading(false);
|
|
2411
|
+
registering.current = false;
|
|
2412
|
+
return false;
|
|
2413
|
+
}
|
|
2414
|
+
setHasPermission(true);
|
|
2415
|
+
const tokenResult = await Notifications.getExpoPushTokenAsync();
|
|
2416
|
+
const token = tokenResult.data;
|
|
2417
|
+
setExpoPushToken(token);
|
|
2418
|
+
await registerTokenWithServer(token);
|
|
2419
|
+
setupAndroidChannels(Notifications);
|
|
2420
|
+
setLoading(false);
|
|
2421
|
+
registering.current = false;
|
|
2422
|
+
return true;
|
|
2423
|
+
} catch (err) {
|
|
2424
|
+
const e = err instanceof Error ? err : new Error(String(err));
|
|
2425
|
+
setError(e);
|
|
2426
|
+
setLoading(false);
|
|
2427
|
+
registering.current = false;
|
|
2428
|
+
console.error("[usePushNotifications] Registration error:", e.message);
|
|
2429
|
+
return false;
|
|
2430
|
+
}
|
|
2431
|
+
}, [getNotificationsModule, registerTokenWithServer, setupAndroidChannels]);
|
|
2432
|
+
const unregister = (0, import_react16.useCallback)(async () => {
|
|
2433
|
+
if (!expoPushToken) return;
|
|
2434
|
+
try {
|
|
2435
|
+
await client.unregisterPushToken(expoPushToken);
|
|
2436
|
+
setExpoPushToken(null);
|
|
2437
|
+
} catch (err) {
|
|
2438
|
+
console.error("[usePushNotifications] Unregister error:", err);
|
|
2439
|
+
}
|
|
2440
|
+
}, [client, expoPushToken]);
|
|
2441
|
+
const restoreIfGranted = (0, import_react16.useCallback)(async () => {
|
|
2442
|
+
try {
|
|
2443
|
+
const Notifications = getNotificationsModule();
|
|
2444
|
+
if (!Notifications) return;
|
|
2445
|
+
const { status } = await Notifications.getPermissionsAsync();
|
|
2446
|
+
if (status !== "granted") return;
|
|
2447
|
+
setHasPermission(true);
|
|
2448
|
+
const tokenResult = await Notifications.getExpoPushTokenAsync();
|
|
2449
|
+
const token = tokenResult.data;
|
|
2450
|
+
setExpoPushToken(token);
|
|
2451
|
+
await registerTokenWithServer(token);
|
|
2452
|
+
setupAndroidChannels(Notifications);
|
|
2453
|
+
} catch (err) {
|
|
2454
|
+
console.log("[usePushNotifications] Restore skipped:", err instanceof Error ? err.message : err);
|
|
2455
|
+
}
|
|
2456
|
+
}, [getNotificationsModule, registerTokenWithServer, setupAndroidChannels]);
|
|
2457
|
+
return {
|
|
2458
|
+
hasPermission,
|
|
2459
|
+
expoPushToken,
|
|
2460
|
+
loading,
|
|
2461
|
+
error,
|
|
2462
|
+
register,
|
|
2463
|
+
unregister,
|
|
2464
|
+
restoreIfGranted
|
|
2465
|
+
};
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2332
2468
|
// src/ui/AuthGate.tsx
|
|
2333
2469
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
2334
2470
|
var DICEBEAR_STYLES = [
|
|
@@ -2357,9 +2493,11 @@ function AuthGate({
|
|
|
2357
2493
|
}) {
|
|
2358
2494
|
const { client } = useDubs();
|
|
2359
2495
|
const auth = useAuth();
|
|
2360
|
-
const [phase, setPhase] = (0,
|
|
2361
|
-
const [registrationPhase, setRegistrationPhase] = (0,
|
|
2362
|
-
(0,
|
|
2496
|
+
const [phase, setPhase] = (0, import_react17.useState)("init");
|
|
2497
|
+
const [registrationPhase, setRegistrationPhase] = (0, import_react17.useState)(false);
|
|
2498
|
+
const [showPushSetup, setShowPushSetup] = (0, import_react17.useState)(false);
|
|
2499
|
+
const [isRestoredSession, setIsRestoredSession] = (0, import_react17.useState)(false);
|
|
2500
|
+
(0, import_react17.useEffect)(() => {
|
|
2363
2501
|
let cancelled = false;
|
|
2364
2502
|
(async () => {
|
|
2365
2503
|
try {
|
|
@@ -2369,6 +2507,7 @@ function AuthGate({
|
|
|
2369
2507
|
const restored = await auth.restoreSession(savedToken);
|
|
2370
2508
|
if (cancelled) return;
|
|
2371
2509
|
if (restored) {
|
|
2510
|
+
setIsRestoredSession(true);
|
|
2372
2511
|
setPhase("active");
|
|
2373
2512
|
return;
|
|
2374
2513
|
}
|
|
@@ -2385,18 +2524,23 @@ function AuthGate({
|
|
|
2385
2524
|
cancelled = true;
|
|
2386
2525
|
};
|
|
2387
2526
|
}, []);
|
|
2388
|
-
(0,
|
|
2527
|
+
(0, import_react17.useEffect)(() => {
|
|
2389
2528
|
if (auth.status === "needsRegistration") setRegistrationPhase(true);
|
|
2390
2529
|
}, [auth.status]);
|
|
2391
|
-
(0,
|
|
2530
|
+
(0, import_react17.useEffect)(() => {
|
|
2531
|
+
if (auth.status === "authenticated" && registrationPhase && !isRestoredSession) {
|
|
2532
|
+
setShowPushSetup(true);
|
|
2533
|
+
}
|
|
2534
|
+
}, [auth.status, registrationPhase, isRestoredSession]);
|
|
2535
|
+
(0, import_react17.useEffect)(() => {
|
|
2392
2536
|
if (auth.token) onSaveToken(auth.token);
|
|
2393
2537
|
}, [auth.token]);
|
|
2394
|
-
const retry = (0,
|
|
2538
|
+
const retry = (0, import_react17.useCallback)(() => {
|
|
2395
2539
|
setRegistrationPhase(false);
|
|
2396
2540
|
auth.reset();
|
|
2397
2541
|
auth.authenticate();
|
|
2398
2542
|
}, [auth]);
|
|
2399
|
-
const handleRegister = (0,
|
|
2543
|
+
const handleRegister = (0, import_react17.useCallback)(
|
|
2400
2544
|
(username, referralCode, avatarUrl) => {
|
|
2401
2545
|
auth.register(username, referralCode, avatarUrl);
|
|
2402
2546
|
},
|
|
@@ -2407,7 +2551,20 @@ function AuthGate({
|
|
|
2407
2551
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DefaultLoadingScreen, { status: "authenticating", appName, accentColor });
|
|
2408
2552
|
}
|
|
2409
2553
|
if (auth.status === "authenticated") {
|
|
2410
|
-
|
|
2554
|
+
if (showPushSetup) {
|
|
2555
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2556
|
+
PushSetupScreen,
|
|
2557
|
+
{
|
|
2558
|
+
accentColor,
|
|
2559
|
+
appName,
|
|
2560
|
+
onComplete: () => setShowPushSetup(false)
|
|
2561
|
+
}
|
|
2562
|
+
);
|
|
2563
|
+
}
|
|
2564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(AuthContext.Provider, { value: auth, children: [
|
|
2565
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PushTokenRestorer, {}),
|
|
2566
|
+
children
|
|
2567
|
+
] });
|
|
2411
2568
|
}
|
|
2412
2569
|
if (registrationPhase) {
|
|
2413
2570
|
const isRegistering = auth.status === "registering";
|
|
@@ -2447,44 +2604,44 @@ function DefaultLoadingScreen({ status, appName, accentColor }) {
|
|
|
2447
2604
|
authenticated: "Ready!",
|
|
2448
2605
|
error: "Something went wrong"
|
|
2449
2606
|
};
|
|
2450
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2451
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2452
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2453
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: [s.container, { backgroundColor: t.background }], children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: s.centerContent, children: [
|
|
2608
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: s.brandingSection, children: [
|
|
2609
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: [s.logoCircle, { backgroundColor: accent }], children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: s.logoText, children: "D" }) }),
|
|
2610
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.appNameText, { color: t.text }], children: appName })
|
|
2454
2611
|
] }),
|
|
2455
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2456
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2457
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2612
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: s.loadingSection, children: [
|
|
2613
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.ActivityIndicator, { size: "large", color: accent }),
|
|
2614
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.statusText, { color: t.textMuted }], children: statusText[status] || "Loading..." })
|
|
2458
2615
|
] })
|
|
2459
2616
|
] }) });
|
|
2460
2617
|
}
|
|
2461
2618
|
function DefaultErrorScreen({ error, onRetry, appName, accentColor }) {
|
|
2462
2619
|
const t = useDubsTheme();
|
|
2463
2620
|
const accent = accentColor || t.accent;
|
|
2464
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2465
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2466
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2467
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2621
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: [s.container, { backgroundColor: t.background }], children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: s.spreadContent, children: [
|
|
2622
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: s.brandingSection, children: [
|
|
2623
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: [s.logoCircle, { backgroundColor: accent }], children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: s.logoText, children: "D" }) }),
|
|
2624
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.appNameText, { color: t.text }], children: appName })
|
|
2468
2625
|
] }),
|
|
2469
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2470
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2471
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2626
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: { gap: 16 }, children: [
|
|
2627
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: [s.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.errorText, { color: t.errorText }], children: error.message }) }),
|
|
2628
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.TouchableOpacity, { style: [s.primaryBtn, { backgroundColor: accent }], onPress: onRetry, activeOpacity: 0.8, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: s.primaryBtnText, children: "Try Again" }) })
|
|
2472
2629
|
] })
|
|
2473
2630
|
] }) });
|
|
2474
2631
|
}
|
|
2475
2632
|
function StepIndicator({ currentStep }) {
|
|
2476
2633
|
const t = useDubsTheme();
|
|
2477
2634
|
const steps = [0, 1, 2, 3];
|
|
2478
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2479
|
-
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: s.stepRow, children: steps.map((i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react17.default.Fragment, { children: [
|
|
2636
|
+
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: [s.stepLine, { backgroundColor: i <= currentStep ? t.success : t.border }] }),
|
|
2480
2637
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2481
|
-
|
|
2638
|
+
import_react_native7.View,
|
|
2482
2639
|
{
|
|
2483
2640
|
style: [
|
|
2484
2641
|
s.stepCircle,
|
|
2485
2642
|
i < currentStep ? { backgroundColor: t.success } : i === currentStep ? { backgroundColor: t.accent } : { backgroundColor: "transparent", borderWidth: 2, borderColor: t.border }
|
|
2486
2643
|
],
|
|
2487
|
-
children: i < currentStep ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2644
|
+
children: i < currentStep ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: s.stepCheck, children: "\u2713" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.stepNum, { color: i === currentStep ? "#FFF" : t.textMuted }], children: i + 1 })
|
|
2488
2645
|
}
|
|
2489
2646
|
)
|
|
2490
2647
|
] }, i)) });
|
|
@@ -2499,19 +2656,19 @@ function DefaultRegistrationScreen({
|
|
|
2499
2656
|
}) {
|
|
2500
2657
|
const t = useDubsTheme();
|
|
2501
2658
|
const accent = accentColor || t.accent;
|
|
2502
|
-
const [step, setStep] = (0,
|
|
2503
|
-
const [avatarSeed, setAvatarSeed] = (0,
|
|
2504
|
-
const [avatarStyle, setAvatarStyle] = (0,
|
|
2505
|
-
const [showStyles, setShowStyles] = (0,
|
|
2506
|
-
const [username, setUsername] = (0,
|
|
2507
|
-
const [referralCode, setReferralCode] = (0,
|
|
2508
|
-
const [checking, setChecking] = (0,
|
|
2509
|
-
const [availability, setAvailability] = (0,
|
|
2510
|
-
const debounceRef = (0,
|
|
2511
|
-
const fadeAnim = (0,
|
|
2512
|
-
const slideAnim = (0,
|
|
2659
|
+
const [step, setStep] = (0, import_react17.useState)(0);
|
|
2660
|
+
const [avatarSeed, setAvatarSeed] = (0, import_react17.useState)(generateSeed);
|
|
2661
|
+
const [avatarStyle, setAvatarStyle] = (0, import_react17.useState)("adventurer");
|
|
2662
|
+
const [showStyles, setShowStyles] = (0, import_react17.useState)(false);
|
|
2663
|
+
const [username, setUsername] = (0, import_react17.useState)("");
|
|
2664
|
+
const [referralCode, setReferralCode] = (0, import_react17.useState)("");
|
|
2665
|
+
const [checking, setChecking] = (0, import_react17.useState)(false);
|
|
2666
|
+
const [availability, setAvailability] = (0, import_react17.useState)(null);
|
|
2667
|
+
const debounceRef = (0, import_react17.useRef)(null);
|
|
2668
|
+
const fadeAnim = (0, import_react17.useRef)(new import_react_native7.Animated.Value(1)).current;
|
|
2669
|
+
const slideAnim = (0, import_react17.useRef)(new import_react_native7.Animated.Value(0)).current;
|
|
2513
2670
|
const avatarUrl = getAvatarUrl(avatarStyle, avatarSeed);
|
|
2514
|
-
(0,
|
|
2671
|
+
(0, import_react17.useEffect)(() => {
|
|
2515
2672
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
2516
2673
|
const trimmed = username.trim();
|
|
2517
2674
|
if (trimmed.length < 3) {
|
|
@@ -2534,94 +2691,94 @@ function DefaultRegistrationScreen({
|
|
|
2534
2691
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
2535
2692
|
};
|
|
2536
2693
|
}, [username, client]);
|
|
2537
|
-
const animateToStep = (0,
|
|
2694
|
+
const animateToStep = (0, import_react17.useCallback)((newStep) => {
|
|
2538
2695
|
const dir = newStep > step ? 1 : -1;
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2696
|
+
import_react_native7.Keyboard.dismiss();
|
|
2697
|
+
import_react_native7.Animated.parallel([
|
|
2698
|
+
import_react_native7.Animated.timing(fadeAnim, { toValue: 0, duration: 120, useNativeDriver: true }),
|
|
2699
|
+
import_react_native7.Animated.timing(slideAnim, { toValue: -dir * 40, duration: 120, useNativeDriver: true })
|
|
2543
2700
|
]).start(() => {
|
|
2544
2701
|
setStep(newStep);
|
|
2545
2702
|
slideAnim.setValue(dir * 40);
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2703
|
+
import_react_native7.Animated.parallel([
|
|
2704
|
+
import_react_native7.Animated.timing(fadeAnim, { toValue: 1, duration: 200, useNativeDriver: true }),
|
|
2705
|
+
import_react_native7.Animated.timing(slideAnim, { toValue: 0, duration: 200, useNativeDriver: true })
|
|
2549
2706
|
]).start();
|
|
2550
2707
|
});
|
|
2551
2708
|
}, [step, fadeAnim, slideAnim]);
|
|
2552
2709
|
const canContinueUsername = username.trim().length >= 3 && availability?.available === true && !checking;
|
|
2553
2710
|
const handleSubmit = () => {
|
|
2554
|
-
|
|
2711
|
+
import_react_native7.Keyboard.dismiss();
|
|
2555
2712
|
onRegister(username.trim(), referralCode.trim() || void 0, avatarUrl);
|
|
2556
2713
|
};
|
|
2557
|
-
const renderAvatarStep = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2558
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2559
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2560
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2714
|
+
const renderAvatarStep = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: s.stepContainer, children: [
|
|
2715
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: s.stepTop, children: [
|
|
2716
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.title, { color: t.text }], children: "Choose Your Avatar" }),
|
|
2717
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.subtitle, { color: t.textMuted }], children: "Pick a look that represents you" }),
|
|
2561
2718
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StepIndicator, { currentStep: 0 }),
|
|
2562
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2563
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2564
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2719
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: s.avatarCenter, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: [s.avatarFrame, { borderColor: accent }], children: [
|
|
2720
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Image, { source: { uri: avatarUrl }, style: s.avatarLarge }),
|
|
2721
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: [s.checkBadge, { backgroundColor: t.success }], children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: s.checkBadgeText, children: "\u2713" }) })
|
|
2565
2722
|
] }) }),
|
|
2566
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2723
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: s.avatarActions, children: [
|
|
2567
2724
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2568
|
-
|
|
2725
|
+
import_react_native7.TouchableOpacity,
|
|
2569
2726
|
{
|
|
2570
2727
|
style: [s.outlineBtn, { borderColor: t.border }],
|
|
2571
2728
|
onPress: () => setAvatarSeed(generateSeed()),
|
|
2572
2729
|
activeOpacity: 0.7,
|
|
2573
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2730
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.outlineBtnText, { color: t.text }], children: "\u21BB Shuffle" })
|
|
2574
2731
|
}
|
|
2575
2732
|
),
|
|
2576
2733
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2577
|
-
|
|
2734
|
+
import_react_native7.TouchableOpacity,
|
|
2578
2735
|
{
|
|
2579
2736
|
style: [s.outlineBtn, { borderColor: accent, backgroundColor: accent + "15" }],
|
|
2580
2737
|
onPress: () => setShowStyles(!showStyles),
|
|
2581
2738
|
activeOpacity: 0.7,
|
|
2582
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2739
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.outlineBtnText, { color: accent }], children: "\u263A Customize" })
|
|
2583
2740
|
}
|
|
2584
2741
|
)
|
|
2585
2742
|
] }),
|
|
2586
|
-
showStyles && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2587
|
-
|
|
2743
|
+
showStyles && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, style: s.styleScroll, children: DICEBEAR_STYLES.map((st) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2744
|
+
import_react_native7.TouchableOpacity,
|
|
2588
2745
|
{
|
|
2589
2746
|
onPress: () => setAvatarStyle(st),
|
|
2590
2747
|
style: [s.styleThumbWrap, { borderColor: st === avatarStyle ? accent : t.border }],
|
|
2591
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2748
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Image, { source: { uri: getAvatarUrl(st, avatarSeed, 80) }, style: s.styleThumb })
|
|
2592
2749
|
},
|
|
2593
2750
|
st
|
|
2594
2751
|
)) })
|
|
2595
2752
|
] }),
|
|
2596
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2597
|
-
|
|
2753
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: s.bottomRow, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2754
|
+
import_react_native7.TouchableOpacity,
|
|
2598
2755
|
{
|
|
2599
2756
|
style: [s.primaryBtn, { backgroundColor: accent, flex: 1 }],
|
|
2600
2757
|
onPress: () => animateToStep(1),
|
|
2601
2758
|
activeOpacity: 0.8,
|
|
2602
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2759
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: s.primaryBtnText, children: "Continue \u203A" })
|
|
2603
2760
|
}
|
|
2604
2761
|
) })
|
|
2605
2762
|
] });
|
|
2606
|
-
const renderUsernameStep = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2607
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2608
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2609
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2610
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2763
|
+
const renderUsernameStep = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: s.stepContainer, children: [
|
|
2764
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: s.stepTop, children: [
|
|
2765
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: s.headerRow, children: [
|
|
2766
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.TouchableOpacity, { onPress: () => animateToStep(0), hitSlop: { top: 12, bottom: 12, left: 12, right: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.backChevron, { color: t.text }], children: "\u2039" }) }),
|
|
2767
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.titleInline, { color: t.text }], children: "Pick a Username" })
|
|
2611
2768
|
] }),
|
|
2612
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2769
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.subtitle, { color: t.textMuted }], children: "This is how others will see you" }),
|
|
2613
2770
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StepIndicator, { currentStep: 1 }),
|
|
2614
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2615
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2616
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2771
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: s.avatarCenter, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: [s.avatarFrameSmall, { borderColor: accent }], children: [
|
|
2772
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Image, { source: { uri: avatarUrl }, style: s.avatarSmall }),
|
|
2773
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: [s.checkBadgeSm, { backgroundColor: t.success }], children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: s.checkBadgeTextSm, children: "\u2713" }) })
|
|
2617
2774
|
] }) }),
|
|
2618
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2619
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2775
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: s.inputGroup, children: [
|
|
2776
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.Text, { style: [s.inputLabel, { color: t.text }], children: [
|
|
2620
2777
|
"Username ",
|
|
2621
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2778
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: { color: t.errorText }, children: "*" })
|
|
2622
2779
|
] }),
|
|
2623
2780
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2624
|
-
|
|
2781
|
+
import_react_native7.TextInput,
|
|
2625
2782
|
{
|
|
2626
2783
|
style: [s.input, { backgroundColor: t.surface, color: t.text, borderColor: accent }],
|
|
2627
2784
|
placeholder: "Enter username",
|
|
@@ -2633,63 +2790,63 @@ function DefaultRegistrationScreen({
|
|
|
2633
2790
|
autoFocus: true
|
|
2634
2791
|
}
|
|
2635
2792
|
),
|
|
2636
|
-
checking ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2793
|
+
checking ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.hint, { color: t.textDim }], children: "Checking..." }) : availability ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.hint, { color: availability.available ? t.success : t.errorText }], children: availability.available ? "\u2713 Available!" : availability.reason || "Username taken" }) : username.trim().length > 0 && username.trim().length < 3 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.hint, { color: t.textDim }], children: "At least 3 characters" }) : null
|
|
2637
2794
|
] })
|
|
2638
2795
|
] }),
|
|
2639
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2796
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: s.bottomRow, children: [
|
|
2640
2797
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2641
|
-
|
|
2798
|
+
import_react_native7.TouchableOpacity,
|
|
2642
2799
|
{
|
|
2643
2800
|
style: [s.secondaryBtn, { borderColor: t.border }],
|
|
2644
2801
|
onPress: () => animateToStep(0),
|
|
2645
2802
|
activeOpacity: 0.7,
|
|
2646
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2803
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.secondaryBtnText, { color: t.text }], children: "\u2039 Back" })
|
|
2647
2804
|
}
|
|
2648
2805
|
),
|
|
2649
2806
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2650
|
-
|
|
2807
|
+
import_react_native7.TouchableOpacity,
|
|
2651
2808
|
{
|
|
2652
2809
|
style: [s.primaryBtn, { backgroundColor: accent, flex: 1, opacity: canContinueUsername ? 1 : 0.4 }],
|
|
2653
2810
|
onPress: () => animateToStep(2),
|
|
2654
2811
|
disabled: !canContinueUsername,
|
|
2655
2812
|
activeOpacity: 0.8,
|
|
2656
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2813
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: s.primaryBtnText, children: "Continue \u203A" })
|
|
2657
2814
|
}
|
|
2658
2815
|
)
|
|
2659
2816
|
] })
|
|
2660
2817
|
] });
|
|
2661
|
-
const renderReferralStep = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2662
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2663
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2664
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2665
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2818
|
+
const renderReferralStep = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: s.stepContainer, children: [
|
|
2819
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: s.stepTop, children: [
|
|
2820
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: s.headerRow, children: [
|
|
2821
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.TouchableOpacity, { onPress: () => animateToStep(1), hitSlop: { top: 12, bottom: 12, left: 12, right: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.backChevron, { color: t.text }], children: "\u2039" }) }),
|
|
2822
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.titleInline, { color: t.text }], children: "Almost There!" })
|
|
2666
2823
|
] }),
|
|
2667
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2824
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.subtitle, { color: t.textMuted }], children: "Got a referral code? (optional)" }),
|
|
2668
2825
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StepIndicator, { currentStep: 2 }),
|
|
2669
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2670
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2671
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2672
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2673
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2674
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2826
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: [s.profileCard, { borderColor: t.border }], children: [
|
|
2827
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.profileLabel, { color: t.textMuted }], children: "Your Profile" }),
|
|
2828
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: s.profileRow, children: [
|
|
2829
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Image, { source: { uri: avatarUrl }, style: s.profileAvatar }),
|
|
2830
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: { gap: 4 }, children: [
|
|
2831
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.Text, { style: [s.profileUsername, { color: t.text }], children: [
|
|
2675
2832
|
"@",
|
|
2676
2833
|
username
|
|
2677
2834
|
] }),
|
|
2678
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2835
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.Text, { style: [s.profileReady, { color: t.success }], children: [
|
|
2679
2836
|
"\u2713",
|
|
2680
2837
|
" Ready to go!"
|
|
2681
2838
|
] })
|
|
2682
2839
|
] })
|
|
2683
2840
|
] })
|
|
2684
2841
|
] }),
|
|
2685
|
-
error ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2686
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2687
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2842
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: [s.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.errorText, { color: t.errorText }], children: error.message }) }) : null,
|
|
2843
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: s.inputGroup, children: [
|
|
2844
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.Text, { style: [s.inputLabel, { color: t.text }], children: [
|
|
2688
2845
|
"Referral Code ",
|
|
2689
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2846
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: { color: t.textMuted }, children: "(optional)" })
|
|
2690
2847
|
] }),
|
|
2691
2848
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2692
|
-
|
|
2849
|
+
import_react_native7.TextInput,
|
|
2693
2850
|
{
|
|
2694
2851
|
style: [s.input, { backgroundColor: t.surface, color: t.text, borderColor: t.border }],
|
|
2695
2852
|
placeholder: "Enter referral code",
|
|
@@ -2701,31 +2858,31 @@ function DefaultRegistrationScreen({
|
|
|
2701
2858
|
editable: !registering
|
|
2702
2859
|
}
|
|
2703
2860
|
),
|
|
2704
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2861
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.Text, { style: [s.hint, { color: t.textMuted }], children: [
|
|
2705
2862
|
"\u{1F381}",
|
|
2706
2863
|
" If a friend invited you, enter their code to give them credit!"
|
|
2707
2864
|
] })
|
|
2708
2865
|
] })
|
|
2709
2866
|
] }),
|
|
2710
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2867
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: s.bottomRow, children: [
|
|
2711
2868
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2712
|
-
|
|
2869
|
+
import_react_native7.TouchableOpacity,
|
|
2713
2870
|
{
|
|
2714
2871
|
style: [s.secondaryBtn, { borderColor: t.border }],
|
|
2715
2872
|
onPress: () => animateToStep(1),
|
|
2716
2873
|
disabled: registering,
|
|
2717
2874
|
activeOpacity: 0.7,
|
|
2718
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2875
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.secondaryBtnText, { color: t.text }], children: "\u2039 Back" })
|
|
2719
2876
|
}
|
|
2720
2877
|
),
|
|
2721
2878
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2722
|
-
|
|
2879
|
+
import_react_native7.TouchableOpacity,
|
|
2723
2880
|
{
|
|
2724
2881
|
style: [s.primaryBtn, { backgroundColor: accent, flex: 1, opacity: registering ? 0.7 : 1 }],
|
|
2725
2882
|
onPress: handleSubmit,
|
|
2726
2883
|
disabled: registering,
|
|
2727
2884
|
activeOpacity: 0.8,
|
|
2728
|
-
children: registering ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2885
|
+
children: registering ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.ActivityIndicator, { color: "#FFFFFF", size: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: s.primaryBtnText, children: "Create Account" })
|
|
2729
2886
|
}
|
|
2730
2887
|
)
|
|
2731
2888
|
] })
|
|
@@ -2743,18 +2900,18 @@ function DefaultRegistrationScreen({
|
|
|
2743
2900
|
}
|
|
2744
2901
|
};
|
|
2745
2902
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2746
|
-
|
|
2903
|
+
import_react_native7.KeyboardAvoidingView,
|
|
2747
2904
|
{
|
|
2748
2905
|
style: [s.container, { backgroundColor: t.background }],
|
|
2749
|
-
behavior:
|
|
2906
|
+
behavior: import_react_native7.Platform.OS === "ios" ? "padding" : void 0,
|
|
2750
2907
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2751
|
-
|
|
2908
|
+
import_react_native7.ScrollView,
|
|
2752
2909
|
{
|
|
2753
2910
|
contentContainerStyle: { flexGrow: 1 },
|
|
2754
2911
|
keyboardShouldPersistTaps: "handled",
|
|
2755
2912
|
bounces: false,
|
|
2756
2913
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2757
|
-
|
|
2914
|
+
import_react_native7.Animated.View,
|
|
2758
2915
|
{
|
|
2759
2916
|
style: [
|
|
2760
2917
|
{ flex: 1 },
|
|
@@ -2768,7 +2925,98 @@ function DefaultRegistrationScreen({
|
|
|
2768
2925
|
}
|
|
2769
2926
|
);
|
|
2770
2927
|
}
|
|
2771
|
-
|
|
2928
|
+
function PushTokenRestorer() {
|
|
2929
|
+
const push = usePushNotifications();
|
|
2930
|
+
const restored = (0, import_react17.useRef)(false);
|
|
2931
|
+
(0, import_react17.useEffect)(() => {
|
|
2932
|
+
if (restored.current) return;
|
|
2933
|
+
restored.current = true;
|
|
2934
|
+
push.restoreIfGranted();
|
|
2935
|
+
}, []);
|
|
2936
|
+
return null;
|
|
2937
|
+
}
|
|
2938
|
+
function PushSetupScreen({
|
|
2939
|
+
accentColor,
|
|
2940
|
+
appName,
|
|
2941
|
+
onComplete
|
|
2942
|
+
}) {
|
|
2943
|
+
const t = useDubsTheme();
|
|
2944
|
+
const accent = accentColor || t.accent;
|
|
2945
|
+
const push = usePushNotifications();
|
|
2946
|
+
const fadeAnim = (0, import_react17.useRef)(new import_react_native7.Animated.Value(0)).current;
|
|
2947
|
+
const slideAnim = (0, import_react17.useRef)(new import_react_native7.Animated.Value(30)).current;
|
|
2948
|
+
(0, import_react17.useEffect)(() => {
|
|
2949
|
+
import_react_native7.Animated.parallel([
|
|
2950
|
+
import_react_native7.Animated.timing(fadeAnim, { toValue: 1, duration: 300, useNativeDriver: true }),
|
|
2951
|
+
import_react_native7.Animated.timing(slideAnim, { toValue: 0, duration: 300, useNativeDriver: true })
|
|
2952
|
+
]).start();
|
|
2953
|
+
}, [fadeAnim, slideAnim]);
|
|
2954
|
+
const handleEnable = async () => {
|
|
2955
|
+
await push.register();
|
|
2956
|
+
onComplete();
|
|
2957
|
+
};
|
|
2958
|
+
const benefits = [
|
|
2959
|
+
"A fight you picked on goes LIVE",
|
|
2960
|
+
"Your pick wins or loses",
|
|
2961
|
+
"Final results and rankings"
|
|
2962
|
+
];
|
|
2963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: [s.container, { backgroundColor: t.background }], children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2964
|
+
import_react_native7.Animated.View,
|
|
2965
|
+
{
|
|
2966
|
+
style: [
|
|
2967
|
+
s.stepContainer,
|
|
2968
|
+
{ opacity: fadeAnim, transform: [{ translateY: slideAnim }] }
|
|
2969
|
+
],
|
|
2970
|
+
children: [
|
|
2971
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: s.stepTop, children: [
|
|
2972
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.title, { color: t.text }], children: "Enable Notifications" }),
|
|
2973
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.subtitle, { color: t.textMuted }], children: "Stay in the loop with real-time updates" }),
|
|
2974
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StepIndicator, { currentStep: 3 }),
|
|
2975
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: pushStyles.iconContainer, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: [pushStyles.bellCircle, { backgroundColor: accent + "20" }], children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [pushStyles.bellIcon, { color: accent }], children: "\u{1F514}" }) }) }),
|
|
2976
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: pushStyles.benefitsList, children: [
|
|
2977
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [pushStyles.benefitsHeader, { color: t.text }], children: "Get real-time updates when:" }),
|
|
2978
|
+
benefits.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: pushStyles.benefitRow, children: [
|
|
2979
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: [pushStyles.bulletDot, { backgroundColor: accent }] }),
|
|
2980
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [pushStyles.benefitText, { color: t.textMuted }], children: item })
|
|
2981
|
+
] }, i))
|
|
2982
|
+
] })
|
|
2983
|
+
] }),
|
|
2984
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: s.bottomRow, children: [
|
|
2985
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2986
|
+
import_react_native7.TouchableOpacity,
|
|
2987
|
+
{
|
|
2988
|
+
style: [s.secondaryBtn, { borderColor: t.border }],
|
|
2989
|
+
onPress: onComplete,
|
|
2990
|
+
activeOpacity: 0.7,
|
|
2991
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: [s.secondaryBtnText, { color: t.textMuted }], children: "Maybe Later" })
|
|
2992
|
+
}
|
|
2993
|
+
),
|
|
2994
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2995
|
+
import_react_native7.TouchableOpacity,
|
|
2996
|
+
{
|
|
2997
|
+
style: [s.primaryBtn, { backgroundColor: accent, flex: 1, opacity: push.loading ? 0.7 : 1 }],
|
|
2998
|
+
onPress: handleEnable,
|
|
2999
|
+
disabled: push.loading,
|
|
3000
|
+
activeOpacity: 0.8,
|
|
3001
|
+
children: push.loading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.ActivityIndicator, { color: "#FFFFFF", size: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.Text, { style: s.primaryBtnText, children: "Enable Notifications" })
|
|
3002
|
+
}
|
|
3003
|
+
)
|
|
3004
|
+
] })
|
|
3005
|
+
]
|
|
3006
|
+
}
|
|
3007
|
+
) });
|
|
3008
|
+
}
|
|
3009
|
+
var pushStyles = import_react_native7.StyleSheet.create({
|
|
3010
|
+
iconContainer: { alignItems: "center", marginVertical: 24 },
|
|
3011
|
+
bellCircle: { width: 100, height: 100, borderRadius: 50, justifyContent: "center", alignItems: "center" },
|
|
3012
|
+
bellIcon: { fontSize: 48 },
|
|
3013
|
+
benefitsList: { paddingHorizontal: 24, gap: 12, marginTop: 8 },
|
|
3014
|
+
benefitsHeader: { fontSize: 17, fontWeight: "700", marginBottom: 4 },
|
|
3015
|
+
benefitRow: { flexDirection: "row", alignItems: "center", gap: 12 },
|
|
3016
|
+
bulletDot: { width: 8, height: 8, borderRadius: 4 },
|
|
3017
|
+
benefitText: { fontSize: 16, flex: 1 }
|
|
3018
|
+
});
|
|
3019
|
+
var s = import_react_native7.StyleSheet.create({
|
|
2772
3020
|
container: { flex: 1 },
|
|
2773
3021
|
// Loading / Error
|
|
2774
3022
|
centerContent: { flex: 1, justifyContent: "center", alignItems: "center", paddingHorizontal: 32, gap: 48 },
|
|
@@ -2833,7 +3081,7 @@ var s = import_react_native6.StyleSheet.create({
|
|
|
2833
3081
|
|
|
2834
3082
|
// src/provider.tsx
|
|
2835
3083
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2836
|
-
var DubsContext = (0,
|
|
3084
|
+
var DubsContext = (0, import_react18.createContext)(null);
|
|
2837
3085
|
function DubsProvider({
|
|
2838
3086
|
apiKey,
|
|
2839
3087
|
children,
|
|
@@ -2855,11 +3103,11 @@ function DubsProvider({
|
|
|
2855
3103
|
const baseUrl = baseUrlOverride || config.baseUrl;
|
|
2856
3104
|
const rpcUrl = rpcUrlOverride || config.rpcUrl;
|
|
2857
3105
|
const cluster = config.cluster;
|
|
2858
|
-
const client = (0,
|
|
2859
|
-
const connection = (0,
|
|
2860
|
-
const storage = (0,
|
|
2861
|
-
const [uiConfig, setUiConfig] = (0,
|
|
2862
|
-
(0,
|
|
3106
|
+
const client = (0, import_react18.useMemo)(() => new DubsClient({ apiKey, baseUrl }), [apiKey, baseUrl]);
|
|
3107
|
+
const connection = (0, import_react18.useMemo)(() => new import_web34.Connection(rpcUrl, { commitment: "confirmed" }), [rpcUrl]);
|
|
3108
|
+
const storage = (0, import_react18.useMemo)(() => tokenStorage || createSecureStoreStorage(), [tokenStorage]);
|
|
3109
|
+
const [uiConfig, setUiConfig] = (0, import_react18.useState)(null);
|
|
3110
|
+
(0, import_react18.useEffect)(() => {
|
|
2863
3111
|
client.getAppConfig().then((config2) => {
|
|
2864
3112
|
console.log("[DubsProvider] UI config loaded:", JSON.stringify(config2));
|
|
2865
3113
|
setUiConfig(config2);
|
|
@@ -2940,11 +3188,11 @@ function ManagedInner({
|
|
|
2940
3188
|
children
|
|
2941
3189
|
}) {
|
|
2942
3190
|
const managedDisconnect = useDisconnect();
|
|
2943
|
-
const disconnect = (0,
|
|
3191
|
+
const disconnect = (0, import_react18.useCallback)(async () => {
|
|
2944
3192
|
client.setToken(null);
|
|
2945
3193
|
await managedDisconnect?.();
|
|
2946
3194
|
}, [client, managedDisconnect]);
|
|
2947
|
-
const value = (0,
|
|
3195
|
+
const value = (0, import_react18.useMemo)(
|
|
2948
3196
|
() => ({ client, wallet, connection, appName, network, disconnect, uiConfig }),
|
|
2949
3197
|
[client, wallet, connection, appName, network, disconnect, uiConfig]
|
|
2950
3198
|
);
|
|
@@ -2980,13 +3228,13 @@ function ExternalWalletProvider({
|
|
|
2980
3228
|
uiConfig,
|
|
2981
3229
|
children
|
|
2982
3230
|
}) {
|
|
2983
|
-
const disconnect = (0,
|
|
3231
|
+
const disconnect = (0, import_react18.useCallback)(async () => {
|
|
2984
3232
|
client.setToken(null);
|
|
2985
3233
|
await storage.deleteItem(STORAGE_KEYS.JWT_TOKEN).catch(() => {
|
|
2986
3234
|
});
|
|
2987
3235
|
await wallet.disconnect?.();
|
|
2988
3236
|
}, [client, storage, wallet]);
|
|
2989
|
-
const value = (0,
|
|
3237
|
+
const value = (0, import_react18.useMemo)(
|
|
2990
3238
|
() => ({ client, wallet, connection, appName, network, disconnect, uiConfig }),
|
|
2991
3239
|
[client, wallet, connection, appName, network, disconnect, uiConfig]
|
|
2992
3240
|
);
|
|
@@ -3011,20 +3259,20 @@ function ExternalWalletProvider({
|
|
|
3011
3259
|
) });
|
|
3012
3260
|
}
|
|
3013
3261
|
function useDubs() {
|
|
3014
|
-
const ctx = (0,
|
|
3262
|
+
const ctx = (0, import_react18.useContext)(DubsContext);
|
|
3015
3263
|
if (!ctx) {
|
|
3016
3264
|
throw new Error("useDubs must be used within a <DubsProvider>");
|
|
3017
3265
|
}
|
|
3018
3266
|
return ctx;
|
|
3019
3267
|
}
|
|
3020
3268
|
function useAppConfig() {
|
|
3021
|
-
const ctx = (0,
|
|
3269
|
+
const ctx = (0, import_react18.useContext)(DubsContext);
|
|
3022
3270
|
return ctx?.uiConfig || {};
|
|
3023
3271
|
}
|
|
3024
3272
|
|
|
3025
3273
|
// src/ui/UserProfileCard.tsx
|
|
3026
|
-
var
|
|
3027
|
-
var
|
|
3274
|
+
var import_react19 = require("react");
|
|
3275
|
+
var import_react_native8 = require("react-native");
|
|
3028
3276
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
3029
3277
|
function truncateAddress(address, chars = 4) {
|
|
3030
3278
|
if (address.length <= chars * 2 + 3) return address;
|
|
@@ -3043,20 +3291,20 @@ function UserProfileCard({
|
|
|
3043
3291
|
memberSince
|
|
3044
3292
|
}) {
|
|
3045
3293
|
const t = useDubsTheme();
|
|
3046
|
-
const imageUri = (0,
|
|
3294
|
+
const imageUri = (0, import_react19.useMemo)(
|
|
3047
3295
|
() => avatarUrl || `https://api.dicebear.com/9.x/avataaars/png?seed=${walletAddress}&size=128`,
|
|
3048
3296
|
[avatarUrl, walletAddress]
|
|
3049
3297
|
);
|
|
3050
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
3051
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3052
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
3053
|
-
username ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3054
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3055
|
-
memberSince ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_native8.View, { style: [styles2.card, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
3299
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native8.Image, { source: { uri: imageUri }, style: styles2.avatar }),
|
|
3300
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_native8.View, { style: styles2.info, children: [
|
|
3301
|
+
username ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native8.Text, { style: [styles2.username, { color: t.text }], children: username }) : null,
|
|
3302
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native8.Text, { style: [styles2.address, { color: t.textMuted }], children: truncateAddress(walletAddress) }),
|
|
3303
|
+
memberSince ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native8.Text, { style: [styles2.memberSince, { color: t.textDim }], children: formatMemberSince(memberSince) }) : null
|
|
3056
3304
|
] })
|
|
3057
3305
|
] });
|
|
3058
3306
|
}
|
|
3059
|
-
var styles2 =
|
|
3307
|
+
var styles2 = import_react_native8.StyleSheet.create({
|
|
3060
3308
|
card: {
|
|
3061
3309
|
flexDirection: "row",
|
|
3062
3310
|
alignItems: "center",
|
|
@@ -3090,7 +3338,7 @@ var styles2 = import_react_native7.StyleSheet.create({
|
|
|
3090
3338
|
});
|
|
3091
3339
|
|
|
3092
3340
|
// src/ui/SettingsSheet.tsx
|
|
3093
|
-
var
|
|
3341
|
+
var import_react_native9 = require("react-native");
|
|
3094
3342
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
3095
3343
|
function truncateAddress2(address, chars = 4) {
|
|
3096
3344
|
if (address.length <= chars * 2 + 3) return address;
|
|
@@ -3109,7 +3357,7 @@ function SettingsSheet({
|
|
|
3109
3357
|
}) {
|
|
3110
3358
|
const t = useDubsTheme();
|
|
3111
3359
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
3112
|
-
|
|
3360
|
+
import_react_native9.ScrollView,
|
|
3113
3361
|
{
|
|
3114
3362
|
style: [styles3.container, { backgroundColor: t.background }],
|
|
3115
3363
|
contentContainerStyle: styles3.content,
|
|
@@ -3123,49 +3371,49 @@ function SettingsSheet({
|
|
|
3123
3371
|
memberSince
|
|
3124
3372
|
}
|
|
3125
3373
|
),
|
|
3126
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
3374
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_native9.View, { style: [styles3.actionsCard, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
3127
3375
|
onCopyAddress ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
3128
|
-
|
|
3376
|
+
import_react_native9.TouchableOpacity,
|
|
3129
3377
|
{
|
|
3130
3378
|
style: styles3.actionRow,
|
|
3131
3379
|
onPress: onCopyAddress,
|
|
3132
3380
|
activeOpacity: 0.7,
|
|
3133
3381
|
children: [
|
|
3134
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
3135
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3136
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3382
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_native9.View, { style: styles3.actionRowLeft, children: [
|
|
3383
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native9.Text, { style: [styles3.actionLabel, { color: t.text }], children: "Wallet Address" }),
|
|
3384
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native9.Text, { style: [styles3.actionValue, { color: t.textMuted }], children: truncateAddress2(walletAddress) })
|
|
3137
3385
|
] }),
|
|
3138
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3386
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native9.Text, { style: [styles3.copyLabel, { color: t.accent }], children: "Copy" })
|
|
3139
3387
|
]
|
|
3140
3388
|
}
|
|
3141
3389
|
) : null,
|
|
3142
3390
|
onSupport ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
3143
|
-
onCopyAddress ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3391
|
+
onCopyAddress ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native9.View, { style: [styles3.separator, { backgroundColor: t.border }] }) : null,
|
|
3144
3392
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
3145
|
-
|
|
3393
|
+
import_react_native9.TouchableOpacity,
|
|
3146
3394
|
{
|
|
3147
3395
|
style: styles3.actionRow,
|
|
3148
3396
|
onPress: onSupport,
|
|
3149
3397
|
activeOpacity: 0.7,
|
|
3150
3398
|
children: [
|
|
3151
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3152
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3399
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native9.Text, { style: [styles3.actionLabel, { color: t.text }], children: "Help & Support" }),
|
|
3400
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native9.Text, { style: [styles3.chevron, { color: t.textMuted }], children: "\u203A" })
|
|
3153
3401
|
]
|
|
3154
3402
|
}
|
|
3155
3403
|
)
|
|
3156
3404
|
] }) : null
|
|
3157
3405
|
] }),
|
|
3158
3406
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3159
|
-
|
|
3407
|
+
import_react_native9.TouchableOpacity,
|
|
3160
3408
|
{
|
|
3161
3409
|
style: [styles3.logoutButton, { borderColor: t.live }],
|
|
3162
3410
|
onPress: onLogout,
|
|
3163
3411
|
disabled: loggingOut,
|
|
3164
3412
|
activeOpacity: 0.7,
|
|
3165
|
-
children: loggingOut ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3413
|
+
children: loggingOut ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native9.ActivityIndicator, { color: t.live, size: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native9.Text, { style: [styles3.logoutText, { color: t.live }], children: "Log Out" })
|
|
3166
3414
|
}
|
|
3167
3415
|
),
|
|
3168
|
-
appVersion ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
3416
|
+
appVersion ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_native9.Text, { style: [styles3.version, { color: t.textDim }], children: [
|
|
3169
3417
|
"v",
|
|
3170
3418
|
appVersion
|
|
3171
3419
|
] }) : null
|
|
@@ -3173,7 +3421,7 @@ function SettingsSheet({
|
|
|
3173
3421
|
}
|
|
3174
3422
|
);
|
|
3175
3423
|
}
|
|
3176
|
-
var styles3 =
|
|
3424
|
+
var styles3 = import_react_native9.StyleSheet.create({
|
|
3177
3425
|
container: {
|
|
3178
3426
|
flex: 1
|
|
3179
3427
|
},
|
|
@@ -3236,8 +3484,8 @@ var styles3 = import_react_native8.StyleSheet.create({
|
|
|
3236
3484
|
});
|
|
3237
3485
|
|
|
3238
3486
|
// src/ui/game/GamePoster.tsx
|
|
3239
|
-
var
|
|
3240
|
-
var
|
|
3487
|
+
var import_react20 = require("react");
|
|
3488
|
+
var import_react_native10 = require("react-native");
|
|
3241
3489
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
3242
3490
|
function computeCountdown(lockTimestamp) {
|
|
3243
3491
|
if (!lockTimestamp) return "";
|
|
@@ -3259,7 +3507,7 @@ function GamePoster({ game, ImageComponent }) {
|
|
|
3259
3507
|
const away = opponents[1];
|
|
3260
3508
|
const countdown = computeCountdown(game.lockTimestamp);
|
|
3261
3509
|
const isLive = countdown === "LIVE";
|
|
3262
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
3510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_native10.View, { style: styles4.container, children: [
|
|
3263
3511
|
game.media?.poster ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3264
3512
|
Img,
|
|
3265
3513
|
{
|
|
@@ -3267,28 +3515,28 @@ function GamePoster({ game, ImageComponent }) {
|
|
|
3267
3515
|
style: styles4.image,
|
|
3268
3516
|
resizeMode: "cover"
|
|
3269
3517
|
}
|
|
3270
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3518
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native10.View, { style: [styles4.image, { backgroundColor: t.surface }], children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_native10.View, { style: styles4.fallback, children: [
|
|
3271
3519
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TeamLogoInternal, { url: home?.imageUrl, size: 56, Img }),
|
|
3272
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3520
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native10.Text, { style: styles4.vs, children: "VS" }),
|
|
3273
3521
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TeamLogoInternal, { url: away?.imageUrl, size: 56, Img })
|
|
3274
3522
|
] }) }),
|
|
3275
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3276
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
3277
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3278
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3279
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3523
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native10.View, { style: styles4.overlay }),
|
|
3524
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_native10.View, { style: styles4.teamNames, children: [
|
|
3525
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native10.Text, { style: styles4.teamNameText, numberOfLines: 1, children: home?.name || "Home" }),
|
|
3526
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native10.Text, { style: styles4.teamNameVs, children: "vs" }),
|
|
3527
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native10.Text, { style: styles4.teamNameText, numberOfLines: 1, children: away?.name || "Away" })
|
|
3280
3528
|
] }),
|
|
3281
|
-
countdown ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3282
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3529
|
+
countdown ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native10.View, { style: styles4.countdownPill, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native10.Text, { style: [styles4.countdownText, isLive && styles4.countdownLive], children: countdown }) }) : null,
|
|
3530
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native10.View, { style: styles4.poolPill, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_native10.Text, { style: styles4.poolText, children: [
|
|
3283
3531
|
game.totalPool || 0,
|
|
3284
3532
|
" SOL"
|
|
3285
3533
|
] }) })
|
|
3286
3534
|
] });
|
|
3287
3535
|
}
|
|
3288
3536
|
function TeamLogoInternal({ url, size, Img }) {
|
|
3289
|
-
const [failed, setFailed] = (0,
|
|
3537
|
+
const [failed, setFailed] = (0, import_react20.useState)(false);
|
|
3290
3538
|
if (!url || failed) {
|
|
3291
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native10.View, { style: [styles4.logoPlaceholder, { width: size, height: size, borderRadius: size / 2 }] });
|
|
3292
3540
|
}
|
|
3293
3541
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3294
3542
|
Img,
|
|
@@ -3300,7 +3548,7 @@ function TeamLogoInternal({ url, size, Img }) {
|
|
|
3300
3548
|
}
|
|
3301
3549
|
);
|
|
3302
3550
|
}
|
|
3303
|
-
var styles4 =
|
|
3551
|
+
var styles4 = import_react_native10.StyleSheet.create({
|
|
3304
3552
|
container: {
|
|
3305
3553
|
height: 200,
|
|
3306
3554
|
borderRadius: 16,
|
|
@@ -3308,12 +3556,12 @@ var styles4 = import_react_native9.StyleSheet.create({
|
|
|
3308
3556
|
position: "relative"
|
|
3309
3557
|
},
|
|
3310
3558
|
image: {
|
|
3311
|
-
...
|
|
3559
|
+
...import_react_native10.StyleSheet.absoluteFillObject,
|
|
3312
3560
|
justifyContent: "center",
|
|
3313
3561
|
alignItems: "center"
|
|
3314
3562
|
},
|
|
3315
3563
|
overlay: {
|
|
3316
|
-
...
|
|
3564
|
+
...import_react_native10.StyleSheet.absoluteFillObject,
|
|
3317
3565
|
backgroundColor: "rgba(0,0,0,0.35)"
|
|
3318
3566
|
},
|
|
3319
3567
|
fallback: {
|
|
@@ -3387,8 +3635,8 @@ var styles4 = import_react_native9.StyleSheet.create({
|
|
|
3387
3635
|
});
|
|
3388
3636
|
|
|
3389
3637
|
// src/ui/game/LivePoolsCard.tsx
|
|
3390
|
-
var
|
|
3391
|
-
var
|
|
3638
|
+
var import_react21 = require("react");
|
|
3639
|
+
var import_react_native11 = require("react-native");
|
|
3392
3640
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
3393
3641
|
function LivePoolsCard({
|
|
3394
3642
|
game,
|
|
@@ -3403,7 +3651,7 @@ function LivePoolsCard({
|
|
|
3403
3651
|
const homePool = game.homePool || 0;
|
|
3404
3652
|
const awayPool = game.awayPool || 0;
|
|
3405
3653
|
const totalPool = game.totalPool || 0;
|
|
3406
|
-
const { homePercent, awayPercent, homeOdds, awayOdds } = (0,
|
|
3654
|
+
const { homePercent, awayPercent, homeOdds, awayOdds } = (0, import_react21.useMemo)(() => {
|
|
3407
3655
|
return {
|
|
3408
3656
|
homePercent: totalPool > 0 ? homePool / totalPool * 100 : 50,
|
|
3409
3657
|
awayPercent: totalPool > 0 ? awayPool / totalPool * 100 : 50,
|
|
@@ -3411,29 +3659,29 @@ function LivePoolsCard({
|
|
|
3411
3659
|
awayOdds: awayPool > 0 ? (totalPool / awayPool).toFixed(2) : "\u2014"
|
|
3412
3660
|
};
|
|
3413
3661
|
}, [homePool, awayPool, totalPool]);
|
|
3414
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3415
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3416
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_native11.View, { style: [styles5.card, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
3663
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native11.Text, { style: [styles5.title, { color: t.text }], children: "Live Pools" }),
|
|
3664
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_native11.Text, { style: [styles5.total, { color: t.accent }], children: [
|
|
3417
3665
|
totalPool,
|
|
3418
3666
|
" SOL total"
|
|
3419
3667
|
] }),
|
|
3420
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3668
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_native11.View, { style: styles5.bars, children: [
|
|
3421
3669
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PoolBar, { name: homeName, amount: homePool, percent: homePercent, color: homeColor, t }),
|
|
3422
3670
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PoolBar, { name: awayName, amount: awayPool, percent: awayPercent, color: awayColor, t })
|
|
3423
3671
|
] }),
|
|
3424
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3425
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3672
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_native11.View, { style: styles5.oddsRow, children: [
|
|
3673
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_native11.Text, { style: [styles5.oddsText, { color: t.textMuted }], children: [
|
|
3426
3674
|
homeName,
|
|
3427
3675
|
": ",
|
|
3428
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3676
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_native11.Text, { style: { color: t.text, fontWeight: "700" }, children: [
|
|
3429
3677
|
homeOdds,
|
|
3430
3678
|
"x"
|
|
3431
3679
|
] })
|
|
3432
3680
|
] }),
|
|
3433
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3681
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_native11.Text, { style: [styles5.oddsText, { color: t.textMuted }], children: [
|
|
3434
3682
|
awayName,
|
|
3435
3683
|
": ",
|
|
3436
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3684
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_native11.Text, { style: { color: t.text, fontWeight: "700" }, children: [
|
|
3437
3685
|
awayOdds,
|
|
3438
3686
|
"x"
|
|
3439
3687
|
] })
|
|
@@ -3442,16 +3690,16 @@ function LivePoolsCard({
|
|
|
3442
3690
|
] });
|
|
3443
3691
|
}
|
|
3444
3692
|
function PoolBar({ name, amount, percent, color, t }) {
|
|
3445
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3446
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3447
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3448
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_native11.View, { style: styles5.barRow, children: [
|
|
3694
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native11.Text, { style: [styles5.barLabel, { color: t.textSecondary }], numberOfLines: 1, children: name }),
|
|
3695
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native11.View, { style: [styles5.barTrack, { backgroundColor: t.border }], children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native11.View, { style: [styles5.barFill, { width: `${Math.max(percent, 2)}%`, backgroundColor: color }] }) }),
|
|
3696
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_native11.Text, { style: [styles5.barAmount, { color: t.text }], children: [
|
|
3449
3697
|
amount,
|
|
3450
3698
|
" SOL"
|
|
3451
3699
|
] })
|
|
3452
3700
|
] });
|
|
3453
3701
|
}
|
|
3454
|
-
var styles5 =
|
|
3702
|
+
var styles5 = import_react_native11.StyleSheet.create({
|
|
3455
3703
|
card: { borderRadius: 16, borderWidth: 1, padding: 16 },
|
|
3456
3704
|
title: { fontSize: 17, fontWeight: "700", marginBottom: 4 },
|
|
3457
3705
|
total: { fontSize: 14, fontWeight: "600", marginBottom: 14 },
|
|
@@ -3466,8 +3714,8 @@ var styles5 = import_react_native10.StyleSheet.create({
|
|
|
3466
3714
|
});
|
|
3467
3715
|
|
|
3468
3716
|
// src/ui/game/PickWinnerCard.tsx
|
|
3469
|
-
var
|
|
3470
|
-
var
|
|
3717
|
+
var import_react22 = require("react");
|
|
3718
|
+
var import_react_native12 = require("react-native");
|
|
3471
3719
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
3472
3720
|
function PickWinnerCard({
|
|
3473
3721
|
game,
|
|
@@ -3484,7 +3732,7 @@ function PickWinnerCard({
|
|
|
3484
3732
|
const totalPool = game.totalPool || 0;
|
|
3485
3733
|
const homePool = game.homePool || 0;
|
|
3486
3734
|
const awayPool = game.awayPool || 0;
|
|
3487
|
-
const { homeOdds, awayOdds, homeBets, awayBets } = (0,
|
|
3735
|
+
const { homeOdds, awayOdds, homeBets, awayBets } = (0, import_react22.useMemo)(() => ({
|
|
3488
3736
|
homeOdds: homePool > 0 ? (totalPool / homePool).toFixed(2) : "\u2014",
|
|
3489
3737
|
awayOdds: awayPool > 0 ? (totalPool / awayPool).toFixed(2) : "\u2014",
|
|
3490
3738
|
homeBets: bettors.filter((b) => b.team === "home").length,
|
|
@@ -3492,9 +3740,9 @@ function PickWinnerCard({
|
|
|
3492
3740
|
}), [totalPool, homePool, awayPool, bettors]);
|
|
3493
3741
|
const homeName = shortName ? shortName(opponents[0]?.name) : opponents[0]?.name || "Home";
|
|
3494
3742
|
const awayName = shortName ? shortName(opponents[1]?.name) : opponents[1]?.name || "Away";
|
|
3495
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3496
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3497
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_native12.View, { style: [styles6.card, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
3744
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native12.Text, { style: [styles6.title, { color: t.text }], children: "Pick Your Winner" }),
|
|
3745
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_native12.View, { style: styles6.row, children: [
|
|
3498
3746
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3499
3747
|
TeamOption,
|
|
3500
3748
|
{
|
|
@@ -3537,33 +3785,33 @@ function TeamOption({
|
|
|
3537
3785
|
ImageComponent,
|
|
3538
3786
|
t
|
|
3539
3787
|
}) {
|
|
3540
|
-
const [imgFailed, setImgFailed] = (0,
|
|
3788
|
+
const [imgFailed, setImgFailed] = (0, import_react22.useState)(false);
|
|
3541
3789
|
const Img = ImageComponent || require("react-native").Image;
|
|
3542
3790
|
const showImage = imageUrl && !imgFailed;
|
|
3543
3791
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3544
|
-
|
|
3792
|
+
import_react_native12.TouchableOpacity,
|
|
3545
3793
|
{
|
|
3546
3794
|
style: [styles6.option, { borderColor: selected ? color : t.border, backgroundColor: selected ? color + "15" : t.background }],
|
|
3547
3795
|
onPress,
|
|
3548
3796
|
activeOpacity: 0.7,
|
|
3549
3797
|
children: [
|
|
3550
|
-
showImage ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Img, { source: { uri: imageUrl }, style: styles6.logo, resizeMode: "contain", onError: () => setImgFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3551
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3552
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3798
|
+
showImage ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Img, { source: { uri: imageUrl }, style: styles6.logo, resizeMode: "contain", onError: () => setImgFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native12.View, { style: [styles6.logo, styles6.logoPlaceholder] }),
|
|
3799
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native12.Text, { style: [styles6.name, { color: t.text }], numberOfLines: 1, children: name }),
|
|
3800
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_native12.Text, { style: [styles6.odds, { color }], children: [
|
|
3553
3801
|
odds,
|
|
3554
3802
|
"x"
|
|
3555
3803
|
] }),
|
|
3556
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
3804
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_native12.Text, { style: [styles6.bets, { color: t.textMuted }], children: [
|
|
3557
3805
|
bets,
|
|
3558
3806
|
" ",
|
|
3559
3807
|
bets === 1 ? "bet" : "bets"
|
|
3560
3808
|
] }),
|
|
3561
|
-
selected && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3809
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native12.View, { style: [styles6.badge, { backgroundColor: color }], children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native12.Text, { style: styles6.badgeText, children: "Selected" }) })
|
|
3562
3810
|
]
|
|
3563
3811
|
}
|
|
3564
3812
|
);
|
|
3565
3813
|
}
|
|
3566
|
-
var styles6 =
|
|
3814
|
+
var styles6 = import_react_native12.StyleSheet.create({
|
|
3567
3815
|
card: { borderRadius: 16, borderWidth: 1, padding: 16 },
|
|
3568
3816
|
title: { fontSize: 17, fontWeight: "700", marginBottom: 12 },
|
|
3569
3817
|
row: { flexDirection: "row", gap: 12 },
|
|
@@ -3578,8 +3826,8 @@ var styles6 = import_react_native11.StyleSheet.create({
|
|
|
3578
3826
|
});
|
|
3579
3827
|
|
|
3580
3828
|
// src/ui/game/PlayersCard.tsx
|
|
3581
|
-
var
|
|
3582
|
-
var
|
|
3829
|
+
var import_react23 = require("react");
|
|
3830
|
+
var import_react_native13 = require("react-native");
|
|
3583
3831
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
3584
3832
|
function truncateWallet(addr, chars) {
|
|
3585
3833
|
if (addr.length <= chars * 2 + 3) return addr;
|
|
@@ -3600,12 +3848,12 @@ function PlayersCard({
|
|
|
3600
3848
|
if (team === "away") return awayColor;
|
|
3601
3849
|
return drawColor;
|
|
3602
3850
|
};
|
|
3603
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3604
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_native13.View, { style: [styles7.card, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
3852
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_native13.Text, { style: [styles7.title, { color: t.text }], children: [
|
|
3605
3853
|
"Players",
|
|
3606
3854
|
bettors.length > 0 ? ` (${bettors.length})` : ""
|
|
3607
3855
|
] }),
|
|
3608
|
-
bettors.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3856
|
+
bettors.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native13.Text, { style: [styles7.empty, { color: t.textMuted }], children: "No players yet \u2014 be the first!" }) : bettors.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3609
3857
|
BettorRow,
|
|
3610
3858
|
{
|
|
3611
3859
|
bettor: b,
|
|
@@ -3627,20 +3875,20 @@ function BettorRow({
|
|
|
3627
3875
|
ImageComponent,
|
|
3628
3876
|
t
|
|
3629
3877
|
}) {
|
|
3630
|
-
const [imgFailed, setImgFailed] = (0,
|
|
3878
|
+
const [imgFailed, setImgFailed] = (0, import_react23.useState)(false);
|
|
3631
3879
|
const Img = ImageComponent || require("react-native").Image;
|
|
3632
3880
|
const showAvatar = bettor.avatar && !imgFailed;
|
|
3633
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3634
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3635
|
-
showAvatar ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Img, { source: { uri: bettor.avatar }, style: styles7.avatar, resizeMode: "cover", onError: () => setImgFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3636
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3637
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_native13.View, { style: [styles7.row, !isFirst && { borderTopColor: t.border, borderTopWidth: 1 }], children: [
|
|
3882
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native13.View, { style: [styles7.dot, { backgroundColor: dotColor }] }),
|
|
3883
|
+
showAvatar ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Img, { source: { uri: bettor.avatar }, style: styles7.avatar, resizeMode: "cover", onError: () => setImgFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native13.View, { style: [styles7.avatar, styles7.avatarPlaceholder] }),
|
|
3884
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native13.View, { style: styles7.nameCol, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native13.Text, { style: [styles7.username, { color: t.text }], numberOfLines: 1, children: bettor.username || truncateWallet(bettor.wallet, truncateChars) }) }),
|
|
3885
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_native13.Text, { style: [styles7.amount, { color: t.textSecondary }], children: [
|
|
3638
3886
|
bettor.amount,
|
|
3639
3887
|
" SOL"
|
|
3640
3888
|
] })
|
|
3641
3889
|
] });
|
|
3642
3890
|
}
|
|
3643
|
-
var styles7 =
|
|
3891
|
+
var styles7 = import_react_native13.StyleSheet.create({
|
|
3644
3892
|
card: { borderRadius: 16, borderWidth: 1, padding: 16 },
|
|
3645
3893
|
title: { fontSize: 17, fontWeight: "700", marginBottom: 12 },
|
|
3646
3894
|
empty: { fontSize: 14, textAlign: "center", paddingVertical: 16 },
|
|
@@ -3654,8 +3902,8 @@ var styles7 = import_react_native12.StyleSheet.create({
|
|
|
3654
3902
|
});
|
|
3655
3903
|
|
|
3656
3904
|
// src/ui/game/JoinGameButton.tsx
|
|
3657
|
-
var
|
|
3658
|
-
var
|
|
3905
|
+
var import_react24 = require("react");
|
|
3906
|
+
var import_react_native14 = require("react-native");
|
|
3659
3907
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
3660
3908
|
var STATUS_LABELS = {
|
|
3661
3909
|
building: "Building transaction...",
|
|
@@ -3665,37 +3913,37 @@ var STATUS_LABELS = {
|
|
|
3665
3913
|
};
|
|
3666
3914
|
function JoinGameButton({ game, walletAddress, selectedTeam, status, onJoin }) {
|
|
3667
3915
|
const t = useDubsTheme();
|
|
3668
|
-
const alreadyJoined = (0,
|
|
3916
|
+
const alreadyJoined = (0, import_react24.useMemo)(() => {
|
|
3669
3917
|
if (!walletAddress) return false;
|
|
3670
3918
|
return (game.bettors || []).some((b) => b.wallet === walletAddress);
|
|
3671
3919
|
}, [game.bettors, walletAddress]);
|
|
3672
3920
|
if (alreadyJoined || game.isLocked || game.isResolved) return null;
|
|
3673
3921
|
const isJoining = status !== "idle" && status !== "success" && status !== "error";
|
|
3674
3922
|
const statusLabel = STATUS_LABELS[status] || "";
|
|
3675
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
3676
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
3677
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3678
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
3923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native14.View, { style: [styles8.bar, { backgroundColor: t.background, borderTopColor: t.border }], children: [
|
|
3924
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native14.View, { style: styles8.buyInRow, children: [
|
|
3925
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native14.Text, { style: [styles8.buyInLabel, { color: t.textMuted }], children: "Buy-in" }),
|
|
3926
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native14.Text, { style: [styles8.buyInValue, { color: t.text }], children: [
|
|
3679
3927
|
game.buyIn,
|
|
3680
3928
|
" SOL"
|
|
3681
3929
|
] })
|
|
3682
3930
|
] }),
|
|
3683
3931
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3684
|
-
|
|
3932
|
+
import_react_native14.TouchableOpacity,
|
|
3685
3933
|
{
|
|
3686
3934
|
style: [styles8.button, { backgroundColor: selectedTeam ? t.accent : t.border }],
|
|
3687
3935
|
disabled: !selectedTeam || isJoining,
|
|
3688
3936
|
onPress: onJoin,
|
|
3689
3937
|
activeOpacity: 0.8,
|
|
3690
|
-
children: isJoining ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
3691
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3692
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3693
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3938
|
+
children: isJoining ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native14.View, { style: styles8.joiningRow, children: [
|
|
3939
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native14.ActivityIndicator, { size: "small", color: "#000" }),
|
|
3940
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native14.Text, { style: styles8.buttonText, children: statusLabel })
|
|
3941
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native14.Text, { style: [styles8.buttonText, !selectedTeam && { color: t.textMuted }], children: selectedTeam ? `Join Bet \u2014 ${game.buyIn} SOL` : "Pick a team to bet" })
|
|
3694
3942
|
}
|
|
3695
3943
|
)
|
|
3696
3944
|
] });
|
|
3697
3945
|
}
|
|
3698
|
-
var styles8 =
|
|
3946
|
+
var styles8 = import_react_native14.StyleSheet.create({
|
|
3699
3947
|
bar: { position: "absolute", bottom: 0, left: 0, right: 0, paddingHorizontal: 16, paddingTop: 12, paddingBottom: 36, borderTopWidth: 1 },
|
|
3700
3948
|
buyInRow: { flexDirection: "row", alignItems: "center", justifyContent: "space-between", marginBottom: 10 },
|
|
3701
3949
|
buyInLabel: { fontSize: 13 },
|
|
@@ -3706,8 +3954,8 @@ var styles8 = import_react_native13.StyleSheet.create({
|
|
|
3706
3954
|
});
|
|
3707
3955
|
|
|
3708
3956
|
// src/ui/game/CreateCustomGameSheet.tsx
|
|
3709
|
-
var
|
|
3710
|
-
var
|
|
3957
|
+
var import_react25 = require("react");
|
|
3958
|
+
var import_react_native15 = require("react-native");
|
|
3711
3959
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
3712
3960
|
var STATUS_LABELS2 = {
|
|
3713
3961
|
building: "Building transaction...",
|
|
@@ -3732,18 +3980,18 @@ function CreateCustomGameSheet({
|
|
|
3732
3980
|
const t = useDubsTheme();
|
|
3733
3981
|
const { wallet } = useDubs();
|
|
3734
3982
|
const mutation = useCreateCustomGame();
|
|
3735
|
-
const [selectedAmount, setSelectedAmount] = (0,
|
|
3736
|
-
const [customAmount, setCustomAmount] = (0,
|
|
3737
|
-
const [isCustom, setIsCustom] = (0,
|
|
3738
|
-
const overlayOpacity = (0,
|
|
3739
|
-
(0,
|
|
3740
|
-
|
|
3983
|
+
const [selectedAmount, setSelectedAmount] = (0, import_react25.useState)(null);
|
|
3984
|
+
const [customAmount, setCustomAmount] = (0, import_react25.useState)("");
|
|
3985
|
+
const [isCustom, setIsCustom] = (0, import_react25.useState)(false);
|
|
3986
|
+
const overlayOpacity = (0, import_react25.useRef)(new import_react_native15.Animated.Value(0)).current;
|
|
3987
|
+
(0, import_react25.useEffect)(() => {
|
|
3988
|
+
import_react_native15.Animated.timing(overlayOpacity, {
|
|
3741
3989
|
toValue: visible ? 1 : 0,
|
|
3742
3990
|
duration: 250,
|
|
3743
3991
|
useNativeDriver: true
|
|
3744
3992
|
}).start();
|
|
3745
3993
|
}, [visible, overlayOpacity]);
|
|
3746
|
-
(0,
|
|
3994
|
+
(0, import_react25.useEffect)(() => {
|
|
3747
3995
|
if (visible) {
|
|
3748
3996
|
setSelectedAmount(defaultAmount ?? null);
|
|
3749
3997
|
setCustomAmount("");
|
|
@@ -3751,7 +3999,7 @@ function CreateCustomGameSheet({
|
|
|
3751
3999
|
mutation.reset();
|
|
3752
4000
|
}
|
|
3753
4001
|
}, [visible]);
|
|
3754
|
-
(0,
|
|
4002
|
+
(0, import_react25.useEffect)(() => {
|
|
3755
4003
|
if (mutation.status === "success" && mutation.data) {
|
|
3756
4004
|
onSuccess?.(mutation.data);
|
|
3757
4005
|
const timer = setTimeout(() => {
|
|
@@ -3760,23 +4008,23 @@ function CreateCustomGameSheet({
|
|
|
3760
4008
|
return () => clearTimeout(timer);
|
|
3761
4009
|
}
|
|
3762
4010
|
}, [mutation.status, mutation.data]);
|
|
3763
|
-
(0,
|
|
4011
|
+
(0, import_react25.useEffect)(() => {
|
|
3764
4012
|
if (mutation.status === "error" && mutation.error) {
|
|
3765
4013
|
onError?.(mutation.error);
|
|
3766
4014
|
}
|
|
3767
4015
|
}, [mutation.status, mutation.error]);
|
|
3768
|
-
const handlePresetSelect = (0,
|
|
4016
|
+
const handlePresetSelect = (0, import_react25.useCallback)((amount) => {
|
|
3769
4017
|
setSelectedAmount(amount);
|
|
3770
4018
|
setIsCustom(false);
|
|
3771
4019
|
setCustomAmount("");
|
|
3772
4020
|
onAmountChange?.(amount);
|
|
3773
4021
|
}, [onAmountChange]);
|
|
3774
|
-
const handleCustomSelect = (0,
|
|
4022
|
+
const handleCustomSelect = (0, import_react25.useCallback)(() => {
|
|
3775
4023
|
setIsCustom(true);
|
|
3776
4024
|
setSelectedAmount(null);
|
|
3777
4025
|
onAmountChange?.(null);
|
|
3778
4026
|
}, [onAmountChange]);
|
|
3779
|
-
const handleCustomAmountChange = (0,
|
|
4027
|
+
const handleCustomAmountChange = (0, import_react25.useCallback)((text) => {
|
|
3780
4028
|
const cleaned = text.replace(/[^0-9.]/g, "").replace(/(\..*?)\..*/g, "$1");
|
|
3781
4029
|
setCustomAmount(cleaned);
|
|
3782
4030
|
const parsed = parseFloat(cleaned);
|
|
@@ -3791,7 +4039,7 @@ function CreateCustomGameSheet({
|
|
|
3791
4039
|
const winnerTakes = pot * (1 - fee / 100);
|
|
3792
4040
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
3793
4041
|
const canCreate = finalAmount !== null && finalAmount > 0 && !isMutating && mutation.status !== "success";
|
|
3794
|
-
const handleCreate = (0,
|
|
4042
|
+
const handleCreate = (0, import_react25.useCallback)(async () => {
|
|
3795
4043
|
if (!finalAmount || !wallet.publicKey) return;
|
|
3796
4044
|
try {
|
|
3797
4045
|
await mutation.execute({
|
|
@@ -3808,32 +4056,32 @@ function CreateCustomGameSheet({
|
|
|
3808
4056
|
const statusLabel = STATUS_LABELS2[mutation.status] || "";
|
|
3809
4057
|
const playersLabel = playerCount === 2 ? "2 (1v1)" : `${playerCount} players`;
|
|
3810
4058
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
3811
|
-
|
|
4059
|
+
import_react_native15.Modal,
|
|
3812
4060
|
{
|
|
3813
4061
|
visible,
|
|
3814
4062
|
animationType: "slide",
|
|
3815
4063
|
transparent: true,
|
|
3816
4064
|
onRequestClose: onDismiss,
|
|
3817
4065
|
children: [
|
|
3818
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
4066
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.Animated.View, { style: [styles9.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.TouchableOpacity, { style: styles9.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
3819
4067
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3820
|
-
|
|
4068
|
+
import_react_native15.KeyboardAvoidingView,
|
|
3821
4069
|
{
|
|
3822
4070
|
style: styles9.keyboardView,
|
|
3823
|
-
behavior:
|
|
3824
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3825
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3826
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
3827
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3828
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
4071
|
+
behavior: import_react_native15.Platform.OS === "ios" ? "padding" : void 0,
|
|
4072
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.View, { style: styles9.sheetPositioner, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native15.View, { style: [styles9.sheet, { backgroundColor: t.background }], children: [
|
|
4073
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.View, { style: styles9.handleRow, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.View, { style: [styles9.handle, { backgroundColor: t.textMuted }] }) }),
|
|
4074
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native15.View, { style: styles9.header, children: [
|
|
4075
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.Text, { style: [styles9.headerTitle, { color: t.text }], children: isPoolModeEnabled ? "Create Pool" : "New Game" }),
|
|
4076
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.TouchableOpacity, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.Text, { style: [styles9.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
3829
4077
|
] }),
|
|
3830
|
-
!isPoolModeEnabled && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
3831
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3832
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
4078
|
+
!isPoolModeEnabled && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native15.View, { style: styles9.section, children: [
|
|
4079
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.Text, { style: [styles9.sectionLabel, { color: t.textSecondary }], children: "Buy-In Amount" }),
|
|
4080
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native15.View, { style: styles9.chipsRow, children: [
|
|
3833
4081
|
presetAmounts.map((amount) => {
|
|
3834
4082
|
const active = !isCustom && selectedAmount === amount;
|
|
3835
4083
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3836
|
-
|
|
4084
|
+
import_react_native15.TouchableOpacity,
|
|
3837
4085
|
{
|
|
3838
4086
|
style: [
|
|
3839
4087
|
styles9.chip,
|
|
@@ -3842,7 +4090,7 @@ function CreateCustomGameSheet({
|
|
|
3842
4090
|
],
|
|
3843
4091
|
onPress: () => handlePresetSelect(amount),
|
|
3844
4092
|
activeOpacity: 0.8,
|
|
3845
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
4093
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native15.Text, { style: [styles9.chipText, { color: active ? "#FFFFFF" : t.text }], children: [
|
|
3846
4094
|
amount,
|
|
3847
4095
|
" SOL"
|
|
3848
4096
|
] })
|
|
@@ -3851,7 +4099,7 @@ function CreateCustomGameSheet({
|
|
|
3851
4099
|
);
|
|
3852
4100
|
}),
|
|
3853
4101
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3854
|
-
|
|
4102
|
+
import_react_native15.TouchableOpacity,
|
|
3855
4103
|
{
|
|
3856
4104
|
style: [
|
|
3857
4105
|
styles9.chip,
|
|
@@ -3860,12 +4108,12 @@ function CreateCustomGameSheet({
|
|
|
3860
4108
|
],
|
|
3861
4109
|
onPress: handleCustomSelect,
|
|
3862
4110
|
activeOpacity: 0.8,
|
|
3863
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
4111
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.Text, { style: [styles9.chipText, { color: isCustom ? "#FFFFFF" : t.text }], children: "Custom" })
|
|
3864
4112
|
}
|
|
3865
4113
|
)
|
|
3866
4114
|
] }),
|
|
3867
4115
|
isCustom && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3868
|
-
|
|
4116
|
+
import_react_native15.TextInput,
|
|
3869
4117
|
{
|
|
3870
4118
|
style: [styles9.input, { backgroundColor: t.surface, color: t.text, borderColor: t.accent }],
|
|
3871
4119
|
placeholder: "Enter amount in SOL",
|
|
@@ -3877,31 +4125,31 @@ function CreateCustomGameSheet({
|
|
|
3877
4125
|
}
|
|
3878
4126
|
)
|
|
3879
4127
|
] }),
|
|
3880
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
3881
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
3882
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3883
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
4128
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native15.View, { style: [styles9.summaryCard, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
4129
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native15.View, { style: styles9.summaryRow, children: [
|
|
4130
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.Text, { style: [styles9.summaryLabel, { color: t.textMuted }], children: "Buy-in" }),
|
|
4131
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.Text, { style: [styles9.summaryValue, { color: t.text }], children: finalAmount ? `${finalAmount} SOL` : "\u2014" })
|
|
3884
4132
|
] }),
|
|
3885
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3886
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
3887
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3888
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
4133
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.View, { style: [styles9.summarySep, { backgroundColor: t.border }] }),
|
|
4134
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native15.View, { style: styles9.summaryRow, children: [
|
|
4135
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.Text, { style: [styles9.summaryLabel, { color: t.textMuted }], children: isPoolModeEnabled ? "Max players" : "Players" }),
|
|
4136
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.Text, { style: [styles9.summaryValue, { color: t.text }], children: isPoolModeEnabled ? playerCount : playersLabel })
|
|
3889
4137
|
] }),
|
|
3890
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3891
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
3892
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3893
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
3894
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3895
|
-
finalAmount ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
4138
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.View, { style: [styles9.summarySep, { backgroundColor: t.border }] }),
|
|
4139
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native15.View, { style: styles9.summaryRow, children: [
|
|
4140
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.Text, { style: [styles9.summaryLabel, { color: t.textMuted }], children: isPoolModeEnabled ? "Max pot" : "Winner Takes" }),
|
|
4141
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native15.View, { style: styles9.winnerCol, children: [
|
|
4142
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.Text, { style: [styles9.summaryValue, { color: t.success }], children: finalAmount ? `${(finalAmount * playerCount * (1 - fee / 100)).toFixed(4)} SOL` : "\u2014" }),
|
|
4143
|
+
finalAmount ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native15.Text, { style: [styles9.feeNote, { color: t.textDim }], children: [
|
|
3896
4144
|
fee,
|
|
3897
4145
|
"% platform fee"
|
|
3898
4146
|
] }) : null
|
|
3899
4147
|
] })
|
|
3900
4148
|
] })
|
|
3901
4149
|
] }),
|
|
3902
|
-
mutation.error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
4150
|
+
mutation.error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.View, { style: [styles9.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.Text, { style: [styles9.errorText, { color: t.errorText }], children: mutation.error.message }) }),
|
|
3903
4151
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3904
|
-
|
|
4152
|
+
import_react_native15.TouchableOpacity,
|
|
3905
4153
|
{
|
|
3906
4154
|
style: [
|
|
3907
4155
|
styles9.ctaButton,
|
|
@@ -3910,10 +4158,10 @@ function CreateCustomGameSheet({
|
|
|
3910
4158
|
disabled: !canCreate,
|
|
3911
4159
|
onPress: handleCreate,
|
|
3912
4160
|
activeOpacity: 0.8,
|
|
3913
|
-
children: isMutating ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
3914
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3915
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3916
|
-
] }) : mutation.status === "success" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
4161
|
+
children: isMutating ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native15.View, { style: styles9.ctaLoading, children: [
|
|
4162
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.ActivityIndicator, { size: "small", color: "#FFFFFF" }),
|
|
4163
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.Text, { style: styles9.ctaText, children: statusLabel })
|
|
4164
|
+
] }) : mutation.status === "success" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.Text, { style: styles9.ctaText, children: isPoolModeEnabled ? "Pool Created!" : STATUS_LABELS2.success }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native15.Text, { style: [styles9.ctaText, !canCreate && { opacity: 0.5 }], children: isPoolModeEnabled ? `Create Pool \u2014 ${finalAmount} SOL` : effectiveAmount ? `Create Game \u2014 ${effectiveAmount} SOL` : "Select buy-in amount" })
|
|
3917
4165
|
}
|
|
3918
4166
|
)
|
|
3919
4167
|
] }) })
|
|
@@ -3923,9 +4171,9 @@ function CreateCustomGameSheet({
|
|
|
3923
4171
|
}
|
|
3924
4172
|
);
|
|
3925
4173
|
}
|
|
3926
|
-
var styles9 =
|
|
4174
|
+
var styles9 = import_react_native15.StyleSheet.create({
|
|
3927
4175
|
overlay: {
|
|
3928
|
-
...
|
|
4176
|
+
...import_react_native15.StyleSheet.absoluteFillObject,
|
|
3929
4177
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
3930
4178
|
},
|
|
3931
4179
|
overlayTap: {
|
|
@@ -4060,8 +4308,8 @@ var styles9 = import_react_native14.StyleSheet.create({
|
|
|
4060
4308
|
});
|
|
4061
4309
|
|
|
4062
4310
|
// src/ui/game/JoinGameSheet.tsx
|
|
4063
|
-
var
|
|
4064
|
-
var
|
|
4311
|
+
var import_react26 = require("react");
|
|
4312
|
+
var import_react_native16 = require("react-native");
|
|
4065
4313
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
4066
4314
|
var STATUS_LABELS3 = {
|
|
4067
4315
|
building: "Building transaction...",
|
|
@@ -4086,22 +4334,22 @@ function JoinGameSheet({
|
|
|
4086
4334
|
const { wallet } = useDubs();
|
|
4087
4335
|
const mutation = useJoinGame();
|
|
4088
4336
|
const isCustomGame = game.gameMode === CUSTOM_GAME_MODE;
|
|
4089
|
-
const [selectedTeam, setSelectedTeam] = (0,
|
|
4090
|
-
const overlayOpacity = (0,
|
|
4091
|
-
(0,
|
|
4092
|
-
|
|
4337
|
+
const [selectedTeam, setSelectedTeam] = (0, import_react26.useState)(null);
|
|
4338
|
+
const overlayOpacity = (0, import_react26.useRef)(new import_react_native16.Animated.Value(0)).current;
|
|
4339
|
+
(0, import_react26.useEffect)(() => {
|
|
4340
|
+
import_react_native16.Animated.timing(overlayOpacity, {
|
|
4093
4341
|
toValue: visible ? 1 : 0,
|
|
4094
4342
|
duration: 250,
|
|
4095
4343
|
useNativeDriver: true
|
|
4096
4344
|
}).start();
|
|
4097
4345
|
}, [visible, overlayOpacity]);
|
|
4098
|
-
(0,
|
|
4346
|
+
(0, import_react26.useEffect)(() => {
|
|
4099
4347
|
if (visible) {
|
|
4100
4348
|
setSelectedTeam(isPoolModeEnabled ? "home" : isCustomGame ? "away" : null);
|
|
4101
4349
|
mutation.reset();
|
|
4102
4350
|
}
|
|
4103
4351
|
}, [visible]);
|
|
4104
|
-
(0,
|
|
4352
|
+
(0, import_react26.useEffect)(() => {
|
|
4105
4353
|
if (mutation.status === "success" && mutation.data) {
|
|
4106
4354
|
onSuccess?.(mutation.data);
|
|
4107
4355
|
const timer = setTimeout(() => {
|
|
@@ -4110,7 +4358,7 @@ function JoinGameSheet({
|
|
|
4110
4358
|
return () => clearTimeout(timer);
|
|
4111
4359
|
}
|
|
4112
4360
|
}, [mutation.status, mutation.data]);
|
|
4113
|
-
(0,
|
|
4361
|
+
(0, import_react26.useEffect)(() => {
|
|
4114
4362
|
if (mutation.status === "error" && mutation.error) {
|
|
4115
4363
|
onError?.(mutation.error);
|
|
4116
4364
|
}
|
|
@@ -4121,7 +4369,7 @@ function JoinGameSheet({
|
|
|
4121
4369
|
const homePool = game.homePool || 0;
|
|
4122
4370
|
const awayPool = game.awayPool || 0;
|
|
4123
4371
|
const buyIn = game.buyIn;
|
|
4124
|
-
const { homeOdds, awayOdds, homeBets, awayBets } = (0,
|
|
4372
|
+
const { homeOdds, awayOdds, homeBets, awayBets } = (0, import_react26.useMemo)(() => ({
|
|
4125
4373
|
homeOdds: homePool > 0 ? (totalPool / homePool).toFixed(2) : "\u2014",
|
|
4126
4374
|
awayOdds: awayPool > 0 ? (totalPool / awayPool).toFixed(2) : "\u2014",
|
|
4127
4375
|
homeBets: bettors.filter((b) => b.team === "home").length,
|
|
@@ -4133,14 +4381,14 @@ function JoinGameSheet({
|
|
|
4133
4381
|
const homeName = shortName ? shortName(opponents[0]?.name) : opponents[0]?.name || "Home";
|
|
4134
4382
|
const awayName = shortName ? shortName(opponents[1]?.name) : opponents[1]?.name || "Away";
|
|
4135
4383
|
const selectedName = selectedTeam === "home" ? homeName : selectedTeam === "away" ? awayName : "\u2014";
|
|
4136
|
-
const alreadyJoined = (0,
|
|
4384
|
+
const alreadyJoined = (0, import_react26.useMemo)(() => {
|
|
4137
4385
|
if (!wallet.publicKey) return false;
|
|
4138
4386
|
const addr = wallet.publicKey.toBase58();
|
|
4139
4387
|
return bettors.some((b) => b.wallet === addr);
|
|
4140
4388
|
}, [bettors, wallet.publicKey]);
|
|
4141
4389
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
4142
4390
|
const canJoin = selectedTeam !== null && !isMutating && mutation.status !== "success" && !alreadyJoined;
|
|
4143
|
-
const handleJoin = (0,
|
|
4391
|
+
const handleJoin = (0, import_react26.useCallback)(async () => {
|
|
4144
4392
|
if (!selectedTeam || !wallet.publicKey) return;
|
|
4145
4393
|
try {
|
|
4146
4394
|
await mutation.execute({
|
|
@@ -4154,28 +4402,28 @@ function JoinGameSheet({
|
|
|
4154
4402
|
}, [selectedTeam, wallet.publicKey, mutation.execute, game.gameId, buyIn]);
|
|
4155
4403
|
const statusLabel = STATUS_LABELS3[mutation.status] || "";
|
|
4156
4404
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4157
|
-
|
|
4405
|
+
import_react_native16.Modal,
|
|
4158
4406
|
{
|
|
4159
4407
|
visible,
|
|
4160
4408
|
animationType: "slide",
|
|
4161
4409
|
transparent: true,
|
|
4162
4410
|
onRequestClose: onDismiss,
|
|
4163
4411
|
children: [
|
|
4164
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4412
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.Animated.View, { style: [styles10.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.TouchableOpacity, { style: styles10.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
4165
4413
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4166
|
-
|
|
4414
|
+
import_react_native16.KeyboardAvoidingView,
|
|
4167
4415
|
{
|
|
4168
4416
|
style: styles10.keyboardView,
|
|
4169
|
-
behavior:
|
|
4170
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4171
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4172
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4173
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4174
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4417
|
+
behavior: import_react_native16.Platform.OS === "ios" ? "padding" : void 0,
|
|
4418
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.View, { style: styles10.sheetPositioner, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native16.View, { style: [styles10.sheet, { backgroundColor: t.background }], children: [
|
|
4419
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.View, { style: styles10.handleRow, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.View, { style: [styles10.handle, { backgroundColor: t.textMuted }] }) }),
|
|
4420
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native16.View, { style: styles10.header, children: [
|
|
4421
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.Text, { style: [styles10.headerTitle, { color: t.text }], children: isPoolModeEnabled ? "Join Pool" : "Join Game" }),
|
|
4422
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.TouchableOpacity, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.Text, { style: [styles10.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
4175
4423
|
] }),
|
|
4176
|
-
!isCustomGame && !isPoolModeEnabled && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4177
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4178
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4424
|
+
!isCustomGame && !isPoolModeEnabled && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native16.View, { style: styles10.section, children: [
|
|
4425
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.Text, { style: [styles10.sectionLabel, { color: t.textSecondary }], children: "Pick Your Side" }),
|
|
4426
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native16.View, { style: styles10.teamsRow, children: [
|
|
4179
4427
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4180
4428
|
TeamButton,
|
|
4181
4429
|
{
|
|
@@ -4206,52 +4454,52 @@ function JoinGameSheet({
|
|
|
4206
4454
|
)
|
|
4207
4455
|
] })
|
|
4208
4456
|
] }),
|
|
4209
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4210
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4211
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4212
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4457
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native16.View, { style: [styles10.summaryCard, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
4458
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native16.View, { style: styles10.summaryRow, children: [
|
|
4459
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.Text, { style: [styles10.summaryLabel, { color: t.textMuted }], children: "Buy-in" }),
|
|
4460
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native16.Text, { style: [styles10.summaryValue, { color: t.text }], children: [
|
|
4213
4461
|
buyIn,
|
|
4214
4462
|
" SOL"
|
|
4215
4463
|
] })
|
|
4216
4464
|
] }),
|
|
4217
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4465
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.View, { style: [styles10.summarySep, { backgroundColor: t.border }] }),
|
|
4218
4466
|
isPoolModeEnabled ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
4219
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4220
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4221
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4467
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native16.View, { style: styles10.summaryRow, children: [
|
|
4468
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.Text, { style: [styles10.summaryLabel, { color: t.textMuted }], children: "Players in" }),
|
|
4469
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.Text, { style: [styles10.summaryValue, { color: t.text }], children: bettors.length })
|
|
4222
4470
|
] }),
|
|
4223
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4224
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4225
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4226
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4471
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.View, { style: [styles10.summarySep, { backgroundColor: t.border }] }),
|
|
4472
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native16.View, { style: styles10.summaryRow, children: [
|
|
4473
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.Text, { style: [styles10.summaryLabel, { color: t.textMuted }], children: "Current pot" }),
|
|
4474
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native16.Text, { style: [styles10.summaryValue, { color: t.success }], children: [
|
|
4227
4475
|
totalPool,
|
|
4228
4476
|
" SOL"
|
|
4229
4477
|
] })
|
|
4230
4478
|
] })
|
|
4231
4479
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
4232
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4233
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4234
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4480
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native16.View, { style: styles10.summaryRow, children: [
|
|
4481
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.Text, { style: [styles10.summaryLabel, { color: t.textMuted }], children: "Your side" }),
|
|
4482
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.Text, { style: [styles10.summaryValue, { color: t.text }], children: selectedName })
|
|
4235
4483
|
] }),
|
|
4236
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4237
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4238
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4239
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4484
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.View, { style: [styles10.summarySep, { backgroundColor: t.border }] }),
|
|
4485
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native16.View, { style: styles10.summaryRow, children: [
|
|
4486
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.Text, { style: [styles10.summaryLabel, { color: t.textMuted }], children: "Total pool" }),
|
|
4487
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native16.Text, { style: [styles10.summaryValue, { color: t.text }], children: [
|
|
4240
4488
|
poolAfterJoin,
|
|
4241
4489
|
" SOL"
|
|
4242
4490
|
] })
|
|
4243
4491
|
] }),
|
|
4244
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4245
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4246
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4247
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4492
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.View, { style: [styles10.summarySep, { backgroundColor: t.border }] }),
|
|
4493
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native16.View, { style: styles10.summaryRow, children: [
|
|
4494
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.Text, { style: [styles10.summaryLabel, { color: t.textMuted }], children: "Potential winnings" }),
|
|
4495
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.Text, { style: [styles10.summaryValue, { color: t.success }], children: potentialWinnings !== "\u2014" ? `${potentialWinnings} SOL` : "\u2014" })
|
|
4248
4496
|
] })
|
|
4249
4497
|
] })
|
|
4250
4498
|
] }),
|
|
4251
|
-
alreadyJoined && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4252
|
-
mutation.error && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4499
|
+
alreadyJoined && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.View, { style: [styles10.errorBox, { backgroundColor: t.surface, borderColor: t.border }], children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.Text, { style: [styles10.errorText, { color: t.textMuted }], children: isPoolModeEnabled ? "You've already joined this pool." : "You've already joined this game." }) }),
|
|
4500
|
+
mutation.error && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.View, { style: [styles10.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.Text, { style: [styles10.errorText, { color: t.errorText }], children: mutation.error.message }) }),
|
|
4253
4501
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4254
|
-
|
|
4502
|
+
import_react_native16.TouchableOpacity,
|
|
4255
4503
|
{
|
|
4256
4504
|
style: [
|
|
4257
4505
|
styles10.ctaButton,
|
|
@@ -4260,10 +4508,10 @@ function JoinGameSheet({
|
|
|
4260
4508
|
disabled: !canJoin,
|
|
4261
4509
|
onPress: handleJoin,
|
|
4262
4510
|
activeOpacity: 0.8,
|
|
4263
|
-
children: isMutating ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4264
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4265
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4266
|
-
] }) : mutation.status === "success" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4511
|
+
children: isMutating ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native16.View, { style: styles10.ctaLoading, children: [
|
|
4512
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.ActivityIndicator, { size: "small", color: "#FFFFFF" }),
|
|
4513
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.Text, { style: styles10.ctaText, children: statusLabel })
|
|
4514
|
+
] }) : mutation.status === "success" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.Text, { style: styles10.ctaText, children: isPoolModeEnabled ? "Joined!" : STATUS_LABELS3.success }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.Text, { style: [styles10.ctaText, !canJoin && { opacity: 0.5 }], children: alreadyJoined ? "Already Joined" : isPoolModeEnabled ? `Join Pool \u2014 ${buyIn} SOL` : selectedTeam ? `Join Game \u2014 ${buyIn} SOL` : "Pick a side to join" })
|
|
4267
4515
|
}
|
|
4268
4516
|
)
|
|
4269
4517
|
] }) })
|
|
@@ -4284,35 +4532,35 @@ function TeamButton({
|
|
|
4284
4532
|
ImageComponent,
|
|
4285
4533
|
t
|
|
4286
4534
|
}) {
|
|
4287
|
-
const [imgFailed, setImgFailed] = (0,
|
|
4535
|
+
const [imgFailed, setImgFailed] = (0, import_react26.useState)(false);
|
|
4288
4536
|
const Img = ImageComponent || require("react-native").Image;
|
|
4289
4537
|
const showImage = imageUrl && !imgFailed;
|
|
4290
4538
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4291
|
-
|
|
4539
|
+
import_react_native16.TouchableOpacity,
|
|
4292
4540
|
{
|
|
4293
4541
|
style: [styles10.teamOption, { borderColor: selected ? color : t.border, backgroundColor: selected ? color + "15" : t.background }],
|
|
4294
4542
|
onPress,
|
|
4295
4543
|
activeOpacity: 0.7,
|
|
4296
4544
|
children: [
|
|
4297
|
-
showImage ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Img, { source: { uri: imageUrl }, style: styles10.teamLogo, resizeMode: "contain", onError: () => setImgFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4298
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4299
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4545
|
+
showImage ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Img, { source: { uri: imageUrl }, style: styles10.teamLogo, resizeMode: "contain", onError: () => setImgFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.View, { style: [styles10.teamLogo, styles10.teamLogoPlaceholder] }),
|
|
4546
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.Text, { style: [styles10.teamName, { color: t.text }], numberOfLines: 1, children: name }),
|
|
4547
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native16.Text, { style: [styles10.teamOdds, { color }], children: [
|
|
4300
4548
|
odds,
|
|
4301
4549
|
"x"
|
|
4302
4550
|
] }),
|
|
4303
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4551
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native16.Text, { style: [styles10.teamBets, { color: t.textMuted }], children: [
|
|
4304
4552
|
bets,
|
|
4305
4553
|
" ",
|
|
4306
4554
|
bets === 1 ? "bet" : "bets"
|
|
4307
4555
|
] }),
|
|
4308
|
-
selected && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4556
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.View, { style: [styles10.teamBadge, { backgroundColor: color }], children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native16.Text, { style: styles10.teamBadgeText, children: "Selected" }) })
|
|
4309
4557
|
]
|
|
4310
4558
|
}
|
|
4311
4559
|
);
|
|
4312
4560
|
}
|
|
4313
|
-
var styles10 =
|
|
4561
|
+
var styles10 = import_react_native16.StyleSheet.create({
|
|
4314
4562
|
overlay: {
|
|
4315
|
-
...
|
|
4563
|
+
...import_react_native16.StyleSheet.absoluteFillObject,
|
|
4316
4564
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
4317
4565
|
},
|
|
4318
4566
|
overlayTap: {
|
|
@@ -4461,8 +4709,8 @@ var styles10 = import_react_native15.StyleSheet.create({
|
|
|
4461
4709
|
});
|
|
4462
4710
|
|
|
4463
4711
|
// src/ui/game/ClaimPrizeSheet.tsx
|
|
4464
|
-
var
|
|
4465
|
-
var
|
|
4712
|
+
var import_react27 = require("react");
|
|
4713
|
+
var import_react_native17 = require("react-native");
|
|
4466
4714
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
4467
4715
|
var STATUS_LABELS4 = {
|
|
4468
4716
|
building: "Building transaction...",
|
|
@@ -4482,18 +4730,18 @@ function ClaimPrizeSheet({
|
|
|
4482
4730
|
const t = useDubsTheme();
|
|
4483
4731
|
const { wallet } = useDubs();
|
|
4484
4732
|
const mutation = useClaim();
|
|
4485
|
-
const overlayOpacity = (0,
|
|
4486
|
-
const celebrationScale = (0,
|
|
4487
|
-
const celebrationOpacity = (0,
|
|
4488
|
-
const [showCelebration, setShowCelebration] = (0,
|
|
4489
|
-
(0,
|
|
4490
|
-
|
|
4733
|
+
const overlayOpacity = (0, import_react27.useRef)(new import_react_native17.Animated.Value(0)).current;
|
|
4734
|
+
const celebrationScale = (0, import_react27.useRef)(new import_react_native17.Animated.Value(0)).current;
|
|
4735
|
+
const celebrationOpacity = (0, import_react27.useRef)(new import_react_native17.Animated.Value(0)).current;
|
|
4736
|
+
const [showCelebration, setShowCelebration] = (0, import_react27.useState)(false);
|
|
4737
|
+
(0, import_react27.useEffect)(() => {
|
|
4738
|
+
import_react_native17.Animated.timing(overlayOpacity, {
|
|
4491
4739
|
toValue: visible ? 1 : 0,
|
|
4492
4740
|
duration: 250,
|
|
4493
4741
|
useNativeDriver: true
|
|
4494
4742
|
}).start();
|
|
4495
4743
|
}, [visible, overlayOpacity]);
|
|
4496
|
-
(0,
|
|
4744
|
+
(0, import_react27.useEffect)(() => {
|
|
4497
4745
|
if (visible) {
|
|
4498
4746
|
mutation.reset();
|
|
4499
4747
|
setShowCelebration(false);
|
|
@@ -4501,17 +4749,17 @@ function ClaimPrizeSheet({
|
|
|
4501
4749
|
celebrationOpacity.setValue(0);
|
|
4502
4750
|
}
|
|
4503
4751
|
}, [visible]);
|
|
4504
|
-
(0,
|
|
4752
|
+
(0, import_react27.useEffect)(() => {
|
|
4505
4753
|
if (mutation.status === "success" && mutation.data) {
|
|
4506
4754
|
setShowCelebration(true);
|
|
4507
|
-
|
|
4508
|
-
|
|
4755
|
+
import_react_native17.Animated.parallel([
|
|
4756
|
+
import_react_native17.Animated.spring(celebrationScale, {
|
|
4509
4757
|
toValue: 1,
|
|
4510
4758
|
tension: 50,
|
|
4511
4759
|
friction: 6,
|
|
4512
4760
|
useNativeDriver: true
|
|
4513
4761
|
}),
|
|
4514
|
-
|
|
4762
|
+
import_react_native17.Animated.timing(celebrationOpacity, {
|
|
4515
4763
|
toValue: 1,
|
|
4516
4764
|
duration: 300,
|
|
4517
4765
|
useNativeDriver: true
|
|
@@ -4524,14 +4772,14 @@ function ClaimPrizeSheet({
|
|
|
4524
4772
|
return () => clearTimeout(timer);
|
|
4525
4773
|
}
|
|
4526
4774
|
}, [mutation.status, mutation.data]);
|
|
4527
|
-
(0,
|
|
4775
|
+
(0, import_react27.useEffect)(() => {
|
|
4528
4776
|
if (mutation.status === "error" && mutation.error) {
|
|
4529
4777
|
onError?.(mutation.error);
|
|
4530
4778
|
}
|
|
4531
4779
|
}, [mutation.status, mutation.error]);
|
|
4532
4780
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
4533
4781
|
const canClaim = !isMutating && mutation.status !== "success" && !!wallet.publicKey;
|
|
4534
|
-
const handleClaim = (0,
|
|
4782
|
+
const handleClaim = (0, import_react27.useCallback)(async () => {
|
|
4535
4783
|
if (!wallet.publicKey) return;
|
|
4536
4784
|
try {
|
|
4537
4785
|
await mutation.execute({
|
|
@@ -4544,27 +4792,27 @@ function ClaimPrizeSheet({
|
|
|
4544
4792
|
}, [wallet.publicKey, mutation.execute, gameId, prizeAmount]);
|
|
4545
4793
|
const statusLabel = STATUS_LABELS4[mutation.status] || "";
|
|
4546
4794
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4547
|
-
|
|
4795
|
+
import_react_native17.Modal,
|
|
4548
4796
|
{
|
|
4549
4797
|
visible,
|
|
4550
4798
|
animationType: "slide",
|
|
4551
4799
|
transparent: true,
|
|
4552
4800
|
onRequestClose: onDismiss,
|
|
4553
4801
|
children: [
|
|
4554
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4802
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native17.Animated.View, { style: [styles11.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native17.TouchableOpacity, { style: styles11.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
4555
4803
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4556
|
-
|
|
4804
|
+
import_react_native17.KeyboardAvoidingView,
|
|
4557
4805
|
{
|
|
4558
4806
|
style: styles11.keyboardView,
|
|
4559
|
-
behavior:
|
|
4560
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4561
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4562
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4563
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4564
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4807
|
+
behavior: import_react_native17.Platform.OS === "ios" ? "padding" : void 0,
|
|
4808
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native17.View, { style: styles11.sheetPositioner, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native17.View, { style: [styles11.sheet, { backgroundColor: t.background }], children: [
|
|
4809
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native17.View, { style: styles11.handleRow, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native17.View, { style: [styles11.handle, { backgroundColor: t.textMuted }] }) }),
|
|
4810
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native17.View, { style: styles11.header, children: [
|
|
4811
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native17.Text, { style: [styles11.headerTitle, { color: t.text }], children: showCelebration ? isRefund ? "Refund Claimed!" : "Prize Claimed!" : isRefund ? "Claim Refund" : "Claim Prize" }),
|
|
4812
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native17.TouchableOpacity, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native17.Text, { style: [styles11.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
4565
4813
|
] }),
|
|
4566
4814
|
showCelebration && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4567
|
-
|
|
4815
|
+
import_react_native17.Animated.View,
|
|
4568
4816
|
{
|
|
4569
4817
|
style: [
|
|
4570
4818
|
styles11.celebrationContainer,
|
|
@@ -4574,29 +4822,29 @@ function ClaimPrizeSheet({
|
|
|
4574
4822
|
}
|
|
4575
4823
|
],
|
|
4576
4824
|
children: [
|
|
4577
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4578
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4825
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native17.Text, { style: styles11.celebrationEmoji, children: "\u{1F3C6}" }),
|
|
4826
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native17.Text, { style: [styles11.celebrationText, { color: t.success }], children: [
|
|
4579
4827
|
"+",
|
|
4580
4828
|
prizeAmount,
|
|
4581
4829
|
" SOL"
|
|
4582
4830
|
] }),
|
|
4583
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4831
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native17.Text, { style: [styles11.celebrationSubtext, { color: t.textMuted }], children: isRefund ? "Refund sent to your wallet" : "Winnings sent to your wallet" })
|
|
4584
4832
|
]
|
|
4585
4833
|
}
|
|
4586
4834
|
),
|
|
4587
|
-
!showCelebration && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4588
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4589
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4590
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4835
|
+
!showCelebration && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native17.View, { style: [styles11.summaryCard, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
4836
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native17.View, { style: styles11.summaryRow, children: [
|
|
4837
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native17.Text, { style: [styles11.summaryLabel, { color: t.textMuted }], children: isRefund ? "Refund" : "Prize" }),
|
|
4838
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native17.Text, { style: [styles11.summaryValue, { color: t.success }], children: [
|
|
4591
4839
|
prizeAmount,
|
|
4592
4840
|
" SOL"
|
|
4593
4841
|
] })
|
|
4594
4842
|
] }),
|
|
4595
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4596
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4597
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4843
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native17.View, { style: [styles11.summarySep, { backgroundColor: t.border }] }),
|
|
4844
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native17.View, { style: styles11.summaryRow, children: [
|
|
4845
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native17.Text, { style: [styles11.summaryLabel, { color: t.textMuted }], children: "Game" }),
|
|
4598
4846
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4599
|
-
|
|
4847
|
+
import_react_native17.Text,
|
|
4600
4848
|
{
|
|
4601
4849
|
style: [styles11.summaryValue, { color: t.text }],
|
|
4602
4850
|
numberOfLines: 1,
|
|
@@ -4609,9 +4857,9 @@ function ClaimPrizeSheet({
|
|
|
4609
4857
|
)
|
|
4610
4858
|
] })
|
|
4611
4859
|
] }),
|
|
4612
|
-
mutation.error && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4860
|
+
mutation.error && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native17.View, { style: [styles11.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native17.Text, { style: [styles11.errorText, { color: t.errorText }], children: mutation.error.message }) }),
|
|
4613
4861
|
!showCelebration && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4614
|
-
|
|
4862
|
+
import_react_native17.TouchableOpacity,
|
|
4615
4863
|
{
|
|
4616
4864
|
style: [
|
|
4617
4865
|
styles11.ctaButton,
|
|
@@ -4620,10 +4868,10 @@ function ClaimPrizeSheet({
|
|
|
4620
4868
|
disabled: !canClaim,
|
|
4621
4869
|
onPress: handleClaim,
|
|
4622
4870
|
activeOpacity: 0.8,
|
|
4623
|
-
children: isMutating ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4624
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4625
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4626
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4871
|
+
children: isMutating ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native17.View, { style: styles11.ctaLoading, children: [
|
|
4872
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native17.ActivityIndicator, { size: "small", color: "#FFFFFF" }),
|
|
4873
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native17.Text, { style: styles11.ctaText, children: statusLabel })
|
|
4874
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native17.Text, { style: [styles11.ctaText, !canClaim && { opacity: 0.5 }], children: [
|
|
4627
4875
|
isRefund ? "Claim Refund" : "Claim Prize",
|
|
4628
4876
|
" \u2014 ",
|
|
4629
4877
|
prizeAmount,
|
|
@@ -4631,7 +4879,7 @@ function ClaimPrizeSheet({
|
|
|
4631
4879
|
] })
|
|
4632
4880
|
}
|
|
4633
4881
|
),
|
|
4634
|
-
mutation.data?.explorerUrl && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4882
|
+
mutation.data?.explorerUrl && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native17.Text, { style: [styles11.explorerHint, { color: t.textMuted }], children: "View on Solscan" })
|
|
4635
4883
|
] }) })
|
|
4636
4884
|
}
|
|
4637
4885
|
)
|
|
@@ -4639,9 +4887,9 @@ function ClaimPrizeSheet({
|
|
|
4639
4887
|
}
|
|
4640
4888
|
);
|
|
4641
4889
|
}
|
|
4642
|
-
var styles11 =
|
|
4890
|
+
var styles11 = import_react_native17.StyleSheet.create({
|
|
4643
4891
|
overlay: {
|
|
4644
|
-
...
|
|
4892
|
+
...import_react_native17.StyleSheet.absoluteFillObject,
|
|
4645
4893
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
4646
4894
|
},
|
|
4647
4895
|
overlayTap: {
|
|
@@ -4764,17 +5012,17 @@ var styles11 = import_react_native16.StyleSheet.create({
|
|
|
4764
5012
|
});
|
|
4765
5013
|
|
|
4766
5014
|
// src/ui/game/ClaimButton.tsx
|
|
4767
|
-
var
|
|
4768
|
-
var
|
|
5015
|
+
var import_react28 = require("react");
|
|
5016
|
+
var import_react_native18 = require("react-native");
|
|
4769
5017
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
4770
5018
|
function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
4771
5019
|
const t = useDubsTheme();
|
|
4772
5020
|
const { wallet } = useDubs();
|
|
4773
5021
|
const game = useGame(gameId);
|
|
4774
5022
|
const claimStatus = useHasClaimed(gameId);
|
|
4775
|
-
const [sheetVisible, setSheetVisible] = (0,
|
|
5023
|
+
const [sheetVisible, setSheetVisible] = (0, import_react28.useState)(false);
|
|
4776
5024
|
const walletAddress = wallet.publicKey?.toBase58() ?? null;
|
|
4777
|
-
const myBet = (0,
|
|
5025
|
+
const myBet = (0, import_react28.useMemo)(() => {
|
|
4778
5026
|
if (!walletAddress || !game.data?.bettors) return null;
|
|
4779
5027
|
return game.data.bettors.find((b) => b.wallet === walletAddress) ?? null;
|
|
4780
5028
|
}, [walletAddress, game.data?.bettors]);
|
|
@@ -4783,7 +5031,7 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
4783
5031
|
const isWinner = isResolved && myBet != null && myBet.team === game.data?.winnerSide;
|
|
4784
5032
|
const isEligible = myBet != null && isResolved && (isWinner || isRefund);
|
|
4785
5033
|
const prizeAmount = isRefund ? myBet?.amount ?? 0 : game.data?.totalPool ?? 0;
|
|
4786
|
-
const handleSuccess = (0,
|
|
5034
|
+
const handleSuccess = (0, import_react28.useCallback)(
|
|
4787
5035
|
(result) => {
|
|
4788
5036
|
claimStatus.refetch();
|
|
4789
5037
|
onSuccess?.(result);
|
|
@@ -4797,12 +5045,12 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
4797
5045
|
const label = isRefund ? "Refund" : "Prize";
|
|
4798
5046
|
if (claimStatus.hasClaimed) {
|
|
4799
5047
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
4800
|
-
|
|
5048
|
+
import_react_native18.TouchableOpacity,
|
|
4801
5049
|
{
|
|
4802
5050
|
style: [styles12.badge, { borderColor: t.accent }, style],
|
|
4803
5051
|
activeOpacity: 1,
|
|
4804
5052
|
disabled: true,
|
|
4805
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
5053
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native18.Text, { style: [styles12.badgeText, { color: t.accent }], children: [
|
|
4806
5054
|
label,
|
|
4807
5055
|
" Claimed!"
|
|
4808
5056
|
] })
|
|
@@ -4814,12 +5062,12 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
4814
5062
|
}
|
|
4815
5063
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
4816
5064
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
4817
|
-
|
|
5065
|
+
import_react_native18.TouchableOpacity,
|
|
4818
5066
|
{
|
|
4819
5067
|
style: [styles12.button, { backgroundColor: t.accent }, style],
|
|
4820
5068
|
activeOpacity: 0.8,
|
|
4821
5069
|
onPress: () => setSheetVisible(true),
|
|
4822
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
5070
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native18.Text, { style: styles12.buttonText, children: [
|
|
4823
5071
|
"Claim ",
|
|
4824
5072
|
label,
|
|
4825
5073
|
" \u2014 ",
|
|
@@ -4842,7 +5090,7 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
4842
5090
|
)
|
|
4843
5091
|
] });
|
|
4844
5092
|
}
|
|
4845
|
-
var styles12 =
|
|
5093
|
+
var styles12 = import_react_native18.StyleSheet.create({
|
|
4846
5094
|
button: {
|
|
4847
5095
|
height: 52,
|
|
4848
5096
|
borderRadius: 14,
|
|
@@ -4912,6 +5160,7 @@ var styles12 = import_react_native17.StyleSheet.create({
|
|
|
4912
5160
|
useHasClaimed,
|
|
4913
5161
|
useJoinGame,
|
|
4914
5162
|
useNetworkGames,
|
|
5163
|
+
usePushNotifications,
|
|
4915
5164
|
useUFCFightCard,
|
|
4916
5165
|
useUFCFighterDetail
|
|
4917
5166
|
});
|