@dubsdotapp/expo 0.5.5 → 0.5.7
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 +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +126 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +129 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/ui/game/JoinGameSheet.tsx +150 -13
package/dist/index.mjs
CHANGED
|
@@ -5324,6 +5324,7 @@ import { useState as useState28, useEffect as useEffect17, useRef as useRef9, us
|
|
|
5324
5324
|
import {
|
|
5325
5325
|
View as View14,
|
|
5326
5326
|
Text as Text14,
|
|
5327
|
+
Image as Image6,
|
|
5327
5328
|
TouchableOpacity as TouchableOpacity10,
|
|
5328
5329
|
ActivityIndicator as ActivityIndicator8,
|
|
5329
5330
|
Modal as Modal3,
|
|
@@ -5340,6 +5341,13 @@ var STATUS_LABELS3 = {
|
|
|
5340
5341
|
success: "Joined!"
|
|
5341
5342
|
};
|
|
5342
5343
|
var CUSTOM_GAME_MODE = 6;
|
|
5344
|
+
function formatSol(n) {
|
|
5345
|
+
return parseFloat(n.toFixed(9)).toString();
|
|
5346
|
+
}
|
|
5347
|
+
function toPng(url) {
|
|
5348
|
+
if (!url) return null;
|
|
5349
|
+
return url.replace("/svg?", "/png?");
|
|
5350
|
+
}
|
|
5343
5351
|
function JoinGameSheet({
|
|
5344
5352
|
visible,
|
|
5345
5353
|
onDismiss,
|
|
@@ -5350,6 +5358,8 @@ function JoinGameSheet({
|
|
|
5350
5358
|
awayColor = "#EF4444",
|
|
5351
5359
|
onSuccess,
|
|
5352
5360
|
onError,
|
|
5361
|
+
onTeamSelect,
|
|
5362
|
+
onJoinSuccess,
|
|
5353
5363
|
isPoolModeEnabled = false
|
|
5354
5364
|
}) {
|
|
5355
5365
|
const t = useDubsTheme();
|
|
@@ -5357,7 +5367,10 @@ function JoinGameSheet({
|
|
|
5357
5367
|
const mutation = useJoinGame();
|
|
5358
5368
|
const isCustomGame = game.gameMode === CUSTOM_GAME_MODE;
|
|
5359
5369
|
const [selectedTeam, setSelectedTeam] = useState28(null);
|
|
5370
|
+
const [showSuccess, setShowSuccess] = useState28(false);
|
|
5360
5371
|
const overlayOpacity = useRef9(new Animated4.Value(0)).current;
|
|
5372
|
+
const successScale = useRef9(new Animated4.Value(0)).current;
|
|
5373
|
+
const successOpacity = useRef9(new Animated4.Value(0)).current;
|
|
5361
5374
|
useEffect17(() => {
|
|
5362
5375
|
Animated4.timing(overlayOpacity, {
|
|
5363
5376
|
toValue: visible ? 1 : 0,
|
|
@@ -5368,15 +5381,26 @@ function JoinGameSheet({
|
|
|
5368
5381
|
useEffect17(() => {
|
|
5369
5382
|
if (visible) {
|
|
5370
5383
|
setSelectedTeam(isPoolModeEnabled ? "home" : isCustomGame ? "away" : null);
|
|
5384
|
+
setShowSuccess(false);
|
|
5385
|
+
successScale.setValue(0);
|
|
5386
|
+
successOpacity.setValue(0);
|
|
5371
5387
|
mutation.reset();
|
|
5372
5388
|
}
|
|
5373
5389
|
}, [visible]);
|
|
5374
5390
|
useEffect17(() => {
|
|
5375
5391
|
if (mutation.status === "success" && mutation.data) {
|
|
5392
|
+
setShowSuccess(true);
|
|
5376
5393
|
onSuccess?.(mutation.data);
|
|
5394
|
+
onJoinSuccess?.(mutation.data);
|
|
5395
|
+
Animated4.parallel([
|
|
5396
|
+
Animated4.spring(successScale, { toValue: 1, friction: 4, tension: 80, useNativeDriver: true }),
|
|
5397
|
+
Animated4.timing(successOpacity, { toValue: 1, duration: 300, useNativeDriver: true })
|
|
5398
|
+
]).start();
|
|
5377
5399
|
const timer = setTimeout(() => {
|
|
5378
|
-
|
|
5379
|
-
|
|
5400
|
+
Animated4.timing(successOpacity, { toValue: 0, duration: 300, useNativeDriver: true }).start(() => {
|
|
5401
|
+
onDismiss();
|
|
5402
|
+
});
|
|
5403
|
+
}, 2500);
|
|
5380
5404
|
return () => clearTimeout(timer);
|
|
5381
5405
|
}
|
|
5382
5406
|
}, [mutation.status, mutation.data]);
|
|
@@ -5399,7 +5423,7 @@ function JoinGameSheet({
|
|
|
5399
5423
|
}), [totalPool, homePool, awayPool, bettors]);
|
|
5400
5424
|
const poolAfterJoin = totalPool + buyIn;
|
|
5401
5425
|
const selectedOdds = selectedTeam === "home" ? homeOdds : selectedTeam === "away" ? awayOdds : "\u2014";
|
|
5402
|
-
const potentialWinnings = selectedOdds !== "\u2014" ? (parseFloat(selectedOdds) * buyIn)
|
|
5426
|
+
const potentialWinnings = selectedOdds !== "\u2014" ? formatSol(parseFloat(selectedOdds) * buyIn) : "\u2014";
|
|
5403
5427
|
const homeName = shortName ? shortName(opponents[0]?.name) : opponents[0]?.name || "Home";
|
|
5404
5428
|
const awayName = shortName ? shortName(opponents[1]?.name) : opponents[1]?.name || "Away";
|
|
5405
5429
|
const selectedName = selectedTeam === "home" ? homeName : selectedTeam === "away" ? awayName : "\u2014";
|
|
@@ -5432,6 +5456,15 @@ function JoinGameSheet({
|
|
|
5432
5456
|
onRequestClose: onDismiss,
|
|
5433
5457
|
children: [
|
|
5434
5458
|
/* @__PURE__ */ jsx16(Animated4.View, { style: [styles13.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ jsx16(TouchableOpacity10, { style: styles13.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
5459
|
+
showSuccess && /* @__PURE__ */ jsx16(View14, { style: styles13.successOverlay, children: /* @__PURE__ */ jsxs13(Animated4.View, { style: [styles13.successContent, { opacity: successOpacity, transform: [{ scale: successScale }] }], children: [
|
|
5460
|
+
/* @__PURE__ */ jsx16(Text14, { style: styles13.successEmoji, children: "\u{1F389}" }),
|
|
5461
|
+
/* @__PURE__ */ jsx16(Text14, { style: styles13.successTitle, children: "You're in!" }),
|
|
5462
|
+
/* @__PURE__ */ jsxs13(Text14, { style: styles13.successSub, children: [
|
|
5463
|
+
formatSol(buyIn),
|
|
5464
|
+
" SOL on ",
|
|
5465
|
+
selectedName
|
|
5466
|
+
] })
|
|
5467
|
+
] }) }),
|
|
5435
5468
|
/* @__PURE__ */ jsx16(
|
|
5436
5469
|
KeyboardAvoidingView4,
|
|
5437
5470
|
{
|
|
@@ -5443,6 +5476,24 @@ function JoinGameSheet({
|
|
|
5443
5476
|
/* @__PURE__ */ jsx16(Text14, { style: [styles13.headerTitle, { color: t.text }], children: isPoolModeEnabled ? "Join Pool" : "Join Game" }),
|
|
5444
5477
|
/* @__PURE__ */ jsx16(TouchableOpacity10, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ jsx16(Text14, { style: [styles13.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
5445
5478
|
] }),
|
|
5479
|
+
bettors.length > 0 && /* @__PURE__ */ jsxs13(View14, { style: styles13.bettorsSection, children: [
|
|
5480
|
+
/* @__PURE__ */ jsxs13(Text14, { style: [styles13.bettorsLabel, { color: t.textMuted }], children: [
|
|
5481
|
+
bettors.length,
|
|
5482
|
+
" ",
|
|
5483
|
+
bettors.length === 1 ? "player" : "players",
|
|
5484
|
+
" in this game"
|
|
5485
|
+
] }),
|
|
5486
|
+
/* @__PURE__ */ jsxs13(View14, { style: styles13.bettorsRow, children: [
|
|
5487
|
+
bettors.slice(0, 6).map((b, i) => {
|
|
5488
|
+
const pngUrl = toPng(b.avatar);
|
|
5489
|
+
return /* @__PURE__ */ jsx16(View14, { style: [styles13.bettorCircle, { backgroundColor: ["#EF4444", "#3B82F6", "#22C55E", "#F59E0B", "#A855F7", "#EC4899"][i % 6] }], children: pngUrl ? /* @__PURE__ */ jsx16(Image6, { source: { uri: pngUrl }, style: styles13.bettorImg }) : /* @__PURE__ */ jsx16(Text14, { style: styles13.bettorInitial, children: (b.username ?? b.wallet).charAt(0).toUpperCase() }) }, b.wallet);
|
|
5490
|
+
}),
|
|
5491
|
+
bettors.length > 6 && /* @__PURE__ */ jsx16(View14, { style: [styles13.bettorCircle, { backgroundColor: "#2C2C2E" }], children: /* @__PURE__ */ jsxs13(Text14, { style: styles13.bettorOverflow, children: [
|
|
5492
|
+
"+",
|
|
5493
|
+
bettors.length - 6
|
|
5494
|
+
] }) })
|
|
5495
|
+
] })
|
|
5496
|
+
] }),
|
|
5446
5497
|
!isCustomGame && !isPoolModeEnabled && /* @__PURE__ */ jsxs13(View14, { style: styles13.section, children: [
|
|
5447
5498
|
/* @__PURE__ */ jsx16(Text14, { style: [styles13.sectionLabel, { color: t.textSecondary }], children: "Pick Your Side" }),
|
|
5448
5499
|
/* @__PURE__ */ jsxs13(View14, { style: styles13.teamsRow, children: [
|
|
@@ -5455,7 +5506,10 @@ function JoinGameSheet({
|
|
|
5455
5506
|
bets: homeBets,
|
|
5456
5507
|
color: homeColor,
|
|
5457
5508
|
selected: selectedTeam === "home",
|
|
5458
|
-
onPress: () =>
|
|
5509
|
+
onPress: () => {
|
|
5510
|
+
setSelectedTeam("home");
|
|
5511
|
+
onTeamSelect?.("home");
|
|
5512
|
+
},
|
|
5459
5513
|
ImageComponent,
|
|
5460
5514
|
t
|
|
5461
5515
|
}
|
|
@@ -5469,7 +5523,10 @@ function JoinGameSheet({
|
|
|
5469
5523
|
bets: awayBets,
|
|
5470
5524
|
color: awayColor,
|
|
5471
5525
|
selected: selectedTeam === "away",
|
|
5472
|
-
onPress: () =>
|
|
5526
|
+
onPress: () => {
|
|
5527
|
+
setSelectedTeam("away");
|
|
5528
|
+
onTeamSelect?.("away");
|
|
5529
|
+
},
|
|
5473
5530
|
ImageComponent,
|
|
5474
5531
|
t
|
|
5475
5532
|
}
|
|
@@ -5480,7 +5537,7 @@ function JoinGameSheet({
|
|
|
5480
5537
|
/* @__PURE__ */ jsxs13(View14, { style: styles13.summaryRow, children: [
|
|
5481
5538
|
/* @__PURE__ */ jsx16(Text14, { style: [styles13.summaryLabel, { color: t.textMuted }], children: "Buy-in" }),
|
|
5482
5539
|
/* @__PURE__ */ jsxs13(Text14, { style: [styles13.summaryValue, { color: t.text }], children: [
|
|
5483
|
-
buyIn,
|
|
5540
|
+
formatSol(buyIn),
|
|
5484
5541
|
" SOL"
|
|
5485
5542
|
] })
|
|
5486
5543
|
] }),
|
|
@@ -5494,7 +5551,7 @@ function JoinGameSheet({
|
|
|
5494
5551
|
/* @__PURE__ */ jsxs13(View14, { style: styles13.summaryRow, children: [
|
|
5495
5552
|
/* @__PURE__ */ jsx16(Text14, { style: [styles13.summaryLabel, { color: t.textMuted }], children: "Current pot" }),
|
|
5496
5553
|
/* @__PURE__ */ jsxs13(Text14, { style: [styles13.summaryValue, { color: t.success }], children: [
|
|
5497
|
-
totalPool,
|
|
5554
|
+
formatSol(totalPool),
|
|
5498
5555
|
" SOL"
|
|
5499
5556
|
] })
|
|
5500
5557
|
] })
|
|
@@ -5507,7 +5564,7 @@ function JoinGameSheet({
|
|
|
5507
5564
|
/* @__PURE__ */ jsxs13(View14, { style: styles13.summaryRow, children: [
|
|
5508
5565
|
/* @__PURE__ */ jsx16(Text14, { style: [styles13.summaryLabel, { color: t.textMuted }], children: "Total pool" }),
|
|
5509
5566
|
/* @__PURE__ */ jsxs13(Text14, { style: [styles13.summaryValue, { color: t.text }], children: [
|
|
5510
|
-
poolAfterJoin,
|
|
5567
|
+
formatSol(poolAfterJoin),
|
|
5511
5568
|
" SOL"
|
|
5512
5569
|
] })
|
|
5513
5570
|
] }),
|
|
@@ -5533,7 +5590,7 @@ function JoinGameSheet({
|
|
|
5533
5590
|
children: isMutating ? /* @__PURE__ */ jsxs13(View14, { style: styles13.ctaLoading, children: [
|
|
5534
5591
|
/* @__PURE__ */ jsx16(ActivityIndicator8, { size: "small", color: "#FFFFFF" }),
|
|
5535
5592
|
/* @__PURE__ */ jsx16(Text14, { style: styles13.ctaText, children: statusLabel })
|
|
5536
|
-
] }) : mutation.status === "success" ? /* @__PURE__ */ jsx16(Text14, { style: styles13.ctaText, children: isPoolModeEnabled ? "Joined!" : STATUS_LABELS3.success }) : /* @__PURE__ */ jsx16(Text14, { style: [styles13.ctaText, !canJoin && { opacity: 0.5 }], children: alreadyJoined ? "Already Joined" : isPoolModeEnabled ? `Join Pool \u2014 ${buyIn} SOL` : selectedTeam ? `Join Game \u2014 ${buyIn} SOL` : "Pick a side to join" })
|
|
5593
|
+
] }) : mutation.status === "success" ? /* @__PURE__ */ jsx16(Text14, { style: styles13.ctaText, children: isPoolModeEnabled ? "Joined!" : STATUS_LABELS3.success }) : /* @__PURE__ */ jsx16(Text14, { style: [styles13.ctaText, !canJoin && { opacity: 0.5 }], children: alreadyJoined ? "Already Joined" : isPoolModeEnabled ? `Join Pool \u2014 ${formatSol(buyIn)} SOL` : selectedTeam ? `Join Game \u2014 ${formatSol(buyIn)} SOL` : "Pick a side to join" })
|
|
5537
5594
|
}
|
|
5538
5595
|
)
|
|
5539
5596
|
] }) })
|
|
@@ -5626,6 +5683,67 @@ var styles13 = StyleSheet14.create({
|
|
|
5626
5683
|
fontSize: 20,
|
|
5627
5684
|
padding: 4
|
|
5628
5685
|
},
|
|
5686
|
+
// Bettors row
|
|
5687
|
+
bettorsSection: {
|
|
5688
|
+
paddingBottom: 12,
|
|
5689
|
+
gap: 8
|
|
5690
|
+
},
|
|
5691
|
+
bettorsLabel: {
|
|
5692
|
+
fontSize: 12,
|
|
5693
|
+
fontWeight: "600"
|
|
5694
|
+
},
|
|
5695
|
+
bettorsRow: {
|
|
5696
|
+
flexDirection: "row",
|
|
5697
|
+
alignItems: "center",
|
|
5698
|
+
gap: 4
|
|
5699
|
+
},
|
|
5700
|
+
bettorCircle: {
|
|
5701
|
+
width: 28,
|
|
5702
|
+
height: 28,
|
|
5703
|
+
borderRadius: 14,
|
|
5704
|
+
alignItems: "center",
|
|
5705
|
+
justifyContent: "center",
|
|
5706
|
+
overflow: "hidden"
|
|
5707
|
+
},
|
|
5708
|
+
bettorImg: {
|
|
5709
|
+
width: 28,
|
|
5710
|
+
height: 28,
|
|
5711
|
+
borderRadius: 14
|
|
5712
|
+
},
|
|
5713
|
+
bettorInitial: {
|
|
5714
|
+
color: "#FFF",
|
|
5715
|
+
fontSize: 11,
|
|
5716
|
+
fontWeight: "800"
|
|
5717
|
+
},
|
|
5718
|
+
bettorOverflow: {
|
|
5719
|
+
color: "#8E8E93",
|
|
5720
|
+
fontSize: 10,
|
|
5721
|
+
fontWeight: "700"
|
|
5722
|
+
},
|
|
5723
|
+
// Success overlay
|
|
5724
|
+
successOverlay: {
|
|
5725
|
+
...StyleSheet14.absoluteFillObject,
|
|
5726
|
+
zIndex: 100,
|
|
5727
|
+
alignItems: "center",
|
|
5728
|
+
justifyContent: "center",
|
|
5729
|
+
backgroundColor: "rgba(0,0,0,0.85)"
|
|
5730
|
+
},
|
|
5731
|
+
successContent: {
|
|
5732
|
+
alignItems: "center",
|
|
5733
|
+
gap: 12
|
|
5734
|
+
},
|
|
5735
|
+
successEmoji: {
|
|
5736
|
+
fontSize: 64
|
|
5737
|
+
},
|
|
5738
|
+
successTitle: {
|
|
5739
|
+
color: "#FFFFFF",
|
|
5740
|
+
fontSize: 28,
|
|
5741
|
+
fontWeight: "900"
|
|
5742
|
+
},
|
|
5743
|
+
successSub: {
|
|
5744
|
+
color: "#8E8E93",
|
|
5745
|
+
fontSize: 16
|
|
5746
|
+
},
|
|
5629
5747
|
section: {
|
|
5630
5748
|
gap: 12,
|
|
5631
5749
|
paddingTop: 8
|
|
@@ -6376,7 +6494,7 @@ import {
|
|
|
6376
6494
|
StyleSheet as StyleSheet18,
|
|
6377
6495
|
KeyboardAvoidingView as KeyboardAvoidingView7,
|
|
6378
6496
|
Platform as Platform10,
|
|
6379
|
-
Image as
|
|
6497
|
+
Image as Image7,
|
|
6380
6498
|
FlatList
|
|
6381
6499
|
} from "react-native";
|
|
6382
6500
|
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
@@ -6417,7 +6535,7 @@ function ArcadeLeaderboardSheet({
|
|
|
6417
6535
|
],
|
|
6418
6536
|
children: [
|
|
6419
6537
|
/* @__PURE__ */ jsx20(View17, { style: styles17.rankCol, children: /* @__PURE__ */ jsx20(RankLabel, { index }) }),
|
|
6420
|
-
item.avatar ? /* @__PURE__ */ jsx20(
|
|
6538
|
+
item.avatar ? /* @__PURE__ */ jsx20(Image7, { source: { uri: ensurePngAvatar(item.avatar) }, style: styles17.avatar }) : /* @__PURE__ */ jsx20(View17, { style: [styles17.avatar, { backgroundColor: t.border }] }),
|
|
6421
6539
|
/* @__PURE__ */ jsxs17(View17, { style: styles17.nameCol, children: [
|
|
6422
6540
|
/* @__PURE__ */ jsx20(Text18, { style: [styles17.name, { color: t.text }], numberOfLines: 1, children: item.username || `${item.wallet_address.slice(0, 4)}...${item.wallet_address.slice(-4)}` }),
|
|
6423
6541
|
/* @__PURE__ */ jsxs17(Text18, { style: [styles17.lives, { color: t.textMuted }], children: [
|