@dubsdotapp/expo 0.5.11 → 0.5.13
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 +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +575 -340
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +540 -296
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -1
- package/src/ui/game/CreateGameSheet.tsx +326 -0
- package/src/ui/game/JoinGameSheet.tsx +1 -74
- package/src/ui/game/TeamButton.tsx +85 -0
- package/src/ui/game/index.ts +2 -0
- package/src/ui/index.ts +2 -1
package/dist/index.js
CHANGED
|
@@ -37,6 +37,7 @@ __export(index_exports, {
|
|
|
37
37
|
ConnectWalletButton: () => ConnectWalletButton,
|
|
38
38
|
ConnectWalletScreen: () => ConnectWalletScreen,
|
|
39
39
|
CreateCustomGameSheet: () => CreateCustomGameSheet,
|
|
40
|
+
CreateGameSheet: () => CreateGameSheet,
|
|
40
41
|
DEFAULT_BASE_URL: () => DEFAULT_BASE_URL,
|
|
41
42
|
DEFAULT_RPC_URL: () => DEFAULT_RPC_URL,
|
|
42
43
|
DubsApiError: () => DubsApiError,
|
|
@@ -5342,8 +5343,8 @@ var styles12 = import_react_native18.StyleSheet.create({
|
|
|
5342
5343
|
});
|
|
5343
5344
|
|
|
5344
5345
|
// src/ui/game/JoinGameSheet.tsx
|
|
5345
|
-
var
|
|
5346
|
-
var
|
|
5346
|
+
var import_react35 = require("react");
|
|
5347
|
+
var import_react_native21 = require("react-native");
|
|
5347
5348
|
|
|
5348
5349
|
// src/ui/game/SolSlider.tsx
|
|
5349
5350
|
var import_react33 = require("react");
|
|
@@ -5534,8 +5535,90 @@ var styles13 = import_react_native19.StyleSheet.create({
|
|
|
5534
5535
|
}
|
|
5535
5536
|
});
|
|
5536
5537
|
|
|
5537
|
-
// src/ui/game/
|
|
5538
|
+
// src/ui/game/TeamButton.tsx
|
|
5539
|
+
var import_react34 = require("react");
|
|
5540
|
+
var import_react_native20 = require("react-native");
|
|
5538
5541
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
5542
|
+
function TeamButton({
|
|
5543
|
+
name,
|
|
5544
|
+
imageUrl,
|
|
5545
|
+
odds,
|
|
5546
|
+
bets,
|
|
5547
|
+
color,
|
|
5548
|
+
selected,
|
|
5549
|
+
onPress,
|
|
5550
|
+
ImageComponent,
|
|
5551
|
+
t
|
|
5552
|
+
}) {
|
|
5553
|
+
const [imgFailed, setImgFailed] = (0, import_react34.useState)(false);
|
|
5554
|
+
const Img = ImageComponent || require("react-native").Image;
|
|
5555
|
+
const showImage = imageUrl && !imgFailed;
|
|
5556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
5557
|
+
import_react_native20.TouchableOpacity,
|
|
5558
|
+
{
|
|
5559
|
+
style: [styles14.teamOption, { borderColor: selected ? color : t.border, backgroundColor: selected ? color + "15" : t.background }],
|
|
5560
|
+
onPress,
|
|
5561
|
+
activeOpacity: 0.7,
|
|
5562
|
+
children: [
|
|
5563
|
+
showImage ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Img, { source: { uri: imageUrl }, style: styles14.teamLogo, resizeMode: "contain", onError: () => setImgFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native20.View, { style: [styles14.teamLogo, styles14.teamLogoPlaceholder] }),
|
|
5564
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native20.Text, { style: [styles14.teamName, { color: t.text }], numberOfLines: 1, children: name }),
|
|
5565
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native20.Text, { style: [styles14.teamOdds, { color }], children: [
|
|
5566
|
+
odds,
|
|
5567
|
+
"x"
|
|
5568
|
+
] }),
|
|
5569
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native20.Text, { style: [styles14.teamBets, { color: t.textMuted }], children: [
|
|
5570
|
+
bets,
|
|
5571
|
+
" ",
|
|
5572
|
+
bets === 1 ? "bet" : "bets"
|
|
5573
|
+
] }),
|
|
5574
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native20.View, { style: [styles14.teamBadge, { backgroundColor: color }], children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native20.Text, { style: styles14.teamBadgeText, children: "Selected" }) })
|
|
5575
|
+
]
|
|
5576
|
+
}
|
|
5577
|
+
);
|
|
5578
|
+
}
|
|
5579
|
+
var styles14 = import_react_native20.StyleSheet.create({
|
|
5580
|
+
teamOption: {
|
|
5581
|
+
flex: 1,
|
|
5582
|
+
borderWidth: 2,
|
|
5583
|
+
borderRadius: 16,
|
|
5584
|
+
padding: 16,
|
|
5585
|
+
alignItems: "center",
|
|
5586
|
+
gap: 8
|
|
5587
|
+
},
|
|
5588
|
+
teamLogo: {
|
|
5589
|
+
width: 48,
|
|
5590
|
+
height: 48,
|
|
5591
|
+
borderRadius: 24
|
|
5592
|
+
},
|
|
5593
|
+
teamLogoPlaceholder: {
|
|
5594
|
+
backgroundColor: "rgba(128,128,128,0.2)"
|
|
5595
|
+
},
|
|
5596
|
+
teamName: {
|
|
5597
|
+
fontSize: 15,
|
|
5598
|
+
fontWeight: "700"
|
|
5599
|
+
},
|
|
5600
|
+
teamOdds: {
|
|
5601
|
+
fontSize: 20,
|
|
5602
|
+
fontWeight: "800"
|
|
5603
|
+
},
|
|
5604
|
+
teamBets: {
|
|
5605
|
+
fontSize: 12
|
|
5606
|
+
},
|
|
5607
|
+
teamBadge: {
|
|
5608
|
+
borderRadius: 8,
|
|
5609
|
+
paddingHorizontal: 12,
|
|
5610
|
+
paddingVertical: 4,
|
|
5611
|
+
marginTop: 4
|
|
5612
|
+
},
|
|
5613
|
+
teamBadgeText: {
|
|
5614
|
+
color: "#FFF",
|
|
5615
|
+
fontSize: 12,
|
|
5616
|
+
fontWeight: "700"
|
|
5617
|
+
}
|
|
5618
|
+
});
|
|
5619
|
+
|
|
5620
|
+
// src/ui/game/JoinGameSheet.tsx
|
|
5621
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
5539
5622
|
var STATUS_LABELS3 = {
|
|
5540
5623
|
building: "Building transaction...",
|
|
5541
5624
|
signing: "Approve in wallet...",
|
|
@@ -5570,20 +5653,20 @@ function JoinGameSheet({
|
|
|
5570
5653
|
const { wallet } = useDubs();
|
|
5571
5654
|
const mutation = useJoinGame();
|
|
5572
5655
|
const isCustomGame = game.gameMode === CUSTOM_GAME_MODE;
|
|
5573
|
-
const [selectedTeam, setSelectedTeam] = (0,
|
|
5574
|
-
const [wager, setWager] = (0,
|
|
5575
|
-
const [showSuccess, setShowSuccess] = (0,
|
|
5576
|
-
const overlayOpacity = (0,
|
|
5577
|
-
const successScale = (0,
|
|
5578
|
-
const successOpacity = (0,
|
|
5579
|
-
(0,
|
|
5580
|
-
|
|
5656
|
+
const [selectedTeam, setSelectedTeam] = (0, import_react35.useState)(null);
|
|
5657
|
+
const [wager, setWager] = (0, import_react35.useState)(game.buyIn);
|
|
5658
|
+
const [showSuccess, setShowSuccess] = (0, import_react35.useState)(false);
|
|
5659
|
+
const overlayOpacity = (0, import_react35.useRef)(new import_react_native21.Animated.Value(0)).current;
|
|
5660
|
+
const successScale = (0, import_react35.useRef)(new import_react_native21.Animated.Value(0)).current;
|
|
5661
|
+
const successOpacity = (0, import_react35.useRef)(new import_react_native21.Animated.Value(0)).current;
|
|
5662
|
+
(0, import_react35.useEffect)(() => {
|
|
5663
|
+
import_react_native21.Animated.timing(overlayOpacity, {
|
|
5581
5664
|
toValue: visible ? 1 : 0,
|
|
5582
5665
|
duration: 250,
|
|
5583
5666
|
useNativeDriver: true
|
|
5584
5667
|
}).start();
|
|
5585
5668
|
}, [visible, overlayOpacity]);
|
|
5586
|
-
(0,
|
|
5669
|
+
(0, import_react35.useEffect)(() => {
|
|
5587
5670
|
if (visible) {
|
|
5588
5671
|
setSelectedTeam(isPoolModeEnabled ? "home" : isCustomGame ? "away" : null);
|
|
5589
5672
|
setWager(game.buyIn);
|
|
@@ -5593,24 +5676,24 @@ function JoinGameSheet({
|
|
|
5593
5676
|
mutation.reset();
|
|
5594
5677
|
}
|
|
5595
5678
|
}, [visible]);
|
|
5596
|
-
(0,
|
|
5679
|
+
(0, import_react35.useEffect)(() => {
|
|
5597
5680
|
if (mutation.status === "success" && mutation.data) {
|
|
5598
5681
|
setShowSuccess(true);
|
|
5599
5682
|
onSuccess?.(mutation.data);
|
|
5600
5683
|
onJoinSuccess?.(mutation.data);
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5684
|
+
import_react_native21.Animated.parallel([
|
|
5685
|
+
import_react_native21.Animated.spring(successScale, { toValue: 1, friction: 4, tension: 80, useNativeDriver: true }),
|
|
5686
|
+
import_react_native21.Animated.timing(successOpacity, { toValue: 1, duration: 300, useNativeDriver: true })
|
|
5604
5687
|
]).start();
|
|
5605
5688
|
const timer = setTimeout(() => {
|
|
5606
|
-
|
|
5689
|
+
import_react_native21.Animated.timing(successOpacity, { toValue: 0, duration: 300, useNativeDriver: true }).start(() => {
|
|
5607
5690
|
onDismiss();
|
|
5608
5691
|
});
|
|
5609
5692
|
}, 2500);
|
|
5610
5693
|
return () => clearTimeout(timer);
|
|
5611
5694
|
}
|
|
5612
5695
|
}, [mutation.status, mutation.data]);
|
|
5613
|
-
(0,
|
|
5696
|
+
(0, import_react35.useEffect)(() => {
|
|
5614
5697
|
if (mutation.status === "error" && mutation.error) {
|
|
5615
5698
|
onError?.(mutation.error);
|
|
5616
5699
|
}
|
|
@@ -5622,7 +5705,7 @@ function JoinGameSheet({
|
|
|
5622
5705
|
const awayPool = game.awayPool || 0;
|
|
5623
5706
|
const buyIn = game.buyIn;
|
|
5624
5707
|
const poolAfterJoin = totalPool + wager;
|
|
5625
|
-
const { homeOdds, awayOdds, homeBets, awayBets } = (0,
|
|
5708
|
+
const { homeOdds, awayOdds, homeBets, awayBets } = (0, import_react35.useMemo)(() => {
|
|
5626
5709
|
const newPool = totalPool + wager;
|
|
5627
5710
|
return {
|
|
5628
5711
|
homeOdds: homePool > 0 ? (newPool / (homePool + (selectedTeam === "home" ? wager : 0))).toFixed(2) : "\u2014",
|
|
@@ -5635,7 +5718,7 @@ function JoinGameSheet({
|
|
|
5635
5718
|
const potentialWinnings = selectedOdds !== "\u2014" ? formatSol(parseFloat(selectedOdds) * wager) : "\u2014";
|
|
5636
5719
|
const homeName = shortName ? shortName(opponents[0]?.name) : opponents[0]?.name || "Home";
|
|
5637
5720
|
const awayName = shortName ? shortName(opponents[1]?.name) : opponents[1]?.name || "Away";
|
|
5638
|
-
const myBet = (0,
|
|
5721
|
+
const myBet = (0, import_react35.useMemo)(() => {
|
|
5639
5722
|
if (!wallet.publicKey) return null;
|
|
5640
5723
|
const addr = wallet.publicKey.toBase58();
|
|
5641
5724
|
return bettors.find((b) => b.wallet === addr) ?? null;
|
|
@@ -5643,7 +5726,7 @@ function JoinGameSheet({
|
|
|
5643
5726
|
const alreadyJoined = myBet !== null;
|
|
5644
5727
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
5645
5728
|
const canJoin = selectedTeam !== null && !isMutating && mutation.status !== "success" && !alreadyJoined;
|
|
5646
|
-
const handleJoin = (0,
|
|
5729
|
+
const handleJoin = (0, import_react35.useCallback)(async () => {
|
|
5647
5730
|
if (!selectedTeam || !wallet.publicKey) return;
|
|
5648
5731
|
try {
|
|
5649
5732
|
await mutation.execute({
|
|
@@ -5656,57 +5739,57 @@ function JoinGameSheet({
|
|
|
5656
5739
|
}
|
|
5657
5740
|
}, [selectedTeam, wallet.publicKey, mutation.execute, game.gameId, wager]);
|
|
5658
5741
|
const statusLabel = STATUS_LABELS3[mutation.status] || "";
|
|
5659
|
-
return /* @__PURE__ */ (0,
|
|
5660
|
-
|
|
5742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
5743
|
+
import_react_native21.Modal,
|
|
5661
5744
|
{
|
|
5662
5745
|
visible,
|
|
5663
5746
|
animationType: "slide",
|
|
5664
5747
|
transparent: true,
|
|
5665
5748
|
onRequestClose: onDismiss,
|
|
5666
5749
|
children: [
|
|
5667
|
-
/* @__PURE__ */ (0,
|
|
5668
|
-
showSuccess && /* @__PURE__ */ (0,
|
|
5669
|
-
/* @__PURE__ */ (0,
|
|
5670
|
-
/* @__PURE__ */ (0,
|
|
5671
|
-
/* @__PURE__ */ (0,
|
|
5750
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Animated.View, { style: [styles15.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.TouchableOpacity, { style: styles15.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
5751
|
+
showSuccess && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.View, { style: styles15.successOverlay, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.Animated.View, { style: [styles15.successContent, { opacity: successOpacity, transform: [{ scale: successScale }] }], children: [
|
|
5752
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: styles15.successEmoji, children: "\u{1F389}" }),
|
|
5753
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: styles15.successTitle, children: "You're in!" }),
|
|
5754
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.Text, { style: styles15.successSub, children: [
|
|
5672
5755
|
formatSol(wager),
|
|
5673
5756
|
" SOL on ",
|
|
5674
5757
|
selectedTeam === "home" ? homeName : awayName
|
|
5675
5758
|
] })
|
|
5676
5759
|
] }) }),
|
|
5677
|
-
/* @__PURE__ */ (0,
|
|
5678
|
-
|
|
5760
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5761
|
+
import_react_native21.KeyboardAvoidingView,
|
|
5679
5762
|
{
|
|
5680
|
-
style:
|
|
5681
|
-
behavior:
|
|
5682
|
-
children: /* @__PURE__ */ (0,
|
|
5683
|
-
/* @__PURE__ */ (0,
|
|
5684
|
-
/* @__PURE__ */ (0,
|
|
5685
|
-
/* @__PURE__ */ (0,
|
|
5686
|
-
/* @__PURE__ */ (0,
|
|
5763
|
+
style: styles15.keyboardView,
|
|
5764
|
+
behavior: import_react_native21.Platform.OS === "ios" ? "padding" : void 0,
|
|
5765
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.View, { style: styles15.sheetPositioner, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: [styles15.sheet, { backgroundColor: t.background }], children: [
|
|
5766
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.View, { style: styles15.handleRow, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.View, { style: [styles15.handle, { backgroundColor: t.textMuted }] }) }),
|
|
5767
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: styles15.header, children: [
|
|
5768
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.headerTitle, { color: t.text }], children: isPoolModeEnabled ? "Join Pool" : "Join Game" }),
|
|
5769
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.TouchableOpacity, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
5687
5770
|
] }),
|
|
5688
|
-
bettors.length > 0 && /* @__PURE__ */ (0,
|
|
5689
|
-
/* @__PURE__ */ (0,
|
|
5771
|
+
bettors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: styles15.bettorsSection, children: [
|
|
5772
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.Text, { style: [styles15.bettorsLabel, { color: t.textMuted }], children: [
|
|
5690
5773
|
bettors.length,
|
|
5691
5774
|
" ",
|
|
5692
5775
|
bettors.length === 1 ? "player" : "players",
|
|
5693
5776
|
" in this game"
|
|
5694
5777
|
] }),
|
|
5695
|
-
/* @__PURE__ */ (0,
|
|
5778
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: styles15.bettorsRow, children: [
|
|
5696
5779
|
bettors.slice(0, 6).map((b, i) => {
|
|
5697
5780
|
const pngUrl = toPng(b.avatar);
|
|
5698
|
-
return /* @__PURE__ */ (0,
|
|
5781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.View, { style: [styles15.bettorCircle, { backgroundColor: ["#EF4444", "#3B82F6", "#22C55E", "#F59E0B", "#A855F7", "#EC4899"][i % 6] }], children: pngUrl ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Image, { source: { uri: pngUrl }, style: styles15.bettorImg }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: styles15.bettorInitial, children: (b.username ?? b.wallet).charAt(0).toUpperCase() }) }, b.wallet);
|
|
5699
5782
|
}),
|
|
5700
|
-
bettors.length > 6 && /* @__PURE__ */ (0,
|
|
5783
|
+
bettors.length > 6 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.View, { style: [styles15.bettorCircle, { backgroundColor: "#2C2C2E" }], children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.Text, { style: styles15.bettorOverflow, children: [
|
|
5701
5784
|
"+",
|
|
5702
5785
|
bettors.length - 6
|
|
5703
5786
|
] }) })
|
|
5704
5787
|
] })
|
|
5705
5788
|
] }),
|
|
5706
|
-
!isCustomGame && !isPoolModeEnabled && !alreadyJoined && /* @__PURE__ */ (0,
|
|
5707
|
-
/* @__PURE__ */ (0,
|
|
5708
|
-
/* @__PURE__ */ (0,
|
|
5709
|
-
/* @__PURE__ */ (0,
|
|
5789
|
+
!isCustomGame && !isPoolModeEnabled && !alreadyJoined && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: styles15.section, children: [
|
|
5790
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.sectionLabel, { color: t.textSecondary }], children: "Pick Your Side" }),
|
|
5791
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: styles15.teamsRow, children: [
|
|
5792
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5710
5793
|
TeamButton,
|
|
5711
5794
|
{
|
|
5712
5795
|
name: homeName,
|
|
@@ -5723,7 +5806,7 @@ function JoinGameSheet({
|
|
|
5723
5806
|
t
|
|
5724
5807
|
}
|
|
5725
5808
|
),
|
|
5726
|
-
/* @__PURE__ */ (0,
|
|
5809
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5727
5810
|
TeamButton,
|
|
5728
5811
|
{
|
|
5729
5812
|
name: awayName,
|
|
@@ -5742,52 +5825,52 @@ function JoinGameSheet({
|
|
|
5742
5825
|
)
|
|
5743
5826
|
] })
|
|
5744
5827
|
] }),
|
|
5745
|
-
alreadyJoined && myBet && /* @__PURE__ */ (0,
|
|
5746
|
-
/* @__PURE__ */ (0,
|
|
5747
|
-
/* @__PURE__ */ (0,
|
|
5748
|
-
/* @__PURE__ */ (0,
|
|
5828
|
+
alreadyJoined && myBet && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: [styles15.myBetCard, { backgroundColor: (myBet.team === "home" ? homeColor : awayColor) + "15", borderColor: myBet.team === "home" ? homeColor : awayColor }], children: [
|
|
5829
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.myBetLabel, { color: myBet.team === "home" ? homeColor : awayColor }], children: "YOUR BET" }),
|
|
5830
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.myBetTeam, { color: t.text }], children: myBet.team === "home" ? homeName : awayName }),
|
|
5831
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.Text, { style: [styles15.myBetAmount, { color: t.textMuted }], children: [
|
|
5749
5832
|
formatSol(myBet.amount),
|
|
5750
5833
|
" SOL"
|
|
5751
5834
|
] })
|
|
5752
5835
|
] }),
|
|
5753
|
-
/* @__PURE__ */ (0,
|
|
5754
|
-
/* @__PURE__ */ (0,
|
|
5755
|
-
/* @__PURE__ */ (0,
|
|
5756
|
-
/* @__PURE__ */ (0,
|
|
5836
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: [styles15.summaryCard, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
5837
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: styles15.summaryRow, children: [
|
|
5838
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.summaryLabel, { color: t.textMuted }], children: "Your wager" }),
|
|
5839
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.Text, { style: [styles15.summaryValue, { color: t.text }], children: [
|
|
5757
5840
|
formatSol(wager),
|
|
5758
5841
|
" SOL"
|
|
5759
5842
|
] })
|
|
5760
5843
|
] }),
|
|
5761
|
-
/* @__PURE__ */ (0,
|
|
5762
|
-
isPoolModeEnabled ? /* @__PURE__ */ (0,
|
|
5763
|
-
/* @__PURE__ */ (0,
|
|
5764
|
-
/* @__PURE__ */ (0,
|
|
5765
|
-
/* @__PURE__ */ (0,
|
|
5844
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.View, { style: [styles15.summarySep, { backgroundColor: t.border }] }),
|
|
5845
|
+
isPoolModeEnabled ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
5846
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: styles15.summaryRow, children: [
|
|
5847
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.summaryLabel, { color: t.textMuted }], children: "Players in" }),
|
|
5848
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.summaryValue, { color: t.text }], children: bettors.length })
|
|
5766
5849
|
] }),
|
|
5767
|
-
/* @__PURE__ */ (0,
|
|
5768
|
-
/* @__PURE__ */ (0,
|
|
5769
|
-
/* @__PURE__ */ (0,
|
|
5770
|
-
/* @__PURE__ */ (0,
|
|
5850
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.View, { style: [styles15.summarySep, { backgroundColor: t.border }] }),
|
|
5851
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: styles15.summaryRow, children: [
|
|
5852
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.summaryLabel, { color: t.textMuted }], children: "Current pot" }),
|
|
5853
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.Text, { style: [styles15.summaryValue, { color: t.success }], children: [
|
|
5771
5854
|
formatSol(totalPool),
|
|
5772
5855
|
" SOL"
|
|
5773
5856
|
] })
|
|
5774
5857
|
] })
|
|
5775
|
-
] }) : /* @__PURE__ */ (0,
|
|
5776
|
-
/* @__PURE__ */ (0,
|
|
5777
|
-
/* @__PURE__ */ (0,
|
|
5778
|
-
/* @__PURE__ */ (0,
|
|
5858
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
5859
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: styles15.summaryRow, children: [
|
|
5860
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.summaryLabel, { color: t.textMuted }], children: "Total pool" }),
|
|
5861
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.Text, { style: [styles15.summaryValue, { color: t.text }], children: [
|
|
5779
5862
|
formatSol(poolAfterJoin),
|
|
5780
5863
|
" SOL"
|
|
5781
5864
|
] })
|
|
5782
5865
|
] }),
|
|
5783
|
-
/* @__PURE__ */ (0,
|
|
5784
|
-
/* @__PURE__ */ (0,
|
|
5785
|
-
/* @__PURE__ */ (0,
|
|
5786
|
-
/* @__PURE__ */ (0,
|
|
5866
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.View, { style: [styles15.summarySep, { backgroundColor: t.border }] }),
|
|
5867
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: styles15.summaryRow, children: [
|
|
5868
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.summaryLabel, { color: t.textMuted }], children: "Potential winnings" }),
|
|
5869
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.summaryValue, { color: t.success }], children: potentialWinnings !== "\u2014" ? `${potentialWinnings} SOL` : "\u2014" })
|
|
5787
5870
|
] })
|
|
5788
5871
|
] })
|
|
5789
5872
|
] }),
|
|
5790
|
-
selectedTeam && !isPoolModeEnabled && !alreadyJoined && /* @__PURE__ */ (0,
|
|
5873
|
+
selectedTeam && !isPoolModeEnabled && !alreadyJoined && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5791
5874
|
SolSlider,
|
|
5792
5875
|
{
|
|
5793
5876
|
value: wager,
|
|
@@ -5799,22 +5882,22 @@ function JoinGameSheet({
|
|
|
5799
5882
|
onTick: onSliderTick
|
|
5800
5883
|
}
|
|
5801
5884
|
),
|
|
5802
|
-
alreadyJoined && /* @__PURE__ */ (0,
|
|
5803
|
-
mutation.error && /* @__PURE__ */ (0,
|
|
5804
|
-
/* @__PURE__ */ (0,
|
|
5805
|
-
|
|
5885
|
+
alreadyJoined && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.View, { style: [styles15.errorBox, { backgroundColor: t.surface, borderColor: t.border }], children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.errorText, { color: t.textMuted }], children: isPoolModeEnabled ? "You've already joined this pool." : "You've already joined this game." }) }),
|
|
5886
|
+
mutation.error && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.View, { style: [styles15.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.errorText, { color: t.errorText }], children: mutation.error.message }) }),
|
|
5887
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
5888
|
+
import_react_native21.TouchableOpacity,
|
|
5806
5889
|
{
|
|
5807
5890
|
style: [
|
|
5808
|
-
|
|
5891
|
+
styles15.ctaButton,
|
|
5809
5892
|
{ backgroundColor: canJoin ? t.accent : t.border }
|
|
5810
5893
|
],
|
|
5811
5894
|
disabled: !canJoin,
|
|
5812
5895
|
onPress: handleJoin,
|
|
5813
5896
|
activeOpacity: 0.8,
|
|
5814
|
-
children: isMutating ? /* @__PURE__ */ (0,
|
|
5815
|
-
/* @__PURE__ */ (0,
|
|
5816
|
-
/* @__PURE__ */ (0,
|
|
5817
|
-
] }) : mutation.status === "success" ? /* @__PURE__ */ (0,
|
|
5897
|
+
children: isMutating ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native21.View, { style: styles15.ctaLoading, children: [
|
|
5898
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.ActivityIndicator, { size: "small", color: "#FFFFFF" }),
|
|
5899
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: styles15.ctaText, children: statusLabel })
|
|
5900
|
+
] }) : mutation.status === "success" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: styles15.ctaText, children: isPoolModeEnabled ? "Joined!" : STATUS_LABELS3.success }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native21.Text, { style: [styles15.ctaText, !canJoin && { opacity: 0.5 }], children: alreadyJoined ? "Already Joined" : isPoolModeEnabled ? `Join Pool \u2014 ${formatSol(wager)} SOL` : selectedTeam ? `Join Game \u2014 ${formatSol(wager)} SOL` : "Pick a side to join" })
|
|
5818
5901
|
}
|
|
5819
5902
|
)
|
|
5820
5903
|
] }) })
|
|
@@ -5824,46 +5907,9 @@ function JoinGameSheet({
|
|
|
5824
5907
|
}
|
|
5825
5908
|
);
|
|
5826
5909
|
}
|
|
5827
|
-
|
|
5828
|
-
name,
|
|
5829
|
-
imageUrl,
|
|
5830
|
-
odds,
|
|
5831
|
-
bets,
|
|
5832
|
-
color,
|
|
5833
|
-
selected,
|
|
5834
|
-
onPress,
|
|
5835
|
-
ImageComponent,
|
|
5836
|
-
t
|
|
5837
|
-
}) {
|
|
5838
|
-
const [imgFailed, setImgFailed] = (0, import_react34.useState)(false);
|
|
5839
|
-
const Img = ImageComponent || require("react-native").Image;
|
|
5840
|
-
const showImage = imageUrl && !imgFailed;
|
|
5841
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
5842
|
-
import_react_native20.TouchableOpacity,
|
|
5843
|
-
{
|
|
5844
|
-
style: [styles14.teamOption, { borderColor: selected ? color : t.border, backgroundColor: selected ? color + "15" : t.background }],
|
|
5845
|
-
onPress,
|
|
5846
|
-
activeOpacity: 0.7,
|
|
5847
|
-
children: [
|
|
5848
|
-
showImage ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Img, { source: { uri: imageUrl }, style: styles14.teamLogo, resizeMode: "contain", onError: () => setImgFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native20.View, { style: [styles14.teamLogo, styles14.teamLogoPlaceholder] }),
|
|
5849
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native20.Text, { style: [styles14.teamName, { color: t.text }], numberOfLines: 1, children: name }),
|
|
5850
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native20.Text, { style: [styles14.teamOdds, { color }], children: [
|
|
5851
|
-
odds,
|
|
5852
|
-
"x"
|
|
5853
|
-
] }),
|
|
5854
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native20.Text, { style: [styles14.teamBets, { color: t.textMuted }], children: [
|
|
5855
|
-
bets,
|
|
5856
|
-
" ",
|
|
5857
|
-
bets === 1 ? "bet" : "bets"
|
|
5858
|
-
] }),
|
|
5859
|
-
selected && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native20.View, { style: [styles14.teamBadge, { backgroundColor: color }], children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native20.Text, { style: styles14.teamBadgeText, children: "Selected" }) })
|
|
5860
|
-
]
|
|
5861
|
-
}
|
|
5862
|
-
);
|
|
5863
|
-
}
|
|
5864
|
-
var styles14 = import_react_native20.StyleSheet.create({
|
|
5910
|
+
var styles15 = import_react_native21.StyleSheet.create({
|
|
5865
5911
|
overlay: {
|
|
5866
|
-
...
|
|
5912
|
+
...import_react_native21.StyleSheet.absoluteFillObject,
|
|
5867
5913
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
5868
5914
|
},
|
|
5869
5915
|
overlayTap: {
|
|
@@ -5946,7 +5992,7 @@ var styles14 = import_react_native20.StyleSheet.create({
|
|
|
5946
5992
|
},
|
|
5947
5993
|
// Success overlay
|
|
5948
5994
|
successOverlay: {
|
|
5949
|
-
...
|
|
5995
|
+
...import_react_native21.StyleSheet.absoluteFillObject,
|
|
5950
5996
|
zIndex: 100,
|
|
5951
5997
|
alignItems: "center",
|
|
5952
5998
|
justifyContent: "center",
|
|
@@ -6051,52 +6097,13 @@ var styles14 = import_react_native20.StyleSheet.create({
|
|
|
6051
6097
|
flexDirection: "row",
|
|
6052
6098
|
alignItems: "center",
|
|
6053
6099
|
gap: 10
|
|
6054
|
-
},
|
|
6055
|
-
// Team button styles
|
|
6056
|
-
teamOption: {
|
|
6057
|
-
flex: 1,
|
|
6058
|
-
borderWidth: 2,
|
|
6059
|
-
borderRadius: 16,
|
|
6060
|
-
padding: 16,
|
|
6061
|
-
alignItems: "center",
|
|
6062
|
-
gap: 8
|
|
6063
|
-
},
|
|
6064
|
-
teamLogo: {
|
|
6065
|
-
width: 48,
|
|
6066
|
-
height: 48,
|
|
6067
|
-
borderRadius: 24
|
|
6068
|
-
},
|
|
6069
|
-
teamLogoPlaceholder: {
|
|
6070
|
-
backgroundColor: "rgba(128,128,128,0.2)"
|
|
6071
|
-
},
|
|
6072
|
-
teamName: {
|
|
6073
|
-
fontSize: 15,
|
|
6074
|
-
fontWeight: "700"
|
|
6075
|
-
},
|
|
6076
|
-
teamOdds: {
|
|
6077
|
-
fontSize: 20,
|
|
6078
|
-
fontWeight: "800"
|
|
6079
|
-
},
|
|
6080
|
-
teamBets: {
|
|
6081
|
-
fontSize: 12
|
|
6082
|
-
},
|
|
6083
|
-
teamBadge: {
|
|
6084
|
-
borderRadius: 8,
|
|
6085
|
-
paddingHorizontal: 12,
|
|
6086
|
-
paddingVertical: 4,
|
|
6087
|
-
marginTop: 4
|
|
6088
|
-
},
|
|
6089
|
-
teamBadgeText: {
|
|
6090
|
-
color: "#FFF",
|
|
6091
|
-
fontSize: 12,
|
|
6092
|
-
fontWeight: "700"
|
|
6093
6100
|
}
|
|
6094
6101
|
});
|
|
6095
6102
|
|
|
6096
6103
|
// src/ui/game/ClaimPrizeSheet.tsx
|
|
6097
|
-
var
|
|
6098
|
-
var
|
|
6099
|
-
var
|
|
6104
|
+
var import_react36 = require("react");
|
|
6105
|
+
var import_react_native22 = require("react-native");
|
|
6106
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
6100
6107
|
var STATUS_LABELS4 = {
|
|
6101
6108
|
building: "Building transaction...",
|
|
6102
6109
|
signing: "Approve in wallet...",
|
|
@@ -6115,18 +6122,18 @@ function ClaimPrizeSheet({
|
|
|
6115
6122
|
const t = useDubsTheme();
|
|
6116
6123
|
const { wallet } = useDubs();
|
|
6117
6124
|
const mutation = useClaim();
|
|
6118
|
-
const overlayOpacity = (0,
|
|
6119
|
-
const celebrationScale = (0,
|
|
6120
|
-
const celebrationOpacity = (0,
|
|
6121
|
-
const [showCelebration, setShowCelebration] = (0,
|
|
6122
|
-
(0,
|
|
6123
|
-
|
|
6125
|
+
const overlayOpacity = (0, import_react36.useRef)(new import_react_native22.Animated.Value(0)).current;
|
|
6126
|
+
const celebrationScale = (0, import_react36.useRef)(new import_react_native22.Animated.Value(0)).current;
|
|
6127
|
+
const celebrationOpacity = (0, import_react36.useRef)(new import_react_native22.Animated.Value(0)).current;
|
|
6128
|
+
const [showCelebration, setShowCelebration] = (0, import_react36.useState)(false);
|
|
6129
|
+
(0, import_react36.useEffect)(() => {
|
|
6130
|
+
import_react_native22.Animated.timing(overlayOpacity, {
|
|
6124
6131
|
toValue: visible ? 1 : 0,
|
|
6125
6132
|
duration: 250,
|
|
6126
6133
|
useNativeDriver: true
|
|
6127
6134
|
}).start();
|
|
6128
6135
|
}, [visible, overlayOpacity]);
|
|
6129
|
-
(0,
|
|
6136
|
+
(0, import_react36.useEffect)(() => {
|
|
6130
6137
|
if (visible) {
|
|
6131
6138
|
mutation.reset();
|
|
6132
6139
|
setShowCelebration(false);
|
|
@@ -6134,17 +6141,17 @@ function ClaimPrizeSheet({
|
|
|
6134
6141
|
celebrationOpacity.setValue(0);
|
|
6135
6142
|
}
|
|
6136
6143
|
}, [visible]);
|
|
6137
|
-
(0,
|
|
6144
|
+
(0, import_react36.useEffect)(() => {
|
|
6138
6145
|
if (mutation.status === "success" && mutation.data) {
|
|
6139
6146
|
setShowCelebration(true);
|
|
6140
|
-
|
|
6141
|
-
|
|
6147
|
+
import_react_native22.Animated.parallel([
|
|
6148
|
+
import_react_native22.Animated.spring(celebrationScale, {
|
|
6142
6149
|
toValue: 1,
|
|
6143
6150
|
tension: 50,
|
|
6144
6151
|
friction: 6,
|
|
6145
6152
|
useNativeDriver: true
|
|
6146
6153
|
}),
|
|
6147
|
-
|
|
6154
|
+
import_react_native22.Animated.timing(celebrationOpacity, {
|
|
6148
6155
|
toValue: 1,
|
|
6149
6156
|
duration: 300,
|
|
6150
6157
|
useNativeDriver: true
|
|
@@ -6157,14 +6164,14 @@ function ClaimPrizeSheet({
|
|
|
6157
6164
|
return () => clearTimeout(timer);
|
|
6158
6165
|
}
|
|
6159
6166
|
}, [mutation.status, mutation.data]);
|
|
6160
|
-
(0,
|
|
6167
|
+
(0, import_react36.useEffect)(() => {
|
|
6161
6168
|
if (mutation.status === "error" && mutation.error) {
|
|
6162
6169
|
onError?.(mutation.error);
|
|
6163
6170
|
}
|
|
6164
6171
|
}, [mutation.status, mutation.error]);
|
|
6165
6172
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
6166
6173
|
const canClaim = !isMutating && mutation.status !== "success" && !!wallet.publicKey;
|
|
6167
|
-
const handleClaim = (0,
|
|
6174
|
+
const handleClaim = (0, import_react36.useCallback)(async () => {
|
|
6168
6175
|
if (!wallet.publicKey) return;
|
|
6169
6176
|
try {
|
|
6170
6177
|
await mutation.execute({
|
|
@@ -6176,62 +6183,62 @@ function ClaimPrizeSheet({
|
|
|
6176
6183
|
}
|
|
6177
6184
|
}, [wallet.publicKey, mutation.execute, gameId, prizeAmount]);
|
|
6178
6185
|
const statusLabel = STATUS_LABELS4[mutation.status] || "";
|
|
6179
|
-
return /* @__PURE__ */ (0,
|
|
6180
|
-
|
|
6186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
6187
|
+
import_react_native22.Modal,
|
|
6181
6188
|
{
|
|
6182
6189
|
visible,
|
|
6183
6190
|
animationType: "slide",
|
|
6184
6191
|
transparent: true,
|
|
6185
6192
|
onRequestClose: onDismiss,
|
|
6186
6193
|
children: [
|
|
6187
|
-
/* @__PURE__ */ (0,
|
|
6188
|
-
/* @__PURE__ */ (0,
|
|
6189
|
-
|
|
6194
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native22.Animated.View, { style: [styles16.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native22.TouchableOpacity, { style: styles16.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
6195
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6196
|
+
import_react_native22.KeyboardAvoidingView,
|
|
6190
6197
|
{
|
|
6191
|
-
style:
|
|
6192
|
-
behavior:
|
|
6193
|
-
children: /* @__PURE__ */ (0,
|
|
6194
|
-
/* @__PURE__ */ (0,
|
|
6195
|
-
/* @__PURE__ */ (0,
|
|
6196
|
-
/* @__PURE__ */ (0,
|
|
6197
|
-
/* @__PURE__ */ (0,
|
|
6198
|
+
style: styles16.keyboardView,
|
|
6199
|
+
behavior: import_react_native22.Platform.OS === "ios" ? "padding" : void 0,
|
|
6200
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native22.View, { style: styles16.sheetPositioner, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_native22.View, { style: [styles16.sheet, { backgroundColor: t.background }], children: [
|
|
6201
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native22.View, { style: styles16.handleRow, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native22.View, { style: [styles16.handle, { backgroundColor: t.textMuted }] }) }),
|
|
6202
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_native22.View, { style: styles16.header, children: [
|
|
6203
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native22.Text, { style: [styles16.headerTitle, { color: t.text }], children: showCelebration ? isRefund ? "Refund Claimed!" : "Prize Claimed!" : isRefund ? "Claim Refund" : "Claim Prize" }),
|
|
6204
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native22.TouchableOpacity, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native22.Text, { style: [styles16.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
6198
6205
|
] }),
|
|
6199
|
-
showCelebration && /* @__PURE__ */ (0,
|
|
6200
|
-
|
|
6206
|
+
showCelebration && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
6207
|
+
import_react_native22.Animated.View,
|
|
6201
6208
|
{
|
|
6202
6209
|
style: [
|
|
6203
|
-
|
|
6210
|
+
styles16.celebrationContainer,
|
|
6204
6211
|
{
|
|
6205
6212
|
opacity: celebrationOpacity,
|
|
6206
6213
|
transform: [{ scale: celebrationScale }]
|
|
6207
6214
|
}
|
|
6208
6215
|
],
|
|
6209
6216
|
children: [
|
|
6210
|
-
/* @__PURE__ */ (0,
|
|
6211
|
-
/* @__PURE__ */ (0,
|
|
6217
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native22.Text, { style: styles16.celebrationEmoji, children: "\u{1F3C6}" }),
|
|
6218
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_native22.Text, { style: [styles16.celebrationText, { color: t.success }], children: [
|
|
6212
6219
|
"+",
|
|
6213
6220
|
prizeAmount,
|
|
6214
6221
|
" SOL"
|
|
6215
6222
|
] }),
|
|
6216
|
-
/* @__PURE__ */ (0,
|
|
6223
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native22.Text, { style: [styles16.celebrationSubtext, { color: t.textMuted }], children: isRefund ? "Refund sent to your wallet" : "Winnings sent to your wallet" })
|
|
6217
6224
|
]
|
|
6218
6225
|
}
|
|
6219
6226
|
),
|
|
6220
|
-
!showCelebration && /* @__PURE__ */ (0,
|
|
6221
|
-
/* @__PURE__ */ (0,
|
|
6222
|
-
/* @__PURE__ */ (0,
|
|
6223
|
-
/* @__PURE__ */ (0,
|
|
6227
|
+
!showCelebration && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_native22.View, { style: [styles16.summaryCard, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
6228
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_native22.View, { style: styles16.summaryRow, children: [
|
|
6229
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native22.Text, { style: [styles16.summaryLabel, { color: t.textMuted }], children: isRefund ? "Refund" : "Prize" }),
|
|
6230
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_native22.Text, { style: [styles16.summaryValue, { color: t.success }], children: [
|
|
6224
6231
|
prizeAmount,
|
|
6225
6232
|
" SOL"
|
|
6226
6233
|
] })
|
|
6227
6234
|
] }),
|
|
6228
|
-
/* @__PURE__ */ (0,
|
|
6229
|
-
/* @__PURE__ */ (0,
|
|
6230
|
-
/* @__PURE__ */ (0,
|
|
6231
|
-
/* @__PURE__ */ (0,
|
|
6232
|
-
|
|
6235
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native22.View, { style: [styles16.summarySep, { backgroundColor: t.border }] }),
|
|
6236
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_native22.View, { style: styles16.summaryRow, children: [
|
|
6237
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native22.Text, { style: [styles16.summaryLabel, { color: t.textMuted }], children: "Game" }),
|
|
6238
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
6239
|
+
import_react_native22.Text,
|
|
6233
6240
|
{
|
|
6234
|
-
style: [
|
|
6241
|
+
style: [styles16.summaryValue, { color: t.text }],
|
|
6235
6242
|
numberOfLines: 1,
|
|
6236
6243
|
children: [
|
|
6237
6244
|
gameId.slice(0, 8),
|
|
@@ -6242,21 +6249,21 @@ function ClaimPrizeSheet({
|
|
|
6242
6249
|
)
|
|
6243
6250
|
] })
|
|
6244
6251
|
] }),
|
|
6245
|
-
mutation.error && /* @__PURE__ */ (0,
|
|
6246
|
-
!showCelebration && /* @__PURE__ */ (0,
|
|
6247
|
-
|
|
6252
|
+
mutation.error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native22.View, { style: [styles16.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native22.Text, { style: [styles16.errorText, { color: t.errorText }], children: mutation.error.message }) }),
|
|
6253
|
+
!showCelebration && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
6254
|
+
import_react_native22.TouchableOpacity,
|
|
6248
6255
|
{
|
|
6249
6256
|
style: [
|
|
6250
|
-
|
|
6257
|
+
styles16.ctaButton,
|
|
6251
6258
|
{ backgroundColor: canClaim ? t.accent : t.border }
|
|
6252
6259
|
],
|
|
6253
6260
|
disabled: !canClaim,
|
|
6254
6261
|
onPress: handleClaim,
|
|
6255
6262
|
activeOpacity: 0.8,
|
|
6256
|
-
children: isMutating ? /* @__PURE__ */ (0,
|
|
6257
|
-
/* @__PURE__ */ (0,
|
|
6258
|
-
/* @__PURE__ */ (0,
|
|
6259
|
-
] }) : /* @__PURE__ */ (0,
|
|
6263
|
+
children: isMutating ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_native22.View, { style: styles16.ctaLoading, children: [
|
|
6264
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native22.ActivityIndicator, { size: "small", color: "#FFFFFF" }),
|
|
6265
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native22.Text, { style: styles16.ctaText, children: statusLabel })
|
|
6266
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_native22.Text, { style: [styles16.ctaText, !canClaim && { opacity: 0.5 }], children: [
|
|
6260
6267
|
isRefund ? "Claim Refund" : "Claim Prize",
|
|
6261
6268
|
" \u2014 ",
|
|
6262
6269
|
prizeAmount,
|
|
@@ -6264,7 +6271,7 @@ function ClaimPrizeSheet({
|
|
|
6264
6271
|
] })
|
|
6265
6272
|
}
|
|
6266
6273
|
),
|
|
6267
|
-
mutation.data?.explorerUrl && /* @__PURE__ */ (0,
|
|
6274
|
+
mutation.data?.explorerUrl && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native22.Text, { style: [styles16.explorerHint, { color: t.textMuted }], children: "View on Solscan" })
|
|
6268
6275
|
] }) })
|
|
6269
6276
|
}
|
|
6270
6277
|
)
|
|
@@ -6272,9 +6279,9 @@ function ClaimPrizeSheet({
|
|
|
6272
6279
|
}
|
|
6273
6280
|
);
|
|
6274
6281
|
}
|
|
6275
|
-
var
|
|
6282
|
+
var styles16 = import_react_native22.StyleSheet.create({
|
|
6276
6283
|
overlay: {
|
|
6277
|
-
...
|
|
6284
|
+
...import_react_native22.StyleSheet.absoluteFillObject,
|
|
6278
6285
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
6279
6286
|
},
|
|
6280
6287
|
overlayTap: {
|
|
@@ -6397,17 +6404,17 @@ var styles15 = import_react_native21.StyleSheet.create({
|
|
|
6397
6404
|
});
|
|
6398
6405
|
|
|
6399
6406
|
// src/ui/game/ClaimButton.tsx
|
|
6400
|
-
var
|
|
6401
|
-
var
|
|
6402
|
-
var
|
|
6407
|
+
var import_react37 = require("react");
|
|
6408
|
+
var import_react_native23 = require("react-native");
|
|
6409
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
6403
6410
|
function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
6404
6411
|
const t = useDubsTheme();
|
|
6405
6412
|
const { wallet } = useDubs();
|
|
6406
6413
|
const game = useGame(gameId);
|
|
6407
6414
|
const claimStatus = useHasClaimed(gameId);
|
|
6408
|
-
const [sheetVisible, setSheetVisible] = (0,
|
|
6415
|
+
const [sheetVisible, setSheetVisible] = (0, import_react37.useState)(false);
|
|
6409
6416
|
const walletAddress = wallet.publicKey?.toBase58() ?? null;
|
|
6410
|
-
const myBet = (0,
|
|
6417
|
+
const myBet = (0, import_react37.useMemo)(() => {
|
|
6411
6418
|
if (!walletAddress || !game.data?.bettors) return null;
|
|
6412
6419
|
return game.data.bettors.find((b) => b.wallet === walletAddress) ?? null;
|
|
6413
6420
|
}, [walletAddress, game.data?.bettors]);
|
|
@@ -6416,7 +6423,7 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
6416
6423
|
const isWinner = isResolved && myBet != null && myBet.team === game.data?.winnerSide;
|
|
6417
6424
|
const isEligible = myBet != null && isResolved && (isWinner || isRefund);
|
|
6418
6425
|
const prizeAmount = isRefund ? myBet?.amount ?? 0 : game.data?.totalPool ?? 0;
|
|
6419
|
-
const handleSuccess = (0,
|
|
6426
|
+
const handleSuccess = (0, import_react37.useCallback)(
|
|
6420
6427
|
(result) => {
|
|
6421
6428
|
claimStatus.refetch();
|
|
6422
6429
|
onSuccess?.(result);
|
|
@@ -6429,13 +6436,13 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
6429
6436
|
}
|
|
6430
6437
|
const label = isRefund ? "Refund" : "Prize";
|
|
6431
6438
|
if (claimStatus.hasClaimed) {
|
|
6432
|
-
return /* @__PURE__ */ (0,
|
|
6433
|
-
|
|
6439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
6440
|
+
import_react_native23.TouchableOpacity,
|
|
6434
6441
|
{
|
|
6435
|
-
style: [
|
|
6442
|
+
style: [styles17.badge, { borderColor: t.accent }, style],
|
|
6436
6443
|
activeOpacity: 1,
|
|
6437
6444
|
disabled: true,
|
|
6438
|
-
children: /* @__PURE__ */ (0,
|
|
6445
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_native23.Text, { style: [styles17.badgeText, { color: t.accent }], children: [
|
|
6439
6446
|
label,
|
|
6440
6447
|
" Claimed!"
|
|
6441
6448
|
] })
|
|
@@ -6445,14 +6452,14 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
6445
6452
|
if (!isEligible) {
|
|
6446
6453
|
return null;
|
|
6447
6454
|
}
|
|
6448
|
-
return /* @__PURE__ */ (0,
|
|
6449
|
-
/* @__PURE__ */ (0,
|
|
6450
|
-
|
|
6455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
6456
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
6457
|
+
import_react_native23.TouchableOpacity,
|
|
6451
6458
|
{
|
|
6452
|
-
style: [
|
|
6459
|
+
style: [styles17.button, { backgroundColor: t.accent }, style],
|
|
6453
6460
|
activeOpacity: 0.8,
|
|
6454
6461
|
onPress: () => setSheetVisible(true),
|
|
6455
|
-
children: /* @__PURE__ */ (0,
|
|
6462
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_native23.Text, { style: styles17.buttonText, children: [
|
|
6456
6463
|
"Claim ",
|
|
6457
6464
|
label,
|
|
6458
6465
|
" \u2014 ",
|
|
@@ -6461,7 +6468,7 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
6461
6468
|
] })
|
|
6462
6469
|
}
|
|
6463
6470
|
),
|
|
6464
|
-
/* @__PURE__ */ (0,
|
|
6471
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
6465
6472
|
ClaimPrizeSheet,
|
|
6466
6473
|
{
|
|
6467
6474
|
visible: sheetVisible,
|
|
@@ -6475,7 +6482,7 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
6475
6482
|
)
|
|
6476
6483
|
] });
|
|
6477
6484
|
}
|
|
6478
|
-
var
|
|
6485
|
+
var styles17 = import_react_native23.StyleSheet.create({
|
|
6479
6486
|
button: {
|
|
6480
6487
|
height: 52,
|
|
6481
6488
|
borderRadius: 14,
|
|
@@ -6503,9 +6510,9 @@ var styles16 = import_react_native22.StyleSheet.create({
|
|
|
6503
6510
|
});
|
|
6504
6511
|
|
|
6505
6512
|
// src/ui/game/EnterArcadePoolSheet.tsx
|
|
6506
|
-
var
|
|
6507
|
-
var
|
|
6508
|
-
var
|
|
6513
|
+
var import_react38 = require("react");
|
|
6514
|
+
var import_react_native24 = require("react-native");
|
|
6515
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
6509
6516
|
var STATUS_LABELS5 = {
|
|
6510
6517
|
building: "Building transaction...",
|
|
6511
6518
|
signing: "Approve in wallet...",
|
|
@@ -6524,20 +6531,20 @@ function EnterArcadePoolSheet({
|
|
|
6524
6531
|
const t = useDubsTheme();
|
|
6525
6532
|
const { wallet } = useDubs();
|
|
6526
6533
|
const mutation = useEnterArcadePool();
|
|
6527
|
-
const overlayOpacity = (0,
|
|
6528
|
-
(0,
|
|
6529
|
-
|
|
6534
|
+
const overlayOpacity = (0, import_react38.useRef)(new import_react_native24.Animated.Value(0)).current;
|
|
6535
|
+
(0, import_react38.useEffect)(() => {
|
|
6536
|
+
import_react_native24.Animated.timing(overlayOpacity, {
|
|
6530
6537
|
toValue: visible ? 1 : 0,
|
|
6531
6538
|
duration: 250,
|
|
6532
6539
|
useNativeDriver: true
|
|
6533
6540
|
}).start();
|
|
6534
6541
|
}, [visible, overlayOpacity]);
|
|
6535
|
-
(0,
|
|
6542
|
+
(0, import_react38.useEffect)(() => {
|
|
6536
6543
|
if (visible) {
|
|
6537
6544
|
mutation.reset();
|
|
6538
6545
|
}
|
|
6539
6546
|
}, [visible]);
|
|
6540
|
-
(0,
|
|
6547
|
+
(0, import_react38.useEffect)(() => {
|
|
6541
6548
|
if (mutation.status === "success" && mutation.data) {
|
|
6542
6549
|
onSuccess?.(mutation.data);
|
|
6543
6550
|
const timer = setTimeout(() => {
|
|
@@ -6546,7 +6553,7 @@ function EnterArcadePoolSheet({
|
|
|
6546
6553
|
return () => clearTimeout(timer);
|
|
6547
6554
|
}
|
|
6548
6555
|
}, [mutation.status, mutation.data]);
|
|
6549
|
-
(0,
|
|
6556
|
+
(0, import_react38.useEffect)(() => {
|
|
6550
6557
|
if (mutation.status === "error" && mutation.error) {
|
|
6551
6558
|
onError?.(mutation.error);
|
|
6552
6559
|
}
|
|
@@ -6558,7 +6565,7 @@ function EnterArcadePoolSheet({
|
|
|
6558
6565
|
const potSol = (pool.buy_in_lamports * Number(totalBuyIns) / 1e9).toFixed(4);
|
|
6559
6566
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
6560
6567
|
const canJoin = !isMutating && mutation.status !== "success";
|
|
6561
|
-
const handleJoin = (0,
|
|
6568
|
+
const handleJoin = (0, import_react38.useCallback)(async () => {
|
|
6562
6569
|
if (!wallet.publicKey) return;
|
|
6563
6570
|
try {
|
|
6564
6571
|
await mutation.execute(pool.id);
|
|
@@ -6570,76 +6577,76 @@ function EnterArcadePoolSheet({
|
|
|
6570
6577
|
const headerTitle = isRejoin ? "Play Again" : "Join Pool";
|
|
6571
6578
|
const ctaLabel = isRejoin ? `Play Again \u2014 ${buyInSol} SOL` : `Join Pool \u2014 ${buyInSol} SOL`;
|
|
6572
6579
|
const successLabel = isRejoin ? "Lives refilled!" : "Joined!";
|
|
6573
|
-
return /* @__PURE__ */ (0,
|
|
6574
|
-
|
|
6580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
6581
|
+
import_react_native24.Modal,
|
|
6575
6582
|
{
|
|
6576
6583
|
visible,
|
|
6577
6584
|
animationType: "slide",
|
|
6578
6585
|
transparent: true,
|
|
6579
6586
|
onRequestClose: onDismiss,
|
|
6580
6587
|
children: [
|
|
6581
|
-
/* @__PURE__ */ (0,
|
|
6582
|
-
/* @__PURE__ */ (0,
|
|
6583
|
-
|
|
6588
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.Animated.View, { style: [styles18.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.TouchableOpacity, { style: styles18.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
6589
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
6590
|
+
import_react_native24.KeyboardAvoidingView,
|
|
6584
6591
|
{
|
|
6585
|
-
style:
|
|
6586
|
-
behavior:
|
|
6587
|
-
children: /* @__PURE__ */ (0,
|
|
6588
|
-
/* @__PURE__ */ (0,
|
|
6589
|
-
/* @__PURE__ */ (0,
|
|
6590
|
-
/* @__PURE__ */ (0,
|
|
6591
|
-
/* @__PURE__ */ (0,
|
|
6592
|
+
style: styles18.keyboardView,
|
|
6593
|
+
behavior: import_react_native24.Platform.OS === "ios" ? "padding" : void 0,
|
|
6594
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.View, { style: styles18.sheetPositioner, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_native24.View, { style: [styles18.sheet, { backgroundColor: t.background }], children: [
|
|
6595
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.View, { style: styles18.handleRow, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.View, { style: [styles18.handle, { backgroundColor: t.textMuted }] }) }),
|
|
6596
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_native24.View, { style: styles18.header, children: [
|
|
6597
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.Text, { style: [styles18.headerTitle, { color: t.text }], children: headerTitle }),
|
|
6598
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.TouchableOpacity, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.Text, { style: [styles18.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
6592
6599
|
] }),
|
|
6593
|
-
/* @__PURE__ */ (0,
|
|
6594
|
-
/* @__PURE__ */ (0,
|
|
6595
|
-
/* @__PURE__ */ (0,
|
|
6596
|
-
/* @__PURE__ */ (0,
|
|
6597
|
-
/* @__PURE__ */ (0,
|
|
6600
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.Text, { style: [styles18.poolName, { color: t.textSecondary }], children: pool.name }),
|
|
6601
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_native24.View, { style: [styles18.summaryCard, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
6602
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_native24.View, { style: styles18.summaryRow, children: [
|
|
6603
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.Text, { style: [styles18.summaryLabel, { color: t.textMuted }], children: "Buy-in" }),
|
|
6604
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_native24.Text, { style: [styles18.summaryValue, { color: t.text }], children: [
|
|
6598
6605
|
buyInSol,
|
|
6599
6606
|
" SOL"
|
|
6600
6607
|
] })
|
|
6601
6608
|
] }),
|
|
6602
|
-
/* @__PURE__ */ (0,
|
|
6603
|
-
/* @__PURE__ */ (0,
|
|
6604
|
-
/* @__PURE__ */ (0,
|
|
6605
|
-
/* @__PURE__ */ (0,
|
|
6609
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.View, { style: [styles18.summarySep, { backgroundColor: t.border }] }),
|
|
6610
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_native24.View, { style: styles18.summaryRow, children: [
|
|
6611
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.Text, { style: [styles18.summaryLabel, { color: t.textMuted }], children: "Players in" }),
|
|
6612
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.Text, { style: [styles18.summaryValue, { color: t.text }], children: totalPlayers })
|
|
6606
6613
|
] }),
|
|
6607
|
-
/* @__PURE__ */ (0,
|
|
6608
|
-
/* @__PURE__ */ (0,
|
|
6609
|
-
/* @__PURE__ */ (0,
|
|
6610
|
-
/* @__PURE__ */ (0,
|
|
6614
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.View, { style: [styles18.summarySep, { backgroundColor: t.border }] }),
|
|
6615
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_native24.View, { style: styles18.summaryRow, children: [
|
|
6616
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.Text, { style: [styles18.summaryLabel, { color: t.textMuted }], children: "Current pot" }),
|
|
6617
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_native24.Text, { style: [styles18.summaryValue, { color: t.success }], children: [
|
|
6611
6618
|
potSol,
|
|
6612
6619
|
" SOL"
|
|
6613
6620
|
] })
|
|
6614
6621
|
] }),
|
|
6615
|
-
/* @__PURE__ */ (0,
|
|
6616
|
-
/* @__PURE__ */ (0,
|
|
6617
|
-
/* @__PURE__ */ (0,
|
|
6618
|
-
/* @__PURE__ */ (0,
|
|
6622
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.View, { style: [styles18.summarySep, { backgroundColor: t.border }] }),
|
|
6623
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_native24.View, { style: styles18.summaryRow, children: [
|
|
6624
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.Text, { style: [styles18.summaryLabel, { color: t.textMuted }], children: "Lives" }),
|
|
6625
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.Text, { style: [styles18.summaryValue, { color: t.text }], children: pool.max_lives })
|
|
6619
6626
|
] }),
|
|
6620
|
-
topScore > 0 && /* @__PURE__ */ (0,
|
|
6621
|
-
/* @__PURE__ */ (0,
|
|
6622
|
-
/* @__PURE__ */ (0,
|
|
6623
|
-
/* @__PURE__ */ (0,
|
|
6624
|
-
/* @__PURE__ */ (0,
|
|
6627
|
+
topScore > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
6628
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.View, { style: [styles18.summarySep, { backgroundColor: t.border }] }),
|
|
6629
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_native24.View, { style: styles18.summaryRow, children: [
|
|
6630
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.Text, { style: [styles18.summaryLabel, { color: t.textMuted }], children: "Top score" }),
|
|
6631
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.Text, { style: [styles18.summaryValue, { color: t.text }], children: topScore })
|
|
6625
6632
|
] })
|
|
6626
6633
|
] })
|
|
6627
6634
|
] }),
|
|
6628
|
-
mutation.error && /* @__PURE__ */ (0,
|
|
6629
|
-
/* @__PURE__ */ (0,
|
|
6630
|
-
|
|
6635
|
+
mutation.error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.View, { style: [styles18.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.Text, { style: [styles18.errorText, { color: t.errorText }], children: mutation.error.message }) }),
|
|
6636
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
6637
|
+
import_react_native24.TouchableOpacity,
|
|
6631
6638
|
{
|
|
6632
6639
|
style: [
|
|
6633
|
-
|
|
6640
|
+
styles18.ctaButton,
|
|
6634
6641
|
{ backgroundColor: canJoin ? t.accent : t.border }
|
|
6635
6642
|
],
|
|
6636
6643
|
disabled: !canJoin,
|
|
6637
6644
|
onPress: handleJoin,
|
|
6638
6645
|
activeOpacity: 0.8,
|
|
6639
|
-
children: isMutating ? /* @__PURE__ */ (0,
|
|
6640
|
-
/* @__PURE__ */ (0,
|
|
6641
|
-
/* @__PURE__ */ (0,
|
|
6642
|
-
] }) : mutation.status === "success" ? /* @__PURE__ */ (0,
|
|
6646
|
+
children: isMutating ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_native24.View, { style: styles18.ctaLoading, children: [
|
|
6647
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.ActivityIndicator, { size: "small", color: "#FFFFFF" }),
|
|
6648
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.Text, { style: styles18.ctaText, children: statusLabel })
|
|
6649
|
+
] }) : mutation.status === "success" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.Text, { style: styles18.ctaText, children: successLabel }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native24.Text, { style: [styles18.ctaText, !canJoin && { opacity: 0.5 }], children: ctaLabel })
|
|
6643
6650
|
}
|
|
6644
6651
|
)
|
|
6645
6652
|
] }) })
|
|
@@ -6649,9 +6656,9 @@ function EnterArcadePoolSheet({
|
|
|
6649
6656
|
}
|
|
6650
6657
|
);
|
|
6651
6658
|
}
|
|
6652
|
-
var
|
|
6659
|
+
var styles18 = import_react_native24.StyleSheet.create({
|
|
6653
6660
|
overlay: {
|
|
6654
|
-
...
|
|
6661
|
+
...import_react_native24.StyleSheet.absoluteFillObject,
|
|
6655
6662
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
6656
6663
|
},
|
|
6657
6664
|
overlayTap: { flex: 1 },
|
|
@@ -6709,14 +6716,14 @@ var styles17 = import_react_native23.StyleSheet.create({
|
|
|
6709
6716
|
});
|
|
6710
6717
|
|
|
6711
6718
|
// src/ui/game/ArcadeLeaderboardSheet.tsx
|
|
6712
|
-
var
|
|
6713
|
-
var
|
|
6714
|
-
var
|
|
6719
|
+
var import_react39 = require("react");
|
|
6720
|
+
var import_react_native25 = require("react-native");
|
|
6721
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
6715
6722
|
function RankLabel({ index }) {
|
|
6716
|
-
if (index === 0) return /* @__PURE__ */ (0,
|
|
6717
|
-
if (index === 1) return /* @__PURE__ */ (0,
|
|
6718
|
-
if (index === 2) return /* @__PURE__ */ (0,
|
|
6719
|
-
return /* @__PURE__ */ (0,
|
|
6723
|
+
if (index === 0) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.Text, { style: styles19.rankEmoji, children: "\u{1F947}" });
|
|
6724
|
+
if (index === 1) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.Text, { style: styles19.rankEmoji, children: "\u{1F948}" });
|
|
6725
|
+
if (index === 2) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.Text, { style: styles19.rankEmoji, children: "\u{1F949}" });
|
|
6726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.Text, { style: styles19.rankNum, children: index + 1 });
|
|
6720
6727
|
}
|
|
6721
6728
|
function ArcadeLeaderboardSheet({
|
|
6722
6729
|
visible,
|
|
@@ -6726,92 +6733,92 @@ function ArcadeLeaderboardSheet({
|
|
|
6726
6733
|
}) {
|
|
6727
6734
|
const t = useDubsTheme();
|
|
6728
6735
|
const { pool, leaderboard, stats, loading, refetch } = useArcadePool(poolId);
|
|
6729
|
-
const overlayOpacity = (0,
|
|
6730
|
-
(0,
|
|
6731
|
-
|
|
6736
|
+
const overlayOpacity = (0, import_react39.useRef)(new import_react_native25.Animated.Value(0)).current;
|
|
6737
|
+
(0, import_react39.useEffect)(() => {
|
|
6738
|
+
import_react_native25.Animated.timing(overlayOpacity, {
|
|
6732
6739
|
toValue: visible ? 1 : 0,
|
|
6733
6740
|
duration: 250,
|
|
6734
6741
|
useNativeDriver: true
|
|
6735
6742
|
}).start();
|
|
6736
6743
|
}, [visible, overlayOpacity]);
|
|
6737
|
-
(0,
|
|
6744
|
+
(0, import_react39.useEffect)(() => {
|
|
6738
6745
|
if (visible) refetch();
|
|
6739
6746
|
}, [visible]);
|
|
6740
6747
|
const renderItem = ({ item, index }) => {
|
|
6741
6748
|
const isMe = highlightWallet && item.wallet_address === highlightWallet;
|
|
6742
|
-
return /* @__PURE__ */ (0,
|
|
6743
|
-
|
|
6749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
6750
|
+
import_react_native25.View,
|
|
6744
6751
|
{
|
|
6745
6752
|
style: [
|
|
6746
|
-
|
|
6753
|
+
styles19.row,
|
|
6747
6754
|
{ backgroundColor: isMe ? `${t.accent}18` : index % 2 === 0 ? t.surface : "transparent" },
|
|
6748
6755
|
isMe ? { borderWidth: 1, borderColor: t.accent } : void 0
|
|
6749
6756
|
],
|
|
6750
6757
|
children: [
|
|
6751
|
-
/* @__PURE__ */ (0,
|
|
6752
|
-
item.avatar ? /* @__PURE__ */ (0,
|
|
6753
|
-
/* @__PURE__ */ (0,
|
|
6754
|
-
/* @__PURE__ */ (0,
|
|
6755
|
-
/* @__PURE__ */ (0,
|
|
6758
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.View, { style: styles19.rankCol, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(RankLabel, { index }) }),
|
|
6759
|
+
item.avatar ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.Image, { source: { uri: ensurePngAvatar(item.avatar) }, style: styles19.avatar }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.View, { style: [styles19.avatar, { backgroundColor: t.border }] }),
|
|
6760
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react_native25.View, { style: styles19.nameCol, children: [
|
|
6761
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.Text, { style: [styles19.name, { color: t.text }], numberOfLines: 1, children: item.username || `${item.wallet_address.slice(0, 4)}...${item.wallet_address.slice(-4)}` }),
|
|
6762
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react_native25.Text, { style: [styles19.lives, { color: t.textMuted }], children: [
|
|
6756
6763
|
item.lives_used,
|
|
6757
6764
|
" ",
|
|
6758
6765
|
item.lives_used === 1 ? "life" : "lives",
|
|
6759
6766
|
" used"
|
|
6760
6767
|
] })
|
|
6761
6768
|
] }),
|
|
6762
|
-
/* @__PURE__ */ (0,
|
|
6769
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.Text, { style: [styles19.score, { color: t.accent }], children: item.best_score })
|
|
6763
6770
|
]
|
|
6764
6771
|
}
|
|
6765
6772
|
);
|
|
6766
6773
|
};
|
|
6767
|
-
return /* @__PURE__ */ (0,
|
|
6768
|
-
|
|
6774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
6775
|
+
import_react_native25.Modal,
|
|
6769
6776
|
{
|
|
6770
6777
|
visible,
|
|
6771
6778
|
animationType: "slide",
|
|
6772
6779
|
transparent: true,
|
|
6773
6780
|
onRequestClose: onDismiss,
|
|
6774
6781
|
children: [
|
|
6775
|
-
/* @__PURE__ */ (0,
|
|
6776
|
-
/* @__PURE__ */ (0,
|
|
6777
|
-
|
|
6782
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.Animated.View, { style: [styles19.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.TouchableOpacity, { style: styles19.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
6783
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
6784
|
+
import_react_native25.KeyboardAvoidingView,
|
|
6778
6785
|
{
|
|
6779
|
-
style:
|
|
6780
|
-
behavior:
|
|
6781
|
-
children: /* @__PURE__ */ (0,
|
|
6782
|
-
/* @__PURE__ */ (0,
|
|
6783
|
-
/* @__PURE__ */ (0,
|
|
6784
|
-
/* @__PURE__ */ (0,
|
|
6785
|
-
/* @__PURE__ */ (0,
|
|
6786
|
-
pool && /* @__PURE__ */ (0,
|
|
6786
|
+
style: styles19.keyboardView,
|
|
6787
|
+
behavior: import_react_native25.Platform.OS === "ios" ? "padding" : void 0,
|
|
6788
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.View, { style: styles19.sheetPositioner, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react_native25.View, { style: [styles19.sheet, { backgroundColor: t.background }], children: [
|
|
6789
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.View, { style: styles19.handleRow, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.View, { style: [styles19.handle, { backgroundColor: t.textMuted }] }) }),
|
|
6790
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react_native25.View, { style: styles19.header, children: [
|
|
6791
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react_native25.View, { children: [
|
|
6792
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.Text, { style: [styles19.headerTitle, { color: t.text }], children: "Leaderboard" }),
|
|
6793
|
+
pool && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.Text, { style: [styles19.poolName, { color: t.textMuted }], children: pool.name })
|
|
6787
6794
|
] }),
|
|
6788
|
-
/* @__PURE__ */ (0,
|
|
6795
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.TouchableOpacity, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.Text, { style: [styles19.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
6789
6796
|
] }),
|
|
6790
|
-
stats && /* @__PURE__ */ (0,
|
|
6791
|
-
/* @__PURE__ */ (0,
|
|
6792
|
-
/* @__PURE__ */ (0,
|
|
6793
|
-
/* @__PURE__ */ (0,
|
|
6797
|
+
stats && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react_native25.View, { style: [styles19.statsBar, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
6798
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react_native25.View, { style: styles19.statItem, children: [
|
|
6799
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.Text, { style: [styles19.statValue, { color: t.text }], children: stats.total_entries }),
|
|
6800
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.Text, { style: [styles19.statLabel, { color: t.textMuted }], children: "Players" })
|
|
6794
6801
|
] }),
|
|
6795
|
-
/* @__PURE__ */ (0,
|
|
6796
|
-
/* @__PURE__ */ (0,
|
|
6797
|
-
/* @__PURE__ */ (0,
|
|
6798
|
-
/* @__PURE__ */ (0,
|
|
6802
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.View, { style: [styles19.statDivider, { backgroundColor: t.border }] }),
|
|
6803
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react_native25.View, { style: styles19.statItem, children: [
|
|
6804
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.Text, { style: [styles19.statValue, { color: t.accent }], children: stats.top_score }),
|
|
6805
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.Text, { style: [styles19.statLabel, { color: t.textMuted }], children: "Top Score" })
|
|
6799
6806
|
] }),
|
|
6800
|
-
/* @__PURE__ */ (0,
|
|
6801
|
-
/* @__PURE__ */ (0,
|
|
6802
|
-
/* @__PURE__ */ (0,
|
|
6803
|
-
/* @__PURE__ */ (0,
|
|
6807
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.View, { style: [styles19.statDivider, { backgroundColor: t.border }] }),
|
|
6808
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react_native25.View, { style: styles19.statItem, children: [
|
|
6809
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.Text, { style: [styles19.statValue, { color: t.text }], children: Math.round(stats.avg_score) }),
|
|
6810
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.Text, { style: [styles19.statLabel, { color: t.textMuted }], children: "Avg Score" })
|
|
6804
6811
|
] })
|
|
6805
6812
|
] }),
|
|
6806
|
-
/* @__PURE__ */ (0,
|
|
6807
|
-
|
|
6813
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
6814
|
+
import_react_native25.FlatList,
|
|
6808
6815
|
{
|
|
6809
6816
|
data: leaderboard,
|
|
6810
6817
|
renderItem,
|
|
6811
6818
|
keyExtractor: (item) => String(item.id),
|
|
6812
|
-
style:
|
|
6813
|
-
contentContainerStyle:
|
|
6814
|
-
ListEmptyComponent: /* @__PURE__ */ (0,
|
|
6819
|
+
style: styles19.list,
|
|
6820
|
+
contentContainerStyle: styles19.listContent,
|
|
6821
|
+
ListEmptyComponent: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.View, { style: styles19.emptyState, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native25.Text, { style: [styles19.emptyText, { color: t.textMuted }], children: loading ? "Loading..." : "No scores yet" }) })
|
|
6815
6822
|
}
|
|
6816
6823
|
)
|
|
6817
6824
|
] }) })
|
|
@@ -6821,9 +6828,9 @@ function ArcadeLeaderboardSheet({
|
|
|
6821
6828
|
}
|
|
6822
6829
|
);
|
|
6823
6830
|
}
|
|
6824
|
-
var
|
|
6831
|
+
var styles19 = import_react_native25.StyleSheet.create({
|
|
6825
6832
|
overlay: {
|
|
6826
|
-
...
|
|
6833
|
+
...import_react_native25.StyleSheet.absoluteFillObject,
|
|
6827
6834
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
6828
6835
|
},
|
|
6829
6836
|
overlayTap: { flex: 1 },
|
|
@@ -6879,6 +6886,233 @@ var styles18 = import_react_native24.StyleSheet.create({
|
|
|
6879
6886
|
emptyState: { paddingVertical: 40, alignItems: "center" },
|
|
6880
6887
|
emptyText: { fontSize: 14, fontWeight: "600" }
|
|
6881
6888
|
});
|
|
6889
|
+
|
|
6890
|
+
// src/ui/game/CreateGameSheet.tsx
|
|
6891
|
+
var import_react40 = require("react");
|
|
6892
|
+
var import_react_native26 = require("react-native");
|
|
6893
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
6894
|
+
var STATUS_LABELS6 = {
|
|
6895
|
+
building: "Building transaction...",
|
|
6896
|
+
signing: "Approve in wallet...",
|
|
6897
|
+
confirming: "Confirming...",
|
|
6898
|
+
success: "Game Created!"
|
|
6899
|
+
};
|
|
6900
|
+
function formatSol2(n) {
|
|
6901
|
+
return parseFloat(n.toFixed(9)).toString();
|
|
6902
|
+
}
|
|
6903
|
+
function CreateGameSheet({
|
|
6904
|
+
visible,
|
|
6905
|
+
onDismiss,
|
|
6906
|
+
event,
|
|
6907
|
+
homeColor = "#3B82F6",
|
|
6908
|
+
awayColor = "#EF4444",
|
|
6909
|
+
onSuccess,
|
|
6910
|
+
onError,
|
|
6911
|
+
onTeamSelect,
|
|
6912
|
+
onCreateSuccess,
|
|
6913
|
+
onSliderTick,
|
|
6914
|
+
maxWager = 1,
|
|
6915
|
+
shortName
|
|
6916
|
+
}) {
|
|
6917
|
+
const t = useDubsTheme();
|
|
6918
|
+
const { wallet } = useDubs();
|
|
6919
|
+
const mutation = useCreateGame();
|
|
6920
|
+
const [selectedTeam, setSelectedTeam] = (0, import_react40.useState)(null);
|
|
6921
|
+
const [wager, setWager] = (0, import_react40.useState)(0.01);
|
|
6922
|
+
const [showSuccess, setShowSuccess] = (0, import_react40.useState)(false);
|
|
6923
|
+
const overlayOpacity = (0, import_react40.useRef)(new import_react_native26.Animated.Value(0)).current;
|
|
6924
|
+
const successScale = (0, import_react40.useRef)(new import_react_native26.Animated.Value(0)).current;
|
|
6925
|
+
const successOpacity = (0, import_react40.useRef)(new import_react_native26.Animated.Value(0)).current;
|
|
6926
|
+
(0, import_react40.useEffect)(() => {
|
|
6927
|
+
import_react_native26.Animated.timing(overlayOpacity, {
|
|
6928
|
+
toValue: visible ? 1 : 0,
|
|
6929
|
+
duration: 250,
|
|
6930
|
+
useNativeDriver: true
|
|
6931
|
+
}).start();
|
|
6932
|
+
}, [visible]);
|
|
6933
|
+
(0, import_react40.useEffect)(() => {
|
|
6934
|
+
if (visible) {
|
|
6935
|
+
setSelectedTeam(null);
|
|
6936
|
+
setWager(0.01);
|
|
6937
|
+
setShowSuccess(false);
|
|
6938
|
+
successScale.setValue(0);
|
|
6939
|
+
successOpacity.setValue(0);
|
|
6940
|
+
mutation.reset();
|
|
6941
|
+
}
|
|
6942
|
+
}, [visible]);
|
|
6943
|
+
(0, import_react40.useEffect)(() => {
|
|
6944
|
+
if (mutation.status === "success" && mutation.data) {
|
|
6945
|
+
setShowSuccess(true);
|
|
6946
|
+
onSuccess?.(mutation.data);
|
|
6947
|
+
onCreateSuccess?.(mutation.data);
|
|
6948
|
+
import_react_native26.Animated.parallel([
|
|
6949
|
+
import_react_native26.Animated.spring(successScale, { toValue: 1, friction: 4, tension: 80, useNativeDriver: true }),
|
|
6950
|
+
import_react_native26.Animated.timing(successOpacity, { toValue: 1, duration: 300, useNativeDriver: true })
|
|
6951
|
+
]).start();
|
|
6952
|
+
const timer = setTimeout(() => {
|
|
6953
|
+
import_react_native26.Animated.timing(successOpacity, { toValue: 0, duration: 300, useNativeDriver: true }).start(() => {
|
|
6954
|
+
onDismiss();
|
|
6955
|
+
});
|
|
6956
|
+
}, 2500);
|
|
6957
|
+
return () => clearTimeout(timer);
|
|
6958
|
+
}
|
|
6959
|
+
}, [mutation.status, mutation.data]);
|
|
6960
|
+
(0, import_react40.useEffect)(() => {
|
|
6961
|
+
if (mutation.status === "error" && mutation.error) {
|
|
6962
|
+
onError?.(mutation.error);
|
|
6963
|
+
}
|
|
6964
|
+
}, [mutation.status, mutation.error]);
|
|
6965
|
+
const opponents = event.opponents || [];
|
|
6966
|
+
const homeName = shortName ? shortName(opponents[0]?.name) : opponents[0]?.name || "Home";
|
|
6967
|
+
const awayName = shortName ? shortName(opponents[1]?.name) : opponents[1]?.name || "Away";
|
|
6968
|
+
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
6969
|
+
const canCreate = selectedTeam !== null && !isMutating && mutation.status !== "success";
|
|
6970
|
+
const handleCreate = (0, import_react40.useCallback)(async () => {
|
|
6971
|
+
if (!selectedTeam || !wallet.publicKey) return;
|
|
6972
|
+
try {
|
|
6973
|
+
await mutation.execute({
|
|
6974
|
+
id: event.id,
|
|
6975
|
+
playerWallet: wallet.publicKey.toBase58(),
|
|
6976
|
+
teamChoice: selectedTeam,
|
|
6977
|
+
wagerAmount: wager
|
|
6978
|
+
});
|
|
6979
|
+
} catch {
|
|
6980
|
+
}
|
|
6981
|
+
}, [selectedTeam, wallet.publicKey, mutation.execute, event.id, wager]);
|
|
6982
|
+
const statusLabel = STATUS_LABELS6[mutation.status] || "";
|
|
6983
|
+
const startTime = event.startTime ? new Date(event.startTime) : null;
|
|
6984
|
+
const timeLabel = startTime ? startTime.toLocaleDateString("en-US", { weekday: "short", month: "short", day: "numeric" }) + " at " + startTime.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" }) : "TBD";
|
|
6985
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native26.Modal, { visible, animationType: "slide", transparent: true, onRequestClose: onDismiss, children: [
|
|
6986
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.Animated.View, { style: [styles20.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.TouchableOpacity, { style: styles20.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
6987
|
+
showSuccess && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.View, { style: styles20.successOverlay, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native26.Animated.View, { style: [styles20.successContent, { opacity: successOpacity, transform: [{ scale: successScale }] }], children: [
|
|
6988
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.Text, { style: styles20.successEmoji, children: "\u{1F3AF}" }),
|
|
6989
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.Text, { style: styles20.successTitle, children: "Game Created!" }),
|
|
6990
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native26.Text, { style: styles20.successSub, children: [
|
|
6991
|
+
formatSol2(wager),
|
|
6992
|
+
" SOL on ",
|
|
6993
|
+
selectedTeam === "home" ? homeName : awayName
|
|
6994
|
+
] })
|
|
6995
|
+
] }) }),
|
|
6996
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.KeyboardAvoidingView, { style: styles20.keyboardView, behavior: import_react_native26.Platform.OS === "ios" ? "padding" : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.View, { style: styles20.sheetPositioner, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native26.View, { style: [styles20.sheet, { backgroundColor: t.background }], children: [
|
|
6997
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.View, { style: styles20.handleRow, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.View, { style: [styles20.handle, { backgroundColor: t.textMuted }] }) }),
|
|
6998
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native26.View, { style: styles20.header, children: [
|
|
6999
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native26.View, { children: [
|
|
7000
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.Text, { style: [styles20.headerTitle, { color: t.text }], children: "Create Game" }),
|
|
7001
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.Text, { style: [styles20.headerSub, { color: t.textMuted }], children: timeLabel })
|
|
7002
|
+
] }),
|
|
7003
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.TouchableOpacity, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.Text, { style: [styles20.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
7004
|
+
] }),
|
|
7005
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native26.View, { style: styles20.section, children: [
|
|
7006
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.Text, { style: [styles20.sectionLabel, { color: t.textSecondary }], children: "Pick Your Side" }),
|
|
7007
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native26.View, { style: styles20.teamsRow, children: [
|
|
7008
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
7009
|
+
TeamButton,
|
|
7010
|
+
{
|
|
7011
|
+
name: homeName,
|
|
7012
|
+
imageUrl: opponents[0]?.imageUrl,
|
|
7013
|
+
odds: "\u2014",
|
|
7014
|
+
bets: 0,
|
|
7015
|
+
color: homeColor,
|
|
7016
|
+
selected: selectedTeam === "home",
|
|
7017
|
+
onPress: () => {
|
|
7018
|
+
setSelectedTeam("home");
|
|
7019
|
+
onTeamSelect?.("home");
|
|
7020
|
+
},
|
|
7021
|
+
t
|
|
7022
|
+
}
|
|
7023
|
+
),
|
|
7024
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
7025
|
+
TeamButton,
|
|
7026
|
+
{
|
|
7027
|
+
name: awayName,
|
|
7028
|
+
imageUrl: opponents[1]?.imageUrl,
|
|
7029
|
+
odds: "\u2014",
|
|
7030
|
+
bets: 0,
|
|
7031
|
+
color: awayColor,
|
|
7032
|
+
selected: selectedTeam === "away",
|
|
7033
|
+
onPress: () => {
|
|
7034
|
+
setSelectedTeam("away");
|
|
7035
|
+
onTeamSelect?.("away");
|
|
7036
|
+
},
|
|
7037
|
+
t
|
|
7038
|
+
}
|
|
7039
|
+
)
|
|
7040
|
+
] })
|
|
7041
|
+
] }),
|
|
7042
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native26.View, { style: [styles20.summaryCard, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
7043
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native26.View, { style: styles20.summaryRow, children: [
|
|
7044
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.Text, { style: [styles20.summaryLabel, { color: t.textMuted }], children: "Your wager" }),
|
|
7045
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native26.Text, { style: [styles20.summaryValue, { color: t.text }], children: [
|
|
7046
|
+
formatSol2(wager),
|
|
7047
|
+
" SOL"
|
|
7048
|
+
] })
|
|
7049
|
+
] }),
|
|
7050
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.View, { style: [styles20.summarySep, { backgroundColor: t.border }] }),
|
|
7051
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native26.View, { style: styles20.summaryRow, children: [
|
|
7052
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.Text, { style: [styles20.summaryLabel, { color: t.textMuted }], children: "You're the first" }),
|
|
7053
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.Text, { style: [styles20.summaryValue, { color: t.success }], children: "Set the odds" })
|
|
7054
|
+
] })
|
|
7055
|
+
] }),
|
|
7056
|
+
selectedTeam && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
7057
|
+
SolSlider,
|
|
7058
|
+
{
|
|
7059
|
+
value: wager,
|
|
7060
|
+
min: 0.01,
|
|
7061
|
+
max: maxWager,
|
|
7062
|
+
step: 0.01,
|
|
7063
|
+
accentColor: selectedTeam === "home" ? homeColor : awayColor,
|
|
7064
|
+
onValueChange: setWager,
|
|
7065
|
+
onTick: onSliderTick
|
|
7066
|
+
}
|
|
7067
|
+
),
|
|
7068
|
+
mutation.error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.View, { style: [styles20.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.Text, { style: [styles20.errorText, { color: t.errorText }], children: mutation.error.message }) }),
|
|
7069
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
7070
|
+
import_react_native26.TouchableOpacity,
|
|
7071
|
+
{
|
|
7072
|
+
style: [styles20.ctaButton, { backgroundColor: canCreate ? t.accent : t.border }],
|
|
7073
|
+
disabled: !canCreate,
|
|
7074
|
+
onPress: handleCreate,
|
|
7075
|
+
activeOpacity: 0.8,
|
|
7076
|
+
children: isMutating ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native26.View, { style: styles20.ctaLoading, children: [
|
|
7077
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.ActivityIndicator, { size: "small", color: "#FFFFFF" }),
|
|
7078
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.Text, { style: styles20.ctaText, children: statusLabel })
|
|
7079
|
+
] }) : mutation.status === "success" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.Text, { style: styles20.ctaText, children: "Game Created!" }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native26.Text, { style: [styles20.ctaText, !canCreate && { opacity: 0.5 }], children: selectedTeam ? `Create Game \u2014 ${formatSol2(wager)} SOL` : "Pick a side to start" })
|
|
7080
|
+
}
|
|
7081
|
+
)
|
|
7082
|
+
] }) }) })
|
|
7083
|
+
] });
|
|
7084
|
+
}
|
|
7085
|
+
var styles20 = import_react_native26.StyleSheet.create({
|
|
7086
|
+
overlay: { ...import_react_native26.StyleSheet.absoluteFillObject, backgroundColor: "rgba(0,0,0,0.5)" },
|
|
7087
|
+
overlayTap: { flex: 1 },
|
|
7088
|
+
keyboardView: { flex: 1, justifyContent: "flex-end" },
|
|
7089
|
+
sheetPositioner: { justifyContent: "flex-end" },
|
|
7090
|
+
sheet: { borderTopLeftRadius: 24, borderTopRightRadius: 24, paddingHorizontal: 20, paddingBottom: 40 },
|
|
7091
|
+
handleRow: { alignItems: "center", paddingTop: 10, paddingBottom: 8 },
|
|
7092
|
+
handle: { width: 36, height: 4, borderRadius: 2, opacity: 0.4 },
|
|
7093
|
+
header: { flexDirection: "row", alignItems: "flex-start", justifyContent: "space-between", paddingVertical: 8 },
|
|
7094
|
+
headerTitle: { fontSize: 20, fontWeight: "700" },
|
|
7095
|
+
headerSub: { fontSize: 13, marginTop: 2 },
|
|
7096
|
+
closeButton: { fontSize: 20, padding: 4 },
|
|
7097
|
+
section: { gap: 10, paddingTop: 12 },
|
|
7098
|
+
sectionLabel: { fontSize: 14, fontWeight: "600" },
|
|
7099
|
+
teamsRow: { flexDirection: "row", gap: 12 },
|
|
7100
|
+
summaryCard: { marginTop: 12, borderRadius: 14, borderWidth: 1, overflow: "hidden" },
|
|
7101
|
+
summaryRow: { flexDirection: "row", alignItems: "center", justifyContent: "space-between", paddingHorizontal: 16, paddingVertical: 12 },
|
|
7102
|
+
summaryLabel: { fontSize: 14 },
|
|
7103
|
+
summaryValue: { fontSize: 15, fontWeight: "700" },
|
|
7104
|
+
summarySep: { height: 1, marginHorizontal: 16 },
|
|
7105
|
+
errorBox: { marginTop: 12, borderRadius: 12, borderWidth: 1, padding: 12 },
|
|
7106
|
+
errorText: { fontSize: 13, fontWeight: "500" },
|
|
7107
|
+
ctaButton: { marginTop: 16, height: 54, borderRadius: 14, justifyContent: "center", alignItems: "center" },
|
|
7108
|
+
ctaText: { color: "#FFFFFF", fontSize: 16, fontWeight: "700" },
|
|
7109
|
+
ctaLoading: { flexDirection: "row", alignItems: "center", gap: 10 },
|
|
7110
|
+
successOverlay: { ...import_react_native26.StyleSheet.absoluteFillObject, zIndex: 100, alignItems: "center", justifyContent: "center", backgroundColor: "rgba(0,0,0,0.85)" },
|
|
7111
|
+
successContent: { alignItems: "center", gap: 12 },
|
|
7112
|
+
successEmoji: { fontSize: 64 },
|
|
7113
|
+
successTitle: { color: "#FFFFFF", fontSize: 28, fontWeight: "900" },
|
|
7114
|
+
successSub: { color: "#8E8E93", fontSize: 16 }
|
|
7115
|
+
});
|
|
6882
7116
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6883
7117
|
0 && (module.exports = {
|
|
6884
7118
|
ArcadeLeaderboardSheet,
|
|
@@ -6888,6 +7122,7 @@ var styles18 = import_react_native24.StyleSheet.create({
|
|
|
6888
7122
|
ConnectWalletButton,
|
|
6889
7123
|
ConnectWalletScreen,
|
|
6890
7124
|
CreateCustomGameSheet,
|
|
7125
|
+
CreateGameSheet,
|
|
6891
7126
|
DEFAULT_BASE_URL,
|
|
6892
7127
|
DEFAULT_RPC_URL,
|
|
6893
7128
|
DubsApiError,
|