be-components 6.9.0 → 6.9.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/Competition/components/CompetitionLeaderboard.js +22 -10
- package/lib/commonjs/Competition/components/CompetitionLeaderboard.js.map +1 -1
- package/lib/commonjs/Competition/components/WagerPickForm.js +2 -2
- package/lib/commonjs/Competition/components/WagerPickForm.js.map +1 -1
- package/lib/commonjs/Competition/index.js +91 -0
- package/lib/commonjs/Competition/index.js.map +1 -1
- package/lib/commonjs/CompetitionManager/api/index.js +19 -11
- package/lib/commonjs/CompetitionManager/api/index.js.map +1 -1
- package/lib/commonjs/CompetitionManager/components/CompetitionContestsForm.js +5 -3
- package/lib/commonjs/CompetitionManager/components/CompetitionContestsForm.js.map +1 -1
- package/lib/commonjs/CompetitionManager/components/CompetitionSettingsForm.js +50 -4
- package/lib/commonjs/CompetitionManager/components/CompetitionSettingsForm.js.map +1 -1
- package/lib/commonjs/CompetitionManager/components/ContestSelector.js +22 -6
- package/lib/commonjs/CompetitionManager/components/ContestSelector.js.map +1 -1
- package/lib/commonjs/CompetitionManager/components/ContestSettingsForm.js +28 -2
- package/lib/commonjs/CompetitionManager/components/ContestSettingsForm.js.map +1 -1
- package/lib/commonjs/CompetitionManager/components/MarketSelector.js +1 -3
- package/lib/commonjs/CompetitionManager/components/MarketSelector.js.map +1 -1
- package/lib/commonjs/CompetitionManager/index.js +14 -4
- package/lib/commonjs/CompetitionManager/index.js.map +1 -1
- package/lib/commonjs/Components/Dropdown.js +1 -0
- package/lib/commonjs/Components/Dropdown.js.map +1 -1
- package/lib/commonjs/CreateEngagement/index.js +1 -1
- package/lib/commonjs/CreateEngagement/index.js.map +1 -1
- package/lib/module/Competition/components/CompetitionLeaderboard.js +22 -10
- package/lib/module/Competition/components/CompetitionLeaderboard.js.map +1 -1
- package/lib/module/Competition/components/WagerPickForm.js +2 -2
- package/lib/module/Competition/components/WagerPickForm.js.map +1 -1
- package/lib/module/Competition/index.js +91 -0
- package/lib/module/Competition/index.js.map +1 -1
- package/lib/module/CompetitionManager/api/index.js +19 -11
- package/lib/module/CompetitionManager/api/index.js.map +1 -1
- package/lib/module/CompetitionManager/components/CompetitionContestsForm.js +5 -3
- package/lib/module/CompetitionManager/components/CompetitionContestsForm.js.map +1 -1
- package/lib/module/CompetitionManager/components/CompetitionSettingsForm.js +50 -4
- package/lib/module/CompetitionManager/components/CompetitionSettingsForm.js.map +1 -1
- package/lib/module/CompetitionManager/components/ContestSelector.js +24 -8
- package/lib/module/CompetitionManager/components/ContestSelector.js.map +1 -1
- package/lib/module/CompetitionManager/components/ContestSettingsForm.js +28 -2
- package/lib/module/CompetitionManager/components/ContestSettingsForm.js.map +1 -1
- package/lib/module/CompetitionManager/components/MarketSelector.js +1 -3
- package/lib/module/CompetitionManager/components/MarketSelector.js.map +1 -1
- package/lib/module/CompetitionManager/index.js +14 -4
- package/lib/module/CompetitionManager/index.js.map +1 -1
- package/lib/module/Components/Dropdown.js +1 -0
- package/lib/module/Components/Dropdown.js.map +1 -1
- package/lib/module/CreateEngagement/index.js +1 -1
- package/lib/module/CreateEngagement/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/Competition/components/CompetitionLeaderboard.d.ts +2 -1
- package/lib/typescript/lib/commonjs/Competition/components/CompetitionLeaderboard.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Competition/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/api/index.d.ts +1 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/components/CompetitionContestsForm.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/components/CompetitionSettingsForm.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/components/ContestSelector.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/components/ContestSettingsForm.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/components/MarketSelector.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Components/Dropdown.d.ts.map +1 -1
- package/lib/typescript/lib/module/Competition/components/CompetitionLeaderboard.d.ts +2 -1
- package/lib/typescript/lib/module/Competition/components/CompetitionLeaderboard.d.ts.map +1 -1
- package/lib/typescript/lib/module/Competition/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/CompetitionManager/api/index.d.ts +1 -1
- package/lib/typescript/lib/module/CompetitionManager/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/CompetitionManager/components/CompetitionContestsForm.d.ts.map +1 -1
- package/lib/typescript/lib/module/CompetitionManager/components/CompetitionSettingsForm.d.ts.map +1 -1
- package/lib/typescript/lib/module/CompetitionManager/components/ContestSelector.d.ts.map +1 -1
- package/lib/typescript/lib/module/CompetitionManager/components/ContestSettingsForm.d.ts.map +1 -1
- package/lib/typescript/lib/module/CompetitionManager/components/MarketSelector.d.ts.map +1 -1
- package/lib/typescript/lib/module/CompetitionManager/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Components/Dropdown.d.ts.map +1 -1
- package/lib/typescript/src/Competition/components/CompetitionLeaderboard.d.ts +7 -2
- package/lib/typescript/src/Competition/components/CompetitionLeaderboard.d.ts.map +1 -1
- package/lib/typescript/src/Competition/index.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/api/index.d.ts +2 -2
- package/lib/typescript/src/CompetitionManager/api/index.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/components/CompetitionSettingsForm.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/components/ContestSelector.d.ts +4 -3
- package/lib/typescript/src/CompetitionManager/components/ContestSelector.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/components/ContestSettingsForm.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/components/MarketSelector.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Competition/components/CompetitionLeaderboard.tsx +23 -7
- package/src/Competition/components/WagerPickForm.tsx +2 -2
- package/src/Competition/index.tsx +81 -2
- package/src/CompetitionManager/api/index.ts +14 -6
- package/src/CompetitionManager/components/CompetitionContestsForm.tsx +4 -4
- package/src/CompetitionManager/components/CompetitionSettingsForm.tsx +34 -1
- package/src/CompetitionManager/components/ContestSelector.tsx +31 -15
- package/src/CompetitionManager/components/ContestSettingsForm.tsx +19 -0
- package/src/CompetitionManager/components/MarketSelector.tsx +5 -7
- package/src/CompetitionManager/index.tsx +15 -7
- package/src/Components/Dropdown.tsx +1 -1
- package/src/CreateEngagement/index.tsx +1 -1
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { FlatList,
|
|
2
|
+
import { FlatList, Image, ActivityIndicator } from "react-native"
|
|
3
3
|
import { Switch } from '../../Components';
|
|
4
4
|
import DropDown from '../../Components/Dropdown';
|
|
5
|
-
import type { EventProps, LeagueProps } from '../../types';
|
|
6
|
-
import { ManageCompetitionMatchApi } from '../api';
|
|
5
|
+
import type { EventProps, LeagueProps, MarketProps, TradeProps } from '../../types';
|
|
6
|
+
import { ManageCompetitionApi, ManageCompetitionMarketApi, ManageCompetitionMatchApi } from '../api';
|
|
7
7
|
import moment from 'moment-mini';
|
|
8
8
|
import SearchBox from '../../Components/SearchBox';
|
|
9
9
|
import { useColors } from '../../constants/useColors';
|
|
10
10
|
import { Button, Text, View } from '../../Components/Themed';
|
|
11
|
+
import { MarketComponentHelpers } from '../../MarketComponents/api';
|
|
11
12
|
|
|
12
13
|
type ContestSelectorProps = {
|
|
13
14
|
action_loading:boolean,
|
|
14
15
|
leagues:LeagueProps[],
|
|
16
|
+
active_markets?:string[],
|
|
15
17
|
selected_team_events:EventProps[],
|
|
16
|
-
onSelectTeamEvent:(event:EventProps) => void,
|
|
17
|
-
onSelectTeamEvents: (events:EventProps[]) => void,
|
|
18
|
+
onSelectTeamEvent:(event:EventProps, trades:TradeProps[]) => void,
|
|
19
|
+
onSelectTeamEvents: (events:EventProps[], trades:TradeProps[]) => void,
|
|
18
20
|
onDeselectTeamEvent: (event:EventProps) => void,
|
|
19
21
|
onClose:() => void
|
|
20
22
|
}
|
|
@@ -30,17 +32,21 @@ const ContestSelector = ({ action_loading, leagues, selected_team_events, onClos
|
|
|
30
32
|
const [ selector_data, setData ] = useState<{
|
|
31
33
|
loading:boolean,
|
|
32
34
|
events:EventProps[],
|
|
35
|
+
markets:MarketProps[],
|
|
36
|
+
trades:TradeProps[],
|
|
33
37
|
range_dates:string[],
|
|
34
38
|
active_league?:LeagueProps,
|
|
35
39
|
active_date: string
|
|
36
40
|
}>({
|
|
37
41
|
loading:false,
|
|
42
|
+
markets:[],
|
|
38
43
|
events: [],
|
|
44
|
+
trades:[],
|
|
39
45
|
range_dates: [],
|
|
40
46
|
active_date: moment().format('YYYY/MM/DD')
|
|
41
47
|
})
|
|
42
48
|
|
|
43
|
-
const { loading, events, range_dates, active_league, active_date } = selector_data;
|
|
49
|
+
const { loading, events, range_dates, trades, markets, active_league, active_date } = selector_data;
|
|
44
50
|
|
|
45
51
|
let filtered_events = events.filter(e => `${e.event_id} ${e.away?.market_name} ${e.away?.name} ${e.home?.market_name} ${e.home?.name}`.toLowerCase().includes(search_value.toLowerCase()))
|
|
46
52
|
.filter(e => moment(e.scheduled_datetime).format('YYYY/MM/DD') == active_date)
|
|
@@ -69,6 +75,7 @@ const ContestSelector = ({ action_loading, leagues, selected_team_events, onClos
|
|
|
69
75
|
|
|
70
76
|
const show_add_all = filtered_events.filter(e => !selected_team_events.map(e => e.event_id.toString()).includes(e.event_id)).length > 0 ? true : false
|
|
71
77
|
|
|
78
|
+
const spread_market = markets.find(mk => mk.type == 'Spread');
|
|
72
79
|
|
|
73
80
|
useEffect(() => {
|
|
74
81
|
if(leagues.length == 0){ return }
|
|
@@ -89,7 +96,13 @@ const ContestSelector = ({ action_loading, leagues, selected_team_events, onClos
|
|
|
89
96
|
if(!best_day){
|
|
90
97
|
best_day = unique_dates[0] ?? moment().format('YYYY/MM/DD')
|
|
91
98
|
}
|
|
92
|
-
|
|
99
|
+
|
|
100
|
+
//Lets grab all the last trades for events that we have
|
|
101
|
+
let ev_markets = await ManageCompetitionApi.getMarkets();
|
|
102
|
+
let event_trades = await ManageCompetitionMarketApi.getLatestTradesByEventIds(resp.events.map(e => e.event_id), 'team');
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
setData({ ...selector_data, loading:false, events: resp.events, range_dates: unique_dates, active_date: best_day, trades: event_trades.filter(t => t.market_type == 'FOR_MONEY'), markets:ev_markets })
|
|
93
106
|
}
|
|
94
107
|
|
|
95
108
|
const renderDivisions = (data: { item:string, index:number }) => {
|
|
@@ -123,6 +136,9 @@ const ContestSelector = ({ action_loading, leagues, selected_team_events, onClos
|
|
|
123
136
|
const renderEvents = (data: { item:EventProps, index:number }) => {
|
|
124
137
|
const selected = selected_team_events.map(e => e.event_id.toString()).includes(data.item.event_id.toString()) ? true : false
|
|
125
138
|
const is_live = moment(data.item.scheduled_datetime).isBefore(moment()) ? true : false
|
|
139
|
+
const event_trades = trades.filter(t => t.event_type == 'team' && t.event_id == data.item.event_id && t.market_type == 'FOR_MONEY')
|
|
140
|
+
const spread_trades = event_trades.filter(t => t.market_id == spread_market?.market_id);
|
|
141
|
+
const home_trade = spread_trades.find(t => t.side_id == data.item.home_team_id)
|
|
126
142
|
return (
|
|
127
143
|
<View type='row' style={{ padding:10, borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
128
144
|
<View style={{ flexDirection:'row', alignItems:'center', paddingRight:10, borderRightWidth:1, borderColor:Colors.borders.light }}>
|
|
@@ -139,7 +155,7 @@ const ContestSelector = ({ action_loading, leagues, selected_team_events, onClos
|
|
|
139
155
|
/>
|
|
140
156
|
</View>
|
|
141
157
|
<View style={{ flex:1, marginLeft: 10 }}>
|
|
142
|
-
<Text theme='h2'>{data.item.event_title}</Text>
|
|
158
|
+
<Text theme='h2'>{data.item.event_title}{home_trade && spread_market?` ${MarketComponentHelpers.getVar1Label(spread_market, home_trade.var_1)}`:''}</Text>
|
|
143
159
|
<Text style={{ marginTop:3 }} theme='description'>{data.item.time_detail == 'scheduled' ? moment(data.item.scheduled_datetime).format('MMM DD hh:mm a'): data.item.time_detail}</Text>
|
|
144
160
|
</View>
|
|
145
161
|
{!is_live ?
|
|
@@ -149,7 +165,7 @@ const ContestSelector = ({ action_loading, leagues, selected_team_events, onClos
|
|
|
149
165
|
onChange={() => {
|
|
150
166
|
if(action_loading){ return }
|
|
151
167
|
if(selected){ return onDeselectTeamEvent(data.item) }
|
|
152
|
-
return onSelectTeamEvent(data.item)
|
|
168
|
+
return onSelectTeamEvent(data.item, event_trades)
|
|
153
169
|
}}
|
|
154
170
|
/>
|
|
155
171
|
:<></>}
|
|
@@ -159,7 +175,7 @@ const ContestSelector = ({ action_loading, leagues, selected_team_events, onClos
|
|
|
159
175
|
|
|
160
176
|
return (
|
|
161
177
|
<View float style={{ flex:1 }}>
|
|
162
|
-
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
|
|
178
|
+
<View type='header' style={{ flexDirection:'row', zIndex:10, alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
|
|
163
179
|
{active_league ?
|
|
164
180
|
<Image
|
|
165
181
|
source={{ uri: active_league.league_image }}
|
|
@@ -171,7 +187,7 @@ const ContestSelector = ({ action_loading, leagues, selected_team_events, onClos
|
|
|
171
187
|
<Text theme='h1'>MANAGE CONTESTS</Text>
|
|
172
188
|
<Text style={{ marginTop:3 }} theme='description'>Add / Remove contests from the competition</Text>
|
|
173
189
|
</View>
|
|
174
|
-
<View style={{ position: 'absolute',
|
|
190
|
+
<View style={{ position: 'absolute', top:10, right:10, justifyContent:'center', alignItems:'center' }}>
|
|
175
191
|
<DropDown
|
|
176
192
|
dropdown_options={[
|
|
177
193
|
{value:'league_id', eligible_options: leagues.sort((a,b) => a.priority - b.priority).map(l => l.league_name)}
|
|
@@ -184,7 +200,7 @@ const ContestSelector = ({ action_loading, leagues, selected_team_events, onClos
|
|
|
184
200
|
/>
|
|
185
201
|
</View>
|
|
186
202
|
</View>
|
|
187
|
-
<
|
|
203
|
+
<View style={{ flex:1 }}>
|
|
188
204
|
<View style={{ padding:10 }}>
|
|
189
205
|
<FlatList
|
|
190
206
|
data={range_dates}
|
|
@@ -224,7 +240,7 @@ const ContestSelector = ({ action_loading, leagues, selected_team_events, onClos
|
|
|
224
240
|
/>
|
|
225
241
|
</View>
|
|
226
242
|
:<></>}
|
|
227
|
-
<View style={{ padding:10 }}>
|
|
243
|
+
<View style={{ flex:1, padding:10 }}>
|
|
228
244
|
{loading ?
|
|
229
245
|
<ActivityIndicator style={{ padding:20, alignSelf:'center' }} size='large' color={Colors.text.h1} />
|
|
230
246
|
:<></>}
|
|
@@ -234,7 +250,7 @@ const ContestSelector = ({ action_loading, leagues, selected_team_events, onClos
|
|
|
234
250
|
keyExtractor={(item) => item.event_id.toString()}
|
|
235
251
|
/>
|
|
236
252
|
</View>
|
|
237
|
-
</
|
|
253
|
+
</View>
|
|
238
254
|
<View type='footer' style={{ flexDirection:'row', padding:10 }}>
|
|
239
255
|
{filtered_events.length > 0 ?
|
|
240
256
|
<Button
|
|
@@ -246,7 +262,7 @@ const ContestSelector = ({ action_loading, leagues, selected_team_events, onClos
|
|
|
246
262
|
onPress={() => {
|
|
247
263
|
///First remove any event that is already selected
|
|
248
264
|
let add_events = filtered_events.filter(e => !selected_team_events.map(e => e.event_id.toString()).includes(e.event_id))
|
|
249
|
-
onSelectTeamEvents(add_events);
|
|
265
|
+
onSelectTeamEvents(add_events, trades);
|
|
250
266
|
}}
|
|
251
267
|
/>
|
|
252
268
|
:<></>}
|
|
@@ -121,10 +121,21 @@ const ContestSettingsForm = ({ init_expanded, onFocusPosition, competition, comp
|
|
|
121
121
|
style={{ flex:1, minWidth:100, textAlign:'center', margin:5 }}
|
|
122
122
|
onChangeText={(text) => setDraftCompetition({ ...draft_competition, max_pick_count: text })}
|
|
123
123
|
placeholder="0"
|
|
124
|
+
onFocus={() => {
|
|
125
|
+
if(draft_competition.max_pick_count == 0){ setDraftCompetition({ ...draft_competition, max_pick_count: '' }) }
|
|
126
|
+
}}
|
|
124
127
|
onFocusPosition={onFocusPosition}
|
|
125
128
|
keyboardType="decimal-pad"
|
|
126
129
|
value={draft_competition.max_pick_count.toString()}
|
|
127
130
|
/>
|
|
131
|
+
{is_changed ?
|
|
132
|
+
<Button
|
|
133
|
+
title='SAVE'
|
|
134
|
+
type='success'
|
|
135
|
+
style={{ margin:5, padding:15, flexGrow:1 }}
|
|
136
|
+
onPress={() => onCompetitionUpdate(draft_competition)}
|
|
137
|
+
/>
|
|
138
|
+
:<></>}
|
|
128
139
|
</View>
|
|
129
140
|
:<></>}
|
|
130
141
|
{competition_type?.type == 'wager' ?
|
|
@@ -142,6 +153,14 @@ const ContestSettingsForm = ({ init_expanded, onFocusPosition, competition, comp
|
|
|
142
153
|
keyboardType="decimal-pad"
|
|
143
154
|
value={draft_competition.initial_balance.toString()}
|
|
144
155
|
/>
|
|
156
|
+
{is_changed ?
|
|
157
|
+
<Button
|
|
158
|
+
title='SAVE'
|
|
159
|
+
type='success'
|
|
160
|
+
style={{ margin:5, padding:15, flexGrow:1 }}
|
|
161
|
+
onPress={() => onCompetitionUpdate(draft_competition)}
|
|
162
|
+
/>
|
|
163
|
+
:<></>}
|
|
145
164
|
</View>
|
|
146
165
|
:<></>}
|
|
147
166
|
<View style={{ padding:20 }}>
|
|
@@ -55,13 +55,11 @@ const MarketSelector = ({ markets, selected_markets, onSelectMarket, onDeselectM
|
|
|
55
55
|
/>
|
|
56
56
|
</View>
|
|
57
57
|
<View style={{ flex:1 }}>
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
/>
|
|
64
|
-
</View>
|
|
58
|
+
<FlatList
|
|
59
|
+
data={filtered_markets}
|
|
60
|
+
renderItem={renderMarkets}
|
|
61
|
+
keyExtractor={(item) => item.market_id.toString()}
|
|
62
|
+
/>
|
|
65
63
|
</View>
|
|
66
64
|
<View type='footer' style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomRightRadius:8, borderBottomLeftRadius:8 }}>
|
|
67
65
|
<Button
|
|
@@ -249,7 +249,7 @@ const CompetitionManager = ({ float, header_style, footer_style, player_id, onFo
|
|
|
249
249
|
const addEvents = new_events.map(async e => {
|
|
250
250
|
const cm = await ManageCompetitionMatchApi.createCompetitionMatch(competition_id, e.event_id, 'team', 'event', undefined, undefined, undefined);
|
|
251
251
|
added_matches.push(cm)
|
|
252
|
-
})
|
|
252
|
+
});
|
|
253
253
|
await Promise.all(addEvents);
|
|
254
254
|
const e_trades = await ManageCompetitionMarketApi.getLatestTradesByEventIds(new_events.map(e => e.event_id), 'team');
|
|
255
255
|
setCompetitionData({
|
|
@@ -257,7 +257,7 @@ const CompetitionManager = ({ float, header_style, footer_style, player_id, onFo
|
|
|
257
257
|
competition: { ...competition, scheduled_datetime: undefined },
|
|
258
258
|
competition_matches: competition_matches.concat(added_matches),
|
|
259
259
|
events: events.filter(e => !new_events.find(ne => ne.event_id == e.event_id)).concat(new_events),
|
|
260
|
-
trades: trades.filter(t => !
|
|
260
|
+
trades: trades.filter(t => !new_events.map(e => e.event_id.toString()).includes(t.event_id.toString())).concat(e_trades)
|
|
261
261
|
})
|
|
262
262
|
setActionLoading(false)
|
|
263
263
|
}
|
|
@@ -280,18 +280,26 @@ const CompetitionManager = ({ float, header_style, footer_style, player_id, onFo
|
|
|
280
280
|
const handleRemoveCompetitionMatch = async(competition_match_id:string) => {
|
|
281
281
|
if(action_loading){ return }
|
|
282
282
|
setActionLoading(true);
|
|
283
|
-
await ManageCompetitionMatchApi.deleteCompetitionMatch(competition_match_id);
|
|
283
|
+
let result = await ManageCompetitionMatchApi.deleteCompetitionMatch(competition_match_id);
|
|
284
|
+
if(!result){
|
|
285
|
+
setActionLoading(false);
|
|
286
|
+
return alert('Unable to remove this market. It could either be the event has already started or a player has already made a pick on it.')
|
|
287
|
+
}
|
|
284
288
|
setCompetitionData({
|
|
285
289
|
...competition_data,
|
|
286
290
|
competition_matches: competition_matches.filter(cm => cm.competition_match_id != competition_match_id)
|
|
287
|
-
})
|
|
291
|
+
});
|
|
288
292
|
setActionLoading(false)
|
|
289
293
|
}
|
|
290
294
|
|
|
291
295
|
const handleRemoveCompetitionMatchMarkets = async(cmms:CompetitionMatchMarketProps[]) => {
|
|
292
296
|
if(action_loading){ return }
|
|
293
297
|
setActionLoading(true);
|
|
294
|
-
await ManageCompetitionMatchApi.deleteCompetitionMatchMarkets(cmms.map(cmm => cmm.competition_match_market_id));
|
|
298
|
+
let result = await ManageCompetitionMatchApi.deleteCompetitionMatchMarkets(cmms.map(cmm => cmm.competition_match_market_id));
|
|
299
|
+
if(!result){
|
|
300
|
+
setActionLoading(false);
|
|
301
|
+
return alert('Unable to remove this market. It could either be the event has already started or a player has already made a pick on it.')
|
|
302
|
+
}
|
|
295
303
|
setCompetitionData({
|
|
296
304
|
...competition_data,
|
|
297
305
|
competition_match_markets: competition_match_markets.filter(cmm => !cmms.map(rmm => rmm.competition_match_market_id.toString()).includes(cmm.competition_match_market_id))
|
|
@@ -365,6 +373,7 @@ const CompetitionManager = ({ float, header_style, footer_style, player_id, onFo
|
|
|
365
373
|
let markets_removed:string[] = []
|
|
366
374
|
const rem_non_primary = non_primary_matches.map(async cm => {
|
|
367
375
|
const del_response = await ManageCompetitionMatchApi.deleteCompetitionMatch(cm.competition_match_id);
|
|
376
|
+
if(!del_response){ return } //We had an issue tring to remove this
|
|
368
377
|
matches_removed = matches_removed.concat(del_response.competition_match.competition_match_id)
|
|
369
378
|
markets_removed = markets_removed.concat(del_response.competition_match_markets.map(cmm => cmm.competition_match_market_id))
|
|
370
379
|
})
|
|
@@ -427,7 +436,6 @@ const CompetitionManager = ({ float, header_style, footer_style, player_id, onFo
|
|
|
427
436
|
if(market.level == 'event'){
|
|
428
437
|
//If the level is event - we need to create some events
|
|
429
438
|
let market_trades = trades.filter(t => t.market_type == 'FOR_MONEY' && t.event_id == contest_id && t.event_type == contest_type && t.market_id == market.market_id)
|
|
430
|
-
console.log(`market trades are ${market_trades.length}`)
|
|
431
439
|
let event_cmms:CompetitionMatchMarketProps[] = []
|
|
432
440
|
market_trades.map(t => {
|
|
433
441
|
event_cmms.push({ ...ManageCompetitionHelpers.createCompetitionMatchMarketFromTrade(t), competition_match_id: new_cm.competition_match_id })
|
|
@@ -691,7 +699,7 @@ const CompetitionManager = ({ float, header_style, footer_style, player_id, onFo
|
|
|
691
699
|
</View>
|
|
692
700
|
:<></>}
|
|
693
701
|
{show_markets.contest_id && show_markets.contest_type && showing_market_event ?
|
|
694
|
-
<View type='blur' style={{
|
|
702
|
+
<View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, paddingBottom:insets?.bottom, paddingTop:insets?.top }}>
|
|
695
703
|
<MarketSelector
|
|
696
704
|
markets={markets.filter(m => m.event_type == show_markets.contest_type && showing_market_event.supported_markets?.map(m => m.market_id.toString()).includes(m.market_id.toString()))}
|
|
697
705
|
onClose={() => setShowMarkets({})}
|
|
@@ -37,7 +37,7 @@ const DropDown = ({ invalid, errors, read_only, selected_value, dropdown_options
|
|
|
37
37
|
const renderOptions = (data: { item: string, index:number }) => {
|
|
38
38
|
const last_item = data.index == options.length - 1 ? true : false
|
|
39
39
|
return (
|
|
40
|
-
<Button transparent style={{ paddingTop:10, paddingBottom:last_item?0:10, borderBottomWidth:last_item?0:1, borderColor:Colors.borders.light }} onPress={() => handleOptionSelect(data.item)}>
|
|
40
|
+
<Button transparent style={{ borderRadius:0, paddingTop:10, paddingBottom:last_item?0:10, borderBottomWidth:last_item?0:1, borderColor:Colors.borders.light }} onPress={() => handleOptionSelect(data.item)}>
|
|
41
41
|
<Text size={14} theme='description'>{data.item}</Text>
|
|
42
42
|
</Button>
|
|
43
43
|
)
|
|
@@ -31,7 +31,7 @@ const steps:CreateEngagementStepProps[] = [
|
|
|
31
31
|
{ step_key: 'intro', num: 1, title: 'BettorEdge Engagements', description: 'Create an engagement and share with friends to play along' },
|
|
32
32
|
{ step_key: 'options', num:2, title: 'Engagement Types', description: 'Select an engagement type below to get started!' },
|
|
33
33
|
{ step_key: 'group', num:3, title: 'Add Group', description: 'Select one of your groups to add this engagement to!' },
|
|
34
|
-
{ step_key: 'company', num:4, title: 'Add Company', description: 'Select one of your
|
|
34
|
+
{ step_key: 'company', num:4, title: 'Add Company', description: 'Select one of your companies to add this engagement to!' },
|
|
35
35
|
{ step_key: 'image', num:5, title:'Add an Image!', description: 'Add an image to your engagement to make it stand out!' },
|
|
36
36
|
{ step_key: 'create', num:6, title: 'Create Engagement', description: 'Complete the step below to create this BettorEdge Engagement!' },
|
|
37
37
|
{ step_key: 'success', num:7, title: 'Engagement Successfully Created!', description: 'Your engagement is in pending status. You can activate it when ready from your dashboard or the engagement screen!' }
|