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