@dubsdotapp/expo 0.5.6 → 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.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,
@@ -5351,6 +5359,7 @@ function JoinGameSheet({
5351
5359
  onSuccess,
5352
5360
  onError,
5353
5361
  onTeamSelect,
5362
+ onJoinSuccess,
5354
5363
  isPoolModeEnabled = false
5355
5364
  }) {
5356
5365
  const t = useDubsTheme();
@@ -5358,7 +5367,10 @@ function JoinGameSheet({
5358
5367
  const mutation = useJoinGame();
5359
5368
  const isCustomGame = game.gameMode === CUSTOM_GAME_MODE;
5360
5369
  const [selectedTeam, setSelectedTeam] = useState28(null);
5370
+ const [showSuccess, setShowSuccess] = useState28(false);
5361
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;
5362
5374
  useEffect17(() => {
5363
5375
  Animated4.timing(overlayOpacity, {
5364
5376
  toValue: visible ? 1 : 0,
@@ -5369,15 +5381,26 @@ function JoinGameSheet({
5369
5381
  useEffect17(() => {
5370
5382
  if (visible) {
5371
5383
  setSelectedTeam(isPoolModeEnabled ? "home" : isCustomGame ? "away" : null);
5384
+ setShowSuccess(false);
5385
+ successScale.setValue(0);
5386
+ successOpacity.setValue(0);
5372
5387
  mutation.reset();
5373
5388
  }
5374
5389
  }, [visible]);
5375
5390
  useEffect17(() => {
5376
5391
  if (mutation.status === "success" && mutation.data) {
5392
+ setShowSuccess(true);
5377
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();
5378
5399
  const timer = setTimeout(() => {
5379
- onDismiss();
5380
- }, 1500);
5400
+ Animated4.timing(successOpacity, { toValue: 0, duration: 300, useNativeDriver: true }).start(() => {
5401
+ onDismiss();
5402
+ });
5403
+ }, 2500);
5381
5404
  return () => clearTimeout(timer);
5382
5405
  }
5383
5406
  }, [mutation.status, mutation.data]);
@@ -5400,7 +5423,7 @@ function JoinGameSheet({
5400
5423
  }), [totalPool, homePool, awayPool, bettors]);
5401
5424
  const poolAfterJoin = totalPool + buyIn;
5402
5425
  const selectedOdds = selectedTeam === "home" ? homeOdds : selectedTeam === "away" ? awayOdds : "\u2014";
5403
- const potentialWinnings = selectedOdds !== "\u2014" ? (parseFloat(selectedOdds) * buyIn).toFixed(4) : "\u2014";
5426
+ const potentialWinnings = selectedOdds !== "\u2014" ? formatSol(parseFloat(selectedOdds) * buyIn) : "\u2014";
5404
5427
  const homeName = shortName ? shortName(opponents[0]?.name) : opponents[0]?.name || "Home";
5405
5428
  const awayName = shortName ? shortName(opponents[1]?.name) : opponents[1]?.name || "Away";
5406
5429
  const selectedName = selectedTeam === "home" ? homeName : selectedTeam === "away" ? awayName : "\u2014";
@@ -5433,6 +5456,15 @@ function JoinGameSheet({
5433
5456
  onRequestClose: onDismiss,
5434
5457
  children: [
5435
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
+ ] }) }),
5436
5468
  /* @__PURE__ */ jsx16(
5437
5469
  KeyboardAvoidingView4,
5438
5470
  {
@@ -5444,6 +5476,24 @@ function JoinGameSheet({
5444
5476
  /* @__PURE__ */ jsx16(Text14, { style: [styles13.headerTitle, { color: t.text }], children: isPoolModeEnabled ? "Join Pool" : "Join Game" }),
5445
5477
  /* @__PURE__ */ jsx16(TouchableOpacity10, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ jsx16(Text14, { style: [styles13.closeButton, { color: t.textMuted }], children: "\u2715" }) })
5446
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
+ ] }),
5447
5497
  !isCustomGame && !isPoolModeEnabled && /* @__PURE__ */ jsxs13(View14, { style: styles13.section, children: [
5448
5498
  /* @__PURE__ */ jsx16(Text14, { style: [styles13.sectionLabel, { color: t.textSecondary }], children: "Pick Your Side" }),
5449
5499
  /* @__PURE__ */ jsxs13(View14, { style: styles13.teamsRow, children: [
@@ -5487,7 +5537,7 @@ function JoinGameSheet({
5487
5537
  /* @__PURE__ */ jsxs13(View14, { style: styles13.summaryRow, children: [
5488
5538
  /* @__PURE__ */ jsx16(Text14, { style: [styles13.summaryLabel, { color: t.textMuted }], children: "Buy-in" }),
5489
5539
  /* @__PURE__ */ jsxs13(Text14, { style: [styles13.summaryValue, { color: t.text }], children: [
5490
- buyIn,
5540
+ formatSol(buyIn),
5491
5541
  " SOL"
5492
5542
  ] })
5493
5543
  ] }),
@@ -5501,7 +5551,7 @@ function JoinGameSheet({
5501
5551
  /* @__PURE__ */ jsxs13(View14, { style: styles13.summaryRow, children: [
5502
5552
  /* @__PURE__ */ jsx16(Text14, { style: [styles13.summaryLabel, { color: t.textMuted }], children: "Current pot" }),
5503
5553
  /* @__PURE__ */ jsxs13(Text14, { style: [styles13.summaryValue, { color: t.success }], children: [
5504
- totalPool,
5554
+ formatSol(totalPool),
5505
5555
  " SOL"
5506
5556
  ] })
5507
5557
  ] })
@@ -5514,7 +5564,7 @@ function JoinGameSheet({
5514
5564
  /* @__PURE__ */ jsxs13(View14, { style: styles13.summaryRow, children: [
5515
5565
  /* @__PURE__ */ jsx16(Text14, { style: [styles13.summaryLabel, { color: t.textMuted }], children: "Total pool" }),
5516
5566
  /* @__PURE__ */ jsxs13(Text14, { style: [styles13.summaryValue, { color: t.text }], children: [
5517
- poolAfterJoin,
5567
+ formatSol(poolAfterJoin),
5518
5568
  " SOL"
5519
5569
  ] })
5520
5570
  ] }),
@@ -5540,7 +5590,7 @@ function JoinGameSheet({
5540
5590
  children: isMutating ? /* @__PURE__ */ jsxs13(View14, { style: styles13.ctaLoading, children: [
5541
5591
  /* @__PURE__ */ jsx16(ActivityIndicator8, { size: "small", color: "#FFFFFF" }),
5542
5592
  /* @__PURE__ */ jsx16(Text14, { style: styles13.ctaText, children: statusLabel })
5543
- ] }) : 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" })
5544
5594
  }
5545
5595
  )
5546
5596
  ] }) })
@@ -5633,6 +5683,67 @@ var styles13 = StyleSheet14.create({
5633
5683
  fontSize: 20,
5634
5684
  padding: 4
5635
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
+ },
5636
5747
  section: {
5637
5748
  gap: 12,
5638
5749
  paddingTop: 8
@@ -6383,7 +6494,7 @@ import {
6383
6494
  StyleSheet as StyleSheet18,
6384
6495
  KeyboardAvoidingView as KeyboardAvoidingView7,
6385
6496
  Platform as Platform10,
6386
- Image as Image6,
6497
+ Image as Image7,
6387
6498
  FlatList
6388
6499
  } from "react-native";
6389
6500
  import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
@@ -6424,7 +6535,7 @@ function ArcadeLeaderboardSheet({
6424
6535
  ],
6425
6536
  children: [
6426
6537
  /* @__PURE__ */ jsx20(View17, { style: styles17.rankCol, children: /* @__PURE__ */ jsx20(RankLabel, { index }) }),
6427
- item.avatar ? /* @__PURE__ */ jsx20(Image6, { source: { uri: ensurePngAvatar(item.avatar) }, style: styles17.avatar }) : /* @__PURE__ */ jsx20(View17, { style: [styles17.avatar, { backgroundColor: t.border }] }),
6538
+ item.avatar ? /* @__PURE__ */ jsx20(Image7, { source: { uri: ensurePngAvatar(item.avatar) }, style: styles17.avatar }) : /* @__PURE__ */ jsx20(View17, { style: [styles17.avatar, { backgroundColor: t.border }] }),
6428
6539
  /* @__PURE__ */ jsxs17(View17, { style: styles17.nameCol, children: [
6429
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)}` }),
6430
6541
  /* @__PURE__ */ jsxs17(Text18, { style: [styles17.lives, { color: t.textMuted }], children: [