@dubsdotapp/expo 0.5.6 → 0.5.8
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 +30 -2
- package/dist/index.d.ts +30 -2
- package/dist/index.js +613 -266
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +591 -238
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -1
- package/src/ui/game/JoinGameSheet.tsx +187 -22
- package/src/ui/game/SolSlider.tsx +259 -0
- package/src/ui/game/index.ts +2 -0
- package/src/ui/index.ts +2 -1
package/dist/index.mjs
CHANGED
|
@@ -5320,19 +5320,239 @@ var styles12 = StyleSheet13.create({
|
|
|
5320
5320
|
});
|
|
5321
5321
|
|
|
5322
5322
|
// src/ui/game/JoinGameSheet.tsx
|
|
5323
|
-
import { useState as useState28, useEffect as useEffect17, useRef as
|
|
5323
|
+
import { useState as useState28, useEffect as useEffect17, useRef as useRef10, useCallback as useCallback24, useMemo as useMemo9 } from "react";
|
|
5324
5324
|
import {
|
|
5325
|
-
View as
|
|
5326
|
-
Text as
|
|
5325
|
+
View as View15,
|
|
5326
|
+
Text as Text15,
|
|
5327
|
+
Image as Image6,
|
|
5327
5328
|
TouchableOpacity as TouchableOpacity10,
|
|
5328
5329
|
ActivityIndicator as ActivityIndicator8,
|
|
5329
5330
|
Modal as Modal3,
|
|
5330
5331
|
Animated as Animated4,
|
|
5331
|
-
StyleSheet as
|
|
5332
|
+
StyleSheet as StyleSheet15,
|
|
5332
5333
|
KeyboardAvoidingView as KeyboardAvoidingView4,
|
|
5334
|
+
Platform as Platform8
|
|
5335
|
+
} from "react-native";
|
|
5336
|
+
|
|
5337
|
+
// src/ui/game/SolSlider.tsx
|
|
5338
|
+
import { useRef as useRef9 } from "react";
|
|
5339
|
+
import {
|
|
5340
|
+
View as View14,
|
|
5341
|
+
Text as Text14,
|
|
5342
|
+
StyleSheet as StyleSheet14,
|
|
5343
|
+
PanResponder,
|
|
5333
5344
|
Platform as Platform7
|
|
5334
5345
|
} from "react-native";
|
|
5335
|
-
import {
|
|
5346
|
+
import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5347
|
+
var THUMB_SIZE = 32;
|
|
5348
|
+
var TRACK_HEIGHT = 6;
|
|
5349
|
+
var TICK_INTERVAL = 0.01;
|
|
5350
|
+
function SolSlider({
|
|
5351
|
+
value,
|
|
5352
|
+
min = 0.01,
|
|
5353
|
+
max = 5,
|
|
5354
|
+
step = 0.01,
|
|
5355
|
+
accentColor,
|
|
5356
|
+
onValueChange,
|
|
5357
|
+
onSlidingComplete,
|
|
5358
|
+
onTick,
|
|
5359
|
+
disabled = false
|
|
5360
|
+
}) {
|
|
5361
|
+
const t = useDubsTheme();
|
|
5362
|
+
const accent = accentColor || t.accent;
|
|
5363
|
+
const trackRef = useRef9(null);
|
|
5364
|
+
const trackWidth = useRef9(0);
|
|
5365
|
+
const lastTickValue = useRef9(value);
|
|
5366
|
+
const clamp = (v) => {
|
|
5367
|
+
const stepped = Math.round(v / step) * step;
|
|
5368
|
+
return Math.max(min, Math.min(max, parseFloat(stepped.toFixed(4))));
|
|
5369
|
+
};
|
|
5370
|
+
const valueToPosition = (v) => {
|
|
5371
|
+
const ratio2 = (v - min) / (max - min);
|
|
5372
|
+
return ratio2 * trackWidth.current;
|
|
5373
|
+
};
|
|
5374
|
+
const positionToValue = (x) => {
|
|
5375
|
+
const ratio2 = Math.max(0, Math.min(1, x / trackWidth.current));
|
|
5376
|
+
return clamp(min + ratio2 * (max - min));
|
|
5377
|
+
};
|
|
5378
|
+
const panResponder = useRef9(
|
|
5379
|
+
PanResponder.create({
|
|
5380
|
+
onStartShouldSetPanResponder: () => !disabled,
|
|
5381
|
+
onMoveShouldSetPanResponder: () => !disabled,
|
|
5382
|
+
onPanResponderGrant: (_, gestureState) => {
|
|
5383
|
+
lastTickValue.current = value;
|
|
5384
|
+
},
|
|
5385
|
+
onPanResponderMove: (evt, gestureState) => {
|
|
5386
|
+
const touchX = gestureState.moveX;
|
|
5387
|
+
trackRef.current?.measureInWindow((trackX) => {
|
|
5388
|
+
const relX = touchX - trackX;
|
|
5389
|
+
const newVal = positionToValue(relX);
|
|
5390
|
+
const tickDelta = Math.abs(newVal - lastTickValue.current);
|
|
5391
|
+
if (tickDelta >= TICK_INTERVAL) {
|
|
5392
|
+
lastTickValue.current = newVal;
|
|
5393
|
+
onTick?.(newVal);
|
|
5394
|
+
}
|
|
5395
|
+
onValueChange(newVal);
|
|
5396
|
+
});
|
|
5397
|
+
},
|
|
5398
|
+
onPanResponderRelease: () => {
|
|
5399
|
+
onSlidingComplete?.(value);
|
|
5400
|
+
}
|
|
5401
|
+
})
|
|
5402
|
+
).current;
|
|
5403
|
+
const ratio = (value - min) / (max - min);
|
|
5404
|
+
const filledWidth = `${ratio * 100}%`;
|
|
5405
|
+
const markers = [min, max * 0.25, max * 0.5, max * 0.75, max];
|
|
5406
|
+
return /* @__PURE__ */ jsxs13(View14, { style: styles13.container, children: [
|
|
5407
|
+
/* @__PURE__ */ jsxs13(View14, { style: styles13.valueRow, children: [
|
|
5408
|
+
/* @__PURE__ */ jsx16(Text14, { style: [styles13.valueText, { color: accent }], children: parseFloat(value.toFixed(4)) }),
|
|
5409
|
+
/* @__PURE__ */ jsx16(Text14, { style: [styles13.solLabel, { color: accent }], children: "SOL" })
|
|
5410
|
+
] }),
|
|
5411
|
+
/* @__PURE__ */ jsxs13(
|
|
5412
|
+
View14,
|
|
5413
|
+
{
|
|
5414
|
+
ref: trackRef,
|
|
5415
|
+
style: styles13.trackContainer,
|
|
5416
|
+
onLayout: (e) => {
|
|
5417
|
+
trackWidth.current = e.nativeEvent.layout.width;
|
|
5418
|
+
},
|
|
5419
|
+
...panResponder.panHandlers,
|
|
5420
|
+
children: [
|
|
5421
|
+
/* @__PURE__ */ jsx16(View14, { style: [styles13.track, { backgroundColor: "#2C2C2E" }], children: /* @__PURE__ */ jsx16(View14, { style: [styles13.trackFilled, { width: filledWidth, backgroundColor: accent }] }) }),
|
|
5422
|
+
/* @__PURE__ */ jsx16(View14, { style: styles13.markerRow, children: markers.map((m, i) => {
|
|
5423
|
+
const mRatio = (m - min) / (max - min);
|
|
5424
|
+
return /* @__PURE__ */ jsx16(
|
|
5425
|
+
View14,
|
|
5426
|
+
{
|
|
5427
|
+
style: [
|
|
5428
|
+
styles13.marker,
|
|
5429
|
+
{
|
|
5430
|
+
left: `${mRatio * 100}%`,
|
|
5431
|
+
backgroundColor: value >= m ? accent : "#3A3A3C"
|
|
5432
|
+
}
|
|
5433
|
+
]
|
|
5434
|
+
},
|
|
5435
|
+
i
|
|
5436
|
+
);
|
|
5437
|
+
}) }),
|
|
5438
|
+
/* @__PURE__ */ jsx16(
|
|
5439
|
+
View14,
|
|
5440
|
+
{
|
|
5441
|
+
style: [
|
|
5442
|
+
styles13.thumb,
|
|
5443
|
+
{
|
|
5444
|
+
left: filledWidth,
|
|
5445
|
+
backgroundColor: accent,
|
|
5446
|
+
shadowColor: accent
|
|
5447
|
+
}
|
|
5448
|
+
],
|
|
5449
|
+
children: /* @__PURE__ */ jsx16(View14, { style: styles13.thumbInner })
|
|
5450
|
+
}
|
|
5451
|
+
)
|
|
5452
|
+
]
|
|
5453
|
+
}
|
|
5454
|
+
),
|
|
5455
|
+
/* @__PURE__ */ jsxs13(View14, { style: styles13.rangeRow, children: [
|
|
5456
|
+
/* @__PURE__ */ jsx16(Text14, { style: styles13.rangeText, children: min }),
|
|
5457
|
+
/* @__PURE__ */ jsxs13(Text14, { style: styles13.rangeText, children: [
|
|
5458
|
+
max,
|
|
5459
|
+
" SOL"
|
|
5460
|
+
] })
|
|
5461
|
+
] })
|
|
5462
|
+
] });
|
|
5463
|
+
}
|
|
5464
|
+
var styles13 = StyleSheet14.create({
|
|
5465
|
+
container: {
|
|
5466
|
+
paddingVertical: 8
|
|
5467
|
+
},
|
|
5468
|
+
valueRow: {
|
|
5469
|
+
flexDirection: "row",
|
|
5470
|
+
alignItems: "baseline",
|
|
5471
|
+
justifyContent: "center",
|
|
5472
|
+
marginBottom: 16,
|
|
5473
|
+
gap: 4
|
|
5474
|
+
},
|
|
5475
|
+
valueText: {
|
|
5476
|
+
fontSize: 36,
|
|
5477
|
+
fontWeight: "900",
|
|
5478
|
+
letterSpacing: -1,
|
|
5479
|
+
fontVariant: ["tabular-nums"]
|
|
5480
|
+
},
|
|
5481
|
+
solLabel: {
|
|
5482
|
+
fontSize: 16,
|
|
5483
|
+
fontWeight: "700",
|
|
5484
|
+
opacity: 0.6
|
|
5485
|
+
},
|
|
5486
|
+
trackContainer: {
|
|
5487
|
+
height: THUMB_SIZE + 16,
|
|
5488
|
+
justifyContent: "center",
|
|
5489
|
+
paddingHorizontal: THUMB_SIZE / 2
|
|
5490
|
+
},
|
|
5491
|
+
track: {
|
|
5492
|
+
height: TRACK_HEIGHT,
|
|
5493
|
+
borderRadius: TRACK_HEIGHT / 2,
|
|
5494
|
+
overflow: "hidden"
|
|
5495
|
+
},
|
|
5496
|
+
trackFilled: {
|
|
5497
|
+
height: "100%",
|
|
5498
|
+
borderRadius: TRACK_HEIGHT / 2
|
|
5499
|
+
},
|
|
5500
|
+
markerRow: {
|
|
5501
|
+
position: "absolute",
|
|
5502
|
+
left: THUMB_SIZE / 2,
|
|
5503
|
+
right: THUMB_SIZE / 2,
|
|
5504
|
+
height: TRACK_HEIGHT,
|
|
5505
|
+
top: (THUMB_SIZE + 16 - TRACK_HEIGHT) / 2
|
|
5506
|
+
},
|
|
5507
|
+
marker: {
|
|
5508
|
+
position: "absolute",
|
|
5509
|
+
width: 3,
|
|
5510
|
+
height: 12,
|
|
5511
|
+
borderRadius: 1.5,
|
|
5512
|
+
top: -3,
|
|
5513
|
+
marginLeft: -1.5
|
|
5514
|
+
},
|
|
5515
|
+
thumb: {
|
|
5516
|
+
position: "absolute",
|
|
5517
|
+
width: THUMB_SIZE,
|
|
5518
|
+
height: THUMB_SIZE,
|
|
5519
|
+
borderRadius: THUMB_SIZE / 2,
|
|
5520
|
+
top: 8,
|
|
5521
|
+
marginLeft: 0,
|
|
5522
|
+
alignItems: "center",
|
|
5523
|
+
justifyContent: "center",
|
|
5524
|
+
...Platform7.select({
|
|
5525
|
+
ios: {
|
|
5526
|
+
shadowOffset: { width: 0, height: 0 },
|
|
5527
|
+
shadowOpacity: 0.6,
|
|
5528
|
+
shadowRadius: 10
|
|
5529
|
+
},
|
|
5530
|
+
android: {
|
|
5531
|
+
elevation: 8
|
|
5532
|
+
}
|
|
5533
|
+
})
|
|
5534
|
+
},
|
|
5535
|
+
thumbInner: {
|
|
5536
|
+
width: 12,
|
|
5537
|
+
height: 12,
|
|
5538
|
+
borderRadius: 6,
|
|
5539
|
+
backgroundColor: "#FFFFFF"
|
|
5540
|
+
},
|
|
5541
|
+
rangeRow: {
|
|
5542
|
+
flexDirection: "row",
|
|
5543
|
+
justifyContent: "space-between",
|
|
5544
|
+
paddingHorizontal: THUMB_SIZE / 2,
|
|
5545
|
+
marginTop: 4
|
|
5546
|
+
},
|
|
5547
|
+
rangeText: {
|
|
5548
|
+
color: "#5A5A5E",
|
|
5549
|
+
fontSize: 11,
|
|
5550
|
+
fontWeight: "600"
|
|
5551
|
+
}
|
|
5552
|
+
});
|
|
5553
|
+
|
|
5554
|
+
// src/ui/game/JoinGameSheet.tsx
|
|
5555
|
+
import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5336
5556
|
var STATUS_LABELS3 = {
|
|
5337
5557
|
building: "Building transaction...",
|
|
5338
5558
|
signing: "Approve in wallet...",
|
|
@@ -5340,6 +5560,13 @@ var STATUS_LABELS3 = {
|
|
|
5340
5560
|
success: "Joined!"
|
|
5341
5561
|
};
|
|
5342
5562
|
var CUSTOM_GAME_MODE = 6;
|
|
5563
|
+
function formatSol(n) {
|
|
5564
|
+
return parseFloat(n.toFixed(9)).toString();
|
|
5565
|
+
}
|
|
5566
|
+
function toPng(url) {
|
|
5567
|
+
if (!url) return null;
|
|
5568
|
+
return url.replace("/svg?", "/png?");
|
|
5569
|
+
}
|
|
5343
5570
|
function JoinGameSheet({
|
|
5344
5571
|
visible,
|
|
5345
5572
|
onDismiss,
|
|
@@ -5351,6 +5578,9 @@ function JoinGameSheet({
|
|
|
5351
5578
|
onSuccess,
|
|
5352
5579
|
onError,
|
|
5353
5580
|
onTeamSelect,
|
|
5581
|
+
onJoinSuccess,
|
|
5582
|
+
onSliderTick,
|
|
5583
|
+
maxWager = 5,
|
|
5354
5584
|
isPoolModeEnabled = false
|
|
5355
5585
|
}) {
|
|
5356
5586
|
const t = useDubsTheme();
|
|
@@ -5358,7 +5588,11 @@ function JoinGameSheet({
|
|
|
5358
5588
|
const mutation = useJoinGame();
|
|
5359
5589
|
const isCustomGame = game.gameMode === CUSTOM_GAME_MODE;
|
|
5360
5590
|
const [selectedTeam, setSelectedTeam] = useState28(null);
|
|
5361
|
-
const
|
|
5591
|
+
const [wager, setWager] = useState28(game.buyIn);
|
|
5592
|
+
const [showSuccess, setShowSuccess] = useState28(false);
|
|
5593
|
+
const overlayOpacity = useRef10(new Animated4.Value(0)).current;
|
|
5594
|
+
const successScale = useRef10(new Animated4.Value(0)).current;
|
|
5595
|
+
const successOpacity = useRef10(new Animated4.Value(0)).current;
|
|
5362
5596
|
useEffect17(() => {
|
|
5363
5597
|
Animated4.timing(overlayOpacity, {
|
|
5364
5598
|
toValue: visible ? 1 : 0,
|
|
@@ -5369,15 +5603,27 @@ function JoinGameSheet({
|
|
|
5369
5603
|
useEffect17(() => {
|
|
5370
5604
|
if (visible) {
|
|
5371
5605
|
setSelectedTeam(isPoolModeEnabled ? "home" : isCustomGame ? "away" : null);
|
|
5606
|
+
setWager(game.buyIn);
|
|
5607
|
+
setShowSuccess(false);
|
|
5608
|
+
successScale.setValue(0);
|
|
5609
|
+
successOpacity.setValue(0);
|
|
5372
5610
|
mutation.reset();
|
|
5373
5611
|
}
|
|
5374
5612
|
}, [visible]);
|
|
5375
5613
|
useEffect17(() => {
|
|
5376
5614
|
if (mutation.status === "success" && mutation.data) {
|
|
5615
|
+
setShowSuccess(true);
|
|
5377
5616
|
onSuccess?.(mutation.data);
|
|
5617
|
+
onJoinSuccess?.(mutation.data);
|
|
5618
|
+
Animated4.parallel([
|
|
5619
|
+
Animated4.spring(successScale, { toValue: 1, friction: 4, tension: 80, useNativeDriver: true }),
|
|
5620
|
+
Animated4.timing(successOpacity, { toValue: 1, duration: 300, useNativeDriver: true })
|
|
5621
|
+
]).start();
|
|
5378
5622
|
const timer = setTimeout(() => {
|
|
5379
|
-
|
|
5380
|
-
|
|
5623
|
+
Animated4.timing(successOpacity, { toValue: 0, duration: 300, useNativeDriver: true }).start(() => {
|
|
5624
|
+
onDismiss();
|
|
5625
|
+
});
|
|
5626
|
+
}, 2500);
|
|
5381
5627
|
return () => clearTimeout(timer);
|
|
5382
5628
|
}
|
|
5383
5629
|
}, [mutation.status, mutation.data]);
|
|
@@ -5392,15 +5638,18 @@ function JoinGameSheet({
|
|
|
5392
5638
|
const homePool = game.homePool || 0;
|
|
5393
5639
|
const awayPool = game.awayPool || 0;
|
|
5394
5640
|
const buyIn = game.buyIn;
|
|
5395
|
-
const
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5641
|
+
const poolAfterJoin = totalPool + wager;
|
|
5642
|
+
const { homeOdds, awayOdds, homeBets, awayBets } = useMemo9(() => {
|
|
5643
|
+
const newPool = totalPool + wager;
|
|
5644
|
+
return {
|
|
5645
|
+
homeOdds: homePool > 0 ? (newPool / (homePool + (selectedTeam === "home" ? wager : 0))).toFixed(2) : "\u2014",
|
|
5646
|
+
awayOdds: awayPool > 0 ? (newPool / (awayPool + (selectedTeam === "away" ? wager : 0))).toFixed(2) : "\u2014",
|
|
5647
|
+
homeBets: bettors.filter((b) => b.team === "home").length,
|
|
5648
|
+
awayBets: bettors.filter((b) => b.team === "away").length
|
|
5649
|
+
};
|
|
5650
|
+
}, [totalPool, homePool, awayPool, bettors, wager, selectedTeam]);
|
|
5402
5651
|
const selectedOdds = selectedTeam === "home" ? homeOdds : selectedTeam === "away" ? awayOdds : "\u2014";
|
|
5403
|
-
const potentialWinnings = selectedOdds !== "\u2014" ? (parseFloat(selectedOdds) *
|
|
5652
|
+
const potentialWinnings = selectedOdds !== "\u2014" ? formatSol(parseFloat(selectedOdds) * wager) : "\u2014";
|
|
5404
5653
|
const homeName = shortName ? shortName(opponents[0]?.name) : opponents[0]?.name || "Home";
|
|
5405
5654
|
const awayName = shortName ? shortName(opponents[1]?.name) : opponents[1]?.name || "Away";
|
|
5406
5655
|
const selectedName = selectedTeam === "home" ? homeName : selectedTeam === "away" ? awayName : "\u2014";
|
|
@@ -5411,20 +5660,20 @@ function JoinGameSheet({
|
|
|
5411
5660
|
}, [bettors, wallet.publicKey]);
|
|
5412
5661
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
5413
5662
|
const canJoin = selectedTeam !== null && !isMutating && mutation.status !== "success" && !alreadyJoined;
|
|
5414
|
-
const handleJoin =
|
|
5663
|
+
const handleJoin = useCallback24(async () => {
|
|
5415
5664
|
if (!selectedTeam || !wallet.publicKey) return;
|
|
5416
5665
|
try {
|
|
5417
5666
|
await mutation.execute({
|
|
5418
5667
|
playerWallet: wallet.publicKey.toBase58(),
|
|
5419
5668
|
gameId: game.gameId,
|
|
5420
5669
|
teamChoice: selectedTeam,
|
|
5421
|
-
amount:
|
|
5670
|
+
amount: wager
|
|
5422
5671
|
});
|
|
5423
5672
|
} catch {
|
|
5424
5673
|
}
|
|
5425
|
-
}, [selectedTeam, wallet.publicKey, mutation.execute, game.gameId,
|
|
5674
|
+
}, [selectedTeam, wallet.publicKey, mutation.execute, game.gameId, wager]);
|
|
5426
5675
|
const statusLabel = STATUS_LABELS3[mutation.status] || "";
|
|
5427
|
-
return /* @__PURE__ */
|
|
5676
|
+
return /* @__PURE__ */ jsxs14(
|
|
5428
5677
|
Modal3,
|
|
5429
5678
|
{
|
|
5430
5679
|
visible,
|
|
@@ -5432,22 +5681,49 @@ function JoinGameSheet({
|
|
|
5432
5681
|
transparent: true,
|
|
5433
5682
|
onRequestClose: onDismiss,
|
|
5434
5683
|
children: [
|
|
5435
|
-
/* @__PURE__ */
|
|
5436
|
-
/* @__PURE__ */
|
|
5684
|
+
/* @__PURE__ */ jsx17(Animated4.View, { style: [styles14.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ jsx17(TouchableOpacity10, { style: styles14.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
5685
|
+
showSuccess && /* @__PURE__ */ jsx17(View15, { style: styles14.successOverlay, children: /* @__PURE__ */ jsxs14(Animated4.View, { style: [styles14.successContent, { opacity: successOpacity, transform: [{ scale: successScale }] }], children: [
|
|
5686
|
+
/* @__PURE__ */ jsx17(Text15, { style: styles14.successEmoji, children: "\u{1F389}" }),
|
|
5687
|
+
/* @__PURE__ */ jsx17(Text15, { style: styles14.successTitle, children: "You're in!" }),
|
|
5688
|
+
/* @__PURE__ */ jsxs14(Text15, { style: styles14.successSub, children: [
|
|
5689
|
+
formatSol(buyIn),
|
|
5690
|
+
" SOL on ",
|
|
5691
|
+
selectedName
|
|
5692
|
+
] })
|
|
5693
|
+
] }) }),
|
|
5694
|
+
/* @__PURE__ */ jsx17(
|
|
5437
5695
|
KeyboardAvoidingView4,
|
|
5438
5696
|
{
|
|
5439
|
-
style:
|
|
5440
|
-
behavior:
|
|
5441
|
-
children: /* @__PURE__ */
|
|
5442
|
-
/* @__PURE__ */
|
|
5443
|
-
/* @__PURE__ */
|
|
5444
|
-
/* @__PURE__ */
|
|
5445
|
-
/* @__PURE__ */
|
|
5697
|
+
style: styles14.keyboardView,
|
|
5698
|
+
behavior: Platform8.OS === "ios" ? "padding" : void 0,
|
|
5699
|
+
children: /* @__PURE__ */ jsx17(View15, { style: styles14.sheetPositioner, children: /* @__PURE__ */ jsxs14(View15, { style: [styles14.sheet, { backgroundColor: t.background }], children: [
|
|
5700
|
+
/* @__PURE__ */ jsx17(View15, { style: styles14.handleRow, children: /* @__PURE__ */ jsx17(View15, { style: [styles14.handle, { backgroundColor: t.textMuted }] }) }),
|
|
5701
|
+
/* @__PURE__ */ jsxs14(View15, { style: styles14.header, children: [
|
|
5702
|
+
/* @__PURE__ */ jsx17(Text15, { style: [styles14.headerTitle, { color: t.text }], children: isPoolModeEnabled ? "Join Pool" : "Join Game" }),
|
|
5703
|
+
/* @__PURE__ */ jsx17(TouchableOpacity10, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ jsx17(Text15, { style: [styles14.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
5446
5704
|
] }),
|
|
5447
|
-
|
|
5448
|
-
/* @__PURE__ */
|
|
5449
|
-
|
|
5450
|
-
|
|
5705
|
+
bettors.length > 0 && /* @__PURE__ */ jsxs14(View15, { style: styles14.bettorsSection, children: [
|
|
5706
|
+
/* @__PURE__ */ jsxs14(Text15, { style: [styles14.bettorsLabel, { color: t.textMuted }], children: [
|
|
5707
|
+
bettors.length,
|
|
5708
|
+
" ",
|
|
5709
|
+
bettors.length === 1 ? "player" : "players",
|
|
5710
|
+
" in this game"
|
|
5711
|
+
] }),
|
|
5712
|
+
/* @__PURE__ */ jsxs14(View15, { style: styles14.bettorsRow, children: [
|
|
5713
|
+
bettors.slice(0, 6).map((b, i) => {
|
|
5714
|
+
const pngUrl = toPng(b.avatar);
|
|
5715
|
+
return /* @__PURE__ */ jsx17(View15, { style: [styles14.bettorCircle, { backgroundColor: ["#EF4444", "#3B82F6", "#22C55E", "#F59E0B", "#A855F7", "#EC4899"][i % 6] }], children: pngUrl ? /* @__PURE__ */ jsx17(Image6, { source: { uri: pngUrl }, style: styles14.bettorImg }) : /* @__PURE__ */ jsx17(Text15, { style: styles14.bettorInitial, children: (b.username ?? b.wallet).charAt(0).toUpperCase() }) }, b.wallet);
|
|
5716
|
+
}),
|
|
5717
|
+
bettors.length > 6 && /* @__PURE__ */ jsx17(View15, { style: [styles14.bettorCircle, { backgroundColor: "#2C2C2E" }], children: /* @__PURE__ */ jsxs14(Text15, { style: styles14.bettorOverflow, children: [
|
|
5718
|
+
"+",
|
|
5719
|
+
bettors.length - 6
|
|
5720
|
+
] }) })
|
|
5721
|
+
] })
|
|
5722
|
+
] }),
|
|
5723
|
+
!isCustomGame && !isPoolModeEnabled && /* @__PURE__ */ jsxs14(View15, { style: styles14.section, children: [
|
|
5724
|
+
/* @__PURE__ */ jsx17(Text15, { style: [styles14.sectionLabel, { color: t.textSecondary }], children: "Pick Your Side" }),
|
|
5725
|
+
/* @__PURE__ */ jsxs14(View15, { style: styles14.teamsRow, children: [
|
|
5726
|
+
/* @__PURE__ */ jsx17(
|
|
5451
5727
|
TeamButton,
|
|
5452
5728
|
{
|
|
5453
5729
|
name: homeName,
|
|
@@ -5464,7 +5740,7 @@ function JoinGameSheet({
|
|
|
5464
5740
|
t
|
|
5465
5741
|
}
|
|
5466
5742
|
),
|
|
5467
|
-
/* @__PURE__ */
|
|
5743
|
+
/* @__PURE__ */ jsx17(
|
|
5468
5744
|
TeamButton,
|
|
5469
5745
|
{
|
|
5470
5746
|
name: awayName,
|
|
@@ -5483,64 +5759,76 @@ function JoinGameSheet({
|
|
|
5483
5759
|
)
|
|
5484
5760
|
] })
|
|
5485
5761
|
] }),
|
|
5486
|
-
/* @__PURE__ */
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5762
|
+
selectedTeam && !isPoolModeEnabled && /* @__PURE__ */ jsx17(View15, { style: styles14.sliderSection, children: /* @__PURE__ */ jsx17(
|
|
5763
|
+
SolSlider,
|
|
5764
|
+
{
|
|
5765
|
+
value: wager,
|
|
5766
|
+
min: game.buyIn,
|
|
5767
|
+
max: maxWager,
|
|
5768
|
+
step: 0.01,
|
|
5769
|
+
accentColor: selectedTeam === "home" ? homeColor : awayColor,
|
|
5770
|
+
onValueChange: setWager,
|
|
5771
|
+
onTick: onSliderTick
|
|
5772
|
+
}
|
|
5773
|
+
) }),
|
|
5774
|
+
/* @__PURE__ */ jsxs14(View15, { style: [styles14.summaryCard, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
5775
|
+
/* @__PURE__ */ jsxs14(View15, { style: styles14.summaryRow, children: [
|
|
5776
|
+
/* @__PURE__ */ jsx17(Text15, { style: [styles14.summaryLabel, { color: t.textMuted }], children: "Your wager" }),
|
|
5777
|
+
/* @__PURE__ */ jsxs14(Text15, { style: [styles14.summaryValue, { color: t.text }], children: [
|
|
5778
|
+
formatSol(wager),
|
|
5491
5779
|
" SOL"
|
|
5492
5780
|
] })
|
|
5493
5781
|
] }),
|
|
5494
|
-
/* @__PURE__ */
|
|
5495
|
-
isPoolModeEnabled ? /* @__PURE__ */
|
|
5496
|
-
/* @__PURE__ */
|
|
5497
|
-
/* @__PURE__ */
|
|
5498
|
-
/* @__PURE__ */
|
|
5782
|
+
/* @__PURE__ */ jsx17(View15, { style: [styles14.summarySep, { backgroundColor: t.border }] }),
|
|
5783
|
+
isPoolModeEnabled ? /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
5784
|
+
/* @__PURE__ */ jsxs14(View15, { style: styles14.summaryRow, children: [
|
|
5785
|
+
/* @__PURE__ */ jsx17(Text15, { style: [styles14.summaryLabel, { color: t.textMuted }], children: "Players in" }),
|
|
5786
|
+
/* @__PURE__ */ jsx17(Text15, { style: [styles14.summaryValue, { color: t.text }], children: bettors.length })
|
|
5499
5787
|
] }),
|
|
5500
|
-
/* @__PURE__ */
|
|
5501
|
-
/* @__PURE__ */
|
|
5502
|
-
/* @__PURE__ */
|
|
5503
|
-
/* @__PURE__ */
|
|
5504
|
-
totalPool,
|
|
5788
|
+
/* @__PURE__ */ jsx17(View15, { style: [styles14.summarySep, { backgroundColor: t.border }] }),
|
|
5789
|
+
/* @__PURE__ */ jsxs14(View15, { style: styles14.summaryRow, children: [
|
|
5790
|
+
/* @__PURE__ */ jsx17(Text15, { style: [styles14.summaryLabel, { color: t.textMuted }], children: "Current pot" }),
|
|
5791
|
+
/* @__PURE__ */ jsxs14(Text15, { style: [styles14.summaryValue, { color: t.success }], children: [
|
|
5792
|
+
formatSol(totalPool),
|
|
5505
5793
|
" SOL"
|
|
5506
5794
|
] })
|
|
5507
5795
|
] })
|
|
5508
|
-
] }) : /* @__PURE__ */
|
|
5509
|
-
/* @__PURE__ */
|
|
5510
|
-
/* @__PURE__ */
|
|
5511
|
-
/* @__PURE__ */
|
|
5796
|
+
] }) : /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
5797
|
+
/* @__PURE__ */ jsxs14(View15, { style: styles14.summaryRow, children: [
|
|
5798
|
+
/* @__PURE__ */ jsx17(Text15, { style: [styles14.summaryLabel, { color: t.textMuted }], children: "Your side" }),
|
|
5799
|
+
/* @__PURE__ */ jsx17(Text15, { style: [styles14.summaryValue, { color: t.text }], children: selectedName })
|
|
5512
5800
|
] }),
|
|
5513
|
-
/* @__PURE__ */
|
|
5514
|
-
/* @__PURE__ */
|
|
5515
|
-
/* @__PURE__ */
|
|
5516
|
-
/* @__PURE__ */
|
|
5517
|
-
poolAfterJoin,
|
|
5801
|
+
/* @__PURE__ */ jsx17(View15, { style: [styles14.summarySep, { backgroundColor: t.border }] }),
|
|
5802
|
+
/* @__PURE__ */ jsxs14(View15, { style: styles14.summaryRow, children: [
|
|
5803
|
+
/* @__PURE__ */ jsx17(Text15, { style: [styles14.summaryLabel, { color: t.textMuted }], children: "Total pool" }),
|
|
5804
|
+
/* @__PURE__ */ jsxs14(Text15, { style: [styles14.summaryValue, { color: t.text }], children: [
|
|
5805
|
+
formatSol(poolAfterJoin),
|
|
5518
5806
|
" SOL"
|
|
5519
5807
|
] })
|
|
5520
5808
|
] }),
|
|
5521
|
-
/* @__PURE__ */
|
|
5522
|
-
/* @__PURE__ */
|
|
5523
|
-
/* @__PURE__ */
|
|
5524
|
-
/* @__PURE__ */
|
|
5809
|
+
/* @__PURE__ */ jsx17(View15, { style: [styles14.summarySep, { backgroundColor: t.border }] }),
|
|
5810
|
+
/* @__PURE__ */ jsxs14(View15, { style: styles14.summaryRow, children: [
|
|
5811
|
+
/* @__PURE__ */ jsx17(Text15, { style: [styles14.summaryLabel, { color: t.textMuted }], children: "Potential winnings" }),
|
|
5812
|
+
/* @__PURE__ */ jsx17(Text15, { style: [styles14.summaryValue, { color: t.success }], children: potentialWinnings !== "\u2014" ? `${potentialWinnings} SOL` : "\u2014" })
|
|
5525
5813
|
] })
|
|
5526
5814
|
] })
|
|
5527
5815
|
] }),
|
|
5528
|
-
alreadyJoined && /* @__PURE__ */
|
|
5529
|
-
mutation.error && /* @__PURE__ */
|
|
5530
|
-
/* @__PURE__ */
|
|
5816
|
+
alreadyJoined && /* @__PURE__ */ jsx17(View15, { style: [styles14.errorBox, { backgroundColor: t.surface, borderColor: t.border }], children: /* @__PURE__ */ jsx17(Text15, { style: [styles14.errorText, { color: t.textMuted }], children: isPoolModeEnabled ? "You've already joined this pool." : "You've already joined this game." }) }),
|
|
5817
|
+
mutation.error && /* @__PURE__ */ jsx17(View15, { style: [styles14.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ jsx17(Text15, { style: [styles14.errorText, { color: t.errorText }], children: mutation.error.message }) }),
|
|
5818
|
+
/* @__PURE__ */ jsx17(
|
|
5531
5819
|
TouchableOpacity10,
|
|
5532
5820
|
{
|
|
5533
5821
|
style: [
|
|
5534
|
-
|
|
5822
|
+
styles14.ctaButton,
|
|
5535
5823
|
{ backgroundColor: canJoin ? t.accent : t.border }
|
|
5536
5824
|
],
|
|
5537
5825
|
disabled: !canJoin,
|
|
5538
5826
|
onPress: handleJoin,
|
|
5539
5827
|
activeOpacity: 0.8,
|
|
5540
|
-
children: isMutating ? /* @__PURE__ */
|
|
5541
|
-
/* @__PURE__ */
|
|
5542
|
-
/* @__PURE__ */
|
|
5543
|
-
] }) : mutation.status === "success" ? /* @__PURE__ */
|
|
5828
|
+
children: isMutating ? /* @__PURE__ */ jsxs14(View15, { style: styles14.ctaLoading, children: [
|
|
5829
|
+
/* @__PURE__ */ jsx17(ActivityIndicator8, { size: "small", color: "#FFFFFF" }),
|
|
5830
|
+
/* @__PURE__ */ jsx17(Text15, { style: styles14.ctaText, children: statusLabel })
|
|
5831
|
+
] }) : mutation.status === "success" ? /* @__PURE__ */ jsx17(Text15, { style: styles14.ctaText, children: isPoolModeEnabled ? "Joined!" : STATUS_LABELS3.success }) : /* @__PURE__ */ jsx17(Text15, { style: [styles14.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" })
|
|
5544
5832
|
}
|
|
5545
5833
|
)
|
|
5546
5834
|
] }) })
|
|
@@ -5564,32 +5852,32 @@ function TeamButton({
|
|
|
5564
5852
|
const [imgFailed, setImgFailed] = useState28(false);
|
|
5565
5853
|
const Img = ImageComponent || __require("react-native").Image;
|
|
5566
5854
|
const showImage = imageUrl && !imgFailed;
|
|
5567
|
-
return /* @__PURE__ */
|
|
5855
|
+
return /* @__PURE__ */ jsxs14(
|
|
5568
5856
|
TouchableOpacity10,
|
|
5569
5857
|
{
|
|
5570
|
-
style: [
|
|
5858
|
+
style: [styles14.teamOption, { borderColor: selected ? color : t.border, backgroundColor: selected ? color + "15" : t.background }],
|
|
5571
5859
|
onPress,
|
|
5572
5860
|
activeOpacity: 0.7,
|
|
5573
5861
|
children: [
|
|
5574
|
-
showImage ? /* @__PURE__ */
|
|
5575
|
-
/* @__PURE__ */
|
|
5576
|
-
/* @__PURE__ */
|
|
5862
|
+
showImage ? /* @__PURE__ */ jsx17(Img, { source: { uri: imageUrl }, style: styles14.teamLogo, resizeMode: "contain", onError: () => setImgFailed(true) }) : /* @__PURE__ */ jsx17(View15, { style: [styles14.teamLogo, styles14.teamLogoPlaceholder] }),
|
|
5863
|
+
/* @__PURE__ */ jsx17(Text15, { style: [styles14.teamName, { color: t.text }], numberOfLines: 1, children: name }),
|
|
5864
|
+
/* @__PURE__ */ jsxs14(Text15, { style: [styles14.teamOdds, { color }], children: [
|
|
5577
5865
|
odds,
|
|
5578
5866
|
"x"
|
|
5579
5867
|
] }),
|
|
5580
|
-
/* @__PURE__ */
|
|
5868
|
+
/* @__PURE__ */ jsxs14(Text15, { style: [styles14.teamBets, { color: t.textMuted }], children: [
|
|
5581
5869
|
bets,
|
|
5582
5870
|
" ",
|
|
5583
5871
|
bets === 1 ? "bet" : "bets"
|
|
5584
5872
|
] }),
|
|
5585
|
-
selected && /* @__PURE__ */
|
|
5873
|
+
selected && /* @__PURE__ */ jsx17(View15, { style: [styles14.teamBadge, { backgroundColor: color }], children: /* @__PURE__ */ jsx17(Text15, { style: styles14.teamBadgeText, children: "Selected" }) })
|
|
5586
5874
|
]
|
|
5587
5875
|
}
|
|
5588
5876
|
);
|
|
5589
5877
|
}
|
|
5590
|
-
var
|
|
5878
|
+
var styles14 = StyleSheet15.create({
|
|
5591
5879
|
overlay: {
|
|
5592
|
-
...
|
|
5880
|
+
...StyleSheet15.absoluteFillObject,
|
|
5593
5881
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
5594
5882
|
},
|
|
5595
5883
|
overlayTap: {
|
|
@@ -5633,6 +5921,67 @@ var styles13 = StyleSheet14.create({
|
|
|
5633
5921
|
fontSize: 20,
|
|
5634
5922
|
padding: 4
|
|
5635
5923
|
},
|
|
5924
|
+
// Bettors row
|
|
5925
|
+
bettorsSection: {
|
|
5926
|
+
paddingBottom: 12,
|
|
5927
|
+
gap: 8
|
|
5928
|
+
},
|
|
5929
|
+
bettorsLabel: {
|
|
5930
|
+
fontSize: 12,
|
|
5931
|
+
fontWeight: "600"
|
|
5932
|
+
},
|
|
5933
|
+
bettorsRow: {
|
|
5934
|
+
flexDirection: "row",
|
|
5935
|
+
alignItems: "center",
|
|
5936
|
+
gap: 4
|
|
5937
|
+
},
|
|
5938
|
+
bettorCircle: {
|
|
5939
|
+
width: 28,
|
|
5940
|
+
height: 28,
|
|
5941
|
+
borderRadius: 14,
|
|
5942
|
+
alignItems: "center",
|
|
5943
|
+
justifyContent: "center",
|
|
5944
|
+
overflow: "hidden"
|
|
5945
|
+
},
|
|
5946
|
+
bettorImg: {
|
|
5947
|
+
width: 28,
|
|
5948
|
+
height: 28,
|
|
5949
|
+
borderRadius: 14
|
|
5950
|
+
},
|
|
5951
|
+
bettorInitial: {
|
|
5952
|
+
color: "#FFF",
|
|
5953
|
+
fontSize: 11,
|
|
5954
|
+
fontWeight: "800"
|
|
5955
|
+
},
|
|
5956
|
+
bettorOverflow: {
|
|
5957
|
+
color: "#8E8E93",
|
|
5958
|
+
fontSize: 10,
|
|
5959
|
+
fontWeight: "700"
|
|
5960
|
+
},
|
|
5961
|
+
// Success overlay
|
|
5962
|
+
successOverlay: {
|
|
5963
|
+
...StyleSheet15.absoluteFillObject,
|
|
5964
|
+
zIndex: 100,
|
|
5965
|
+
alignItems: "center",
|
|
5966
|
+
justifyContent: "center",
|
|
5967
|
+
backgroundColor: "rgba(0,0,0,0.85)"
|
|
5968
|
+
},
|
|
5969
|
+
successContent: {
|
|
5970
|
+
alignItems: "center",
|
|
5971
|
+
gap: 12
|
|
5972
|
+
},
|
|
5973
|
+
successEmoji: {
|
|
5974
|
+
fontSize: 64
|
|
5975
|
+
},
|
|
5976
|
+
successTitle: {
|
|
5977
|
+
color: "#FFFFFF",
|
|
5978
|
+
fontSize: 28,
|
|
5979
|
+
fontWeight: "900"
|
|
5980
|
+
},
|
|
5981
|
+
successSub: {
|
|
5982
|
+
color: "#8E8E93",
|
|
5983
|
+
fontSize: 16
|
|
5984
|
+
},
|
|
5636
5985
|
section: {
|
|
5637
5986
|
gap: 12,
|
|
5638
5987
|
paddingTop: 8
|
|
@@ -5645,8 +5994,11 @@ var styles13 = StyleSheet14.create({
|
|
|
5645
5994
|
flexDirection: "row",
|
|
5646
5995
|
gap: 12
|
|
5647
5996
|
},
|
|
5997
|
+
sliderSection: {
|
|
5998
|
+
marginTop: 16
|
|
5999
|
+
},
|
|
5648
6000
|
summaryCard: {
|
|
5649
|
-
marginTop:
|
|
6001
|
+
marginTop: 12,
|
|
5650
6002
|
borderRadius: 16,
|
|
5651
6003
|
borderWidth: 1,
|
|
5652
6004
|
overflow: "hidden"
|
|
@@ -5738,19 +6090,19 @@ var styles13 = StyleSheet14.create({
|
|
|
5738
6090
|
});
|
|
5739
6091
|
|
|
5740
6092
|
// src/ui/game/ClaimPrizeSheet.tsx
|
|
5741
|
-
import { useState as useState29, useEffect as useEffect18, useRef as
|
|
6093
|
+
import { useState as useState29, useEffect as useEffect18, useRef as useRef11, useCallback as useCallback25 } from "react";
|
|
5742
6094
|
import {
|
|
5743
|
-
View as
|
|
5744
|
-
Text as
|
|
6095
|
+
View as View16,
|
|
6096
|
+
Text as Text16,
|
|
5745
6097
|
TouchableOpacity as TouchableOpacity11,
|
|
5746
6098
|
ActivityIndicator as ActivityIndicator9,
|
|
5747
6099
|
Modal as Modal4,
|
|
5748
6100
|
Animated as Animated5,
|
|
5749
|
-
StyleSheet as
|
|
6101
|
+
StyleSheet as StyleSheet16,
|
|
5750
6102
|
KeyboardAvoidingView as KeyboardAvoidingView5,
|
|
5751
|
-
Platform as
|
|
6103
|
+
Platform as Platform9
|
|
5752
6104
|
} from "react-native";
|
|
5753
|
-
import { jsx as
|
|
6105
|
+
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5754
6106
|
var STATUS_LABELS4 = {
|
|
5755
6107
|
building: "Building transaction...",
|
|
5756
6108
|
signing: "Approve in wallet...",
|
|
@@ -5769,9 +6121,9 @@ function ClaimPrizeSheet({
|
|
|
5769
6121
|
const t = useDubsTheme();
|
|
5770
6122
|
const { wallet } = useDubs();
|
|
5771
6123
|
const mutation = useClaim();
|
|
5772
|
-
const overlayOpacity =
|
|
5773
|
-
const celebrationScale =
|
|
5774
|
-
const celebrationOpacity =
|
|
6124
|
+
const overlayOpacity = useRef11(new Animated5.Value(0)).current;
|
|
6125
|
+
const celebrationScale = useRef11(new Animated5.Value(0)).current;
|
|
6126
|
+
const celebrationOpacity = useRef11(new Animated5.Value(0)).current;
|
|
5775
6127
|
const [showCelebration, setShowCelebration] = useState29(false);
|
|
5776
6128
|
useEffect18(() => {
|
|
5777
6129
|
Animated5.timing(overlayOpacity, {
|
|
@@ -5818,7 +6170,7 @@ function ClaimPrizeSheet({
|
|
|
5818
6170
|
}, [mutation.status, mutation.error]);
|
|
5819
6171
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
5820
6172
|
const canClaim = !isMutating && mutation.status !== "success" && !!wallet.publicKey;
|
|
5821
|
-
const handleClaim =
|
|
6173
|
+
const handleClaim = useCallback25(async () => {
|
|
5822
6174
|
if (!wallet.publicKey) return;
|
|
5823
6175
|
try {
|
|
5824
6176
|
await mutation.execute({
|
|
@@ -5830,7 +6182,7 @@ function ClaimPrizeSheet({
|
|
|
5830
6182
|
}
|
|
5831
6183
|
}, [wallet.publicKey, mutation.execute, gameId, prizeAmount]);
|
|
5832
6184
|
const statusLabel = STATUS_LABELS4[mutation.status] || "";
|
|
5833
|
-
return /* @__PURE__ */
|
|
6185
|
+
return /* @__PURE__ */ jsxs15(
|
|
5834
6186
|
Modal4,
|
|
5835
6187
|
{
|
|
5836
6188
|
visible,
|
|
@@ -5838,54 +6190,54 @@ function ClaimPrizeSheet({
|
|
|
5838
6190
|
transparent: true,
|
|
5839
6191
|
onRequestClose: onDismiss,
|
|
5840
6192
|
children: [
|
|
5841
|
-
/* @__PURE__ */
|
|
5842
|
-
/* @__PURE__ */
|
|
6193
|
+
/* @__PURE__ */ jsx18(Animated5.View, { style: [styles15.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ jsx18(TouchableOpacity11, { style: styles15.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
6194
|
+
/* @__PURE__ */ jsx18(
|
|
5843
6195
|
KeyboardAvoidingView5,
|
|
5844
6196
|
{
|
|
5845
|
-
style:
|
|
5846
|
-
behavior:
|
|
5847
|
-
children: /* @__PURE__ */
|
|
5848
|
-
/* @__PURE__ */
|
|
5849
|
-
/* @__PURE__ */
|
|
5850
|
-
/* @__PURE__ */
|
|
5851
|
-
/* @__PURE__ */
|
|
6197
|
+
style: styles15.keyboardView,
|
|
6198
|
+
behavior: Platform9.OS === "ios" ? "padding" : void 0,
|
|
6199
|
+
children: /* @__PURE__ */ jsx18(View16, { style: styles15.sheetPositioner, children: /* @__PURE__ */ jsxs15(View16, { style: [styles15.sheet, { backgroundColor: t.background }], children: [
|
|
6200
|
+
/* @__PURE__ */ jsx18(View16, { style: styles15.handleRow, children: /* @__PURE__ */ jsx18(View16, { style: [styles15.handle, { backgroundColor: t.textMuted }] }) }),
|
|
6201
|
+
/* @__PURE__ */ jsxs15(View16, { style: styles15.header, children: [
|
|
6202
|
+
/* @__PURE__ */ jsx18(Text16, { style: [styles15.headerTitle, { color: t.text }], children: showCelebration ? isRefund ? "Refund Claimed!" : "Prize Claimed!" : isRefund ? "Claim Refund" : "Claim Prize" }),
|
|
6203
|
+
/* @__PURE__ */ jsx18(TouchableOpacity11, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ jsx18(Text16, { style: [styles15.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
5852
6204
|
] }),
|
|
5853
|
-
showCelebration && /* @__PURE__ */
|
|
6205
|
+
showCelebration && /* @__PURE__ */ jsxs15(
|
|
5854
6206
|
Animated5.View,
|
|
5855
6207
|
{
|
|
5856
6208
|
style: [
|
|
5857
|
-
|
|
6209
|
+
styles15.celebrationContainer,
|
|
5858
6210
|
{
|
|
5859
6211
|
opacity: celebrationOpacity,
|
|
5860
6212
|
transform: [{ scale: celebrationScale }]
|
|
5861
6213
|
}
|
|
5862
6214
|
],
|
|
5863
6215
|
children: [
|
|
5864
|
-
/* @__PURE__ */
|
|
5865
|
-
/* @__PURE__ */
|
|
6216
|
+
/* @__PURE__ */ jsx18(Text16, { style: styles15.celebrationEmoji, children: "\u{1F3C6}" }),
|
|
6217
|
+
/* @__PURE__ */ jsxs15(Text16, { style: [styles15.celebrationText, { color: t.success }], children: [
|
|
5866
6218
|
"+",
|
|
5867
6219
|
prizeAmount,
|
|
5868
6220
|
" SOL"
|
|
5869
6221
|
] }),
|
|
5870
|
-
/* @__PURE__ */
|
|
6222
|
+
/* @__PURE__ */ jsx18(Text16, { style: [styles15.celebrationSubtext, { color: t.textMuted }], children: isRefund ? "Refund sent to your wallet" : "Winnings sent to your wallet" })
|
|
5871
6223
|
]
|
|
5872
6224
|
}
|
|
5873
6225
|
),
|
|
5874
|
-
!showCelebration && /* @__PURE__ */
|
|
5875
|
-
/* @__PURE__ */
|
|
5876
|
-
/* @__PURE__ */
|
|
5877
|
-
/* @__PURE__ */
|
|
6226
|
+
!showCelebration && /* @__PURE__ */ jsxs15(View16, { style: [styles15.summaryCard, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
6227
|
+
/* @__PURE__ */ jsxs15(View16, { style: styles15.summaryRow, children: [
|
|
6228
|
+
/* @__PURE__ */ jsx18(Text16, { style: [styles15.summaryLabel, { color: t.textMuted }], children: isRefund ? "Refund" : "Prize" }),
|
|
6229
|
+
/* @__PURE__ */ jsxs15(Text16, { style: [styles15.summaryValue, { color: t.success }], children: [
|
|
5878
6230
|
prizeAmount,
|
|
5879
6231
|
" SOL"
|
|
5880
6232
|
] })
|
|
5881
6233
|
] }),
|
|
5882
|
-
/* @__PURE__ */
|
|
5883
|
-
/* @__PURE__ */
|
|
5884
|
-
/* @__PURE__ */
|
|
5885
|
-
/* @__PURE__ */
|
|
5886
|
-
|
|
6234
|
+
/* @__PURE__ */ jsx18(View16, { style: [styles15.summarySep, { backgroundColor: t.border }] }),
|
|
6235
|
+
/* @__PURE__ */ jsxs15(View16, { style: styles15.summaryRow, children: [
|
|
6236
|
+
/* @__PURE__ */ jsx18(Text16, { style: [styles15.summaryLabel, { color: t.textMuted }], children: "Game" }),
|
|
6237
|
+
/* @__PURE__ */ jsxs15(
|
|
6238
|
+
Text16,
|
|
5887
6239
|
{
|
|
5888
|
-
style: [
|
|
6240
|
+
style: [styles15.summaryValue, { color: t.text }],
|
|
5889
6241
|
numberOfLines: 1,
|
|
5890
6242
|
children: [
|
|
5891
6243
|
gameId.slice(0, 8),
|
|
@@ -5896,21 +6248,21 @@ function ClaimPrizeSheet({
|
|
|
5896
6248
|
)
|
|
5897
6249
|
] })
|
|
5898
6250
|
] }),
|
|
5899
|
-
mutation.error && /* @__PURE__ */
|
|
5900
|
-
!showCelebration && /* @__PURE__ */
|
|
6251
|
+
mutation.error && /* @__PURE__ */ jsx18(View16, { style: [styles15.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ jsx18(Text16, { style: [styles15.errorText, { color: t.errorText }], children: mutation.error.message }) }),
|
|
6252
|
+
!showCelebration && /* @__PURE__ */ jsx18(
|
|
5901
6253
|
TouchableOpacity11,
|
|
5902
6254
|
{
|
|
5903
6255
|
style: [
|
|
5904
|
-
|
|
6256
|
+
styles15.ctaButton,
|
|
5905
6257
|
{ backgroundColor: canClaim ? t.accent : t.border }
|
|
5906
6258
|
],
|
|
5907
6259
|
disabled: !canClaim,
|
|
5908
6260
|
onPress: handleClaim,
|
|
5909
6261
|
activeOpacity: 0.8,
|
|
5910
|
-
children: isMutating ? /* @__PURE__ */
|
|
5911
|
-
/* @__PURE__ */
|
|
5912
|
-
/* @__PURE__ */
|
|
5913
|
-
] }) : /* @__PURE__ */
|
|
6262
|
+
children: isMutating ? /* @__PURE__ */ jsxs15(View16, { style: styles15.ctaLoading, children: [
|
|
6263
|
+
/* @__PURE__ */ jsx18(ActivityIndicator9, { size: "small", color: "#FFFFFF" }),
|
|
6264
|
+
/* @__PURE__ */ jsx18(Text16, { style: styles15.ctaText, children: statusLabel })
|
|
6265
|
+
] }) : /* @__PURE__ */ jsxs15(Text16, { style: [styles15.ctaText, !canClaim && { opacity: 0.5 }], children: [
|
|
5914
6266
|
isRefund ? "Claim Refund" : "Claim Prize",
|
|
5915
6267
|
" \u2014 ",
|
|
5916
6268
|
prizeAmount,
|
|
@@ -5918,7 +6270,7 @@ function ClaimPrizeSheet({
|
|
|
5918
6270
|
] })
|
|
5919
6271
|
}
|
|
5920
6272
|
),
|
|
5921
|
-
mutation.data?.explorerUrl && /* @__PURE__ */
|
|
6273
|
+
mutation.data?.explorerUrl && /* @__PURE__ */ jsx18(Text16, { style: [styles15.explorerHint, { color: t.textMuted }], children: "View on Solscan" })
|
|
5922
6274
|
] }) })
|
|
5923
6275
|
}
|
|
5924
6276
|
)
|
|
@@ -5926,9 +6278,9 @@ function ClaimPrizeSheet({
|
|
|
5926
6278
|
}
|
|
5927
6279
|
);
|
|
5928
6280
|
}
|
|
5929
|
-
var
|
|
6281
|
+
var styles15 = StyleSheet16.create({
|
|
5930
6282
|
overlay: {
|
|
5931
|
-
...
|
|
6283
|
+
...StyleSheet16.absoluteFillObject,
|
|
5932
6284
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
5933
6285
|
},
|
|
5934
6286
|
overlayTap: {
|
|
@@ -6051,9 +6403,9 @@ var styles14 = StyleSheet15.create({
|
|
|
6051
6403
|
});
|
|
6052
6404
|
|
|
6053
6405
|
// src/ui/game/ClaimButton.tsx
|
|
6054
|
-
import { useState as useState30, useMemo as useMemo10, useCallback as
|
|
6055
|
-
import { StyleSheet as
|
|
6056
|
-
import { Fragment as Fragment5, jsx as
|
|
6406
|
+
import { useState as useState30, useMemo as useMemo10, useCallback as useCallback26 } from "react";
|
|
6407
|
+
import { StyleSheet as StyleSheet17, Text as Text17, TouchableOpacity as TouchableOpacity12 } from "react-native";
|
|
6408
|
+
import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6057
6409
|
function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
6058
6410
|
const t = useDubsTheme();
|
|
6059
6411
|
const { wallet } = useDubs();
|
|
@@ -6070,7 +6422,7 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
6070
6422
|
const isWinner = isResolved && myBet != null && myBet.team === game.data?.winnerSide;
|
|
6071
6423
|
const isEligible = myBet != null && isResolved && (isWinner || isRefund);
|
|
6072
6424
|
const prizeAmount = isRefund ? myBet?.amount ?? 0 : game.data?.totalPool ?? 0;
|
|
6073
|
-
const handleSuccess =
|
|
6425
|
+
const handleSuccess = useCallback26(
|
|
6074
6426
|
(result) => {
|
|
6075
6427
|
claimStatus.refetch();
|
|
6076
6428
|
onSuccess?.(result);
|
|
@@ -6083,13 +6435,13 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
6083
6435
|
}
|
|
6084
6436
|
const label = isRefund ? "Refund" : "Prize";
|
|
6085
6437
|
if (claimStatus.hasClaimed) {
|
|
6086
|
-
return /* @__PURE__ */
|
|
6438
|
+
return /* @__PURE__ */ jsx19(
|
|
6087
6439
|
TouchableOpacity12,
|
|
6088
6440
|
{
|
|
6089
|
-
style: [
|
|
6441
|
+
style: [styles16.badge, { borderColor: t.accent }, style],
|
|
6090
6442
|
activeOpacity: 1,
|
|
6091
6443
|
disabled: true,
|
|
6092
|
-
children: /* @__PURE__ */
|
|
6444
|
+
children: /* @__PURE__ */ jsxs16(Text17, { style: [styles16.badgeText, { color: t.accent }], children: [
|
|
6093
6445
|
label,
|
|
6094
6446
|
" Claimed!"
|
|
6095
6447
|
] })
|
|
@@ -6099,14 +6451,14 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
6099
6451
|
if (!isEligible) {
|
|
6100
6452
|
return null;
|
|
6101
6453
|
}
|
|
6102
|
-
return /* @__PURE__ */
|
|
6103
|
-
/* @__PURE__ */
|
|
6454
|
+
return /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
6455
|
+
/* @__PURE__ */ jsx19(
|
|
6104
6456
|
TouchableOpacity12,
|
|
6105
6457
|
{
|
|
6106
|
-
style: [
|
|
6458
|
+
style: [styles16.button, { backgroundColor: t.accent }, style],
|
|
6107
6459
|
activeOpacity: 0.8,
|
|
6108
6460
|
onPress: () => setSheetVisible(true),
|
|
6109
|
-
children: /* @__PURE__ */
|
|
6461
|
+
children: /* @__PURE__ */ jsxs16(Text17, { style: styles16.buttonText, children: [
|
|
6110
6462
|
"Claim ",
|
|
6111
6463
|
label,
|
|
6112
6464
|
" \u2014 ",
|
|
@@ -6115,7 +6467,7 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
6115
6467
|
] })
|
|
6116
6468
|
}
|
|
6117
6469
|
),
|
|
6118
|
-
/* @__PURE__ */
|
|
6470
|
+
/* @__PURE__ */ jsx19(
|
|
6119
6471
|
ClaimPrizeSheet,
|
|
6120
6472
|
{
|
|
6121
6473
|
visible: sheetVisible,
|
|
@@ -6129,7 +6481,7 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
6129
6481
|
)
|
|
6130
6482
|
] });
|
|
6131
6483
|
}
|
|
6132
|
-
var
|
|
6484
|
+
var styles16 = StyleSheet17.create({
|
|
6133
6485
|
button: {
|
|
6134
6486
|
height: 52,
|
|
6135
6487
|
borderRadius: 14,
|
|
@@ -6157,19 +6509,19 @@ var styles15 = StyleSheet16.create({
|
|
|
6157
6509
|
});
|
|
6158
6510
|
|
|
6159
6511
|
// src/ui/game/EnterArcadePoolSheet.tsx
|
|
6160
|
-
import { useEffect as useEffect19, useRef as
|
|
6512
|
+
import { useEffect as useEffect19, useRef as useRef12, useCallback as useCallback27 } from "react";
|
|
6161
6513
|
import {
|
|
6162
|
-
View as
|
|
6163
|
-
Text as
|
|
6514
|
+
View as View17,
|
|
6515
|
+
Text as Text18,
|
|
6164
6516
|
TouchableOpacity as TouchableOpacity13,
|
|
6165
6517
|
ActivityIndicator as ActivityIndicator10,
|
|
6166
6518
|
Modal as Modal5,
|
|
6167
6519
|
Animated as Animated6,
|
|
6168
|
-
StyleSheet as
|
|
6520
|
+
StyleSheet as StyleSheet18,
|
|
6169
6521
|
KeyboardAvoidingView as KeyboardAvoidingView6,
|
|
6170
|
-
Platform as
|
|
6522
|
+
Platform as Platform10
|
|
6171
6523
|
} from "react-native";
|
|
6172
|
-
import { Fragment as Fragment6, jsx as
|
|
6524
|
+
import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6173
6525
|
var STATUS_LABELS5 = {
|
|
6174
6526
|
building: "Building transaction...",
|
|
6175
6527
|
signing: "Approve in wallet...",
|
|
@@ -6188,7 +6540,7 @@ function EnterArcadePoolSheet({
|
|
|
6188
6540
|
const t = useDubsTheme();
|
|
6189
6541
|
const { wallet } = useDubs();
|
|
6190
6542
|
const mutation = useEnterArcadePool();
|
|
6191
|
-
const overlayOpacity =
|
|
6543
|
+
const overlayOpacity = useRef12(new Animated6.Value(0)).current;
|
|
6192
6544
|
useEffect19(() => {
|
|
6193
6545
|
Animated6.timing(overlayOpacity, {
|
|
6194
6546
|
toValue: visible ? 1 : 0,
|
|
@@ -6222,7 +6574,7 @@ function EnterArcadePoolSheet({
|
|
|
6222
6574
|
const potSol = (pool.buy_in_lamports * Number(totalBuyIns) / 1e9).toFixed(4);
|
|
6223
6575
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
6224
6576
|
const canJoin = !isMutating && mutation.status !== "success";
|
|
6225
|
-
const handleJoin =
|
|
6577
|
+
const handleJoin = useCallback27(async () => {
|
|
6226
6578
|
if (!wallet.publicKey) return;
|
|
6227
6579
|
try {
|
|
6228
6580
|
await mutation.execute(pool.id);
|
|
@@ -6234,7 +6586,7 @@ function EnterArcadePoolSheet({
|
|
|
6234
6586
|
const headerTitle = isRejoin ? "Play Again" : "Join Pool";
|
|
6235
6587
|
const ctaLabel = isRejoin ? `Play Again \u2014 ${buyInSol} SOL` : `Join Pool \u2014 ${buyInSol} SOL`;
|
|
6236
6588
|
const successLabel = isRejoin ? "Lives refilled!" : "Joined!";
|
|
6237
|
-
return /* @__PURE__ */
|
|
6589
|
+
return /* @__PURE__ */ jsxs17(
|
|
6238
6590
|
Modal5,
|
|
6239
6591
|
{
|
|
6240
6592
|
visible,
|
|
@@ -6242,68 +6594,68 @@ function EnterArcadePoolSheet({
|
|
|
6242
6594
|
transparent: true,
|
|
6243
6595
|
onRequestClose: onDismiss,
|
|
6244
6596
|
children: [
|
|
6245
|
-
/* @__PURE__ */
|
|
6246
|
-
/* @__PURE__ */
|
|
6597
|
+
/* @__PURE__ */ jsx20(Animated6.View, { style: [styles17.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ jsx20(TouchableOpacity13, { style: styles17.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
6598
|
+
/* @__PURE__ */ jsx20(
|
|
6247
6599
|
KeyboardAvoidingView6,
|
|
6248
6600
|
{
|
|
6249
|
-
style:
|
|
6250
|
-
behavior:
|
|
6251
|
-
children: /* @__PURE__ */
|
|
6252
|
-
/* @__PURE__ */
|
|
6253
|
-
/* @__PURE__ */
|
|
6254
|
-
/* @__PURE__ */
|
|
6255
|
-
/* @__PURE__ */
|
|
6601
|
+
style: styles17.keyboardView,
|
|
6602
|
+
behavior: Platform10.OS === "ios" ? "padding" : void 0,
|
|
6603
|
+
children: /* @__PURE__ */ jsx20(View17, { style: styles17.sheetPositioner, children: /* @__PURE__ */ jsxs17(View17, { style: [styles17.sheet, { backgroundColor: t.background }], children: [
|
|
6604
|
+
/* @__PURE__ */ jsx20(View17, { style: styles17.handleRow, children: /* @__PURE__ */ jsx20(View17, { style: [styles17.handle, { backgroundColor: t.textMuted }] }) }),
|
|
6605
|
+
/* @__PURE__ */ jsxs17(View17, { style: styles17.header, children: [
|
|
6606
|
+
/* @__PURE__ */ jsx20(Text18, { style: [styles17.headerTitle, { color: t.text }], children: headerTitle }),
|
|
6607
|
+
/* @__PURE__ */ jsx20(TouchableOpacity13, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ jsx20(Text18, { style: [styles17.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
6256
6608
|
] }),
|
|
6257
|
-
/* @__PURE__ */
|
|
6258
|
-
/* @__PURE__ */
|
|
6259
|
-
/* @__PURE__ */
|
|
6260
|
-
/* @__PURE__ */
|
|
6261
|
-
/* @__PURE__ */
|
|
6609
|
+
/* @__PURE__ */ jsx20(Text18, { style: [styles17.poolName, { color: t.textSecondary }], children: pool.name }),
|
|
6610
|
+
/* @__PURE__ */ jsxs17(View17, { style: [styles17.summaryCard, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
6611
|
+
/* @__PURE__ */ jsxs17(View17, { style: styles17.summaryRow, children: [
|
|
6612
|
+
/* @__PURE__ */ jsx20(Text18, { style: [styles17.summaryLabel, { color: t.textMuted }], children: "Buy-in" }),
|
|
6613
|
+
/* @__PURE__ */ jsxs17(Text18, { style: [styles17.summaryValue, { color: t.text }], children: [
|
|
6262
6614
|
buyInSol,
|
|
6263
6615
|
" SOL"
|
|
6264
6616
|
] })
|
|
6265
6617
|
] }),
|
|
6266
|
-
/* @__PURE__ */
|
|
6267
|
-
/* @__PURE__ */
|
|
6268
|
-
/* @__PURE__ */
|
|
6269
|
-
/* @__PURE__ */
|
|
6618
|
+
/* @__PURE__ */ jsx20(View17, { style: [styles17.summarySep, { backgroundColor: t.border }] }),
|
|
6619
|
+
/* @__PURE__ */ jsxs17(View17, { style: styles17.summaryRow, children: [
|
|
6620
|
+
/* @__PURE__ */ jsx20(Text18, { style: [styles17.summaryLabel, { color: t.textMuted }], children: "Players in" }),
|
|
6621
|
+
/* @__PURE__ */ jsx20(Text18, { style: [styles17.summaryValue, { color: t.text }], children: totalPlayers })
|
|
6270
6622
|
] }),
|
|
6271
|
-
/* @__PURE__ */
|
|
6272
|
-
/* @__PURE__ */
|
|
6273
|
-
/* @__PURE__ */
|
|
6274
|
-
/* @__PURE__ */
|
|
6623
|
+
/* @__PURE__ */ jsx20(View17, { style: [styles17.summarySep, { backgroundColor: t.border }] }),
|
|
6624
|
+
/* @__PURE__ */ jsxs17(View17, { style: styles17.summaryRow, children: [
|
|
6625
|
+
/* @__PURE__ */ jsx20(Text18, { style: [styles17.summaryLabel, { color: t.textMuted }], children: "Current pot" }),
|
|
6626
|
+
/* @__PURE__ */ jsxs17(Text18, { style: [styles17.summaryValue, { color: t.success }], children: [
|
|
6275
6627
|
potSol,
|
|
6276
6628
|
" SOL"
|
|
6277
6629
|
] })
|
|
6278
6630
|
] }),
|
|
6279
|
-
/* @__PURE__ */
|
|
6280
|
-
/* @__PURE__ */
|
|
6281
|
-
/* @__PURE__ */
|
|
6282
|
-
/* @__PURE__ */
|
|
6631
|
+
/* @__PURE__ */ jsx20(View17, { style: [styles17.summarySep, { backgroundColor: t.border }] }),
|
|
6632
|
+
/* @__PURE__ */ jsxs17(View17, { style: styles17.summaryRow, children: [
|
|
6633
|
+
/* @__PURE__ */ jsx20(Text18, { style: [styles17.summaryLabel, { color: t.textMuted }], children: "Lives" }),
|
|
6634
|
+
/* @__PURE__ */ jsx20(Text18, { style: [styles17.summaryValue, { color: t.text }], children: pool.max_lives })
|
|
6283
6635
|
] }),
|
|
6284
|
-
topScore > 0 && /* @__PURE__ */
|
|
6285
|
-
/* @__PURE__ */
|
|
6286
|
-
/* @__PURE__ */
|
|
6287
|
-
/* @__PURE__ */
|
|
6288
|
-
/* @__PURE__ */
|
|
6636
|
+
topScore > 0 && /* @__PURE__ */ jsxs17(Fragment6, { children: [
|
|
6637
|
+
/* @__PURE__ */ jsx20(View17, { style: [styles17.summarySep, { backgroundColor: t.border }] }),
|
|
6638
|
+
/* @__PURE__ */ jsxs17(View17, { style: styles17.summaryRow, children: [
|
|
6639
|
+
/* @__PURE__ */ jsx20(Text18, { style: [styles17.summaryLabel, { color: t.textMuted }], children: "Top score" }),
|
|
6640
|
+
/* @__PURE__ */ jsx20(Text18, { style: [styles17.summaryValue, { color: t.text }], children: topScore })
|
|
6289
6641
|
] })
|
|
6290
6642
|
] })
|
|
6291
6643
|
] }),
|
|
6292
|
-
mutation.error && /* @__PURE__ */
|
|
6293
|
-
/* @__PURE__ */
|
|
6644
|
+
mutation.error && /* @__PURE__ */ jsx20(View17, { style: [styles17.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ jsx20(Text18, { style: [styles17.errorText, { color: t.errorText }], children: mutation.error.message }) }),
|
|
6645
|
+
/* @__PURE__ */ jsx20(
|
|
6294
6646
|
TouchableOpacity13,
|
|
6295
6647
|
{
|
|
6296
6648
|
style: [
|
|
6297
|
-
|
|
6649
|
+
styles17.ctaButton,
|
|
6298
6650
|
{ backgroundColor: canJoin ? t.accent : t.border }
|
|
6299
6651
|
],
|
|
6300
6652
|
disabled: !canJoin,
|
|
6301
6653
|
onPress: handleJoin,
|
|
6302
6654
|
activeOpacity: 0.8,
|
|
6303
|
-
children: isMutating ? /* @__PURE__ */
|
|
6304
|
-
/* @__PURE__ */
|
|
6305
|
-
/* @__PURE__ */
|
|
6306
|
-
] }) : mutation.status === "success" ? /* @__PURE__ */
|
|
6655
|
+
children: isMutating ? /* @__PURE__ */ jsxs17(View17, { style: styles17.ctaLoading, children: [
|
|
6656
|
+
/* @__PURE__ */ jsx20(ActivityIndicator10, { size: "small", color: "#FFFFFF" }),
|
|
6657
|
+
/* @__PURE__ */ jsx20(Text18, { style: styles17.ctaText, children: statusLabel })
|
|
6658
|
+
] }) : mutation.status === "success" ? /* @__PURE__ */ jsx20(Text18, { style: styles17.ctaText, children: successLabel }) : /* @__PURE__ */ jsx20(Text18, { style: [styles17.ctaText, !canJoin && { opacity: 0.5 }], children: ctaLabel })
|
|
6307
6659
|
}
|
|
6308
6660
|
)
|
|
6309
6661
|
] }) })
|
|
@@ -6313,9 +6665,9 @@ function EnterArcadePoolSheet({
|
|
|
6313
6665
|
}
|
|
6314
6666
|
);
|
|
6315
6667
|
}
|
|
6316
|
-
var
|
|
6668
|
+
var styles17 = StyleSheet18.create({
|
|
6317
6669
|
overlay: {
|
|
6318
|
-
...
|
|
6670
|
+
...StyleSheet18.absoluteFillObject,
|
|
6319
6671
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
6320
6672
|
},
|
|
6321
6673
|
overlayTap: { flex: 1 },
|
|
@@ -6373,25 +6725,25 @@ var styles16 = StyleSheet17.create({
|
|
|
6373
6725
|
});
|
|
6374
6726
|
|
|
6375
6727
|
// src/ui/game/ArcadeLeaderboardSheet.tsx
|
|
6376
|
-
import { useEffect as useEffect20, useRef as
|
|
6728
|
+
import { useEffect as useEffect20, useRef as useRef13 } from "react";
|
|
6377
6729
|
import {
|
|
6378
|
-
View as
|
|
6379
|
-
Text as
|
|
6730
|
+
View as View18,
|
|
6731
|
+
Text as Text19,
|
|
6380
6732
|
TouchableOpacity as TouchableOpacity14,
|
|
6381
6733
|
Modal as Modal6,
|
|
6382
6734
|
Animated as Animated7,
|
|
6383
|
-
StyleSheet as
|
|
6735
|
+
StyleSheet as StyleSheet19,
|
|
6384
6736
|
KeyboardAvoidingView as KeyboardAvoidingView7,
|
|
6385
|
-
Platform as
|
|
6386
|
-
Image as
|
|
6737
|
+
Platform as Platform11,
|
|
6738
|
+
Image as Image7,
|
|
6387
6739
|
FlatList
|
|
6388
6740
|
} from "react-native";
|
|
6389
|
-
import { jsx as
|
|
6741
|
+
import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6390
6742
|
function RankLabel({ index }) {
|
|
6391
|
-
if (index === 0) return /* @__PURE__ */
|
|
6392
|
-
if (index === 1) return /* @__PURE__ */
|
|
6393
|
-
if (index === 2) return /* @__PURE__ */
|
|
6394
|
-
return /* @__PURE__ */
|
|
6743
|
+
if (index === 0) return /* @__PURE__ */ jsx21(Text19, { style: styles18.rankEmoji, children: "\u{1F947}" });
|
|
6744
|
+
if (index === 1) return /* @__PURE__ */ jsx21(Text19, { style: styles18.rankEmoji, children: "\u{1F948}" });
|
|
6745
|
+
if (index === 2) return /* @__PURE__ */ jsx21(Text19, { style: styles18.rankEmoji, children: "\u{1F949}" });
|
|
6746
|
+
return /* @__PURE__ */ jsx21(Text19, { style: styles18.rankNum, children: index + 1 });
|
|
6395
6747
|
}
|
|
6396
6748
|
function ArcadeLeaderboardSheet({
|
|
6397
6749
|
visible,
|
|
@@ -6401,7 +6753,7 @@ function ArcadeLeaderboardSheet({
|
|
|
6401
6753
|
}) {
|
|
6402
6754
|
const t = useDubsTheme();
|
|
6403
6755
|
const { pool, leaderboard, stats, loading, refetch } = useArcadePool(poolId);
|
|
6404
|
-
const overlayOpacity =
|
|
6756
|
+
const overlayOpacity = useRef13(new Animated7.Value(0)).current;
|
|
6405
6757
|
useEffect20(() => {
|
|
6406
6758
|
Animated7.timing(overlayOpacity, {
|
|
6407
6759
|
toValue: visible ? 1 : 0,
|
|
@@ -6414,32 +6766,32 @@ function ArcadeLeaderboardSheet({
|
|
|
6414
6766
|
}, [visible]);
|
|
6415
6767
|
const renderItem = ({ item, index }) => {
|
|
6416
6768
|
const isMe = highlightWallet && item.wallet_address === highlightWallet;
|
|
6417
|
-
return /* @__PURE__ */
|
|
6418
|
-
|
|
6769
|
+
return /* @__PURE__ */ jsxs18(
|
|
6770
|
+
View18,
|
|
6419
6771
|
{
|
|
6420
6772
|
style: [
|
|
6421
|
-
|
|
6773
|
+
styles18.row,
|
|
6422
6774
|
{ backgroundColor: isMe ? `${t.accent}18` : index % 2 === 0 ? t.surface : "transparent" },
|
|
6423
6775
|
isMe ? { borderWidth: 1, borderColor: t.accent } : void 0
|
|
6424
6776
|
],
|
|
6425
6777
|
children: [
|
|
6426
|
-
/* @__PURE__ */
|
|
6427
|
-
item.avatar ? /* @__PURE__ */
|
|
6428
|
-
/* @__PURE__ */
|
|
6429
|
-
/* @__PURE__ */
|
|
6430
|
-
/* @__PURE__ */
|
|
6778
|
+
/* @__PURE__ */ jsx21(View18, { style: styles18.rankCol, children: /* @__PURE__ */ jsx21(RankLabel, { index }) }),
|
|
6779
|
+
item.avatar ? /* @__PURE__ */ jsx21(Image7, { source: { uri: ensurePngAvatar(item.avatar) }, style: styles18.avatar }) : /* @__PURE__ */ jsx21(View18, { style: [styles18.avatar, { backgroundColor: t.border }] }),
|
|
6780
|
+
/* @__PURE__ */ jsxs18(View18, { style: styles18.nameCol, children: [
|
|
6781
|
+
/* @__PURE__ */ jsx21(Text19, { style: [styles18.name, { color: t.text }], numberOfLines: 1, children: item.username || `${item.wallet_address.slice(0, 4)}...${item.wallet_address.slice(-4)}` }),
|
|
6782
|
+
/* @__PURE__ */ jsxs18(Text19, { style: [styles18.lives, { color: t.textMuted }], children: [
|
|
6431
6783
|
item.lives_used,
|
|
6432
6784
|
" ",
|
|
6433
6785
|
item.lives_used === 1 ? "life" : "lives",
|
|
6434
6786
|
" used"
|
|
6435
6787
|
] })
|
|
6436
6788
|
] }),
|
|
6437
|
-
/* @__PURE__ */
|
|
6789
|
+
/* @__PURE__ */ jsx21(Text19, { style: [styles18.score, { color: t.accent }], children: item.best_score })
|
|
6438
6790
|
]
|
|
6439
6791
|
}
|
|
6440
6792
|
);
|
|
6441
6793
|
};
|
|
6442
|
-
return /* @__PURE__ */
|
|
6794
|
+
return /* @__PURE__ */ jsxs18(
|
|
6443
6795
|
Modal6,
|
|
6444
6796
|
{
|
|
6445
6797
|
visible,
|
|
@@ -6447,46 +6799,46 @@ function ArcadeLeaderboardSheet({
|
|
|
6447
6799
|
transparent: true,
|
|
6448
6800
|
onRequestClose: onDismiss,
|
|
6449
6801
|
children: [
|
|
6450
|
-
/* @__PURE__ */
|
|
6451
|
-
/* @__PURE__ */
|
|
6802
|
+
/* @__PURE__ */ jsx21(Animated7.View, { style: [styles18.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ jsx21(TouchableOpacity14, { style: styles18.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
6803
|
+
/* @__PURE__ */ jsx21(
|
|
6452
6804
|
KeyboardAvoidingView7,
|
|
6453
6805
|
{
|
|
6454
|
-
style:
|
|
6455
|
-
behavior:
|
|
6456
|
-
children: /* @__PURE__ */
|
|
6457
|
-
/* @__PURE__ */
|
|
6458
|
-
/* @__PURE__ */
|
|
6459
|
-
/* @__PURE__ */
|
|
6460
|
-
/* @__PURE__ */
|
|
6461
|
-
pool && /* @__PURE__ */
|
|
6806
|
+
style: styles18.keyboardView,
|
|
6807
|
+
behavior: Platform11.OS === "ios" ? "padding" : void 0,
|
|
6808
|
+
children: /* @__PURE__ */ jsx21(View18, { style: styles18.sheetPositioner, children: /* @__PURE__ */ jsxs18(View18, { style: [styles18.sheet, { backgroundColor: t.background }], children: [
|
|
6809
|
+
/* @__PURE__ */ jsx21(View18, { style: styles18.handleRow, children: /* @__PURE__ */ jsx21(View18, { style: [styles18.handle, { backgroundColor: t.textMuted }] }) }),
|
|
6810
|
+
/* @__PURE__ */ jsxs18(View18, { style: styles18.header, children: [
|
|
6811
|
+
/* @__PURE__ */ jsxs18(View18, { children: [
|
|
6812
|
+
/* @__PURE__ */ jsx21(Text19, { style: [styles18.headerTitle, { color: t.text }], children: "Leaderboard" }),
|
|
6813
|
+
pool && /* @__PURE__ */ jsx21(Text19, { style: [styles18.poolName, { color: t.textMuted }], children: pool.name })
|
|
6462
6814
|
] }),
|
|
6463
|
-
/* @__PURE__ */
|
|
6815
|
+
/* @__PURE__ */ jsx21(TouchableOpacity14, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ jsx21(Text19, { style: [styles18.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
6464
6816
|
] }),
|
|
6465
|
-
stats && /* @__PURE__ */
|
|
6466
|
-
/* @__PURE__ */
|
|
6467
|
-
/* @__PURE__ */
|
|
6468
|
-
/* @__PURE__ */
|
|
6817
|
+
stats && /* @__PURE__ */ jsxs18(View18, { style: [styles18.statsBar, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
6818
|
+
/* @__PURE__ */ jsxs18(View18, { style: styles18.statItem, children: [
|
|
6819
|
+
/* @__PURE__ */ jsx21(Text19, { style: [styles18.statValue, { color: t.text }], children: stats.total_entries }),
|
|
6820
|
+
/* @__PURE__ */ jsx21(Text19, { style: [styles18.statLabel, { color: t.textMuted }], children: "Players" })
|
|
6469
6821
|
] }),
|
|
6470
|
-
/* @__PURE__ */
|
|
6471
|
-
/* @__PURE__ */
|
|
6472
|
-
/* @__PURE__ */
|
|
6473
|
-
/* @__PURE__ */
|
|
6822
|
+
/* @__PURE__ */ jsx21(View18, { style: [styles18.statDivider, { backgroundColor: t.border }] }),
|
|
6823
|
+
/* @__PURE__ */ jsxs18(View18, { style: styles18.statItem, children: [
|
|
6824
|
+
/* @__PURE__ */ jsx21(Text19, { style: [styles18.statValue, { color: t.accent }], children: stats.top_score }),
|
|
6825
|
+
/* @__PURE__ */ jsx21(Text19, { style: [styles18.statLabel, { color: t.textMuted }], children: "Top Score" })
|
|
6474
6826
|
] }),
|
|
6475
|
-
/* @__PURE__ */
|
|
6476
|
-
/* @__PURE__ */
|
|
6477
|
-
/* @__PURE__ */
|
|
6478
|
-
/* @__PURE__ */
|
|
6827
|
+
/* @__PURE__ */ jsx21(View18, { style: [styles18.statDivider, { backgroundColor: t.border }] }),
|
|
6828
|
+
/* @__PURE__ */ jsxs18(View18, { style: styles18.statItem, children: [
|
|
6829
|
+
/* @__PURE__ */ jsx21(Text19, { style: [styles18.statValue, { color: t.text }], children: Math.round(stats.avg_score) }),
|
|
6830
|
+
/* @__PURE__ */ jsx21(Text19, { style: [styles18.statLabel, { color: t.textMuted }], children: "Avg Score" })
|
|
6479
6831
|
] })
|
|
6480
6832
|
] }),
|
|
6481
|
-
/* @__PURE__ */
|
|
6833
|
+
/* @__PURE__ */ jsx21(
|
|
6482
6834
|
FlatList,
|
|
6483
6835
|
{
|
|
6484
6836
|
data: leaderboard,
|
|
6485
6837
|
renderItem,
|
|
6486
6838
|
keyExtractor: (item) => String(item.id),
|
|
6487
|
-
style:
|
|
6488
|
-
contentContainerStyle:
|
|
6489
|
-
ListEmptyComponent: /* @__PURE__ */
|
|
6839
|
+
style: styles18.list,
|
|
6840
|
+
contentContainerStyle: styles18.listContent,
|
|
6841
|
+
ListEmptyComponent: /* @__PURE__ */ jsx21(View18, { style: styles18.emptyState, children: /* @__PURE__ */ jsx21(Text19, { style: [styles18.emptyText, { color: t.textMuted }], children: loading ? "Loading..." : "No scores yet" }) })
|
|
6490
6842
|
}
|
|
6491
6843
|
)
|
|
6492
6844
|
] }) })
|
|
@@ -6496,9 +6848,9 @@ function ArcadeLeaderboardSheet({
|
|
|
6496
6848
|
}
|
|
6497
6849
|
);
|
|
6498
6850
|
}
|
|
6499
|
-
var
|
|
6851
|
+
var styles18 = StyleSheet19.create({
|
|
6500
6852
|
overlay: {
|
|
6501
|
-
...
|
|
6853
|
+
...StyleSheet19.absoluteFillObject,
|
|
6502
6854
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
6503
6855
|
},
|
|
6504
6856
|
overlayTap: { flex: 1 },
|
|
@@ -6580,6 +6932,7 @@ export {
|
|
|
6580
6932
|
SOLANA_PROGRAM_ERRORS,
|
|
6581
6933
|
STORAGE_KEYS,
|
|
6582
6934
|
SettingsSheet,
|
|
6935
|
+
SolSlider,
|
|
6583
6936
|
UserProfileCard,
|
|
6584
6937
|
UserProfileSheet,
|
|
6585
6938
|
createSecureStoreStorage,
|