@dubsdotapp/expo 0.3.0 → 0.3.2
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 +1 -62
- package/dist/index.d.ts +1 -62
- package/dist/index.js +302 -627
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +319 -654
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +72 -26
- package/src/hooks/index.ts +6 -0
- package/src/hooks/useArcadeGame.ts +102 -0
- package/src/hooks/useArcadePool.ts +44 -0
- package/src/hooks/useArcadePools.ts +34 -0
- package/src/index.ts +15 -5
- package/src/types.ts +62 -45
- package/src/ui/index.ts +0 -2
- package/src/ui/DeveloperDashboardSheet.tsx +0 -353
package/dist/index.mjs
CHANGED
|
@@ -520,31 +520,6 @@ var DubsClient = class {
|
|
|
520
520
|
}
|
|
521
521
|
return config;
|
|
522
522
|
}
|
|
523
|
-
// ── Developer Commissions ──
|
|
524
|
-
/** Fetch paginated list of commission earnings for this app */
|
|
525
|
-
async getCommissions(params) {
|
|
526
|
-
const qs = new URLSearchParams();
|
|
527
|
-
if (params?.limit != null) qs.set("limit", String(params.limit));
|
|
528
|
-
if (params?.offset != null) qs.set("offset", String(params.offset));
|
|
529
|
-
const query = qs.toString();
|
|
530
|
-
const res = await this.request(
|
|
531
|
-
"GET",
|
|
532
|
-
`/commissions${query ? `?${query}` : ""}`
|
|
533
|
-
);
|
|
534
|
-
return {
|
|
535
|
-
commissions: res.commissions,
|
|
536
|
-
summary: res.summary,
|
|
537
|
-
pagination: res.pagination
|
|
538
|
-
};
|
|
539
|
-
}
|
|
540
|
-
/** Fetch a quick summary of commission earnings for this app */
|
|
541
|
-
async getCommissionsSummary() {
|
|
542
|
-
const res = await this.request(
|
|
543
|
-
"GET",
|
|
544
|
-
"/commissions/summary"
|
|
545
|
-
);
|
|
546
|
-
return res.summary;
|
|
547
|
-
}
|
|
548
523
|
};
|
|
549
524
|
|
|
550
525
|
// src/storage.ts
|
|
@@ -4033,319 +4008,10 @@ var styles5 = StyleSheet6.create({
|
|
|
4033
4008
|
}
|
|
4034
4009
|
});
|
|
4035
4010
|
|
|
4036
|
-
// src/ui/DeveloperDashboardSheet.tsx
|
|
4037
|
-
import { useCallback as useCallback17, useEffect as useEffect13, useRef as useRef6, useState as useState18 } from "react";
|
|
4038
|
-
import {
|
|
4039
|
-
ActivityIndicator as ActivityIndicator5,
|
|
4040
|
-
Animated as Animated3,
|
|
4041
|
-
FlatList,
|
|
4042
|
-
KeyboardAvoidingView as KeyboardAvoidingView3,
|
|
4043
|
-
Modal as Modal2,
|
|
4044
|
-
Platform as Platform6,
|
|
4045
|
-
StyleSheet as StyleSheet7,
|
|
4046
|
-
Text as Text7,
|
|
4047
|
-
TouchableOpacity as TouchableOpacity6,
|
|
4048
|
-
View as View7
|
|
4049
|
-
} from "react-native";
|
|
4050
|
-
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
4051
|
-
function DeveloperDashboardSheet({ visible, onDismiss }) {
|
|
4052
|
-
const t = useDubsTheme();
|
|
4053
|
-
const { client } = useDubs();
|
|
4054
|
-
const [summary, setSummary] = useState18(null);
|
|
4055
|
-
const [commissions, setCommissions] = useState18([]);
|
|
4056
|
-
const [loading, setLoading] = useState18(false);
|
|
4057
|
-
const [error, setError] = useState18(null);
|
|
4058
|
-
const overlayOpacity = useRef6(new Animated3.Value(0)).current;
|
|
4059
|
-
useEffect13(() => {
|
|
4060
|
-
Animated3.timing(overlayOpacity, {
|
|
4061
|
-
toValue: visible ? 1 : 0,
|
|
4062
|
-
duration: 250,
|
|
4063
|
-
useNativeDriver: true
|
|
4064
|
-
}).start();
|
|
4065
|
-
}, [visible, overlayOpacity]);
|
|
4066
|
-
const fetchData = useCallback17(async () => {
|
|
4067
|
-
setLoading(true);
|
|
4068
|
-
setError(null);
|
|
4069
|
-
try {
|
|
4070
|
-
const result = await client.getCommissions({ limit: 50 });
|
|
4071
|
-
setCommissions(result.commissions);
|
|
4072
|
-
setSummary(result.summary);
|
|
4073
|
-
} catch (err) {
|
|
4074
|
-
setError(err instanceof Error ? err.message : "Failed to load commissions");
|
|
4075
|
-
} finally {
|
|
4076
|
-
setLoading(false);
|
|
4077
|
-
}
|
|
4078
|
-
}, [client]);
|
|
4079
|
-
useEffect13(() => {
|
|
4080
|
-
if (visible) fetchData();
|
|
4081
|
-
}, [visible, fetchData]);
|
|
4082
|
-
const formatSol = (sol) => {
|
|
4083
|
-
if (sol === 0) return "0";
|
|
4084
|
-
if (sol < 1e-3) return "<0.001";
|
|
4085
|
-
return sol.toFixed(3);
|
|
4086
|
-
};
|
|
4087
|
-
const renderCommission = ({ item }) => /* @__PURE__ */ jsxs7(View7, { style: [styles6.row, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
4088
|
-
/* @__PURE__ */ jsxs7(View7, { style: styles6.rowTop, children: [
|
|
4089
|
-
/* @__PURE__ */ jsxs7(Text7, { style: [styles6.rowGameId, { color: t.text }], numberOfLines: 1, children: [
|
|
4090
|
-
item.gameId.slice(0, 16),
|
|
4091
|
-
"..."
|
|
4092
|
-
] }),
|
|
4093
|
-
/* @__PURE__ */ jsxs7(Text7, { style: [styles6.rowAmount, { color: t.success }], children: [
|
|
4094
|
-
"+",
|
|
4095
|
-
formatSol(item.amountSol),
|
|
4096
|
-
" SOL"
|
|
4097
|
-
] })
|
|
4098
|
-
] }),
|
|
4099
|
-
/* @__PURE__ */ jsxs7(View7, { style: styles6.rowBottom, children: [
|
|
4100
|
-
/* @__PURE__ */ jsxs7(Text7, { style: [styles6.rowMeta, { color: t.textMuted }], children: [
|
|
4101
|
-
item.gameType || "game",
|
|
4102
|
-
" | pot ",
|
|
4103
|
-
formatSol(item.potSizeSol),
|
|
4104
|
-
" SOL"
|
|
4105
|
-
] }),
|
|
4106
|
-
/* @__PURE__ */ jsx9(View7, { style: [
|
|
4107
|
-
styles6.statusBadge,
|
|
4108
|
-
{ backgroundColor: item.status === "paid" ? t.success + "22" : t.accent + "22" }
|
|
4109
|
-
], children: /* @__PURE__ */ jsx9(Text7, { style: [
|
|
4110
|
-
styles6.statusText,
|
|
4111
|
-
{ color: item.status === "paid" ? t.success : t.accent }
|
|
4112
|
-
], children: item.status }) })
|
|
4113
|
-
] }),
|
|
4114
|
-
/* @__PURE__ */ jsx9(Text7, { style: [styles6.rowDate, { color: t.textDim }], children: new Date(item.createdAt).toLocaleDateString() })
|
|
4115
|
-
] });
|
|
4116
|
-
return /* @__PURE__ */ jsxs7(Modal2, { visible, animationType: "slide", transparent: true, onRequestClose: onDismiss, children: [
|
|
4117
|
-
/* @__PURE__ */ jsx9(Animated3.View, { style: [styles6.overlay, { opacity: overlayOpacity }] }),
|
|
4118
|
-
/* @__PURE__ */ jsxs7(
|
|
4119
|
-
KeyboardAvoidingView3,
|
|
4120
|
-
{
|
|
4121
|
-
style: styles6.flex,
|
|
4122
|
-
behavior: Platform6.OS === "ios" ? "padding" : void 0,
|
|
4123
|
-
children: [
|
|
4124
|
-
/* @__PURE__ */ jsx9(View7, { style: styles6.flex }),
|
|
4125
|
-
/* @__PURE__ */ jsxs7(View7, { style: [styles6.sheet, { backgroundColor: t.background }], children: [
|
|
4126
|
-
/* @__PURE__ */ jsx9(View7, { style: styles6.handleRow, children: /* @__PURE__ */ jsx9(View7, { style: [styles6.handle, { backgroundColor: t.textMuted }] }) }),
|
|
4127
|
-
/* @__PURE__ */ jsxs7(View7, { style: styles6.header, children: [
|
|
4128
|
-
/* @__PURE__ */ jsx9(Text7, { style: [styles6.headerTitle, { color: t.text }], children: "Commission Earnings" }),
|
|
4129
|
-
/* @__PURE__ */ jsx9(TouchableOpacity6, { onPress: onDismiss, hitSlop: { top: 12, bottom: 12, left: 12, right: 12 }, children: /* @__PURE__ */ jsx9(Text7, { style: [styles6.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
4130
|
-
] }),
|
|
4131
|
-
summary && /* @__PURE__ */ jsxs7(View7, { style: styles6.summaryRow, children: [
|
|
4132
|
-
/* @__PURE__ */ jsxs7(View7, { style: [styles6.summaryCard, { backgroundColor: t.surface }], children: [
|
|
4133
|
-
/* @__PURE__ */ jsx9(Text7, { style: [styles6.summaryLabel, { color: t.textMuted }], children: "Total Earned" }),
|
|
4134
|
-
/* @__PURE__ */ jsxs7(Text7, { style: [styles6.summaryValue, { color: t.success }], children: [
|
|
4135
|
-
formatSol(summary.totalEarnedSol),
|
|
4136
|
-
" SOL"
|
|
4137
|
-
] })
|
|
4138
|
-
] }),
|
|
4139
|
-
/* @__PURE__ */ jsxs7(View7, { style: [styles6.summaryCard, { backgroundColor: t.surface }], children: [
|
|
4140
|
-
/* @__PURE__ */ jsx9(Text7, { style: [styles6.summaryLabel, { color: t.textMuted }], children: "Games" }),
|
|
4141
|
-
/* @__PURE__ */ jsx9(Text7, { style: [styles6.summaryValue, { color: t.text }], children: summary.totalGames })
|
|
4142
|
-
] }),
|
|
4143
|
-
/* @__PURE__ */ jsxs7(View7, { style: [styles6.summaryCard, { backgroundColor: t.surface }], children: [
|
|
4144
|
-
/* @__PURE__ */ jsx9(Text7, { style: [styles6.summaryLabel, { color: t.textMuted }], children: "Paid" }),
|
|
4145
|
-
/* @__PURE__ */ jsxs7(Text7, { style: [styles6.summaryValue, { color: t.accent }], children: [
|
|
4146
|
-
formatSol(summary.totalPaidSol),
|
|
4147
|
-
" SOL"
|
|
4148
|
-
] })
|
|
4149
|
-
] })
|
|
4150
|
-
] }),
|
|
4151
|
-
summary?.commissionWallet && /* @__PURE__ */ jsxs7(View7, { style: [styles6.walletRow, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
4152
|
-
/* @__PURE__ */ jsx9(Text7, { style: [styles6.walletLabel, { color: t.textMuted }], children: "Commission Wallet" }),
|
|
4153
|
-
/* @__PURE__ */ jsx9(Text7, { style: [styles6.walletAddress, { color: t.textSecondary }], numberOfLines: 1, children: summary.commissionWallet })
|
|
4154
|
-
] }),
|
|
4155
|
-
loading && !commissions.length ? /* @__PURE__ */ jsx9(View7, { style: styles6.centered, children: /* @__PURE__ */ jsx9(ActivityIndicator5, { size: "large", color: t.accent }) }) : error ? /* @__PURE__ */ jsxs7(View7, { style: [styles6.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: [
|
|
4156
|
-
/* @__PURE__ */ jsx9(Text7, { style: [styles6.errorText, { color: t.errorText }], children: error }),
|
|
4157
|
-
/* @__PURE__ */ jsx9(TouchableOpacity6, { onPress: fetchData, style: [styles6.retryButton, { borderColor: t.errorBorder }], children: /* @__PURE__ */ jsx9(Text7, { style: [styles6.retryText, { color: t.errorText }], children: "Retry" }) })
|
|
4158
|
-
] }) : commissions.length === 0 ? /* @__PURE__ */ jsxs7(View7, { style: styles6.centered, children: [
|
|
4159
|
-
/* @__PURE__ */ jsx9(Text7, { style: [styles6.emptyTitle, { color: t.textMuted }], children: "No commissions yet" }),
|
|
4160
|
-
/* @__PURE__ */ jsx9(Text7, { style: [styles6.emptySubtitle, { color: t.textDim }], children: "When games created through your app are resolved, your 1% commission will appear here." })
|
|
4161
|
-
] }) : /* @__PURE__ */ jsx9(
|
|
4162
|
-
FlatList,
|
|
4163
|
-
{
|
|
4164
|
-
data: commissions,
|
|
4165
|
-
keyExtractor: (item) => String(item.id),
|
|
4166
|
-
renderItem: renderCommission,
|
|
4167
|
-
contentContainerStyle: styles6.listContent,
|
|
4168
|
-
showsVerticalScrollIndicator: false
|
|
4169
|
-
}
|
|
4170
|
-
)
|
|
4171
|
-
] })
|
|
4172
|
-
]
|
|
4173
|
-
}
|
|
4174
|
-
)
|
|
4175
|
-
] });
|
|
4176
|
-
}
|
|
4177
|
-
var styles6 = StyleSheet7.create({
|
|
4178
|
-
flex: { flex: 1 },
|
|
4179
|
-
overlay: {
|
|
4180
|
-
...StyleSheet7.absoluteFillObject,
|
|
4181
|
-
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
4182
|
-
},
|
|
4183
|
-
sheet: {
|
|
4184
|
-
borderTopLeftRadius: 20,
|
|
4185
|
-
borderTopRightRadius: 20,
|
|
4186
|
-
maxHeight: "85%",
|
|
4187
|
-
minHeight: 400,
|
|
4188
|
-
paddingBottom: 34
|
|
4189
|
-
},
|
|
4190
|
-
handleRow: {
|
|
4191
|
-
alignItems: "center",
|
|
4192
|
-
paddingTop: 10,
|
|
4193
|
-
paddingBottom: 6
|
|
4194
|
-
},
|
|
4195
|
-
handle: {
|
|
4196
|
-
width: 36,
|
|
4197
|
-
height: 4,
|
|
4198
|
-
borderRadius: 2,
|
|
4199
|
-
opacity: 0.4
|
|
4200
|
-
},
|
|
4201
|
-
header: {
|
|
4202
|
-
flexDirection: "row",
|
|
4203
|
-
alignItems: "center",
|
|
4204
|
-
justifyContent: "space-between",
|
|
4205
|
-
paddingHorizontal: 20,
|
|
4206
|
-
paddingVertical: 12
|
|
4207
|
-
},
|
|
4208
|
-
headerTitle: {
|
|
4209
|
-
fontSize: 18,
|
|
4210
|
-
fontWeight: "700"
|
|
4211
|
-
},
|
|
4212
|
-
closeButton: {
|
|
4213
|
-
fontSize: 18,
|
|
4214
|
-
fontWeight: "600"
|
|
4215
|
-
},
|
|
4216
|
-
summaryRow: {
|
|
4217
|
-
flexDirection: "row",
|
|
4218
|
-
paddingHorizontal: 16,
|
|
4219
|
-
gap: 8,
|
|
4220
|
-
marginBottom: 12
|
|
4221
|
-
},
|
|
4222
|
-
summaryCard: {
|
|
4223
|
-
flex: 1,
|
|
4224
|
-
borderRadius: 12,
|
|
4225
|
-
padding: 12,
|
|
4226
|
-
alignItems: "center"
|
|
4227
|
-
},
|
|
4228
|
-
summaryLabel: {
|
|
4229
|
-
fontSize: 11,
|
|
4230
|
-
fontWeight: "600",
|
|
4231
|
-
textTransform: "uppercase",
|
|
4232
|
-
letterSpacing: 0.5,
|
|
4233
|
-
marginBottom: 4
|
|
4234
|
-
},
|
|
4235
|
-
summaryValue: {
|
|
4236
|
-
fontSize: 16,
|
|
4237
|
-
fontWeight: "700"
|
|
4238
|
-
},
|
|
4239
|
-
walletRow: {
|
|
4240
|
-
marginHorizontal: 16,
|
|
4241
|
-
borderRadius: 10,
|
|
4242
|
-
borderWidth: 1,
|
|
4243
|
-
padding: 10,
|
|
4244
|
-
marginBottom: 12
|
|
4245
|
-
},
|
|
4246
|
-
walletLabel: {
|
|
4247
|
-
fontSize: 11,
|
|
4248
|
-
fontWeight: "600",
|
|
4249
|
-
textTransform: "uppercase",
|
|
4250
|
-
letterSpacing: 0.5,
|
|
4251
|
-
marginBottom: 2
|
|
4252
|
-
},
|
|
4253
|
-
walletAddress: {
|
|
4254
|
-
fontSize: 12,
|
|
4255
|
-
fontFamily: Platform6.OS === "ios" ? "Menlo" : "monospace"
|
|
4256
|
-
},
|
|
4257
|
-
centered: {
|
|
4258
|
-
flex: 1,
|
|
4259
|
-
justifyContent: "center",
|
|
4260
|
-
alignItems: "center",
|
|
4261
|
-
paddingHorizontal: 32,
|
|
4262
|
-
paddingVertical: 48
|
|
4263
|
-
},
|
|
4264
|
-
emptyTitle: {
|
|
4265
|
-
fontSize: 16,
|
|
4266
|
-
fontWeight: "600",
|
|
4267
|
-
marginBottom: 8
|
|
4268
|
-
},
|
|
4269
|
-
emptySubtitle: {
|
|
4270
|
-
fontSize: 13,
|
|
4271
|
-
textAlign: "center",
|
|
4272
|
-
lineHeight: 18
|
|
4273
|
-
},
|
|
4274
|
-
errorBox: {
|
|
4275
|
-
margin: 16,
|
|
4276
|
-
borderRadius: 10,
|
|
4277
|
-
borderWidth: 1,
|
|
4278
|
-
padding: 16,
|
|
4279
|
-
alignItems: "center"
|
|
4280
|
-
},
|
|
4281
|
-
errorText: {
|
|
4282
|
-
fontSize: 14,
|
|
4283
|
-
marginBottom: 12
|
|
4284
|
-
},
|
|
4285
|
-
retryButton: {
|
|
4286
|
-
borderWidth: 1,
|
|
4287
|
-
borderRadius: 8,
|
|
4288
|
-
paddingHorizontal: 16,
|
|
4289
|
-
paddingVertical: 6
|
|
4290
|
-
},
|
|
4291
|
-
retryText: {
|
|
4292
|
-
fontSize: 13,
|
|
4293
|
-
fontWeight: "600"
|
|
4294
|
-
},
|
|
4295
|
-
listContent: {
|
|
4296
|
-
paddingHorizontal: 16,
|
|
4297
|
-
paddingBottom: 16
|
|
4298
|
-
},
|
|
4299
|
-
row: {
|
|
4300
|
-
borderRadius: 12,
|
|
4301
|
-
borderWidth: 1,
|
|
4302
|
-
padding: 12,
|
|
4303
|
-
marginBottom: 8
|
|
4304
|
-
},
|
|
4305
|
-
rowTop: {
|
|
4306
|
-
flexDirection: "row",
|
|
4307
|
-
justifyContent: "space-between",
|
|
4308
|
-
alignItems: "center",
|
|
4309
|
-
marginBottom: 4
|
|
4310
|
-
},
|
|
4311
|
-
rowGameId: {
|
|
4312
|
-
fontSize: 14,
|
|
4313
|
-
fontWeight: "600",
|
|
4314
|
-
flex: 1,
|
|
4315
|
-
marginRight: 8
|
|
4316
|
-
},
|
|
4317
|
-
rowAmount: {
|
|
4318
|
-
fontSize: 14,
|
|
4319
|
-
fontWeight: "700"
|
|
4320
|
-
},
|
|
4321
|
-
rowBottom: {
|
|
4322
|
-
flexDirection: "row",
|
|
4323
|
-
justifyContent: "space-between",
|
|
4324
|
-
alignItems: "center",
|
|
4325
|
-
marginBottom: 2
|
|
4326
|
-
},
|
|
4327
|
-
rowMeta: {
|
|
4328
|
-
fontSize: 12
|
|
4329
|
-
},
|
|
4330
|
-
statusBadge: {
|
|
4331
|
-
borderRadius: 6,
|
|
4332
|
-
paddingHorizontal: 8,
|
|
4333
|
-
paddingVertical: 2
|
|
4334
|
-
},
|
|
4335
|
-
statusText: {
|
|
4336
|
-
fontSize: 11,
|
|
4337
|
-
fontWeight: "600",
|
|
4338
|
-
textTransform: "uppercase"
|
|
4339
|
-
},
|
|
4340
|
-
rowDate: {
|
|
4341
|
-
fontSize: 11
|
|
4342
|
-
}
|
|
4343
|
-
});
|
|
4344
|
-
|
|
4345
4011
|
// src/ui/game/GamePoster.tsx
|
|
4346
|
-
import { useState as
|
|
4347
|
-
import { StyleSheet as
|
|
4348
|
-
import { jsx as
|
|
4012
|
+
import { useState as useState18 } from "react";
|
|
4013
|
+
import { StyleSheet as StyleSheet7, View as View7, Text as Text7 } from "react-native";
|
|
4014
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
4349
4015
|
function computeCountdown(lockTimestamp) {
|
|
4350
4016
|
if (!lockTimestamp) return "";
|
|
4351
4017
|
const ts = typeof lockTimestamp === "string" ? parseInt(lockTimestamp) : lockTimestamp;
|
|
@@ -4366,38 +4032,38 @@ function GamePoster({ game, ImageComponent }) {
|
|
|
4366
4032
|
const away = opponents[1];
|
|
4367
4033
|
const countdown = computeCountdown(game.lockTimestamp);
|
|
4368
4034
|
const isLive = countdown === "LIVE";
|
|
4369
|
-
return /* @__PURE__ */
|
|
4370
|
-
game.media?.poster ? /* @__PURE__ */
|
|
4035
|
+
return /* @__PURE__ */ jsxs7(View7, { style: styles6.container, children: [
|
|
4036
|
+
game.media?.poster ? /* @__PURE__ */ jsx9(
|
|
4371
4037
|
Img,
|
|
4372
4038
|
{
|
|
4373
4039
|
source: { uri: game.media.poster },
|
|
4374
|
-
style:
|
|
4040
|
+
style: styles6.image,
|
|
4375
4041
|
resizeMode: "cover"
|
|
4376
4042
|
}
|
|
4377
|
-
) : /* @__PURE__ */
|
|
4378
|
-
/* @__PURE__ */
|
|
4379
|
-
/* @__PURE__ */
|
|
4380
|
-
/* @__PURE__ */
|
|
4043
|
+
) : /* @__PURE__ */ jsx9(View7, { style: [styles6.image, { backgroundColor: t.surface }], children: /* @__PURE__ */ jsxs7(View7, { style: styles6.fallback, children: [
|
|
4044
|
+
/* @__PURE__ */ jsx9(TeamLogoInternal, { url: home?.imageUrl, size: 56, Img }),
|
|
4045
|
+
/* @__PURE__ */ jsx9(Text7, { style: styles6.vs, children: "VS" }),
|
|
4046
|
+
/* @__PURE__ */ jsx9(TeamLogoInternal, { url: away?.imageUrl, size: 56, Img })
|
|
4381
4047
|
] }) }),
|
|
4382
|
-
/* @__PURE__ */
|
|
4383
|
-
/* @__PURE__ */
|
|
4384
|
-
/* @__PURE__ */
|
|
4385
|
-
/* @__PURE__ */
|
|
4386
|
-
/* @__PURE__ */
|
|
4048
|
+
/* @__PURE__ */ jsx9(View7, { style: styles6.overlay }),
|
|
4049
|
+
/* @__PURE__ */ jsxs7(View7, { style: styles6.teamNames, children: [
|
|
4050
|
+
/* @__PURE__ */ jsx9(Text7, { style: styles6.teamNameText, numberOfLines: 1, children: home?.name || "Home" }),
|
|
4051
|
+
/* @__PURE__ */ jsx9(Text7, { style: styles6.teamNameVs, children: "vs" }),
|
|
4052
|
+
/* @__PURE__ */ jsx9(Text7, { style: styles6.teamNameText, numberOfLines: 1, children: away?.name || "Away" })
|
|
4387
4053
|
] }),
|
|
4388
|
-
countdown ? /* @__PURE__ */
|
|
4389
|
-
/* @__PURE__ */
|
|
4054
|
+
countdown ? /* @__PURE__ */ jsx9(View7, { style: styles6.countdownPill, children: /* @__PURE__ */ jsx9(Text7, { style: [styles6.countdownText, isLive && styles6.countdownLive], children: countdown }) }) : null,
|
|
4055
|
+
/* @__PURE__ */ jsx9(View7, { style: styles6.poolPill, children: /* @__PURE__ */ jsxs7(Text7, { style: styles6.poolText, children: [
|
|
4390
4056
|
game.totalPool || 0,
|
|
4391
4057
|
" SOL"
|
|
4392
4058
|
] }) })
|
|
4393
4059
|
] });
|
|
4394
4060
|
}
|
|
4395
4061
|
function TeamLogoInternal({ url, size, Img }) {
|
|
4396
|
-
const [failed, setFailed] =
|
|
4062
|
+
const [failed, setFailed] = useState18(false);
|
|
4397
4063
|
if (!url || failed) {
|
|
4398
|
-
return /* @__PURE__ */
|
|
4064
|
+
return /* @__PURE__ */ jsx9(View7, { style: [styles6.logoPlaceholder, { width: size, height: size, borderRadius: size / 2 }] });
|
|
4399
4065
|
}
|
|
4400
|
-
return /* @__PURE__ */
|
|
4066
|
+
return /* @__PURE__ */ jsx9(
|
|
4401
4067
|
Img,
|
|
4402
4068
|
{
|
|
4403
4069
|
source: { uri: url },
|
|
@@ -4407,7 +4073,7 @@ function TeamLogoInternal({ url, size, Img }) {
|
|
|
4407
4073
|
}
|
|
4408
4074
|
);
|
|
4409
4075
|
}
|
|
4410
|
-
var
|
|
4076
|
+
var styles6 = StyleSheet7.create({
|
|
4411
4077
|
container: {
|
|
4412
4078
|
height: 200,
|
|
4413
4079
|
borderRadius: 16,
|
|
@@ -4415,12 +4081,12 @@ var styles7 = StyleSheet8.create({
|
|
|
4415
4081
|
position: "relative"
|
|
4416
4082
|
},
|
|
4417
4083
|
image: {
|
|
4418
|
-
...
|
|
4084
|
+
...StyleSheet7.absoluteFillObject,
|
|
4419
4085
|
justifyContent: "center",
|
|
4420
4086
|
alignItems: "center"
|
|
4421
4087
|
},
|
|
4422
4088
|
overlay: {
|
|
4423
|
-
...
|
|
4089
|
+
...StyleSheet7.absoluteFillObject,
|
|
4424
4090
|
backgroundColor: "rgba(0,0,0,0.35)"
|
|
4425
4091
|
},
|
|
4426
4092
|
fallback: {
|
|
@@ -4495,8 +4161,8 @@ var styles7 = StyleSheet8.create({
|
|
|
4495
4161
|
|
|
4496
4162
|
// src/ui/game/LivePoolsCard.tsx
|
|
4497
4163
|
import { useMemo as useMemo5 } from "react";
|
|
4498
|
-
import { StyleSheet as
|
|
4499
|
-
import { jsx as
|
|
4164
|
+
import { StyleSheet as StyleSheet8, View as View8, Text as Text8 } from "react-native";
|
|
4165
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
4500
4166
|
function LivePoolsCard({
|
|
4501
4167
|
game,
|
|
4502
4168
|
shortName,
|
|
@@ -4518,29 +4184,29 @@ function LivePoolsCard({
|
|
|
4518
4184
|
awayOdds: awayPool > 0 ? (totalPool / awayPool).toFixed(2) : "\u2014"
|
|
4519
4185
|
};
|
|
4520
4186
|
}, [homePool, awayPool, totalPool]);
|
|
4521
|
-
return /* @__PURE__ */
|
|
4522
|
-
/* @__PURE__ */
|
|
4523
|
-
/* @__PURE__ */
|
|
4187
|
+
return /* @__PURE__ */ jsxs8(View8, { style: [styles7.card, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
4188
|
+
/* @__PURE__ */ jsx10(Text8, { style: [styles7.title, { color: t.text }], children: "Live Pools" }),
|
|
4189
|
+
/* @__PURE__ */ jsxs8(Text8, { style: [styles7.total, { color: t.accent }], children: [
|
|
4524
4190
|
totalPool,
|
|
4525
4191
|
" SOL total"
|
|
4526
4192
|
] }),
|
|
4527
|
-
/* @__PURE__ */
|
|
4528
|
-
/* @__PURE__ */
|
|
4529
|
-
/* @__PURE__ */
|
|
4193
|
+
/* @__PURE__ */ jsxs8(View8, { style: styles7.bars, children: [
|
|
4194
|
+
/* @__PURE__ */ jsx10(PoolBar, { name: homeName, amount: homePool, percent: homePercent, color: homeColor, t }),
|
|
4195
|
+
/* @__PURE__ */ jsx10(PoolBar, { name: awayName, amount: awayPool, percent: awayPercent, color: awayColor, t })
|
|
4530
4196
|
] }),
|
|
4531
|
-
/* @__PURE__ */
|
|
4532
|
-
/* @__PURE__ */
|
|
4197
|
+
/* @__PURE__ */ jsxs8(View8, { style: styles7.oddsRow, children: [
|
|
4198
|
+
/* @__PURE__ */ jsxs8(Text8, { style: [styles7.oddsText, { color: t.textMuted }], children: [
|
|
4533
4199
|
homeName,
|
|
4534
4200
|
": ",
|
|
4535
|
-
/* @__PURE__ */
|
|
4201
|
+
/* @__PURE__ */ jsxs8(Text8, { style: { color: t.text, fontWeight: "700" }, children: [
|
|
4536
4202
|
homeOdds,
|
|
4537
4203
|
"x"
|
|
4538
4204
|
] })
|
|
4539
4205
|
] }),
|
|
4540
|
-
/* @__PURE__ */
|
|
4206
|
+
/* @__PURE__ */ jsxs8(Text8, { style: [styles7.oddsText, { color: t.textMuted }], children: [
|
|
4541
4207
|
awayName,
|
|
4542
4208
|
": ",
|
|
4543
|
-
/* @__PURE__ */
|
|
4209
|
+
/* @__PURE__ */ jsxs8(Text8, { style: { color: t.text, fontWeight: "700" }, children: [
|
|
4544
4210
|
awayOdds,
|
|
4545
4211
|
"x"
|
|
4546
4212
|
] })
|
|
@@ -4549,16 +4215,16 @@ function LivePoolsCard({
|
|
|
4549
4215
|
] });
|
|
4550
4216
|
}
|
|
4551
4217
|
function PoolBar({ name, amount, percent, color, t }) {
|
|
4552
|
-
return /* @__PURE__ */
|
|
4553
|
-
/* @__PURE__ */
|
|
4554
|
-
/* @__PURE__ */
|
|
4555
|
-
/* @__PURE__ */
|
|
4218
|
+
return /* @__PURE__ */ jsxs8(View8, { style: styles7.barRow, children: [
|
|
4219
|
+
/* @__PURE__ */ jsx10(Text8, { style: [styles7.barLabel, { color: t.textSecondary }], numberOfLines: 1, children: name }),
|
|
4220
|
+
/* @__PURE__ */ jsx10(View8, { style: [styles7.barTrack, { backgroundColor: t.border }], children: /* @__PURE__ */ jsx10(View8, { style: [styles7.barFill, { width: `${Math.max(percent, 2)}%`, backgroundColor: color }] }) }),
|
|
4221
|
+
/* @__PURE__ */ jsxs8(Text8, { style: [styles7.barAmount, { color: t.text }], children: [
|
|
4556
4222
|
amount,
|
|
4557
4223
|
" SOL"
|
|
4558
4224
|
] })
|
|
4559
4225
|
] });
|
|
4560
4226
|
}
|
|
4561
|
-
var
|
|
4227
|
+
var styles7 = StyleSheet8.create({
|
|
4562
4228
|
card: { borderRadius: 16, borderWidth: 1, padding: 16 },
|
|
4563
4229
|
title: { fontSize: 17, fontWeight: "700", marginBottom: 4 },
|
|
4564
4230
|
total: { fontSize: 14, fontWeight: "600", marginBottom: 14 },
|
|
@@ -4573,9 +4239,9 @@ var styles8 = StyleSheet9.create({
|
|
|
4573
4239
|
});
|
|
4574
4240
|
|
|
4575
4241
|
// src/ui/game/PickWinnerCard.tsx
|
|
4576
|
-
import { useState as
|
|
4577
|
-
import { StyleSheet as
|
|
4578
|
-
import { jsx as
|
|
4242
|
+
import { useState as useState19, useMemo as useMemo6 } from "react";
|
|
4243
|
+
import { StyleSheet as StyleSheet9, View as View9, Text as Text9, TouchableOpacity as TouchableOpacity6 } from "react-native";
|
|
4244
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
4579
4245
|
function PickWinnerCard({
|
|
4580
4246
|
game,
|
|
4581
4247
|
selectedTeam,
|
|
@@ -4599,10 +4265,10 @@ function PickWinnerCard({
|
|
|
4599
4265
|
}), [totalPool, homePool, awayPool, bettors]);
|
|
4600
4266
|
const homeName = shortName ? shortName(opponents[0]?.name) : opponents[0]?.name || "Home";
|
|
4601
4267
|
const awayName = shortName ? shortName(opponents[1]?.name) : opponents[1]?.name || "Away";
|
|
4602
|
-
return /* @__PURE__ */
|
|
4603
|
-
/* @__PURE__ */
|
|
4604
|
-
/* @__PURE__ */
|
|
4605
|
-
/* @__PURE__ */
|
|
4268
|
+
return /* @__PURE__ */ jsxs9(View9, { style: [styles8.card, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
4269
|
+
/* @__PURE__ */ jsx11(Text9, { style: [styles8.title, { color: t.text }], children: "Pick Your Winner" }),
|
|
4270
|
+
/* @__PURE__ */ jsxs9(View9, { style: styles8.row, children: [
|
|
4271
|
+
/* @__PURE__ */ jsx11(
|
|
4606
4272
|
TeamOption,
|
|
4607
4273
|
{
|
|
4608
4274
|
name: homeName,
|
|
@@ -4616,7 +4282,7 @@ function PickWinnerCard({
|
|
|
4616
4282
|
t
|
|
4617
4283
|
}
|
|
4618
4284
|
),
|
|
4619
|
-
/* @__PURE__ */
|
|
4285
|
+
/* @__PURE__ */ jsx11(
|
|
4620
4286
|
TeamOption,
|
|
4621
4287
|
{
|
|
4622
4288
|
name: awayName,
|
|
@@ -4644,33 +4310,33 @@ function TeamOption({
|
|
|
4644
4310
|
ImageComponent,
|
|
4645
4311
|
t
|
|
4646
4312
|
}) {
|
|
4647
|
-
const [imgFailed, setImgFailed] =
|
|
4313
|
+
const [imgFailed, setImgFailed] = useState19(false);
|
|
4648
4314
|
const Img = ImageComponent || __require("react-native").Image;
|
|
4649
4315
|
const showImage = imageUrl && !imgFailed;
|
|
4650
|
-
return /* @__PURE__ */
|
|
4651
|
-
|
|
4316
|
+
return /* @__PURE__ */ jsxs9(
|
|
4317
|
+
TouchableOpacity6,
|
|
4652
4318
|
{
|
|
4653
|
-
style: [
|
|
4319
|
+
style: [styles8.option, { borderColor: selected ? color : t.border, backgroundColor: selected ? color + "15" : t.background }],
|
|
4654
4320
|
onPress,
|
|
4655
4321
|
activeOpacity: 0.7,
|
|
4656
4322
|
children: [
|
|
4657
|
-
showImage ? /* @__PURE__ */
|
|
4658
|
-
/* @__PURE__ */
|
|
4659
|
-
/* @__PURE__ */
|
|
4323
|
+
showImage ? /* @__PURE__ */ jsx11(Img, { source: { uri: imageUrl }, style: styles8.logo, resizeMode: "contain", onError: () => setImgFailed(true) }) : /* @__PURE__ */ jsx11(View9, { style: [styles8.logo, styles8.logoPlaceholder] }),
|
|
4324
|
+
/* @__PURE__ */ jsx11(Text9, { style: [styles8.name, { color: t.text }], numberOfLines: 1, children: name }),
|
|
4325
|
+
/* @__PURE__ */ jsxs9(Text9, { style: [styles8.odds, { color }], children: [
|
|
4660
4326
|
odds,
|
|
4661
4327
|
"x"
|
|
4662
4328
|
] }),
|
|
4663
|
-
/* @__PURE__ */
|
|
4329
|
+
/* @__PURE__ */ jsxs9(Text9, { style: [styles8.bets, { color: t.textMuted }], children: [
|
|
4664
4330
|
bets,
|
|
4665
4331
|
" ",
|
|
4666
4332
|
bets === 1 ? "bet" : "bets"
|
|
4667
4333
|
] }),
|
|
4668
|
-
selected && /* @__PURE__ */
|
|
4334
|
+
selected && /* @__PURE__ */ jsx11(View9, { style: [styles8.badge, { backgroundColor: color }], children: /* @__PURE__ */ jsx11(Text9, { style: styles8.badgeText, children: "Selected" }) })
|
|
4669
4335
|
]
|
|
4670
4336
|
}
|
|
4671
4337
|
);
|
|
4672
4338
|
}
|
|
4673
|
-
var
|
|
4339
|
+
var styles8 = StyleSheet9.create({
|
|
4674
4340
|
card: { borderRadius: 16, borderWidth: 1, padding: 16 },
|
|
4675
4341
|
title: { fontSize: 17, fontWeight: "700", marginBottom: 12 },
|
|
4676
4342
|
row: { flexDirection: "row", gap: 12 },
|
|
@@ -4685,9 +4351,9 @@ var styles9 = StyleSheet10.create({
|
|
|
4685
4351
|
});
|
|
4686
4352
|
|
|
4687
4353
|
// src/ui/game/PlayersCard.tsx
|
|
4688
|
-
import { useState as
|
|
4689
|
-
import { StyleSheet as
|
|
4690
|
-
import { jsx as
|
|
4354
|
+
import { useState as useState20 } from "react";
|
|
4355
|
+
import { StyleSheet as StyleSheet10, View as View10, Text as Text10 } from "react-native";
|
|
4356
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4691
4357
|
function truncateWallet(addr, chars) {
|
|
4692
4358
|
if (addr.length <= chars * 2 + 3) return addr;
|
|
4693
4359
|
return `${addr.slice(0, chars)}...${addr.slice(-chars)}`;
|
|
@@ -4707,12 +4373,12 @@ function PlayersCard({
|
|
|
4707
4373
|
if (team === "away") return awayColor;
|
|
4708
4374
|
return drawColor;
|
|
4709
4375
|
};
|
|
4710
|
-
return /* @__PURE__ */
|
|
4711
|
-
/* @__PURE__ */
|
|
4376
|
+
return /* @__PURE__ */ jsxs10(View10, { style: [styles9.card, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
4377
|
+
/* @__PURE__ */ jsxs10(Text10, { style: [styles9.title, { color: t.text }], children: [
|
|
4712
4378
|
"Players",
|
|
4713
4379
|
bettors.length > 0 ? ` (${bettors.length})` : ""
|
|
4714
4380
|
] }),
|
|
4715
|
-
bettors.length === 0 ? /* @__PURE__ */
|
|
4381
|
+
bettors.length === 0 ? /* @__PURE__ */ jsx12(Text10, { style: [styles9.empty, { color: t.textMuted }], children: "No players yet \u2014 be the first!" }) : bettors.map((b, i) => /* @__PURE__ */ jsx12(
|
|
4716
4382
|
BettorRow,
|
|
4717
4383
|
{
|
|
4718
4384
|
bettor: b,
|
|
@@ -4734,20 +4400,20 @@ function BettorRow({
|
|
|
4734
4400
|
ImageComponent,
|
|
4735
4401
|
t
|
|
4736
4402
|
}) {
|
|
4737
|
-
const [imgFailed, setImgFailed] =
|
|
4403
|
+
const [imgFailed, setImgFailed] = useState20(false);
|
|
4738
4404
|
const Img = ImageComponent || __require("react-native").Image;
|
|
4739
4405
|
const showAvatar = bettor.avatar && !imgFailed;
|
|
4740
|
-
return /* @__PURE__ */
|
|
4741
|
-
/* @__PURE__ */
|
|
4742
|
-
showAvatar ? /* @__PURE__ */
|
|
4743
|
-
/* @__PURE__ */
|
|
4744
|
-
/* @__PURE__ */
|
|
4406
|
+
return /* @__PURE__ */ jsxs10(View10, { style: [styles9.row, !isFirst && { borderTopColor: t.border, borderTopWidth: 1 }], children: [
|
|
4407
|
+
/* @__PURE__ */ jsx12(View10, { style: [styles9.dot, { backgroundColor: dotColor }] }),
|
|
4408
|
+
showAvatar ? /* @__PURE__ */ jsx12(Img, { source: { uri: ensurePngAvatar(bettor.avatar) }, style: styles9.avatar, resizeMode: "cover", onError: () => setImgFailed(true) }) : /* @__PURE__ */ jsx12(View10, { style: [styles9.avatar, styles9.avatarPlaceholder] }),
|
|
4409
|
+
/* @__PURE__ */ jsx12(View10, { style: styles9.nameCol, children: /* @__PURE__ */ jsx12(Text10, { style: [styles9.username, { color: t.text }], numberOfLines: 1, children: bettor.username || truncateWallet(bettor.wallet, truncateChars) }) }),
|
|
4410
|
+
/* @__PURE__ */ jsxs10(Text10, { style: [styles9.amount, { color: t.textSecondary }], children: [
|
|
4745
4411
|
bettor.amount,
|
|
4746
4412
|
" SOL"
|
|
4747
4413
|
] })
|
|
4748
4414
|
] });
|
|
4749
4415
|
}
|
|
4750
|
-
var
|
|
4416
|
+
var styles9 = StyleSheet10.create({
|
|
4751
4417
|
card: { borderRadius: 16, borderWidth: 1, padding: 16 },
|
|
4752
4418
|
title: { fontSize: 17, fontWeight: "700", marginBottom: 12 },
|
|
4753
4419
|
empty: { fontSize: 14, textAlign: "center", paddingVertical: 16 },
|
|
@@ -4762,8 +4428,8 @@ var styles10 = StyleSheet11.create({
|
|
|
4762
4428
|
|
|
4763
4429
|
// src/ui/game/JoinGameButton.tsx
|
|
4764
4430
|
import { useMemo as useMemo7 } from "react";
|
|
4765
|
-
import { StyleSheet as
|
|
4766
|
-
import { jsx as
|
|
4431
|
+
import { StyleSheet as StyleSheet11, View as View11, Text as Text11, TouchableOpacity as TouchableOpacity7, ActivityIndicator as ActivityIndicator5 } from "react-native";
|
|
4432
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4767
4433
|
var STATUS_LABELS = {
|
|
4768
4434
|
building: "Building transaction...",
|
|
4769
4435
|
signing: "Approve in wallet...",
|
|
@@ -4779,30 +4445,30 @@ function JoinGameButton({ game, walletAddress, selectedTeam, status, onJoin }) {
|
|
|
4779
4445
|
if (alreadyJoined || game.isLocked || game.isResolved) return null;
|
|
4780
4446
|
const isJoining = status !== "idle" && status !== "success" && status !== "error";
|
|
4781
4447
|
const statusLabel = STATUS_LABELS[status] || "";
|
|
4782
|
-
return /* @__PURE__ */
|
|
4783
|
-
/* @__PURE__ */
|
|
4784
|
-
/* @__PURE__ */
|
|
4785
|
-
/* @__PURE__ */
|
|
4448
|
+
return /* @__PURE__ */ jsxs11(View11, { style: [styles10.bar, { backgroundColor: t.background, borderTopColor: t.border }], children: [
|
|
4449
|
+
/* @__PURE__ */ jsxs11(View11, { style: styles10.buyInRow, children: [
|
|
4450
|
+
/* @__PURE__ */ jsx13(Text11, { style: [styles10.buyInLabel, { color: t.textMuted }], children: "Buy-in" }),
|
|
4451
|
+
/* @__PURE__ */ jsxs11(Text11, { style: [styles10.buyInValue, { color: t.text }], children: [
|
|
4786
4452
|
game.buyIn,
|
|
4787
4453
|
" SOL"
|
|
4788
4454
|
] })
|
|
4789
4455
|
] }),
|
|
4790
|
-
/* @__PURE__ */
|
|
4791
|
-
|
|
4456
|
+
/* @__PURE__ */ jsx13(
|
|
4457
|
+
TouchableOpacity7,
|
|
4792
4458
|
{
|
|
4793
|
-
style: [
|
|
4459
|
+
style: [styles10.button, { backgroundColor: selectedTeam ? t.accent : t.border }],
|
|
4794
4460
|
disabled: !selectedTeam || isJoining,
|
|
4795
4461
|
onPress: onJoin,
|
|
4796
4462
|
activeOpacity: 0.8,
|
|
4797
|
-
children: isJoining ? /* @__PURE__ */
|
|
4798
|
-
/* @__PURE__ */
|
|
4799
|
-
/* @__PURE__ */
|
|
4800
|
-
] }) : /* @__PURE__ */
|
|
4463
|
+
children: isJoining ? /* @__PURE__ */ jsxs11(View11, { style: styles10.joiningRow, children: [
|
|
4464
|
+
/* @__PURE__ */ jsx13(ActivityIndicator5, { size: "small", color: "#000" }),
|
|
4465
|
+
/* @__PURE__ */ jsx13(Text11, { style: styles10.buttonText, children: statusLabel })
|
|
4466
|
+
] }) : /* @__PURE__ */ jsx13(Text11, { style: [styles10.buttonText, !selectedTeam && { color: t.textMuted }], children: selectedTeam ? `Join Bet \u2014 ${game.buyIn} SOL` : "Pick a team to bet" })
|
|
4801
4467
|
}
|
|
4802
4468
|
)
|
|
4803
4469
|
] });
|
|
4804
4470
|
}
|
|
4805
|
-
var
|
|
4471
|
+
var styles10 = StyleSheet11.create({
|
|
4806
4472
|
bar: { position: "absolute", bottom: 0, left: 0, right: 0, paddingHorizontal: 16, paddingTop: 12, paddingBottom: 36, borderTopWidth: 1 },
|
|
4807
4473
|
buyInRow: { flexDirection: "row", alignItems: "center", justifyContent: "space-between", marginBottom: 10 },
|
|
4808
4474
|
buyInLabel: { fontSize: 13 },
|
|
@@ -4813,20 +4479,20 @@ var styles11 = StyleSheet12.create({
|
|
|
4813
4479
|
});
|
|
4814
4480
|
|
|
4815
4481
|
// src/ui/game/CreateCustomGameSheet.tsx
|
|
4816
|
-
import { useState as
|
|
4482
|
+
import { useState as useState21, useEffect as useEffect13, useRef as useRef6, useCallback as useCallback17 } from "react";
|
|
4817
4483
|
import {
|
|
4818
|
-
View as
|
|
4819
|
-
Text as
|
|
4484
|
+
View as View12,
|
|
4485
|
+
Text as Text12,
|
|
4820
4486
|
TextInput as TextInput2,
|
|
4821
|
-
TouchableOpacity as
|
|
4822
|
-
ActivityIndicator as
|
|
4823
|
-
Modal as
|
|
4824
|
-
Animated as
|
|
4825
|
-
StyleSheet as
|
|
4826
|
-
KeyboardAvoidingView as
|
|
4827
|
-
Platform as
|
|
4487
|
+
TouchableOpacity as TouchableOpacity8,
|
|
4488
|
+
ActivityIndicator as ActivityIndicator6,
|
|
4489
|
+
Modal as Modal2,
|
|
4490
|
+
Animated as Animated3,
|
|
4491
|
+
StyleSheet as StyleSheet12,
|
|
4492
|
+
KeyboardAvoidingView as KeyboardAvoidingView3,
|
|
4493
|
+
Platform as Platform6
|
|
4828
4494
|
} from "react-native";
|
|
4829
|
-
import { jsx as
|
|
4495
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4830
4496
|
var STATUS_LABELS2 = {
|
|
4831
4497
|
building: "Building transaction...",
|
|
4832
4498
|
signing: "Approve in wallet...",
|
|
@@ -4850,18 +4516,18 @@ function CreateCustomGameSheet({
|
|
|
4850
4516
|
const t = useDubsTheme();
|
|
4851
4517
|
const { wallet } = useDubs();
|
|
4852
4518
|
const mutation = useCreateCustomGame();
|
|
4853
|
-
const [selectedAmount, setSelectedAmount] =
|
|
4854
|
-
const [customAmount, setCustomAmount] =
|
|
4855
|
-
const [isCustom, setIsCustom] =
|
|
4856
|
-
const overlayOpacity =
|
|
4857
|
-
|
|
4858
|
-
|
|
4519
|
+
const [selectedAmount, setSelectedAmount] = useState21(null);
|
|
4520
|
+
const [customAmount, setCustomAmount] = useState21("");
|
|
4521
|
+
const [isCustom, setIsCustom] = useState21(false);
|
|
4522
|
+
const overlayOpacity = useRef6(new Animated3.Value(0)).current;
|
|
4523
|
+
useEffect13(() => {
|
|
4524
|
+
Animated3.timing(overlayOpacity, {
|
|
4859
4525
|
toValue: visible ? 1 : 0,
|
|
4860
4526
|
duration: 250,
|
|
4861
4527
|
useNativeDriver: true
|
|
4862
4528
|
}).start();
|
|
4863
4529
|
}, [visible, overlayOpacity]);
|
|
4864
|
-
|
|
4530
|
+
useEffect13(() => {
|
|
4865
4531
|
if (visible) {
|
|
4866
4532
|
setSelectedAmount(defaultAmount ?? null);
|
|
4867
4533
|
setCustomAmount("");
|
|
@@ -4869,7 +4535,7 @@ function CreateCustomGameSheet({
|
|
|
4869
4535
|
mutation.reset();
|
|
4870
4536
|
}
|
|
4871
4537
|
}, [visible]);
|
|
4872
|
-
|
|
4538
|
+
useEffect13(() => {
|
|
4873
4539
|
if (mutation.status === "success" && mutation.data) {
|
|
4874
4540
|
onSuccess?.(mutation.data);
|
|
4875
4541
|
const timer = setTimeout(() => {
|
|
@@ -4878,23 +4544,23 @@ function CreateCustomGameSheet({
|
|
|
4878
4544
|
return () => clearTimeout(timer);
|
|
4879
4545
|
}
|
|
4880
4546
|
}, [mutation.status, mutation.data]);
|
|
4881
|
-
|
|
4547
|
+
useEffect13(() => {
|
|
4882
4548
|
if (mutation.status === "error" && mutation.error) {
|
|
4883
4549
|
onError?.(mutation.error);
|
|
4884
4550
|
}
|
|
4885
4551
|
}, [mutation.status, mutation.error]);
|
|
4886
|
-
const handlePresetSelect =
|
|
4552
|
+
const handlePresetSelect = useCallback17((amount) => {
|
|
4887
4553
|
setSelectedAmount(amount);
|
|
4888
4554
|
setIsCustom(false);
|
|
4889
4555
|
setCustomAmount("");
|
|
4890
4556
|
onAmountChange?.(amount);
|
|
4891
4557
|
}, [onAmountChange]);
|
|
4892
|
-
const handleCustomSelect =
|
|
4558
|
+
const handleCustomSelect = useCallback17(() => {
|
|
4893
4559
|
setIsCustom(true);
|
|
4894
4560
|
setSelectedAmount(null);
|
|
4895
4561
|
onAmountChange?.(null);
|
|
4896
4562
|
}, [onAmountChange]);
|
|
4897
|
-
const handleCustomAmountChange =
|
|
4563
|
+
const handleCustomAmountChange = useCallback17((text) => {
|
|
4898
4564
|
const cleaned = text.replace(/[^0-9.]/g, "").replace(/(\..*?)\..*/g, "$1");
|
|
4899
4565
|
setCustomAmount(cleaned);
|
|
4900
4566
|
const parsed = parseFloat(cleaned);
|
|
@@ -4909,7 +4575,7 @@ function CreateCustomGameSheet({
|
|
|
4909
4575
|
const winnerTakes = pot * (1 - fee / 100);
|
|
4910
4576
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
4911
4577
|
const canCreate = finalAmount !== null && finalAmount > 0 && !isMutating && mutation.status !== "success";
|
|
4912
|
-
const handleCreate =
|
|
4578
|
+
const handleCreate = useCallback17(async () => {
|
|
4913
4579
|
if (!finalAmount || !wallet.publicKey) return;
|
|
4914
4580
|
try {
|
|
4915
4581
|
await mutation.execute({
|
|
@@ -4925,42 +4591,42 @@ function CreateCustomGameSheet({
|
|
|
4925
4591
|
}, [finalAmount, wallet.publicKey, mutation.execute, title, maxPlayers, metadata]);
|
|
4926
4592
|
const statusLabel = STATUS_LABELS2[mutation.status] || "";
|
|
4927
4593
|
const playersLabel = playerCount === 2 ? "2 (1v1)" : `${playerCount} players`;
|
|
4928
|
-
return /* @__PURE__ */
|
|
4929
|
-
|
|
4594
|
+
return /* @__PURE__ */ jsxs12(
|
|
4595
|
+
Modal2,
|
|
4930
4596
|
{
|
|
4931
4597
|
visible,
|
|
4932
4598
|
animationType: "slide",
|
|
4933
4599
|
transparent: true,
|
|
4934
4600
|
onRequestClose: onDismiss,
|
|
4935
4601
|
children: [
|
|
4936
|
-
/* @__PURE__ */
|
|
4937
|
-
/* @__PURE__ */
|
|
4938
|
-
|
|
4602
|
+
/* @__PURE__ */ jsx14(Animated3.View, { style: [styles11.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ jsx14(TouchableOpacity8, { style: styles11.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
4603
|
+
/* @__PURE__ */ jsx14(
|
|
4604
|
+
KeyboardAvoidingView3,
|
|
4939
4605
|
{
|
|
4940
|
-
style:
|
|
4941
|
-
behavior:
|
|
4942
|
-
children: /* @__PURE__ */
|
|
4943
|
-
/* @__PURE__ */
|
|
4944
|
-
/* @__PURE__ */
|
|
4945
|
-
/* @__PURE__ */
|
|
4946
|
-
/* @__PURE__ */
|
|
4606
|
+
style: styles11.keyboardView,
|
|
4607
|
+
behavior: Platform6.OS === "ios" ? "padding" : void 0,
|
|
4608
|
+
children: /* @__PURE__ */ jsx14(View12, { style: styles11.sheetPositioner, children: /* @__PURE__ */ jsxs12(View12, { style: [styles11.sheet, { backgroundColor: t.background }], children: [
|
|
4609
|
+
/* @__PURE__ */ jsx14(View12, { style: styles11.handleRow, children: /* @__PURE__ */ jsx14(View12, { style: [styles11.handle, { backgroundColor: t.textMuted }] }) }),
|
|
4610
|
+
/* @__PURE__ */ jsxs12(View12, { style: styles11.header, children: [
|
|
4611
|
+
/* @__PURE__ */ jsx14(Text12, { style: [styles11.headerTitle, { color: t.text }], children: isPoolModeEnabled ? "Create Pool" : "New Game" }),
|
|
4612
|
+
/* @__PURE__ */ jsx14(TouchableOpacity8, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ jsx14(Text12, { style: [styles11.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
4947
4613
|
] }),
|
|
4948
|
-
!isPoolModeEnabled && /* @__PURE__ */
|
|
4949
|
-
/* @__PURE__ */
|
|
4950
|
-
/* @__PURE__ */
|
|
4614
|
+
!isPoolModeEnabled && /* @__PURE__ */ jsxs12(View12, { style: styles11.section, children: [
|
|
4615
|
+
/* @__PURE__ */ jsx14(Text12, { style: [styles11.sectionLabel, { color: t.textSecondary }], children: "Buy-In Amount" }),
|
|
4616
|
+
/* @__PURE__ */ jsxs12(View12, { style: styles11.chipsRow, children: [
|
|
4951
4617
|
presetAmounts.map((amount) => {
|
|
4952
4618
|
const active = !isCustom && selectedAmount === amount;
|
|
4953
|
-
return /* @__PURE__ */
|
|
4954
|
-
|
|
4619
|
+
return /* @__PURE__ */ jsx14(
|
|
4620
|
+
TouchableOpacity8,
|
|
4955
4621
|
{
|
|
4956
4622
|
style: [
|
|
4957
|
-
|
|
4623
|
+
styles11.chip,
|
|
4958
4624
|
{ borderColor: active ? t.accent : t.border },
|
|
4959
4625
|
active && { backgroundColor: t.accent }
|
|
4960
4626
|
],
|
|
4961
4627
|
onPress: () => handlePresetSelect(amount),
|
|
4962
4628
|
activeOpacity: 0.8,
|
|
4963
|
-
children: /* @__PURE__ */
|
|
4629
|
+
children: /* @__PURE__ */ jsxs12(Text12, { style: [styles11.chipText, { color: active ? "#FFFFFF" : t.text }], children: [
|
|
4964
4630
|
amount,
|
|
4965
4631
|
" SOL"
|
|
4966
4632
|
] })
|
|
@@ -4968,24 +4634,24 @@ function CreateCustomGameSheet({
|
|
|
4968
4634
|
amount
|
|
4969
4635
|
);
|
|
4970
4636
|
}),
|
|
4971
|
-
/* @__PURE__ */
|
|
4972
|
-
|
|
4637
|
+
/* @__PURE__ */ jsx14(
|
|
4638
|
+
TouchableOpacity8,
|
|
4973
4639
|
{
|
|
4974
4640
|
style: [
|
|
4975
|
-
|
|
4641
|
+
styles11.chip,
|
|
4976
4642
|
{ borderColor: isCustom ? t.accent : t.border },
|
|
4977
4643
|
isCustom && { backgroundColor: t.accent }
|
|
4978
4644
|
],
|
|
4979
4645
|
onPress: handleCustomSelect,
|
|
4980
4646
|
activeOpacity: 0.8,
|
|
4981
|
-
children: /* @__PURE__ */
|
|
4647
|
+
children: /* @__PURE__ */ jsx14(Text12, { style: [styles11.chipText, { color: isCustom ? "#FFFFFF" : t.text }], children: "Custom" })
|
|
4982
4648
|
}
|
|
4983
4649
|
)
|
|
4984
4650
|
] }),
|
|
4985
|
-
isCustom && /* @__PURE__ */
|
|
4651
|
+
isCustom && /* @__PURE__ */ jsx14(
|
|
4986
4652
|
TextInput2,
|
|
4987
4653
|
{
|
|
4988
|
-
style: [
|
|
4654
|
+
style: [styles11.input, { backgroundColor: t.surface, color: t.text, borderColor: t.accent }],
|
|
4989
4655
|
placeholder: "Enter amount in SOL",
|
|
4990
4656
|
placeholderTextColor: t.textDim,
|
|
4991
4657
|
keyboardType: "decimal-pad",
|
|
@@ -4995,43 +4661,43 @@ function CreateCustomGameSheet({
|
|
|
4995
4661
|
}
|
|
4996
4662
|
)
|
|
4997
4663
|
] }),
|
|
4998
|
-
/* @__PURE__ */
|
|
4999
|
-
/* @__PURE__ */
|
|
5000
|
-
/* @__PURE__ */
|
|
5001
|
-
/* @__PURE__ */
|
|
4664
|
+
/* @__PURE__ */ jsxs12(View12, { style: [styles11.summaryCard, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
4665
|
+
/* @__PURE__ */ jsxs12(View12, { style: styles11.summaryRow, children: [
|
|
4666
|
+
/* @__PURE__ */ jsx14(Text12, { style: [styles11.summaryLabel, { color: t.textMuted }], children: "Buy-in" }),
|
|
4667
|
+
/* @__PURE__ */ jsx14(Text12, { style: [styles11.summaryValue, { color: t.text }], children: finalAmount ? `${finalAmount} SOL` : "\u2014" })
|
|
5002
4668
|
] }),
|
|
5003
|
-
/* @__PURE__ */
|
|
5004
|
-
/* @__PURE__ */
|
|
5005
|
-
/* @__PURE__ */
|
|
5006
|
-
/* @__PURE__ */
|
|
4669
|
+
/* @__PURE__ */ jsx14(View12, { style: [styles11.summarySep, { backgroundColor: t.border }] }),
|
|
4670
|
+
/* @__PURE__ */ jsxs12(View12, { style: styles11.summaryRow, children: [
|
|
4671
|
+
/* @__PURE__ */ jsx14(Text12, { style: [styles11.summaryLabel, { color: t.textMuted }], children: isPoolModeEnabled ? "Max players" : "Players" }),
|
|
4672
|
+
/* @__PURE__ */ jsx14(Text12, { style: [styles11.summaryValue, { color: t.text }], children: isPoolModeEnabled ? playerCount : playersLabel })
|
|
5007
4673
|
] }),
|
|
5008
|
-
/* @__PURE__ */
|
|
5009
|
-
/* @__PURE__ */
|
|
5010
|
-
/* @__PURE__ */
|
|
5011
|
-
/* @__PURE__ */
|
|
5012
|
-
/* @__PURE__ */
|
|
5013
|
-
finalAmount ? /* @__PURE__ */
|
|
4674
|
+
/* @__PURE__ */ jsx14(View12, { style: [styles11.summarySep, { backgroundColor: t.border }] }),
|
|
4675
|
+
/* @__PURE__ */ jsxs12(View12, { style: styles11.summaryRow, children: [
|
|
4676
|
+
/* @__PURE__ */ jsx14(Text12, { style: [styles11.summaryLabel, { color: t.textMuted }], children: isPoolModeEnabled ? "Max pot" : "Winner Takes" }),
|
|
4677
|
+
/* @__PURE__ */ jsxs12(View12, { style: styles11.winnerCol, children: [
|
|
4678
|
+
/* @__PURE__ */ jsx14(Text12, { style: [styles11.summaryValue, { color: t.success }], children: finalAmount ? `${(finalAmount * playerCount * (1 - fee / 100)).toFixed(4)} SOL` : "\u2014" }),
|
|
4679
|
+
finalAmount ? /* @__PURE__ */ jsxs12(Text12, { style: [styles11.feeNote, { color: t.textDim }], children: [
|
|
5014
4680
|
fee,
|
|
5015
4681
|
"% platform fee"
|
|
5016
4682
|
] }) : null
|
|
5017
4683
|
] })
|
|
5018
4684
|
] })
|
|
5019
4685
|
] }),
|
|
5020
|
-
mutation.error && /* @__PURE__ */
|
|
5021
|
-
/* @__PURE__ */
|
|
5022
|
-
|
|
4686
|
+
mutation.error && /* @__PURE__ */ jsx14(View12, { style: [styles11.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ jsx14(Text12, { style: [styles11.errorText, { color: t.errorText }], children: mutation.error.message }) }),
|
|
4687
|
+
/* @__PURE__ */ jsx14(
|
|
4688
|
+
TouchableOpacity8,
|
|
5023
4689
|
{
|
|
5024
4690
|
style: [
|
|
5025
|
-
|
|
4691
|
+
styles11.ctaButton,
|
|
5026
4692
|
{ backgroundColor: canCreate ? t.accent : t.border }
|
|
5027
4693
|
],
|
|
5028
4694
|
disabled: !canCreate,
|
|
5029
4695
|
onPress: handleCreate,
|
|
5030
4696
|
activeOpacity: 0.8,
|
|
5031
|
-
children: isMutating ? /* @__PURE__ */
|
|
5032
|
-
/* @__PURE__ */
|
|
5033
|
-
/* @__PURE__ */
|
|
5034
|
-
] }) : mutation.status === "success" ? /* @__PURE__ */
|
|
4697
|
+
children: isMutating ? /* @__PURE__ */ jsxs12(View12, { style: styles11.ctaLoading, children: [
|
|
4698
|
+
/* @__PURE__ */ jsx14(ActivityIndicator6, { size: "small", color: "#FFFFFF" }),
|
|
4699
|
+
/* @__PURE__ */ jsx14(Text12, { style: styles11.ctaText, children: statusLabel })
|
|
4700
|
+
] }) : mutation.status === "success" ? /* @__PURE__ */ jsx14(Text12, { style: styles11.ctaText, children: isPoolModeEnabled ? "Pool Created!" : STATUS_LABELS2.success }) : /* @__PURE__ */ jsx14(Text12, { style: [styles11.ctaText, !canCreate && { opacity: 0.5 }], children: isPoolModeEnabled ? `Create Pool \u2014 ${finalAmount} SOL` : effectiveAmount ? `Create Game \u2014 ${effectiveAmount} SOL` : "Select buy-in amount" })
|
|
5035
4701
|
}
|
|
5036
4702
|
)
|
|
5037
4703
|
] }) })
|
|
@@ -5041,9 +4707,9 @@ function CreateCustomGameSheet({
|
|
|
5041
4707
|
}
|
|
5042
4708
|
);
|
|
5043
4709
|
}
|
|
5044
|
-
var
|
|
4710
|
+
var styles11 = StyleSheet12.create({
|
|
5045
4711
|
overlay: {
|
|
5046
|
-
...
|
|
4712
|
+
...StyleSheet12.absoluteFillObject,
|
|
5047
4713
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
5048
4714
|
},
|
|
5049
4715
|
overlayTap: {
|
|
@@ -5178,19 +4844,19 @@ var styles12 = StyleSheet13.create({
|
|
|
5178
4844
|
});
|
|
5179
4845
|
|
|
5180
4846
|
// src/ui/game/JoinGameSheet.tsx
|
|
5181
|
-
import { useState as
|
|
4847
|
+
import { useState as useState22, useEffect as useEffect14, useRef as useRef7, useCallback as useCallback18, useMemo as useMemo8 } from "react";
|
|
5182
4848
|
import {
|
|
5183
|
-
View as
|
|
5184
|
-
Text as
|
|
5185
|
-
TouchableOpacity as
|
|
5186
|
-
ActivityIndicator as
|
|
5187
|
-
Modal as
|
|
5188
|
-
Animated as
|
|
5189
|
-
StyleSheet as
|
|
5190
|
-
KeyboardAvoidingView as
|
|
5191
|
-
Platform as
|
|
4849
|
+
View as View13,
|
|
4850
|
+
Text as Text13,
|
|
4851
|
+
TouchableOpacity as TouchableOpacity9,
|
|
4852
|
+
ActivityIndicator as ActivityIndicator7,
|
|
4853
|
+
Modal as Modal3,
|
|
4854
|
+
Animated as Animated4,
|
|
4855
|
+
StyleSheet as StyleSheet13,
|
|
4856
|
+
KeyboardAvoidingView as KeyboardAvoidingView4,
|
|
4857
|
+
Platform as Platform7
|
|
5192
4858
|
} from "react-native";
|
|
5193
|
-
import { Fragment as Fragment4, jsx as
|
|
4859
|
+
import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5194
4860
|
var STATUS_LABELS3 = {
|
|
5195
4861
|
building: "Building transaction...",
|
|
5196
4862
|
signing: "Approve in wallet...",
|
|
@@ -5214,22 +4880,22 @@ function JoinGameSheet({
|
|
|
5214
4880
|
const { wallet } = useDubs();
|
|
5215
4881
|
const mutation = useJoinGame();
|
|
5216
4882
|
const isCustomGame = game.gameMode === CUSTOM_GAME_MODE;
|
|
5217
|
-
const [selectedTeam, setSelectedTeam] =
|
|
5218
|
-
const overlayOpacity =
|
|
5219
|
-
|
|
5220
|
-
|
|
4883
|
+
const [selectedTeam, setSelectedTeam] = useState22(null);
|
|
4884
|
+
const overlayOpacity = useRef7(new Animated4.Value(0)).current;
|
|
4885
|
+
useEffect14(() => {
|
|
4886
|
+
Animated4.timing(overlayOpacity, {
|
|
5221
4887
|
toValue: visible ? 1 : 0,
|
|
5222
4888
|
duration: 250,
|
|
5223
4889
|
useNativeDriver: true
|
|
5224
4890
|
}).start();
|
|
5225
4891
|
}, [visible, overlayOpacity]);
|
|
5226
|
-
|
|
4892
|
+
useEffect14(() => {
|
|
5227
4893
|
if (visible) {
|
|
5228
4894
|
setSelectedTeam(isPoolModeEnabled ? "home" : isCustomGame ? "away" : null);
|
|
5229
4895
|
mutation.reset();
|
|
5230
4896
|
}
|
|
5231
4897
|
}, [visible]);
|
|
5232
|
-
|
|
4898
|
+
useEffect14(() => {
|
|
5233
4899
|
if (mutation.status === "success" && mutation.data) {
|
|
5234
4900
|
onSuccess?.(mutation.data);
|
|
5235
4901
|
const timer = setTimeout(() => {
|
|
@@ -5238,7 +4904,7 @@ function JoinGameSheet({
|
|
|
5238
4904
|
return () => clearTimeout(timer);
|
|
5239
4905
|
}
|
|
5240
4906
|
}, [mutation.status, mutation.data]);
|
|
5241
|
-
|
|
4907
|
+
useEffect14(() => {
|
|
5242
4908
|
if (mutation.status === "error" && mutation.error) {
|
|
5243
4909
|
onError?.(mutation.error);
|
|
5244
4910
|
}
|
|
@@ -5268,7 +4934,7 @@ function JoinGameSheet({
|
|
|
5268
4934
|
}, [bettors, wallet.publicKey]);
|
|
5269
4935
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
5270
4936
|
const canJoin = selectedTeam !== null && !isMutating && mutation.status !== "success" && !alreadyJoined;
|
|
5271
|
-
const handleJoin =
|
|
4937
|
+
const handleJoin = useCallback18(async () => {
|
|
5272
4938
|
if (!selectedTeam || !wallet.publicKey) return;
|
|
5273
4939
|
try {
|
|
5274
4940
|
await mutation.execute({
|
|
@@ -5281,30 +4947,30 @@ function JoinGameSheet({
|
|
|
5281
4947
|
}
|
|
5282
4948
|
}, [selectedTeam, wallet.publicKey, mutation.execute, game.gameId, buyIn]);
|
|
5283
4949
|
const statusLabel = STATUS_LABELS3[mutation.status] || "";
|
|
5284
|
-
return /* @__PURE__ */
|
|
5285
|
-
|
|
4950
|
+
return /* @__PURE__ */ jsxs13(
|
|
4951
|
+
Modal3,
|
|
5286
4952
|
{
|
|
5287
4953
|
visible,
|
|
5288
4954
|
animationType: "slide",
|
|
5289
4955
|
transparent: true,
|
|
5290
4956
|
onRequestClose: onDismiss,
|
|
5291
4957
|
children: [
|
|
5292
|
-
/* @__PURE__ */
|
|
5293
|
-
/* @__PURE__ */
|
|
5294
|
-
|
|
4958
|
+
/* @__PURE__ */ jsx15(Animated4.View, { style: [styles12.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ jsx15(TouchableOpacity9, { style: styles12.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
4959
|
+
/* @__PURE__ */ jsx15(
|
|
4960
|
+
KeyboardAvoidingView4,
|
|
5295
4961
|
{
|
|
5296
|
-
style:
|
|
5297
|
-
behavior:
|
|
5298
|
-
children: /* @__PURE__ */
|
|
5299
|
-
/* @__PURE__ */
|
|
5300
|
-
/* @__PURE__ */
|
|
5301
|
-
/* @__PURE__ */
|
|
5302
|
-
/* @__PURE__ */
|
|
4962
|
+
style: styles12.keyboardView,
|
|
4963
|
+
behavior: Platform7.OS === "ios" ? "padding" : void 0,
|
|
4964
|
+
children: /* @__PURE__ */ jsx15(View13, { style: styles12.sheetPositioner, children: /* @__PURE__ */ jsxs13(View13, { style: [styles12.sheet, { backgroundColor: t.background }], children: [
|
|
4965
|
+
/* @__PURE__ */ jsx15(View13, { style: styles12.handleRow, children: /* @__PURE__ */ jsx15(View13, { style: [styles12.handle, { backgroundColor: t.textMuted }] }) }),
|
|
4966
|
+
/* @__PURE__ */ jsxs13(View13, { style: styles12.header, children: [
|
|
4967
|
+
/* @__PURE__ */ jsx15(Text13, { style: [styles12.headerTitle, { color: t.text }], children: isPoolModeEnabled ? "Join Pool" : "Join Game" }),
|
|
4968
|
+
/* @__PURE__ */ jsx15(TouchableOpacity9, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ jsx15(Text13, { style: [styles12.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
5303
4969
|
] }),
|
|
5304
|
-
!isCustomGame && !isPoolModeEnabled && /* @__PURE__ */
|
|
5305
|
-
/* @__PURE__ */
|
|
5306
|
-
/* @__PURE__ */
|
|
5307
|
-
/* @__PURE__ */
|
|
4970
|
+
!isCustomGame && !isPoolModeEnabled && /* @__PURE__ */ jsxs13(View13, { style: styles12.section, children: [
|
|
4971
|
+
/* @__PURE__ */ jsx15(Text13, { style: [styles12.sectionLabel, { color: t.textSecondary }], children: "Pick Your Side" }),
|
|
4972
|
+
/* @__PURE__ */ jsxs13(View13, { style: styles12.teamsRow, children: [
|
|
4973
|
+
/* @__PURE__ */ jsx15(
|
|
5308
4974
|
TeamButton,
|
|
5309
4975
|
{
|
|
5310
4976
|
name: homeName,
|
|
@@ -5318,7 +4984,7 @@ function JoinGameSheet({
|
|
|
5318
4984
|
t
|
|
5319
4985
|
}
|
|
5320
4986
|
),
|
|
5321
|
-
/* @__PURE__ */
|
|
4987
|
+
/* @__PURE__ */ jsx15(
|
|
5322
4988
|
TeamButton,
|
|
5323
4989
|
{
|
|
5324
4990
|
name: awayName,
|
|
@@ -5334,64 +5000,64 @@ function JoinGameSheet({
|
|
|
5334
5000
|
)
|
|
5335
5001
|
] })
|
|
5336
5002
|
] }),
|
|
5337
|
-
/* @__PURE__ */
|
|
5338
|
-
/* @__PURE__ */
|
|
5339
|
-
/* @__PURE__ */
|
|
5340
|
-
/* @__PURE__ */
|
|
5003
|
+
/* @__PURE__ */ jsxs13(View13, { style: [styles12.summaryCard, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
5004
|
+
/* @__PURE__ */ jsxs13(View13, { style: styles12.summaryRow, children: [
|
|
5005
|
+
/* @__PURE__ */ jsx15(Text13, { style: [styles12.summaryLabel, { color: t.textMuted }], children: "Buy-in" }),
|
|
5006
|
+
/* @__PURE__ */ jsxs13(Text13, { style: [styles12.summaryValue, { color: t.text }], children: [
|
|
5341
5007
|
buyIn,
|
|
5342
5008
|
" SOL"
|
|
5343
5009
|
] })
|
|
5344
5010
|
] }),
|
|
5345
|
-
/* @__PURE__ */
|
|
5346
|
-
isPoolModeEnabled ? /* @__PURE__ */
|
|
5347
|
-
/* @__PURE__ */
|
|
5348
|
-
/* @__PURE__ */
|
|
5349
|
-
/* @__PURE__ */
|
|
5011
|
+
/* @__PURE__ */ jsx15(View13, { style: [styles12.summarySep, { backgroundColor: t.border }] }),
|
|
5012
|
+
isPoolModeEnabled ? /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
5013
|
+
/* @__PURE__ */ jsxs13(View13, { style: styles12.summaryRow, children: [
|
|
5014
|
+
/* @__PURE__ */ jsx15(Text13, { style: [styles12.summaryLabel, { color: t.textMuted }], children: "Players in" }),
|
|
5015
|
+
/* @__PURE__ */ jsx15(Text13, { style: [styles12.summaryValue, { color: t.text }], children: bettors.length })
|
|
5350
5016
|
] }),
|
|
5351
|
-
/* @__PURE__ */
|
|
5352
|
-
/* @__PURE__ */
|
|
5353
|
-
/* @__PURE__ */
|
|
5354
|
-
/* @__PURE__ */
|
|
5017
|
+
/* @__PURE__ */ jsx15(View13, { style: [styles12.summarySep, { backgroundColor: t.border }] }),
|
|
5018
|
+
/* @__PURE__ */ jsxs13(View13, { style: styles12.summaryRow, children: [
|
|
5019
|
+
/* @__PURE__ */ jsx15(Text13, { style: [styles12.summaryLabel, { color: t.textMuted }], children: "Current pot" }),
|
|
5020
|
+
/* @__PURE__ */ jsxs13(Text13, { style: [styles12.summaryValue, { color: t.success }], children: [
|
|
5355
5021
|
totalPool,
|
|
5356
5022
|
" SOL"
|
|
5357
5023
|
] })
|
|
5358
5024
|
] })
|
|
5359
|
-
] }) : /* @__PURE__ */
|
|
5360
|
-
/* @__PURE__ */
|
|
5361
|
-
/* @__PURE__ */
|
|
5362
|
-
/* @__PURE__ */
|
|
5025
|
+
] }) : /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
5026
|
+
/* @__PURE__ */ jsxs13(View13, { style: styles12.summaryRow, children: [
|
|
5027
|
+
/* @__PURE__ */ jsx15(Text13, { style: [styles12.summaryLabel, { color: t.textMuted }], children: "Your side" }),
|
|
5028
|
+
/* @__PURE__ */ jsx15(Text13, { style: [styles12.summaryValue, { color: t.text }], children: selectedName })
|
|
5363
5029
|
] }),
|
|
5364
|
-
/* @__PURE__ */
|
|
5365
|
-
/* @__PURE__ */
|
|
5366
|
-
/* @__PURE__ */
|
|
5367
|
-
/* @__PURE__ */
|
|
5030
|
+
/* @__PURE__ */ jsx15(View13, { style: [styles12.summarySep, { backgroundColor: t.border }] }),
|
|
5031
|
+
/* @__PURE__ */ jsxs13(View13, { style: styles12.summaryRow, children: [
|
|
5032
|
+
/* @__PURE__ */ jsx15(Text13, { style: [styles12.summaryLabel, { color: t.textMuted }], children: "Total pool" }),
|
|
5033
|
+
/* @__PURE__ */ jsxs13(Text13, { style: [styles12.summaryValue, { color: t.text }], children: [
|
|
5368
5034
|
poolAfterJoin,
|
|
5369
5035
|
" SOL"
|
|
5370
5036
|
] })
|
|
5371
5037
|
] }),
|
|
5372
|
-
/* @__PURE__ */
|
|
5373
|
-
/* @__PURE__ */
|
|
5374
|
-
/* @__PURE__ */
|
|
5375
|
-
/* @__PURE__ */
|
|
5038
|
+
/* @__PURE__ */ jsx15(View13, { style: [styles12.summarySep, { backgroundColor: t.border }] }),
|
|
5039
|
+
/* @__PURE__ */ jsxs13(View13, { style: styles12.summaryRow, children: [
|
|
5040
|
+
/* @__PURE__ */ jsx15(Text13, { style: [styles12.summaryLabel, { color: t.textMuted }], children: "Potential winnings" }),
|
|
5041
|
+
/* @__PURE__ */ jsx15(Text13, { style: [styles12.summaryValue, { color: t.success }], children: potentialWinnings !== "\u2014" ? `${potentialWinnings} SOL` : "\u2014" })
|
|
5376
5042
|
] })
|
|
5377
5043
|
] })
|
|
5378
5044
|
] }),
|
|
5379
|
-
alreadyJoined && /* @__PURE__ */
|
|
5380
|
-
mutation.error && /* @__PURE__ */
|
|
5381
|
-
/* @__PURE__ */
|
|
5382
|
-
|
|
5045
|
+
alreadyJoined && /* @__PURE__ */ jsx15(View13, { style: [styles12.errorBox, { backgroundColor: t.surface, borderColor: t.border }], children: /* @__PURE__ */ jsx15(Text13, { style: [styles12.errorText, { color: t.textMuted }], children: isPoolModeEnabled ? "You've already joined this pool." : "You've already joined this game." }) }),
|
|
5046
|
+
mutation.error && /* @__PURE__ */ jsx15(View13, { style: [styles12.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ jsx15(Text13, { style: [styles12.errorText, { color: t.errorText }], children: mutation.error.message }) }),
|
|
5047
|
+
/* @__PURE__ */ jsx15(
|
|
5048
|
+
TouchableOpacity9,
|
|
5383
5049
|
{
|
|
5384
5050
|
style: [
|
|
5385
|
-
|
|
5051
|
+
styles12.ctaButton,
|
|
5386
5052
|
{ backgroundColor: canJoin ? t.accent : t.border }
|
|
5387
5053
|
],
|
|
5388
5054
|
disabled: !canJoin,
|
|
5389
5055
|
onPress: handleJoin,
|
|
5390
5056
|
activeOpacity: 0.8,
|
|
5391
|
-
children: isMutating ? /* @__PURE__ */
|
|
5392
|
-
/* @__PURE__ */
|
|
5393
|
-
/* @__PURE__ */
|
|
5394
|
-
] }) : mutation.status === "success" ? /* @__PURE__ */
|
|
5057
|
+
children: isMutating ? /* @__PURE__ */ jsxs13(View13, { style: styles12.ctaLoading, children: [
|
|
5058
|
+
/* @__PURE__ */ jsx15(ActivityIndicator7, { size: "small", color: "#FFFFFF" }),
|
|
5059
|
+
/* @__PURE__ */ jsx15(Text13, { style: styles12.ctaText, children: statusLabel })
|
|
5060
|
+
] }) : mutation.status === "success" ? /* @__PURE__ */ jsx15(Text13, { style: styles12.ctaText, children: isPoolModeEnabled ? "Joined!" : STATUS_LABELS3.success }) : /* @__PURE__ */ jsx15(Text13, { style: [styles12.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" })
|
|
5395
5061
|
}
|
|
5396
5062
|
)
|
|
5397
5063
|
] }) })
|
|
@@ -5412,35 +5078,35 @@ function TeamButton({
|
|
|
5412
5078
|
ImageComponent,
|
|
5413
5079
|
t
|
|
5414
5080
|
}) {
|
|
5415
|
-
const [imgFailed, setImgFailed] =
|
|
5081
|
+
const [imgFailed, setImgFailed] = useState22(false);
|
|
5416
5082
|
const Img = ImageComponent || __require("react-native").Image;
|
|
5417
5083
|
const showImage = imageUrl && !imgFailed;
|
|
5418
|
-
return /* @__PURE__ */
|
|
5419
|
-
|
|
5084
|
+
return /* @__PURE__ */ jsxs13(
|
|
5085
|
+
TouchableOpacity9,
|
|
5420
5086
|
{
|
|
5421
|
-
style: [
|
|
5087
|
+
style: [styles12.teamOption, { borderColor: selected ? color : t.border, backgroundColor: selected ? color + "15" : t.background }],
|
|
5422
5088
|
onPress,
|
|
5423
5089
|
activeOpacity: 0.7,
|
|
5424
5090
|
children: [
|
|
5425
|
-
showImage ? /* @__PURE__ */
|
|
5426
|
-
/* @__PURE__ */
|
|
5427
|
-
/* @__PURE__ */
|
|
5091
|
+
showImage ? /* @__PURE__ */ jsx15(Img, { source: { uri: imageUrl }, style: styles12.teamLogo, resizeMode: "contain", onError: () => setImgFailed(true) }) : /* @__PURE__ */ jsx15(View13, { style: [styles12.teamLogo, styles12.teamLogoPlaceholder] }),
|
|
5092
|
+
/* @__PURE__ */ jsx15(Text13, { style: [styles12.teamName, { color: t.text }], numberOfLines: 1, children: name }),
|
|
5093
|
+
/* @__PURE__ */ jsxs13(Text13, { style: [styles12.teamOdds, { color }], children: [
|
|
5428
5094
|
odds,
|
|
5429
5095
|
"x"
|
|
5430
5096
|
] }),
|
|
5431
|
-
/* @__PURE__ */
|
|
5097
|
+
/* @__PURE__ */ jsxs13(Text13, { style: [styles12.teamBets, { color: t.textMuted }], children: [
|
|
5432
5098
|
bets,
|
|
5433
5099
|
" ",
|
|
5434
5100
|
bets === 1 ? "bet" : "bets"
|
|
5435
5101
|
] }),
|
|
5436
|
-
selected && /* @__PURE__ */
|
|
5102
|
+
selected && /* @__PURE__ */ jsx15(View13, { style: [styles12.teamBadge, { backgroundColor: color }], children: /* @__PURE__ */ jsx15(Text13, { style: styles12.teamBadgeText, children: "Selected" }) })
|
|
5437
5103
|
]
|
|
5438
5104
|
}
|
|
5439
5105
|
);
|
|
5440
5106
|
}
|
|
5441
|
-
var
|
|
5107
|
+
var styles12 = StyleSheet13.create({
|
|
5442
5108
|
overlay: {
|
|
5443
|
-
...
|
|
5109
|
+
...StyleSheet13.absoluteFillObject,
|
|
5444
5110
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
5445
5111
|
},
|
|
5446
5112
|
overlayTap: {
|
|
@@ -5589,19 +5255,19 @@ var styles13 = StyleSheet14.create({
|
|
|
5589
5255
|
});
|
|
5590
5256
|
|
|
5591
5257
|
// src/ui/game/ClaimPrizeSheet.tsx
|
|
5592
|
-
import { useState as
|
|
5258
|
+
import { useState as useState23, useEffect as useEffect15, useRef as useRef8, useCallback as useCallback19 } from "react";
|
|
5593
5259
|
import {
|
|
5594
|
-
View as
|
|
5595
|
-
Text as
|
|
5596
|
-
TouchableOpacity as
|
|
5597
|
-
ActivityIndicator as
|
|
5598
|
-
Modal as
|
|
5599
|
-
Animated as
|
|
5600
|
-
StyleSheet as
|
|
5601
|
-
KeyboardAvoidingView as
|
|
5602
|
-
Platform as
|
|
5260
|
+
View as View14,
|
|
5261
|
+
Text as Text14,
|
|
5262
|
+
TouchableOpacity as TouchableOpacity10,
|
|
5263
|
+
ActivityIndicator as ActivityIndicator8,
|
|
5264
|
+
Modal as Modal4,
|
|
5265
|
+
Animated as Animated5,
|
|
5266
|
+
StyleSheet as StyleSheet14,
|
|
5267
|
+
KeyboardAvoidingView as KeyboardAvoidingView5,
|
|
5268
|
+
Platform as Platform8
|
|
5603
5269
|
} from "react-native";
|
|
5604
|
-
import { jsx as
|
|
5270
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5605
5271
|
var STATUS_LABELS4 = {
|
|
5606
5272
|
building: "Building transaction...",
|
|
5607
5273
|
signing: "Approve in wallet...",
|
|
@@ -5620,18 +5286,18 @@ function ClaimPrizeSheet({
|
|
|
5620
5286
|
const t = useDubsTheme();
|
|
5621
5287
|
const { wallet } = useDubs();
|
|
5622
5288
|
const mutation = useClaim();
|
|
5623
|
-
const overlayOpacity =
|
|
5624
|
-
const celebrationScale =
|
|
5625
|
-
const celebrationOpacity =
|
|
5626
|
-
const [showCelebration, setShowCelebration] =
|
|
5627
|
-
|
|
5628
|
-
|
|
5289
|
+
const overlayOpacity = useRef8(new Animated5.Value(0)).current;
|
|
5290
|
+
const celebrationScale = useRef8(new Animated5.Value(0)).current;
|
|
5291
|
+
const celebrationOpacity = useRef8(new Animated5.Value(0)).current;
|
|
5292
|
+
const [showCelebration, setShowCelebration] = useState23(false);
|
|
5293
|
+
useEffect15(() => {
|
|
5294
|
+
Animated5.timing(overlayOpacity, {
|
|
5629
5295
|
toValue: visible ? 1 : 0,
|
|
5630
5296
|
duration: 250,
|
|
5631
5297
|
useNativeDriver: true
|
|
5632
5298
|
}).start();
|
|
5633
5299
|
}, [visible, overlayOpacity]);
|
|
5634
|
-
|
|
5300
|
+
useEffect15(() => {
|
|
5635
5301
|
if (visible) {
|
|
5636
5302
|
mutation.reset();
|
|
5637
5303
|
setShowCelebration(false);
|
|
@@ -5639,17 +5305,17 @@ function ClaimPrizeSheet({
|
|
|
5639
5305
|
celebrationOpacity.setValue(0);
|
|
5640
5306
|
}
|
|
5641
5307
|
}, [visible]);
|
|
5642
|
-
|
|
5308
|
+
useEffect15(() => {
|
|
5643
5309
|
if (mutation.status === "success" && mutation.data) {
|
|
5644
5310
|
setShowCelebration(true);
|
|
5645
|
-
|
|
5646
|
-
|
|
5311
|
+
Animated5.parallel([
|
|
5312
|
+
Animated5.spring(celebrationScale, {
|
|
5647
5313
|
toValue: 1,
|
|
5648
5314
|
tension: 50,
|
|
5649
5315
|
friction: 6,
|
|
5650
5316
|
useNativeDriver: true
|
|
5651
5317
|
}),
|
|
5652
|
-
|
|
5318
|
+
Animated5.timing(celebrationOpacity, {
|
|
5653
5319
|
toValue: 1,
|
|
5654
5320
|
duration: 300,
|
|
5655
5321
|
useNativeDriver: true
|
|
@@ -5662,14 +5328,14 @@ function ClaimPrizeSheet({
|
|
|
5662
5328
|
return () => clearTimeout(timer);
|
|
5663
5329
|
}
|
|
5664
5330
|
}, [mutation.status, mutation.data]);
|
|
5665
|
-
|
|
5331
|
+
useEffect15(() => {
|
|
5666
5332
|
if (mutation.status === "error" && mutation.error) {
|
|
5667
5333
|
onError?.(mutation.error);
|
|
5668
5334
|
}
|
|
5669
5335
|
}, [mutation.status, mutation.error]);
|
|
5670
5336
|
const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
|
|
5671
5337
|
const canClaim = !isMutating && mutation.status !== "success" && !!wallet.publicKey;
|
|
5672
|
-
const handleClaim =
|
|
5338
|
+
const handleClaim = useCallback19(async () => {
|
|
5673
5339
|
if (!wallet.publicKey) return;
|
|
5674
5340
|
try {
|
|
5675
5341
|
await mutation.execute({
|
|
@@ -5681,62 +5347,62 @@ function ClaimPrizeSheet({
|
|
|
5681
5347
|
}
|
|
5682
5348
|
}, [wallet.publicKey, mutation.execute, gameId, prizeAmount]);
|
|
5683
5349
|
const statusLabel = STATUS_LABELS4[mutation.status] || "";
|
|
5684
|
-
return /* @__PURE__ */
|
|
5685
|
-
|
|
5350
|
+
return /* @__PURE__ */ jsxs14(
|
|
5351
|
+
Modal4,
|
|
5686
5352
|
{
|
|
5687
5353
|
visible,
|
|
5688
5354
|
animationType: "slide",
|
|
5689
5355
|
transparent: true,
|
|
5690
5356
|
onRequestClose: onDismiss,
|
|
5691
5357
|
children: [
|
|
5692
|
-
/* @__PURE__ */
|
|
5693
|
-
/* @__PURE__ */
|
|
5694
|
-
|
|
5358
|
+
/* @__PURE__ */ jsx16(Animated5.View, { style: [styles13.overlay, { opacity: overlayOpacity }], children: /* @__PURE__ */ jsx16(TouchableOpacity10, { style: styles13.overlayTap, activeOpacity: 1, onPress: onDismiss }) }),
|
|
5359
|
+
/* @__PURE__ */ jsx16(
|
|
5360
|
+
KeyboardAvoidingView5,
|
|
5695
5361
|
{
|
|
5696
|
-
style:
|
|
5697
|
-
behavior:
|
|
5698
|
-
children: /* @__PURE__ */
|
|
5699
|
-
/* @__PURE__ */
|
|
5700
|
-
/* @__PURE__ */
|
|
5701
|
-
/* @__PURE__ */
|
|
5702
|
-
/* @__PURE__ */
|
|
5362
|
+
style: styles13.keyboardView,
|
|
5363
|
+
behavior: Platform8.OS === "ios" ? "padding" : void 0,
|
|
5364
|
+
children: /* @__PURE__ */ jsx16(View14, { style: styles13.sheetPositioner, children: /* @__PURE__ */ jsxs14(View14, { style: [styles13.sheet, { backgroundColor: t.background }], children: [
|
|
5365
|
+
/* @__PURE__ */ jsx16(View14, { style: styles13.handleRow, children: /* @__PURE__ */ jsx16(View14, { style: [styles13.handle, { backgroundColor: t.textMuted }] }) }),
|
|
5366
|
+
/* @__PURE__ */ jsxs14(View14, { style: styles13.header, children: [
|
|
5367
|
+
/* @__PURE__ */ jsx16(Text14, { style: [styles13.headerTitle, { color: t.text }], children: showCelebration ? isRefund ? "Refund Claimed!" : "Prize Claimed!" : isRefund ? "Claim Refund" : "Claim Prize" }),
|
|
5368
|
+
/* @__PURE__ */ jsx16(TouchableOpacity10, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ jsx16(Text14, { style: [styles13.closeButton, { color: t.textMuted }], children: "\u2715" }) })
|
|
5703
5369
|
] }),
|
|
5704
|
-
showCelebration && /* @__PURE__ */
|
|
5705
|
-
|
|
5370
|
+
showCelebration && /* @__PURE__ */ jsxs14(
|
|
5371
|
+
Animated5.View,
|
|
5706
5372
|
{
|
|
5707
5373
|
style: [
|
|
5708
|
-
|
|
5374
|
+
styles13.celebrationContainer,
|
|
5709
5375
|
{
|
|
5710
5376
|
opacity: celebrationOpacity,
|
|
5711
5377
|
transform: [{ scale: celebrationScale }]
|
|
5712
5378
|
}
|
|
5713
5379
|
],
|
|
5714
5380
|
children: [
|
|
5715
|
-
/* @__PURE__ */
|
|
5716
|
-
/* @__PURE__ */
|
|
5381
|
+
/* @__PURE__ */ jsx16(Text14, { style: styles13.celebrationEmoji, children: "\u{1F3C6}" }),
|
|
5382
|
+
/* @__PURE__ */ jsxs14(Text14, { style: [styles13.celebrationText, { color: t.success }], children: [
|
|
5717
5383
|
"+",
|
|
5718
5384
|
prizeAmount,
|
|
5719
5385
|
" SOL"
|
|
5720
5386
|
] }),
|
|
5721
|
-
/* @__PURE__ */
|
|
5387
|
+
/* @__PURE__ */ jsx16(Text14, { style: [styles13.celebrationSubtext, { color: t.textMuted }], children: isRefund ? "Refund sent to your wallet" : "Winnings sent to your wallet" })
|
|
5722
5388
|
]
|
|
5723
5389
|
}
|
|
5724
5390
|
),
|
|
5725
|
-
!showCelebration && /* @__PURE__ */
|
|
5726
|
-
/* @__PURE__ */
|
|
5727
|
-
/* @__PURE__ */
|
|
5728
|
-
/* @__PURE__ */
|
|
5391
|
+
!showCelebration && /* @__PURE__ */ jsxs14(View14, { style: [styles13.summaryCard, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
5392
|
+
/* @__PURE__ */ jsxs14(View14, { style: styles13.summaryRow, children: [
|
|
5393
|
+
/* @__PURE__ */ jsx16(Text14, { style: [styles13.summaryLabel, { color: t.textMuted }], children: isRefund ? "Refund" : "Prize" }),
|
|
5394
|
+
/* @__PURE__ */ jsxs14(Text14, { style: [styles13.summaryValue, { color: t.success }], children: [
|
|
5729
5395
|
prizeAmount,
|
|
5730
5396
|
" SOL"
|
|
5731
5397
|
] })
|
|
5732
5398
|
] }),
|
|
5733
|
-
/* @__PURE__ */
|
|
5734
|
-
/* @__PURE__ */
|
|
5735
|
-
/* @__PURE__ */
|
|
5736
|
-
/* @__PURE__ */
|
|
5737
|
-
|
|
5399
|
+
/* @__PURE__ */ jsx16(View14, { style: [styles13.summarySep, { backgroundColor: t.border }] }),
|
|
5400
|
+
/* @__PURE__ */ jsxs14(View14, { style: styles13.summaryRow, children: [
|
|
5401
|
+
/* @__PURE__ */ jsx16(Text14, { style: [styles13.summaryLabel, { color: t.textMuted }], children: "Game" }),
|
|
5402
|
+
/* @__PURE__ */ jsxs14(
|
|
5403
|
+
Text14,
|
|
5738
5404
|
{
|
|
5739
|
-
style: [
|
|
5405
|
+
style: [styles13.summaryValue, { color: t.text }],
|
|
5740
5406
|
numberOfLines: 1,
|
|
5741
5407
|
children: [
|
|
5742
5408
|
gameId.slice(0, 8),
|
|
@@ -5747,21 +5413,21 @@ function ClaimPrizeSheet({
|
|
|
5747
5413
|
)
|
|
5748
5414
|
] })
|
|
5749
5415
|
] }),
|
|
5750
|
-
mutation.error && /* @__PURE__ */
|
|
5751
|
-
!showCelebration && /* @__PURE__ */
|
|
5752
|
-
|
|
5416
|
+
mutation.error && /* @__PURE__ */ jsx16(View14, { style: [styles13.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ jsx16(Text14, { style: [styles13.errorText, { color: t.errorText }], children: mutation.error.message }) }),
|
|
5417
|
+
!showCelebration && /* @__PURE__ */ jsx16(
|
|
5418
|
+
TouchableOpacity10,
|
|
5753
5419
|
{
|
|
5754
5420
|
style: [
|
|
5755
|
-
|
|
5421
|
+
styles13.ctaButton,
|
|
5756
5422
|
{ backgroundColor: canClaim ? t.accent : t.border }
|
|
5757
5423
|
],
|
|
5758
5424
|
disabled: !canClaim,
|
|
5759
5425
|
onPress: handleClaim,
|
|
5760
5426
|
activeOpacity: 0.8,
|
|
5761
|
-
children: isMutating ? /* @__PURE__ */
|
|
5762
|
-
/* @__PURE__ */
|
|
5763
|
-
/* @__PURE__ */
|
|
5764
|
-
] }) : /* @__PURE__ */
|
|
5427
|
+
children: isMutating ? /* @__PURE__ */ jsxs14(View14, { style: styles13.ctaLoading, children: [
|
|
5428
|
+
/* @__PURE__ */ jsx16(ActivityIndicator8, { size: "small", color: "#FFFFFF" }),
|
|
5429
|
+
/* @__PURE__ */ jsx16(Text14, { style: styles13.ctaText, children: statusLabel })
|
|
5430
|
+
] }) : /* @__PURE__ */ jsxs14(Text14, { style: [styles13.ctaText, !canClaim && { opacity: 0.5 }], children: [
|
|
5765
5431
|
isRefund ? "Claim Refund" : "Claim Prize",
|
|
5766
5432
|
" \u2014 ",
|
|
5767
5433
|
prizeAmount,
|
|
@@ -5769,7 +5435,7 @@ function ClaimPrizeSheet({
|
|
|
5769
5435
|
] })
|
|
5770
5436
|
}
|
|
5771
5437
|
),
|
|
5772
|
-
mutation.data?.explorerUrl && /* @__PURE__ */
|
|
5438
|
+
mutation.data?.explorerUrl && /* @__PURE__ */ jsx16(Text14, { style: [styles13.explorerHint, { color: t.textMuted }], children: "View on Solscan" })
|
|
5773
5439
|
] }) })
|
|
5774
5440
|
}
|
|
5775
5441
|
)
|
|
@@ -5777,9 +5443,9 @@ function ClaimPrizeSheet({
|
|
|
5777
5443
|
}
|
|
5778
5444
|
);
|
|
5779
5445
|
}
|
|
5780
|
-
var
|
|
5446
|
+
var styles13 = StyleSheet14.create({
|
|
5781
5447
|
overlay: {
|
|
5782
|
-
...
|
|
5448
|
+
...StyleSheet14.absoluteFillObject,
|
|
5783
5449
|
backgroundColor: "rgba(0,0,0,0.5)"
|
|
5784
5450
|
},
|
|
5785
5451
|
overlayTap: {
|
|
@@ -5902,15 +5568,15 @@ var styles14 = StyleSheet15.create({
|
|
|
5902
5568
|
});
|
|
5903
5569
|
|
|
5904
5570
|
// src/ui/game/ClaimButton.tsx
|
|
5905
|
-
import { useState as
|
|
5906
|
-
import { StyleSheet as
|
|
5907
|
-
import { Fragment as Fragment5, jsx as
|
|
5571
|
+
import { useState as useState24, useMemo as useMemo9, useCallback as useCallback20 } from "react";
|
|
5572
|
+
import { StyleSheet as StyleSheet15, Text as Text15, TouchableOpacity as TouchableOpacity11 } from "react-native";
|
|
5573
|
+
import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5908
5574
|
function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
5909
5575
|
const t = useDubsTheme();
|
|
5910
5576
|
const { wallet } = useDubs();
|
|
5911
5577
|
const game = useGame(gameId);
|
|
5912
5578
|
const claimStatus = useHasClaimed(gameId);
|
|
5913
|
-
const [sheetVisible, setSheetVisible] =
|
|
5579
|
+
const [sheetVisible, setSheetVisible] = useState24(false);
|
|
5914
5580
|
const walletAddress = wallet.publicKey?.toBase58() ?? null;
|
|
5915
5581
|
const myBet = useMemo9(() => {
|
|
5916
5582
|
if (!walletAddress || !game.data?.bettors) return null;
|
|
@@ -5921,7 +5587,7 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
5921
5587
|
const isWinner = isResolved && myBet != null && myBet.team === game.data?.winnerSide;
|
|
5922
5588
|
const isEligible = myBet != null && isResolved && (isWinner || isRefund);
|
|
5923
5589
|
const prizeAmount = isRefund ? myBet?.amount ?? 0 : game.data?.totalPool ?? 0;
|
|
5924
|
-
const handleSuccess =
|
|
5590
|
+
const handleSuccess = useCallback20(
|
|
5925
5591
|
(result) => {
|
|
5926
5592
|
claimStatus.refetch();
|
|
5927
5593
|
onSuccess?.(result);
|
|
@@ -5934,13 +5600,13 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
5934
5600
|
}
|
|
5935
5601
|
const label = isRefund ? "Refund" : "Prize";
|
|
5936
5602
|
if (claimStatus.hasClaimed) {
|
|
5937
|
-
return /* @__PURE__ */
|
|
5938
|
-
|
|
5603
|
+
return /* @__PURE__ */ jsx17(
|
|
5604
|
+
TouchableOpacity11,
|
|
5939
5605
|
{
|
|
5940
|
-
style: [
|
|
5606
|
+
style: [styles14.badge, { borderColor: t.accent }, style],
|
|
5941
5607
|
activeOpacity: 1,
|
|
5942
5608
|
disabled: true,
|
|
5943
|
-
children: /* @__PURE__ */
|
|
5609
|
+
children: /* @__PURE__ */ jsxs15(Text15, { style: [styles14.badgeText, { color: t.accent }], children: [
|
|
5944
5610
|
label,
|
|
5945
5611
|
" Claimed!"
|
|
5946
5612
|
] })
|
|
@@ -5950,14 +5616,14 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
5950
5616
|
if (!isEligible) {
|
|
5951
5617
|
return null;
|
|
5952
5618
|
}
|
|
5953
|
-
return /* @__PURE__ */
|
|
5954
|
-
/* @__PURE__ */
|
|
5955
|
-
|
|
5619
|
+
return /* @__PURE__ */ jsxs15(Fragment5, { children: [
|
|
5620
|
+
/* @__PURE__ */ jsx17(
|
|
5621
|
+
TouchableOpacity11,
|
|
5956
5622
|
{
|
|
5957
|
-
style: [
|
|
5623
|
+
style: [styles14.button, { backgroundColor: t.accent }, style],
|
|
5958
5624
|
activeOpacity: 0.8,
|
|
5959
5625
|
onPress: () => setSheetVisible(true),
|
|
5960
|
-
children: /* @__PURE__ */
|
|
5626
|
+
children: /* @__PURE__ */ jsxs15(Text15, { style: styles14.buttonText, children: [
|
|
5961
5627
|
"Claim ",
|
|
5962
5628
|
label,
|
|
5963
5629
|
" \u2014 ",
|
|
@@ -5966,7 +5632,7 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
5966
5632
|
] })
|
|
5967
5633
|
}
|
|
5968
5634
|
),
|
|
5969
|
-
/* @__PURE__ */
|
|
5635
|
+
/* @__PURE__ */ jsx17(
|
|
5970
5636
|
ClaimPrizeSheet,
|
|
5971
5637
|
{
|
|
5972
5638
|
visible: sheetVisible,
|
|
@@ -5980,7 +5646,7 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
|
|
|
5980
5646
|
)
|
|
5981
5647
|
] });
|
|
5982
5648
|
}
|
|
5983
|
-
var
|
|
5649
|
+
var styles14 = StyleSheet15.create({
|
|
5984
5650
|
button: {
|
|
5985
5651
|
height: 52,
|
|
5986
5652
|
borderRadius: 14,
|
|
@@ -6014,7 +5680,6 @@ export {
|
|
|
6014
5680
|
CreateCustomGameSheet,
|
|
6015
5681
|
DEFAULT_BASE_URL,
|
|
6016
5682
|
DEFAULT_RPC_URL,
|
|
6017
|
-
DeveloperDashboardSheet,
|
|
6018
5683
|
DubsApiError,
|
|
6019
5684
|
DubsClient,
|
|
6020
5685
|
DubsProvider,
|