be-components 6.0.9 → 6.1.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/lib/commonjs/BetMatch/api/index.js +183 -0
- package/lib/commonjs/BetMatch/api/index.js.map +1 -0
- package/lib/commonjs/BetMatch/components/BetMatchCard.js +469 -0
- package/lib/commonjs/BetMatch/components/BetMatchCard.js.map +1 -0
- package/lib/commonjs/BetMatch/components/BetMatchCardSmall.js +132 -0
- package/lib/commonjs/BetMatch/components/BetMatchCardSmall.js.map +1 -0
- package/lib/commonjs/BetMatch/index.js +280 -0
- package/lib/commonjs/BetMatch/index.js.map +1 -0
- package/lib/commonjs/Components/AutoScrollFlatList.js +135 -0
- package/lib/commonjs/Components/AutoScrollFlatList.js.map +1 -0
- package/lib/commonjs/Components/Icons.js +26 -0
- package/lib/commonjs/Components/Icons.js.map +1 -1
- package/lib/commonjs/Components/index.js +7 -0
- package/lib/commonjs/Components/index.js.map +1 -1
- package/lib/commonjs/FlashMarket/FlashHolder.js +7 -6
- package/lib/commonjs/FlashMarket/FlashHolder.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/MyOrderList/api/index.js +7 -1
- package/lib/commonjs/MarketComponents/components/MyOrderList/api/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/OrderGradeBar.js +5 -1
- package/lib/commonjs/MarketComponents/components/OrderGradeBar.js.map +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/BetMatch/api/index.js +176 -0
- package/lib/module/BetMatch/api/index.js.map +1 -0
- package/lib/module/BetMatch/components/BetMatchCard.js +461 -0
- package/lib/module/BetMatch/components/BetMatchCard.js.map +1 -0
- package/lib/module/BetMatch/components/BetMatchCardSmall.js +125 -0
- package/lib/module/BetMatch/components/BetMatchCardSmall.js.map +1 -0
- package/lib/module/BetMatch/index.js +271 -0
- package/lib/module/BetMatch/index.js.map +1 -0
- package/lib/module/Components/AutoScrollFlatList.js +127 -0
- package/lib/module/Components/AutoScrollFlatList.js.map +1 -0
- package/lib/module/Components/Icons.js +26 -0
- package/lib/module/Components/Icons.js.map +1 -1
- package/lib/module/Components/index.js +2 -1
- package/lib/module/Components/index.js.map +1 -1
- package/lib/module/FlashMarket/FlashHolder.js +7 -6
- package/lib/module/FlashMarket/FlashHolder.js.map +1 -1
- package/lib/module/MarketComponents/components/MyOrderList/api/index.js +7 -1
- package/lib/module/MarketComponents/components/MyOrderList/api/index.js.map +1 -1
- package/lib/module/MarketComponents/components/OrderGradeBar.js +5 -1
- package/lib/module/MarketComponents/components/OrderGradeBar.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/BetMatch/api/index.d.ts +19 -0
- package/lib/typescript/lib/commonjs/BetMatch/api/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/BetMatch/components/BetMatchCard.d.ts +12 -0
- package/lib/typescript/lib/commonjs/BetMatch/components/BetMatchCard.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/BetMatch/components/BetMatchCardSmall.d.ts +12 -0
- package/lib/typescript/lib/commonjs/BetMatch/components/BetMatchCardSmall.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/BetMatch/index.d.ts +6 -0
- package/lib/typescript/lib/commonjs/BetMatch/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Components/AutoScrollFlatList.d.ts +13 -0
- package/lib/typescript/lib/commonjs/Components/AutoScrollFlatList.d.ts.map +1 -0
- 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/index.d.ts +1 -0
- package/lib/typescript/lib/commonjs/FlashMarket/FlashHolder.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/MarketComponents/components/MyOrderList/api/index.d.ts +3 -0
- package/lib/typescript/lib/commonjs/MarketComponents/components/MyOrderList/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/MarketComponents/components/OrderGradeBar.d.ts +2 -1
- package/lib/typescript/lib/commonjs/MarketComponents/components/OrderGradeBar.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/index.d.ts +1 -0
- package/lib/typescript/lib/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/BetMatch/api/index.d.ts +18 -0
- package/lib/typescript/lib/module/BetMatch/api/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/BetMatch/components/BetMatchCard.d.ts +12 -0
- package/lib/typescript/lib/module/BetMatch/components/BetMatchCard.d.ts.map +1 -0
- package/lib/typescript/lib/module/BetMatch/components/BetMatchCardSmall.d.ts +12 -0
- package/lib/typescript/lib/module/BetMatch/components/BetMatchCardSmall.d.ts.map +1 -0
- package/lib/typescript/lib/module/BetMatch/index.d.ts +6 -0
- package/lib/typescript/lib/module/BetMatch/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/Components/AutoScrollFlatList.d.ts +14 -0
- package/lib/typescript/lib/module/Components/AutoScrollFlatList.d.ts.map +1 -0
- 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/index.d.ts +2 -1
- package/lib/typescript/lib/module/Components/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/FlashMarket/FlashHolder.d.ts.map +1 -1
- package/lib/typescript/lib/module/MarketComponents/components/MyOrderList/api/index.d.ts +3 -0
- package/lib/typescript/lib/module/MarketComponents/components/MyOrderList/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/MarketComponents/components/OrderGradeBar.d.ts +2 -1
- package/lib/typescript/lib/module/MarketComponents/components/OrderGradeBar.d.ts.map +1 -1
- package/lib/typescript/lib/module/index.d.ts +2 -1
- package/lib/typescript/lib/module/index.d.ts.map +1 -1
- package/lib/typescript/src/BetMatch/api/index.d.ts +19 -0
- package/lib/typescript/src/BetMatch/api/index.d.ts.map +1 -0
- package/lib/typescript/src/BetMatch/components/BetMatchCard.d.ts +16 -0
- package/lib/typescript/src/BetMatch/components/BetMatchCard.d.ts.map +1 -0
- package/lib/typescript/src/BetMatch/components/BetMatchCardSmall.d.ts +15 -0
- package/lib/typescript/src/BetMatch/components/BetMatchCardSmall.d.ts.map +1 -0
- package/lib/typescript/src/BetMatch/index.d.ts +9 -0
- package/lib/typescript/src/BetMatch/index.d.ts.map +1 -0
- package/lib/typescript/src/Components/AutoScrollFlatList.d.ts +18 -0
- package/lib/typescript/src/Components/AutoScrollFlatList.d.ts.map +1 -0
- 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/index.d.ts +2 -1
- package/lib/typescript/src/Components/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/components/MyOrderList/api/index.d.ts +3 -0
- package/lib/typescript/src/MarketComponents/components/MyOrderList/api/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/components/OrderGradeBar.d.ts +2 -1
- package/lib/typescript/src/MarketComponents/components/OrderGradeBar.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/index.d.ts +2 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/BetMatch/api/index.ts +145 -0
- package/src/BetMatch/components/BetMatchCard.tsx +227 -0
- package/src/BetMatch/components/BetMatchCardSmall.tsx +70 -0
- package/src/BetMatch/index.tsx +192 -0
- package/src/Components/AutoScrollFlatList.tsx +169 -0
- package/src/Components/Icons.tsx +17 -0
- package/src/Components/index.tsx +3 -0
- package/src/FlashMarket/FlashHolder.tsx +3 -3
- package/src/MarketComponents/components/MyOrderList/api/index.ts +4 -1
- package/src/MarketComponents/components/OrderGradeBar.tsx +3 -2
- package/src/index.tsx +3 -0
- package/src/types.d.ts +36 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button, Text, View } from "../../Components/Themed"
|
|
3
|
+
import type { AthleteProps, LeagueProps, OrderProps, PublicPlayerProps, TeamProps } from "../../types"
|
|
4
|
+
import { useColors } from '../../constants/useColors';
|
|
5
|
+
import { MarketComponentHelpers } from '../../MarketComponents/api';
|
|
6
|
+
import { Image } from 'react-native';
|
|
7
|
+
import { AthleteImage, TeamImage } from '../../Components/Jerseys';
|
|
8
|
+
import OrderGradeBar from '../../MarketComponents/components/OrderGradeBar';
|
|
9
|
+
|
|
10
|
+
type BetMatchCardSmallProps = {
|
|
11
|
+
player:PublicPlayerProps,
|
|
12
|
+
contest_title:string,
|
|
13
|
+
time_detail:string,
|
|
14
|
+
league?:LeagueProps,
|
|
15
|
+
team?:TeamProps,
|
|
16
|
+
athlete?:AthleteProps,
|
|
17
|
+
order:OrderProps,
|
|
18
|
+
onOrder:(order:OrderProps) => void
|
|
19
|
+
}
|
|
20
|
+
const BetMatchCardSmall = ({ contest_title, time_detail, team, athlete, league, order, onOrder }:BetMatchCardSmallProps) => {
|
|
21
|
+
const Colors = useColors();
|
|
22
|
+
return (
|
|
23
|
+
<Button float style={{ flex:1, padding:0 }} onPress={() => onOrder(order)}>
|
|
24
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:5, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
|
|
25
|
+
<View float style={{ borderRadius:100, padding:2 }}>
|
|
26
|
+
{athlete ?
|
|
27
|
+
<AthleteImage
|
|
28
|
+
athlete={athlete}
|
|
29
|
+
size={36}
|
|
30
|
+
/>
|
|
31
|
+
:team ?
|
|
32
|
+
<TeamImage
|
|
33
|
+
team={team}
|
|
34
|
+
size={14}
|
|
35
|
+
/>
|
|
36
|
+
:league ?
|
|
37
|
+
<Image
|
|
38
|
+
source={{ uri: league.league_image }}
|
|
39
|
+
style={{ height:36, width:36, borderRadius:100 }}
|
|
40
|
+
resizeMode='cover'
|
|
41
|
+
/>
|
|
42
|
+
:<></>
|
|
43
|
+
}
|
|
44
|
+
</View>
|
|
45
|
+
<View transparent style={{ flex:1, marginLeft:10 }}>
|
|
46
|
+
<Text theme='description' size={12}>{order.title}</Text>
|
|
47
|
+
<Text theme='h1' size={12} color={Colors.text.success} style={{ marginTop:3 }}>${order.open_amt.toFixed(2)} Available</Text>
|
|
48
|
+
</View>
|
|
49
|
+
</View>
|
|
50
|
+
<View type='body' style={{ flex:1 }}>
|
|
51
|
+
|
|
52
|
+
<View transparent type='row' style={{ padding:5, borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
53
|
+
<View style={{ flex:1 }}>
|
|
54
|
+
<Text theme='h2' size={12}>Offer Odds:</Text>
|
|
55
|
+
<OrderGradeBar style={{ alignItems:'flex-start', marginTop:5 }} grade={order.grade} view_type='card' />
|
|
56
|
+
</View>
|
|
57
|
+
<Text theme='h1'>{MarketComponentHelpers.getOddsLabel(order.odds)}</Text>
|
|
58
|
+
</View>
|
|
59
|
+
</View>
|
|
60
|
+
<View type='footer' style={{ flexDirection:'row', alignItems:'center', borderBottomLeftRadius:8, borderBottomRightRadius:8, padding:5 }}>
|
|
61
|
+
<View transparent style={{ flex:1 }}>
|
|
62
|
+
<Text theme='h2'>{contest_title}</Text>
|
|
63
|
+
<Text theme='light' style={{ marginTop:3 }}>{time_detail}</Text>
|
|
64
|
+
</View>
|
|
65
|
+
</View>
|
|
66
|
+
</Button>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export default BetMatchCardSmall
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { Text, View } from "../Components/Themed";
|
|
3
|
+
import { MyOrdersHelpers } from '../MarketComponents/components/MyOrderList/api';
|
|
4
|
+
import type { AthleteProps, EventProps, LeagueProps, MarketProps, MatchProps, OrderProps, PlayerFilterProps, PublicPlayerProps, TeamProps, TournamentProps } from '../types';
|
|
5
|
+
import { BetMatchApi } from './api';
|
|
6
|
+
import { ActivityIndicator, FlatList } from 'react-native';
|
|
7
|
+
import BetMatchCardSmall from './components/BetMatchCardSmall';
|
|
8
|
+
import { SocialOrderHelpers } from '../SocialComponents/api';
|
|
9
|
+
import moment from 'moment-mini';
|
|
10
|
+
import { useColors } from '../constants/useColors';
|
|
11
|
+
import BetMatchCard from './components/BetMatchCard';
|
|
12
|
+
|
|
13
|
+
type BetMatchProps = {
|
|
14
|
+
player_filter_id:string,
|
|
15
|
+
style?:any,
|
|
16
|
+
player_id:string
|
|
17
|
+
}
|
|
18
|
+
const sections = ['filter','orders', 'bet']
|
|
19
|
+
const BetMatch = ({ player_filter_id }:BetMatchProps) => {
|
|
20
|
+
const Colors = useColors();
|
|
21
|
+
const [ module_size, setModuleSize ] = useState({ width:0, height:0 });
|
|
22
|
+
const [ viewing_order_id, setViewingOrderId ] = useState<string|undefined>(undefined);
|
|
23
|
+
const [ static_data, setStaticData ] = useState<{
|
|
24
|
+
static_loading:boolean,
|
|
25
|
+
leagues:LeagueProps[],
|
|
26
|
+
markets:MarketProps[],
|
|
27
|
+
}>({
|
|
28
|
+
static_loading: false, leagues:[], markets:[]
|
|
29
|
+
});
|
|
30
|
+
const { leagues } = static_data;
|
|
31
|
+
const [ filter_data, setFilterData ] = useState<{
|
|
32
|
+
loading:boolean,
|
|
33
|
+
player_filter?:PlayerFilterProps,
|
|
34
|
+
orders:OrderProps[],
|
|
35
|
+
}>({
|
|
36
|
+
loading:false, orders:[]
|
|
37
|
+
});
|
|
38
|
+
const { loading, player_filter, orders } = filter_data;
|
|
39
|
+
const viewing_order = orders.find(o => o.order_id == viewing_order_id);
|
|
40
|
+
const [ contest_data, setContestData ] = useState<{
|
|
41
|
+
contest_loading:boolean,
|
|
42
|
+
players:PublicPlayerProps[],
|
|
43
|
+
events:EventProps[],
|
|
44
|
+
tournaments:TournamentProps[],
|
|
45
|
+
matches:MatchProps[],
|
|
46
|
+
teams:TeamProps[],
|
|
47
|
+
athletes:AthleteProps[]
|
|
48
|
+
}>({
|
|
49
|
+
contest_loading: false, players: [], events: [], tournaments: [], matches: [], teams:[], athletes: []
|
|
50
|
+
});
|
|
51
|
+
const { players, events, tournaments, matches, teams, athletes } = contest_data;
|
|
52
|
+
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
BetMatchApi.setEnvironment()
|
|
55
|
+
runFilter(player_filter_id);
|
|
56
|
+
getStaticData();
|
|
57
|
+
},[player_filter_id]);
|
|
58
|
+
|
|
59
|
+
const runFilter = async(id:string) => {
|
|
60
|
+
setFilterData({ ...filter_data, loading: true });
|
|
61
|
+
const pf = await BetMatchApi.getPlayerFilterById(id);
|
|
62
|
+
if(!pf){ return }
|
|
63
|
+
const filter_orders = await BetMatchApi.runPlayerFilter(id);
|
|
64
|
+
setFilterData({
|
|
65
|
+
...filter_data,
|
|
66
|
+
orders: filter_orders,
|
|
67
|
+
player_filter: pf,
|
|
68
|
+
loading: false
|
|
69
|
+
});
|
|
70
|
+
getContestData(filter_orders);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const getStaticData = async() => {
|
|
74
|
+
setStaticData({ ...static_data, static_loading:true });
|
|
75
|
+
const lgs = await BetMatchApi.getLeagues();
|
|
76
|
+
const makets = await BetMatchApi.getMarkets();
|
|
77
|
+
setStaticData({
|
|
78
|
+
...static_data,
|
|
79
|
+
static_loading:true,
|
|
80
|
+
leagues: lgs,
|
|
81
|
+
markets: makets
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const getContestData = async(orders:OrderProps[]) => {
|
|
86
|
+
setContestData({ ...contest_data, contest_loading:true });
|
|
87
|
+
const { event_ids, tournament_ids, match_ids, athlete_ids, team_ids, player_ids } = MyOrdersHelpers.getContestsFromOrders(orders);
|
|
88
|
+
const plyers = await BetMatchApi.getPlayersByPlayerIds(player_ids);
|
|
89
|
+
const evs = await BetMatchApi.getEventsByEventIds(event_ids);
|
|
90
|
+
const tourns = await BetMatchApi.getTournamentsByTournamentIds(tournament_ids);
|
|
91
|
+
const matchs = await BetMatchApi.getMatchesByMatchIds(match_ids);
|
|
92
|
+
const aths = await BetMatchApi.getAthletesByIds(athlete_ids);
|
|
93
|
+
const tms = await BetMatchApi.getTeamsByIds(team_ids);
|
|
94
|
+
setContestData({
|
|
95
|
+
...contest_data,
|
|
96
|
+
players: plyers,
|
|
97
|
+
events: evs,
|
|
98
|
+
tournaments: tourns,
|
|
99
|
+
matches: matchs,
|
|
100
|
+
teams: tms,
|
|
101
|
+
athletes: aths
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const renderOrders = (data:{ item:OrderProps, index:number }) => {
|
|
106
|
+
const player = players.find(p => p.player_id == data.item.player_id);
|
|
107
|
+
if(!player){ return <></> }
|
|
108
|
+
const { team, athlete, league, title, time } = SocialOrderHelpers.getContestDetails(data.item, events, tournaments, matches, athletes, teams, leagues)
|
|
109
|
+
return (
|
|
110
|
+
<View transparent key={data.item.order_id.toString()} style={{ width:150, maxWidth:250, flexGrow:1, margin:7 }}>
|
|
111
|
+
<BetMatchCardSmall
|
|
112
|
+
player={player}
|
|
113
|
+
team={team}
|
|
114
|
+
athlete={athlete}
|
|
115
|
+
contest_title={title}
|
|
116
|
+
time_detail={time}
|
|
117
|
+
league={league}
|
|
118
|
+
order={data.item}
|
|
119
|
+
onOrder={(order) => setViewingOrderId(order.order_id)}
|
|
120
|
+
/>
|
|
121
|
+
</View>
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const renderSections = (data:{item:string, index:number}) => {
|
|
126
|
+
switch(data.item){
|
|
127
|
+
case 'filter':
|
|
128
|
+
if(!player_filter){ return <></> }
|
|
129
|
+
if(viewing_order){ return <></> }
|
|
130
|
+
return (
|
|
131
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
|
|
132
|
+
<View transparent style={{ flex:1, marginRight:10 }}>
|
|
133
|
+
<Text theme='h1'>{player_filter.name}</Text>
|
|
134
|
+
<Text theme='description' style={{ marginTop:3 }}>Created {moment(player_filter.create_datetime).fromNow()}</Text>
|
|
135
|
+
</View>
|
|
136
|
+
<View transparent style={{ alignItems:'flex-end' }}>
|
|
137
|
+
<Text theme='h1'>{orders.length}</Text>
|
|
138
|
+
<Text theme='description' style={{ marginTop:3 }}>Offers</Text>
|
|
139
|
+
</View>
|
|
140
|
+
</View>
|
|
141
|
+
)
|
|
142
|
+
case 'orders':
|
|
143
|
+
if(viewing_order){ return <></> }
|
|
144
|
+
return (
|
|
145
|
+
<View style={{ flexDirection:'row', flexWrap:'wrap' }}>
|
|
146
|
+
{orders.map((item, index) => {
|
|
147
|
+
return renderOrders({ item, index })
|
|
148
|
+
})}
|
|
149
|
+
</View>
|
|
150
|
+
)
|
|
151
|
+
case 'bet':
|
|
152
|
+
if(!viewing_order){ return <></> }
|
|
153
|
+
const player = players.find(p => p.player_id == viewing_order.player_id);
|
|
154
|
+
if(!player){ return <></> }
|
|
155
|
+
const { team, athlete, league, title, time } = SocialOrderHelpers.getContestDetails(viewing_order, events, tournaments, matches, athletes, teams, leagues)
|
|
156
|
+
return (
|
|
157
|
+
<View style={{ flex:1, padding:20 }}>
|
|
158
|
+
<BetMatchCard
|
|
159
|
+
player={player}
|
|
160
|
+
height={module_size.height - 60}
|
|
161
|
+
order={viewing_order}
|
|
162
|
+
team={team}
|
|
163
|
+
athlete={athlete}
|
|
164
|
+
league={league}
|
|
165
|
+
time_detail={time}
|
|
166
|
+
contest_title={title}
|
|
167
|
+
onOrder={(order) => console.log(order)}
|
|
168
|
+
/>
|
|
169
|
+
</View>
|
|
170
|
+
)
|
|
171
|
+
default: return <></>
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return (
|
|
175
|
+
<View style={{ flex:1 }} onLayout={(ev) => {
|
|
176
|
+
const { width, height } = ev.nativeEvent.layout;
|
|
177
|
+
setModuleSize({ width, height })
|
|
178
|
+
}}>
|
|
179
|
+
{loading ?
|
|
180
|
+
<ActivityIndicator size='large' color={Colors.text.h1} />
|
|
181
|
+
:<></>}
|
|
182
|
+
<FlatList
|
|
183
|
+
data={sections}
|
|
184
|
+
key={'filter_sections'}
|
|
185
|
+
keyExtractor={item => item}
|
|
186
|
+
renderItem={renderSections}
|
|
187
|
+
/>
|
|
188
|
+
</View>
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export default BetMatch
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
FlatList,
|
|
4
|
+
View,
|
|
5
|
+
type LayoutChangeEvent,
|
|
6
|
+
type ViewStyle,
|
|
7
|
+
type NativeScrollEvent,
|
|
8
|
+
type NativeSyntheticEvent,
|
|
9
|
+
Platform,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
|
|
12
|
+
type AutoScrollingFlatListProps<T> = {
|
|
13
|
+
data: T[];
|
|
14
|
+
renderItem: ({ item, index }: { item: T; index: number }) => React.ReactElement;
|
|
15
|
+
horizontal?: boolean;
|
|
16
|
+
style?: ViewStyle;
|
|
17
|
+
speed: number; // pixels per second
|
|
18
|
+
minDuration?: number; // milliseconds (optional)
|
|
19
|
+
onCompleteScroll?: (completed: boolean) => void;
|
|
20
|
+
resetKey?: string | number; // used to reset internal state
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const AutoScrollingFlatList = <T,>({
|
|
24
|
+
data,
|
|
25
|
+
renderItem,
|
|
26
|
+
horizontal = false,
|
|
27
|
+
style,
|
|
28
|
+
speed,
|
|
29
|
+
minDuration = 0,
|
|
30
|
+
onCompleteScroll,
|
|
31
|
+
resetKey,
|
|
32
|
+
}: AutoScrollingFlatListProps<T>) => {
|
|
33
|
+
const listRef = useRef<FlatList<T>>(null);
|
|
34
|
+
const itemSizes = useRef<(number | undefined)[]>([]);
|
|
35
|
+
const totalSize = useRef(0);
|
|
36
|
+
const offset = useRef(0);
|
|
37
|
+
const scrollTimer = useRef<NodeJS.Timeout | null>(null);
|
|
38
|
+
const scrollStartTime = useRef<number | null>(null);
|
|
39
|
+
|
|
40
|
+
const [ready, setReady] = useState(false);
|
|
41
|
+
const [isPaused, setIsPaused] = useState(false); // replaces isHovered
|
|
42
|
+
const [containerSize, setContainerSize] = useState(0);
|
|
43
|
+
|
|
44
|
+
const handleLayout = (e: LayoutChangeEvent) => {
|
|
45
|
+
const size = horizontal
|
|
46
|
+
? e.nativeEvent.layout.width
|
|
47
|
+
: e.nativeEvent.layout.height;
|
|
48
|
+
setContainerSize(size);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const updateItemLayout = (index: number, e: LayoutChangeEvent) => {
|
|
52
|
+
const size = horizontal
|
|
53
|
+
? e.nativeEvent.layout.width
|
|
54
|
+
: e.nativeEvent.layout.height;
|
|
55
|
+
|
|
56
|
+
itemSizes.current[index] = size;
|
|
57
|
+
|
|
58
|
+
const allMeasured =
|
|
59
|
+
itemSizes.current.length === data.length &&
|
|
60
|
+
itemSizes.current.every((v) => typeof v === 'number');
|
|
61
|
+
|
|
62
|
+
if (allMeasured && !ready) {
|
|
63
|
+
totalSize.current = itemSizes.current
|
|
64
|
+
.filter((v): v is number => typeof v === 'number')
|
|
65
|
+
.reduce((acc, val) => acc + val, 0);
|
|
66
|
+
setReady(true);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const handleScroll = (e: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
71
|
+
const currentOffset = horizontal
|
|
72
|
+
? e.nativeEvent.contentOffset.x
|
|
73
|
+
: e.nativeEvent.contentOffset.y;
|
|
74
|
+
|
|
75
|
+
offset.current = currentOffset;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
const isWeb = Platform.OS === 'web';
|
|
80
|
+
|
|
81
|
+
if (!ready || (isWeb && isPaused) || speed <= 0 || containerSize === 0) return;
|
|
82
|
+
|
|
83
|
+
const frameInterval = 16;
|
|
84
|
+
const pixelsPerFrame = (speed * frameInterval) / 1000;
|
|
85
|
+
scrollStartTime.current = Date.now();
|
|
86
|
+
|
|
87
|
+
scrollTimer.current = setInterval(() => {
|
|
88
|
+
offset.current += pixelsPerFrame;
|
|
89
|
+
|
|
90
|
+
const maxOffset = totalSize.current - containerSize;
|
|
91
|
+
const now = Date.now();
|
|
92
|
+
const reachedEnd = offset.current >= maxOffset;
|
|
93
|
+
const minTimeElapsed = now - (scrollStartTime.current ?? 0) >= minDuration;
|
|
94
|
+
|
|
95
|
+
if (reachedEnd) {
|
|
96
|
+
if (minTimeElapsed) {
|
|
97
|
+
offset.current = 0;
|
|
98
|
+
scrollStartTime.current = Date.now();
|
|
99
|
+
listRef.current?.scrollToOffset({ offset: 0, animated: false });
|
|
100
|
+
if (onCompleteScroll) onCompleteScroll(true);
|
|
101
|
+
} else {
|
|
102
|
+
offset.current = maxOffset;
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
listRef.current?.scrollToOffset({
|
|
106
|
+
offset: offset.current,
|
|
107
|
+
animated: false,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}, frameInterval);
|
|
111
|
+
|
|
112
|
+
return () => {
|
|
113
|
+
if (scrollTimer.current) clearInterval(scrollTimer.current);
|
|
114
|
+
};
|
|
115
|
+
}, [ready, speed, isPaused, containerSize, onCompleteScroll, minDuration]);
|
|
116
|
+
|
|
117
|
+
// Reset state/refs on resetKey change
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
if (scrollTimer.current) clearInterval(scrollTimer.current);
|
|
120
|
+
offset.current = 0;
|
|
121
|
+
scrollStartTime.current = null;
|
|
122
|
+
itemSizes.current = [];
|
|
123
|
+
totalSize.current = 0;
|
|
124
|
+
setReady(false);
|
|
125
|
+
setIsPaused(false);
|
|
126
|
+
}, [resetKey]);
|
|
127
|
+
|
|
128
|
+
const wrappedRenderItem = ({ item, index }: { item: T; index: number }) => (
|
|
129
|
+
<View onLayout={(e) => updateItemLayout(index, e)} style={{ flexShrink: 0 }}>
|
|
130
|
+
{renderItem({ item, index })}
|
|
131
|
+
</View>
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
const wrapperProps =
|
|
135
|
+
Platform.OS === 'web'
|
|
136
|
+
? {
|
|
137
|
+
onMouseEnter: () => setIsPaused(true),
|
|
138
|
+
onMouseLeave: () => setIsPaused(false),
|
|
139
|
+
onTouchStart: () => setIsPaused(true), // pause on mobile tap
|
|
140
|
+
onTouchEnd: () => setIsPaused(false),
|
|
141
|
+
}
|
|
142
|
+
: {
|
|
143
|
+
onTouchStart: () => setIsPaused(true),
|
|
144
|
+
onTouchEnd: () => setIsPaused(false),
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
return (
|
|
148
|
+
<View
|
|
149
|
+
{...(wrapperProps as any)}
|
|
150
|
+
onLayout={handleLayout}
|
|
151
|
+
style={[{ overflow: 'hidden' }, style]}
|
|
152
|
+
>
|
|
153
|
+
<FlatList
|
|
154
|
+
ref={listRef}
|
|
155
|
+
data={data}
|
|
156
|
+
renderItem={wrappedRenderItem}
|
|
157
|
+
keyExtractor={(_, i) => i.toString()}
|
|
158
|
+
horizontal={horizontal}
|
|
159
|
+
scrollEnabled={true}
|
|
160
|
+
onScroll={handleScroll}
|
|
161
|
+
scrollEventThrottle={16}
|
|
162
|
+
showsHorizontalScrollIndicator={false}
|
|
163
|
+
showsVerticalScrollIndicator={false}
|
|
164
|
+
/>
|
|
165
|
+
</View>
|
|
166
|
+
);
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export default AutoScrollingFlatList;
|
package/src/Components/Icons.tsx
CHANGED
|
@@ -1534,6 +1534,22 @@ const GolferIcon = ({ color, size }:IconProps) => {
|
|
|
1534
1534
|
)
|
|
1535
1535
|
}
|
|
1536
1536
|
|
|
1537
|
+
const LocationIcon = ({ color, size }:IconProps) => {
|
|
1538
|
+
const ratio = 0.833
|
|
1539
|
+
const height = size ?? 18
|
|
1540
|
+
const width = height * ratio
|
|
1541
|
+
|
|
1542
|
+
return (
|
|
1543
|
+
<Svg width={`${width}px`} height={`${height}px`} viewBox="0 0 34 40">
|
|
1544
|
+
<G id="app-icons" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
|
|
1545
|
+
<G id="location-1-svgrepo-com" fill={color ?? Colors.brand.midnight}>
|
|
1546
|
+
<Path d="M17.2995556,35.5411111 C17.0148889,35.75 16.7495556,35.9395556 16.5071111,36.1095556 C16.2484444,35.938 15.9615556,35.7406667 15.6504444,35.5182222 C14.1835556,34.4686667 12.2811111,32.928 10.4075111,31.0064444 C6.56448889,27.0648889 3.33333333,22.0335556 3.33333333,16.6666667 C3.33333333,9.30286667 9.30286667,3.33333333 16.6666667,3.33333333 C24.0304444,3.33333333 30,9.30286667 30,16.6666667 C30,21.976 26.6264444,26.9928889 22.6428889,30.9762222 C20.7102222,32.9091111 18.7653333,34.4664444 17.2995556,35.5411111 Z M33.3333333,16.6666667 C33.3333333,20.0320028 32.2715689,23.184986 30.6840192,26.0184205 C25.9817575,34.4109455 16.6666667,40 16.6666667,40 C15.8333333,40 0,30 0,16.6666667 C0,7.46191111 7.46191111,0 16.6666667,0 C25.8713333,0 33.3333333,7.46191111 33.3333333,16.6666667 Z M20,16.6666667 C20,18.5075556 18.5075556,20 16.6666667,20 C14.8257778,20 13.3333333,18.5075556 13.3333333,16.6666667 C13.3333333,14.8257111 14.8257778,13.3333333 16.6666667,13.3333333 C18.5075556,13.3333333 20,14.8257111 20,16.6666667 Z M23.3333333,16.6666667 C23.3333333,20.3486667 20.3486667,23.3333333 16.6666667,23.3333333 C12.9846667,23.3333333 10,20.3486667 10,16.6666667 C10,12.9847778 12.9846667,10 16.6666667,10 C20.3486667,10 23.3333333,12.9847778 23.3333333,16.6666667 Z" id="Shape"></Path>
|
|
1547
|
+
</G>
|
|
1548
|
+
</G>
|
|
1549
|
+
</Svg>
|
|
1550
|
+
)
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1537
1553
|
export default {
|
|
1538
1554
|
SearchIcon,
|
|
1539
1555
|
LiquidityIcon,
|
|
@@ -1542,6 +1558,7 @@ export default {
|
|
|
1542
1558
|
//BetScopeSuccessIcon,
|
|
1543
1559
|
AlertIcon,
|
|
1544
1560
|
GolferIcon,
|
|
1561
|
+
LocationIcon,
|
|
1545
1562
|
GIFIcon,
|
|
1546
1563
|
QuestionIcon,
|
|
1547
1564
|
BarstoolIcon,
|
package/src/Components/index.tsx
CHANGED
|
@@ -9,10 +9,13 @@ import Switch from './Switch';
|
|
|
9
9
|
import ConfirmationModal from './ConfirmationModal';
|
|
10
10
|
import Toggle from './Toggle';
|
|
11
11
|
import ProgressBar from './ProgressBar';
|
|
12
|
+
import AutoScrollingFlatList from './AutoScrollFlatList';
|
|
13
|
+
|
|
12
14
|
export {
|
|
13
15
|
Button,
|
|
14
16
|
Text,
|
|
15
17
|
Spring,
|
|
18
|
+
AutoScrollingFlatList,
|
|
16
19
|
Switch,
|
|
17
20
|
TextInput,
|
|
18
21
|
ProgressBar,
|
|
@@ -137,13 +137,13 @@ const FlashHolder = ({ float, distinct_id, hide_tabs, league_id, player_id, play
|
|
|
137
137
|
|
|
138
138
|
const loadData = async(options?:{ reload:boolean }) => {
|
|
139
139
|
FlashMarketApi.setEnvironment();
|
|
140
|
+
setFlashData({ ...flash_data, holder_loading: true });
|
|
140
141
|
if(poll_id){
|
|
141
142
|
//need to grab the poll
|
|
142
|
-
setFlashData({ ...flash_data, loaded:true });
|
|
143
|
+
setFlashData({ ...flash_data, loaded:true, holder_loading: false });
|
|
143
144
|
return handleSelectPoll(poll_id, options);
|
|
144
145
|
}
|
|
145
146
|
let found_polls:PollProps[] = []
|
|
146
|
-
setFlashData({ ...flash_data, holder_loading:true });
|
|
147
147
|
if(league_id || contest_type || contest_id || side_type || side_id){
|
|
148
148
|
found_polls = await FlashMarketApi.getActiveLinkedFlashMarkets(league_id, contest_type, contest_id, side_type, side_id);
|
|
149
149
|
} else {
|
|
@@ -263,7 +263,7 @@ const FlashHolder = ({ float, distinct_id, hide_tabs, league_id, player_id, play
|
|
|
263
263
|
poll_summaries={poll_summaries}
|
|
264
264
|
poll_campaign={poll_campaign}
|
|
265
265
|
flash_market_fees={flash_market_fees}
|
|
266
|
-
loading={loading}
|
|
266
|
+
loading={loading || holder_loading}
|
|
267
267
|
hide_image
|
|
268
268
|
card_style={{ borderWidth:2, borderColor:Colors.text.success, borderBottomRightRadius:8, borderBottomLeftRadius:8 }}
|
|
269
269
|
init_expanded
|
|
@@ -8,7 +8,10 @@ export const MyOrdersHelpers = {
|
|
|
8
8
|
let event_ids = [ ...new Set(orders.filter(o => o.event_type == 'team').map(o => o.event_id))]
|
|
9
9
|
let tournament_ids = [ ...new Set(orders.filter(o => o.event_type == 'tournament').map(o => o.event_id))]
|
|
10
10
|
let match_ids = [ ...new Set(orders.filter(o => o.event_type == 'match').map(o => o.event_id))]
|
|
11
|
-
|
|
11
|
+
let athlete_ids = [ ...new Set(orders.filter(o => o.side_type == 'athlete').map(o => o.side_id))]
|
|
12
|
+
let team_ids = [ ...new Set(orders.filter(o => o.side_type == 'team').map(o => o.side_id)) ]
|
|
13
|
+
let player_ids = [ ...new Set(orders.map(o => o.player_id)) ]
|
|
14
|
+
return { event_ids, tournament_ids, match_ids, athlete_ids, team_ids, player_ids }
|
|
12
15
|
},
|
|
13
16
|
getHedgesFromPositions: (orders:OrderProps[], markets:MarketProps[]):HedgeProps[] => {
|
|
14
17
|
//1) Set up arrays to store hedges
|
|
@@ -17,13 +17,14 @@ type GradeBoxType = {
|
|
|
17
17
|
|
|
18
18
|
type OrderGradeBarProps = {
|
|
19
19
|
mask?:boolean,
|
|
20
|
+
style?:any,
|
|
20
21
|
grade?: number,
|
|
21
22
|
view_type: 'card'|'book'|'market',
|
|
22
23
|
onSelectGrade?:() => void
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
//OrderGradeBar React Component
|
|
26
|
-
const OrderGradeBar = ({ grade, view_type, mask, onSelectGrade }:OrderGradeBarProps ) => {
|
|
27
|
+
const OrderGradeBar = ({ grade, view_type, style, mask, onSelectGrade }:OrderGradeBarProps ) => {
|
|
27
28
|
const Colors = useColors();
|
|
28
29
|
|
|
29
30
|
//Stage the boxes and set the min / max and colors
|
|
@@ -97,7 +98,7 @@ const OrderGradeBar = ({ grade, view_type, mask, onSelectGrade }:OrderGradeBarPr
|
|
|
97
98
|
}
|
|
98
99
|
|
|
99
100
|
return (
|
|
100
|
-
<View transparent>
|
|
101
|
+
<View transparent style={{ ...style }}>
|
|
101
102
|
<Button style={{ padding:0 }} transparent disabled={onSelectGrade ? false : true} onPress={() => onSelectGrade ? onSelectGrade() : console.log('')}>
|
|
102
103
|
{view_type === 'card' ?
|
|
103
104
|
<FlatList style={{ alignSelf:'center' }} horizontal data={grade_boxes} renderItem={renderGradeBoxes} keyExtractor={(item) => item.min.toString()} />
|
package/src/index.tsx
CHANGED
|
@@ -50,6 +50,8 @@ import GolfScoreboard from './GolfScoreboard';
|
|
|
50
50
|
import FlashMarket from './FlashMarket';
|
|
51
51
|
import FlashHolder from './FlashMarket/FlashHolder';
|
|
52
52
|
import BEPostHog from './PostHog';
|
|
53
|
+
import BetMatch from './BetMatch';
|
|
54
|
+
|
|
53
55
|
|
|
54
56
|
|
|
55
57
|
export {
|
|
@@ -57,6 +59,7 @@ export {
|
|
|
57
59
|
Observer,
|
|
58
60
|
BEEventApi,
|
|
59
61
|
BELinkApi,
|
|
62
|
+
BetMatch,
|
|
60
63
|
Ticker,
|
|
61
64
|
LeaderboardCard,
|
|
62
65
|
LocationTracker,
|
package/src/types.d.ts
CHANGED
|
@@ -2133,6 +2133,42 @@ export interface EventOrderStatProps {
|
|
|
2133
2133
|
market_type: string;
|
|
2134
2134
|
}
|
|
2135
2135
|
|
|
2136
|
+
|
|
2137
|
+
export interface PlayerFilterProps {
|
|
2138
|
+
player_filter_id:string,
|
|
2139
|
+
player_id:string,
|
|
2140
|
+
pinned:boolean,
|
|
2141
|
+
name: string
|
|
2142
|
+
premium?:boolean,
|
|
2143
|
+
filter: OrderFilterProps,
|
|
2144
|
+
status:'active'|'inactive'|'deleted',
|
|
2145
|
+
create_datetime:any,
|
|
2146
|
+
last_update_datetime:any
|
|
2147
|
+
}
|
|
2148
|
+
|
|
2149
|
+
|
|
2150
|
+
export interface OrderFilterProps {
|
|
2151
|
+
market_type: 'FOR_MONEY'|'FREE'
|
|
2152
|
+
order_id?:string, //If populated, then this overrides all other options
|
|
2153
|
+
following_only:boolean,
|
|
2154
|
+
custom_players?:boolean,
|
|
2155
|
+
market_level?:string,
|
|
2156
|
+
external_book?:string,
|
|
2157
|
+
event_id?:string,
|
|
2158
|
+
market_types?:string,
|
|
2159
|
+
team_ids:string[],
|
|
2160
|
+
minimum_grade:number,
|
|
2161
|
+
athlete_ids:string[],
|
|
2162
|
+
event_type?:'team'|'tournament'|'match',
|
|
2163
|
+
market_ids:string[],
|
|
2164
|
+
league_ids:string[],
|
|
2165
|
+
live_only:boolean,
|
|
2166
|
+
player_ids:string[],
|
|
2167
|
+
location?:any,
|
|
2168
|
+
location_range_miles?:number,
|
|
2169
|
+
region?:string
|
|
2170
|
+
}
|
|
2171
|
+
|
|
2136
2172
|
export type EventNameTypes = 'generated_link' |'incoming_user' |'identify_user' |'visibility_on' |'visibility_off'|
|
|
2137
2173
|
'page_hit'|'sign_up'|'game_view'|'game_join'|'game_result'|'order_create'|'order_result'|'vouch_start'|'vouch_attempt'|
|
|
2138
2174
|
'account_add_start'|'account_add_result'|'transaction_attempt'|'transaction_result'|'message_support'|'room_view'|'view_social'|
|