@dubsdotapp/expo 0.2.55 → 0.2.57
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 +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +730 -302
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +766 -327
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +11 -0
- package/src/hooks/useAuth.ts +13 -0
- package/src/index.ts +2 -2
- package/src/ui/UserProfileSheet.tsx +478 -0
- package/src/ui/index.ts +2 -0
package/dist/index.mjs
CHANGED
|
@@ -474,6 +474,15 @@ var DubsClient = class {
|
|
|
474
474
|
{ token }
|
|
475
475
|
);
|
|
476
476
|
}
|
|
477
|
+
// ── Profile ──
|
|
478
|
+
async updateProfile(params) {
|
|
479
|
+
const res = await this.request(
|
|
480
|
+
"PATCH",
|
|
481
|
+
"/auth/profile",
|
|
482
|
+
params
|
|
483
|
+
);
|
|
484
|
+
return res.data.user;
|
|
485
|
+
}
|
|
477
486
|
// ── Error Utilities ──
|
|
478
487
|
async parseError(error) {
|
|
479
488
|
const res = await this.request(
|
|
@@ -2222,6 +2231,13 @@ function useAuth() {
|
|
|
2222
2231
|
return false;
|
|
2223
2232
|
}
|
|
2224
2233
|
}, [client]);
|
|
2234
|
+
const refreshUser = useCallback10(async () => {
|
|
2235
|
+
try {
|
|
2236
|
+
const me = await client.getMe();
|
|
2237
|
+
setUser(me);
|
|
2238
|
+
} catch {
|
|
2239
|
+
}
|
|
2240
|
+
}, [client]);
|
|
2225
2241
|
if (sharedAuth) return sharedAuth;
|
|
2226
2242
|
return {
|
|
2227
2243
|
status,
|
|
@@ -2233,6 +2249,7 @@ function useAuth() {
|
|
|
2233
2249
|
register,
|
|
2234
2250
|
logout,
|
|
2235
2251
|
restoreSession,
|
|
2252
|
+
refreshUser,
|
|
2236
2253
|
reset
|
|
2237
2254
|
};
|
|
2238
2255
|
}
|
|
@@ -3437,10 +3454,431 @@ var styles3 = StyleSheet4.create({
|
|
|
3437
3454
|
}
|
|
3438
3455
|
});
|
|
3439
3456
|
|
|
3440
|
-
// src/ui/
|
|
3441
|
-
import { useState as useState17 } from "react";
|
|
3442
|
-
import {
|
|
3457
|
+
// src/ui/UserProfileSheet.tsx
|
|
3458
|
+
import { useState as useState17, useEffect as useEffect11, useRef as useRef5, useCallback as useCallback16, useMemo as useMemo4 } from "react";
|
|
3459
|
+
import {
|
|
3460
|
+
View as View5,
|
|
3461
|
+
Text as Text5,
|
|
3462
|
+
TouchableOpacity as TouchableOpacity4,
|
|
3463
|
+
ActivityIndicator as ActivityIndicator4,
|
|
3464
|
+
Modal,
|
|
3465
|
+
Animated as Animated2,
|
|
3466
|
+
StyleSheet as StyleSheet5,
|
|
3467
|
+
KeyboardAvoidingView as KeyboardAvoidingView2,
|
|
3468
|
+
Platform as Platform5,
|
|
3469
|
+
Image as Image4,
|
|
3470
|
+
ScrollView as ScrollView3
|
|
3471
|
+
} from "react-native";
|
|
3443
3472
|
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3473
|
+
var DICEBEAR_STYLES2 = [
|
|
3474
|
+
"adventurer",
|
|
3475
|
+
"avataaars",
|
|
3476
|
+
"fun-emoji",
|
|
3477
|
+
"bottts",
|
|
3478
|
+
"big-smile",
|
|
3479
|
+
"thumbs"
|
|
3480
|
+
];
|
|
3481
|
+
function generateSeed2() {
|
|
3482
|
+
return Math.random().toString(36).slice(2, 10);
|
|
3483
|
+
}
|
|
3484
|
+
function getAvatarUrl2(style, seed, size = 256) {
|
|
3485
|
+
return `https://api.dicebear.com/9.x/${style}/png?seed=${seed}&size=${size}`;
|
|
3486
|
+
}
|
|
3487
|
+
function parseAvatarUrl(url) {
|
|
3488
|
+
if (!url) return { style: "adventurer", seed: generateSeed2() };
|
|
3489
|
+
try {
|
|
3490
|
+
const match = url.match(/\/9\.x\/([^/]+)\/png\?seed=([^&]+)/);
|
|
3491
|
+
if (match) return { style: match[1], seed: match[2] };
|
|
3492
|
+
} catch {
|
|
3493
|
+
}
|
|
3494
|
+
return { style: "adventurer", seed: generateSeed2() };
|
|
3495
|
+
}
|
|
3496
|
+
function truncateAddress3(address, chars = 4) {
|
|
3497
|
+
if (address.length <= chars * 2 + 3) return address;
|
|
3498
|
+
return `${address.slice(0, chars)}...${address.slice(-chars)}`;
|
|
3499
|
+
}
|
|
3500
|
+
function UserProfileSheet({
|
|
3501
|
+
visible,
|
|
3502
|
+
onDismiss,
|
|
3503
|
+
user,
|
|
3504
|
+
onAvatarUpdated,
|
|
3505
|
+
onDisconnect
|
|
3506
|
+
}) {
|
|
3507
|
+
const t = useDubsTheme();
|
|
3508
|
+
const { client } = useDubs();
|
|
3509
|
+
const push = usePushNotifications();
|
|
3510
|
+
const overlayOpacity = useRef5(new Animated2.Value(0)).current;
|
|
3511
|
+
const parsed = useMemo4(() => parseAvatarUrl(user.avatar), [user.avatar]);
|
|
3512
|
+
const [avatarStyle, setAvatarStyle] = useState17(parsed.style);
|
|
3513
|
+
const [avatarSeed, setAvatarSeed] = useState17(parsed.seed);
|
|
3514
|
+
const [saving, setSaving] = useState17(false);
|
|
3515
|
+
const [error, setError] = useState17(null);
|
|
3516
|
+
useEffect11(() => {
|
|
3517
|
+
const p = parseAvatarUrl(user.avatar);
|
|
3518
|
+
setAvatarStyle(p.style);
|
|
3519
|
+
setAvatarSeed(p.seed);
|
|
3520
|
+
}, [user.avatar]);
|
|
3521
|
+
useEffect11(() => {
|
|
3522
|
+
Animated2.timing(overlayOpacity, {
|
|
3523
|
+
toValue: visible ? 1 : 0,
|
|
3524
|
+
duration: 250,
|
|
3525
|
+
useNativeDriver: true
|
|
3526
|
+
}).start();
|
|
3527
|
+
}, [visible, overlayOpacity]);
|
|
3528
|
+
useEffect11(() => {
|
|
3529
|
+
if (visible) setError(null);
|
|
3530
|
+
}, [visible]);
|
|
3531
|
+
const currentAvatarUrl = getAvatarUrl2(avatarStyle, avatarSeed);
|
|
3532
|
+
const handleSelectStyle = useCallback16(
|
|
3533
|
+
async (style) => {
|
|
3534
|
+
const newUrl = getAvatarUrl2(style, avatarSeed);
|
|
3535
|
+
setAvatarStyle(style);
|
|
3536
|
+
setSaving(true);
|
|
3537
|
+
setError(null);
|
|
3538
|
+
try {
|
|
3539
|
+
await client.updateProfile({ avatar: newUrl });
|
|
3540
|
+
onAvatarUpdated?.(newUrl);
|
|
3541
|
+
} catch (err) {
|
|
3542
|
+
setError(err instanceof Error ? err.message : "Failed to update avatar");
|
|
3543
|
+
} finally {
|
|
3544
|
+
setSaving(false);
|
|
3545
|
+
}
|
|
3546
|
+
},
|
|
3547
|
+
[avatarSeed, client, onAvatarUpdated]
|
|
3548
|
+
);
|
|
3549
|
+
const handleShuffle = useCallback16(async () => {
|
|
3550
|
+
const newSeed = generateSeed2();
|
|
3551
|
+
const newUrl = getAvatarUrl2(avatarStyle, newSeed);
|
|
3552
|
+
setAvatarSeed(newSeed);
|
|
3553
|
+
setSaving(true);
|
|
3554
|
+
setError(null);
|
|
3555
|
+
try {
|
|
3556
|
+
await client.updateProfile({ avatar: newUrl });
|
|
3557
|
+
onAvatarUpdated?.(newUrl);
|
|
3558
|
+
} catch (err) {
|
|
3559
|
+
setError(err instanceof Error ? err.message : "Failed to update avatar");
|
|
3560
|
+
} finally {
|
|
3561
|
+
setSaving(false);
|
|
3562
|
+
}
|
|
3563
|
+
}, [avatarStyle, client, onAvatarUpdated]);
|
|
3564
|
+
return /* @__PURE__ */ jsxs5(
|
|
3565
|
+
Modal,
|
|
3566
|
+
{
|
|
3567
|
+
visible,
|
|
3568
|
+
animationType: "slide",
|
|
3569
|
+
transparent: true,
|
|
3570
|
+
onRequestClose: onDismiss,
|
|
3571
|
+
children: [
|
|
3572
|
+
/* @__PURE__ */ jsx7(Animated2.View, { style: [styles4.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ jsx7(TouchableOpacity4, { style: styles4.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
3573
|
+
/* @__PURE__ */ jsx7(
|
|
3574
|
+
KeyboardAvoidingView2,
|
|
3575
|
+
{
|
|
3576
|
+
style: styles4.keyboardView,
|
|
3577
|
+
behavior: Platform5.OS === "ios" ? "padding" : void 0,
|
|
3578
|
+
children: /* @__PURE__ */ jsx7(View5, { style: styles4.sheetPositioner, children: /* @__PURE__ */ jsxs5(View5, { style: [styles4.sheet, { backgroundColor: t.background }], children: [
|
|
3579
|
+
/* @__PURE__ */ jsx7(View5, { style: styles4.handleRow, children: /* @__PURE__ */ jsx7(View5, { style: [styles4.handle, { backgroundColor: t.textMuted }] }) }),
|
|
3580
|
+
/* @__PURE__ */ jsxs5(View5, { style: styles4.header, children: [
|
|
3581
|
+
/* @__PURE__ */ jsx7(Text5, { style: [styles4.headerTitle, { color: t.text }], children: "Profile" }),
|
|
3582
|
+
/* @__PURE__ */ jsx7(TouchableOpacity4, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ jsx7(Text5, { style: [styles4.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
3583
|
+
] }),
|
|
3584
|
+
/* @__PURE__ */ jsxs5(
|
|
3585
|
+
ScrollView3,
|
|
3586
|
+
{
|
|
3587
|
+
style: styles4.scrollContent,
|
|
3588
|
+
contentContainerStyle: styles4.scrollContentInner,
|
|
3589
|
+
showsVerticalScrollIndicator: false,
|
|
3590
|
+
bounces: false,
|
|
3591
|
+
children: [
|
|
3592
|
+
/* @__PURE__ */ jsxs5(View5, { style: styles4.avatarSection, children: [
|
|
3593
|
+
/* @__PURE__ */ jsxs5(View5, { style: [styles4.avatarContainer, { borderColor: t.border }], children: [
|
|
3594
|
+
/* @__PURE__ */ jsx7(
|
|
3595
|
+
Image4,
|
|
3596
|
+
{
|
|
3597
|
+
source: { uri: currentAvatarUrl },
|
|
3598
|
+
style: styles4.avatar
|
|
3599
|
+
}
|
|
3600
|
+
),
|
|
3601
|
+
saving && /* @__PURE__ */ jsx7(View5, { style: styles4.avatarLoading, children: /* @__PURE__ */ jsx7(ActivityIndicator4, { size: "small", color: "#FFFFFF" }) })
|
|
3602
|
+
] }),
|
|
3603
|
+
user.username ? /* @__PURE__ */ jsx7(Text5, { style: [styles4.username, { color: t.text }], children: user.username }) : null,
|
|
3604
|
+
/* @__PURE__ */ jsx7(Text5, { style: [styles4.walletAddress, { color: t.textMuted }], children: truncateAddress3(user.walletAddress, 6) })
|
|
3605
|
+
] }),
|
|
3606
|
+
/* @__PURE__ */ jsxs5(View5, { style: styles4.section, children: [
|
|
3607
|
+
/* @__PURE__ */ jsxs5(View5, { style: styles4.sectionHeaderRow, children: [
|
|
3608
|
+
/* @__PURE__ */ jsx7(Text5, { style: [styles4.sectionLabel, { color: t.textSecondary }], children: "Change Avatar" }),
|
|
3609
|
+
/* @__PURE__ */ jsx7(
|
|
3610
|
+
TouchableOpacity4,
|
|
3611
|
+
{
|
|
3612
|
+
style: [styles4.shuffleButton, { borderColor: t.border }],
|
|
3613
|
+
onPress: handleShuffle,
|
|
3614
|
+
activeOpacity: 0.7,
|
|
3615
|
+
disabled: saving,
|
|
3616
|
+
children: /* @__PURE__ */ jsx7(Text5, { style: [styles4.shuffleText, { color: t.accent }], children: "Shuffle" })
|
|
3617
|
+
}
|
|
3618
|
+
)
|
|
3619
|
+
] }),
|
|
3620
|
+
/* @__PURE__ */ jsx7(
|
|
3621
|
+
ScrollView3,
|
|
3622
|
+
{
|
|
3623
|
+
horizontal: true,
|
|
3624
|
+
showsHorizontalScrollIndicator: false,
|
|
3625
|
+
contentContainerStyle: styles4.stylePickerContent,
|
|
3626
|
+
children: DICEBEAR_STYLES2.map((style) => {
|
|
3627
|
+
const isSelected = style === avatarStyle;
|
|
3628
|
+
return /* @__PURE__ */ jsx7(
|
|
3629
|
+
TouchableOpacity4,
|
|
3630
|
+
{
|
|
3631
|
+
onPress: () => handleSelectStyle(style),
|
|
3632
|
+
activeOpacity: 0.7,
|
|
3633
|
+
disabled: saving,
|
|
3634
|
+
style: [
|
|
3635
|
+
styles4.styleTile,
|
|
3636
|
+
{
|
|
3637
|
+
borderColor: isSelected ? t.accent : t.border,
|
|
3638
|
+
borderWidth: isSelected ? 2 : 1
|
|
3639
|
+
}
|
|
3640
|
+
],
|
|
3641
|
+
children: /* @__PURE__ */ jsx7(
|
|
3642
|
+
Image4,
|
|
3643
|
+
{
|
|
3644
|
+
source: { uri: getAvatarUrl2(style, avatarSeed, 80) },
|
|
3645
|
+
style: styles4.styleTileImage
|
|
3646
|
+
}
|
|
3647
|
+
)
|
|
3648
|
+
},
|
|
3649
|
+
style
|
|
3650
|
+
);
|
|
3651
|
+
})
|
|
3652
|
+
}
|
|
3653
|
+
)
|
|
3654
|
+
] }),
|
|
3655
|
+
error ? /* @__PURE__ */ jsx7(View5, { style: [styles4.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ jsx7(Text5, { style: [styles4.errorText, { color: t.errorText }], children: error }) }) : null,
|
|
3656
|
+
/* @__PURE__ */ jsxs5(View5, { style: [styles4.notifRow, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
3657
|
+
/* @__PURE__ */ jsxs5(View5, { style: styles4.notifLeft, children: [
|
|
3658
|
+
/* @__PURE__ */ jsx7(Text5, { style: [styles4.notifLabel, { color: t.text }], children: "Push Notifications" }),
|
|
3659
|
+
/* @__PURE__ */ jsx7(
|
|
3660
|
+
Text5,
|
|
3661
|
+
{
|
|
3662
|
+
style: [
|
|
3663
|
+
styles4.notifStatus,
|
|
3664
|
+
{ color: push.hasPermission ? t.success : t.textMuted }
|
|
3665
|
+
],
|
|
3666
|
+
children: push.hasPermission ? "Enabled" : "Disabled"
|
|
3667
|
+
}
|
|
3668
|
+
)
|
|
3669
|
+
] }),
|
|
3670
|
+
!push.hasPermission && /* @__PURE__ */ jsx7(
|
|
3671
|
+
TouchableOpacity4,
|
|
3672
|
+
{
|
|
3673
|
+
style: [styles4.enableButton, { backgroundColor: t.accent }],
|
|
3674
|
+
onPress: push.register,
|
|
3675
|
+
disabled: push.loading,
|
|
3676
|
+
activeOpacity: 0.8,
|
|
3677
|
+
children: push.loading ? /* @__PURE__ */ jsx7(ActivityIndicator4, { size: "small", color: "#FFFFFF" }) : /* @__PURE__ */ jsx7(Text5, { style: styles4.enableText, children: "Enable" })
|
|
3678
|
+
}
|
|
3679
|
+
)
|
|
3680
|
+
] }),
|
|
3681
|
+
onDisconnect ? /* @__PURE__ */ jsx7(
|
|
3682
|
+
TouchableOpacity4,
|
|
3683
|
+
{
|
|
3684
|
+
style: [styles4.disconnectButton, { borderColor: t.live }],
|
|
3685
|
+
onPress: onDisconnect,
|
|
3686
|
+
activeOpacity: 0.7,
|
|
3687
|
+
children: /* @__PURE__ */ jsx7(Text5, { style: [styles4.disconnectText, { color: t.live }], children: "Disconnect Wallet" })
|
|
3688
|
+
}
|
|
3689
|
+
) : null
|
|
3690
|
+
]
|
|
3691
|
+
}
|
|
3692
|
+
)
|
|
3693
|
+
] }) })
|
|
3694
|
+
}
|
|
3695
|
+
)
|
|
3696
|
+
]
|
|
3697
|
+
}
|
|
3698
|
+
);
|
|
3699
|
+
}
|
|
3700
|
+
var styles4 = StyleSheet5.create({
|
|
3701
|
+
overlay: {
|
|
3702
|
+
...StyleSheet5.absoluteFillObject,
|
|
3703
|
+
backgroundColor: "rgba(0,0,0,0.5)"
|
|
3704
|
+
},
|
|
3705
|
+
overlayTap: {
|
|
3706
|
+
flex: 1
|
|
3707
|
+
},
|
|
3708
|
+
keyboardView: {
|
|
3709
|
+
flex: 1,
|
|
3710
|
+
justifyContent: "flex-end"
|
|
3711
|
+
},
|
|
3712
|
+
sheetPositioner: {
|
|
3713
|
+
justifyContent: "flex-end"
|
|
3714
|
+
},
|
|
3715
|
+
sheet: {
|
|
3716
|
+
borderTopLeftRadius: 24,
|
|
3717
|
+
borderTopRightRadius: 24,
|
|
3718
|
+
paddingHorizontal: 20,
|
|
3719
|
+
paddingBottom: 40,
|
|
3720
|
+
maxHeight: "85%"
|
|
3721
|
+
},
|
|
3722
|
+
handleRow: {
|
|
3723
|
+
alignItems: "center",
|
|
3724
|
+
paddingTop: 10,
|
|
3725
|
+
paddingBottom: 8
|
|
3726
|
+
},
|
|
3727
|
+
handle: {
|
|
3728
|
+
width: 36,
|
|
3729
|
+
height: 4,
|
|
3730
|
+
borderRadius: 2,
|
|
3731
|
+
opacity: 0.4
|
|
3732
|
+
},
|
|
3733
|
+
header: {
|
|
3734
|
+
flexDirection: "row",
|
|
3735
|
+
alignItems: "center",
|
|
3736
|
+
justifyContent: "space-between",
|
|
3737
|
+
paddingVertical: 12
|
|
3738
|
+
},
|
|
3739
|
+
headerTitle: {
|
|
3740
|
+
fontSize: 20,
|
|
3741
|
+
fontWeight: "700"
|
|
3742
|
+
},
|
|
3743
|
+
closeButton: {
|
|
3744
|
+
fontSize: 20,
|
|
3745
|
+
padding: 4
|
|
3746
|
+
},
|
|
3747
|
+
scrollContent: {
|
|
3748
|
+
flexGrow: 0
|
|
3749
|
+
},
|
|
3750
|
+
scrollContentInner: {
|
|
3751
|
+
paddingBottom: 8
|
|
3752
|
+
},
|
|
3753
|
+
// Avatar
|
|
3754
|
+
avatarSection: {
|
|
3755
|
+
alignItems: "center",
|
|
3756
|
+
paddingTop: 8,
|
|
3757
|
+
paddingBottom: 20,
|
|
3758
|
+
gap: 8
|
|
3759
|
+
},
|
|
3760
|
+
avatarContainer: {
|
|
3761
|
+
width: 120,
|
|
3762
|
+
height: 120,
|
|
3763
|
+
borderRadius: 60,
|
|
3764
|
+
borderWidth: 2,
|
|
3765
|
+
overflow: "hidden"
|
|
3766
|
+
},
|
|
3767
|
+
avatar: {
|
|
3768
|
+
width: "100%",
|
|
3769
|
+
height: "100%"
|
|
3770
|
+
},
|
|
3771
|
+
avatarLoading: {
|
|
3772
|
+
...StyleSheet5.absoluteFillObject,
|
|
3773
|
+
backgroundColor: "rgba(0,0,0,0.35)",
|
|
3774
|
+
justifyContent: "center",
|
|
3775
|
+
alignItems: "center"
|
|
3776
|
+
},
|
|
3777
|
+
username: {
|
|
3778
|
+
fontSize: 18,
|
|
3779
|
+
fontWeight: "700"
|
|
3780
|
+
},
|
|
3781
|
+
walletAddress: {
|
|
3782
|
+
fontSize: 13,
|
|
3783
|
+
fontFamily: "monospace"
|
|
3784
|
+
},
|
|
3785
|
+
// Change Avatar
|
|
3786
|
+
section: {
|
|
3787
|
+
marginBottom: 20,
|
|
3788
|
+
gap: 12
|
|
3789
|
+
},
|
|
3790
|
+
sectionHeaderRow: {
|
|
3791
|
+
flexDirection: "row",
|
|
3792
|
+
alignItems: "center",
|
|
3793
|
+
justifyContent: "space-between"
|
|
3794
|
+
},
|
|
3795
|
+
sectionLabel: {
|
|
3796
|
+
fontSize: 14,
|
|
3797
|
+
fontWeight: "600"
|
|
3798
|
+
},
|
|
3799
|
+
shuffleButton: {
|
|
3800
|
+
paddingHorizontal: 14,
|
|
3801
|
+
paddingVertical: 6,
|
|
3802
|
+
borderRadius: 12,
|
|
3803
|
+
borderWidth: 1
|
|
3804
|
+
},
|
|
3805
|
+
shuffleText: {
|
|
3806
|
+
fontSize: 13,
|
|
3807
|
+
fontWeight: "600"
|
|
3808
|
+
},
|
|
3809
|
+
stylePickerContent: {
|
|
3810
|
+
gap: 10
|
|
3811
|
+
},
|
|
3812
|
+
styleTile: {
|
|
3813
|
+
width: 72,
|
|
3814
|
+
height: 72,
|
|
3815
|
+
borderRadius: 16,
|
|
3816
|
+
overflow: "hidden"
|
|
3817
|
+
},
|
|
3818
|
+
styleTileImage: {
|
|
3819
|
+
width: "100%",
|
|
3820
|
+
height: "100%"
|
|
3821
|
+
},
|
|
3822
|
+
// Error
|
|
3823
|
+
errorBox: {
|
|
3824
|
+
marginBottom: 16,
|
|
3825
|
+
borderRadius: 12,
|
|
3826
|
+
borderWidth: 1,
|
|
3827
|
+
padding: 12
|
|
3828
|
+
},
|
|
3829
|
+
errorText: {
|
|
3830
|
+
fontSize: 13,
|
|
3831
|
+
fontWeight: "500"
|
|
3832
|
+
},
|
|
3833
|
+
// Push Notifications
|
|
3834
|
+
notifRow: {
|
|
3835
|
+
flexDirection: "row",
|
|
3836
|
+
alignItems: "center",
|
|
3837
|
+
justifyContent: "space-between",
|
|
3838
|
+
borderRadius: 16,
|
|
3839
|
+
borderWidth: 1,
|
|
3840
|
+
paddingHorizontal: 16,
|
|
3841
|
+
paddingVertical: 14,
|
|
3842
|
+
marginBottom: 16
|
|
3843
|
+
},
|
|
3844
|
+
notifLeft: {
|
|
3845
|
+
gap: 2
|
|
3846
|
+
},
|
|
3847
|
+
notifLabel: {
|
|
3848
|
+
fontSize: 15,
|
|
3849
|
+
fontWeight: "600"
|
|
3850
|
+
},
|
|
3851
|
+
notifStatus: {
|
|
3852
|
+
fontSize: 13
|
|
3853
|
+
},
|
|
3854
|
+
enableButton: {
|
|
3855
|
+
paddingHorizontal: 18,
|
|
3856
|
+
paddingVertical: 10,
|
|
3857
|
+
borderRadius: 12
|
|
3858
|
+
},
|
|
3859
|
+
enableText: {
|
|
3860
|
+
color: "#FFFFFF",
|
|
3861
|
+
fontSize: 14,
|
|
3862
|
+
fontWeight: "700"
|
|
3863
|
+
},
|
|
3864
|
+
// Disconnect
|
|
3865
|
+
disconnectButton: {
|
|
3866
|
+
height: 52,
|
|
3867
|
+
borderRadius: 16,
|
|
3868
|
+
borderWidth: 1.5,
|
|
3869
|
+
justifyContent: "center",
|
|
3870
|
+
alignItems: "center"
|
|
3871
|
+
},
|
|
3872
|
+
disconnectText: {
|
|
3873
|
+
fontSize: 16,
|
|
3874
|
+
fontWeight: "700"
|
|
3875
|
+
}
|
|
3876
|
+
});
|
|
3877
|
+
|
|
3878
|
+
// src/ui/game/GamePoster.tsx
|
|
3879
|
+
import { useState as useState18 } from "react";
|
|
3880
|
+
import { StyleSheet as StyleSheet6, View as View6, Text as Text6 } from "react-native";
|
|
3881
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3444
3882
|
function computeCountdown(lockTimestamp) {
|
|
3445
3883
|
if (!lockTimestamp) return "";
|
|
3446
3884
|
const ts = typeof lockTimestamp === "string" ? parseInt(lockTimestamp) : lockTimestamp;
|
|
@@ -3461,38 +3899,38 @@ function GamePoster({ game, ImageComponent }) {
|
|
|
3461
3899
|
const away = opponents[1];
|
|
3462
3900
|
const countdown = computeCountdown(game.lockTimestamp);
|
|
3463
3901
|
const isLive = countdown === "LIVE";
|
|
3464
|
-
return /* @__PURE__ */
|
|
3465
|
-
game.media?.poster ? /* @__PURE__ */
|
|
3902
|
+
return /* @__PURE__ */ jsxs6(View6, { style: styles5.container, children: [
|
|
3903
|
+
game.media?.poster ? /* @__PURE__ */ jsx8(
|
|
3466
3904
|
Img,
|
|
3467
3905
|
{
|
|
3468
3906
|
source: { uri: game.media.poster },
|
|
3469
|
-
style:
|
|
3907
|
+
style: styles5.image,
|
|
3470
3908
|
resizeMode: "cover"
|
|
3471
3909
|
}
|
|
3472
|
-
) : /* @__PURE__ */
|
|
3473
|
-
/* @__PURE__ */
|
|
3474
|
-
/* @__PURE__ */
|
|
3475
|
-
/* @__PURE__ */
|
|
3910
|
+
) : /* @__PURE__ */ jsx8(View6, { style: [styles5.image, { backgroundColor: t.surface }], children: /* @__PURE__ */ jsxs6(View6, { style: styles5.fallback, children: [
|
|
3911
|
+
/* @__PURE__ */ jsx8(TeamLogoInternal, { url: home?.imageUrl, size: 56, Img }),
|
|
3912
|
+
/* @__PURE__ */ jsx8(Text6, { style: styles5.vs, children: "VS" }),
|
|
3913
|
+
/* @__PURE__ */ jsx8(TeamLogoInternal, { url: away?.imageUrl, size: 56, Img })
|
|
3476
3914
|
] }) }),
|
|
3477
|
-
/* @__PURE__ */
|
|
3478
|
-
/* @__PURE__ */
|
|
3479
|
-
/* @__PURE__ */
|
|
3480
|
-
/* @__PURE__ */
|
|
3481
|
-
/* @__PURE__ */
|
|
3915
|
+
/* @__PURE__ */ jsx8(View6, { style: styles5.overlay }),
|
|
3916
|
+
/* @__PURE__ */ jsxs6(View6, { style: styles5.teamNames, children: [
|
|
3917
|
+
/* @__PURE__ */ jsx8(Text6, { style: styles5.teamNameText, numberOfLines: 1, children: home?.name || "Home" }),
|
|
3918
|
+
/* @__PURE__ */ jsx8(Text6, { style: styles5.teamNameVs, children: "vs" }),
|
|
3919
|
+
/* @__PURE__ */ jsx8(Text6, { style: styles5.teamNameText, numberOfLines: 1, children: away?.name || "Away" })
|
|
3482
3920
|
] }),
|
|
3483
|
-
countdown ? /* @__PURE__ */
|
|
3484
|
-
/* @__PURE__ */
|
|
3921
|
+
countdown ? /* @__PURE__ */ jsx8(View6, { style: styles5.countdownPill, children: /* @__PURE__ */ jsx8(Text6, { style: [styles5.countdownText, isLive && styles5.countdownLive], children: countdown }) }) : null,
|
|
3922
|
+
/* @__PURE__ */ jsx8(View6, { style: styles5.poolPill, children: /* @__PURE__ */ jsxs6(Text6, { style: styles5.poolText, children: [
|
|
3485
3923
|
game.totalPool || 0,
|
|
3486
3924
|
" SOL"
|
|
3487
3925
|
] }) })
|
|
3488
3926
|
] });
|
|
3489
3927
|
}
|
|
3490
3928
|
function TeamLogoInternal({ url, size, Img }) {
|
|
3491
|
-
const [failed, setFailed] =
|
|
3929
|
+
const [failed, setFailed] = useState18(false);
|
|
3492
3930
|
if (!url || failed) {
|
|
3493
|
-
return /* @__PURE__ */
|
|
3931
|
+
return /* @__PURE__ */ jsx8(View6, { style: [styles5.logoPlaceholder, { width: size, height: size, borderRadius: size / 2 }] });
|
|
3494
3932
|
}
|
|
3495
|
-
return /* @__PURE__ */
|
|
3933
|
+
return /* @__PURE__ */ jsx8(
|
|
3496
3934
|
Img,
|
|
3497
3935
|
{
|
|
3498
3936
|
source: { uri: url },
|
|
@@ -3502,7 +3940,7 @@ function TeamLogoInternal({ url, size, Img }) {
|
|
|
3502
3940
|
}
|
|
3503
3941
|
);
|
|
3504
3942
|
}
|
|
3505
|
-
var
|
|
3943
|
+
var styles5 = StyleSheet6.create({
|
|
3506
3944
|
container: {
|
|
3507
3945
|
height: 200,
|
|
3508
3946
|
borderRadius: 16,
|
|
@@ -3510,12 +3948,12 @@ var styles4 = StyleSheet5.create({
|
|
|
3510
3948
|
position: "relative"
|
|
3511
3949
|
},
|
|
3512
3950
|
image: {
|
|
3513
|
-
...
|
|
3951
|
+
...StyleSheet6.absoluteFillObject,
|
|
3514
3952
|
justifyContent: "center",
|
|
3515
3953
|
alignItems: "center"
|
|
3516
3954
|
},
|
|
3517
3955
|
overlay: {
|
|
3518
|
-
...
|
|
3956
|
+
...StyleSheet6.absoluteFillObject,
|
|
3519
3957
|
backgroundColor: "rgba(0,0,0,0.35)"
|
|
3520
3958
|
},
|
|
3521
3959
|
fallback: {
|
|
@@ -3589,9 +4027,9 @@ var styles4 = StyleSheet5.create({
|
|
|
3589
4027
|
});
|
|
3590
4028
|
|
|
3591
4029
|
// src/ui/game/LivePoolsCard.tsx
|
|
3592
|
-
import { useMemo as
|
|
3593
|
-
import { StyleSheet as
|
|
3594
|
-
import { jsx as
|
|
4030
|
+
import { useMemo as useMemo5 } from "react";
|
|
4031
|
+
import { StyleSheet as StyleSheet7, View as View7, Text as Text7 } from "react-native";
|
|
4032
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3595
4033
|
function LivePoolsCard({
|
|
3596
4034
|
game,
|
|
3597
4035
|
shortName,
|
|
@@ -3605,7 +4043,7 @@ function LivePoolsCard({
|
|
|
3605
4043
|
const homePool = game.homePool || 0;
|
|
3606
4044
|
const awayPool = game.awayPool || 0;
|
|
3607
4045
|
const totalPool = game.totalPool || 0;
|
|
3608
|
-
const { homePercent, awayPercent, homeOdds, awayOdds } =
|
|
4046
|
+
const { homePercent, awayPercent, homeOdds, awayOdds } = useMemo5(() => {
|
|
3609
4047
|
return {
|
|
3610
4048
|
homePercent: totalPool > 0 ? homePool / totalPool * 100 : 50,
|
|
3611
4049
|
awayPercent: totalPool > 0 ? awayPool / totalPool * 100 : 50,
|
|
@@ -3613,29 +4051,29 @@ function LivePoolsCard({
|
|
|
3613
4051
|
awayOdds: awayPool > 0 ? (totalPool / awayPool).toFixed(2) : "\u2014"
|
|
3614
4052
|
};
|
|
3615
4053
|
}, [homePool, awayPool, totalPool]);
|
|
3616
|
-
return /* @__PURE__ */
|
|
3617
|
-
/* @__PURE__ */
|
|
3618
|
-
/* @__PURE__ */
|
|
4054
|
+
return /* @__PURE__ */ jsxs7(View7, { style: [styles6.card, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
4055
|
+
/* @__PURE__ */ jsx9(Text7, { style: [styles6.title, { color: t.text }], children: "Live Pools" }),
|
|
4056
|
+
/* @__PURE__ */ jsxs7(Text7, { style: [styles6.total, { color: t.accent }], children: [
|
|
3619
4057
|
totalPool,
|
|
3620
4058
|
" SOL total"
|
|
3621
4059
|
] }),
|
|
3622
|
-
/* @__PURE__ */
|
|
3623
|
-
/* @__PURE__ */
|
|
3624
|
-
/* @__PURE__ */
|
|
4060
|
+
/* @__PURE__ */ jsxs7(View7, { style: styles6.bars, children: [
|
|
4061
|
+
/* @__PURE__ */ jsx9(PoolBar, { name: homeName, amount: homePool, percent: homePercent, color: homeColor, t }),
|
|
4062
|
+
/* @__PURE__ */ jsx9(PoolBar, { name: awayName, amount: awayPool, percent: awayPercent, color: awayColor, t })
|
|
3625
4063
|
] }),
|
|
3626
|
-
/* @__PURE__ */
|
|
3627
|
-
/* @__PURE__ */
|
|
4064
|
+
/* @__PURE__ */ jsxs7(View7, { style: styles6.oddsRow, children: [
|
|
4065
|
+
/* @__PURE__ */ jsxs7(Text7, { style: [styles6.oddsText, { color: t.textMuted }], children: [
|
|
3628
4066
|
homeName,
|
|
3629
4067
|
": ",
|
|
3630
|
-
/* @__PURE__ */
|
|
4068
|
+
/* @__PURE__ */ jsxs7(Text7, { style: { color: t.text, fontWeight: "700" }, children: [
|
|
3631
4069
|
homeOdds,
|
|
3632
4070
|
"x"
|
|
3633
4071
|
] })
|
|
3634
4072
|
] }),
|
|
3635
|
-
/* @__PURE__ */
|
|
4073
|
+
/* @__PURE__ */ jsxs7(Text7, { style: [styles6.oddsText, { color: t.textMuted }], children: [
|
|
3636
4074
|
awayName,
|
|
3637
4075
|
": ",
|
|
3638
|
-
/* @__PURE__ */
|
|
4076
|
+
/* @__PURE__ */ jsxs7(Text7, { style: { color: t.text, fontWeight: "700" }, children: [
|
|
3639
4077
|
awayOdds,
|
|
3640
4078
|
"x"
|
|
3641
4079
|
] })
|
|
@@ -3644,16 +4082,16 @@ function LivePoolsCard({
|
|
|
3644
4082
|
] });
|
|
3645
4083
|
}
|
|
3646
4084
|
function PoolBar({ name, amount, percent, color, t }) {
|
|
3647
|
-
return /* @__PURE__ */
|
|
3648
|
-
/* @__PURE__ */
|
|
3649
|
-
/* @__PURE__ */
|
|
3650
|
-
/* @__PURE__ */
|
|
4085
|
+
return /* @__PURE__ */ jsxs7(View7, { style: styles6.barRow, children: [
|
|
4086
|
+
/* @__PURE__ */ jsx9(Text7, { style: [styles6.barLabel, { color: t.textSecondary }], numberOfLines: 1, children: name }),
|
|
4087
|
+
/* @__PURE__ */ jsx9(View7, { style: [styles6.barTrack, { backgroundColor: t.border }], children: /* @__PURE__ */ jsx9(View7, { style: [styles6.barFill, { width: `${Math.max(percent, 2)}%`, backgroundColor: color }] }) }),
|
|
4088
|
+
/* @__PURE__ */ jsxs7(Text7, { style: [styles6.barAmount, { color: t.text }], children: [
|
|
3651
4089
|
amount,
|
|
3652
4090
|
" SOL"
|
|
3653
4091
|
] })
|
|
3654
4092
|
] });
|
|
3655
4093
|
}
|
|
3656
|
-
var
|
|
4094
|
+
var styles6 = StyleSheet7.create({
|
|
3657
4095
|
card: { borderRadius: 16, borderWidth: 1, padding: 16 },
|
|
3658
4096
|
title: { fontSize: 17, fontWeight: "700", marginBottom: 4 },
|
|
3659
4097
|
total: { fontSize: 14, fontWeight: "600", marginBottom: 14 },
|
|
@@ -3668,9 +4106,9 @@ var styles5 = StyleSheet6.create({
|
|
|
3668
4106
|
});
|
|
3669
4107
|
|
|
3670
4108
|
// src/ui/game/PickWinnerCard.tsx
|
|
3671
|
-
import { useState as
|
|
3672
|
-
import { StyleSheet as
|
|
3673
|
-
import { jsx as
|
|
4109
|
+
import { useState as useState19, useMemo as useMemo6 } from "react";
|
|
4110
|
+
import { StyleSheet as StyleSheet8, View as View8, Text as Text8, TouchableOpacity as TouchableOpacity5 } from "react-native";
|
|
4111
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3674
4112
|
function PickWinnerCard({
|
|
3675
4113
|
game,
|
|
3676
4114
|
selectedTeam,
|
|
@@ -3686,7 +4124,7 @@ function PickWinnerCard({
|
|
|
3686
4124
|
const totalPool = game.totalPool || 0;
|
|
3687
4125
|
const homePool = game.homePool || 0;
|
|
3688
4126
|
const awayPool = game.awayPool || 0;
|
|
3689
|
-
const { homeOdds, awayOdds, homeBets, awayBets } =
|
|
4127
|
+
const { homeOdds, awayOdds, homeBets, awayBets } = useMemo6(() => ({
|
|
3690
4128
|
homeOdds: homePool > 0 ? (totalPool / homePool).toFixed(2) : "\u2014",
|
|
3691
4129
|
awayOdds: awayPool > 0 ? (totalPool / awayPool).toFixed(2) : "\u2014",
|
|
3692
4130
|
homeBets: bettors.filter((b) => b.team === "home").length,
|
|
@@ -3694,10 +4132,10 @@ function PickWinnerCard({
|
|
|
3694
4132
|
}), [totalPool, homePool, awayPool, bettors]);
|
|
3695
4133
|
const homeName = shortName ? shortName(opponents[0]?.name) : opponents[0]?.name || "Home";
|
|
3696
4134
|
const awayName = shortName ? shortName(opponents[1]?.name) : opponents[1]?.name || "Away";
|
|
3697
|
-
return /* @__PURE__ */
|
|
3698
|
-
/* @__PURE__ */
|
|
3699
|
-
/* @__PURE__ */
|
|
3700
|
-
/* @__PURE__ */
|
|
4135
|
+
return /* @__PURE__ */ jsxs8(View8, { style: [styles7.card, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
4136
|
+
/* @__PURE__ */ jsx10(Text8, { style: [styles7.title, { color: t.text }], children: "Pick Your Winner" }),
|
|
4137
|
+
/* @__PURE__ */ jsxs8(View8, { style: styles7.row, children: [
|
|
4138
|
+
/* @__PURE__ */ jsx10(
|
|
3701
4139
|
TeamOption,
|
|
3702
4140
|
{
|
|
3703
4141
|
name: homeName,
|
|
@@ -3711,7 +4149,7 @@ function PickWinnerCard({
|
|
|
3711
4149
|
t
|
|
3712
4150
|
}
|
|
3713
4151
|
),
|
|
3714
|
-
/* @__PURE__ */
|
|
4152
|
+
/* @__PURE__ */ jsx10(
|
|
3715
4153
|
TeamOption,
|
|
3716
4154
|
{
|
|
3717
4155
|
name: awayName,
|
|
@@ -3739,33 +4177,33 @@ function TeamOption({
|
|
|
3739
4177
|
ImageComponent,
|
|
3740
4178
|
t
|
|
3741
4179
|
}) {
|
|
3742
|
-
const [imgFailed, setImgFailed] =
|
|
4180
|
+
const [imgFailed, setImgFailed] = useState19(false);
|
|
3743
4181
|
const Img = ImageComponent || __require("react-native").Image;
|
|
3744
4182
|
const showImage = imageUrl && !imgFailed;
|
|
3745
|
-
return /* @__PURE__ */
|
|
3746
|
-
|
|
4183
|
+
return /* @__PURE__ */ jsxs8(
|
|
4184
|
+
TouchableOpacity5,
|
|
3747
4185
|
{
|
|
3748
|
-
style: [
|
|
4186
|
+
style: [styles7.option, { borderColor: selected ? color : t.border, backgroundColor: selected ? color + "15" : t.background }],
|
|
3749
4187
|
onPress,
|
|
3750
4188
|
activeOpacity: 0.7,
|
|
3751
4189
|
children: [
|
|
3752
|
-
showImage ? /* @__PURE__ */
|
|
3753
|
-
/* @__PURE__ */
|
|
3754
|
-
/* @__PURE__ */
|
|
4190
|
+
showImage ? /* @__PURE__ */ jsx10(Img, { source: { uri: imageUrl }, style: styles7.logo, resizeMode: "contain", onError: () => setImgFailed(true) }) : /* @__PURE__ */ jsx10(View8, { style: [styles7.logo, styles7.logoPlaceholder] }),
|
|
4191
|
+
/* @__PURE__ */ jsx10(Text8, { style: [styles7.name, { color: t.text }], numberOfLines: 1, children: name }),
|
|
4192
|
+
/* @__PURE__ */ jsxs8(Text8, { style: [styles7.odds, { color }], children: [
|
|
3755
4193
|
odds,
|
|
3756
4194
|
"x"
|
|
3757
4195
|
] }),
|
|
3758
|
-
/* @__PURE__ */
|
|
4196
|
+
/* @__PURE__ */ jsxs8(Text8, { style: [styles7.bets, { color: t.textMuted }], children: [
|
|
3759
4197
|
bets,
|
|
3760
4198
|
" ",
|
|
3761
4199
|
bets === 1 ? "bet" : "bets"
|
|
3762
4200
|
] }),
|
|
3763
|
-
selected && /* @__PURE__ */
|
|
4201
|
+
selected && /* @__PURE__ */ jsx10(View8, { style: [styles7.badge, { backgroundColor: color }], children: /* @__PURE__ */ jsx10(Text8, { style: styles7.badgeText, children: "Selected" }) })
|
|
3764
4202
|
]
|
|
3765
4203
|
}
|
|
3766
4204
|
);
|
|
3767
4205
|
}
|
|
3768
|
-
var
|
|
4206
|
+
var styles7 = StyleSheet8.create({
|
|
3769
4207
|
card: { borderRadius: 16, borderWidth: 1, padding: 16 },
|
|
3770
4208
|
title: { fontSize: 17, fontWeight: "700", marginBottom: 12 },
|
|
3771
4209
|
row: { flexDirection: "row", gap: 12 },
|
|
@@ -3780,9 +4218,9 @@ var styles6 = StyleSheet7.create({
|
|
|
3780
4218
|
});
|
|
3781
4219
|
|
|
3782
4220
|
// src/ui/game/PlayersCard.tsx
|
|
3783
|
-
import { useState as
|
|
3784
|
-
import { StyleSheet as
|
|
3785
|
-
import { jsx as
|
|
4221
|
+
import { useState as useState20 } from "react";
|
|
4222
|
+
import { StyleSheet as StyleSheet9, View as View9, Text as Text9 } from "react-native";
|
|
4223
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3786
4224
|
function truncateWallet(addr, chars) {
|
|
3787
4225
|
if (addr.length <= chars * 2 + 3) return addr;
|
|
3788
4226
|
return `${addr.slice(0, chars)}...${addr.slice(-chars)}`;
|
|
@@ -3802,12 +4240,12 @@ function PlayersCard({
|
|
|
3802
4240
|
if (team === "away") return awayColor;
|
|
3803
4241
|
return drawColor;
|
|
3804
4242
|
};
|
|
3805
|
-
return /* @__PURE__ */
|
|
3806
|
-
/* @__PURE__ */
|
|
4243
|
+
return /* @__PURE__ */ jsxs9(View9, { style: [styles8.card, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
4244
|
+
/* @__PURE__ */ jsxs9(Text9, { style: [styles8.title, { color: t.text }], children: [
|
|
3807
4245
|
"Players",
|
|
3808
4246
|
bettors.length > 0 ? ` (${bettors.length})` : ""
|
|
3809
4247
|
] }),
|
|
3810
|
-
bettors.length === 0 ? /* @__PURE__ */
|
|
4248
|
+
bettors.length === 0 ? /* @__PURE__ */ jsx11(Text9, { style: [styles8.empty, { color: t.textMuted }], children: "No players yet \u2014 be the first!" }) : bettors.map((b, i) => /* @__PURE__ */ jsx11(
|
|
3811
4249
|
BettorRow,
|
|
3812
4250
|
{
|
|
3813
4251
|
bettor: b,
|
|
@@ -3829,20 +4267,20 @@ function BettorRow({
|
|
|
3829
4267
|
ImageComponent,
|
|
3830
4268
|
t
|
|
3831
4269
|
}) {
|
|
3832
|
-
const [imgFailed, setImgFailed] =
|
|
4270
|
+
const [imgFailed, setImgFailed] = useState20(false);
|
|
3833
4271
|
const Img = ImageComponent || __require("react-native").Image;
|
|
3834
4272
|
const showAvatar = bettor.avatar && !imgFailed;
|
|
3835
|
-
return /* @__PURE__ */
|
|
3836
|
-
/* @__PURE__ */
|
|
3837
|
-
showAvatar ? /* @__PURE__ */
|
|
3838
|
-
/* @__PURE__ */
|
|
3839
|
-
/* @__PURE__ */
|
|
4273
|
+
return /* @__PURE__ */ jsxs9(View9, { style: [styles8.row, !isFirst && { borderTopColor: t.border, borderTopWidth: 1 }], children: [
|
|
4274
|
+
/* @__PURE__ */ jsx11(View9, { style: [styles8.dot, { backgroundColor: dotColor }] }),
|
|
4275
|
+
showAvatar ? /* @__PURE__ */ jsx11(Img, { source: { uri: bettor.avatar }, style: styles8.avatar, resizeMode: "cover", onError: () => setImgFailed(true) }) : /* @__PURE__ */ jsx11(View9, { style: [styles8.avatar, styles8.avatarPlaceholder] }),
|
|
4276
|
+
/* @__PURE__ */ jsx11(View9, { style: styles8.nameCol, children: /* @__PURE__ */ jsx11(Text9, { style: [styles8.username, { color: t.text }], numberOfLines: 1, children: bettor.username || truncateWallet(bettor.wallet, truncateChars) }) }),
|
|
4277
|
+
/* @__PURE__ */ jsxs9(Text9, { style: [styles8.amount, { color: t.textSecondary }], children: [
|
|
3840
4278
|
bettor.amount,
|
|
3841
4279
|
" SOL"
|
|
3842
4280
|
] })
|
|
3843
4281
|
] });
|
|
3844
4282
|
}
|
|
3845
|
-
var
|
|
4283
|
+
var styles8 = StyleSheet9.create({
|
|
3846
4284
|
card: { borderRadius: 16, borderWidth: 1, padding: 16 },
|
|
3847
4285
|
title: { fontSize: 17, fontWeight: "700", marginBottom: 12 },
|
|
3848
4286
|
empty: { fontSize: 14, textAlign: "center", paddingVertical: 16 },
|
|
@@ -3856,9 +4294,9 @@ var styles7 = StyleSheet8.create({
|
|
|
3856
4294
|
});
|
|
3857
4295
|
|
|
3858
4296
|
// src/ui/game/JoinGameButton.tsx
|
|
3859
|
-
import { useMemo as
|
|
3860
|
-
import { StyleSheet as
|
|
3861
|
-
import { jsx as
|
|
4297
|
+
import { useMemo as useMemo7 } from "react";
|
|
4298
|
+
import { StyleSheet as StyleSheet10, View as View10, Text as Text10, TouchableOpacity as TouchableOpacity6, ActivityIndicator as ActivityIndicator5 } from "react-native";
|
|
4299
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3862
4300
|
var STATUS_LABELS = {
|
|
3863
4301
|
building: "Building transaction...",
|
|
3864
4302
|
signing: "Approve in wallet...",
|
|
@@ -3867,37 +4305,37 @@ var STATUS_LABELS = {
|
|
|
3867
4305
|
};
|
|
3868
4306
|
function JoinGameButton({ game, walletAddress, selectedTeam, status, onJoin }) {
|
|
3869
4307
|
const t = useDubsTheme();
|
|
3870
|
-
const alreadyJoined =
|
|
4308
|
+
const alreadyJoined = useMemo7(() => {
|
|
3871
4309
|
if (!walletAddress) return false;
|
|
3872
4310
|
return (game.bettors || []).some((b) => b.wallet === walletAddress);
|
|
3873
4311
|
}, [game.bettors, walletAddress]);
|
|
3874
4312
|
if (alreadyJoined || game.isLocked || game.isResolved) return null;
|
|
3875
4313
|
const isJoining = status !== "idle" && status !== "success" && status !== "error";
|
|
3876
4314
|
const statusLabel = STATUS_LABELS[status] || "";
|
|
3877
|
-
return /* @__PURE__ */
|
|
3878
|
-
/* @__PURE__ */
|
|
3879
|
-
/* @__PURE__ */
|
|
3880
|
-
/* @__PURE__ */
|
|
4315
|
+
return /* @__PURE__ */ jsxs10(View10, { style: [styles9.bar, { backgroundColor: t.background, borderTopColor: t.border }], children: [
|
|
4316
|
+
/* @__PURE__ */ jsxs10(View10, { style: styles9.buyInRow, children: [
|
|
4317
|
+
/* @__PURE__ */ jsx12(Text10, { style: [styles9.buyInLabel, { color: t.textMuted }], children: "Buy-in" }),
|
|
4318
|
+
/* @__PURE__ */ jsxs10(Text10, { style: [styles9.buyInValue, { color: t.text }], children: [
|
|
3881
4319
|
game.buyIn,
|
|
3882
4320
|
" SOL"
|
|
3883
4321
|
] })
|
|
3884
4322
|
] }),
|
|
3885
|
-
/* @__PURE__ */
|
|
3886
|
-
|
|
4323
|
+
/* @__PURE__ */ jsx12(
|
|
4324
|
+
TouchableOpacity6,
|
|
3887
4325
|
{
|
|
3888
|
-
style: [
|
|
4326
|
+
style: [styles9.button, { backgroundColor: selectedTeam ? t.accent : t.border }],
|
|
3889
4327
|
disabled: !selectedTeam || isJoining,
|
|
3890
4328
|
onPress: onJoin,
|
|
3891
4329
|
activeOpacity: 0.8,
|
|
3892
|
-
children: isJoining ? /* @__PURE__ */
|
|
3893
|
-
/* @__PURE__ */
|
|
3894
|
-
/* @__PURE__ */
|
|
3895
|
-
] }) : /* @__PURE__ */
|
|
4330
|
+
children: isJoining ? /* @__PURE__ */ jsxs10(View10, { style: styles9.joiningRow, children: [
|
|
4331
|
+
/* @__PURE__ */ jsx12(ActivityIndicator5, { size: "small", color: "#000" }),
|
|
4332
|
+
/* @__PURE__ */ jsx12(Text10, { style: styles9.buttonText, children: statusLabel })
|
|
4333
|
+
] }) : /* @__PURE__ */ jsx12(Text10, { style: [styles9.buttonText, !selectedTeam && { color: t.textMuted }], children: selectedTeam ? `Join Bet \u2014 ${game.buyIn} SOL` : "Pick a team to bet" })
|
|
3896
4334
|
}
|
|
3897
4335
|
)
|
|
3898
4336
|
] });
|
|
3899
4337
|
}
|
|
3900
|
-
var
|
|
4338
|
+
var styles9 = StyleSheet10.create({
|
|
3901
4339
|
bar: { position: "absolute", bottom: 0, left: 0, right: 0, paddingHorizontal: 16, paddingTop: 12, paddingBottom: 36, borderTopWidth: 1 },
|
|
3902
4340
|
buyInRow: { flexDirection: "row", alignItems: "center", justifyContent: "space-between", marginBottom: 10 },
|
|
3903
4341
|
buyInLabel: { fontSize: 13 },
|
|
@@ -3908,20 +4346,20 @@ var styles8 = StyleSheet9.create({
|
|
|
3908
4346
|
});
|
|
3909
4347
|
|
|
3910
4348
|
// src/ui/game/CreateCustomGameSheet.tsx
|
|
3911
|
-
import { useState as
|
|
4349
|
+
import { useState as useState21, useEffect as useEffect12, useRef as useRef6, useCallback as useCallback17 } from "react";
|
|
3912
4350
|
import {
|
|
3913
|
-
View as
|
|
3914
|
-
Text as
|
|
4351
|
+
View as View11,
|
|
4352
|
+
Text as Text11,
|
|
3915
4353
|
TextInput as TextInput2,
|
|
3916
|
-
TouchableOpacity as
|
|
3917
|
-
ActivityIndicator as
|
|
3918
|
-
Modal,
|
|
3919
|
-
Animated as
|
|
3920
|
-
StyleSheet as
|
|
3921
|
-
KeyboardAvoidingView as
|
|
3922
|
-
Platform as
|
|
4354
|
+
TouchableOpacity as TouchableOpacity7,
|
|
4355
|
+
ActivityIndicator as ActivityIndicator6,
|
|
4356
|
+
Modal as Modal2,
|
|
4357
|
+
Animated as Animated3,
|
|
4358
|
+
StyleSheet as StyleSheet11,
|
|
4359
|
+
KeyboardAvoidingView as KeyboardAvoidingView3,
|
|
4360
|
+
Platform as Platform6
|
|
3923
4361
|
} from "react-native";
|
|
3924
|
-
import { jsx as
|
|
4362
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3925
4363
|
var STATUS_LABELS2 = {
|
|
3926
4364
|
building: "Building transaction...",
|
|
3927
4365
|
signing: "Approve in wallet...",
|
|
@@ -3945,18 +4383,18 @@ function CreateCustomGameSheet({
|
|
|
3945
4383
|
const t = useDubsTheme();
|
|
3946
4384
|
const { wallet } = useDubs();
|
|
3947
4385
|
const mutation = useCreateCustomGame();
|
|
3948
|
-
const [selectedAmount, setSelectedAmount] =
|
|
3949
|
-
const [customAmount, setCustomAmount] =
|
|
3950
|
-
const [isCustom, setIsCustom] =
|
|
3951
|
-
const overlayOpacity =
|
|
3952
|
-
|
|
3953
|
-
|
|
4386
|
+
const [selectedAmount, setSelectedAmount] = useState21(null);
|
|
4387
|
+
const [customAmount, setCustomAmount] = useState21("");
|
|
4388
|
+
const [isCustom, setIsCustom] = useState21(false);
|
|
4389
|
+
const overlayOpacity = useRef6(new Animated3.Value(0)).current;
|
|
4390
|
+
useEffect12(() => {
|
|
4391
|
+
Animated3.timing(overlayOpacity, {
|
|
3954
4392
|
toValue: visible ? 1 : 0,
|
|
3955
4393
|
duration: 250,
|
|
3956
4394
|
useNativeDriver: true
|
|
3957
4395
|
}).start();
|
|
3958
4396
|
}, [visible, overlayOpacity]);
|
|
3959
|
-
|
|
4397
|
+
useEffect12(() => {
|
|
3960
4398
|
if (visible) {
|
|
3961
4399
|
setSelectedAmount(defaultAmount ?? null);
|
|
3962
4400
|
setCustomAmount("");
|
|
@@ -3964,7 +4402,7 @@ function CreateCustomGameSheet({
|
|
|
3964
4402
|
mutation.reset();
|
|
3965
4403
|
}
|
|
3966
4404
|
}, [visible]);
|
|
3967
|
-
|
|
4405
|
+
useEffect12(() => {
|
|
3968
4406
|
if (mutation.status === "success" && mutation.data) {
|
|
3969
4407
|
onSuccess?.(mutation.data);
|
|
3970
4408
|
const timer = setTimeout(() => {
|
|
@@ -3973,23 +4411,23 @@ function CreateCustomGameSheet({
|
|
|
3973
4411
|
return () => clearTimeout(timer);
|
|
3974
4412
|
}
|
|
3975
4413
|
}, [mutation.status, mutation.data]);
|
|
3976
|
-
|
|
4414
|
+
useEffect12(() => {
|
|
3977
4415
|
if (mutation.status === "error" && mutation.error) {
|
|
3978
4416
|
onError?.(mutation.error);
|
|
3979
4417
|
}
|
|
3980
4418
|
}, [mutation.status, mutation.error]);
|
|
3981
|
-
const handlePresetSelect =
|
|
4419
|
+
const handlePresetSelect = useCallback17((amount) => {
|
|
3982
4420
|
setSelectedAmount(amount);
|
|
3983
4421
|
setIsCustom(false);
|
|
3984
4422
|
setCustomAmount("");
|
|
3985
4423
|
onAmountChange?.(amount);
|
|
3986
4424
|
}, [onAmountChange]);
|
|
3987
|
-
const handleCustomSelect =
|
|
4425
|
+
const handleCustomSelect = useCallback17(() => {
|
|
3988
4426
|
setIsCustom(true);
|
|
3989
4427
|
setSelectedAmount(null);
|
|
3990
4428
|
onAmountChange?.(null);
|
|
3991
4429
|
}, [onAmountChange]);
|
|
3992
|
-
const handleCustomAmountChange =
|
|
4430
|
+
const handleCustomAmountChange = useCallback17((text) => {
|
|
3993
4431
|
const cleaned = text.replace(/[^0-9.]/g, "").replace(/(\..*?)\..*/g, "$1");
|
|
3994
4432
|
setCustomAmount(cleaned);
|
|
3995
4433
|
const parsed = parseFloat(cleaned);
|
|
@@ -4004,7 +4442,7 @@ function CreateCustomGameSheet({
|
|
|
4004
4442
|
const winnerTakes = pot * (1 - fee / 100);
|
|
4005
4443
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
4006
4444
|
const canCreate = finalAmount !== null && finalAmount > 0 && !isMutating && mutation.status !== "success";
|
|
4007
|
-
const handleCreate =
|
|
4445
|
+
const handleCreate = useCallback17(async () => {
|
|
4008
4446
|
if (!finalAmount || !wallet.publicKey) return;
|
|
4009
4447
|
try {
|
|
4010
4448
|
await mutation.execute({
|
|
@@ -4020,42 +4458,42 @@ function CreateCustomGameSheet({
|
|
|
4020
4458
|
}, [finalAmount, wallet.publicKey, mutation.execute, title, maxPlayers, metadata]);
|
|
4021
4459
|
const statusLabel = STATUS_LABELS2[mutation.status] || "";
|
|
4022
4460
|
const playersLabel = playerCount === 2 ? "2 (1v1)" : `${playerCount} players`;
|
|
4023
|
-
return /* @__PURE__ */
|
|
4024
|
-
|
|
4461
|
+
return /* @__PURE__ */ jsxs11(
|
|
4462
|
+
Modal2,
|
|
4025
4463
|
{
|
|
4026
4464
|
visible,
|
|
4027
4465
|
animationType: "slide",
|
|
4028
4466
|
transparent: true,
|
|
4029
4467
|
onRequestClose: onDismiss,
|
|
4030
4468
|
children: [
|
|
4031
|
-
/* @__PURE__ */
|
|
4032
|
-
/* @__PURE__ */
|
|
4033
|
-
|
|
4469
|
+
/* @__PURE__ */ jsx13(Animated3.View, { style: [styles10.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ jsx13(TouchableOpacity7, { style: styles10.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
4470
|
+
/* @__PURE__ */ jsx13(
|
|
4471
|
+
KeyboardAvoidingView3,
|
|
4034
4472
|
{
|
|
4035
|
-
style:
|
|
4036
|
-
behavior:
|
|
4037
|
-
children: /* @__PURE__ */
|
|
4038
|
-
/* @__PURE__ */
|
|
4039
|
-
/* @__PURE__ */
|
|
4040
|
-
/* @__PURE__ */
|
|
4041
|
-
/* @__PURE__ */
|
|
4473
|
+
style: styles10.keyboardView,
|
|
4474
|
+
behavior: Platform6.OS === "ios" ? "padding" : void 0,
|
|
4475
|
+
children: /* @__PURE__ */ jsx13(View11, { style: styles10.sheetPositioner, children: /* @__PURE__ */ jsxs11(View11, { style: [styles10.sheet, { backgroundColor: t.background }], children: [
|
|
4476
|
+
/* @__PURE__ */ jsx13(View11, { style: styles10.handleRow, children: /* @__PURE__ */ jsx13(View11, { style: [styles10.handle, { backgroundColor: t.textMuted }] }) }),
|
|
4477
|
+
/* @__PURE__ */ jsxs11(View11, { style: styles10.header, children: [
|
|
4478
|
+
/* @__PURE__ */ jsx13(Text11, { style: [styles10.headerTitle, { color: t.text }], children: isPoolModeEnabled ? "Create Pool" : "New Game" }),
|
|
4479
|
+
/* @__PURE__ */ jsx13(TouchableOpacity7, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ jsx13(Text11, { style: [styles10.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
4042
4480
|
] }),
|
|
4043
|
-
!isPoolModeEnabled && /* @__PURE__ */
|
|
4044
|
-
/* @__PURE__ */
|
|
4045
|
-
/* @__PURE__ */
|
|
4481
|
+
!isPoolModeEnabled && /* @__PURE__ */ jsxs11(View11, { style: styles10.section, children: [
|
|
4482
|
+
/* @__PURE__ */ jsx13(Text11, { style: [styles10.sectionLabel, { color: t.textSecondary }], children: "Buy-In Amount" }),
|
|
4483
|
+
/* @__PURE__ */ jsxs11(View11, { style: styles10.chipsRow, children: [
|
|
4046
4484
|
presetAmounts.map((amount) => {
|
|
4047
4485
|
const active = !isCustom && selectedAmount === amount;
|
|
4048
|
-
return /* @__PURE__ */
|
|
4049
|
-
|
|
4486
|
+
return /* @__PURE__ */ jsx13(
|
|
4487
|
+
TouchableOpacity7,
|
|
4050
4488
|
{
|
|
4051
4489
|
style: [
|
|
4052
|
-
|
|
4490
|
+
styles10.chip,
|
|
4053
4491
|
{ borderColor: active ? t.accent : t.border },
|
|
4054
4492
|
active && { backgroundColor: t.accent }
|
|
4055
4493
|
],
|
|
4056
4494
|
onPress: () => handlePresetSelect(amount),
|
|
4057
4495
|
activeOpacity: 0.8,
|
|
4058
|
-
children: /* @__PURE__ */
|
|
4496
|
+
children: /* @__PURE__ */ jsxs11(Text11, { style: [styles10.chipText, { color: active ? "#FFFFFF" : t.text }], children: [
|
|
4059
4497
|
amount,
|
|
4060
4498
|
" SOL"
|
|
4061
4499
|
] })
|
|
@@ -4063,24 +4501,24 @@ function CreateCustomGameSheet({
|
|
|
4063
4501
|
amount
|
|
4064
4502
|
);
|
|
4065
4503
|
}),
|
|
4066
|
-
/* @__PURE__ */
|
|
4067
|
-
|
|
4504
|
+
/* @__PURE__ */ jsx13(
|
|
4505
|
+
TouchableOpacity7,
|
|
4068
4506
|
{
|
|
4069
4507
|
style: [
|
|
4070
|
-
|
|
4508
|
+
styles10.chip,
|
|
4071
4509
|
{ borderColor: isCustom ? t.accent : t.border },
|
|
4072
4510
|
isCustom && { backgroundColor: t.accent }
|
|
4073
4511
|
],
|
|
4074
4512
|
onPress: handleCustomSelect,
|
|
4075
4513
|
activeOpacity: 0.8,
|
|
4076
|
-
children: /* @__PURE__ */
|
|
4514
|
+
children: /* @__PURE__ */ jsx13(Text11, { style: [styles10.chipText, { color: isCustom ? "#FFFFFF" : t.text }], children: "Custom" })
|
|
4077
4515
|
}
|
|
4078
4516
|
)
|
|
4079
4517
|
] }),
|
|
4080
|
-
isCustom && /* @__PURE__ */
|
|
4518
|
+
isCustom && /* @__PURE__ */ jsx13(
|
|
4081
4519
|
TextInput2,
|
|
4082
4520
|
{
|
|
4083
|
-
style: [
|
|
4521
|
+
style: [styles10.input, { backgroundColor: t.surface, color: t.text, borderColor: t.accent }],
|
|
4084
4522
|
placeholder: "Enter amount in SOL",
|
|
4085
4523
|
placeholderTextColor: t.textDim,
|
|
4086
4524
|
keyboardType: "decimal-pad",
|
|
@@ -4090,43 +4528,43 @@ function CreateCustomGameSheet({
|
|
|
4090
4528
|
}
|
|
4091
4529
|
)
|
|
4092
4530
|
] }),
|
|
4093
|
-
/* @__PURE__ */
|
|
4094
|
-
/* @__PURE__ */
|
|
4095
|
-
/* @__PURE__ */
|
|
4096
|
-
/* @__PURE__ */
|
|
4531
|
+
/* @__PURE__ */ jsxs11(View11, { style: [styles10.summaryCard, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
4532
|
+
/* @__PURE__ */ jsxs11(View11, { style: styles10.summaryRow, children: [
|
|
4533
|
+
/* @__PURE__ */ jsx13(Text11, { style: [styles10.summaryLabel, { color: t.textMuted }], children: "Buy-in" }),
|
|
4534
|
+
/* @__PURE__ */ jsx13(Text11, { style: [styles10.summaryValue, { color: t.text }], children: finalAmount ? `${finalAmount} SOL` : "\u2014" })
|
|
4097
4535
|
] }),
|
|
4098
|
-
/* @__PURE__ */
|
|
4099
|
-
/* @__PURE__ */
|
|
4100
|
-
/* @__PURE__ */
|
|
4101
|
-
/* @__PURE__ */
|
|
4536
|
+
/* @__PURE__ */ jsx13(View11, { style: [styles10.summarySep, { backgroundColor: t.border }] }),
|
|
4537
|
+
/* @__PURE__ */ jsxs11(View11, { style: styles10.summaryRow, children: [
|
|
4538
|
+
/* @__PURE__ */ jsx13(Text11, { style: [styles10.summaryLabel, { color: t.textMuted }], children: isPoolModeEnabled ? "Max players" : "Players" }),
|
|
4539
|
+
/* @__PURE__ */ jsx13(Text11, { style: [styles10.summaryValue, { color: t.text }], children: isPoolModeEnabled ? playerCount : playersLabel })
|
|
4102
4540
|
] }),
|
|
4103
|
-
/* @__PURE__ */
|
|
4104
|
-
/* @__PURE__ */
|
|
4105
|
-
/* @__PURE__ */
|
|
4106
|
-
/* @__PURE__ */
|
|
4107
|
-
/* @__PURE__ */
|
|
4108
|
-
finalAmount ? /* @__PURE__ */
|
|
4541
|
+
/* @__PURE__ */ jsx13(View11, { style: [styles10.summarySep, { backgroundColor: t.border }] }),
|
|
4542
|
+
/* @__PURE__ */ jsxs11(View11, { style: styles10.summaryRow, children: [
|
|
4543
|
+
/* @__PURE__ */ jsx13(Text11, { style: [styles10.summaryLabel, { color: t.textMuted }], children: isPoolModeEnabled ? "Max pot" : "Winner Takes" }),
|
|
4544
|
+
/* @__PURE__ */ jsxs11(View11, { style: styles10.winnerCol, children: [
|
|
4545
|
+
/* @__PURE__ */ jsx13(Text11, { style: [styles10.summaryValue, { color: t.success }], children: finalAmount ? `${(finalAmount * playerCount * (1 - fee / 100)).toFixed(4)} SOL` : "\u2014" }),
|
|
4546
|
+
finalAmount ? /* @__PURE__ */ jsxs11(Text11, { style: [styles10.feeNote, { color: t.textDim }], children: [
|
|
4109
4547
|
fee,
|
|
4110
4548
|
"% platform fee"
|
|
4111
4549
|
] }) : null
|
|
4112
4550
|
] })
|
|
4113
4551
|
] })
|
|
4114
4552
|
] }),
|
|
4115
|
-
mutation.error && /* @__PURE__ */
|
|
4116
|
-
/* @__PURE__ */
|
|
4117
|
-
|
|
4553
|
+
mutation.error && /* @__PURE__ */ jsx13(View11, { style: [styles10.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ jsx13(Text11, { style: [styles10.errorText, { color: t.errorText }], children: mutation.error.message }) }),
|
|
4554
|
+
/* @__PURE__ */ jsx13(
|
|
4555
|
+
TouchableOpacity7,
|
|
4118
4556
|
{
|
|
4119
4557
|
style: [
|
|
4120
|
-
|
|
4558
|
+
styles10.ctaButton,
|
|
4121
4559
|
{ backgroundColor: canCreate ? t.accent : t.border }
|
|
4122
4560
|
],
|
|
4123
4561
|
disabled: !canCreate,
|
|
4124
4562
|
onPress: handleCreate,
|
|
4125
4563
|
activeOpacity: 0.8,
|
|
4126
|
-
children: isMutating ? /* @__PURE__ */
|
|
4127
|
-
/* @__PURE__ */
|
|
4128
|
-
/* @__PURE__ */
|
|
4129
|
-
] }) : mutation.status === "success" ? /* @__PURE__ */
|
|
4564
|
+
children: isMutating ? /* @__PURE__ */ jsxs11(View11, { style: styles10.ctaLoading, children: [
|
|
4565
|
+
/* @__PURE__ */ jsx13(ActivityIndicator6, { size: "small", color: "#FFFFFF" }),
|
|
4566
|
+
/* @__PURE__ */ jsx13(Text11, { style: styles10.ctaText, children: statusLabel })
|
|
4567
|
+
] }) : mutation.status === "success" ? /* @__PURE__ */ jsx13(Text11, { style: styles10.ctaText, children: isPoolModeEnabled ? "Pool Created!" : STATUS_LABELS2.success }) : /* @__PURE__ */ jsx13(Text11, { style: [styles10.ctaText, !canCreate && { opacity: 0.5 }], children: isPoolModeEnabled ? `Create Pool \u2014 ${finalAmount} SOL` : effectiveAmount ? `Create Game \u2014 ${effectiveAmount} SOL` : "Select buy-in amount" })
|
|
4130
4568
|
}
|
|
4131
4569
|
)
|
|
4132
4570
|
] }) })
|
|
@@ -4136,9 +4574,9 @@ function CreateCustomGameSheet({
|
|
|
4136
4574
|
}
|
|
4137
4575
|
);
|
|
4138
4576
|
}
|
|
4139
|
-
var
|
|
4577
|
+
var styles10 = StyleSheet11.create({
|
|
4140
4578
|
overlay: {
|
|
4141
|
-
...
|
|
4579
|
+
...StyleSheet11.absoluteFillObject,
|
|
4142
4580
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
4143
4581
|
},
|
|
4144
4582
|
overlayTap: {
|
|
@@ -4273,19 +4711,19 @@ var styles9 = StyleSheet10.create({
|
|
|
4273
4711
|
});
|
|
4274
4712
|
|
|
4275
4713
|
// src/ui/game/JoinGameSheet.tsx
|
|
4276
|
-
import { useState as
|
|
4714
|
+
import { useState as useState22, useEffect as useEffect13, useRef as useRef7, useCallback as useCallback18, useMemo as useMemo8 } from "react";
|
|
4277
4715
|
import {
|
|
4278
|
-
View as
|
|
4279
|
-
Text as
|
|
4280
|
-
TouchableOpacity as
|
|
4281
|
-
ActivityIndicator as
|
|
4282
|
-
Modal as
|
|
4283
|
-
Animated as
|
|
4284
|
-
StyleSheet as
|
|
4285
|
-
KeyboardAvoidingView as
|
|
4286
|
-
Platform as
|
|
4716
|
+
View as View12,
|
|
4717
|
+
Text as Text12,
|
|
4718
|
+
TouchableOpacity as TouchableOpacity8,
|
|
4719
|
+
ActivityIndicator as ActivityIndicator7,
|
|
4720
|
+
Modal as Modal3,
|
|
4721
|
+
Animated as Animated4,
|
|
4722
|
+
StyleSheet as StyleSheet12,
|
|
4723
|
+
KeyboardAvoidingView as KeyboardAvoidingView4,
|
|
4724
|
+
Platform as Platform7
|
|
4287
4725
|
} from "react-native";
|
|
4288
|
-
import { Fragment as Fragment4, jsx as
|
|
4726
|
+
import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4289
4727
|
var STATUS_LABELS3 = {
|
|
4290
4728
|
building: "Building transaction...",
|
|
4291
4729
|
signing: "Approve in wallet...",
|
|
@@ -4309,22 +4747,22 @@ function JoinGameSheet({
|
|
|
4309
4747
|
const { wallet } = useDubs();
|
|
4310
4748
|
const mutation = useJoinGame();
|
|
4311
4749
|
const isCustomGame = game.gameMode === CUSTOM_GAME_MODE;
|
|
4312
|
-
const [selectedTeam, setSelectedTeam] =
|
|
4313
|
-
const overlayOpacity =
|
|
4314
|
-
|
|
4315
|
-
|
|
4750
|
+
const [selectedTeam, setSelectedTeam] = useState22(null);
|
|
4751
|
+
const overlayOpacity = useRef7(new Animated4.Value(0)).current;
|
|
4752
|
+
useEffect13(() => {
|
|
4753
|
+
Animated4.timing(overlayOpacity, {
|
|
4316
4754
|
toValue: visible ? 1 : 0,
|
|
4317
4755
|
duration: 250,
|
|
4318
4756
|
useNativeDriver: true
|
|
4319
4757
|
}).start();
|
|
4320
4758
|
}, [visible, overlayOpacity]);
|
|
4321
|
-
|
|
4759
|
+
useEffect13(() => {
|
|
4322
4760
|
if (visible) {
|
|
4323
4761
|
setSelectedTeam(isPoolModeEnabled ? "home" : isCustomGame ? "away" : null);
|
|
4324
4762
|
mutation.reset();
|
|
4325
4763
|
}
|
|
4326
4764
|
}, [visible]);
|
|
4327
|
-
|
|
4765
|
+
useEffect13(() => {
|
|
4328
4766
|
if (mutation.status === "success" && mutation.data) {
|
|
4329
4767
|
onSuccess?.(mutation.data);
|
|
4330
4768
|
const timer = setTimeout(() => {
|
|
@@ -4333,7 +4771,7 @@ function JoinGameSheet({
|
|
|
4333
4771
|
return () => clearTimeout(timer);
|
|
4334
4772
|
}
|
|
4335
4773
|
}, [mutation.status, mutation.data]);
|
|
4336
|
-
|
|
4774
|
+
useEffect13(() => {
|
|
4337
4775
|
if (mutation.status === "error" && mutation.error) {
|
|
4338
4776
|
onError?.(mutation.error);
|
|
4339
4777
|
}
|
|
@@ -4344,7 +4782,7 @@ function JoinGameSheet({
|
|
|
4344
4782
|
const homePool = game.homePool || 0;
|
|
4345
4783
|
const awayPool = game.awayPool || 0;
|
|
4346
4784
|
const buyIn = game.buyIn;
|
|
4347
|
-
const { homeOdds, awayOdds, homeBets, awayBets } =
|
|
4785
|
+
const { homeOdds, awayOdds, homeBets, awayBets } = useMemo8(() => ({
|
|
4348
4786
|
homeOdds: homePool > 0 ? (totalPool / homePool).toFixed(2) : "\u2014",
|
|
4349
4787
|
awayOdds: awayPool > 0 ? (totalPool / awayPool).toFixed(2) : "\u2014",
|
|
4350
4788
|
homeBets: bettors.filter((b) => b.team === "home").length,
|
|
@@ -4356,14 +4794,14 @@ function JoinGameSheet({
|
|
|
4356
4794
|
const homeName = shortName ? shortName(opponents[0]?.name) : opponents[0]?.name || "Home";
|
|
4357
4795
|
const awayName = shortName ? shortName(opponents[1]?.name) : opponents[1]?.name || "Away";
|
|
4358
4796
|
const selectedName = selectedTeam === "home" ? homeName : selectedTeam === "away" ? awayName : "\u2014";
|
|
4359
|
-
const alreadyJoined =
|
|
4797
|
+
const alreadyJoined = useMemo8(() => {
|
|
4360
4798
|
if (!wallet.publicKey) return false;
|
|
4361
4799
|
const addr = wallet.publicKey.toBase58();
|
|
4362
4800
|
return bettors.some((b) => b.wallet === addr);
|
|
4363
4801
|
}, [bettors, wallet.publicKey]);
|
|
4364
4802
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
4365
4803
|
const canJoin = selectedTeam !== null && !isMutating && mutation.status !== "success" && !alreadyJoined;
|
|
4366
|
-
const handleJoin =
|
|
4804
|
+
const handleJoin = useCallback18(async () => {
|
|
4367
4805
|
if (!selectedTeam || !wallet.publicKey) return;
|
|
4368
4806
|
try {
|
|
4369
4807
|
await mutation.execute({
|
|
@@ -4376,30 +4814,30 @@ function JoinGameSheet({
|
|
|
4376
4814
|
}
|
|
4377
4815
|
}, [selectedTeam, wallet.publicKey, mutation.execute, game.gameId, buyIn]);
|
|
4378
4816
|
const statusLabel = STATUS_LABELS3[mutation.status] || "";
|
|
4379
|
-
return /* @__PURE__ */
|
|
4380
|
-
|
|
4817
|
+
return /* @__PURE__ */ jsxs12(
|
|
4818
|
+
Modal3,
|
|
4381
4819
|
{
|
|
4382
4820
|
visible,
|
|
4383
4821
|
animationType: "slide",
|
|
4384
4822
|
transparent: true,
|
|
4385
4823
|
onRequestClose: onDismiss,
|
|
4386
4824
|
children: [
|
|
4387
|
-
/* @__PURE__ */
|
|
4388
|
-
/* @__PURE__ */
|
|
4389
|
-
|
|
4825
|
+
/* @__PURE__ */ jsx14(Animated4.View, { style: [styles11.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ jsx14(TouchableOpacity8, { style: styles11.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
4826
|
+
/* @__PURE__ */ jsx14(
|
|
4827
|
+
KeyboardAvoidingView4,
|
|
4390
4828
|
{
|
|
4391
|
-
style:
|
|
4392
|
-
behavior:
|
|
4393
|
-
children: /* @__PURE__ */
|
|
4394
|
-
/* @__PURE__ */
|
|
4395
|
-
/* @__PURE__ */
|
|
4396
|
-
/* @__PURE__ */
|
|
4397
|
-
/* @__PURE__ */
|
|
4829
|
+
style: styles11.keyboardView,
|
|
4830
|
+
behavior: Platform7.OS === "ios" ? "padding" : void 0,
|
|
4831
|
+
children: /* @__PURE__ */ jsx14(View12, { style: styles11.sheetPositioner, children: /* @__PURE__ */ jsxs12(View12, { style: [styles11.sheet, { backgroundColor: t.background }], children: [
|
|
4832
|
+
/* @__PURE__ */ jsx14(View12, { style: styles11.handleRow, children: /* @__PURE__ */ jsx14(View12, { style: [styles11.handle, { backgroundColor: t.textMuted }] }) }),
|
|
4833
|
+
/* @__PURE__ */ jsxs12(View12, { style: styles11.header, children: [
|
|
4834
|
+
/* @__PURE__ */ jsx14(Text12, { style: [styles11.headerTitle, { color: t.text }], children: isPoolModeEnabled ? "Join Pool" : "Join Game" }),
|
|
4835
|
+
/* @__PURE__ */ jsx14(TouchableOpacity8, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ jsx14(Text12, { style: [styles11.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
4398
4836
|
] }),
|
|
4399
|
-
!isCustomGame && !isPoolModeEnabled && /* @__PURE__ */
|
|
4400
|
-
/* @__PURE__ */
|
|
4401
|
-
/* @__PURE__ */
|
|
4402
|
-
/* @__PURE__ */
|
|
4837
|
+
!isCustomGame && !isPoolModeEnabled && /* @__PURE__ */ jsxs12(View12, { style: styles11.section, children: [
|
|
4838
|
+
/* @__PURE__ */ jsx14(Text12, { style: [styles11.sectionLabel, { color: t.textSecondary }], children: "Pick Your Side" }),
|
|
4839
|
+
/* @__PURE__ */ jsxs12(View12, { style: styles11.teamsRow, children: [
|
|
4840
|
+
/* @__PURE__ */ jsx14(
|
|
4403
4841
|
TeamButton,
|
|
4404
4842
|
{
|
|
4405
4843
|
name: homeName,
|
|
@@ -4413,7 +4851,7 @@ function JoinGameSheet({
|
|
|
4413
4851
|
t
|
|
4414
4852
|
}
|
|
4415
4853
|
),
|
|
4416
|
-
/* @__PURE__ */
|
|
4854
|
+
/* @__PURE__ */ jsx14(
|
|
4417
4855
|
TeamButton,
|
|
4418
4856
|
{
|
|
4419
4857
|
name: awayName,
|
|
@@ -4429,64 +4867,64 @@ function JoinGameSheet({
|
|
|
4429
4867
|
)
|
|
4430
4868
|
] })
|
|
4431
4869
|
] }),
|
|
4432
|
-
/* @__PURE__ */
|
|
4433
|
-
/* @__PURE__ */
|
|
4434
|
-
/* @__PURE__ */
|
|
4435
|
-
/* @__PURE__ */
|
|
4870
|
+
/* @__PURE__ */ jsxs12(View12, { style: [styles11.summaryCard, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
4871
|
+
/* @__PURE__ */ jsxs12(View12, { style: styles11.summaryRow, children: [
|
|
4872
|
+
/* @__PURE__ */ jsx14(Text12, { style: [styles11.summaryLabel, { color: t.textMuted }], children: "Buy-in" }),
|
|
4873
|
+
/* @__PURE__ */ jsxs12(Text12, { style: [styles11.summaryValue, { color: t.text }], children: [
|
|
4436
4874
|
buyIn,
|
|
4437
4875
|
" SOL"
|
|
4438
4876
|
] })
|
|
4439
4877
|
] }),
|
|
4440
|
-
/* @__PURE__ */
|
|
4441
|
-
isPoolModeEnabled ? /* @__PURE__ */
|
|
4442
|
-
/* @__PURE__ */
|
|
4443
|
-
/* @__PURE__ */
|
|
4444
|
-
/* @__PURE__ */
|
|
4878
|
+
/* @__PURE__ */ jsx14(View12, { style: [styles11.summarySep, { backgroundColor: t.border }] }),
|
|
4879
|
+
isPoolModeEnabled ? /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
4880
|
+
/* @__PURE__ */ jsxs12(View12, { style: styles11.summaryRow, children: [
|
|
4881
|
+
/* @__PURE__ */ jsx14(Text12, { style: [styles11.summaryLabel, { color: t.textMuted }], children: "Players in" }),
|
|
4882
|
+
/* @__PURE__ */ jsx14(Text12, { style: [styles11.summaryValue, { color: t.text }], children: bettors.length })
|
|
4445
4883
|
] }),
|
|
4446
|
-
/* @__PURE__ */
|
|
4447
|
-
/* @__PURE__ */
|
|
4448
|
-
/* @__PURE__ */
|
|
4449
|
-
/* @__PURE__ */
|
|
4884
|
+
/* @__PURE__ */ jsx14(View12, { style: [styles11.summarySep, { backgroundColor: t.border }] }),
|
|
4885
|
+
/* @__PURE__ */ jsxs12(View12, { style: styles11.summaryRow, children: [
|
|
4886
|
+
/* @__PURE__ */ jsx14(Text12, { style: [styles11.summaryLabel, { color: t.textMuted }], children: "Current pot" }),
|
|
4887
|
+
/* @__PURE__ */ jsxs12(Text12, { style: [styles11.summaryValue, { color: t.success }], children: [
|
|
4450
4888
|
totalPool,
|
|
4451
4889
|
" SOL"
|
|
4452
4890
|
] })
|
|
4453
4891
|
] })
|
|
4454
|
-
] }) : /* @__PURE__ */
|
|
4455
|
-
/* @__PURE__ */
|
|
4456
|
-
/* @__PURE__ */
|
|
4457
|
-
/* @__PURE__ */
|
|
4892
|
+
] }) : /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
4893
|
+
/* @__PURE__ */ jsxs12(View12, { style: styles11.summaryRow, children: [
|
|
4894
|
+
/* @__PURE__ */ jsx14(Text12, { style: [styles11.summaryLabel, { color: t.textMuted }], children: "Your side" }),
|
|
4895
|
+
/* @__PURE__ */ jsx14(Text12, { style: [styles11.summaryValue, { color: t.text }], children: selectedName })
|
|
4458
4896
|
] }),
|
|
4459
|
-
/* @__PURE__ */
|
|
4460
|
-
/* @__PURE__ */
|
|
4461
|
-
/* @__PURE__ */
|
|
4462
|
-
/* @__PURE__ */
|
|
4897
|
+
/* @__PURE__ */ jsx14(View12, { style: [styles11.summarySep, { backgroundColor: t.border }] }),
|
|
4898
|
+
/* @__PURE__ */ jsxs12(View12, { style: styles11.summaryRow, children: [
|
|
4899
|
+
/* @__PURE__ */ jsx14(Text12, { style: [styles11.summaryLabel, { color: t.textMuted }], children: "Total pool" }),
|
|
4900
|
+
/* @__PURE__ */ jsxs12(Text12, { style: [styles11.summaryValue, { color: t.text }], children: [
|
|
4463
4901
|
poolAfterJoin,
|
|
4464
4902
|
" SOL"
|
|
4465
4903
|
] })
|
|
4466
4904
|
] }),
|
|
4467
|
-
/* @__PURE__ */
|
|
4468
|
-
/* @__PURE__ */
|
|
4469
|
-
/* @__PURE__ */
|
|
4470
|
-
/* @__PURE__ */
|
|
4905
|
+
/* @__PURE__ */ jsx14(View12, { style: [styles11.summarySep, { backgroundColor: t.border }] }),
|
|
4906
|
+
/* @__PURE__ */ jsxs12(View12, { style: styles11.summaryRow, children: [
|
|
4907
|
+
/* @__PURE__ */ jsx14(Text12, { style: [styles11.summaryLabel, { color: t.textMuted }], children: "Potential winnings" }),
|
|
4908
|
+
/* @__PURE__ */ jsx14(Text12, { style: [styles11.summaryValue, { color: t.success }], children: potentialWinnings !== "\u2014" ? `${potentialWinnings} SOL` : "\u2014" })
|
|
4471
4909
|
] })
|
|
4472
4910
|
] })
|
|
4473
4911
|
] }),
|
|
4474
|
-
alreadyJoined && /* @__PURE__ */
|
|
4475
|
-
mutation.error && /* @__PURE__ */
|
|
4476
|
-
/* @__PURE__ */
|
|
4477
|
-
|
|
4912
|
+
alreadyJoined && /* @__PURE__ */ jsx14(View12, { style: [styles11.errorBox, { backgroundColor: t.surface, borderColor: t.border }], children: /* @__PURE__ */ jsx14(Text12, { style: [styles11.errorText, { color: t.textMuted }], children: isPoolModeEnabled ? "You've already joined this pool." : "You've already joined this game." }) }),
|
|
4913
|
+
mutation.error && /* @__PURE__ */ jsx14(View12, { style: [styles11.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ jsx14(Text12, { style: [styles11.errorText, { color: t.errorText }], children: mutation.error.message }) }),
|
|
4914
|
+
/* @__PURE__ */ jsx14(
|
|
4915
|
+
TouchableOpacity8,
|
|
4478
4916
|
{
|
|
4479
4917
|
style: [
|
|
4480
|
-
|
|
4918
|
+
styles11.ctaButton,
|
|
4481
4919
|
{ backgroundColor: canJoin ? t.accent : t.border }
|
|
4482
4920
|
],
|
|
4483
4921
|
disabled: !canJoin,
|
|
4484
4922
|
onPress: handleJoin,
|
|
4485
4923
|
activeOpacity: 0.8,
|
|
4486
|
-
children: isMutating ? /* @__PURE__ */
|
|
4487
|
-
/* @__PURE__ */
|
|
4488
|
-
/* @__PURE__ */
|
|
4489
|
-
] }) : mutation.status === "success" ? /* @__PURE__ */
|
|
4924
|
+
children: isMutating ? /* @__PURE__ */ jsxs12(View12, { style: styles11.ctaLoading, children: [
|
|
4925
|
+
/* @__PURE__ */ jsx14(ActivityIndicator7, { size: "small", color: "#FFFFFF" }),
|
|
4926
|
+
/* @__PURE__ */ jsx14(Text12, { style: styles11.ctaText, children: statusLabel })
|
|
4927
|
+
] }) : mutation.status === "success" ? /* @__PURE__ */ jsx14(Text12, { style: styles11.ctaText, children: isPoolModeEnabled ? "Joined!" : STATUS_LABELS3.success }) : /* @__PURE__ */ jsx14(Text12, { style: [styles11.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" })
|
|
4490
4928
|
}
|
|
4491
4929
|
)
|
|
4492
4930
|
] }) })
|
|
@@ -4507,35 +4945,35 @@ function TeamButton({
|
|
|
4507
4945
|
ImageComponent,
|
|
4508
4946
|
t
|
|
4509
4947
|
}) {
|
|
4510
|
-
const [imgFailed, setImgFailed] =
|
|
4948
|
+
const [imgFailed, setImgFailed] = useState22(false);
|
|
4511
4949
|
const Img = ImageComponent || __require("react-native").Image;
|
|
4512
4950
|
const showImage = imageUrl && !imgFailed;
|
|
4513
|
-
return /* @__PURE__ */
|
|
4514
|
-
|
|
4951
|
+
return /* @__PURE__ */ jsxs12(
|
|
4952
|
+
TouchableOpacity8,
|
|
4515
4953
|
{
|
|
4516
|
-
style: [
|
|
4954
|
+
style: [styles11.teamOption, { borderColor: selected ? color : t.border, backgroundColor: selected ? color + "15" : t.background }],
|
|
4517
4955
|
onPress,
|
|
4518
4956
|
activeOpacity: 0.7,
|
|
4519
4957
|
children: [
|
|
4520
|
-
showImage ? /* @__PURE__ */
|
|
4521
|
-
/* @__PURE__ */
|
|
4522
|
-
/* @__PURE__ */
|
|
4958
|
+
showImage ? /* @__PURE__ */ jsx14(Img, { source: { uri: imageUrl }, style: styles11.teamLogo, resizeMode: "contain", onError: () => setImgFailed(true) }) : /* @__PURE__ */ jsx14(View12, { style: [styles11.teamLogo, styles11.teamLogoPlaceholder] }),
|
|
4959
|
+
/* @__PURE__ */ jsx14(Text12, { style: [styles11.teamName, { color: t.text }], numberOfLines: 1, children: name }),
|
|
4960
|
+
/* @__PURE__ */ jsxs12(Text12, { style: [styles11.teamOdds, { color }], children: [
|
|
4523
4961
|
odds,
|
|
4524
4962
|
"x"
|
|
4525
4963
|
] }),
|
|
4526
|
-
/* @__PURE__ */
|
|
4964
|
+
/* @__PURE__ */ jsxs12(Text12, { style: [styles11.teamBets, { color: t.textMuted }], children: [
|
|
4527
4965
|
bets,
|
|
4528
4966
|
" ",
|
|
4529
4967
|
bets === 1 ? "bet" : "bets"
|
|
4530
4968
|
] }),
|
|
4531
|
-
selected && /* @__PURE__ */
|
|
4969
|
+
selected && /* @__PURE__ */ jsx14(View12, { style: [styles11.teamBadge, { backgroundColor: color }], children: /* @__PURE__ */ jsx14(Text12, { style: styles11.teamBadgeText, children: "Selected" }) })
|
|
4532
4970
|
]
|
|
4533
4971
|
}
|
|
4534
4972
|
);
|
|
4535
4973
|
}
|
|
4536
|
-
var
|
|
4974
|
+
var styles11 = StyleSheet12.create({
|
|
4537
4975
|
overlay: {
|
|
4538
|
-
...
|
|
4976
|
+
...StyleSheet12.absoluteFillObject,
|
|
4539
4977
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
4540
4978
|
},
|
|
4541
4979
|
overlayTap: {
|
|
@@ -4684,19 +5122,19 @@ var styles10 = StyleSheet11.create({
|
|
|
4684
5122
|
});
|
|
4685
5123
|
|
|
4686
5124
|
// src/ui/game/ClaimPrizeSheet.tsx
|
|
4687
|
-
import { useState as
|
|
5125
|
+
import { useState as useState23, useEffect as useEffect14, useRef as useRef8, useCallback as useCallback19 } from "react";
|
|
4688
5126
|
import {
|
|
4689
|
-
View as
|
|
4690
|
-
Text as
|
|
4691
|
-
TouchableOpacity as
|
|
4692
|
-
ActivityIndicator as
|
|
4693
|
-
Modal as
|
|
4694
|
-
Animated as
|
|
4695
|
-
StyleSheet as
|
|
4696
|
-
KeyboardAvoidingView as
|
|
4697
|
-
Platform as
|
|
5127
|
+
View as View13,
|
|
5128
|
+
Text as Text13,
|
|
5129
|
+
TouchableOpacity as TouchableOpacity9,
|
|
5130
|
+
ActivityIndicator as ActivityIndicator8,
|
|
5131
|
+
Modal as Modal4,
|
|
5132
|
+
Animated as Animated5,
|
|
5133
|
+
StyleSheet as StyleSheet13,
|
|
5134
|
+
KeyboardAvoidingView as KeyboardAvoidingView5,
|
|
5135
|
+
Platform as Platform8
|
|
4698
5136
|
} from "react-native";
|
|
4699
|
-
import { jsx as
|
|
5137
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4700
5138
|
var STATUS_LABELS4 = {
|
|
4701
5139
|
building: "Building transaction...",
|
|
4702
5140
|
signing: "Approve in wallet...",
|
|
@@ -4715,18 +5153,18 @@ function ClaimPrizeSheet({
|
|
|
4715
5153
|
const t = useDubsTheme();
|
|
4716
5154
|
const { wallet } = useDubs();
|
|
4717
5155
|
const mutation = useClaim();
|
|
4718
|
-
const overlayOpacity =
|
|
4719
|
-
const celebrationScale =
|
|
4720
|
-
const celebrationOpacity =
|
|
4721
|
-
const [showCelebration, setShowCelebration] =
|
|
4722
|
-
|
|
4723
|
-
|
|
5156
|
+
const overlayOpacity = useRef8(new Animated5.Value(0)).current;
|
|
5157
|
+
const celebrationScale = useRef8(new Animated5.Value(0)).current;
|
|
5158
|
+
const celebrationOpacity = useRef8(new Animated5.Value(0)).current;
|
|
5159
|
+
const [showCelebration, setShowCelebration] = useState23(false);
|
|
5160
|
+
useEffect14(() => {
|
|
5161
|
+
Animated5.timing(overlayOpacity, {
|
|
4724
5162
|
toValue: visible ? 1 : 0,
|
|
4725
5163
|
duration: 250,
|
|
4726
5164
|
useNativeDriver: true
|
|
4727
5165
|
}).start();
|
|
4728
5166
|
}, [visible, overlayOpacity]);
|
|
4729
|
-
|
|
5167
|
+
useEffect14(() => {
|
|
4730
5168
|
if (visible) {
|
|
4731
5169
|
mutation.reset();
|
|
4732
5170
|
setShowCelebration(false);
|
|
@@ -4734,17 +5172,17 @@ function ClaimPrizeSheet({
|
|
|
4734
5172
|
celebrationOpacity.setValue(0);
|
|
4735
5173
|
}
|
|
4736
5174
|
}, [visible]);
|
|
4737
|
-
|
|
5175
|
+
useEffect14(() => {
|
|
4738
5176
|
if (mutation.status === "success" && mutation.data) {
|
|
4739
5177
|
setShowCelebration(true);
|
|
4740
|
-
|
|
4741
|
-
|
|
5178
|
+
Animated5.parallel([
|
|
5179
|
+
Animated5.spring(celebrationScale, {
|
|
4742
5180
|
toValue: 1,
|
|
4743
5181
|
tension: 50,
|
|
4744
5182
|
friction: 6,
|
|
4745
5183
|
useNativeDriver: true
|
|
4746
5184
|
}),
|
|
4747
|
-
|
|
5185
|
+
Animated5.timing(celebrationOpacity, {
|
|
4748
5186
|
toValue: 1,
|
|
4749
5187
|
duration: 300,
|
|
4750
5188
|
useNativeDriver: true
|
|
@@ -4757,14 +5195,14 @@ function ClaimPrizeSheet({
|
|
|
4757
5195
|
return () => clearTimeout(timer);
|
|
4758
5196
|
}
|
|
4759
5197
|
}, [mutation.status, mutation.data]);
|
|
4760
|
-
|
|
5198
|
+
useEffect14(() => {
|
|
4761
5199
|
if (mutation.status === "error" && mutation.error) {
|
|
4762
5200
|
onError?.(mutation.error);
|
|
4763
5201
|
}
|
|
4764
5202
|
}, [mutation.status, mutation.error]);
|
|
4765
5203
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
4766
5204
|
const canClaim = !isMutating && mutation.status !== "success" && !!wallet.publicKey;
|
|
4767
|
-
const handleClaim =
|
|
5205
|
+
const handleClaim = useCallback19(async () => {
|
|
4768
5206
|
if (!wallet.publicKey) return;
|
|
4769
5207
|
try {
|
|
4770
5208
|
await mutation.execute({
|
|
@@ -4776,62 +5214,62 @@ function ClaimPrizeSheet({
|
|
|
4776
5214
|
}
|
|
4777
5215
|
}, [wallet.publicKey, mutation.execute, gameId, prizeAmount]);
|
|
4778
5216
|
const statusLabel = STATUS_LABELS4[mutation.status] || "";
|
|
4779
|
-
return /* @__PURE__ */
|
|
4780
|
-
|
|
5217
|
+
return /* @__PURE__ */ jsxs13(
|
|
5218
|
+
Modal4,
|
|
4781
5219
|
{
|
|
4782
5220
|
visible,
|
|
4783
5221
|
animationType: "slide",
|
|
4784
5222
|
transparent: true,
|
|
4785
5223
|
onRequestClose: onDismiss,
|
|
4786
5224
|
children: [
|
|
4787
|
-
/* @__PURE__ */
|
|
4788
|
-
/* @__PURE__ */
|
|
4789
|
-
|
|
5225
|
+
/* @__PURE__ */ jsx15(Animated5.View, { style: [styles12.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ jsx15(TouchableOpacity9, { style: styles12.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
5226
|
+
/* @__PURE__ */ jsx15(
|
|
5227
|
+
KeyboardAvoidingView5,
|
|
4790
5228
|
{
|
|
4791
|
-
style:
|
|
4792
|
-
behavior:
|
|
4793
|
-
children: /* @__PURE__ */
|
|
4794
|
-
/* @__PURE__ */
|
|
4795
|
-
/* @__PURE__ */
|
|
4796
|
-
/* @__PURE__ */
|
|
4797
|
-
/* @__PURE__ */
|
|
5229
|
+
style: styles12.keyboardView,
|
|
5230
|
+
behavior: Platform8.OS === "ios" ? "padding" : void 0,
|
|
5231
|
+
children: /* @__PURE__ */ jsx15(View13, { style: styles12.sheetPositioner, children: /* @__PURE__ */ jsxs13(View13, { style: [styles12.sheet, { backgroundColor: t.background }], children: [
|
|
5232
|
+
/* @__PURE__ */ jsx15(View13, { style: styles12.handleRow, children: /* @__PURE__ */ jsx15(View13, { style: [styles12.handle, { backgroundColor: t.textMuted }] }) }),
|
|
5233
|
+
/* @__PURE__ */ jsxs13(View13, { style: styles12.header, children: [
|
|
5234
|
+
/* @__PURE__ */ jsx15(Text13, { style: [styles12.headerTitle, { color: t.text }], children: showCelebration ? isRefund ? "Refund Claimed!" : "Prize Claimed!" : isRefund ? "Claim Refund" : "Claim Prize" }),
|
|
5235
|
+
/* @__PURE__ */ jsx15(TouchableOpacity9, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ jsx15(Text13, { style: [styles12.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
4798
5236
|
] }),
|
|
4799
|
-
showCelebration && /* @__PURE__ */
|
|
4800
|
-
|
|
5237
|
+
showCelebration && /* @__PURE__ */ jsxs13(
|
|
5238
|
+
Animated5.View,
|
|
4801
5239
|
{
|
|
4802
5240
|
style: [
|
|
4803
|
-
|
|
5241
|
+
styles12.celebrationContainer,
|
|
4804
5242
|
{
|
|
4805
5243
|
opacity: celebrationOpacity,
|
|
4806
5244
|
transform: [{ scale: celebrationScale }]
|
|
4807
5245
|
}
|
|
4808
5246
|
],
|
|
4809
5247
|
children: [
|
|
4810
|
-
/* @__PURE__ */
|
|
4811
|
-
/* @__PURE__ */
|
|
5248
|
+
/* @__PURE__ */ jsx15(Text13, { style: styles12.celebrationEmoji, children: "\u{1F3C6}" }),
|
|
5249
|
+
/* @__PURE__ */ jsxs13(Text13, { style: [styles12.celebrationText, { color: t.success }], children: [
|
|
4812
5250
|
"+",
|
|
4813
5251
|
prizeAmount,
|
|
4814
5252
|
" SOL"
|
|
4815
5253
|
] }),
|
|
4816
|
-
/* @__PURE__ */
|
|
5254
|
+
/* @__PURE__ */ jsx15(Text13, { style: [styles12.celebrationSubtext, { color: t.textMuted }], children: isRefund ? "Refund sent to your wallet" : "Winnings sent to your wallet" })
|
|
4817
5255
|
]
|
|
4818
5256
|
}
|
|
4819
5257
|
),
|
|
4820
|
-
!showCelebration && /* @__PURE__ */
|
|
4821
|
-
/* @__PURE__ */
|
|
4822
|
-
/* @__PURE__ */
|
|
4823
|
-
/* @__PURE__ */
|
|
5258
|
+
!showCelebration && /* @__PURE__ */ jsxs13(View13, { style: [styles12.summaryCard, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
5259
|
+
/* @__PURE__ */ jsxs13(View13, { style: styles12.summaryRow, children: [
|
|
5260
|
+
/* @__PURE__ */ jsx15(Text13, { style: [styles12.summaryLabel, { color: t.textMuted }], children: isRefund ? "Refund" : "Prize" }),
|
|
5261
|
+
/* @__PURE__ */ jsxs13(Text13, { style: [styles12.summaryValue, { color: t.success }], children: [
|
|
4824
5262
|
prizeAmount,
|
|
4825
5263
|
" SOL"
|
|
4826
5264
|
] })
|
|
4827
5265
|
] }),
|
|
4828
|
-
/* @__PURE__ */
|
|
4829
|
-
/* @__PURE__ */
|
|
4830
|
-
/* @__PURE__ */
|
|
4831
|
-
/* @__PURE__ */
|
|
4832
|
-
|
|
5266
|
+
/* @__PURE__ */ jsx15(View13, { style: [styles12.summarySep, { backgroundColor: t.border }] }),
|
|
5267
|
+
/* @__PURE__ */ jsxs13(View13, { style: styles12.summaryRow, children: [
|
|
5268
|
+
/* @__PURE__ */ jsx15(Text13, { style: [styles12.summaryLabel, { color: t.textMuted }], children: "Game" }),
|
|
5269
|
+
/* @__PURE__ */ jsxs13(
|
|
5270
|
+
Text13,
|
|
4833
5271
|
{
|
|
4834
|
-
style: [
|
|
5272
|
+
style: [styles12.summaryValue, { color: t.text }],
|
|
4835
5273
|
numberOfLines: 1,
|
|
4836
5274
|
children: [
|
|
4837
5275
|
gameId.slice(0, 8),
|
|
@@ -4842,21 +5280,21 @@ function ClaimPrizeSheet({
|
|
|
4842
5280
|
)
|
|
4843
5281
|
] })
|
|
4844
5282
|
] }),
|
|
4845
|
-
mutation.error && /* @__PURE__ */
|
|
4846
|
-
!showCelebration && /* @__PURE__ */
|
|
4847
|
-
|
|
5283
|
+
mutation.error && /* @__PURE__ */ jsx15(View13, { style: [styles12.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ jsx15(Text13, { style: [styles12.errorText, { color: t.errorText }], children: mutation.error.message }) }),
|
|
5284
|
+
!showCelebration && /* @__PURE__ */ jsx15(
|
|
5285
|
+
TouchableOpacity9,
|
|
4848
5286
|
{
|
|
4849
5287
|
style: [
|
|
4850
|
-
|
|
5288
|
+
styles12.ctaButton,
|
|
4851
5289
|
{ backgroundColor: canClaim ? t.accent : t.border }
|
|
4852
5290
|
],
|
|
4853
5291
|
disabled: !canClaim,
|
|
4854
5292
|
onPress: handleClaim,
|
|
4855
5293
|
activeOpacity: 0.8,
|
|
4856
|
-
children: isMutating ? /* @__PURE__ */
|
|
4857
|
-
/* @__PURE__ */
|
|
4858
|
-
/* @__PURE__ */
|
|
4859
|
-
] }) : /* @__PURE__ */
|
|
5294
|
+
children: isMutating ? /* @__PURE__ */ jsxs13(View13, { style: styles12.ctaLoading, children: [
|
|
5295
|
+
/* @__PURE__ */ jsx15(ActivityIndicator8, { size: "small", color: "#FFFFFF" }),
|
|
5296
|
+
/* @__PURE__ */ jsx15(Text13, { style: styles12.ctaText, children: statusLabel })
|
|
5297
|
+
] }) : /* @__PURE__ */ jsxs13(Text13, { style: [styles12.ctaText, !canClaim && { opacity: 0.5 }], children: [
|
|
4860
5298
|
isRefund ? "Claim Refund" : "Claim Prize",
|
|
4861
5299
|
" \u2014 ",
|
|
4862
5300
|
prizeAmount,
|
|
@@ -4864,7 +5302,7 @@ function ClaimPrizeSheet({
|
|
|
4864
5302
|
] })
|
|
4865
5303
|
}
|
|
4866
5304
|
),
|
|
4867
|
-
mutation.data?.explorerUrl && /* @__PURE__ */
|
|
5305
|
+
mutation.data?.explorerUrl && /* @__PURE__ */ jsx15(Text13, { style: [styles12.explorerHint, { color: t.textMuted }], children: "View on Solscan" })
|
|
4868
5306
|
] }) })
|
|
4869
5307
|
}
|
|
4870
5308
|
)
|
|
@@ -4872,9 +5310,9 @@ function ClaimPrizeSheet({
|
|
|
4872
5310
|
}
|
|
4873
5311
|
);
|
|
4874
5312
|
}
|
|
4875
|
-
var
|
|
5313
|
+
var styles12 = StyleSheet13.create({
|
|
4876
5314
|
overlay: {
|
|
4877
|
-
...
|
|
5315
|
+
...StyleSheet13.absoluteFillObject,
|
|
4878
5316
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
4879
5317
|
},
|
|
4880
5318
|
overlayTap: {
|
|
@@ -4997,17 +5435,17 @@ var styles11 = StyleSheet12.create({
|
|
|
4997
5435
|
});
|
|
4998
5436
|
|
|
4999
5437
|
// src/ui/game/ClaimButton.tsx
|
|
5000
|
-
import { useState as
|
|
5001
|
-
import { StyleSheet as
|
|
5002
|
-
import { Fragment as Fragment5, jsx as
|
|
5438
|
+
import { useState as useState24, useMemo as useMemo9, useCallback as useCallback20 } from "react";
|
|
5439
|
+
import { StyleSheet as StyleSheet14, Text as Text14, TouchableOpacity as TouchableOpacity10 } from "react-native";
|
|
5440
|
+
import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5003
5441
|
function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
5004
5442
|
const t = useDubsTheme();
|
|
5005
5443
|
const { wallet } = useDubs();
|
|
5006
5444
|
const game = useGame(gameId);
|
|
5007
5445
|
const claimStatus = useHasClaimed(gameId);
|
|
5008
|
-
const [sheetVisible, setSheetVisible] =
|
|
5446
|
+
const [sheetVisible, setSheetVisible] = useState24(false);
|
|
5009
5447
|
const walletAddress = wallet.publicKey?.toBase58() ?? null;
|
|
5010
|
-
const myBet =
|
|
5448
|
+
const myBet = useMemo9(() => {
|
|
5011
5449
|
if (!walletAddress || !game.data?.bettors) return null;
|
|
5012
5450
|
return game.data.bettors.find((b) => b.wallet === walletAddress) ?? null;
|
|
5013
5451
|
}, [walletAddress, game.data?.bettors]);
|
|
@@ -5016,7 +5454,7 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
5016
5454
|
const isWinner = isResolved && myBet != null && myBet.team === game.data?.winnerSide;
|
|
5017
5455
|
const isEligible = myBet != null && isResolved && (isWinner || isRefund);
|
|
5018
5456
|
const prizeAmount = isRefund ? myBet?.amount ?? 0 : game.data?.totalPool ?? 0;
|
|
5019
|
-
const handleSuccess =
|
|
5457
|
+
const handleSuccess = useCallback20(
|
|
5020
5458
|
(result) => {
|
|
5021
5459
|
claimStatus.refetch();
|
|
5022
5460
|
onSuccess?.(result);
|
|
@@ -5029,13 +5467,13 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
5029
5467
|
}
|
|
5030
5468
|
const label = isRefund ? "Refund" : "Prize";
|
|
5031
5469
|
if (claimStatus.hasClaimed) {
|
|
5032
|
-
return /* @__PURE__ */
|
|
5033
|
-
|
|
5470
|
+
return /* @__PURE__ */ jsx16(
|
|
5471
|
+
TouchableOpacity10,
|
|
5034
5472
|
{
|
|
5035
|
-
style: [
|
|
5473
|
+
style: [styles13.badge, { borderColor: t.accent }, style],
|
|
5036
5474
|
activeOpacity: 1,
|
|
5037
5475
|
disabled: true,
|
|
5038
|
-
children: /* @__PURE__ */
|
|
5476
|
+
children: /* @__PURE__ */ jsxs14(Text14, { style: [styles13.badgeText, { color: t.accent }], children: [
|
|
5039
5477
|
label,
|
|
5040
5478
|
" Claimed!"
|
|
5041
5479
|
] })
|
|
@@ -5045,14 +5483,14 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
5045
5483
|
if (!isEligible) {
|
|
5046
5484
|
return null;
|
|
5047
5485
|
}
|
|
5048
|
-
return /* @__PURE__ */
|
|
5049
|
-
/* @__PURE__ */
|
|
5050
|
-
|
|
5486
|
+
return /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
5487
|
+
/* @__PURE__ */ jsx16(
|
|
5488
|
+
TouchableOpacity10,
|
|
5051
5489
|
{
|
|
5052
|
-
style: [
|
|
5490
|
+
style: [styles13.button, { backgroundColor: t.accent }, style],
|
|
5053
5491
|
activeOpacity: 0.8,
|
|
5054
5492
|
onPress: () => setSheetVisible(true),
|
|
5055
|
-
children: /* @__PURE__ */
|
|
5493
|
+
children: /* @__PURE__ */ jsxs14(Text14, { style: styles13.buttonText, children: [
|
|
5056
5494
|
"Claim ",
|
|
5057
5495
|
label,
|
|
5058
5496
|
" \u2014 ",
|
|
@@ -5061,7 +5499,7 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
5061
5499
|
] })
|
|
5062
5500
|
}
|
|
5063
5501
|
),
|
|
5064
|
-
/* @__PURE__ */
|
|
5502
|
+
/* @__PURE__ */ jsx16(
|
|
5065
5503
|
ClaimPrizeSheet,
|
|
5066
5504
|
{
|
|
5067
5505
|
visible: sheetVisible,
|
|
@@ -5075,7 +5513,7 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
5075
5513
|
)
|
|
5076
5514
|
] });
|
|
5077
5515
|
}
|
|
5078
|
-
var
|
|
5516
|
+
var styles13 = StyleSheet14.create({
|
|
5079
5517
|
button: {
|
|
5080
5518
|
height: 52,
|
|
5081
5519
|
borderRadius: 14,
|
|
@@ -5125,6 +5563,7 @@ export {
|
|
|
5125
5563
|
STORAGE_KEYS,
|
|
5126
5564
|
SettingsSheet,
|
|
5127
5565
|
UserProfileCard,
|
|
5566
|
+
UserProfileSheet,
|
|
5128
5567
|
createSecureStoreStorage,
|
|
5129
5568
|
getDeviceInfo,
|
|
5130
5569
|
isSolanaSeeker,
|