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