@dubsdotapp/expo 0.3.4 → 0.3.6
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 +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +181 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +191 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -1
- package/src/ui/game/ArcadeLeaderboardSheet.tsx +222 -0
- package/src/ui/game/EnterArcadePoolSheet.tsx +11 -3
- package/src/ui/game/index.ts +2 -0
- package/src/ui/index.ts +2 -1
package/dist/index.mjs
CHANGED
|
@@ -5963,6 +5963,7 @@ function EnterArcadePoolSheet({
|
|
|
5963
5963
|
onDismiss,
|
|
5964
5964
|
pool,
|
|
5965
5965
|
stats,
|
|
5966
|
+
mode = "join",
|
|
5966
5967
|
onSuccess,
|
|
5967
5968
|
onError
|
|
5968
5969
|
}) {
|
|
@@ -6010,6 +6011,10 @@ function EnterArcadePoolSheet({
|
|
|
6010
6011
|
}
|
|
6011
6012
|
}, [wallet.publicKey, mutation.execute, pool.id]);
|
|
6012
6013
|
const statusLabel = STATUS_LABELS5[mutation.status] || "";
|
|
6014
|
+
const isRejoin = mode === "rejoin";
|
|
6015
|
+
const headerTitle = isRejoin ? "Play Again" : "Join Pool";
|
|
6016
|
+
const ctaLabel = isRejoin ? `Play Again \u2014 ${buyInSol} SOL` : `Join Pool \u2014 ${buyInSol} SOL`;
|
|
6017
|
+
const successLabel = isRejoin ? "Lives refilled!" : "Joined!";
|
|
6013
6018
|
return /* @__PURE__ */ jsxs16(
|
|
6014
6019
|
Modal5,
|
|
6015
6020
|
{
|
|
@@ -6027,7 +6032,7 @@ function EnterArcadePoolSheet({
|
|
|
6027
6032
|
children: /* @__PURE__ */ jsx18(View15, { style: styles15.sheetPositioner, children: /* @__PURE__ */ jsxs16(View15, { style: [styles15.sheet, { backgroundColor: t.background }], children: [
|
|
6028
6033
|
/* @__PURE__ */ jsx18(View15, { style: styles15.handleRow, children: /* @__PURE__ */ jsx18(View15, { style: [styles15.handle, { backgroundColor: t.textMuted }] }) }),
|
|
6029
6034
|
/* @__PURE__ */ jsxs16(View15, { style: styles15.header, children: [
|
|
6030
|
-
/* @__PURE__ */ jsx18(Text16, { style: [styles15.headerTitle, { color: t.text }], children:
|
|
6035
|
+
/* @__PURE__ */ jsx18(Text16, { style: [styles15.headerTitle, { color: t.text }], children: headerTitle }),
|
|
6031
6036
|
/* @__PURE__ */ jsx18(TouchableOpacity12, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ jsx18(Text16, { style: [styles15.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
6032
6037
|
] }),
|
|
6033
6038
|
/* @__PURE__ */ jsx18(Text16, { style: [styles15.poolName, { color: t.textSecondary }], children: pool.name }),
|
|
@@ -6079,7 +6084,7 @@ function EnterArcadePoolSheet({
|
|
|
6079
6084
|
children: isMutating ? /* @__PURE__ */ jsxs16(View15, { style: styles15.ctaLoading, children: [
|
|
6080
6085
|
/* @__PURE__ */ jsx18(ActivityIndicator9, { size: "small", color: "#FFFFFF" }),
|
|
6081
6086
|
/* @__PURE__ */ jsx18(Text16, { style: styles15.ctaText, children: statusLabel })
|
|
6082
|
-
] }) : mutation.status === "success" ? /* @__PURE__ */ jsx18(Text16, { style: styles15.ctaText, children:
|
|
6087
|
+
] }) : mutation.status === "success" ? /* @__PURE__ */ jsx18(Text16, { style: styles15.ctaText, children: successLabel }) : /* @__PURE__ */ jsx18(Text16, { style: [styles15.ctaText, !canJoin && { opacity: 0.5 }], children: ctaLabel })
|
|
6083
6088
|
}
|
|
6084
6089
|
)
|
|
6085
6090
|
] }) })
|
|
@@ -6147,7 +6152,191 @@ var styles15 = StyleSheet16.create({
|
|
|
6147
6152
|
ctaText: { color: "#FFFFFF", fontSize: 16, fontWeight: "700" },
|
|
6148
6153
|
ctaLoading: { flexDirection: "row", alignItems: "center", gap: 10 }
|
|
6149
6154
|
});
|
|
6155
|
+
|
|
6156
|
+
// src/ui/game/ArcadeLeaderboardSheet.tsx
|
|
6157
|
+
import { useEffect as useEffect19, useRef as useRef10 } from "react";
|
|
6158
|
+
import {
|
|
6159
|
+
View as View16,
|
|
6160
|
+
Text as Text17,
|
|
6161
|
+
TouchableOpacity as TouchableOpacity13,
|
|
6162
|
+
Modal as Modal6,
|
|
6163
|
+
Animated as Animated7,
|
|
6164
|
+
StyleSheet as StyleSheet17,
|
|
6165
|
+
KeyboardAvoidingView as KeyboardAvoidingView7,
|
|
6166
|
+
Platform as Platform10,
|
|
6167
|
+
Image as Image6,
|
|
6168
|
+
FlatList
|
|
6169
|
+
} from "react-native";
|
|
6170
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6171
|
+
function RankLabel({ index }) {
|
|
6172
|
+
if (index === 0) return /* @__PURE__ */ jsx19(Text17, { style: styles16.rankEmoji, children: "\u{1F947}" });
|
|
6173
|
+
if (index === 1) return /* @__PURE__ */ jsx19(Text17, { style: styles16.rankEmoji, children: "\u{1F948}" });
|
|
6174
|
+
if (index === 2) return /* @__PURE__ */ jsx19(Text17, { style: styles16.rankEmoji, children: "\u{1F949}" });
|
|
6175
|
+
return /* @__PURE__ */ jsx19(Text17, { style: styles16.rankNum, children: index + 1 });
|
|
6176
|
+
}
|
|
6177
|
+
function ArcadeLeaderboardSheet({
|
|
6178
|
+
visible,
|
|
6179
|
+
onDismiss,
|
|
6180
|
+
poolId,
|
|
6181
|
+
highlightWallet
|
|
6182
|
+
}) {
|
|
6183
|
+
const t = useDubsTheme();
|
|
6184
|
+
const { pool, leaderboard, stats, loading, refetch } = useArcadePool(poolId);
|
|
6185
|
+
const overlayOpacity = useRef10(new Animated7.Value(0)).current;
|
|
6186
|
+
useEffect19(() => {
|
|
6187
|
+
Animated7.timing(overlayOpacity, {
|
|
6188
|
+
toValue: visible ? 1 : 0,
|
|
6189
|
+
duration: 250,
|
|
6190
|
+
useNativeDriver: true
|
|
6191
|
+
}).start();
|
|
6192
|
+
}, [visible, overlayOpacity]);
|
|
6193
|
+
useEffect19(() => {
|
|
6194
|
+
if (visible) refetch();
|
|
6195
|
+
}, [visible]);
|
|
6196
|
+
const renderItem = ({ item, index }) => {
|
|
6197
|
+
const isMe = highlightWallet && item.wallet_address === highlightWallet;
|
|
6198
|
+
return /* @__PURE__ */ jsxs17(
|
|
6199
|
+
View16,
|
|
6200
|
+
{
|
|
6201
|
+
style: [
|
|
6202
|
+
styles16.row,
|
|
6203
|
+
{ backgroundColor: isMe ? `${t.accent}18` : index % 2 === 0 ? t.surface : "transparent" },
|
|
6204
|
+
isMe ? { borderWidth: 1, borderColor: t.accent } : void 0
|
|
6205
|
+
],
|
|
6206
|
+
children: [
|
|
6207
|
+
/* @__PURE__ */ jsx19(View16, { style: styles16.rankCol, children: /* @__PURE__ */ jsx19(RankLabel, { index }) }),
|
|
6208
|
+
item.avatar ? /* @__PURE__ */ jsx19(Image6, { source: { uri: item.avatar }, style: styles16.avatar }) : /* @__PURE__ */ jsx19(View16, { style: [styles16.avatar, { backgroundColor: t.border }] }),
|
|
6209
|
+
/* @__PURE__ */ jsxs17(View16, { style: styles16.nameCol, children: [
|
|
6210
|
+
/* @__PURE__ */ jsx19(Text17, { style: [styles16.name, { color: t.text }], numberOfLines: 1, children: item.username || `${item.wallet_address.slice(0, 4)}...${item.wallet_address.slice(-4)}` }),
|
|
6211
|
+
/* @__PURE__ */ jsxs17(Text17, { style: [styles16.lives, { color: t.textMuted }], children: [
|
|
6212
|
+
item.lives_used,
|
|
6213
|
+
" ",
|
|
6214
|
+
item.lives_used === 1 ? "life" : "lives",
|
|
6215
|
+
" used"
|
|
6216
|
+
] })
|
|
6217
|
+
] }),
|
|
6218
|
+
/* @__PURE__ */ jsx19(Text17, { style: [styles16.score, { color: t.accent }], children: item.best_score })
|
|
6219
|
+
]
|
|
6220
|
+
}
|
|
6221
|
+
);
|
|
6222
|
+
};
|
|
6223
|
+
return /* @__PURE__ */ jsxs17(
|
|
6224
|
+
Modal6,
|
|
6225
|
+
{
|
|
6226
|
+
visible,
|
|
6227
|
+
animationType: "slide",
|
|
6228
|
+
transparent: true,
|
|
6229
|
+
onRequestClose: onDismiss,
|
|
6230
|
+
children: [
|
|
6231
|
+
/* @__PURE__ */ jsx19(Animated7.View, { style: [styles16.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ jsx19(TouchableOpacity13, { style: styles16.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
6232
|
+
/* @__PURE__ */ jsx19(
|
|
6233
|
+
KeyboardAvoidingView7,
|
|
6234
|
+
{
|
|
6235
|
+
style: styles16.keyboardView,
|
|
6236
|
+
behavior: Platform10.OS === "ios" ? "padding" : void 0,
|
|
6237
|
+
children: /* @__PURE__ */ jsx19(View16, { style: styles16.sheetPositioner, children: /* @__PURE__ */ jsxs17(View16, { style: [styles16.sheet, { backgroundColor: t.background }], children: [
|
|
6238
|
+
/* @__PURE__ */ jsx19(View16, { style: styles16.handleRow, children: /* @__PURE__ */ jsx19(View16, { style: [styles16.handle, { backgroundColor: t.textMuted }] }) }),
|
|
6239
|
+
/* @__PURE__ */ jsxs17(View16, { style: styles16.header, children: [
|
|
6240
|
+
/* @__PURE__ */ jsxs17(View16, { children: [
|
|
6241
|
+
/* @__PURE__ */ jsx19(Text17, { style: [styles16.headerTitle, { color: t.text }], children: "Leaderboard" }),
|
|
6242
|
+
pool && /* @__PURE__ */ jsx19(Text17, { style: [styles16.poolName, { color: t.textMuted }], children: pool.name })
|
|
6243
|
+
] }),
|
|
6244
|
+
/* @__PURE__ */ jsx19(TouchableOpacity13, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ jsx19(Text17, { style: [styles16.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
6245
|
+
] }),
|
|
6246
|
+
stats && /* @__PURE__ */ jsxs17(View16, { style: [styles16.statsBar, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
6247
|
+
/* @__PURE__ */ jsxs17(View16, { style: styles16.statItem, children: [
|
|
6248
|
+
/* @__PURE__ */ jsx19(Text17, { style: [styles16.statValue, { color: t.text }], children: stats.total_entries }),
|
|
6249
|
+
/* @__PURE__ */ jsx19(Text17, { style: [styles16.statLabel, { color: t.textMuted }], children: "Players" })
|
|
6250
|
+
] }),
|
|
6251
|
+
/* @__PURE__ */ jsx19(View16, { style: [styles16.statDivider, { backgroundColor: t.border }] }),
|
|
6252
|
+
/* @__PURE__ */ jsxs17(View16, { style: styles16.statItem, children: [
|
|
6253
|
+
/* @__PURE__ */ jsx19(Text17, { style: [styles16.statValue, { color: t.accent }], children: stats.top_score }),
|
|
6254
|
+
/* @__PURE__ */ jsx19(Text17, { style: [styles16.statLabel, { color: t.textMuted }], children: "Top Score" })
|
|
6255
|
+
] }),
|
|
6256
|
+
/* @__PURE__ */ jsx19(View16, { style: [styles16.statDivider, { backgroundColor: t.border }] }),
|
|
6257
|
+
/* @__PURE__ */ jsxs17(View16, { style: styles16.statItem, children: [
|
|
6258
|
+
/* @__PURE__ */ jsx19(Text17, { style: [styles16.statValue, { color: t.text }], children: Math.round(stats.avg_score) }),
|
|
6259
|
+
/* @__PURE__ */ jsx19(Text17, { style: [styles16.statLabel, { color: t.textMuted }], children: "Avg Score" })
|
|
6260
|
+
] })
|
|
6261
|
+
] }),
|
|
6262
|
+
/* @__PURE__ */ jsx19(
|
|
6263
|
+
FlatList,
|
|
6264
|
+
{
|
|
6265
|
+
data: leaderboard,
|
|
6266
|
+
renderItem,
|
|
6267
|
+
keyExtractor: (item) => String(item.id),
|
|
6268
|
+
style: styles16.list,
|
|
6269
|
+
contentContainerStyle: styles16.listContent,
|
|
6270
|
+
ListEmptyComponent: /* @__PURE__ */ jsx19(View16, { style: styles16.emptyState, children: /* @__PURE__ */ jsx19(Text17, { style: [styles16.emptyText, { color: t.textMuted }], children: loading ? "Loading..." : "No scores yet" }) })
|
|
6271
|
+
}
|
|
6272
|
+
)
|
|
6273
|
+
] }) })
|
|
6274
|
+
}
|
|
6275
|
+
)
|
|
6276
|
+
]
|
|
6277
|
+
}
|
|
6278
|
+
);
|
|
6279
|
+
}
|
|
6280
|
+
var styles16 = StyleSheet17.create({
|
|
6281
|
+
overlay: {
|
|
6282
|
+
...StyleSheet17.absoluteFillObject,
|
|
6283
|
+
backgroundColor: "rgba(0,0,0,0.5)"
|
|
6284
|
+
},
|
|
6285
|
+
overlayTap: { flex: 1 },
|
|
6286
|
+
keyboardView: { flex: 1, justifyContent: "flex-end" },
|
|
6287
|
+
sheetPositioner: { flex: 1, justifyContent: "flex-end" },
|
|
6288
|
+
sheet: {
|
|
6289
|
+
borderTopLeftRadius: 24,
|
|
6290
|
+
borderTopRightRadius: 24,
|
|
6291
|
+
paddingHorizontal: 20,
|
|
6292
|
+
paddingBottom: 40,
|
|
6293
|
+
maxHeight: "80%"
|
|
6294
|
+
},
|
|
6295
|
+
handleRow: { alignItems: "center", paddingTop: 10, paddingBottom: 8 },
|
|
6296
|
+
handle: { width: 36, height: 4, borderRadius: 2, opacity: 0.4 },
|
|
6297
|
+
header: {
|
|
6298
|
+
flexDirection: "row",
|
|
6299
|
+
alignItems: "flex-start",
|
|
6300
|
+
justifyContent: "space-between",
|
|
6301
|
+
paddingVertical: 12
|
|
6302
|
+
},
|
|
6303
|
+
headerTitle: { fontSize: 20, fontWeight: "700" },
|
|
6304
|
+
poolName: { fontSize: 13, fontWeight: "600", marginTop: 2 },
|
|
6305
|
+
closeButton: { fontSize: 20, padding: 4 },
|
|
6306
|
+
statsBar: {
|
|
6307
|
+
flexDirection: "row",
|
|
6308
|
+
borderRadius: 12,
|
|
6309
|
+
borderWidth: 1,
|
|
6310
|
+
marginBottom: 12,
|
|
6311
|
+
overflow: "hidden"
|
|
6312
|
+
},
|
|
6313
|
+
statItem: { flex: 1, alignItems: "center", paddingVertical: 10 },
|
|
6314
|
+
statValue: { fontSize: 18, fontWeight: "800" },
|
|
6315
|
+
statLabel: { fontSize: 11, fontWeight: "600", marginTop: 2 },
|
|
6316
|
+
statDivider: { width: 1, marginVertical: 8 },
|
|
6317
|
+
list: { flexGrow: 0 },
|
|
6318
|
+
listContent: { paddingBottom: 8 },
|
|
6319
|
+
row: {
|
|
6320
|
+
flexDirection: "row",
|
|
6321
|
+
alignItems: "center",
|
|
6322
|
+
paddingVertical: 10,
|
|
6323
|
+
paddingHorizontal: 12,
|
|
6324
|
+
borderRadius: 10,
|
|
6325
|
+
marginBottom: 2
|
|
6326
|
+
},
|
|
6327
|
+
rankCol: { width: 32, alignItems: "center" },
|
|
6328
|
+
rankEmoji: { fontSize: 18 },
|
|
6329
|
+
rankNum: { fontSize: 14, fontWeight: "700", color: "#888" },
|
|
6330
|
+
avatar: { width: 32, height: 32, borderRadius: 16, marginRight: 10 },
|
|
6331
|
+
nameCol: { flex: 1 },
|
|
6332
|
+
name: { fontSize: 14, fontWeight: "600" },
|
|
6333
|
+
lives: { fontSize: 11, marginTop: 1 },
|
|
6334
|
+
score: { fontSize: 18, fontWeight: "800" },
|
|
6335
|
+
emptyState: { paddingVertical: 40, alignItems: "center" },
|
|
6336
|
+
emptyText: { fontSize: 14, fontWeight: "600" }
|
|
6337
|
+
});
|
|
6150
6338
|
export {
|
|
6339
|
+
ArcadeLeaderboardSheet,
|
|
6151
6340
|
AuthGate,
|
|
6152
6341
|
ClaimButton,
|
|
6153
6342
|
ClaimPrizeSheet,
|