@dubsdotapp/expo 0.5.8 → 0.5.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dubsdotapp/expo",
3
- "version": "0.5.8",
3
+ "version": "0.5.10",
4
4
  "description": "React Native SDK for the Dubs betting platform",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -169,14 +169,15 @@ export function JoinGameSheet({
169
169
 
170
170
  const homeName = shortName ? shortName(opponents[0]?.name) : (opponents[0]?.name || 'Home');
171
171
  const awayName = shortName ? shortName(opponents[1]?.name) : (opponents[1]?.name || 'Away');
172
- const selectedName = selectedTeam === 'home' ? homeName : selectedTeam === 'away' ? awayName : '—';
173
172
 
174
- const alreadyJoined = useMemo(() => {
175
- if (!wallet.publicKey) return false;
173
+ const myBet = useMemo(() => {
174
+ if (!wallet.publicKey) return null;
176
175
  const addr = wallet.publicKey.toBase58();
177
- return bettors.some(b => b.wallet === addr);
176
+ return bettors.find(b => b.wallet === addr) ?? null;
178
177
  }, [bettors, wallet.publicKey]);
179
178
 
179
+ const alreadyJoined = myBet !== null;
180
+
180
181
  const isMutating = mutation.status !== 'idle' && mutation.status !== 'success' && mutation.status !== 'error';
181
182
  const canJoin = selectedTeam !== null && !isMutating && mutation.status !== 'success' && !alreadyJoined;
182
183
 
@@ -269,7 +270,7 @@ export function JoinGameSheet({
269
270
  )}
270
271
 
271
272
  {/* Team Selection — hidden in pool mode and custom games */}
272
- {!isCustomGame && !isPoolModeEnabled && (
273
+ {!isCustomGame && !isPoolModeEnabled && !alreadyJoined && (
273
274
  <View style={styles.section}>
274
275
  <Text style={[styles.sectionLabel, { color: t.textSecondary }]}>Pick Your Side</Text>
275
276
  <View style={styles.teamsRow}>
@@ -299,18 +300,16 @@ export function JoinGameSheet({
299
300
  </View>
300
301
  )}
301
302
 
302
- {/* SOL Slider */}
303
- {selectedTeam && !isPoolModeEnabled && (
304
- <View style={styles.sliderSection}>
305
- <SolSlider
306
- value={wager}
307
- min={game.buyIn}
308
- max={maxWager}
309
- step={0.01}
310
- accentColor={selectedTeam === 'home' ? homeColor : awayColor}
311
- onValueChange={setWager}
312
- onTick={onSliderTick}
313
- />
303
+ {/* Already joined — show which side */}
304
+ {alreadyJoined && myBet && (
305
+ <View style={[styles.myBetCard, { backgroundColor: (myBet.team === 'home' ? homeColor : awayColor) + '15', borderColor: myBet.team === 'home' ? homeColor : awayColor }]}>
306
+ <Text style={[styles.myBetLabel, { color: myBet.team === 'home' ? homeColor : awayColor }]}>YOUR BET</Text>
307
+ <Text style={[styles.myBetTeam, { color: t.text }]}>
308
+ {myBet.team === 'home' ? homeName : awayName}
309
+ </Text>
310
+ <Text style={[styles.myBetAmount, { color: t.textMuted }]}>
311
+ {formatSol(myBet.amount)} SOL
312
+ </Text>
314
313
  </View>
315
314
  )}
316
315
 
@@ -335,11 +334,6 @@ export function JoinGameSheet({
335
334
  </>
336
335
  ) : (
337
336
  <>
338
- <View style={styles.summaryRow}>
339
- <Text style={[styles.summaryLabel, { color: t.textMuted }]}>Your side</Text>
340
- <Text style={[styles.summaryValue, { color: t.text }]}>{selectedName}</Text>
341
- </View>
342
- <View style={[styles.summarySep, { backgroundColor: t.border }]} />
343
337
  <View style={styles.summaryRow}>
344
338
  <Text style={[styles.summaryLabel, { color: t.textMuted }]}>Total pool</Text>
345
339
  <Text style={[styles.summaryValue, { color: t.text }]}>{formatSol(poolAfterJoin)} SOL</Text>
@@ -355,6 +349,19 @@ export function JoinGameSheet({
355
349
  )}
356
350
  </View>
357
351
 
352
+ {/* SOL Slider — sits right below summary card */}
353
+ {selectedTeam && !isPoolModeEnabled && !alreadyJoined && (
354
+ <SolSlider
355
+ value={wager}
356
+ min={game.buyIn}
357
+ max={maxWager}
358
+ step={0.01}
359
+ accentColor={selectedTeam === 'home' ? homeColor : awayColor}
360
+ onValueChange={setWager}
361
+ onTick={onSliderTick}
362
+ />
363
+ )}
364
+
358
365
  {/* Already Joined Notice */}
359
366
  {alreadyJoined && (
360
367
  <View style={[styles.errorBox, { backgroundColor: t.surface, borderColor: t.border }]}>
@@ -563,11 +570,8 @@ const styles = StyleSheet.create({
563
570
  flexDirection: 'row',
564
571
  gap: 12,
565
572
  },
566
- sliderSection: {
567
- marginTop: 16,
568
- },
569
573
  summaryCard: {
570
- marginTop: 12,
574
+ marginTop: 20,
571
575
  borderRadius: 16,
572
576
  borderWidth: 1,
573
577
  overflow: 'hidden',
@@ -590,6 +594,27 @@ const styles = StyleSheet.create({
590
594
  height: 1,
591
595
  marginHorizontal: 16,
592
596
  },
597
+ myBetCard: {
598
+ marginTop: 16,
599
+ borderRadius: 14,
600
+ borderWidth: 1.5,
601
+ padding: 16,
602
+ alignItems: 'center',
603
+ gap: 4,
604
+ },
605
+ myBetLabel: {
606
+ fontSize: 10,
607
+ fontWeight: '900',
608
+ letterSpacing: 1.5,
609
+ },
610
+ myBetTeam: {
611
+ fontSize: 18,
612
+ fontWeight: '700',
613
+ },
614
+ myBetAmount: {
615
+ fontSize: 14,
616
+ fontWeight: '600',
617
+ },
593
618
  errorBox: {
594
619
  marginTop: 16,
595
620
  borderRadius: 12,
@@ -104,14 +104,6 @@ export function SolSlider({
104
104
 
105
105
  return (
106
106
  <View style={styles.container}>
107
- {/* Value display */}
108
- <View style={styles.valueRow}>
109
- <Text style={[styles.valueText, { color: accent }]}>
110
- {parseFloat(value.toFixed(4))}
111
- </Text>
112
- <Text style={[styles.solLabel, { color: accent }]}>SOL</Text>
113
- </View>
114
-
115
107
  {/* Track */}
116
108
  <View
117
109
  ref={trackRef}
@@ -170,25 +162,7 @@ export function SolSlider({
170
162
 
171
163
  const styles = StyleSheet.create({
172
164
  container: {
173
- paddingVertical: 8,
174
- },
175
- valueRow: {
176
- flexDirection: 'row',
177
- alignItems: 'baseline',
178
- justifyContent: 'center',
179
- marginBottom: 16,
180
- gap: 4,
181
- },
182
- valueText: {
183
- fontSize: 36,
184
- fontWeight: '900',
185
- letterSpacing: -1,
186
- fontVariant: ['tabular-nums'],
187
- },
188
- solLabel: {
189
- fontSize: 16,
190
- fontWeight: '700',
191
- opacity: 0.6,
165
+ paddingVertical: 4,
192
166
  },
193
167
  trackContainer: {
194
168
  height: THUMB_SIZE + 16,