be-components 6.0.4 → 6.0.5
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/lib/commonjs/Components/Icons.js +30 -0
- package/lib/commonjs/Components/Icons.js.map +1 -1
- package/lib/commonjs/Components/Pagination.js +70 -6
- package/lib/commonjs/Components/Pagination.js.map +1 -1
- package/lib/commonjs/LocationTracker/api/index.js +2 -0
- package/lib/commonjs/LocationTracker/api/index.js.map +1 -1
- package/lib/commonjs/LocationTracker/index.js +39 -54
- package/lib/commonjs/LocationTracker/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/api/index.js +137 -2
- package/lib/commonjs/MarketComponents/api/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/AthleteMarket/index.js +2 -2
- package/lib/commonjs/MarketComponents/components/AthleteMarket/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/TeamEventMarket/api/index.js +28 -0
- package/lib/commonjs/MarketComponents/components/TeamEventMarket/api/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js +3 -2
- package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
- package/lib/commonjs/ProfileManager/Components/ProfileWizard.js +1 -130
- package/lib/commonjs/ProfileManager/Components/ProfileWizard.js.map +1 -1
- package/lib/commonjs/ProfileManager/index.js +15 -5
- package/lib/commonjs/ProfileManager/index.js.map +1 -1
- package/lib/commonjs/SocialComponents/SocialOrderCard.js +50 -1
- package/lib/commonjs/SocialComponents/SocialOrderCard.js.map +1 -1
- package/lib/module/Components/Icons.js +30 -0
- package/lib/module/Components/Icons.js.map +1 -1
- package/lib/module/Components/Pagination.js +68 -5
- package/lib/module/Components/Pagination.js.map +1 -1
- package/lib/module/LocationTracker/api/index.js +2 -0
- package/lib/module/LocationTracker/api/index.js.map +1 -1
- package/lib/module/LocationTracker/index.js +16 -31
- package/lib/module/LocationTracker/index.js.map +1 -1
- package/lib/module/MarketComponents/api/index.js +137 -2
- package/lib/module/MarketComponents/api/index.js.map +1 -1
- package/lib/module/MarketComponents/components/AthleteMarket/index.js +2 -2
- package/lib/module/MarketComponents/components/AthleteMarket/index.js.map +1 -1
- package/lib/module/MarketComponents/components/TeamEventMarket/api/index.js +28 -0
- package/lib/module/MarketComponents/components/TeamEventMarket/api/index.js.map +1 -1
- package/lib/module/MarketComponents/components/TeamEventMarket/index.js +3 -2
- package/lib/module/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
- package/lib/module/ProfileManager/Components/ProfileWizard.js +1 -132
- package/lib/module/ProfileManager/Components/ProfileWizard.js.map +1 -1
- package/lib/module/ProfileManager/index.js +15 -5
- package/lib/module/ProfileManager/index.js.map +1 -1
- package/lib/module/SocialComponents/SocialOrderCard.js +50 -1
- package/lib/module/SocialComponents/SocialOrderCard.js.map +1 -1
- package/lib/typescript/lib/commonjs/Components/Icons.d.ts +5 -0
- package/lib/typescript/lib/commonjs/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Components/Pagination.d.ts +3 -1
- package/lib/typescript/lib/commonjs/Components/Pagination.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/LocationTracker/api/index.d.ts +1 -0
- package/lib/typescript/lib/commonjs/LocationTracker/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/LocationTracker/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/MarketComponents/api/index.d.ts +10 -0
- package/lib/typescript/lib/commonjs/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/MarketComponents/components/TeamEventMarket/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/ProfileManager/Components/ProfileWizard.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/ProfileManager/index.d.ts +3 -1
- package/lib/typescript/lib/commonjs/ProfileManager/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/SocialComponents/SocialOrderCard.d.ts +2 -1
- package/lib/typescript/lib/commonjs/SocialComponents/SocialOrderCard.d.ts.map +1 -1
- package/lib/typescript/lib/module/Components/Icons.d.ts +5 -0
- package/lib/typescript/lib/module/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/lib/module/Components/Pagination.d.ts +3 -1
- package/lib/typescript/lib/module/Components/Pagination.d.ts.map +1 -1
- package/lib/typescript/lib/module/LocationTracker/api/index.d.ts +1 -0
- package/lib/typescript/lib/module/LocationTracker/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/LocationTracker/index.d.ts +1 -2
- package/lib/typescript/lib/module/LocationTracker/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/MarketComponents/api/index.d.ts +10 -0
- package/lib/typescript/lib/module/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/MarketComponents/components/TeamEventMarket/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/MarketComponents/components/TeamEventMarket/index.d.ts +2 -1
- package/lib/typescript/lib/module/MarketComponents/components/TeamEventMarket/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/ProfileManager/Components/ProfileWizard.d.ts.map +1 -1
- package/lib/typescript/lib/module/ProfileManager/index.d.ts +3 -1
- package/lib/typescript/lib/module/ProfileManager/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/SocialComponents/SocialOrderCard.d.ts +2 -1
- package/lib/typescript/lib/module/SocialComponents/SocialOrderCard.d.ts.map +1 -1
- package/lib/typescript/src/Components/Icons.d.ts +1 -0
- package/lib/typescript/src/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/src/Components/Pagination.d.ts +3 -1
- package/lib/typescript/src/Components/Pagination.d.ts.map +1 -1
- package/lib/typescript/src/LocationTracker/api/index.d.ts.map +1 -1
- package/lib/typescript/src/LocationTracker/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/api/index.d.ts +22 -2
- package/lib/typescript/src/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/components/AthleteMarket/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/components/TeamEventMarket/api/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts +2 -1
- package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/index.d.ts +2 -1
- package/lib/typescript/src/MarketComponents/index.d.ts.map +1 -1
- package/lib/typescript/src/ProfileManager/Components/ProfileWizard.d.ts.map +1 -1
- package/lib/typescript/src/ProfileManager/index.d.ts +3 -1
- package/lib/typescript/src/ProfileManager/index.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/SocialOrderCard.d.ts +4 -3
- package/lib/typescript/src/SocialComponents/SocialOrderCard.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Components/Icons.tsx +17 -0
- package/src/Components/Pagination.tsx +46 -6
- package/src/LocationTracker/api/index.tsx +2 -0
- package/src/LocationTracker/index.tsx +16 -26
- package/src/MarketComponents/api/index.ts +110 -4
- package/src/MarketComponents/components/AthleteMarket/index.tsx +2 -3
- package/src/MarketComponents/components/TeamEventMarket/api/index.ts +27 -1
- package/src/MarketComponents/components/TeamEventMarket/index.tsx +4 -4
- package/src/ProfileManager/Components/ProfileWizard.tsx +2 -139
- package/src/ProfileManager/index.tsx +9 -7
- package/src/SocialComponents/SocialOrderCard.tsx +24 -3
- package/src/types.d.ts +11 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { Button, Text } from '../Components';
|
|
4
|
-
import Colors from '../constants/colors';
|
|
2
|
+
import { Image, Linking, Platform } from 'react-native';
|
|
5
3
|
import { isSafari, isChrome, isIOS } from 'react-device-detect';
|
|
6
4
|
import type { LocationProps, PlayerAddressProps } from '../types';
|
|
7
5
|
import * as Location from 'expo-location';
|
|
6
|
+
import { Button, Text, View } from '../Components/Themed';
|
|
7
|
+
import { useColors } from '../constants/useColors';
|
|
8
8
|
|
|
9
9
|
type LocationTrackerProps = {
|
|
10
10
|
onClose: () => void,
|
|
@@ -25,7 +25,7 @@ type LocationTrackerProps = {
|
|
|
25
25
|
onGetLocation: () => void
|
|
26
26
|
}
|
|
27
27
|
const LocationTracker = ({ onClose, onGetLocation, permission, location, onPromptForPermission }: LocationTrackerProps) => {
|
|
28
|
-
|
|
28
|
+
const Colors = useColors();
|
|
29
29
|
const { loading, error } = location;
|
|
30
30
|
|
|
31
31
|
const handleHelpMe = () => {
|
|
@@ -41,7 +41,7 @@ const LocationTracker = ({ onClose, onGetLocation, permission, location, onPromp
|
|
|
41
41
|
{permission.permission == 'undetermined' || permission.permission == 'prompt' || !permission.permission ?
|
|
42
42
|
<View style={{ padding:20 }}>
|
|
43
43
|
<View style={{ padding:10 }}>
|
|
44
|
-
<Text size={18}
|
|
44
|
+
<Text size={18} theme='h2'>ALL REAL-MONEY TRANSACTIONS REQUIRE LOCATION</Text>
|
|
45
45
|
</View>
|
|
46
46
|
<View style={{ justifyContent:'center', alignItems:'center', padding:15 }}>
|
|
47
47
|
<Image
|
|
@@ -50,13 +50,13 @@ const LocationTracker = ({ onClose, onGetLocation, permission, location, onPromp
|
|
|
50
50
|
/>
|
|
51
51
|
</View>
|
|
52
52
|
<View style={{ padding:10 }}>
|
|
53
|
-
<Text style={{ marginTop:5 }}
|
|
53
|
+
<Text style={{ marginTop:5 }} size={14} theme='description' textAlign='center'>When using real money, either in the form of a bet, competition or deposit/withdrawal, BettorEdge requires location services turned on to verify you are in a location where betting is permitted.</Text>
|
|
54
54
|
</View>
|
|
55
55
|
</View>
|
|
56
56
|
: permission.permission == 'denied' ?
|
|
57
57
|
<View style={{ padding:20 }}>
|
|
58
58
|
<View style={{ padding:10 }}>
|
|
59
|
-
<Text size={18}
|
|
59
|
+
<Text size={18} theme='h2' textAlign='center'>LOCATION SETTINGS ARE NOT ENABLED</Text>
|
|
60
60
|
</View>
|
|
61
61
|
<View style={{ justifyContent:'center', alignItems:'center', padding:15 }}>
|
|
62
62
|
<Image
|
|
@@ -65,13 +65,13 @@ const LocationTracker = ({ onClose, onGetLocation, permission, location, onPromp
|
|
|
65
65
|
/>
|
|
66
66
|
</View>
|
|
67
67
|
<View style={{ padding:10 }}>
|
|
68
|
-
<Text style={{ marginTop:5 }}
|
|
68
|
+
<Text style={{ marginTop:5 }} size={14} theme='warning' textAlign='center'>{error ?? `We were not able to get your location. Please use the Help Me button below to troubleshoot enabling your device's location services`}</Text>
|
|
69
69
|
</View>
|
|
70
70
|
</View>
|
|
71
71
|
: permission.permission == 'granted' || location.location ?
|
|
72
72
|
<View style={{ padding:20 }}>
|
|
73
73
|
<View style={{ padding:10 }}>
|
|
74
|
-
<Text size={18}
|
|
74
|
+
<Text size={18} theme='h2' textAlign='center'>ALL REAL-MONEY TRANSACTIONS REQUIRE LOCATION</Text>
|
|
75
75
|
</View>
|
|
76
76
|
<View style={{ justifyContent:'center', alignItems:'center', padding:15 }}>
|
|
77
77
|
<Image
|
|
@@ -80,7 +80,7 @@ const LocationTracker = ({ onClose, onGetLocation, permission, location, onPromp
|
|
|
80
80
|
/>
|
|
81
81
|
</View>
|
|
82
82
|
<View style={{ padding:10 }}>
|
|
83
|
-
<Text style={{ marginTop:5 }}
|
|
83
|
+
<Text style={{ marginTop:5 }} theme='description' size={14} weight='regular' textAlign='center'>When using real money, either in the form of a bet, competition or deposit/withdrawal, BettorEdge requires location services turned on to verify you are in a location where betting is permitted.</Text>
|
|
84
84
|
</View>
|
|
85
85
|
</View>
|
|
86
86
|
:<></>}
|
|
@@ -88,12 +88,8 @@ const LocationTracker = ({ onClose, onGetLocation, permission, location, onPromp
|
|
|
88
88
|
<View nativeID='action_row' style={{ flexDirection:'row', padding:20 }}>
|
|
89
89
|
<Button
|
|
90
90
|
title='CLOSE'
|
|
91
|
+
type='close'
|
|
91
92
|
style={{ flex:1, marginRight:5 }}
|
|
92
|
-
title_color={Colors.utility.error}
|
|
93
|
-
backgroundColor={Colors.shades.white}
|
|
94
|
-
borderWidth={1}
|
|
95
|
-
padding={15}
|
|
96
|
-
borderColor={Colors.utility.error}
|
|
97
93
|
onPress={() => onClose()}
|
|
98
94
|
/>
|
|
99
95
|
<Button
|
|
@@ -101,8 +97,8 @@ const LocationTracker = ({ onClose, onGetLocation, permission, location, onPromp
|
|
|
101
97
|
style={{ flex:3, opacity: loading ? 0.5 : 1 }}
|
|
102
98
|
loading={loading}
|
|
103
99
|
disabled={loading}
|
|
104
|
-
backgroundColor={Colors.
|
|
105
|
-
title_color={Colors.
|
|
100
|
+
backgroundColor={Colors.text.highlight}
|
|
101
|
+
title_color={Colors.text.white}
|
|
106
102
|
onPress={() => {
|
|
107
103
|
if(permission.permission == 'prompt' || permission.permission == 'undetermined' || !permission.checked){
|
|
108
104
|
return onPromptForPermission()
|
|
@@ -116,21 +112,15 @@ const LocationTracker = ({ onClose, onGetLocation, permission, location, onPromp
|
|
|
116
112
|
<View nativeID='action_row' style={{ flexDirection:'row', padding:20 }}>
|
|
117
113
|
<Button
|
|
118
114
|
title='CLOSE'
|
|
115
|
+
type='error'
|
|
119
116
|
style={{ flex:1, marginRight:5 }}
|
|
120
|
-
title_color={Colors.utility.error}
|
|
121
|
-
backgroundColor={Colors.shades.white}
|
|
122
|
-
borderWidth={1}
|
|
123
|
-
padding={15}
|
|
124
|
-
borderColor={Colors.utility.error}
|
|
125
117
|
onPress={() => onClose()}
|
|
126
118
|
/>
|
|
127
119
|
<Button
|
|
128
120
|
title='HELP ME'
|
|
129
121
|
style={{ flex:3 }}
|
|
130
|
-
title_color={Colors.
|
|
131
|
-
|
|
132
|
-
padding={15}
|
|
133
|
-
backgroundColor={Colors.brand.electric}
|
|
122
|
+
title_color={Colors.text.white}
|
|
123
|
+
backgroundColor={Colors.text.highlight}
|
|
134
124
|
onPress={() => handleHelpMe()}
|
|
135
125
|
/>
|
|
136
126
|
</View>
|
|
@@ -27,6 +27,15 @@ const MarketComponentApi = {
|
|
|
27
27
|
return []
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
+
createOrder: async(order:OrderProps):Promise<OrderProps | undefined> => {
|
|
31
|
+
try {
|
|
32
|
+
const resp = await axios.post(`${MK_SVC_API}/v1/orders/order/create`, { order });
|
|
33
|
+
return resp.data.order
|
|
34
|
+
} catch (e) {
|
|
35
|
+
console.log(e);
|
|
36
|
+
return undefined
|
|
37
|
+
}
|
|
38
|
+
},
|
|
30
39
|
getPlayersByIds: async(player_ids:string[]):Promise<PublicPlayerProps[]> => {
|
|
31
40
|
try {
|
|
32
41
|
if(player_ids.length == 0){ return [] }
|
|
@@ -202,7 +211,7 @@ const MarketComponentApi = {
|
|
|
202
211
|
}
|
|
203
212
|
|
|
204
213
|
},
|
|
205
|
-
getAthletesByIds : async(athlete_ids:string[]) => {
|
|
214
|
+
getAthletesByIds : async(athlete_ids:string[]):Promise<AthleteProps[]> => {
|
|
206
215
|
try {
|
|
207
216
|
if(athlete_ids.length == 0){ return [] }
|
|
208
217
|
const resp = await axios.post(`${EVENT_SVC_API}/v1/athletes/bulk/get`, { attribute: 'athlete_id', values: athlete_ids })
|
|
@@ -238,13 +247,12 @@ const MarketComponentApi = {
|
|
|
238
247
|
return []
|
|
239
248
|
}
|
|
240
249
|
},
|
|
241
|
-
getBestAvailableOrders:async():Promise<BestAvailableResponseProps
|
|
250
|
+
getBestAvailableOrders:async():Promise<BestAvailableResponseProps> => {
|
|
242
251
|
try {
|
|
243
252
|
const resp = await axios.get(`${MK_SVC_API}/v1/orders/available`);
|
|
244
253
|
return resp.data
|
|
245
254
|
} catch (e) {
|
|
246
|
-
|
|
247
|
-
return undefined
|
|
255
|
+
return { events: [], tournaments: [], matches: [] }
|
|
248
256
|
}
|
|
249
257
|
},
|
|
250
258
|
getAthletesByTeamId: async(team_id:string):Promise<AthleteProps[]> => {
|
|
@@ -317,6 +325,104 @@ const MarketComponentHelpers = {
|
|
|
317
325
|
return earningsMultiplyer * amt
|
|
318
326
|
}
|
|
319
327
|
},
|
|
328
|
+
getMissingTournaments:(matches:MatchProps[], tournaments:TournamentProps[]) => {
|
|
329
|
+
let needed_tourneys:string[] = []
|
|
330
|
+
matches.map(m => {
|
|
331
|
+
let tourney = tournaments.find(t => t.tournament_id == m.tournament_id);
|
|
332
|
+
if(!tourney){ needed_tourneys.push(m.tournament_id) }
|
|
333
|
+
})
|
|
334
|
+
return needed_tourneys
|
|
335
|
+
},
|
|
336
|
+
extractAthleteIds: (athlete_ids?:string):string[] => {
|
|
337
|
+
if(!athlete_ids || athlete_ids == 'undefined'){ return [] }
|
|
338
|
+
let split_ids = athlete_ids.split(',');
|
|
339
|
+
let ath_ids:string[] = []
|
|
340
|
+
split_ids.map(id => {
|
|
341
|
+
if(isNaN(parseInt(id))){ return }
|
|
342
|
+
return ath_ids.push(id)
|
|
343
|
+
});
|
|
344
|
+
return ath_ids
|
|
345
|
+
},
|
|
346
|
+
formatBestAvailable:(ba_response:{ events:EventProps[], tournaments:TournamentProps[], matches:MatchProps[] }) => {
|
|
347
|
+
let best_available:{ [key:string]: BestAvailableOrderProps[] } = {}
|
|
348
|
+
let order_stats: { [key:string]: EventOrderStatProps[] } = {}
|
|
349
|
+
let latest_trades: { [key:string]: TradeProps[] } = {}
|
|
350
|
+
let athlete_ids:string[] = []
|
|
351
|
+
let team_ids: string[] = []
|
|
352
|
+
|
|
353
|
+
ba_response.events.map((e:EventProps) => {
|
|
354
|
+
if(!e.supported_markets){ return }
|
|
355
|
+
let ao:BestAvailableOrderProps[] = [], os:EventOrderStatProps[] = [], lt:TradeProps[] = []
|
|
356
|
+
let supported_markets = e.supported_markets.filter(m => m)
|
|
357
|
+
|
|
358
|
+
supported_markets.map(m => {
|
|
359
|
+
m.available_orders?.map(o => ao.push(o))
|
|
360
|
+
m.order_stats?.map(s => os.push(s))
|
|
361
|
+
m.latest_trades?.map(t => {
|
|
362
|
+
if(t.side_type == 'athlete'){ athlete_ids.push(t.side_id) }
|
|
363
|
+
lt.push(t)
|
|
364
|
+
})
|
|
365
|
+
});
|
|
366
|
+
best_available[`team:${e.event_id}`] = ao
|
|
367
|
+
order_stats[`team:${e.event_id}`] = os
|
|
368
|
+
latest_trades[`team:${e.event_id}`] = lt
|
|
369
|
+
})
|
|
370
|
+
ba_response.tournaments.map((e:TournamentProps) => {
|
|
371
|
+
if(!e.supported_markets){ return }
|
|
372
|
+
let ao:BestAvailableOrderProps[] = [], os:EventOrderStatProps[] = [], lt:TradeProps[] = []
|
|
373
|
+
let supported_markets = e.supported_markets.filter(m => m)
|
|
374
|
+
supported_markets.map(m => {
|
|
375
|
+
m.available_orders?.map(o => ao.push(o))
|
|
376
|
+
m.order_stats?.map(s => os.push(s))
|
|
377
|
+
m.latest_trades?.map(t => {
|
|
378
|
+
if(t.side_type == 'athlete'){ athlete_ids.push(t.side_id) }
|
|
379
|
+
lt.push(t)
|
|
380
|
+
})
|
|
381
|
+
});
|
|
382
|
+
best_available[`tournament:${e.tournament_id}`] = ao
|
|
383
|
+
order_stats[`tournament:${e.tournament_id}`] = os
|
|
384
|
+
latest_trades[`tournament:${e.tournament_id}`] = lt
|
|
385
|
+
|
|
386
|
+
})
|
|
387
|
+
ba_response.matches.map((e:MatchProps) => {
|
|
388
|
+
if(!e.supported_markets){ return }
|
|
389
|
+
if(e.participant_type == 'athlete'){ athlete_ids = athlete_ids.concat(e.participants) }
|
|
390
|
+
let ao:BestAvailableOrderProps[] = [], os:EventOrderStatProps[] = [], lt:TradeProps[] = []
|
|
391
|
+
let supported_markets = e.supported_markets.filter(m => m)
|
|
392
|
+
supported_markets.map(m => {
|
|
393
|
+
|
|
394
|
+
m.available_orders?.map(o => ao.push(o))
|
|
395
|
+
m.order_stats?.map(s => os.push(s))
|
|
396
|
+
m.latest_trades?.map(t => lt.push(t))
|
|
397
|
+
});
|
|
398
|
+
best_available[`match:${e.match_id}`] = ao
|
|
399
|
+
order_stats[`match:${e.match_id}`] = os
|
|
400
|
+
latest_trades[`match:${e.match_id}`] = lt
|
|
401
|
+
|
|
402
|
+
let existing_tournament = order_stats[`tournament:${e.tournament_id}`]
|
|
403
|
+
if(!existing_tournament){
|
|
404
|
+
order_stats[`tournament:${e.tournament_id}`] = os
|
|
405
|
+
} else {
|
|
406
|
+
order_stats[`tournament:${e.tournament_id}`] = existing_tournament.concat(os)
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
let existing_tournament_trades = latest_trades[`tournament:${e.tournament_id}`]
|
|
410
|
+
if(!existing_tournament_trades){
|
|
411
|
+
latest_trades[`tournament:${e.tournament_id}`] = lt
|
|
412
|
+
} else {
|
|
413
|
+
latest_trades[`tournament:${e.tournament_id}`] = existing_tournament_trades.concat(lt)
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
let existing_tournament_orders = best_available[`tournament:${e.tournament_id}`]
|
|
417
|
+
if(!existing_tournament_orders){
|
|
418
|
+
best_available[`tournament:${e.tournament_id}`] = ao
|
|
419
|
+
} else {
|
|
420
|
+
best_available[`tournament:${e.tournament_id}`] = existing_tournament_orders.concat(ao)
|
|
421
|
+
}
|
|
422
|
+
})
|
|
423
|
+
athlete_ids = [ ...new Set(athlete_ids.map(id => id)) ]
|
|
424
|
+
return { best_available, order_stats, latest_trades, athlete_ids, team_ids }
|
|
425
|
+
},
|
|
320
426
|
getOrdersFromTrade:(trade:TradeProps, orders:OrderProps[]) => {
|
|
321
427
|
if(trade.position_ids.length == 0){ return { found_orders:[], found_positions: [] } }
|
|
322
428
|
let found_orders:OrderProps[] = []
|
|
@@ -66,13 +66,12 @@ const AthleteMarket = ({ event, show_event, float, hide_image, direction, league
|
|
|
66
66
|
</View>
|
|
67
67
|
)
|
|
68
68
|
},[athlete.athlete_id, is_locked, market.market_id, JSON.stringify(event_order_stats), JSON.stringify(best_available_orders)])
|
|
69
|
-
|
|
70
69
|
return (
|
|
71
70
|
<View float={float} style={[{ borderRadius:8 }, style]}>
|
|
72
71
|
{!hide_stat_banner ?
|
|
73
72
|
<LinearDiagnal
|
|
74
73
|
label={market.stat_label ?? market.type}
|
|
75
|
-
label_size={
|
|
74
|
+
label_size={12}
|
|
76
75
|
style={{ borderTopLeftRadius:8, padding:5 }}
|
|
77
76
|
left_color={Colors.incentive.gold}
|
|
78
77
|
right_color={'#ebd197'}
|
|
@@ -98,7 +97,7 @@ const AthleteMarket = ({ event, show_event, float, hide_image, direction, league
|
|
|
98
97
|
<Text style={{ marginTop:3 }} theme='description' textAlign='center' size={12}>{athlete.team?`${athlete.team.abbr}`:''} ({athlete.position})</Text>
|
|
99
98
|
</View>
|
|
100
99
|
</View>
|
|
101
|
-
<View nativeID='market_sides' style={{ flexDirection:'row', flexGrow:1, justifyContent:'flex-end', alignItems:'center', padding:10 }}>
|
|
100
|
+
<View nativeID='market_sides' style={{ flexDirection:'row', flexGrow:1, justifyContent:direction=='vertical'?'center':'flex-end', alignItems:'center', padding:10 }}>
|
|
102
101
|
{market.side_options.sort((a,b) => {
|
|
103
102
|
let a_t = a.side == market.trade_side ? 1 : 0
|
|
104
103
|
let b_t = b.side == market.trade_side ? 1 : 0
|
|
@@ -20,7 +20,33 @@ const TeamEventMarketHelpers = {
|
|
|
20
20
|
sortNonPrimaryMarkets: (markets:MarketProps[], event_order_stats:EventOrderStatProps[], latest_trades:TradeProps[]) => {
|
|
21
21
|
let available = latest_trades.find(t => markets.map(m => m.market_id.toString()).includes(t.market_id)) ? true : false
|
|
22
22
|
let sorted_stats = event_order_stats.filter(s => s.market_type == 'FOR_MONEY' && markets.map(m => m.market_id.toString()).includes(s.market_id.toString()));
|
|
23
|
-
|
|
23
|
+
//How do we also just grab the top level markets from latest trades if there is no volume on it?
|
|
24
|
+
let sorted_athlete_trades = latest_trades.filter(t => t.market_type == 'FOR_MONEY' && t.side_type == 'athlete' && markets.map(m => m.market_id.toString()).includes(t.market_id.toString()));
|
|
25
|
+
//For each market ID - lets create a sorted stat that has 0 in liquidity
|
|
26
|
+
let unique_traded_markets = [ ...new Set(sorted_athlete_trades.map(t => t.market_id)) ]
|
|
27
|
+
//Ok we have unique markets!
|
|
28
|
+
//Lets map through the markets and find the top 3 var_1s of each market!
|
|
29
|
+
unique_traded_markets.map(m => {
|
|
30
|
+
//Find the top 3 markets
|
|
31
|
+
let athlete_trades = sorted_athlete_trades.filter(t => t.market_id == m).sort((a,b) => b.var_1 - a.var_1).slice(0, 3);
|
|
32
|
+
athlete_trades.map(t => {
|
|
33
|
+
let exists = sorted_stats.find(ss => ss.side_id == t.side_id && ss.side_type == t.side_type && ss.market_id == ss.market_id);
|
|
34
|
+
if(exists){ return } //We already have this!
|
|
35
|
+
//Now lets create a new event order stat
|
|
36
|
+
let new_order_stat:EventOrderStatProps = {
|
|
37
|
+
event_id: t.event_id,
|
|
38
|
+
event_type: t.event_type,
|
|
39
|
+
market_id: t.market_id,
|
|
40
|
+
side_type: t.side_type,
|
|
41
|
+
side_id: t.side_id,
|
|
42
|
+
market_type: t.market_type,
|
|
43
|
+
open_order_amount:0,
|
|
44
|
+
open_order_count:0
|
|
45
|
+
}
|
|
46
|
+
sorted_stats = sorted_stats.concat(new_order_stat)
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
|
|
24
50
|
//Now need to combine event level markets
|
|
25
51
|
let event_level_markets:EventOrderStatProps[] = []
|
|
26
52
|
let non_event_level_markets:EventOrderStatProps[] = []
|
|
@@ -45,6 +45,7 @@ type TeamEventMarketProps = {
|
|
|
45
45
|
onShare?:(event:EventProps) => void,
|
|
46
46
|
onPodcastSelect?:(podcast:PodcastProps) => void,
|
|
47
47
|
show_grades?:boolean,
|
|
48
|
+
hide_non_primary?:boolean,
|
|
48
49
|
onCompetitionSelect:(competition_id:string) => void,
|
|
49
50
|
onSquaresSelect: (sq_comp_id:string) => void,
|
|
50
51
|
onViewAdditionalMarkets: (event_id:string, event_type:string) => void,
|
|
@@ -52,7 +53,7 @@ type TeamEventMarketProps = {
|
|
|
52
53
|
onActivate?:(event_id:string, event_type:string) => void
|
|
53
54
|
activate_loading?:boolean
|
|
54
55
|
}
|
|
55
|
-
const TeamEventMarket = ({ event, league, float, style, init_expanded, hot_markets_direction, show_id, hide_liquidity, show_podcasts, activate_loading, competitions, squares_competitions, show_grades, markets, latest_trades, best_available_orders, event_order_stats, default_price_view, onTeamSelect, onSquaresSelect, onCompetitionSelect, onExpand, onOrder, onViewMarketStats, onView, onViewAdditionalMarkets, onTradeLongPress, onTVSelect, onActivate, onEvent, onShare, onPodcastSelect }:TeamEventMarketProps) => {
|
|
56
|
+
const TeamEventMarket = ({ event, hide_non_primary, league, float, style, init_expanded, hot_markets_direction, show_id, hide_liquidity, show_podcasts, activate_loading, competitions, squares_competitions, show_grades, markets, latest_trades, best_available_orders, event_order_stats, default_price_view, onTeamSelect, onSquaresSelect, onCompetitionSelect, onExpand, onOrder, onViewMarketStats, onView, onViewAdditionalMarkets, onTradeLongPress, onTVSelect, onActivate, onEvent, onShare, onPodcastSelect }:TeamEventMarketProps) => {
|
|
56
57
|
const C = useColors();
|
|
57
58
|
const [ market_width, setMarketWidth ] = useState(180);
|
|
58
59
|
const [ expanded_data, setExpandedData ] = useState<{
|
|
@@ -331,7 +332,6 @@ const TeamEventMarket = ({ event, league, float, style, init_expanded, hot_marke
|
|
|
331
332
|
|
|
332
333
|
const { liquidity, open_order_count } = useMemo(() => MarketComponentHelpers.getLiqudity(event_order_stats),[JSON.stringify(event_order_stats)])
|
|
333
334
|
const { non_primary_markets, available } = useMemo(() => TeamEventMarketHelpers.sortNonPrimaryMarkets(TeamEventMarketHelpers.getNonPrimaryMarkets(event, markets), event_order_stats, latest_trades),[JSON.stringify(event_order_stats), JSON.stringify(latest_trades), markets.length, event.last_update_datetime])
|
|
334
|
-
|
|
335
335
|
const tv_link = event.info?.broadcast?.link && onTVSelect ? event.info?.broadcast?.link : undefined
|
|
336
336
|
return (
|
|
337
337
|
<View ref={ref} float={float} style={[style]}>
|
|
@@ -596,7 +596,7 @@ const TeamEventMarket = ({ event, league, float, style, init_expanded, hot_marke
|
|
|
596
596
|
<Text style={{ marginLeft:5 }} size={14} color={C.text.white} weight='semibold'>MultiPick</Text>
|
|
597
597
|
</Button>
|
|
598
598
|
:<></>}
|
|
599
|
-
{non_primary_markets.length > 0 ?
|
|
599
|
+
{non_primary_markets.length > 0 && !hide_non_primary ?
|
|
600
600
|
<Button
|
|
601
601
|
float
|
|
602
602
|
style={{ height:35, width:35, justifyContent:'center', borderRadius:100, alignItems:'center' }}
|
|
@@ -604,7 +604,7 @@ const TeamEventMarket = ({ event, league, float, style, init_expanded, hot_marke
|
|
|
604
604
|
>
|
|
605
605
|
<Icons.ChevronIcon direction={expanded ? 'up' : 'down'} size={8} color={C.text.h1} />
|
|
606
606
|
</Button>
|
|
607
|
-
:available && !expanded ?
|
|
607
|
+
:available && !expanded && !hide_non_primary ?
|
|
608
608
|
<Button
|
|
609
609
|
title='MORE'
|
|
610
610
|
type='info'
|
|
@@ -236,7 +236,7 @@ const ProfileWizard = ({ player, view_mode, settings, player_settings, insets,
|
|
|
236
236
|
const renderLevels = (data: { item: ProfileLevelProps, index:number}) => {
|
|
237
237
|
if(hidden_levels && hidden_levels.includes(data.item.identifier)){ return <></> }
|
|
238
238
|
return (
|
|
239
|
-
<Button style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomWidth:1, borderBottomColor:C.borders.light }} onPress={() => {
|
|
239
|
+
<Button style={{ flexDirection:'row', alignItems:'center', padding:10, borderRadius:0, borderBottomWidth:1, borderBottomColor:C.borders.light }} onPress={() => {
|
|
240
240
|
setActiveLevel(data.item)
|
|
241
241
|
setActiveStep(data.item.profile_steps[0])
|
|
242
242
|
}}>
|
|
@@ -632,141 +632,4 @@ const ProfileWizard = ({ player, view_mode, settings, player_settings, insets,
|
|
|
632
632
|
)
|
|
633
633
|
}
|
|
634
634
|
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
export default ProfileWizard
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
/*
|
|
641
|
-
{!active_level && !show_code_request ?
|
|
642
|
-
<View transparent style={{ flex:1 }}>
|
|
643
|
-
<View style={{ flex:1 }}>
|
|
644
|
-
<FlatList
|
|
645
|
-
data={groups}
|
|
646
|
-
renderItem={renderGroups}
|
|
647
|
-
keyExtractor={(item) => item.key}
|
|
648
|
-
/>
|
|
649
|
-
</View>
|
|
650
|
-
{!hide_powered_by ?
|
|
651
|
-
<TouchableOpacity style={{ justifyContent:'center', alignItems:'center' }}
|
|
652
|
-
onPress={() => {
|
|
653
|
-
Linking.openURL(`https://app.bettoredge.com`)
|
|
654
|
-
}}>
|
|
655
|
-
<Image
|
|
656
|
-
source={{ uri: 'https://res.cloudinary.com/hoabts6mc/image/upload/v1715272520/powered_be_be_irnaka.webp' }}
|
|
657
|
-
style={{ width: width * 0.6, height: (width*0.6) / 3 }}
|
|
658
|
-
resizeMode='center'
|
|
659
|
-
/>
|
|
660
|
-
</TouchableOpacity>
|
|
661
|
-
:<></>}
|
|
662
|
-
<View style={{flexDirection:'row', padding:10}}>
|
|
663
|
-
<Button
|
|
664
|
-
title='CLOSE'
|
|
665
|
-
style={{ flex:3, marginLeft:5 }}
|
|
666
|
-
type='close'
|
|
667
|
-
onPress={() => onClose()}
|
|
668
|
-
/>
|
|
669
|
-
<Button
|
|
670
|
-
onPress={() => setShowLogout(true)}
|
|
671
|
-
type='error'
|
|
672
|
-
style={{ marginLeft:20 }}
|
|
673
|
-
>
|
|
674
|
-
<Icons.LogoutIcon color={C.text.h1} size={20}/>
|
|
675
|
-
</Button>
|
|
676
|
-
</View>
|
|
677
|
-
{show_logout ?
|
|
678
|
-
<View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, justifyContent:'center', alignItems:'center' }}>
|
|
679
|
-
<View float style={{ padding:10, borderRadius:22, minWidth:250 }}>
|
|
680
|
-
<Text style={{ padding:15 }} size={18} theme='h1' textAlign='center'>ARE YOU SURE?</Text>
|
|
681
|
-
<View transparent style={{ flexDirection:'row', padding:10 }}>
|
|
682
|
-
<Button
|
|
683
|
-
title='NO'
|
|
684
|
-
style={{ flex:1, marginRight:3 }}
|
|
685
|
-
type='close'
|
|
686
|
-
onPress={() => setShowLogout(false)}
|
|
687
|
-
/>
|
|
688
|
-
<Button
|
|
689
|
-
title='YES - LOGOUT'
|
|
690
|
-
style={{ flex:3, marginLeft:3 }}
|
|
691
|
-
type='error'
|
|
692
|
-
onPress={onLogout}
|
|
693
|
-
/>
|
|
694
|
-
</View>
|
|
695
|
-
</View>
|
|
696
|
-
</View>
|
|
697
|
-
:<></>}
|
|
698
|
-
</View>
|
|
699
|
-
:
|
|
700
|
-
<View style={{ flex:1 }}>
|
|
701
|
-
{!walkthrough && active_level ?
|
|
702
|
-
<TouchableOpacity style={{ flexDirection:'row', alignItems:'center', padding:10, borderTopWidth:2, borderColor:C.borders.light}} onPress={() => {
|
|
703
|
-
setActiveLevel(undefined)
|
|
704
|
-
setActiveStep(undefined)
|
|
705
|
-
}}>
|
|
706
|
-
<Icons.ChevronIcon direction='left' size={10} color={C.text.h1} />
|
|
707
|
-
<View style={{ flex:1, marginLeft:20, marginRight:20 }}>
|
|
708
|
-
<Text theme='h1'>{active_level.label}</Text>
|
|
709
|
-
<Text style={{ marginTop:3 }} theme='h2'>{active_level.description}</Text>
|
|
710
|
-
</View>
|
|
711
|
-
{active_level.pct_complete ?
|
|
712
|
-
<View>
|
|
713
|
-
<Text theme='description'>{(active_level.pct_complete*100).toFixed()}%</Text>
|
|
714
|
-
</View>
|
|
715
|
-
:<></>}
|
|
716
|
-
</TouchableOpacity>
|
|
717
|
-
:<></>}
|
|
718
|
-
<View transparent style={{ borderWidth:1, borderColor:Colors.shades.shade600, borderRadius:22, margin:10 }}>
|
|
719
|
-
<FlatList
|
|
720
|
-
data={active_level?.profile_steps}
|
|
721
|
-
renderItem={renderSteps}
|
|
722
|
-
horizontal
|
|
723
|
-
showsHorizontalScrollIndicator={false}
|
|
724
|
-
keyExtractor={(item) => item.check}
|
|
725
|
-
/>
|
|
726
|
-
{walkthrough == 'verify' && code_details.code_request && code_details.promo ?
|
|
727
|
-
<View style={{ position:'absolute', right:-4, top:0, bottom:0, justifyContent:'center', alignItems:'center' }}>
|
|
728
|
-
<View style={{ height:30, width:30, backgroundColor:Colors.shades.white, borderRadius:100, justifyContent:'center', alignItems:'center', ...view_styles.float }}>
|
|
729
|
-
<Icons.GiftIcon size={18} color={Colors.incentive.gold}/>
|
|
730
|
-
</View>
|
|
731
|
-
</View>
|
|
732
|
-
:<></>}
|
|
733
|
-
</View>
|
|
734
|
-
|
|
735
|
-
</View>
|
|
736
|
-
}
|
|
737
|
-
*/
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
/*
|
|
742
|
-
<View style={{ flex:1 }}>
|
|
743
|
-
{!active_step && show_code_request ?
|
|
744
|
-
CODE REDEEM
|
|
745
|
-
:<></>}
|
|
746
|
-
{!active_step && show_welcome && !welcome_hidden && !show_code_request?
|
|
747
|
-
WELCOME
|
|
748
|
-
:active_step?.check == 'basic' ?
|
|
749
|
-
BASIC INFO
|
|
750
|
-
:active_step?.check == 'profile_pic'?
|
|
751
|
-
PROFILE PIC
|
|
752
|
-
:active_step?.check == 'password' ?
|
|
753
|
-
PASSWORD
|
|
754
|
-
:active_step?.check == 'email' ?
|
|
755
|
-
EMAIL
|
|
756
|
-
:active_step?.check == 'phone' ?
|
|
757
|
-
PHONE
|
|
758
|
-
:active_step?.check == 'basic_review' ?
|
|
759
|
-
BASIC STATUS
|
|
760
|
-
:active_step?.check == 'dob' ?
|
|
761
|
-
DOB
|
|
762
|
-
:active_step?.check == 'vouch' ?
|
|
763
|
-
VOUCH
|
|
764
|
-
:active_step?.check == 'notification' ?
|
|
765
|
-
SETTINGS
|
|
766
|
-
:active_step?.check == 'preferences' ?
|
|
767
|
-
PREFERENCES
|
|
768
|
-
:active_step?.check == 'sharing' ?
|
|
769
|
-
SHARING
|
|
770
|
-
:<></>}
|
|
771
|
-
</View>
|
|
772
|
-
*/
|
|
635
|
+
export default ProfileWizard
|
|
@@ -10,8 +10,10 @@ import { Text, View } from '../Components/Themed';
|
|
|
10
10
|
type ProfileOverviewProps = {
|
|
11
11
|
show_welcome?:boolean,
|
|
12
12
|
hide_powered_by?:boolean,
|
|
13
|
+
float?:boolean,
|
|
13
14
|
hide_profile_header?:boolean,
|
|
14
15
|
player?:MyPlayerProps,
|
|
16
|
+
style?:any,
|
|
15
17
|
keyboard_height:number,
|
|
16
18
|
hidden_groups?:string[],
|
|
17
19
|
insets?:{ top:number, bottom:number, left:number, right:number }
|
|
@@ -37,7 +39,7 @@ type ProfileOverviewProps = {
|
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
|
|
40
|
-
const ProfileManager = ({ profile_attribute, keyboard_height, view_mode, hide_profile_header, insets, player, hide_powered_by, onRedeemCode, onPlayerUpdate, onNextStep, onFocusPosition, onVouchStart, show_welcome, hidden_groups, hidden_steps, hidden_levels, walkthrough, onClose, onLogout }: ProfileOverviewProps ) => {
|
|
42
|
+
const ProfileManager = ({ float, profile_attribute, style, keyboard_height, view_mode, hide_profile_header, insets, player, hide_powered_by, onRedeemCode, onPlayerUpdate, onNextStep, onFocusPosition, onVouchStart, show_welcome, hidden_groups, hidden_steps, hidden_levels, walkthrough, onClose, onLogout }: ProfileOverviewProps ) => {
|
|
41
43
|
const [ width, setModuleWidth ] = useState(400);
|
|
42
44
|
const [ loading, setLoading ] = useState(false);
|
|
43
45
|
const [ vouching, setVouching ] = useState(false);
|
|
@@ -89,26 +91,26 @@ const ProfileManager = ({ profile_attribute, keyboard_height, view_mode, hide_pr
|
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
return (
|
|
92
|
-
<View style={{ flex:1 }}
|
|
94
|
+
<View float={float} style={{ flex:1 }}>
|
|
95
|
+
<View style={{ flex:1, ...style }} onLayout={(ev) => {
|
|
93
96
|
const { width } = ev.nativeEvent.layout
|
|
94
97
|
setModuleWidth(width)
|
|
95
98
|
}}>
|
|
96
|
-
<View style={{ flex:1 }}>
|
|
97
99
|
{!hide_profile_header && !walkthrough && !vouching ?
|
|
98
|
-
<View style={{ flexDirection:'row', alignItems:'center' }}>
|
|
99
|
-
<View nativeID='profile_picture' style={{ padding:10 }}>
|
|
100
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', borderTopRightRadius:8, borderTopLeftRadius:8 }}>
|
|
101
|
+
<View transparent nativeID='profile_picture' style={{ padding:10 }}>
|
|
100
102
|
<Image
|
|
101
103
|
source={{ uri: draft_player.profile_pic }}
|
|
102
104
|
style={{ height:50, width:50, borderRadius:100 }}
|
|
103
105
|
resizeMode='cover'
|
|
104
106
|
/>
|
|
105
107
|
</View>
|
|
106
|
-
<View style={{ flex:1 }}>
|
|
108
|
+
<View transparent style={{ flex:1 }}>
|
|
107
109
|
<Text size={20} theme='h1'>{draft_player.first_name} {draft_player.last_name}</Text>
|
|
108
110
|
<Text style={{ marginTop:5 }} size={16} theme='h2'>@{draft_player.username}</Text>
|
|
109
111
|
</View>
|
|
110
112
|
{player_balance ?
|
|
111
|
-
<View style={{ paddingRight:10 }}>
|
|
113
|
+
<View transparent style={{ paddingRight:10 }}>
|
|
112
114
|
<Text size={16} theme='h1' textAlign='right'>${player_balance.balance.toFixed(2)}</Text>
|
|
113
115
|
<Text style={{ marginTop:3 }} theme='description' textAlign='right'>Promo {player_balance.promo_balance.toFixed(2)}</Text>
|
|
114
116
|
</View>
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { Image } from 'react-native';
|
|
3
|
-
import type { AthleteProps, LeagueProps, OrderProps, PublicPlayerProps, TeamProps } from '../types';
|
|
3
|
+
import type { AthleteProps, LeagueProps, MyPlayerProps, OrderProps, PublicPlayerProps, TeamProps } from '../types';
|
|
4
4
|
import { Icons } from '../Components';
|
|
5
5
|
import { SocialComponentApi, SocialOrderHelpers } from './api';
|
|
6
6
|
import moment from 'moment-mini';
|
|
7
7
|
import { AthleteImage } from '../Components/Jerseys';
|
|
8
8
|
import { View, Button, Text } from '../Components/Themed';
|
|
9
9
|
import { useColors } from '../constants/useColors';
|
|
10
|
+
import { MyOrdersHelpers } from '../MarketComponents/components/MyOrderList/api';
|
|
10
11
|
|
|
11
12
|
type SocialOrderCardProps = {
|
|
12
|
-
player?:PublicPlayerProps,
|
|
13
|
+
player?:PublicPlayerProps | MyPlayerProps,
|
|
13
14
|
show_player?:boolean,
|
|
14
15
|
contest_title:string,
|
|
15
16
|
contest_time:string,
|
|
17
|
+
show_amounts?:boolean,
|
|
16
18
|
order:OrderProps,
|
|
17
19
|
athlete?:AthleteProps,
|
|
18
20
|
maxWidth?:number,
|
|
@@ -23,10 +25,12 @@ type SocialOrderCardProps = {
|
|
|
23
25
|
onCopyOrder?:(order:OrderProps) => void,
|
|
24
26
|
onFadeOrder?:(order:OrderProps) => void
|
|
25
27
|
}
|
|
26
|
-
const SocialOrderCard = ({ player, show_player, hide_contest, maxWidth, league, team, athlete, order, contest_title, contest_time, onTagOrder, onCopyOrder, onFadeOrder }:SocialOrderCardProps) => {
|
|
28
|
+
const SocialOrderCard = ({ player, show_player, show_amounts, hide_contest, maxWidth, league, team, athlete, order, contest_title, contest_time, onTagOrder, onCopyOrder, onFadeOrder }:SocialOrderCardProps) => {
|
|
27
29
|
const Colors = useColors();
|
|
28
30
|
const [ fade_loading, setFadeLoading ] = useState(false);
|
|
31
|
+
const cl = order.market_type == 'FOR_MONEY' ? '$' : 'E'
|
|
29
32
|
const { result_label, color } = SocialOrderHelpers.getResultDetails(order)
|
|
33
|
+
const stats = MyOrdersHelpers.calcAllOrderStats([order])
|
|
30
34
|
const handleFadeOrder = async() => {
|
|
31
35
|
if(!onFadeOrder){ return }
|
|
32
36
|
if(fade_loading){ return }
|
|
@@ -111,6 +115,23 @@ const SocialOrderCard = ({ player, show_player, hide_contest, maxWidth, league,
|
|
|
111
115
|
</View>
|
|
112
116
|
</View>
|
|
113
117
|
</View>
|
|
118
|
+
{show_amounts && order.resolution_status == 'inprogress'?
|
|
119
|
+
<View type='footer' style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomRightRadius:8, borderBottomLeftRadius:8 }}>
|
|
120
|
+
<View transparent style={{ flex:1 }}>
|
|
121
|
+
<Text theme='h2' textAlign='left'>{cl}{stats.unresolved_stake.toFixed(2)}</Text>
|
|
122
|
+
</View>
|
|
123
|
+
<Text theme='description'>To Win</Text>
|
|
124
|
+
<View transparent style={{ flex:1 }}>
|
|
125
|
+
<Text theme='h1' textAlign='right'>{cl}{stats.unresolved_potential_winnings.toFixed(2)}</Text>
|
|
126
|
+
</View>
|
|
127
|
+
</View>
|
|
128
|
+
:show_amounts && order.resolution_status == 'closed' ?
|
|
129
|
+
<View type='footer' style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomRightRadius:8, borderBottomLeftRadius:8 }}>
|
|
130
|
+
<View transparent style={{ flex:1 }}>
|
|
131
|
+
<Text theme='h1' textAlign='right' color={stats.net_earnings > 0 ? Colors.text.success : Colors.text.error}>Earned: {cl}{stats.net_earnings.toFixed(2)}</Text>
|
|
132
|
+
</View>
|
|
133
|
+
</View>
|
|
134
|
+
:<></>}
|
|
114
135
|
{order.resolution_status == 'inprogress' ?
|
|
115
136
|
<View type='row' style={{ padding:0, borderBottomLeftRadius:8, borderBottomRightRadius:8 }}>
|
|
116
137
|
{onCopyOrder ?
|