be-components 6.0.4 → 6.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/MatchMarket/api/index.js +17 -0
- package/lib/commonjs/MarketComponents/components/MatchMarket/api/index.js.map +1 -0
- package/lib/commonjs/MarketComponents/components/MatchMarket/index.js +44 -1
- package/lib/commonjs/MarketComponents/components/MatchMarket/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/TeamEventMarket/api/index.js +34 -0
- package/lib/commonjs/MarketComponents/components/TeamEventMarket/api/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js +45 -3
- package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/TournamentMarket/api/index.js +15 -0
- package/lib/commonjs/MarketComponents/components/TournamentMarket/api/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/TournamentMarket/index.js +42 -1
- package/lib/commonjs/MarketComponents/components/TournamentMarket/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/MatchMarket/api/index.js +10 -0
- package/lib/module/MarketComponents/components/MatchMarket/api/index.js.map +1 -0
- package/lib/module/MarketComponents/components/MatchMarket/index.js +44 -1
- package/lib/module/MarketComponents/components/MatchMarket/index.js.map +1 -1
- package/lib/module/MarketComponents/components/TeamEventMarket/api/index.js +34 -0
- package/lib/module/MarketComponents/components/TeamEventMarket/api/index.js.map +1 -1
- package/lib/module/MarketComponents/components/TeamEventMarket/index.js +45 -3
- package/lib/module/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
- package/lib/module/MarketComponents/components/TournamentMarket/api/index.js +15 -0
- package/lib/module/MarketComponents/components/TournamentMarket/api/index.js.map +1 -1
- package/lib/module/MarketComponents/components/TournamentMarket/index.js +42 -1
- package/lib/module/MarketComponents/components/TournamentMarket/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/MatchMarket/api/index.d.ts +5 -0
- package/lib/typescript/lib/commonjs/MarketComponents/components/MatchMarket/api/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/MarketComponents/components/TeamEventMarket/api/index.d.ts +1 -0
- package/lib/typescript/lib/commonjs/MarketComponents/components/TeamEventMarket/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/MarketComponents/components/TournamentMarket/api/index.d.ts +1 -0
- package/lib/typescript/lib/commonjs/MarketComponents/components/TournamentMarket/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/MarketComponents/components/TournamentMarket/index.d.ts +3 -1
- package/lib/typescript/lib/commonjs/MarketComponents/components/TournamentMarket/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/MatchMarket/api/index.d.ts +4 -0
- package/lib/typescript/lib/module/MarketComponents/components/MatchMarket/api/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/MarketComponents/components/MatchMarket/index.d.ts +3 -1
- package/lib/typescript/lib/module/MarketComponents/components/MatchMarket/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/MarketComponents/components/TeamEventMarket/api/index.d.ts +1 -0
- 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 +4 -1
- package/lib/typescript/lib/module/MarketComponents/components/TeamEventMarket/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/MarketComponents/components/TournamentMarket/api/index.d.ts +1 -0
- package/lib/typescript/lib/module/MarketComponents/components/TournamentMarket/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/MarketComponents/components/TournamentMarket/index.d.ts +3 -1
- package/lib/typescript/lib/module/MarketComponents/components/TournamentMarket/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/MatchMarket/api/index.d.ts +5 -0
- package/lib/typescript/src/MarketComponents/components/MatchMarket/api/index.d.ts.map +1 -0
- package/lib/typescript/src/MarketComponents/components/MatchMarket/index.d.ts +4 -2
- package/lib/typescript/src/MarketComponents/components/MatchMarket/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/components/TeamEventMarket/api/index.d.ts +2 -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 +5 -2
- package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/components/TournamentMarket/api/index.d.ts +2 -1
- package/lib/typescript/src/MarketComponents/components/TournamentMarket/api/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/components/TournamentMarket/index.d.ts +4 -2
- package/lib/typescript/src/MarketComponents/components/TournamentMarket/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/index.d.ts +10 -3
- 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/MatchMarket/api/index.ts +9 -0
- package/src/MarketComponents/components/MatchMarket/index.tsx +29 -2
- package/src/MarketComponents/components/TeamEventMarket/api/index.ts +32 -2
- package/src/MarketComponents/components/TeamEventMarket/index.tsx +31 -6
- package/src/MarketComponents/components/TournamentMarket/api/index.ts +14 -1
- package/src/MarketComponents/components/TournamentMarket/index.tsx +27 -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
package/src/Components/Icons.tsx
CHANGED
|
@@ -25,6 +25,22 @@ const AlertIcon = ({ color, size }:IconProps) => {
|
|
|
25
25
|
)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
const AthleteIcon = ({size, color}:IconProps) => {
|
|
29
|
+
const ratio = 0.7
|
|
30
|
+
const height = size ?? 30
|
|
31
|
+
const width = height * ratio
|
|
32
|
+
return (
|
|
33
|
+
<Svg width={`${width}px`} height={`${height}px`} viewBox="0 0 21 30">
|
|
34
|
+
<G id="Page-1" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
|
|
35
|
+
<G id="athlete-svgrepo-com" fill={color??Colors.brand.midnight} fillRule="nonzero">
|
|
36
|
+
<Path d="M10.4052437,14.8646046 C4.59485879,14.8646046 0,19.5973344 0,25.2698484 L0,28.8660949 C0,29.4922857 0.507655754,30 1.13390514,30 L19.6766409,30 C20.3028317,30 20.8105461,29.4923442 20.8105461,28.8660949 L20.8105461,25.2698484 C20.8105461,19.5349321 16.1428553,14.8646046 10.4052437,14.8646046 Z M9.49170948,17.1839188 C10.0969237,17.1164188 10.7031341,17.1147782 11.318778,17.1839188 L11.318778,18.8465734 C11.318778,19.3502448 10.9089737,19.7601077 10.4052437,19.7601077 C9.90151377,19.7601077 9.49170948,19.3503034 9.49170948,18.8465734 L9.49170948,17.1839188 Z M3.55839496,27.7321897 L2.26775169,27.7321897 C2.26775169,25.1453954 2.04491988,23.2271551 3.55833637,20.8766105 L3.55833637,27.7321897 L3.55839496,27.7321897 Z M14.9843994,27.7321897 L5.82620525,27.7321897 L5.82620525,18.5465737 C6.26360716,18.2477459 6.73136061,17.9902852 7.22401638,17.7802854 L7.22401638,18.8466906 C7.22401638,20.60081 8.65112436,22.0280351 10.4053609,22.0280351 C12.1595975,22.0280351 13.5867055,20.6009271 13.5867055,18.8466906 L13.5867055,17.7802854 C14.0793612,17.9903438 14.5471147,18.2477459 14.9845166,18.5465737 L14.9845166,27.7321897 L14.9843994,27.7321897 Z M18.542853,27.7321897 L17.2522683,27.7321897 L17.2522683,20.8766105 C18.7474622,23.1989129 18.542853,25.0730322 18.542853,27.7321897 Z" id="Shape"></Path>
|
|
37
|
+
<Path d="M3.76265258,4.82369646 C2.29177511,9.33347721 5.67515071,13.9701719 10.4053609,13.9701719 C15.1458836,13.9701719 18.5161343,9.32515691 17.0480107,4.82369646 C17.3922486,4.62904822 17.6249828,4.26031811 17.6249828,3.83662711 C17.6249828,3.21043632 17.117327,2.70272197 16.4910776,2.70272197 L15.9201993,2.70272197 C13.1156122,-0.901083103 7.69458233,-0.900731541 4.89028819,2.70272197 L4.31946844,2.70272197 C3.69327764,2.70272197 3.1855633,3.21037773 3.1855633,3.83662711 C3.1855633,4.26025951 3.41835604,4.62898962 3.76265258,4.82369646 Z M12.381316,2.70266338 L8.42917146,2.70266338 C9.65067417,2.13682409 11.0967665,2.10752724 12.381316,2.70266338 Z M6.14050182,4.97047366 L14.6701029,4.97047366 C16.1461366,8.08285344 13.8644396,11.7023616 10.4053023,11.7023616 C6.94657525,11.7023616 4.66429232,8.083205 6.14050182,4.97047366 Z" id="Shape"></Path>
|
|
38
|
+
</G>
|
|
39
|
+
</G>
|
|
40
|
+
</Svg>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
28
44
|
const LeaderboardIcon = ({ color, size }:IconProps) => {
|
|
29
45
|
return (
|
|
30
46
|
<Svg width={`${size??34}px`} height={`${size??34}px`} viewBox="0 0 34 34">
|
|
@@ -1606,6 +1622,7 @@ export default {
|
|
|
1606
1622
|
PauseIcon,
|
|
1607
1623
|
TransactionErrorIcon,
|
|
1608
1624
|
VisaCardIcon,
|
|
1625
|
+
AthleteIcon,
|
|
1609
1626
|
MasterCardIcon,
|
|
1610
1627
|
UnbidSquare
|
|
1611
1628
|
}
|
|
@@ -1,28 +1,68 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
2
2
|
import { Button, View } from "./Themed"
|
|
3
|
+
import { FlatList } from 'react-native';
|
|
4
|
+
import { useColors } from '../constants/useColors';
|
|
3
5
|
|
|
4
6
|
type PaginationProps = {
|
|
5
7
|
offset:number
|
|
6
8
|
style?:any,
|
|
9
|
+
pages?:number,
|
|
7
10
|
next_title?:string,
|
|
8
11
|
previous_title?:string,
|
|
9
12
|
onPrevious: () => void,
|
|
10
|
-
onNext: () => void
|
|
13
|
+
onNext: () => void,
|
|
14
|
+
onSelectPage?:(page:number) => void
|
|
11
15
|
}
|
|
12
16
|
|
|
13
|
-
const Pagination = ({ offset, onPrevious, onNext, next_title, previous_title, style }:PaginationProps) => {
|
|
17
|
+
const Pagination = ({ offset, pages, onPrevious, onNext, next_title, previous_title, style, onSelectPage }:PaginationProps) => {
|
|
18
|
+
const Colors = useColors();
|
|
19
|
+
const [ width, setWidth ] = useState(0);
|
|
20
|
+
let pagination_dots = useCallback(() => {
|
|
21
|
+
if(!pages){ return [] }
|
|
22
|
+
const arr = Array.from({ length: pages }, (_, i) => i);
|
|
23
|
+
return arr
|
|
24
|
+
},[pages]);
|
|
25
|
+
const page_dots = pagination_dots();
|
|
26
|
+
const renderDots = (data:{ item:number, index:number }) => {
|
|
27
|
+
const active = offset == data.item ? true : false
|
|
28
|
+
return (
|
|
29
|
+
<Button transparent disabled={!onSelectPage}
|
|
30
|
+
style={{ padding:10, width: width / page_dots.length, justifyContent:'center', alignItems:'center' }}
|
|
31
|
+
onPress={() => onSelectPage ? onSelectPage(data.item): console.log('')}>
|
|
32
|
+
<View style={{ height:active ? 10 : 8, width:active ? 10 : 8, borderRadius:100, backgroundColor:active ? Colors.text.action :Colors.text.h1, opacity: active? 1 : 0.8 }} />
|
|
33
|
+
</Button>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
14
36
|
|
|
15
37
|
return (
|
|
16
|
-
<View transparent style={{ flexDirection: 'row', alignItems:'center',
|
|
17
|
-
|
|
38
|
+
<View transparent style={{ flexDirection: 'row', alignItems:'center', ...style }}>
|
|
39
|
+
|
|
18
40
|
<Button
|
|
41
|
+
disabled={offset == 0}
|
|
42
|
+
style={{ opacity: offset == 0 ? 0.4: 1 }}
|
|
19
43
|
title={previous_title ?? 'PREV'}
|
|
20
44
|
type='text'
|
|
21
45
|
onPress={() => onPrevious()}
|
|
22
46
|
/>
|
|
23
|
-
|
|
47
|
+
|
|
48
|
+
<View transparent style={{ flex:1 }} onLayout={(ev) => {
|
|
49
|
+
const { width } = ev.nativeEvent.layout;
|
|
50
|
+
setWidth(width);
|
|
51
|
+
}}>
|
|
52
|
+
<FlatList
|
|
53
|
+
data={page_dots}
|
|
54
|
+
keyExtractor={(item) => item.toString()}
|
|
55
|
+
key={'pagination_dots'}
|
|
56
|
+
showsHorizontalScrollIndicator={false}
|
|
57
|
+
renderItem={renderDots}
|
|
58
|
+
horizontal
|
|
59
|
+
|
|
60
|
+
/>
|
|
61
|
+
</View>
|
|
24
62
|
<Button
|
|
25
63
|
title={next_title ?? 'NEXT'}
|
|
64
|
+
style={{ opacity: pages && pages == offset + 1 ? 0.4 : 1 }}
|
|
65
|
+
disabled={pages && pages == offset + 1 ? true : false}
|
|
26
66
|
type='text'
|
|
27
67
|
onPress={() => onNext()}
|
|
28
68
|
/>
|
|
@@ -31,6 +31,7 @@ const LocationApi = {
|
|
|
31
31
|
},
|
|
32
32
|
compareLastLocation: async(player_location:PlayerLocationProps):Promise<{ last_location?:PlayerLocationProps, distance:number }> => {
|
|
33
33
|
try {
|
|
34
|
+
console.log(SOCIAL_SVC_API)
|
|
34
35
|
if(Platform.OS != 'web'){ return { distance: 1000 } }
|
|
35
36
|
const resp = await axios.post(`${SOCIAL_SVC_API}/v1/locations/player/compare`, { player_location })
|
|
36
37
|
return { distance: resp.data.distance, last_location: resp.data.last_location }
|
|
@@ -138,6 +139,7 @@ const LocationHelpers = {
|
|
|
138
139
|
location: {
|
|
139
140
|
location_id: '',
|
|
140
141
|
label: region ?? 'UNKNOWN',
|
|
142
|
+
commission_pct: 0.015,
|
|
141
143
|
value: region ?? 'UNKNOWN',
|
|
142
144
|
create_datetime: '', last_update_datetime: '',
|
|
143
145
|
legal_ind: false,
|
|
@@ -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
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import moment from "moment-mini"
|
|
2
|
+
import type { PollProps } from "../../../../types"
|
|
3
|
+
|
|
4
|
+
export const MatchMarketHelpers = {
|
|
5
|
+
getUpcomingFlash: (flash_markets?:PollProps[]) => {
|
|
6
|
+
if(!flash_markets){ return undefined }
|
|
7
|
+
return flash_markets.filter(fm => fm.status == 'active' && moment().isBefore(moment(fm.end_datetime))).sort((a,b) => moment(a.end_datetime).unix() - moment(b.end_datetime).unix() || parseInt(a.poll_id) - parseInt(b.poll_id))[0]
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from 'react';
|
|
2
|
-
import type { AthleteProps, BestAvailableOrderProps, EventOrderStatProps, LeagueProps, MarketProps, MarketSideOptionProps, MatchProps, OrderProps, TeamProps, TournamentProps, TradeProps } from "../../../types"
|
|
2
|
+
import type { AthleteProps, BestAvailableOrderProps, EventOrderStatProps, LeagueProps, MarketProps, MarketSideOptionProps, MatchProps, OrderProps, PollProps, TeamProps, TournamentProps, TradeProps } from "../../../types"
|
|
3
3
|
import MarketButton from '../MarketButton';
|
|
4
4
|
import { Icons, LinearDiagnal } from '../../../Components';
|
|
5
5
|
import { MarketButtonHelpers } from '../MarketButton/api';
|
|
@@ -7,6 +7,8 @@ import { MarketComponentHelpers } from '../../api';
|
|
|
7
7
|
import { AthleteImage } from '../../../Components/Jerseys';
|
|
8
8
|
import { Button, Text, View } from '../../../Components/Themed';
|
|
9
9
|
import { useColors } from '../../../constants/useColors';
|
|
10
|
+
import { MatchMarketHelpers } from './api';
|
|
11
|
+
import { Image } from 'react-native';
|
|
10
12
|
|
|
11
13
|
type MatchMarketProps = {
|
|
12
14
|
league?:LeagueProps,
|
|
@@ -21,6 +23,7 @@ type MatchMarketProps = {
|
|
|
21
23
|
home_team?:TeamProps,
|
|
22
24
|
image_size_override?:number,
|
|
23
25
|
hide_stat_banner?:boolean,
|
|
26
|
+
flash_markets?:PollProps[],
|
|
24
27
|
width?:number,
|
|
25
28
|
style?:any,
|
|
26
29
|
market:MarketProps,
|
|
@@ -31,16 +34,18 @@ type MatchMarketProps = {
|
|
|
31
34
|
event_order_stats:EventOrderStatProps[],
|
|
32
35
|
default_price_view:'last_trade'|'best_available',
|
|
33
36
|
onOrder:(order:OrderProps) => void,
|
|
37
|
+
onFlashSelect?:(poll_id:string) => void,
|
|
34
38
|
show_grades?:boolean,
|
|
35
39
|
onView:(data:{event_id:string, event_type:string, market_id:string, side_type:'athlete', side_id:string}) => void,
|
|
36
40
|
onTradeLongPress:(trade:TradeProps) => void
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
const MatchMarket = ({ league, match, tournament, float, show_event, hide_image, image_size_override, direction, style, hide_liquidity, hide_stat_banner, width, away_athlete, home_athlete, away_team, home_team, market, event_order_stats, default_price_view, latest_trades, show_grades, best_available_orders, onOrder, onView, onTradeLongPress }:MatchMarketProps) => {
|
|
43
|
+
const MatchMarket = ({ league, match, tournament, float, flash_markets, show_event, hide_image, image_size_override, direction, style, hide_liquidity, hide_stat_banner, width, away_athlete, home_athlete, away_team, home_team, market, event_order_stats, default_price_view, latest_trades, show_grades, best_available_orders, onFlashSelect, onOrder, onView, onTradeLongPress }:MatchMarketProps) => {
|
|
40
44
|
const C = useColors();
|
|
41
45
|
const { liquidity, open_order_count } = useMemo(() => MarketComponentHelpers.getLiqudity(event_order_stats), [JSON.stringify(event_order_stats)])
|
|
42
46
|
const is_locked = useMemo(() => MarketComponentHelpers.isMatchMarketLocked(match, market.market_id),[JSON.stringify(match.supported_markets)])
|
|
43
47
|
const match_time_detail = MarketComponentHelpers.getMatchTimeDetail(match);
|
|
48
|
+
const upcoming_flash_market = MatchMarketHelpers.getUpcomingFlash(flash_markets);
|
|
44
49
|
let image_size = image_size_override ?? 40
|
|
45
50
|
if(!image_size_override && width){ image_size = width * 0.18 }
|
|
46
51
|
|
|
@@ -148,6 +153,28 @@ const MatchMarket = ({ league, match, tournament, float, show_event, hide_image,
|
|
|
148
153
|
|
|
149
154
|
</View>
|
|
150
155
|
</View>
|
|
156
|
+
{onFlashSelect && upcoming_flash_market ?
|
|
157
|
+
<View type='footer' style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomWidth:1, borderColor:C.borders.light }}>
|
|
158
|
+
{upcoming_flash_market.poll_image ?
|
|
159
|
+
<Image
|
|
160
|
+
source={{ uri: upcoming_flash_market.poll_image.url }}
|
|
161
|
+
style={{ height:30, width:30, borderRadius:4 }}
|
|
162
|
+
resizeMode='cover'
|
|
163
|
+
/>
|
|
164
|
+
:
|
|
165
|
+
<Icons.FlameIcon size={24} color={C.text.error} />
|
|
166
|
+
}
|
|
167
|
+
<View transparent style={{ flex:1, marginLeft:10, marginRight:10 }}>
|
|
168
|
+
<Text theme='h2'>{upcoming_flash_market.poll_question}</Text>
|
|
169
|
+
</View>
|
|
170
|
+
<Button
|
|
171
|
+
title='BUY NOW'
|
|
172
|
+
type='success'
|
|
173
|
+
style={{ padding:10 }}
|
|
174
|
+
onPress={() => onFlashSelect(upcoming_flash_market.poll_id)}
|
|
175
|
+
/>
|
|
176
|
+
</View>
|
|
177
|
+
:<></>}
|
|
151
178
|
{!hide_liquidity ?
|
|
152
179
|
<View type='footer' style={{ flexDirection:'row', alignItems:'center', borderBottomLeftRadius:8, borderBottomRightRadius:8 }}>
|
|
153
180
|
<Button transparent style={{ flexGrow:1, flexDirection:'row', padding:10 }} onPress={() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import moment from "moment-mini";
|
|
2
|
-
import type { AthleteProps, EventOrderStatProps, EventProps, MarketProps, TradeProps } from "../../../../types"
|
|
2
|
+
import type { AthleteProps, EventOrderStatProps, EventProps, MarketProps, PollProps, TradeProps } from "../../../../types"
|
|
3
3
|
|
|
4
4
|
export { TeamEventMarketHelpers }
|
|
5
5
|
const TeamEventMarketHelpers = {
|
|
@@ -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[] = []
|
|
@@ -69,5 +95,9 @@ const TeamEventMarketHelpers = {
|
|
|
69
95
|
if(['unnecessary','postponed','cancelled','canceled','complete','completed','closed','suspended'].includes(event.status)){ status = 'closed' }
|
|
70
96
|
if(status == 'active' && !event.is_active){ status = 'inactive' }
|
|
71
97
|
return status
|
|
98
|
+
},
|
|
99
|
+
getUpcomingFlash: (flash_markets?:PollProps[]) => {
|
|
100
|
+
if(!flash_markets){ return undefined }
|
|
101
|
+
return flash_markets.filter(fm => fm.status == 'active' && moment().isBefore(moment(fm.end_datetime))).sort((a,b) => moment(a.end_datetime).unix() - moment(b.end_datetime).unix() || parseInt(a.poll_id) - parseInt(b.poll_id))[0]
|
|
72
102
|
}
|
|
73
103
|
}
|