be-components 5.9.7 → 5.9.8
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/api/index.js +136 -0
- package/lib/commonjs/MarketComponents/api/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/MarketManager/MarketResolveForm.js +553 -0
- package/lib/commonjs/MarketComponents/components/MarketManager/MarketResolveForm.js.map +1 -0
- package/lib/commonjs/MarketComponents/components/MarketManager/MarketRollbackForm.js +315 -0
- package/lib/commonjs/MarketComponents/components/MarketManager/MarketRollbackForm.js.map +1 -0
- package/lib/commonjs/MarketComponents/components/MarketManager/index.js +570 -0
- package/lib/commonjs/MarketComponents/components/MarketManager/index.js.map +1 -0
- package/lib/commonjs/MarketComponents/index.js +2 -0
- package/lib/commonjs/MarketComponents/index.js.map +1 -1
- package/lib/module/MarketComponents/api/index.js +136 -0
- package/lib/module/MarketComponents/api/index.js.map +1 -1
- package/lib/module/MarketComponents/components/MarketManager/MarketResolveForm.js +544 -0
- package/lib/module/MarketComponents/components/MarketManager/MarketResolveForm.js.map +1 -0
- package/lib/module/MarketComponents/components/MarketManager/MarketRollbackForm.js +307 -0
- package/lib/module/MarketComponents/components/MarketManager/MarketRollbackForm.js.map +1 -0
- package/lib/module/MarketComponents/components/MarketManager/index.js +561 -0
- package/lib/module/MarketComponents/components/MarketManager/index.js.map +1 -0
- package/lib/module/MarketComponents/index.js +2 -0
- package/lib/module/MarketComponents/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/MarketComponents/api/index.d.ts +21 -0
- package/lib/typescript/lib/commonjs/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/MarketComponents/components/MarketManager/MarketResolveForm.d.ts +14 -0
- package/lib/typescript/lib/commonjs/MarketComponents/components/MarketManager/MarketResolveForm.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/MarketComponents/components/MarketManager/MarketRollbackForm.d.ts +15 -0
- package/lib/typescript/lib/commonjs/MarketComponents/components/MarketManager/MarketRollbackForm.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/MarketComponents/components/MarketManager/index.d.ts +9 -0
- package/lib/typescript/lib/commonjs/MarketComponents/components/MarketManager/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/MarketComponents/index.d.ts +1 -0
- package/lib/typescript/lib/module/MarketComponents/api/index.d.ts +21 -0
- package/lib/typescript/lib/module/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/MarketComponents/components/MarketManager/MarketResolveForm.d.ts +14 -0
- package/lib/typescript/lib/module/MarketComponents/components/MarketManager/MarketResolveForm.d.ts.map +1 -0
- package/lib/typescript/lib/module/MarketComponents/components/MarketManager/MarketRollbackForm.d.ts +15 -0
- package/lib/typescript/lib/module/MarketComponents/components/MarketManager/MarketRollbackForm.d.ts.map +1 -0
- package/lib/typescript/lib/module/MarketComponents/components/MarketManager/index.d.ts +9 -0
- package/lib/typescript/lib/module/MarketComponents/components/MarketManager/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/MarketComponents/index.d.ts +2 -0
- package/lib/typescript/lib/module/MarketComponents/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/api/index.d.ts +33 -1
- package/lib/typescript/src/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/components/MarketManager/MarketResolveForm.d.ts +17 -0
- package/lib/typescript/src/MarketComponents/components/MarketManager/MarketResolveForm.d.ts.map +1 -0
- package/lib/typescript/src/MarketComponents/components/MarketManager/MarketRollbackForm.d.ts +17 -0
- package/lib/typescript/src/MarketComponents/components/MarketManager/MarketRollbackForm.d.ts.map +1 -0
- package/lib/typescript/src/MarketComponents/components/MarketManager/index.d.ts +10 -0
- package/lib/typescript/src/MarketComponents/components/MarketManager/index.d.ts.map +1 -0
- package/lib/typescript/src/MarketComponents/index.d.ts +6 -0
- package/lib/typescript/src/MarketComponents/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/MarketComponents/api/index.ts +93 -1
- package/src/MarketComponents/components/MarketManager/MarketResolveForm.tsx +354 -0
- package/src/MarketComponents/components/MarketManager/MarketRollbackForm.tsx +202 -0
- package/src/MarketComponents/components/MarketManager/index.tsx +392 -0
- package/src/MarketComponents/index.tsx +2 -0
- package/src/types.d.ts +25 -0
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { Button, Text, View } from "../../../Components/Themed"
|
|
3
|
+
import type { AthleteProps, EventProps, MarketProps, MarketStatsProps, MatchProps, TeamProps, TournamentProps } from '../../../types';
|
|
4
|
+
import { MarketComponentApi, MarketComponentHelpers } from '../../api';
|
|
5
|
+
import { Alert, FlatList, Platform } from 'react-native';
|
|
6
|
+
import { useColors } from '../../../constants/useColors';
|
|
7
|
+
import { AthleteImage, TeamImage } from '../../../Components/Jerseys';
|
|
8
|
+
import MarketRollbackForm from './MarketRollbackForm';
|
|
9
|
+
import MarketResolveForm from './MarketResolveForm';
|
|
10
|
+
|
|
11
|
+
type MarketManagerProps = {
|
|
12
|
+
player_id?:string,
|
|
13
|
+
contest_type:string,
|
|
14
|
+
contest_id:string,
|
|
15
|
+
onClose:() => void
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const manage_sections = ['header','total_stats','markets','orders']
|
|
19
|
+
|
|
20
|
+
const MarketManager = ({ player_id, contest_type, contest_id, onClose }:MarketManagerProps) => {
|
|
21
|
+
const Colors = useColors();
|
|
22
|
+
const [ rollback, setRollback ] = useState<{
|
|
23
|
+
visible:boolean,
|
|
24
|
+
market?:MarketProps,
|
|
25
|
+
side_type?:string,
|
|
26
|
+
side_id?:string
|
|
27
|
+
}>({
|
|
28
|
+
visible: false
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const [ resolve, setResolve ] = useState<{
|
|
32
|
+
visible:boolean,
|
|
33
|
+
market?:MarketProps,
|
|
34
|
+
side_type?:string,
|
|
35
|
+
side_id?:string
|
|
36
|
+
}>({
|
|
37
|
+
visible: false
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const [ active_market, setActiveMarket ] = useState<MarketProps|undefined>(undefined);
|
|
41
|
+
const [ form_data, setFormData ] = useState<{
|
|
42
|
+
loading: boolean,
|
|
43
|
+
action_loading:boolean,
|
|
44
|
+
markets:MarketProps[],
|
|
45
|
+
market_stats:MarketStatsProps[],
|
|
46
|
+
athletes:AthleteProps[],
|
|
47
|
+
teams:TeamProps[],
|
|
48
|
+
event?:EventProps,
|
|
49
|
+
tournament?:TournamentProps,
|
|
50
|
+
match?:MatchProps,
|
|
51
|
+
}>({
|
|
52
|
+
loading:false,
|
|
53
|
+
action_loading:false,
|
|
54
|
+
athletes: [],
|
|
55
|
+
teams:[],
|
|
56
|
+
markets: [],
|
|
57
|
+
market_stats: []
|
|
58
|
+
});
|
|
59
|
+
const { market_stats, event, tournament, match, markets, athletes, teams } = form_data;
|
|
60
|
+
const { closed, total_volume, commission, routing_prem, reconciliation, total_unresolved } = MarketComponentHelpers.getReconFromMarketStats(market_stats);
|
|
61
|
+
const { contest_title } = MarketComponentHelpers.getContestDetails(contest_type, event, tournament, match);
|
|
62
|
+
const supported_markets = MarketComponentHelpers.sortMarketStats(market_stats, MarketComponentHelpers.getSupportedMarkets(contest_type, markets, event, tournament, match));
|
|
63
|
+
|
|
64
|
+
const selected_market_stats = market_stats.filter(s => s.market_id == active_market?.market_id);
|
|
65
|
+
const selected_stats = MarketComponentHelpers.getReconFromMarketStats(selected_market_stats);
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
const overall_resolve = selected_stats.total_unresolved > 0 ? true : false
|
|
69
|
+
const overall_rollback = selected_stats.total_paid > 0 ? true : false
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if(!player_id){ return }
|
|
72
|
+
if(!contest_id){ return }
|
|
73
|
+
getData();
|
|
74
|
+
},[player_id, contest_id]);
|
|
75
|
+
|
|
76
|
+
const getContest = async() => {
|
|
77
|
+
let ev:EventProps | undefined = undefined
|
|
78
|
+
let mtch:MatchProps | undefined = undefined
|
|
79
|
+
let tn:TournamentProps | undefined = undefined
|
|
80
|
+
switch(contest_type){
|
|
81
|
+
case 'team':
|
|
82
|
+
let evs = await MarketComponentApi.getEventsByEventIds([contest_id]);
|
|
83
|
+
ev = evs[0]
|
|
84
|
+
break
|
|
85
|
+
case 'match':
|
|
86
|
+
let mtchs = await MarketComponentApi.getMatchesByMatchIds([contest_id]);
|
|
87
|
+
mtch = mtchs[0]
|
|
88
|
+
if(mtch){
|
|
89
|
+
let mt_tns = await MarketComponentApi.getTournamentsByTournamentIds([contest_id]);
|
|
90
|
+
tn = mt_tns[0]
|
|
91
|
+
}
|
|
92
|
+
break
|
|
93
|
+
case 'tournament':
|
|
94
|
+
let tns = await MarketComponentApi.getTournamentsByTournamentIds([contest_id]);
|
|
95
|
+
tn = tns[0]
|
|
96
|
+
break
|
|
97
|
+
default: break
|
|
98
|
+
}
|
|
99
|
+
return { event:ev, tournament: tn, match: mtch }
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const getReconColor = (recon:number) => {
|
|
103
|
+
if(!closed){ return Colors.text.warning }
|
|
104
|
+
if(recon < 0){ return Colors.text.error }
|
|
105
|
+
return Colors.text.success
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const getData = async() => {
|
|
109
|
+
MarketComponentApi.setEnvironment();
|
|
110
|
+
setFormData({ ...form_data, loading:true });
|
|
111
|
+
const me = await MarketComponentApi.getMyDetails();
|
|
112
|
+
if(me?.role != 'admin'){ return Alert.alert('Not authorized to view this!') }
|
|
113
|
+
const mk_stats = await MarketComponentApi.getMarketStatsByEvent(contest_id, contest_type);
|
|
114
|
+
let contest_resp = await getContest();
|
|
115
|
+
const mkets = await MarketComponentApi.getMarkets();
|
|
116
|
+
let team_ids = mk_stats.filter(s => s.side_type == 'team').map(s => s.side_id);
|
|
117
|
+
let athlete_ids = mk_stats.filter(s => s.side_type == 'athlete').map(s => s.side_id);
|
|
118
|
+
let tms = await MarketComponentApi.getTeamsByIds(team_ids);
|
|
119
|
+
let aths = await MarketComponentApi.getAthletesByIds(athlete_ids);
|
|
120
|
+
setFormData({
|
|
121
|
+
...form_data,
|
|
122
|
+
loading:false,
|
|
123
|
+
markets:mkets,
|
|
124
|
+
teams: tms,
|
|
125
|
+
athletes: aths,
|
|
126
|
+
event: contest_resp.event,
|
|
127
|
+
match: contest_resp.match,
|
|
128
|
+
tournament: contest_resp.tournament,
|
|
129
|
+
market_stats: mk_stats.filter(mk => mk.market_type == 'FOR_MONEY')
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const handleExpire = async(order_ids:string[]) => {
|
|
134
|
+
if(!active_market){ return }
|
|
135
|
+
if(Platform.OS == 'web'){
|
|
136
|
+
const confirmed = await confirm('Are you sure? This will update the expiration times to now. It may take up to 1 minute for the orders to be closed and refunded')
|
|
137
|
+
if(!confirmed){ return }
|
|
138
|
+
return await MarketComponentApi.expireOpenOrders(contest_id, contest_type, active_market.market_id, order_ids)
|
|
139
|
+
} else {
|
|
140
|
+
Alert.alert('Are you sure?', 'This will update the expiration times to now. It may take up to 1 minute for the orders to be closed and refunded', [
|
|
141
|
+
{
|
|
142
|
+
text: 'Cancel',
|
|
143
|
+
style:'cancel',
|
|
144
|
+
onPress:() => console.log('Done')
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
style: 'destructive',
|
|
148
|
+
text: 'Confirm',
|
|
149
|
+
onPress:async() => {
|
|
150
|
+
await MarketComponentApi.expireOpenOrders(contest_id, contest_type, active_market.market_id, order_ids)
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
]);
|
|
154
|
+
return true
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const renderMarketStats = (data:{ item:MarketStatsProps, index:number }) => {
|
|
160
|
+
if(data.item.status == 'cancelled' && data.item.called_amt < 0.01){ return <></> }
|
|
161
|
+
if(data.item.buy_sell_ind == 'sell' && data.item.status != 'approved'){ return <></> }
|
|
162
|
+
const athlete = athletes.find(a => a.athlete_id == data.item.side_id);
|
|
163
|
+
const team = teams.find(t => t.team_id == data.item.side_id);
|
|
164
|
+
const mk_agg = MarketComponentHelpers.getReconFromMarketStats([data.item]);
|
|
165
|
+
const market = markets.find(m => m.market_id == data.item.market_id);
|
|
166
|
+
if(!market){ return <></> }
|
|
167
|
+
const rollback_allowed = market.level != 'event' && mk_agg.total_paid > 0 ? true : false
|
|
168
|
+
const resolve_allowed = market.level != 'event' && mk_agg.total_unresolved > 0 ? true : false
|
|
169
|
+
return (
|
|
170
|
+
<View type='row' style={{ borderBottomWidth:1, borderColor:Colors.borders.light, padding:5 }}>
|
|
171
|
+
{data.item.side_type == 'athlete' && athlete ?
|
|
172
|
+
<View>
|
|
173
|
+
<AthleteImage
|
|
174
|
+
athlete={athlete}
|
|
175
|
+
size={32}
|
|
176
|
+
/>
|
|
177
|
+
</View>
|
|
178
|
+
:data.item.side_type == 'team' && team ?
|
|
179
|
+
<View>
|
|
180
|
+
<TeamImage
|
|
181
|
+
team={team}
|
|
182
|
+
size={16}
|
|
183
|
+
/>
|
|
184
|
+
</View>
|
|
185
|
+
:<></>}
|
|
186
|
+
<View transparent style={{ flex:1, marginLeft:10 }}>
|
|
187
|
+
<Text theme='h2'>{data.item.title}</Text>
|
|
188
|
+
<Text theme='light' size={10} style={{ marginTop:3 }}>{data.item.buy_sell_ind.toUpperCase()}: {data.item.status.toUpperCase()}</Text>
|
|
189
|
+
</View>
|
|
190
|
+
<View style={{ alignItems:'flex-end' }}>
|
|
191
|
+
<Text color={getReconColor(mk_agg.total_unresolved * -1)}>${mk_agg.total_unresolved.toFixed(2)}</Text>
|
|
192
|
+
<Text theme='light' textAlign='right'>Unresolved</Text>
|
|
193
|
+
</View>
|
|
194
|
+
{data.item.open_amt > 0 && data.item.status == 'approved' ?
|
|
195
|
+
<View style={{ alignItems:'flex-end', marginLeft:5, paddingLeft:5, borderLeftWidth:1, borderColor:Colors.borders.light }}>
|
|
196
|
+
<Text theme='description'>${data.item.open_amt.toFixed(2)}</Text>
|
|
197
|
+
<Text theme='light' textAlign='right'>Open</Text>
|
|
198
|
+
</View>
|
|
199
|
+
:<></>}
|
|
200
|
+
<View nativeID='actions' style={{ marginLeft:5, flexDirection:'row' }}>
|
|
201
|
+
{data.item.status == 'approved' ?
|
|
202
|
+
<Button
|
|
203
|
+
style={{ padding:10 }}
|
|
204
|
+
type='error'
|
|
205
|
+
onPress={() => handleExpire(data.item.order_ids)}>
|
|
206
|
+
<Text theme='h1' color={Colors.text.white} size={10}>CLEAR</Text>
|
|
207
|
+
</Button>
|
|
208
|
+
:<></>}
|
|
209
|
+
{resolve_allowed ?
|
|
210
|
+
<Button
|
|
211
|
+
style={{ padding:10, marginLeft:5 }}
|
|
212
|
+
type='success'
|
|
213
|
+
onPress={() => setResolve({ ...resolve, visible: true, side_type: data.item.side_type, side_id: data.item.side_id, market:market })}>
|
|
214
|
+
<Text theme='h1' color={Colors.text.white} size={10}>RESOLVE</Text>
|
|
215
|
+
</Button>
|
|
216
|
+
:<></>}
|
|
217
|
+
{rollback_allowed ?
|
|
218
|
+
<Button
|
|
219
|
+
style={{ padding:10, marginLeft:5 }}
|
|
220
|
+
title_color={Colors.text.white}
|
|
221
|
+
backgroundColor={Colors.text.warning}
|
|
222
|
+
onPress={() => setRollback({ ...rollback, visible:true, side_type: data.item.side_type, side_id:data.item.side_id, market: market })}>
|
|
223
|
+
<Text theme='h1' color={Colors.text.white} size={10}>ROLLBACK</Text>
|
|
224
|
+
</Button>
|
|
225
|
+
:<></>}
|
|
226
|
+
</View>
|
|
227
|
+
</View>
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const renderSupportedMarkets = (data: { item:MarketProps, index:number }) => {
|
|
232
|
+
let mk_stats = market_stats.filter(s => s.market_id == data.item.market_id);
|
|
233
|
+
let mk_agg = MarketComponentHelpers.getReconFromMarketStats(mk_stats);
|
|
234
|
+
const selected = data.item.market_id == active_market?.market_id ? true : false
|
|
235
|
+
|
|
236
|
+
return (
|
|
237
|
+
<Button float style={{ width:100, padding:0, margin:4, borderColor:selected?Colors.text.success:Colors.borders.light }}
|
|
238
|
+
onPress={() => {
|
|
239
|
+
if(selected){ setActiveMarket(undefined) }
|
|
240
|
+
else { setActiveMarket(data.item) }
|
|
241
|
+
}}>
|
|
242
|
+
<View type='header' style={{ padding:5, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
|
|
243
|
+
<Text theme='light' size={8}>{data.item.type == 'Stat' ? data.item.stat_label : data.item.type}</Text>
|
|
244
|
+
</View>
|
|
245
|
+
<View type='body' transparent style={{ padding:10, flex:1, justifyContent:'flex-end', alignItems:'flex-end' }}>
|
|
246
|
+
<Text theme='h1' color={Colors.text.h1}>{mk_agg.total_volume.toFixed(2)}</Text>
|
|
247
|
+
<Text theme='light' color={Colors.text.h1} size={10}>Volume</Text>
|
|
248
|
+
</View>
|
|
249
|
+
<View type='footer' style={{ padding:5, borderBottomRightRadius:8, borderBottomLeftRadius:8, flexDirection:'row', alignItems:'center' }}>
|
|
250
|
+
<Text theme='light' style={{ flex:1 }}>Rec:</Text>
|
|
251
|
+
<Text theme='h1' color={getReconColor(mk_agg.reconciliation)} size={12} textAlign='right'>${mk_agg.reconciliation.toFixed(2)}</Text>
|
|
252
|
+
</View>
|
|
253
|
+
</Button>
|
|
254
|
+
)
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const renderSections = (data: { item:string, index:number }) => {
|
|
258
|
+
switch(data.item){
|
|
259
|
+
case 'header':
|
|
260
|
+
return (
|
|
261
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
|
|
262
|
+
<View transparent style={{ flex:1 }}>
|
|
263
|
+
<Text theme='h1'>{contest_title}</Text>
|
|
264
|
+
<Text theme='description' style={{ marginTop:3 }}>Manage Market Data</Text>
|
|
265
|
+
</View>
|
|
266
|
+
<Button
|
|
267
|
+
float
|
|
268
|
+
style={{ padding:10, borderRadius:100 }}
|
|
269
|
+
title='X'
|
|
270
|
+
onPress={() => onClose()}
|
|
271
|
+
/>
|
|
272
|
+
</View>
|
|
273
|
+
)
|
|
274
|
+
case 'total_stats':
|
|
275
|
+
return (
|
|
276
|
+
<View type='row' style={{ borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
277
|
+
{closed ?
|
|
278
|
+
<View style={{ padding:10, flex:1 }}>
|
|
279
|
+
<Text theme='h1' color={Colors.text.success}>${(commission + routing_prem).toFixed(2)}</Text>
|
|
280
|
+
<Text theme='light' color={Colors.text.success} style={{ marginTop:2 }} size={8}>{commission.toFixed(2)} + {routing_prem.toFixed(2)}</Text>
|
|
281
|
+
<Text theme='description' style={{ marginTop:3 }}>Revenue</Text>
|
|
282
|
+
</View>
|
|
283
|
+
:
|
|
284
|
+
<View style={{ padding:10, flex:1 }}>
|
|
285
|
+
<Text theme='h1' color={Colors.text.warning}>${total_unresolved.toFixed(2)}</Text>
|
|
286
|
+
<Text theme='description' style={{ marginTop:3 }}>Unresolved</Text>
|
|
287
|
+
</View>
|
|
288
|
+
}
|
|
289
|
+
<View style={{ padding:10, flex:1 }}>
|
|
290
|
+
<Text theme='h1' color={Colors.text.h1}>${total_volume.toFixed(2)}</Text>
|
|
291
|
+
<Text theme='description' style={{ marginTop:3 }}>Volume</Text>
|
|
292
|
+
</View>
|
|
293
|
+
<View style={{ padding:10, flex:1 }}>
|
|
294
|
+
<Text theme='h1' color={getReconColor(reconciliation)}>${reconciliation.toFixed(2)}</Text>
|
|
295
|
+
<Text theme='description' style={{ marginTop:3 }}>Recon</Text>
|
|
296
|
+
</View>
|
|
297
|
+
|
|
298
|
+
</View>
|
|
299
|
+
)
|
|
300
|
+
case 'markets':
|
|
301
|
+
return (
|
|
302
|
+
<View transparent style={{ padding:10 }}>
|
|
303
|
+
<FlatList
|
|
304
|
+
data={supported_markets}
|
|
305
|
+
key={`supported_markets`}
|
|
306
|
+
renderItem={renderSupportedMarkets}
|
|
307
|
+
keyExtractor={(item) => item.market_id.toString()}
|
|
308
|
+
horizontal
|
|
309
|
+
/>
|
|
310
|
+
</View>
|
|
311
|
+
)
|
|
312
|
+
case 'orders':
|
|
313
|
+
if(!active_market){ return <></> }
|
|
314
|
+
return (
|
|
315
|
+
<FlatList
|
|
316
|
+
data={market_stats.filter(s => s.market_id == active_market.market_id)}
|
|
317
|
+
key={`unresolved_stats_${active_market?.market_id}`}
|
|
318
|
+
renderItem={renderMarketStats}
|
|
319
|
+
keyExtractor={(item) => `${item.market_id}_${item.side_id}_${item.side}_${item.buy_sell_ind}_${item.var_1}_${item.status}`}
|
|
320
|
+
/>
|
|
321
|
+
)
|
|
322
|
+
default: return <></>
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
return (
|
|
327
|
+
<View style={{ flex:1 }}>
|
|
328
|
+
<View transparent style={{ flex:1 }}>
|
|
329
|
+
<FlatList
|
|
330
|
+
data={manage_sections}
|
|
331
|
+
key={'manage_sections'}
|
|
332
|
+
keyExtractor={(item) => item}
|
|
333
|
+
renderItem={renderSections}
|
|
334
|
+
/>
|
|
335
|
+
</View>
|
|
336
|
+
{active_market ?
|
|
337
|
+
<View type='footer' style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
|
|
338
|
+
{overall_rollback ?
|
|
339
|
+
<Button
|
|
340
|
+
title='Rollback'
|
|
341
|
+
type='error'
|
|
342
|
+
style={{ flex:1, marginRight:3 }}
|
|
343
|
+
onPress={() => setRollback({ ...rollback, visible: true, market:active_market })}
|
|
344
|
+
/>
|
|
345
|
+
:<></>}
|
|
346
|
+
{overall_resolve ?
|
|
347
|
+
<Button
|
|
348
|
+
title='Resolve'
|
|
349
|
+
type='success'
|
|
350
|
+
style={{ flex:1, marginLeft:3 }}
|
|
351
|
+
onPress={() => setResolve({ visible: true, market: active_market })}
|
|
352
|
+
/>
|
|
353
|
+
:<></>}
|
|
354
|
+
</View>
|
|
355
|
+
:<></>}
|
|
356
|
+
{rollback.visible && rollback.market ?
|
|
357
|
+
<View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0 }}>
|
|
358
|
+
<MarketRollbackForm
|
|
359
|
+
contest_title={contest_title}
|
|
360
|
+
contest_id={contest_id}
|
|
361
|
+
contest_type={contest_type}
|
|
362
|
+
market={rollback.market}
|
|
363
|
+
market_stats={market_stats}
|
|
364
|
+
side_type={rollback.side_type}
|
|
365
|
+
side_id={rollback.side_id}
|
|
366
|
+
athletes={athletes}
|
|
367
|
+
teams={teams}
|
|
368
|
+
onClose={() => setRollback({ visible: false })}
|
|
369
|
+
/>
|
|
370
|
+
</View>
|
|
371
|
+
:<></>}
|
|
372
|
+
{resolve.visible && resolve.market ?
|
|
373
|
+
<View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0 }}>
|
|
374
|
+
<MarketResolveForm
|
|
375
|
+
contest_title={contest_title}
|
|
376
|
+
contest_id={contest_id}
|
|
377
|
+
contest_type={contest_type}
|
|
378
|
+
market={resolve.market}
|
|
379
|
+
market_stats={market_stats}
|
|
380
|
+
side_type={resolve.side_type}
|
|
381
|
+
side_id={resolve.side_id}
|
|
382
|
+
athletes={athletes}
|
|
383
|
+
teams={teams}
|
|
384
|
+
onClose={() => setResolve({ visible: false })}
|
|
385
|
+
/>
|
|
386
|
+
</View>
|
|
387
|
+
:<></>}
|
|
388
|
+
</View>
|
|
389
|
+
)
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
export default MarketManager
|
|
@@ -13,6 +13,7 @@ import OrderBookCard from './components/OrderBook';
|
|
|
13
13
|
import MyOrderList from './components/MyOrderList';
|
|
14
14
|
import ExternalPriceComparison from './components/ExternalPriceComparison';
|
|
15
15
|
import OrderGradeBar from './components/OrderGradeBar';
|
|
16
|
+
import MarketManager from './components/MarketManager';
|
|
16
17
|
|
|
17
18
|
export default {
|
|
18
19
|
TeamEventMarket,
|
|
@@ -21,6 +22,7 @@ export default {
|
|
|
21
22
|
BestAvailableOrderCard,
|
|
22
23
|
EventMarket,
|
|
23
24
|
OrderBookCard,
|
|
25
|
+
MarketManager,
|
|
24
26
|
OrderBookChart,
|
|
25
27
|
AthleteTournamentMarket,
|
|
26
28
|
TeamEventList,
|
package/src/types.d.ts
CHANGED
|
@@ -1429,6 +1429,31 @@ export interface MarketSideOptionProps {
|
|
|
1429
1429
|
parseable_title: string
|
|
1430
1430
|
}
|
|
1431
1431
|
|
|
1432
|
+
export interface MarketStatsProps {
|
|
1433
|
+
event_id:string,
|
|
1434
|
+
market_type:string,
|
|
1435
|
+
event_type: string,
|
|
1436
|
+
market_id:string,
|
|
1437
|
+
title:string,
|
|
1438
|
+
buy_sell_ind:'buy'|'sell',
|
|
1439
|
+
status: 'approved'|'cancelled'|'closed',
|
|
1440
|
+
resolution_status:'inprogress'|'closed '
|
|
1441
|
+
side: string,
|
|
1442
|
+
var_1:number,
|
|
1443
|
+
side_type: string,
|
|
1444
|
+
side_id:string,
|
|
1445
|
+
open_amt: number,
|
|
1446
|
+
called_amt: number,
|
|
1447
|
+
stake: number,
|
|
1448
|
+
order_ids:string[],
|
|
1449
|
+
cash_rcvd: number,
|
|
1450
|
+
in_sale_order:number,
|
|
1451
|
+
delayed_cash:number,
|
|
1452
|
+
winnings:number,
|
|
1453
|
+
net_winnings:number,
|
|
1454
|
+
commission:number,
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1432
1457
|
export interface TradeProps {
|
|
1433
1458
|
trade_id: string;
|
|
1434
1459
|
market_id: string;
|