be-components 1.7.8 → 1.8.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/AdServer/index.js +0 -1
- package/lib/commonjs/AdServer/index.js.map +1 -1
- package/lib/commonjs/CompetitionManager/components/CompetitionContestsForm.js +39 -2
- package/lib/commonjs/CompetitionManager/components/CompetitionContestsForm.js.map +1 -1
- package/lib/commonjs/CompetitionManager/components/CompetitionInfoForm.js +1 -71
- package/lib/commonjs/CompetitionManager/components/CompetitionInfoForm.js.map +1 -1
- package/lib/commonjs/CompetitionManager/components/CompetitionSettingsForm.js.map +1 -1
- package/lib/commonjs/CompetitionManager/index.js +9 -0
- package/lib/commonjs/CompetitionManager/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/TeamEventMarket/api/index.js +2 -7
- package/lib/commonjs/MarketComponents/components/TeamEventMarket/api/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js +97 -8
- package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
- package/lib/module/AdServer/index.js +0 -1
- package/lib/module/AdServer/index.js.map +1 -1
- package/lib/module/CompetitionManager/components/CompetitionContestsForm.js +39 -2
- package/lib/module/CompetitionManager/components/CompetitionContestsForm.js.map +1 -1
- package/lib/module/CompetitionManager/components/CompetitionInfoForm.js +1 -71
- package/lib/module/CompetitionManager/components/CompetitionInfoForm.js.map +1 -1
- package/lib/module/CompetitionManager/components/CompetitionSettingsForm.js.map +1 -1
- package/lib/module/CompetitionManager/index.js +9 -0
- package/lib/module/CompetitionManager/index.js.map +1 -1
- package/lib/module/MarketComponents/components/TeamEventMarket/api/index.js +2 -7
- package/lib/module/MarketComponents/components/TeamEventMarket/api/index.js.map +1 -1
- package/lib/module/MarketComponents/components/TeamEventMarket/index.js +98 -9
- package/lib/module/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
- package/lib/typescript/src/AdServer/index.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/components/CompetitionContestsForm.d.ts +4 -2
- package/lib/typescript/src/CompetitionManager/components/CompetitionContestsForm.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/components/CompetitionInfoForm.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/components/CompetitionSettingsForm.d.ts +2 -2
- package/lib/typescript/src/CompetitionManager/components/CompetitionSettingsForm.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/components/TeamEventMarket/api/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts +2 -2
- package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/index.d.ts +2 -2
- package/lib/typescript/src/MarketComponents/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/AdServer/index.tsx +0 -1
- package/src/CompetitionManager/components/CompetitionContestsForm.tsx +24 -2
- package/src/CompetitionManager/components/CompetitionInfoForm.tsx +0 -31
- package/src/CompetitionManager/components/CompetitionSettingsForm.tsx +3 -3
- package/src/CompetitionManager/index.tsx +6 -0
- package/src/MarketComponents/components/TeamEventMarket/api/index.ts +2 -5
- package/src/MarketComponents/components/TeamEventMarket/index.tsx +59 -12
- package/src/types.d.ts +1 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FlatList, TextInput, TouchableOpacity, View, Image } from "react-native"
|
|
2
2
|
import React, { useEffect, useState } from "react";
|
|
3
|
-
import type { CompetitionProps, CompetitionResultTypeProps, PublicPlayerProps } from "../../types";
|
|
3
|
+
import type { CompetitionProps, CompetitionResultTypeProps, MyPlayerProps, PublicPlayerProps } from "../../types";
|
|
4
4
|
import { ManageCompetitionApi } from "../api";
|
|
5
5
|
import Colors from "../../constants/colors";
|
|
6
6
|
import { Button, Icons, Text } from "../../Components";
|
|
@@ -9,7 +9,7 @@ import DropDown from "../../Components/Dropdown";
|
|
|
9
9
|
import moment from "moment-mini";
|
|
10
10
|
|
|
11
11
|
type CompetitionSettingsFormProps = {
|
|
12
|
-
player?:
|
|
12
|
+
player?: MyPlayerProps,
|
|
13
13
|
competition: CompetitionProps,
|
|
14
14
|
width:number,
|
|
15
15
|
is_valid?:boolean,
|
|
@@ -24,7 +24,7 @@ const CompetitionSettingsForm = ({ is_valid, player, width, competition, competi
|
|
|
24
24
|
const [ expanded, setExpanded ] = useState(false);
|
|
25
25
|
const [ draft_competition, setDraftCompetition ] = useState<CompetitionProps | undefined>(undefined);
|
|
26
26
|
//const [ player_selector_visible, setPlayerSelectorVisible ] = useState(false);
|
|
27
|
-
const [ pacer, setPacer ] = useState<PublicPlayerProps>();
|
|
27
|
+
const [ pacer, setPacer ] = useState<PublicPlayerProps | MyPlayerProps>();
|
|
28
28
|
|
|
29
29
|
const competition_result_type = competition_result_types.find(crt => crt.competition_result_type_id == competition?.competition_result_type_id);
|
|
30
30
|
|
|
@@ -467,6 +467,7 @@ const CompetitionManager = ({ player_id, competition_id, onClose }:CompetitionMa
|
|
|
467
467
|
is_valid={competition_valid.settings}
|
|
468
468
|
competition={competition}
|
|
469
469
|
width={module_size.width - 20}
|
|
470
|
+
player={player}
|
|
470
471
|
onShowPacers={() => setShowPacers(true)}
|
|
471
472
|
competition_result_types={competition_result_types}
|
|
472
473
|
onCompetitionUpdate={async(comp) => {
|
|
@@ -478,6 +479,7 @@ const CompetitionManager = ({ player_id, competition_id, onClose }:CompetitionMa
|
|
|
478
479
|
action_loading={action_loading}
|
|
479
480
|
is_valid={competition_valid.contests}
|
|
480
481
|
width={module_size.width - 20}
|
|
482
|
+
player={player}
|
|
481
483
|
competition={competition}
|
|
482
484
|
competition_matches={competition_matches}
|
|
483
485
|
competition_match_markets={competition_match_markets}
|
|
@@ -494,6 +496,10 @@ const CompetitionManager = ({ player_id, competition_id, onClose }:CompetitionMa
|
|
|
494
496
|
onDeleteMarket={(contest_id, contest_type, market) => handleRemoveMarket(contest_id, contest_type, market)}
|
|
495
497
|
onShowAthletes={(contest_id, contest_type, market_id) => setShowAthletes({ contest_id, contest_type, market_id, filtered_positions:[] })}
|
|
496
498
|
onShowMarkets={(contest_id, contest_type) => setShowMarkets({ contest_id, contest_type })}
|
|
499
|
+
onUpdateCompetition={async(comp) => {
|
|
500
|
+
const new_c = await ManageCompetitionApi.updateCompetition(comp);
|
|
501
|
+
setCompetitionData({ ...competition_data, competition: new_c });
|
|
502
|
+
}}
|
|
497
503
|
onShowContests={() => setShowContests({ visible:true })}
|
|
498
504
|
onSaveCompetitionMatch={() => console.log('SAVE EVENT')}
|
|
499
505
|
onDeleteCompetitionMatch={(competition_match_id) => handleRemoveCompetitionMatch(competition_match_id)}
|
|
@@ -18,18 +18,15 @@ const TeamEventMarketHelpers = {
|
|
|
18
18
|
return event.time_detail
|
|
19
19
|
},
|
|
20
20
|
sortNonPrimaryMarkets: (markets:MarketProps[], event_order_stats:EventOrderStatProps[], latest_trades:TradeProps[]) => {
|
|
21
|
-
let available = false
|
|
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
24
|
//Now need to combine event level markets
|
|
24
25
|
let event_level_markets:EventOrderStatProps[] = []
|
|
25
26
|
let non_event_level_markets:EventOrderStatProps[] = []
|
|
26
27
|
sorted_stats.map(ss => {
|
|
27
28
|
let market = markets.find(m => m.market_id == ss.market_id);
|
|
28
29
|
if(!market){ return }
|
|
29
|
-
if(!available){
|
|
30
|
-
let trade = latest_trades.find(t => t.market_id == ss.market_id)
|
|
31
|
-
if(trade){ available = true }
|
|
32
|
-
}
|
|
33
30
|
if(market.level == 'event'){ return event_level_markets.push(ss) }
|
|
34
31
|
return non_event_level_markets.push(ss)
|
|
35
32
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { View, Image, FlatList, TouchableOpacity, ActivityIndicator } from 'react-native';
|
|
2
|
+
import { View, Image, FlatList, TouchableOpacity, ActivityIndicator, ScrollView } from 'react-native';
|
|
3
3
|
import type { AthleteProps, BestAvailableOrderProps, CompetitionProps, EventOrderStatProps, EventProps, MarketProps, MarketSideOptionProps, OrderProps, SquaresCompetitionProps, TradeProps } from '../../../types';
|
|
4
4
|
import { view_styles } from '../../../constants/styles';
|
|
5
5
|
import { Button, Icons, LinearDiagnal, Text } from '../../../Components';
|
|
@@ -16,7 +16,7 @@ type TeamEventMarketProps = {
|
|
|
16
16
|
event:EventProps,
|
|
17
17
|
markets:MarketProps[],
|
|
18
18
|
init_expanded?:boolean,
|
|
19
|
-
|
|
19
|
+
competitions?:CompetitionProps[],
|
|
20
20
|
show_id?:string,
|
|
21
21
|
squares_competition?:SquaresCompetitionProps,
|
|
22
22
|
latest_trades:TradeProps[],
|
|
@@ -34,7 +34,7 @@ type TeamEventMarketProps = {
|
|
|
34
34
|
onActivate?:(event_id:string, event_type:string) => void
|
|
35
35
|
activate_loading?:boolean
|
|
36
36
|
}
|
|
37
|
-
const TeamEventMarket = ({ event, init_expanded, show_id, activate_loading,
|
|
37
|
+
const TeamEventMarket = ({ event, init_expanded, show_id, activate_loading, competitions, squares_competition, show_grades, markets, latest_trades, best_available_orders, event_order_stats, default_price_view, onSquaresSelect, onCompetitionSelect, onExpand, onOrder, onView, onViewAdditionalMarkets, onTradeLongPress, onActivate }:TeamEventMarketProps) => {
|
|
38
38
|
const [ expanded_data, setExpandedData ] = useState<{
|
|
39
39
|
expanded:boolean,
|
|
40
40
|
loaded:boolean,
|
|
@@ -46,9 +46,10 @@ const TeamEventMarket = ({ event, init_expanded, show_id, activate_loading, comp
|
|
|
46
46
|
expanded:false,
|
|
47
47
|
athletes:[]
|
|
48
48
|
})
|
|
49
|
+
const [ competitions_expanded, setCompetitionsExpanded ] = useState(false);
|
|
49
50
|
const { expanded, athletes, loaded, loading } = expanded_data;
|
|
50
51
|
const event_status = TeamEventMarketHelpers.getEventStatus(event);
|
|
51
|
-
|
|
52
|
+
console.log(competitions)
|
|
52
53
|
useEffect(() => {
|
|
53
54
|
MarketComponentApi.setEnvironment();
|
|
54
55
|
if(init_expanded){ expandedEvent(); }
|
|
@@ -76,6 +77,30 @@ const TeamEventMarket = ({ event, init_expanded, show_id, activate_loading, comp
|
|
|
76
77
|
|
|
77
78
|
const primary_markets = TeamEventMarketHelpers.getPrimaryMarkets(event, markets);
|
|
78
79
|
|
|
80
|
+
const handleSelectCompetition = () => {
|
|
81
|
+
if(!competitions || competitions.length == 0){ return }
|
|
82
|
+
if(competitions.length == 1 && competitions[0]){ return onCompetitionSelect(competitions[0].competition_id) }
|
|
83
|
+
return setCompetitionsExpanded(true);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const renderCompetitions = (data:{ item:CompetitionProps, index: number }) => {
|
|
87
|
+
return (
|
|
88
|
+
<TouchableOpacity style={{ ...view_styles.body_row, padding:10, borderBottomWidth:1, borderColor:Colors.shades.shade600 }} onPress={() => {
|
|
89
|
+
setCompetitionsExpanded(false);
|
|
90
|
+
onCompetitionSelect(data.item.competition_id)
|
|
91
|
+
}}>
|
|
92
|
+
<Image
|
|
93
|
+
source={{ uri: data.item.image?.url }}
|
|
94
|
+
style={{ height:25, width:25 }}
|
|
95
|
+
resizeMode='cover'
|
|
96
|
+
/>
|
|
97
|
+
<View style={{ flex:1, marginLeft:10 }}>
|
|
98
|
+
<Text theme='header_2'>{data.item.competition_name}</Text>
|
|
99
|
+
</View>
|
|
100
|
+
<Icons.ChevronIcon direction='right' size={10} color={Colors.brand.midnight} />
|
|
101
|
+
</TouchableOpacity>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
79
104
|
|
|
80
105
|
const renderSides = (data:{ item:MarketSideOptionProps, index:number, market:MarketProps, is_locked:boolean }) => {
|
|
81
106
|
const ba_order = best_available_orders.find(o => o.market_id == data.market.market_id && o.side == data.item.side)
|
|
@@ -185,9 +210,7 @@ const TeamEventMarket = ({ event, init_expanded, show_id, activate_loading, comp
|
|
|
185
210
|
if(!event.away || !event.home){ return <></> }
|
|
186
211
|
|
|
187
212
|
const { liquidity, open_order_count } = MarketComponentHelpers.getLiqudity(event_order_stats);
|
|
188
|
-
|
|
189
213
|
const { non_primary_markets, available } = TeamEventMarketHelpers.sortNonPrimaryMarkets(TeamEventMarketHelpers.getNonPrimaryMarkets(event, markets), event_order_stats, latest_trades)
|
|
190
|
-
|
|
191
214
|
return (
|
|
192
215
|
<View style={{ ...view_styles.section, borderWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
193
216
|
<View nativeID='event_header_data' style={{ flexDirection:'row', padding:10, borderBottomWidth:1, borderBottomColor:Colors.shades.shade600 }}>
|
|
@@ -301,18 +324,18 @@ const TeamEventMarket = ({ event, init_expanded, show_id, activate_loading, comp
|
|
|
301
324
|
</TouchableOpacity>
|
|
302
325
|
{squares_competition ?
|
|
303
326
|
<TouchableOpacity
|
|
304
|
-
style={{ marginRight:
|
|
327
|
+
style={{ marginRight:5, flexDirection:'row', alignItems:'center', padding:10, borderRadius:22, backgroundColor:Colors.highlights.highlight100, ...view_styles.float }}
|
|
305
328
|
onPress={() => onSquaresSelect(squares_competition.sq_comp_id)}>
|
|
306
329
|
<Icons.SquaresIcon size={18} color={Colors.shades.white} />
|
|
307
330
|
<Text style={{ marginLeft:5 }} size={14} color={Colors.shades.white} weight='semibold'>Squares</Text>
|
|
308
331
|
</TouchableOpacity>
|
|
309
332
|
:<></>}
|
|
310
|
-
{
|
|
333
|
+
{competitions ?
|
|
311
334
|
<TouchableOpacity
|
|
312
|
-
style={{ marginRight:
|
|
313
|
-
onPress={() =>
|
|
314
|
-
<Icons.PickEmIcon size={
|
|
315
|
-
<Text style={{ marginLeft:5 }} size={14} color={Colors.shades.white} weight='semibold'>
|
|
335
|
+
style={{ marginRight:5, flexDirection:'row', alignItems:'center', padding:10, borderRadius:22, backgroundColor:Colors.highlights.highlight500, ...view_styles.float }}
|
|
336
|
+
onPress={() => handleSelectCompetition()}>
|
|
337
|
+
<Icons.PickEmIcon size={14} color={Colors.shades.white} />
|
|
338
|
+
<Text style={{ marginLeft:5 }} size={14} color={Colors.shades.white} weight='semibold'>MultiPick</Text>
|
|
316
339
|
</TouchableOpacity>
|
|
317
340
|
:<></>}
|
|
318
341
|
{non_primary_markets.length > 0 ?
|
|
@@ -327,6 +350,30 @@ const TeamEventMarket = ({ event, init_expanded, show_id, activate_loading, comp
|
|
|
327
350
|
onPress={() => onViewAdditionalMarkets(event.event_id, 'team')}
|
|
328
351
|
/>
|
|
329
352
|
:<></>}
|
|
353
|
+
{competitions && competitions_expanded ?
|
|
354
|
+
<View style={{ position:'absolute', bottom:0, right:0, ...view_styles.section, minWidth:300, maxHeight:220 }}>
|
|
355
|
+
<TouchableOpacity style={{ ...view_styles.section_header, padding:15, paddingRight:10, backgroundColor:Colors.highlights.highlight500 }} onPress={() => setCompetitionsExpanded(false)}>
|
|
356
|
+
<Icons.PickEmIcon size={16} color={Colors.shades.white} />
|
|
357
|
+
<Text style={{ flex:1, marginLeft:10 }} size={16} weight='bold' color={Colors.shades.white}>Select Competition</Text>
|
|
358
|
+
<Button
|
|
359
|
+
title='X'
|
|
360
|
+
backgroundColor='transparent'
|
|
361
|
+
title_color={Colors.utility.error}
|
|
362
|
+
disabled
|
|
363
|
+
title_size={16}
|
|
364
|
+
padding={0}
|
|
365
|
+
onPress={() => console.log('')}
|
|
366
|
+
/>
|
|
367
|
+
</TouchableOpacity>
|
|
368
|
+
<ScrollView style={{flex:1}}>
|
|
369
|
+
<FlatList
|
|
370
|
+
data={competitions}
|
|
371
|
+
renderItem={renderCompetitions}
|
|
372
|
+
keyExtractor={(item) => item.competition_id.toString()}
|
|
373
|
+
/>
|
|
374
|
+
</ScrollView>
|
|
375
|
+
</View>
|
|
376
|
+
:<></>}
|
|
330
377
|
</View>
|
|
331
378
|
:<></>}
|
|
332
379
|
{expanded ?
|
package/src/types.d.ts
CHANGED
|
@@ -1041,6 +1041,7 @@ export interface CompetitionProps {
|
|
|
1041
1041
|
template?:boolean,
|
|
1042
1042
|
buy_in:number | string,
|
|
1043
1043
|
linked_event_id?:string,
|
|
1044
|
+
linked_event_ids?:string[],
|
|
1044
1045
|
linked_event_type?:string,
|
|
1045
1046
|
league_name?:string,
|
|
1046
1047
|
template_competition_id?:string,
|