be-components 2.7.0 → 2.7.2
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/MarketComponents/components/TournamentMarket/api/index.js +42 -6
- package/lib/commonjs/MarketComponents/components/TournamentMarket/api/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/TournamentMarket/index.js +144 -16
- package/lib/commonjs/MarketComponents/components/TournamentMarket/index.js.map +1 -1
- package/lib/module/MarketComponents/components/TournamentMarket/api/index.js +42 -6
- package/lib/module/MarketComponents/components/TournamentMarket/api/index.js.map +1 -1
- package/lib/module/MarketComponents/components/TournamentMarket/index.js +145 -17
- package/lib/module/MarketComponents/components/TournamentMarket/index.js.map +1 -1
- package/lib/typescript/src/MarketComponents/components/TournamentMarket/api/index.d.ts +4 -3
- 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 -1
- package/lib/typescript/src/MarketComponents/components/TournamentMarket/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/index.d.ts +4 -1
- package/lib/typescript/src/MarketComponents/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/MarketComponents/components/TournamentMarket/api/index.ts +34 -6
- package/src/MarketComponents/components/TournamentMarket/index.tsx +137 -56
|
@@ -3,7 +3,7 @@ import { View, FlatList, TouchableOpacity, ActivityIndicator, Image } from 'reac
|
|
|
3
3
|
import { view_styles } from '../../../constants/styles';
|
|
4
4
|
import Colors from '../../../constants/colors';
|
|
5
5
|
import type { AthleteProps, BestAvailableOrderProps, EventOrderStatProps, LeagueProps, MarketProps, MatchProps, OrderProps, TeamProps, TournamentProps, TradeProps } from '../../../types';
|
|
6
|
-
import { Button, Icons, Text } from '../../../Components';
|
|
6
|
+
import { Button, Icons, Text, TextInput } from '../../../Components';
|
|
7
7
|
import { MarketComponentApi, MarketComponentHelpers } from '../../api';
|
|
8
8
|
import AthleteTournamentMarket from '../AthleteTournamentMarket';
|
|
9
9
|
import TeamTournamentMarket from '../TeamTournamentMarket';
|
|
@@ -18,16 +18,19 @@ type TournamentMarketProps = {
|
|
|
18
18
|
league?:LeagueProps,
|
|
19
19
|
markets:MarketProps[],
|
|
20
20
|
hide_liquidity?:boolean,
|
|
21
|
+
width?:number,
|
|
21
22
|
hide_match_liquidity?:boolean,
|
|
22
23
|
show_grades?:boolean,
|
|
23
24
|
hide_participant_liquidity?:boolean,
|
|
24
25
|
activate_loading?:boolean,
|
|
26
|
+
wrap_markets?:boolean,
|
|
25
27
|
latest_trades:TradeProps[],
|
|
26
28
|
best_available_orders:BestAvailableOrderProps[],
|
|
27
29
|
match_available_orders:BestAvailableOrderProps[],
|
|
28
30
|
event_order_stats:EventOrderStatProps[],
|
|
29
31
|
match_order_stats:EventOrderStatProps[],
|
|
30
32
|
match_latest_trades:TradeProps[],
|
|
33
|
+
market_selector_location?:string,
|
|
31
34
|
onShare?:(t:TournamentProps) => void,
|
|
32
35
|
onView:(data:{ event_id:string, event_type:string, market_id:string, side_type?:string, side_id?:string }) => void,
|
|
33
36
|
onTradeLongPress:(trade:TradeProps) => void,
|
|
@@ -36,8 +39,8 @@ type TournamentMarketProps = {
|
|
|
36
39
|
onOrder:(order:OrderProps) => void
|
|
37
40
|
}
|
|
38
41
|
|
|
39
|
-
|
|
40
|
-
const
|
|
42
|
+
const TournamentMarket = ({ tournament, wrap_markets, width, market_selector_location, hide_match_liquidity, show_grades, hide_participant_liquidity, league, markets, latest_trades, hide_liquidity, best_available_orders, event_order_stats, match_available_orders, match_latest_trades, match_order_stats, activate_loading, onView, onTradeLongPress, onViewAdditionalMarkets, onOrder, onActivate, onShare }:TournamentMarketProps) => {
|
|
43
|
+
const [ search_value, setSearchValue ] = useState<string | undefined>(undefined);
|
|
41
44
|
const [ tournament_data, setTournamentData ] = useState<{
|
|
42
45
|
loaded:boolean,
|
|
43
46
|
loading:boolean,
|
|
@@ -63,10 +66,10 @@ const TournamentMarket = ({ tournament, hide_match_liquidity, show_grades, hide_
|
|
|
63
66
|
const supported_markets = markets.filter(m => tournament.supported_markets.find(sm => sm.market_id == m.market_id));
|
|
64
67
|
const { show_athletes, show_teams, show_matches } = TournamentMarketHelpers.visibleMarketTypes(tournament, active_market);
|
|
65
68
|
const { liquidity, open_order_count } = MarketComponentHelpers.getLiqudity(event_order_stats.concat(match_order_stats.filter(m => matches.find(nm => nm.match_id == m.event_id))));
|
|
66
|
-
const sorted_athletes = TournamentMarketHelpers.sortAthletes(event_order_stats, latest_trades, athletes, active_market);
|
|
67
|
-
const sorted_teams = TournamentMarketHelpers.sortTeams(event_order_stats, latest_trades, teams, active_market);
|
|
68
|
-
const sorted_matches = TournamentMarketHelpers.sortMatches(match_order_stats, matches, active_market);
|
|
69
|
-
|
|
69
|
+
const sorted_athletes = TournamentMarketHelpers.sortAthletes(event_order_stats, latest_trades, athletes, active_market, search_value);
|
|
70
|
+
const sorted_teams = TournamentMarketHelpers.sortTeams(event_order_stats, latest_trades, teams, active_market, search_value);
|
|
71
|
+
const sorted_matches = TournamentMarketHelpers.sortMatches(match_order_stats, matches, active_market, search_value, athletes, teams);
|
|
72
|
+
const market_width = TournamentMarketHelpers.getMarketWrapWidth(40, width, wrap_markets)
|
|
70
73
|
useEffect(() => {
|
|
71
74
|
if(!is_in_viewport || loaded || loading){ return }
|
|
72
75
|
MarketComponentApi.setEnvironment();
|
|
@@ -127,51 +130,57 @@ const TournamentMarket = ({ tournament, hide_match_liquidity, show_grades, hide_
|
|
|
127
130
|
m_trades = match_trades.filter(t => t.event_id == data.item.match_id && t.event_type == 'match');
|
|
128
131
|
}
|
|
129
132
|
let m_order_stats = match_order_stats.filter(os => os.event_id == data.item.match_id && os.event_type == 'match');
|
|
133
|
+
|
|
130
134
|
return (
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
135
|
+
<View>
|
|
136
|
+
<MatchMarket
|
|
137
|
+
match={data.item}
|
|
138
|
+
league={league}
|
|
139
|
+
away_athlete={away_athlete}
|
|
140
|
+
home_athlete={home_athlete}
|
|
141
|
+
away_team={away_team}
|
|
142
|
+
show_grades={show_grades}
|
|
143
|
+
width={wrap_markets ? market_width : undefined}
|
|
144
|
+
home_team={home_team}
|
|
145
|
+
hide_liquidity={hide_match_liquidity ? true : false}
|
|
146
|
+
market={active_market}
|
|
147
|
+
latest_trades={m_trades}
|
|
148
|
+
best_available_orders={m_available_orders}
|
|
149
|
+
event_order_stats={m_order_stats}
|
|
150
|
+
onOrder={onOrder}
|
|
151
|
+
onTradeLongPress={onTradeLongPress}
|
|
152
|
+
onView={onView}
|
|
153
|
+
default_price_view='best_available'
|
|
148
154
|
|
|
149
|
-
|
|
155
|
+
/>
|
|
156
|
+
</View>
|
|
150
157
|
)
|
|
151
158
|
}
|
|
152
159
|
|
|
153
160
|
const renderTeams = (data:{ item:TeamProps, index:number }) => {
|
|
154
|
-
console.log('rendering team!!!!')
|
|
155
161
|
if(!active_market){ return <></> }
|
|
156
162
|
let team_available_orders = best_available_orders.filter(ba => ba.side_type == 'team' && ba.side_id == data.item.team_id);
|
|
157
163
|
let team_trades = latest_trades.filter(t => t.side_type == 'team' && t.side_id == data.item.team_id);
|
|
158
164
|
let team_order_stats = event_order_stats.filter(os => os.side_type == 'team' && os.side_id == data.item.team_id);
|
|
159
165
|
return (
|
|
160
|
-
<
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
166
|
+
<View>
|
|
167
|
+
<TeamTournamentMarket
|
|
168
|
+
team={data.item}
|
|
169
|
+
event_type='tournament'
|
|
170
|
+
onTradeLongPress={onTradeLongPress}
|
|
171
|
+
onView={onView}
|
|
172
|
+
width={wrap_markets ? market_width : undefined}
|
|
173
|
+
show_grades={show_grades}
|
|
174
|
+
hide_liquidity={hide_participant_liquidity ? true : false}
|
|
175
|
+
tournament={tournament}
|
|
176
|
+
event_order_stats={team_order_stats}
|
|
177
|
+
best_available_orders={team_available_orders}
|
|
178
|
+
latest_trades={team_trades}
|
|
179
|
+
default_price_view='best_available'
|
|
180
|
+
market={active_market}
|
|
181
|
+
onOrder={onOrder}
|
|
182
|
+
/>
|
|
183
|
+
</View>
|
|
175
184
|
)
|
|
176
185
|
}
|
|
177
186
|
|
|
@@ -181,21 +190,24 @@ const TournamentMarket = ({ tournament, hide_match_liquidity, show_grades, hide_
|
|
|
181
190
|
let team_trades = latest_trades.filter(t => t.side_type == 'athlete' && t.side_id == data.item.athlete_id);
|
|
182
191
|
let team_order_stats = event_order_stats.filter(os => os.side_type == 'athlete' && os.side_id == data.item.athlete_id);
|
|
183
192
|
return (
|
|
184
|
-
<
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
193
|
+
<View>
|
|
194
|
+
<AthleteTournamentMarket
|
|
195
|
+
athlete={data.item}
|
|
196
|
+
event_type='tournament'
|
|
197
|
+
onTradeLongPress={onTradeLongPress}
|
|
198
|
+
onView={onView}
|
|
199
|
+
show_grades={show_grades}
|
|
200
|
+
hide_liquidity={hide_participant_liquidity ? true : false}
|
|
201
|
+
tournament={tournament}
|
|
202
|
+
width={wrap_markets ? market_width : undefined}
|
|
203
|
+
event_order_stats={team_order_stats}
|
|
204
|
+
best_available_orders={team_available_orders}
|
|
205
|
+
latest_trades={team_trades}
|
|
206
|
+
default_price_view='best_available'
|
|
207
|
+
market={active_market}
|
|
208
|
+
onOrder={onOrder}
|
|
209
|
+
/>
|
|
210
|
+
</View>
|
|
199
211
|
)
|
|
200
212
|
}
|
|
201
213
|
|
|
@@ -237,33 +249,98 @@ const TournamentMarket = ({ tournament, hide_match_liquidity, show_grades, hide_
|
|
|
237
249
|
</View>
|
|
238
250
|
:
|
|
239
251
|
<View>
|
|
252
|
+
{market_selector_location == 'top_right' ?
|
|
253
|
+
<View style={{ ...view_styles.body_row, paddingLeft:10, paddingRight:10, zIndex:1, backgroundColor:Colors.shades.shade100 }}>
|
|
254
|
+
<View style={{ flexDirection:'row', alignItems:'center', flex:1, marginRight:10, paddingLeft:10, backgroundColor:Colors.shades.white, borderRadius:22 }}>
|
|
255
|
+
<Icons.SearchIcon color={Colors.brand.electric} size={18} />
|
|
256
|
+
<TextInput
|
|
257
|
+
style={{ flex:1, marginLeft:10, borderRadius:0, borderTopRightRadius:22, borderBottomRightRadius:22 }}
|
|
258
|
+
placeholder='Search athletes, teams, matches ...'
|
|
259
|
+
placeholderTextColor={Colors.accents.accent200}
|
|
260
|
+
onChangeText={(text) => setSearchValue(text)}
|
|
261
|
+
/>
|
|
262
|
+
</View>
|
|
263
|
+
<TouchableOpacity style={{ flexDirection:'row', alignItems:'center', backgroundColor:Colors.shades.white, borderWidth:1, borderColor:Colors.shades.shade600, borderRadius:4, padding:10, ...view_styles.float }} onPress={() => setShowMarkets(!show_markets)}>
|
|
264
|
+
<Text style={{ marginRight:10 }} size={14} color={Colors.brand.midnight}>{active_market?.type == 'Stat' ? active_market.stat_label : active_market?.type}</Text>
|
|
265
|
+
<Icons.ChevronIcon color={Colors.brand.midnight} size={14} />
|
|
266
|
+
</TouchableOpacity>
|
|
267
|
+
{show_markets ?
|
|
268
|
+
<View style={{ ...view_styles.section, position:'absolute', top:5, right:5, minWidth:175 }}>
|
|
269
|
+
<View style={{ ...view_styles.section_header, backgroundColor:Colors.shades.shade100 }}>
|
|
270
|
+
<View style={{ flex:1 }}>
|
|
271
|
+
<Text theme='header_2'>Select Market</Text>
|
|
272
|
+
</View>
|
|
273
|
+
<Button
|
|
274
|
+
title='X'
|
|
275
|
+
title_weight='regular'
|
|
276
|
+
borderRadius={100}
|
|
277
|
+
backgroundColor={Colors.shades.white}
|
|
278
|
+
padding={5}
|
|
279
|
+
onPress={() => setShowMarkets(false)}
|
|
280
|
+
/>
|
|
281
|
+
</View>
|
|
282
|
+
<View style={{ ...view_styles.section_body, padding:10 }}>
|
|
283
|
+
<FlatList
|
|
284
|
+
data={supported_markets}
|
|
285
|
+
renderItem={renderMarkets}
|
|
286
|
+
keyExtractor={(item) => item.market_id.toString()}
|
|
287
|
+
/>
|
|
288
|
+
</View>
|
|
289
|
+
</View>
|
|
290
|
+
:<></>}
|
|
291
|
+
</View>
|
|
292
|
+
:<></>}
|
|
240
293
|
{show_teams && teams.length > 0 ?
|
|
241
294
|
<View style={{ ...view_styles.section_body, padding:5 }}>
|
|
295
|
+
{wrap_markets ?
|
|
296
|
+
<View style={{ flexDirection:'row', flexWrap:'wrap', justifyContent:'center' }}>
|
|
297
|
+
{sorted_teams.map((t,i) => {
|
|
298
|
+
return renderTeams({ item:t, index:i })
|
|
299
|
+
})}
|
|
300
|
+
</View>
|
|
301
|
+
:
|
|
242
302
|
<FlatList
|
|
243
303
|
data={sorted_teams}
|
|
244
304
|
renderItem={renderTeams}
|
|
245
305
|
horizontal
|
|
246
306
|
keyExtractor={(item) => item.team_id.toString()}
|
|
247
307
|
/>
|
|
308
|
+
}
|
|
248
309
|
</View>
|
|
249
310
|
:<></>}
|
|
250
311
|
{show_athletes && athletes.length > 0 ?
|
|
251
312
|
<View style={{ ...view_styles.section_body, padding:5 }}>
|
|
313
|
+
{wrap_markets ?
|
|
314
|
+
<View style={{ flexDirection:'row', flexWrap:'wrap', justifyContent:'center' }}>
|
|
315
|
+
{sorted_athletes.map((a,i) => {
|
|
316
|
+
return renderAthletes({ item:a, index:i })
|
|
317
|
+
})}
|
|
318
|
+
</View>
|
|
319
|
+
:
|
|
252
320
|
<FlatList
|
|
253
321
|
data={sorted_athletes}
|
|
254
322
|
renderItem={renderAthletes}
|
|
255
323
|
horizontal
|
|
256
324
|
keyExtractor={(item) => item.athlete_id.toString()}
|
|
257
325
|
/>
|
|
326
|
+
}
|
|
258
327
|
</View>
|
|
259
328
|
:show_matches && matches.length > 0 ?
|
|
260
329
|
<View style={{ ...view_styles.section_body, padding:5 }}>
|
|
330
|
+
{wrap_markets ?
|
|
331
|
+
<View style={{ flexDirection:'row', flexWrap:'wrap', justifyContent:'center' }}>
|
|
332
|
+
{sorted_matches.map((m,i) => {
|
|
333
|
+
return renderMatches({ item:m, index:i })
|
|
334
|
+
})}
|
|
335
|
+
</View>
|
|
336
|
+
:
|
|
261
337
|
<FlatList
|
|
262
338
|
data={sorted_matches}
|
|
263
339
|
renderItem={renderMatches}
|
|
264
340
|
keyExtractor={(item) => item.match_id.toString()}
|
|
265
341
|
horizontal
|
|
266
342
|
/>
|
|
343
|
+
}
|
|
267
344
|
</View>
|
|
268
345
|
:<></>}
|
|
269
346
|
</View>
|
|
@@ -284,6 +361,8 @@ const TournamentMarket = ({ tournament, hide_match_liquidity, show_grades, hide_
|
|
|
284
361
|
</View>
|
|
285
362
|
</TouchableOpacity>
|
|
286
363
|
:<View style={{flex:1}} />}
|
|
364
|
+
{!market_selector_location ?
|
|
365
|
+
<View>
|
|
287
366
|
<TouchableOpacity style={{ flexDirection:'row', alignItems:'center', backgroundColor:Colors.shades.white, borderWidth:1, borderColor:Colors.shades.shade600, borderRadius:4, padding:10, ...view_styles.float }} onPress={() => setShowMarkets(!show_markets)}>
|
|
288
367
|
<Text style={{ marginRight:10 }} size={14} color={Colors.brand.midnight}>{active_market?.type == 'Stat' ? active_market.stat_label : active_market?.type}</Text>
|
|
289
368
|
<Icons.ChevronIcon color={Colors.brand.midnight} size={14} />
|
|
@@ -312,6 +391,8 @@ const TournamentMarket = ({ tournament, hide_match_liquidity, show_grades, hide_
|
|
|
312
391
|
</View>
|
|
313
392
|
</View>
|
|
314
393
|
:<></>}
|
|
394
|
+
</View>
|
|
395
|
+
:<></>}
|
|
315
396
|
</View>
|
|
316
397
|
</View>
|
|
317
398
|
)
|