@dubsdotapp/expo 0.5.7 → 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 +28 -2
- package/dist/index.d.ts +28 -2
- package/dist/index.js +516 -279
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +487 -245
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -1
- package/src/ui/game/JoinGameSheet.tsx +46 -15
- 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,20 +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
5327
|
Image as Image6,
|
|
5328
5328
|
TouchableOpacity as TouchableOpacity10,
|
|
5329
5329
|
ActivityIndicator as ActivityIndicator8,
|
|
5330
5330
|
Modal as Modal3,
|
|
5331
5331
|
Animated as Animated4,
|
|
5332
|
-
StyleSheet as
|
|
5332
|
+
StyleSheet as StyleSheet15,
|
|
5333
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,
|
|
5334
5344
|
Platform as Platform7
|
|
5335
5345
|
} from "react-native";
|
|
5336
|
-
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";
|
|
5337
5556
|
var STATUS_LABELS3 = {
|
|
5338
5557
|
building: "Building transaction...",
|
|
5339
5558
|
signing: "Approve in wallet...",
|
|
@@ -5360,6 +5579,8 @@ function JoinGameSheet({
|
|
|
5360
5579
|
onError,
|
|
5361
5580
|
onTeamSelect,
|
|
5362
5581
|
onJoinSuccess,
|
|
5582
|
+
onSliderTick,
|
|
5583
|
+
maxWager = 5,
|
|
5363
5584
|
isPoolModeEnabled = false
|
|
5364
5585
|
}) {
|
|
5365
5586
|
const t = useDubsTheme();
|
|
@@ -5367,10 +5588,11 @@ function JoinGameSheet({
|
|
|
5367
5588
|
const mutation = useJoinGame();
|
|
5368
5589
|
const isCustomGame = game.gameMode === CUSTOM_GAME_MODE;
|
|
5369
5590
|
const [selectedTeam, setSelectedTeam] = useState28(null);
|
|
5591
|
+
const [wager, setWager] = useState28(game.buyIn);
|
|
5370
5592
|
const [showSuccess, setShowSuccess] = useState28(false);
|
|
5371
|
-
const overlayOpacity =
|
|
5372
|
-
const successScale =
|
|
5373
|
-
const successOpacity =
|
|
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;
|
|
5374
5596
|
useEffect17(() => {
|
|
5375
5597
|
Animated4.timing(overlayOpacity, {
|
|
5376
5598
|
toValue: visible ? 1 : 0,
|
|
@@ -5381,6 +5603,7 @@ function JoinGameSheet({
|
|
|
5381
5603
|
useEffect17(() => {
|
|
5382
5604
|
if (visible) {
|
|
5383
5605
|
setSelectedTeam(isPoolModeEnabled ? "home" : isCustomGame ? "away" : null);
|
|
5606
|
+
setWager(game.buyIn);
|
|
5384
5607
|
setShowSuccess(false);
|
|
5385
5608
|
successScale.setValue(0);
|
|
5386
5609
|
successOpacity.setValue(0);
|
|
@@ -5415,15 +5638,18 @@ function JoinGameSheet({
|
|
|
5415
5638
|
const homePool = game.homePool || 0;
|
|
5416
5639
|
const awayPool = game.awayPool || 0;
|
|
5417
5640
|
const buyIn = game.buyIn;
|
|
5418
|
-
const
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
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]);
|
|
5425
5651
|
const selectedOdds = selectedTeam === "home" ? homeOdds : selectedTeam === "away" ? awayOdds : "\u2014";
|
|
5426
|
-
const potentialWinnings = selectedOdds !== "\u2014" ? formatSol(parseFloat(selectedOdds) *
|
|
5652
|
+
const potentialWinnings = selectedOdds !== "\u2014" ? formatSol(parseFloat(selectedOdds) * wager) : "\u2014";
|
|
5427
5653
|
const homeName = shortName ? shortName(opponents[0]?.name) : opponents[0]?.name || "Home";
|
|
5428
5654
|
const awayName = shortName ? shortName(opponents[1]?.name) : opponents[1]?.name || "Away";
|
|
5429
5655
|
const selectedName = selectedTeam === "home" ? homeName : selectedTeam === "away" ? awayName : "\u2014";
|
|
@@ -5434,20 +5660,20 @@ function JoinGameSheet({
|
|
|
5434
5660
|
}, [bettors, wallet.publicKey]);
|
|
5435
5661
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
5436
5662
|
const canJoin = selectedTeam !== null && !isMutating && mutation.status !== "success" && !alreadyJoined;
|
|
5437
|
-
const handleJoin =
|
|
5663
|
+
const handleJoin = useCallback24(async () => {
|
|
5438
5664
|
if (!selectedTeam || !wallet.publicKey) return;
|
|
5439
5665
|
try {
|
|
5440
5666
|
await mutation.execute({
|
|
5441
5667
|
playerWallet: wallet.publicKey.toBase58(),
|
|
5442
5668
|
gameId: game.gameId,
|
|
5443
5669
|
teamChoice: selectedTeam,
|
|
5444
|
-
amount:
|
|
5670
|
+
amount: wager
|
|
5445
5671
|
});
|
|
5446
5672
|
} catch {
|
|
5447
5673
|
}
|
|
5448
|
-
}, [selectedTeam, wallet.publicKey, mutation.execute, game.gameId,
|
|
5674
|
+
}, [selectedTeam, wallet.publicKey, mutation.execute, game.gameId, wager]);
|
|
5449
5675
|
const statusLabel = STATUS_LABELS3[mutation.status] || "";
|
|
5450
|
-
return /* @__PURE__ */
|
|
5676
|
+
return /* @__PURE__ */ jsxs14(
|
|
5451
5677
|
Modal3,
|
|
5452
5678
|
{
|
|
5453
5679
|
visible,
|
|
@@ -5455,49 +5681,49 @@ function JoinGameSheet({
|
|
|
5455
5681
|
transparent: true,
|
|
5456
5682
|
onRequestClose: onDismiss,
|
|
5457
5683
|
children: [
|
|
5458
|
-
/* @__PURE__ */
|
|
5459
|
-
showSuccess && /* @__PURE__ */
|
|
5460
|
-
/* @__PURE__ */
|
|
5461
|
-
/* @__PURE__ */
|
|
5462
|
-
/* @__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: [
|
|
5463
5689
|
formatSol(buyIn),
|
|
5464
5690
|
" SOL on ",
|
|
5465
5691
|
selectedName
|
|
5466
5692
|
] })
|
|
5467
5693
|
] }) }),
|
|
5468
|
-
/* @__PURE__ */
|
|
5694
|
+
/* @__PURE__ */ jsx17(
|
|
5469
5695
|
KeyboardAvoidingView4,
|
|
5470
5696
|
{
|
|
5471
|
-
style:
|
|
5472
|
-
behavior:
|
|
5473
|
-
children: /* @__PURE__ */
|
|
5474
|
-
/* @__PURE__ */
|
|
5475
|
-
/* @__PURE__ */
|
|
5476
|
-
/* @__PURE__ */
|
|
5477
|
-
/* @__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" }) })
|
|
5478
5704
|
] }),
|
|
5479
|
-
bettors.length > 0 && /* @__PURE__ */
|
|
5480
|
-
/* @__PURE__ */
|
|
5705
|
+
bettors.length > 0 && /* @__PURE__ */ jsxs14(View15, { style: styles14.bettorsSection, children: [
|
|
5706
|
+
/* @__PURE__ */ jsxs14(Text15, { style: [styles14.bettorsLabel, { color: t.textMuted }], children: [
|
|
5481
5707
|
bettors.length,
|
|
5482
5708
|
" ",
|
|
5483
5709
|
bettors.length === 1 ? "player" : "players",
|
|
5484
5710
|
" in this game"
|
|
5485
5711
|
] }),
|
|
5486
|
-
/* @__PURE__ */
|
|
5712
|
+
/* @__PURE__ */ jsxs14(View15, { style: styles14.bettorsRow, children: [
|
|
5487
5713
|
bettors.slice(0, 6).map((b, i) => {
|
|
5488
5714
|
const pngUrl = toPng(b.avatar);
|
|
5489
|
-
return /* @__PURE__ */
|
|
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);
|
|
5490
5716
|
}),
|
|
5491
|
-
bettors.length > 6 && /* @__PURE__ */
|
|
5717
|
+
bettors.length > 6 && /* @__PURE__ */ jsx17(View15, { style: [styles14.bettorCircle, { backgroundColor: "#2C2C2E" }], children: /* @__PURE__ */ jsxs14(Text15, { style: styles14.bettorOverflow, children: [
|
|
5492
5718
|
"+",
|
|
5493
5719
|
bettors.length - 6
|
|
5494
5720
|
] }) })
|
|
5495
5721
|
] })
|
|
5496
5722
|
] }),
|
|
5497
|
-
!isCustomGame && !isPoolModeEnabled && /* @__PURE__ */
|
|
5498
|
-
/* @__PURE__ */
|
|
5499
|
-
/* @__PURE__ */
|
|
5500
|
-
/* @__PURE__ */
|
|
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(
|
|
5501
5727
|
TeamButton,
|
|
5502
5728
|
{
|
|
5503
5729
|
name: homeName,
|
|
@@ -5514,7 +5740,7 @@ function JoinGameSheet({
|
|
|
5514
5740
|
t
|
|
5515
5741
|
}
|
|
5516
5742
|
),
|
|
5517
|
-
/* @__PURE__ */
|
|
5743
|
+
/* @__PURE__ */ jsx17(
|
|
5518
5744
|
TeamButton,
|
|
5519
5745
|
{
|
|
5520
5746
|
name: awayName,
|
|
@@ -5533,64 +5759,76 @@ function JoinGameSheet({
|
|
|
5533
5759
|
)
|
|
5534
5760
|
] })
|
|
5535
5761
|
] }),
|
|
5536
|
-
/* @__PURE__ */
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
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),
|
|
5541
5779
|
" SOL"
|
|
5542
5780
|
] })
|
|
5543
5781
|
] }),
|
|
5544
|
-
/* @__PURE__ */
|
|
5545
|
-
isPoolModeEnabled ? /* @__PURE__ */
|
|
5546
|
-
/* @__PURE__ */
|
|
5547
|
-
/* @__PURE__ */
|
|
5548
|
-
/* @__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 })
|
|
5549
5787
|
] }),
|
|
5550
|
-
/* @__PURE__ */
|
|
5551
|
-
/* @__PURE__ */
|
|
5552
|
-
/* @__PURE__ */
|
|
5553
|
-
/* @__PURE__ */
|
|
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: [
|
|
5554
5792
|
formatSol(totalPool),
|
|
5555
5793
|
" SOL"
|
|
5556
5794
|
] })
|
|
5557
5795
|
] })
|
|
5558
|
-
] }) : /* @__PURE__ */
|
|
5559
|
-
/* @__PURE__ */
|
|
5560
|
-
/* @__PURE__ */
|
|
5561
|
-
/* @__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 })
|
|
5562
5800
|
] }),
|
|
5563
|
-
/* @__PURE__ */
|
|
5564
|
-
/* @__PURE__ */
|
|
5565
|
-
/* @__PURE__ */
|
|
5566
|
-
/* @__PURE__ */
|
|
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: [
|
|
5567
5805
|
formatSol(poolAfterJoin),
|
|
5568
5806
|
" SOL"
|
|
5569
5807
|
] })
|
|
5570
5808
|
] }),
|
|
5571
|
-
/* @__PURE__ */
|
|
5572
|
-
/* @__PURE__ */
|
|
5573
|
-
/* @__PURE__ */
|
|
5574
|
-
/* @__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" })
|
|
5575
5813
|
] })
|
|
5576
5814
|
] })
|
|
5577
5815
|
] }),
|
|
5578
|
-
alreadyJoined && /* @__PURE__ */
|
|
5579
|
-
mutation.error && /* @__PURE__ */
|
|
5580
|
-
/* @__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(
|
|
5581
5819
|
TouchableOpacity10,
|
|
5582
5820
|
{
|
|
5583
5821
|
style: [
|
|
5584
|
-
|
|
5822
|
+
styles14.ctaButton,
|
|
5585
5823
|
{ backgroundColor: canJoin ? t.accent : t.border }
|
|
5586
5824
|
],
|
|
5587
5825
|
disabled: !canJoin,
|
|
5588
5826
|
onPress: handleJoin,
|
|
5589
5827
|
activeOpacity: 0.8,
|
|
5590
|
-
children: isMutating ? /* @__PURE__ */
|
|
5591
|
-
/* @__PURE__ */
|
|
5592
|
-
/* @__PURE__ */
|
|
5593
|
-
] }) : 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" })
|
|
5594
5832
|
}
|
|
5595
5833
|
)
|
|
5596
5834
|
] }) })
|
|
@@ -5614,32 +5852,32 @@ function TeamButton({
|
|
|
5614
5852
|
const [imgFailed, setImgFailed] = useState28(false);
|
|
5615
5853
|
const Img = ImageComponent || __require("react-native").Image;
|
|
5616
5854
|
const showImage = imageUrl && !imgFailed;
|
|
5617
|
-
return /* @__PURE__ */
|
|
5855
|
+
return /* @__PURE__ */ jsxs14(
|
|
5618
5856
|
TouchableOpacity10,
|
|
5619
5857
|
{
|
|
5620
|
-
style: [
|
|
5858
|
+
style: [styles14.teamOption, { borderColor: selected ? color : t.border, backgroundColor: selected ? color + "15" : t.background }],
|
|
5621
5859
|
onPress,
|
|
5622
5860
|
activeOpacity: 0.7,
|
|
5623
5861
|
children: [
|
|
5624
|
-
showImage ? /* @__PURE__ */
|
|
5625
|
-
/* @__PURE__ */
|
|
5626
|
-
/* @__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: [
|
|
5627
5865
|
odds,
|
|
5628
5866
|
"x"
|
|
5629
5867
|
] }),
|
|
5630
|
-
/* @__PURE__ */
|
|
5868
|
+
/* @__PURE__ */ jsxs14(Text15, { style: [styles14.teamBets, { color: t.textMuted }], children: [
|
|
5631
5869
|
bets,
|
|
5632
5870
|
" ",
|
|
5633
5871
|
bets === 1 ? "bet" : "bets"
|
|
5634
5872
|
] }),
|
|
5635
|
-
selected && /* @__PURE__ */
|
|
5873
|
+
selected && /* @__PURE__ */ jsx17(View15, { style: [styles14.teamBadge, { backgroundColor: color }], children: /* @__PURE__ */ jsx17(Text15, { style: styles14.teamBadgeText, children: "Selected" }) })
|
|
5636
5874
|
]
|
|
5637
5875
|
}
|
|
5638
5876
|
);
|
|
5639
5877
|
}
|
|
5640
|
-
var
|
|
5878
|
+
var styles14 = StyleSheet15.create({
|
|
5641
5879
|
overlay: {
|
|
5642
|
-
...
|
|
5880
|
+
...StyleSheet15.absoluteFillObject,
|
|
5643
5881
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
5644
5882
|
},
|
|
5645
5883
|
overlayTap: {
|
|
@@ -5722,7 +5960,7 @@ var styles13 = StyleSheet14.create({
|
|
|
5722
5960
|
},
|
|
5723
5961
|
// Success overlay
|
|
5724
5962
|
successOverlay: {
|
|
5725
|
-
...
|
|
5963
|
+
...StyleSheet15.absoluteFillObject,
|
|
5726
5964
|
zIndex: 100,
|
|
5727
5965
|
alignItems: "center",
|
|
5728
5966
|
justifyContent: "center",
|
|
@@ -5756,8 +5994,11 @@ var styles13 = StyleSheet14.create({
|
|
|
5756
5994
|
flexDirection: "row",
|
|
5757
5995
|
gap: 12
|
|
5758
5996
|
},
|
|
5997
|
+
sliderSection: {
|
|
5998
|
+
marginTop: 16
|
|
5999
|
+
},
|
|
5759
6000
|
summaryCard: {
|
|
5760
|
-
marginTop:
|
|
6001
|
+
marginTop: 12,
|
|
5761
6002
|
borderRadius: 16,
|
|
5762
6003
|
borderWidth: 1,
|
|
5763
6004
|
overflow: "hidden"
|
|
@@ -5849,19 +6090,19 @@ var styles13 = StyleSheet14.create({
|
|
|
5849
6090
|
});
|
|
5850
6091
|
|
|
5851
6092
|
// src/ui/game/ClaimPrizeSheet.tsx
|
|
5852
|
-
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";
|
|
5853
6094
|
import {
|
|
5854
|
-
View as
|
|
5855
|
-
Text as
|
|
6095
|
+
View as View16,
|
|
6096
|
+
Text as Text16,
|
|
5856
6097
|
TouchableOpacity as TouchableOpacity11,
|
|
5857
6098
|
ActivityIndicator as ActivityIndicator9,
|
|
5858
6099
|
Modal as Modal4,
|
|
5859
6100
|
Animated as Animated5,
|
|
5860
|
-
StyleSheet as
|
|
6101
|
+
StyleSheet as StyleSheet16,
|
|
5861
6102
|
KeyboardAvoidingView as KeyboardAvoidingView5,
|
|
5862
|
-
Platform as
|
|
6103
|
+
Platform as Platform9
|
|
5863
6104
|
} from "react-native";
|
|
5864
|
-
import { jsx as
|
|
6105
|
+
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5865
6106
|
var STATUS_LABELS4 = {
|
|
5866
6107
|
building: "Building transaction...",
|
|
5867
6108
|
signing: "Approve in wallet...",
|
|
@@ -5880,9 +6121,9 @@ function ClaimPrizeSheet({
|
|
|
5880
6121
|
const t = useDubsTheme();
|
|
5881
6122
|
const { wallet } = useDubs();
|
|
5882
6123
|
const mutation = useClaim();
|
|
5883
|
-
const overlayOpacity =
|
|
5884
|
-
const celebrationScale =
|
|
5885
|
-
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;
|
|
5886
6127
|
const [showCelebration, setShowCelebration] = useState29(false);
|
|
5887
6128
|
useEffect18(() => {
|
|
5888
6129
|
Animated5.timing(overlayOpacity, {
|
|
@@ -5929,7 +6170,7 @@ function ClaimPrizeSheet({
|
|
|
5929
6170
|
}, [mutation.status, mutation.error]);
|
|
5930
6171
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
5931
6172
|
const canClaim = !isMutating && mutation.status !== "success" && !!wallet.publicKey;
|
|
5932
|
-
const handleClaim =
|
|
6173
|
+
const handleClaim = useCallback25(async () => {
|
|
5933
6174
|
if (!wallet.publicKey) return;
|
|
5934
6175
|
try {
|
|
5935
6176
|
await mutation.execute({
|
|
@@ -5941,7 +6182,7 @@ function ClaimPrizeSheet({
|
|
|
5941
6182
|
}
|
|
5942
6183
|
}, [wallet.publicKey, mutation.execute, gameId, prizeAmount]);
|
|
5943
6184
|
const statusLabel = STATUS_LABELS4[mutation.status] || "";
|
|
5944
|
-
return /* @__PURE__ */
|
|
6185
|
+
return /* @__PURE__ */ jsxs15(
|
|
5945
6186
|
Modal4,
|
|
5946
6187
|
{
|
|
5947
6188
|
visible,
|
|
@@ -5949,54 +6190,54 @@ function ClaimPrizeSheet({
|
|
|
5949
6190
|
transparent: true,
|
|
5950
6191
|
onRequestClose: onDismiss,
|
|
5951
6192
|
children: [
|
|
5952
|
-
/* @__PURE__ */
|
|
5953
|
-
/* @__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(
|
|
5954
6195
|
KeyboardAvoidingView5,
|
|
5955
6196
|
{
|
|
5956
|
-
style:
|
|
5957
|
-
behavior:
|
|
5958
|
-
children: /* @__PURE__ */
|
|
5959
|
-
/* @__PURE__ */
|
|
5960
|
-
/* @__PURE__ */
|
|
5961
|
-
/* @__PURE__ */
|
|
5962
|
-
/* @__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" }) })
|
|
5963
6204
|
] }),
|
|
5964
|
-
showCelebration && /* @__PURE__ */
|
|
6205
|
+
showCelebration && /* @__PURE__ */ jsxs15(
|
|
5965
6206
|
Animated5.View,
|
|
5966
6207
|
{
|
|
5967
6208
|
style: [
|
|
5968
|
-
|
|
6209
|
+
styles15.celebrationContainer,
|
|
5969
6210
|
{
|
|
5970
6211
|
opacity: celebrationOpacity,
|
|
5971
6212
|
transform: [{ scale: celebrationScale }]
|
|
5972
6213
|
}
|
|
5973
6214
|
],
|
|
5974
6215
|
children: [
|
|
5975
|
-
/* @__PURE__ */
|
|
5976
|
-
/* @__PURE__ */
|
|
6216
|
+
/* @__PURE__ */ jsx18(Text16, { style: styles15.celebrationEmoji, children: "\u{1F3C6}" }),
|
|
6217
|
+
/* @__PURE__ */ jsxs15(Text16, { style: [styles15.celebrationText, { color: t.success }], children: [
|
|
5977
6218
|
"+",
|
|
5978
6219
|
prizeAmount,
|
|
5979
6220
|
" SOL"
|
|
5980
6221
|
] }),
|
|
5981
|
-
/* @__PURE__ */
|
|
6222
|
+
/* @__PURE__ */ jsx18(Text16, { style: [styles15.celebrationSubtext, { color: t.textMuted }], children: isRefund ? "Refund sent to your wallet" : "Winnings sent to your wallet" })
|
|
5982
6223
|
]
|
|
5983
6224
|
}
|
|
5984
6225
|
),
|
|
5985
|
-
!showCelebration && /* @__PURE__ */
|
|
5986
|
-
/* @__PURE__ */
|
|
5987
|
-
/* @__PURE__ */
|
|
5988
|
-
/* @__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: [
|
|
5989
6230
|
prizeAmount,
|
|
5990
6231
|
" SOL"
|
|
5991
6232
|
] })
|
|
5992
6233
|
] }),
|
|
5993
|
-
/* @__PURE__ */
|
|
5994
|
-
/* @__PURE__ */
|
|
5995
|
-
/* @__PURE__ */
|
|
5996
|
-
/* @__PURE__ */
|
|
5997
|
-
|
|
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,
|
|
5998
6239
|
{
|
|
5999
|
-
style: [
|
|
6240
|
+
style: [styles15.summaryValue, { color: t.text }],
|
|
6000
6241
|
numberOfLines: 1,
|
|
6001
6242
|
children: [
|
|
6002
6243
|
gameId.slice(0, 8),
|
|
@@ -6007,21 +6248,21 @@ function ClaimPrizeSheet({
|
|
|
6007
6248
|
)
|
|
6008
6249
|
] })
|
|
6009
6250
|
] }),
|
|
6010
|
-
mutation.error && /* @__PURE__ */
|
|
6011
|
-
!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(
|
|
6012
6253
|
TouchableOpacity11,
|
|
6013
6254
|
{
|
|
6014
6255
|
style: [
|
|
6015
|
-
|
|
6256
|
+
styles15.ctaButton,
|
|
6016
6257
|
{ backgroundColor: canClaim ? t.accent : t.border }
|
|
6017
6258
|
],
|
|
6018
6259
|
disabled: !canClaim,
|
|
6019
6260
|
onPress: handleClaim,
|
|
6020
6261
|
activeOpacity: 0.8,
|
|
6021
|
-
children: isMutating ? /* @__PURE__ */
|
|
6022
|
-
/* @__PURE__ */
|
|
6023
|
-
/* @__PURE__ */
|
|
6024
|
-
] }) : /* @__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: [
|
|
6025
6266
|
isRefund ? "Claim Refund" : "Claim Prize",
|
|
6026
6267
|
" \u2014 ",
|
|
6027
6268
|
prizeAmount,
|
|
@@ -6029,7 +6270,7 @@ function ClaimPrizeSheet({
|
|
|
6029
6270
|
] })
|
|
6030
6271
|
}
|
|
6031
6272
|
),
|
|
6032
|
-
mutation.data?.explorerUrl && /* @__PURE__ */
|
|
6273
|
+
mutation.data?.explorerUrl && /* @__PURE__ */ jsx18(Text16, { style: [styles15.explorerHint, { color: t.textMuted }], children: "View on Solscan" })
|
|
6033
6274
|
] }) })
|
|
6034
6275
|
}
|
|
6035
6276
|
)
|
|
@@ -6037,9 +6278,9 @@ function ClaimPrizeSheet({
|
|
|
6037
6278
|
}
|
|
6038
6279
|
);
|
|
6039
6280
|
}
|
|
6040
|
-
var
|
|
6281
|
+
var styles15 = StyleSheet16.create({
|
|
6041
6282
|
overlay: {
|
|
6042
|
-
...
|
|
6283
|
+
...StyleSheet16.absoluteFillObject,
|
|
6043
6284
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
6044
6285
|
},
|
|
6045
6286
|
overlayTap: {
|
|
@@ -6162,9 +6403,9 @@ var styles14 = StyleSheet15.create({
|
|
|
6162
6403
|
});
|
|
6163
6404
|
|
|
6164
6405
|
// src/ui/game/ClaimButton.tsx
|
|
6165
|
-
import { useState as useState30, useMemo as useMemo10, useCallback as
|
|
6166
|
-
import { StyleSheet as
|
|
6167
|
-
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";
|
|
6168
6409
|
function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
6169
6410
|
const t = useDubsTheme();
|
|
6170
6411
|
const { wallet } = useDubs();
|
|
@@ -6181,7 +6422,7 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
6181
6422
|
const isWinner = isResolved && myBet != null && myBet.team === game.data?.winnerSide;
|
|
6182
6423
|
const isEligible = myBet != null && isResolved && (isWinner || isRefund);
|
|
6183
6424
|
const prizeAmount = isRefund ? myBet?.amount ?? 0 : game.data?.totalPool ?? 0;
|
|
6184
|
-
const handleSuccess =
|
|
6425
|
+
const handleSuccess = useCallback26(
|
|
6185
6426
|
(result) => {
|
|
6186
6427
|
claimStatus.refetch();
|
|
6187
6428
|
onSuccess?.(result);
|
|
@@ -6194,13 +6435,13 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
6194
6435
|
}
|
|
6195
6436
|
const label = isRefund ? "Refund" : "Prize";
|
|
6196
6437
|
if (claimStatus.hasClaimed) {
|
|
6197
|
-
return /* @__PURE__ */
|
|
6438
|
+
return /* @__PURE__ */ jsx19(
|
|
6198
6439
|
TouchableOpacity12,
|
|
6199
6440
|
{
|
|
6200
|
-
style: [
|
|
6441
|
+
style: [styles16.badge, { borderColor: t.accent }, style],
|
|
6201
6442
|
activeOpacity: 1,
|
|
6202
6443
|
disabled: true,
|
|
6203
|
-
children: /* @__PURE__ */
|
|
6444
|
+
children: /* @__PURE__ */ jsxs16(Text17, { style: [styles16.badgeText, { color: t.accent }], children: [
|
|
6204
6445
|
label,
|
|
6205
6446
|
" Claimed!"
|
|
6206
6447
|
] })
|
|
@@ -6210,14 +6451,14 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
6210
6451
|
if (!isEligible) {
|
|
6211
6452
|
return null;
|
|
6212
6453
|
}
|
|
6213
|
-
return /* @__PURE__ */
|
|
6214
|
-
/* @__PURE__ */
|
|
6454
|
+
return /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
6455
|
+
/* @__PURE__ */ jsx19(
|
|
6215
6456
|
TouchableOpacity12,
|
|
6216
6457
|
{
|
|
6217
|
-
style: [
|
|
6458
|
+
style: [styles16.button, { backgroundColor: t.accent }, style],
|
|
6218
6459
|
activeOpacity: 0.8,
|
|
6219
6460
|
onPress: () => setSheetVisible(true),
|
|
6220
|
-
children: /* @__PURE__ */
|
|
6461
|
+
children: /* @__PURE__ */ jsxs16(Text17, { style: styles16.buttonText, children: [
|
|
6221
6462
|
"Claim ",
|
|
6222
6463
|
label,
|
|
6223
6464
|
" \u2014 ",
|
|
@@ -6226,7 +6467,7 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
6226
6467
|
] })
|
|
6227
6468
|
}
|
|
6228
6469
|
),
|
|
6229
|
-
/* @__PURE__ */
|
|
6470
|
+
/* @__PURE__ */ jsx19(
|
|
6230
6471
|
ClaimPrizeSheet,
|
|
6231
6472
|
{
|
|
6232
6473
|
visible: sheetVisible,
|
|
@@ -6240,7 +6481,7 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
6240
6481
|
)
|
|
6241
6482
|
] });
|
|
6242
6483
|
}
|
|
6243
|
-
var
|
|
6484
|
+
var styles16 = StyleSheet17.create({
|
|
6244
6485
|
button: {
|
|
6245
6486
|
height: 52,
|
|
6246
6487
|
borderRadius: 14,
|
|
@@ -6268,19 +6509,19 @@ var styles15 = StyleSheet16.create({
|
|
|
6268
6509
|
});
|
|
6269
6510
|
|
|
6270
6511
|
// src/ui/game/EnterArcadePoolSheet.tsx
|
|
6271
|
-
import { useEffect as useEffect19, useRef as
|
|
6512
|
+
import { useEffect as useEffect19, useRef as useRef12, useCallback as useCallback27 } from "react";
|
|
6272
6513
|
import {
|
|
6273
|
-
View as
|
|
6274
|
-
Text as
|
|
6514
|
+
View as View17,
|
|
6515
|
+
Text as Text18,
|
|
6275
6516
|
TouchableOpacity as TouchableOpacity13,
|
|
6276
6517
|
ActivityIndicator as ActivityIndicator10,
|
|
6277
6518
|
Modal as Modal5,
|
|
6278
6519
|
Animated as Animated6,
|
|
6279
|
-
StyleSheet as
|
|
6520
|
+
StyleSheet as StyleSheet18,
|
|
6280
6521
|
KeyboardAvoidingView as KeyboardAvoidingView6,
|
|
6281
|
-
Platform as
|
|
6522
|
+
Platform as Platform10
|
|
6282
6523
|
} from "react-native";
|
|
6283
|
-
import { Fragment as Fragment6, jsx as
|
|
6524
|
+
import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6284
6525
|
var STATUS_LABELS5 = {
|
|
6285
6526
|
building: "Building transaction...",
|
|
6286
6527
|
signing: "Approve in wallet...",
|
|
@@ -6299,7 +6540,7 @@ function EnterArcadePoolSheet({
|
|
|
6299
6540
|
const t = useDubsTheme();
|
|
6300
6541
|
const { wallet } = useDubs();
|
|
6301
6542
|
const mutation = useEnterArcadePool();
|
|
6302
|
-
const overlayOpacity =
|
|
6543
|
+
const overlayOpacity = useRef12(new Animated6.Value(0)).current;
|
|
6303
6544
|
useEffect19(() => {
|
|
6304
6545
|
Animated6.timing(overlayOpacity, {
|
|
6305
6546
|
toValue: visible ? 1 : 0,
|
|
@@ -6333,7 +6574,7 @@ function EnterArcadePoolSheet({
|
|
|
6333
6574
|
const potSol = (pool.buy_in_lamports * Number(totalBuyIns) / 1e9).toFixed(4);
|
|
6334
6575
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
6335
6576
|
const canJoin = !isMutating && mutation.status !== "success";
|
|
6336
|
-
const handleJoin =
|
|
6577
|
+
const handleJoin = useCallback27(async () => {
|
|
6337
6578
|
if (!wallet.publicKey) return;
|
|
6338
6579
|
try {
|
|
6339
6580
|
await mutation.execute(pool.id);
|
|
@@ -6345,7 +6586,7 @@ function EnterArcadePoolSheet({
|
|
|
6345
6586
|
const headerTitle = isRejoin ? "Play Again" : "Join Pool";
|
|
6346
6587
|
const ctaLabel = isRejoin ? `Play Again \u2014 ${buyInSol} SOL` : `Join Pool \u2014 ${buyInSol} SOL`;
|
|
6347
6588
|
const successLabel = isRejoin ? "Lives refilled!" : "Joined!";
|
|
6348
|
-
return /* @__PURE__ */
|
|
6589
|
+
return /* @__PURE__ */ jsxs17(
|
|
6349
6590
|
Modal5,
|
|
6350
6591
|
{
|
|
6351
6592
|
visible,
|
|
@@ -6353,68 +6594,68 @@ function EnterArcadePoolSheet({
|
|
|
6353
6594
|
transparent: true,
|
|
6354
6595
|
onRequestClose: onDismiss,
|
|
6355
6596
|
children: [
|
|
6356
|
-
/* @__PURE__ */
|
|
6357
|
-
/* @__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(
|
|
6358
6599
|
KeyboardAvoidingView6,
|
|
6359
6600
|
{
|
|
6360
|
-
style:
|
|
6361
|
-
behavior:
|
|
6362
|
-
children: /* @__PURE__ */
|
|
6363
|
-
/* @__PURE__ */
|
|
6364
|
-
/* @__PURE__ */
|
|
6365
|
-
/* @__PURE__ */
|
|
6366
|
-
/* @__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" }) })
|
|
6367
6608
|
] }),
|
|
6368
|
-
/* @__PURE__ */
|
|
6369
|
-
/* @__PURE__ */
|
|
6370
|
-
/* @__PURE__ */
|
|
6371
|
-
/* @__PURE__ */
|
|
6372
|
-
/* @__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: [
|
|
6373
6614
|
buyInSol,
|
|
6374
6615
|
" SOL"
|
|
6375
6616
|
] })
|
|
6376
6617
|
] }),
|
|
6377
|
-
/* @__PURE__ */
|
|
6378
|
-
/* @__PURE__ */
|
|
6379
|
-
/* @__PURE__ */
|
|
6380
|
-
/* @__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 })
|
|
6381
6622
|
] }),
|
|
6382
|
-
/* @__PURE__ */
|
|
6383
|
-
/* @__PURE__ */
|
|
6384
|
-
/* @__PURE__ */
|
|
6385
|
-
/* @__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: [
|
|
6386
6627
|
potSol,
|
|
6387
6628
|
" SOL"
|
|
6388
6629
|
] })
|
|
6389
6630
|
] }),
|
|
6390
|
-
/* @__PURE__ */
|
|
6391
|
-
/* @__PURE__ */
|
|
6392
|
-
/* @__PURE__ */
|
|
6393
|
-
/* @__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 })
|
|
6394
6635
|
] }),
|
|
6395
|
-
topScore > 0 && /* @__PURE__ */
|
|
6396
|
-
/* @__PURE__ */
|
|
6397
|
-
/* @__PURE__ */
|
|
6398
|
-
/* @__PURE__ */
|
|
6399
|
-
/* @__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 })
|
|
6400
6641
|
] })
|
|
6401
6642
|
] })
|
|
6402
6643
|
] }),
|
|
6403
|
-
mutation.error && /* @__PURE__ */
|
|
6404
|
-
/* @__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(
|
|
6405
6646
|
TouchableOpacity13,
|
|
6406
6647
|
{
|
|
6407
6648
|
style: [
|
|
6408
|
-
|
|
6649
|
+
styles17.ctaButton,
|
|
6409
6650
|
{ backgroundColor: canJoin ? t.accent : t.border }
|
|
6410
6651
|
],
|
|
6411
6652
|
disabled: !canJoin,
|
|
6412
6653
|
onPress: handleJoin,
|
|
6413
6654
|
activeOpacity: 0.8,
|
|
6414
|
-
children: isMutating ? /* @__PURE__ */
|
|
6415
|
-
/* @__PURE__ */
|
|
6416
|
-
/* @__PURE__ */
|
|
6417
|
-
] }) : 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 })
|
|
6418
6659
|
}
|
|
6419
6660
|
)
|
|
6420
6661
|
] }) })
|
|
@@ -6424,9 +6665,9 @@ function EnterArcadePoolSheet({
|
|
|
6424
6665
|
}
|
|
6425
6666
|
);
|
|
6426
6667
|
}
|
|
6427
|
-
var
|
|
6668
|
+
var styles17 = StyleSheet18.create({
|
|
6428
6669
|
overlay: {
|
|
6429
|
-
...
|
|
6670
|
+
...StyleSheet18.absoluteFillObject,
|
|
6430
6671
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
6431
6672
|
},
|
|
6432
6673
|
overlayTap: { flex: 1 },
|
|
@@ -6484,25 +6725,25 @@ var styles16 = StyleSheet17.create({
|
|
|
6484
6725
|
});
|
|
6485
6726
|
|
|
6486
6727
|
// src/ui/game/ArcadeLeaderboardSheet.tsx
|
|
6487
|
-
import { useEffect as useEffect20, useRef as
|
|
6728
|
+
import { useEffect as useEffect20, useRef as useRef13 } from "react";
|
|
6488
6729
|
import {
|
|
6489
|
-
View as
|
|
6490
|
-
Text as
|
|
6730
|
+
View as View18,
|
|
6731
|
+
Text as Text19,
|
|
6491
6732
|
TouchableOpacity as TouchableOpacity14,
|
|
6492
6733
|
Modal as Modal6,
|
|
6493
6734
|
Animated as Animated7,
|
|
6494
|
-
StyleSheet as
|
|
6735
|
+
StyleSheet as StyleSheet19,
|
|
6495
6736
|
KeyboardAvoidingView as KeyboardAvoidingView7,
|
|
6496
|
-
Platform as
|
|
6737
|
+
Platform as Platform11,
|
|
6497
6738
|
Image as Image7,
|
|
6498
6739
|
FlatList
|
|
6499
6740
|
} from "react-native";
|
|
6500
|
-
import { jsx as
|
|
6741
|
+
import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6501
6742
|
function RankLabel({ index }) {
|
|
6502
|
-
if (index === 0) return /* @__PURE__ */
|
|
6503
|
-
if (index === 1) return /* @__PURE__ */
|
|
6504
|
-
if (index === 2) return /* @__PURE__ */
|
|
6505
|
-
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 });
|
|
6506
6747
|
}
|
|
6507
6748
|
function ArcadeLeaderboardSheet({
|
|
6508
6749
|
visible,
|
|
@@ -6512,7 +6753,7 @@ function ArcadeLeaderboardSheet({
|
|
|
6512
6753
|
}) {
|
|
6513
6754
|
const t = useDubsTheme();
|
|
6514
6755
|
const { pool, leaderboard, stats, loading, refetch } = useArcadePool(poolId);
|
|
6515
|
-
const overlayOpacity =
|
|
6756
|
+
const overlayOpacity = useRef13(new Animated7.Value(0)).current;
|
|
6516
6757
|
useEffect20(() => {
|
|
6517
6758
|
Animated7.timing(overlayOpacity, {
|
|
6518
6759
|
toValue: visible ? 1 : 0,
|
|
@@ -6525,32 +6766,32 @@ function ArcadeLeaderboardSheet({
|
|
|
6525
6766
|
}, [visible]);
|
|
6526
6767
|
const renderItem = ({ item, index }) => {
|
|
6527
6768
|
const isMe = highlightWallet && item.wallet_address === highlightWallet;
|
|
6528
|
-
return /* @__PURE__ */
|
|
6529
|
-
|
|
6769
|
+
return /* @__PURE__ */ jsxs18(
|
|
6770
|
+
View18,
|
|
6530
6771
|
{
|
|
6531
6772
|
style: [
|
|
6532
|
-
|
|
6773
|
+
styles18.row,
|
|
6533
6774
|
{ backgroundColor: isMe ? `${t.accent}18` : index % 2 === 0 ? t.surface : "transparent" },
|
|
6534
6775
|
isMe ? { borderWidth: 1, borderColor: t.accent } : void 0
|
|
6535
6776
|
],
|
|
6536
6777
|
children: [
|
|
6537
|
-
/* @__PURE__ */
|
|
6538
|
-
item.avatar ? /* @__PURE__ */
|
|
6539
|
-
/* @__PURE__ */
|
|
6540
|
-
/* @__PURE__ */
|
|
6541
|
-
/* @__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: [
|
|
6542
6783
|
item.lives_used,
|
|
6543
6784
|
" ",
|
|
6544
6785
|
item.lives_used === 1 ? "life" : "lives",
|
|
6545
6786
|
" used"
|
|
6546
6787
|
] })
|
|
6547
6788
|
] }),
|
|
6548
|
-
/* @__PURE__ */
|
|
6789
|
+
/* @__PURE__ */ jsx21(Text19, { style: [styles18.score, { color: t.accent }], children: item.best_score })
|
|
6549
6790
|
]
|
|
6550
6791
|
}
|
|
6551
6792
|
);
|
|
6552
6793
|
};
|
|
6553
|
-
return /* @__PURE__ */
|
|
6794
|
+
return /* @__PURE__ */ jsxs18(
|
|
6554
6795
|
Modal6,
|
|
6555
6796
|
{
|
|
6556
6797
|
visible,
|
|
@@ -6558,46 +6799,46 @@ function ArcadeLeaderboardSheet({
|
|
|
6558
6799
|
transparent: true,
|
|
6559
6800
|
onRequestClose: onDismiss,
|
|
6560
6801
|
children: [
|
|
6561
|
-
/* @__PURE__ */
|
|
6562
|
-
/* @__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(
|
|
6563
6804
|
KeyboardAvoidingView7,
|
|
6564
6805
|
{
|
|
6565
|
-
style:
|
|
6566
|
-
behavior:
|
|
6567
|
-
children: /* @__PURE__ */
|
|
6568
|
-
/* @__PURE__ */
|
|
6569
|
-
/* @__PURE__ */
|
|
6570
|
-
/* @__PURE__ */
|
|
6571
|
-
/* @__PURE__ */
|
|
6572
|
-
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 })
|
|
6573
6814
|
] }),
|
|
6574
|
-
/* @__PURE__ */
|
|
6815
|
+
/* @__PURE__ */ jsx21(TouchableOpacity14, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ jsx21(Text19, { style: [styles18.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
6575
6816
|
] }),
|
|
6576
|
-
stats && /* @__PURE__ */
|
|
6577
|
-
/* @__PURE__ */
|
|
6578
|
-
/* @__PURE__ */
|
|
6579
|
-
/* @__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" })
|
|
6580
6821
|
] }),
|
|
6581
|
-
/* @__PURE__ */
|
|
6582
|
-
/* @__PURE__ */
|
|
6583
|
-
/* @__PURE__ */
|
|
6584
|
-
/* @__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" })
|
|
6585
6826
|
] }),
|
|
6586
|
-
/* @__PURE__ */
|
|
6587
|
-
/* @__PURE__ */
|
|
6588
|
-
/* @__PURE__ */
|
|
6589
|
-
/* @__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" })
|
|
6590
6831
|
] })
|
|
6591
6832
|
] }),
|
|
6592
|
-
/* @__PURE__ */
|
|
6833
|
+
/* @__PURE__ */ jsx21(
|
|
6593
6834
|
FlatList,
|
|
6594
6835
|
{
|
|
6595
6836
|
data: leaderboard,
|
|
6596
6837
|
renderItem,
|
|
6597
6838
|
keyExtractor: (item) => String(item.id),
|
|
6598
|
-
style:
|
|
6599
|
-
contentContainerStyle:
|
|
6600
|
-
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" }) })
|
|
6601
6842
|
}
|
|
6602
6843
|
)
|
|
6603
6844
|
] }) })
|
|
@@ -6607,9 +6848,9 @@ function ArcadeLeaderboardSheet({
|
|
|
6607
6848
|
}
|
|
6608
6849
|
);
|
|
6609
6850
|
}
|
|
6610
|
-
var
|
|
6851
|
+
var styles18 = StyleSheet19.create({
|
|
6611
6852
|
overlay: {
|
|
6612
|
-
...
|
|
6853
|
+
...StyleSheet19.absoluteFillObject,
|
|
6613
6854
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
6614
6855
|
},
|
|
6615
6856
|
overlayTap: { flex: 1 },
|
|
@@ -6691,6 +6932,7 @@ export {
|
|
|
6691
6932
|
SOLANA_PROGRAM_ERRORS,
|
|
6692
6933
|
STORAGE_KEYS,
|
|
6693
6934
|
SettingsSheet,
|
|
6935
|
+
SolSlider,
|
|
6694
6936
|
UserProfileCard,
|
|
6695
6937
|
UserProfileSheet,
|
|
6696
6938
|
createSecureStoreStorage,
|