be-components 7.3.9 → 7.4.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/CreateEngagement/index.js +3 -0
- package/lib/commonjs/CreateEngagement/index.js.map +1 -1
- package/lib/commonjs/FlashMarket/api/index.js +61 -0
- package/lib/commonjs/FlashMarket/api/index.js.map +1 -1
- package/lib/commonjs/FlashMarket/components/ManageFlashMarket.js +91 -83
- package/lib/commonjs/FlashMarket/components/ManageFlashMarket.js.map +1 -1
- package/lib/commonjs/FlashMarket/index.js +67 -42
- package/lib/commonjs/FlashMarket/index.js.map +1 -1
- package/lib/commonjs/MyAction/api/index.js +580 -0
- package/lib/commonjs/MyAction/api/index.js.map +1 -0
- package/lib/commonjs/MyAction/components/BracketRow.js +67 -0
- package/lib/commonjs/MyAction/components/BracketRow.js.map +1 -0
- package/lib/commonjs/MyAction/components/CompetitionRow.js +68 -0
- package/lib/commonjs/MyAction/components/CompetitionRow.js.map +1 -0
- package/lib/commonjs/MyAction/components/ContestStatRow.js +265 -0
- package/lib/commonjs/MyAction/components/ContestStatRow.js.map +1 -0
- package/lib/commonjs/MyAction/components/FlashRow.js +131 -0
- package/lib/commonjs/MyAction/components/FlashRow.js.map +1 -0
- package/lib/commonjs/MyAction/components/ParlayRow.js +236 -0
- package/lib/commonjs/MyAction/components/ParlayRow.js.map +1 -0
- package/lib/commonjs/MyAction/components/SquaresRow.js +83 -0
- package/lib/commonjs/MyAction/components/SquaresRow.js.map +1 -0
- package/lib/commonjs/MyAction/index.js +354 -0
- package/lib/commonjs/MyAction/index.js.map +1 -0
- package/lib/commonjs/PartnerPortal/components/EmbedManager.js +42 -0
- package/lib/commonjs/PartnerPortal/components/EmbedManager.js.map +1 -1
- package/lib/commonjs/PartnerPortal/components/StringSelector.js +90 -0
- package/lib/commonjs/PartnerPortal/components/StringSelector.js.map +1 -0
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.d.js.map +1 -1
- package/lib/module/CreateEngagement/index.js +3 -0
- package/lib/module/CreateEngagement/index.js.map +1 -1
- package/lib/module/FlashMarket/api/index.js +61 -0
- package/lib/module/FlashMarket/api/index.js.map +1 -1
- package/lib/module/FlashMarket/components/ManageFlashMarket.js +91 -83
- package/lib/module/FlashMarket/components/ManageFlashMarket.js.map +1 -1
- package/lib/module/FlashMarket/index.js +67 -42
- package/lib/module/FlashMarket/index.js.map +1 -1
- package/lib/module/MyAction/api/index.js +573 -0
- package/lib/module/MyAction/api/index.js.map +1 -0
- package/lib/module/MyAction/components/BracketRow.js +60 -0
- package/lib/module/MyAction/components/BracketRow.js.map +1 -0
- package/lib/module/MyAction/components/CompetitionRow.js +61 -0
- package/lib/module/MyAction/components/CompetitionRow.js.map +1 -0
- package/lib/module/MyAction/components/ContestStatRow.js +258 -0
- package/lib/module/MyAction/components/ContestStatRow.js.map +1 -0
- package/lib/module/MyAction/components/FlashRow.js +124 -0
- package/lib/module/MyAction/components/FlashRow.js.map +1 -0
- package/lib/module/MyAction/components/ParlayRow.js +229 -0
- package/lib/module/MyAction/components/ParlayRow.js.map +1 -0
- package/lib/module/MyAction/components/SquaresRow.js +76 -0
- package/lib/module/MyAction/components/SquaresRow.js.map +1 -0
- package/lib/module/MyAction/index.js +344 -0
- package/lib/module/MyAction/index.js.map +1 -0
- package/lib/module/PartnerPortal/components/EmbedManager.js +42 -0
- package/lib/module/PartnerPortal/components/EmbedManager.js.map +1 -1
- package/lib/module/PartnerPortal/components/StringSelector.js +83 -0
- package/lib/module/PartnerPortal/components/StringSelector.js.map +1 -0
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.d.js.map +1 -1
- package/lib/typescript/lib/commonjs/CreateEngagement/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/FlashMarket/api/index.d.ts +1 -0
- package/lib/typescript/lib/commonjs/FlashMarket/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/FlashMarket/components/ManageFlashMarket.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/FlashMarket/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/MyAction/api/index.d.ts +110 -0
- package/lib/typescript/lib/commonjs/MyAction/api/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/MyAction/components/BracketRow.d.ts +8 -0
- package/lib/typescript/lib/commonjs/MyAction/components/BracketRow.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/MyAction/components/CompetitionRow.d.ts +9 -0
- package/lib/typescript/lib/commonjs/MyAction/components/CompetitionRow.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/MyAction/components/ContestStatRow.d.ts +15 -0
- package/lib/typescript/lib/commonjs/MyAction/components/ContestStatRow.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/MyAction/components/FlashRow.d.ts +10 -0
- package/lib/typescript/lib/commonjs/MyAction/components/FlashRow.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/MyAction/components/ParlayRow.d.ts +15 -0
- package/lib/typescript/lib/commonjs/MyAction/components/ParlayRow.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/MyAction/components/SquaresRow.d.ts +8 -0
- package/lib/typescript/lib/commonjs/MyAction/components/SquaresRow.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/MyAction/index.d.ts +7 -0
- package/lib/typescript/lib/commonjs/MyAction/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/PartnerPortal/components/EmbedManager.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/PartnerPortal/components/StringSelector.d.ts +8 -0
- package/lib/typescript/lib/commonjs/PartnerPortal/components/StringSelector.d.ts.map +1 -0
- 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/CreateEngagement/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/FlashMarket/api/index.d.ts +1 -0
- package/lib/typescript/lib/module/FlashMarket/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/FlashMarket/components/ManageFlashMarket.d.ts.map +1 -1
- package/lib/typescript/lib/module/FlashMarket/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/MyAction/api/index.d.ts +110 -0
- package/lib/typescript/lib/module/MyAction/api/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/MyAction/components/BracketRow.d.ts +8 -0
- package/lib/typescript/lib/module/MyAction/components/BracketRow.d.ts.map +1 -0
- package/lib/typescript/lib/module/MyAction/components/CompetitionRow.d.ts +9 -0
- package/lib/typescript/lib/module/MyAction/components/CompetitionRow.d.ts.map +1 -0
- package/lib/typescript/lib/module/MyAction/components/ContestStatRow.d.ts +15 -0
- package/lib/typescript/lib/module/MyAction/components/ContestStatRow.d.ts.map +1 -0
- package/lib/typescript/lib/module/MyAction/components/FlashRow.d.ts +10 -0
- package/lib/typescript/lib/module/MyAction/components/FlashRow.d.ts.map +1 -0
- package/lib/typescript/lib/module/MyAction/components/ParlayRow.d.ts +15 -0
- package/lib/typescript/lib/module/MyAction/components/ParlayRow.d.ts.map +1 -0
- package/lib/typescript/lib/module/MyAction/components/SquaresRow.d.ts +8 -0
- package/lib/typescript/lib/module/MyAction/components/SquaresRow.d.ts.map +1 -0
- package/lib/typescript/lib/module/MyAction/index.d.ts +7 -0
- package/lib/typescript/lib/module/MyAction/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/PartnerPortal/components/EmbedManager.d.ts.map +1 -1
- package/lib/typescript/lib/module/PartnerPortal/components/StringSelector.d.ts +8 -0
- package/lib/typescript/lib/module/PartnerPortal/components/StringSelector.d.ts.map +1 -0
- 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/CreateEngagement/index.d.ts.map +1 -1
- package/lib/typescript/src/FlashMarket/api/index.d.ts +1 -0
- package/lib/typescript/src/FlashMarket/api/index.d.ts.map +1 -1
- package/lib/typescript/src/FlashMarket/components/ManageFlashMarket.d.ts.map +1 -1
- package/lib/typescript/src/FlashMarket/index.d.ts.map +1 -1
- package/lib/typescript/src/MyAction/api/index.d.ts +103 -0
- package/lib/typescript/src/MyAction/api/index.d.ts.map +1 -0
- package/lib/typescript/src/MyAction/components/BracketRow.d.ts +10 -0
- package/lib/typescript/src/MyAction/components/BracketRow.d.ts.map +1 -0
- package/lib/typescript/src/MyAction/components/CompetitionRow.d.ts +15 -0
- package/lib/typescript/src/MyAction/components/CompetitionRow.d.ts.map +1 -0
- package/lib/typescript/src/MyAction/components/ContestStatRow.d.ts +18 -0
- package/lib/typescript/src/MyAction/components/ContestStatRow.d.ts.map +1 -0
- package/lib/typescript/src/MyAction/components/FlashRow.d.ts +12 -0
- package/lib/typescript/src/MyAction/components/FlashRow.d.ts.map +1 -0
- package/lib/typescript/src/MyAction/components/ParlayRow.d.ts +18 -0
- package/lib/typescript/src/MyAction/components/ParlayRow.d.ts.map +1 -0
- package/lib/typescript/src/MyAction/components/SquaresRow.d.ts +10 -0
- package/lib/typescript/src/MyAction/components/SquaresRow.d.ts.map +1 -0
- package/lib/typescript/src/MyAction/index.d.ts +14 -0
- package/lib/typescript/src/MyAction/index.d.ts.map +1 -0
- package/lib/typescript/src/PartnerPortal/components/EmbedManager.d.ts.map +1 -1
- package/lib/typescript/src/PartnerPortal/components/StringSelector.d.ts +10 -0
- package/lib/typescript/src/PartnerPortal/components/StringSelector.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/CreateEngagement/index.tsx +4 -1
- package/src/FlashMarket/api/index.ts +72 -0
- package/src/FlashMarket/components/ManageFlashMarket.tsx +28 -2
- package/src/FlashMarket/index.tsx +39 -24
- package/src/MyAction/api/index.ts +393 -0
- package/src/MyAction/components/BracketRow.tsx +34 -0
- package/src/MyAction/components/CompetitionRow.tsx +39 -0
- package/src/MyAction/components/ContestStatRow.tsx +153 -0
- package/src/MyAction/components/FlashRow.tsx +74 -0
- package/src/MyAction/components/ParlayRow.tsx +137 -0
- package/src/MyAction/components/SquaresRow.tsx +55 -0
- package/src/MyAction/index.tsx +316 -0
- package/src/PartnerPortal/components/EmbedManager.tsx +20 -0
- package/src/PartnerPortal/components/StringSelector.tsx +55 -0
- package/src/index.tsx +2 -0
- package/src/types.d.ts +12 -0
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import moment, { type Moment } from "moment-mini";
|
|
2
|
+
import { APIOverrides } from "../../ApiOverrides";
|
|
3
|
+
import type { ActionListProps, AthleteProps, BracketCompetitionProps, CompetitionPayoutTypeProps, CompetitionPlayerBracketProps, CompetitionPlayerProps, CompetitionProps, CompetitionRecordProps, CompetitionResultProps, CompetitionResultTypeProps, CompetitionSeasonPlayerProps, CompetitionSeasonProps, CompetitionSeasonResultProps, CompetitionTypeProps, EventProps, LeagueProps, MatchProps, OrderProps, OrderStatsProps, ParlayPositionProps, ParlayProps, PlayerBracketProps, PollOptionProps, PollProps, PollResponseProps, SquaresCompetitionProps, TeamProps, TournamentProps } from "../../types";
|
|
4
|
+
import axios from 'axios';
|
|
5
|
+
import { MarketComponentHelpers } from "../../MarketComponents/api";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
let EVENT_SVC_API = '';
|
|
9
|
+
let MK_SVC_API = '';
|
|
10
|
+
let AUTH_SVC_API = '';
|
|
11
|
+
let TP_SVC_API = '';
|
|
12
|
+
|
|
13
|
+
export const MyActionApi = {
|
|
14
|
+
setEnvironment: () => {
|
|
15
|
+
const endpoints = APIOverrides.getEndpoints();
|
|
16
|
+
EVENT_SVC_API = endpoints['EVENT_SVC_API'] as string;
|
|
17
|
+
MK_SVC_API = endpoints['MK_SVC_API'] as string;
|
|
18
|
+
AUTH_SVC_API = endpoints['AUTH_SVC_API'] as string;
|
|
19
|
+
TP_SVC_API = endpoints['TP_SVC_API'] as string;
|
|
20
|
+
},
|
|
21
|
+
ContestApi: {
|
|
22
|
+
getLeagues:async():Promise<LeagueProps[]> => {
|
|
23
|
+
try {
|
|
24
|
+
const resp = await axios.get(`${EVENT_SVC_API}/v1/leagues`);
|
|
25
|
+
return resp.data.leagues
|
|
26
|
+
} catch (e) {
|
|
27
|
+
return []
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
getTournamentsByIds: async(tournament_ids:string[]):Promise<TournamentProps[]> => {
|
|
31
|
+
try {
|
|
32
|
+
if(tournament_ids.length == 0){ return [] }
|
|
33
|
+
const resp = await axios.post(`${EVENT_SVC_API}/v1/tournaments/bulk/get`, { attribute:'tournament_id', values: tournament_ids });
|
|
34
|
+
return resp.data.tournaments
|
|
35
|
+
} catch (e) {
|
|
36
|
+
return []
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
getEventsByIds: async(event_ids:string[]):Promise<EventProps[]> => {
|
|
40
|
+
try {
|
|
41
|
+
if(event_ids.length == 0){ return [] }
|
|
42
|
+
const resp = await axios.post(`${EVENT_SVC_API}/v1/events/bulk/get`, { attribute:'event_id', values: event_ids });
|
|
43
|
+
return resp.data.events
|
|
44
|
+
} catch (e) {
|
|
45
|
+
return []
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
getMatchesByIds: async(match_ids:string[]):Promise<MatchProps[]> => {
|
|
49
|
+
try {
|
|
50
|
+
if(match_ids.length == 0){ return [] }
|
|
51
|
+
const resp = await axios.post(`${EVENT_SVC_API}/v1/matches/bulk/get`, { attribute:'match_id', values: match_ids });
|
|
52
|
+
return resp.data.matches
|
|
53
|
+
} catch (e) {
|
|
54
|
+
return []
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
getMatchesByTournamentId: async(tournament_id:string):Promise<MatchProps[]> => {
|
|
58
|
+
try {
|
|
59
|
+
const resp = await axios.get(`${EVENT_SVC_API}/v1/matches/tournament/${tournament_id}`);
|
|
60
|
+
return resp.data.matches
|
|
61
|
+
} catch (e) {
|
|
62
|
+
return []
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
getAthletesByIds : async(athlete_ids:string[]):Promise<AthleteProps[]> => {
|
|
66
|
+
if(athlete_ids.length == 0){ return [] }
|
|
67
|
+
try {
|
|
68
|
+
const resp = await axios.post(`${EVENT_SVC_API}/v1/athletes/bulk/get`, { attribute: 'athlete_id', values: athlete_ids })
|
|
69
|
+
return resp.data.athletes
|
|
70
|
+
} catch (e) {
|
|
71
|
+
return []
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
getTeamsByIds: async(team_ids:string[]):Promise<TeamProps[]> => {
|
|
75
|
+
if(team_ids.length == 0){ return [] }
|
|
76
|
+
try {
|
|
77
|
+
const resp = await axios.post(`${EVENT_SVC_API}/v1/teams/bulk/get`, { attribute:'team_id', values: team_ids })
|
|
78
|
+
return resp.data.teams
|
|
79
|
+
} catch (e) {
|
|
80
|
+
return []
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
OrderApi: {
|
|
85
|
+
getMyAction: async():Promise<{orders: OrderProps[], parlays:ParlayProps[], parlay_positions:ParlayPositionProps[], parlay_orders:OrderProps[]}> => {
|
|
86
|
+
try {
|
|
87
|
+
const resp = await axios.get(`${MK_SVC_API}/v1/orders/action/me`);
|
|
88
|
+
return resp.data
|
|
89
|
+
} catch (e) {
|
|
90
|
+
return { orders: [], parlay_orders: [], parlay_positions: [], parlays: [] }
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
FlashApi: {
|
|
95
|
+
getMyFlashAction: async():Promise<{ polls:PollProps[], poll_responses:PollResponseProps[], poll_options:PollOptionProps[] }> => {
|
|
96
|
+
try {
|
|
97
|
+
const resp = await axios.get(`${AUTH_SVC_API}/v2/pm/action/me`);
|
|
98
|
+
console.log(resp.data)
|
|
99
|
+
return resp.data
|
|
100
|
+
} catch (e) {
|
|
101
|
+
return { polls:[], poll_responses:[], poll_options: [] }
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
EngagementApi: {
|
|
106
|
+
getCompetitionOptions: async():Promise<{competition_types:CompetitionTypeProps[], competition_result_types:CompetitionResultTypeProps[], competition_payout_types:CompetitionPayoutTypeProps[]}> => {
|
|
107
|
+
try {
|
|
108
|
+
const resp = await axios.get(`${TP_SVC_API}/v1/competitions/options`)
|
|
109
|
+
return resp.data
|
|
110
|
+
} catch (e) {
|
|
111
|
+
return { competition_payout_types:[], competition_result_types:[], competition_types:[] }
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
getMyActiveSquaresCompetitions:async():Promise<{ squares_competitions:SquaresCompetitionProps[] }> => {
|
|
115
|
+
try {
|
|
116
|
+
const resp = await axios.get(`${TP_SVC_API}/v1/squares/me/active`);
|
|
117
|
+
return resp.data
|
|
118
|
+
} catch (error) {
|
|
119
|
+
return { squares_competitions: [] }
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
getMyActiveCompetitions:async():Promise<{ competitions:CompetitionProps[], competition_players:CompetitionPlayerProps[], competition_records:CompetitionRecordProps[], competition_results:CompetitionResultProps[] }> => {
|
|
124
|
+
try {
|
|
125
|
+
const resp = await axios.get(`${TP_SVC_API}/v2/competitions/me/active`);
|
|
126
|
+
return resp.data
|
|
127
|
+
} catch (e) {
|
|
128
|
+
return { competitions: [], competition_players:[], competition_records:[], competition_results:[] }
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
getMyActiveSeasons:async():Promise<{ competition_seasons:CompetitionSeasonProps[], competition_season_players:CompetitionSeasonPlayerProps[], competition_season_results:CompetitionSeasonResultProps[] }> => {
|
|
133
|
+
try {
|
|
134
|
+
const resp = await axios.get(`${TP_SVC_API}/v2/competitions/seasons/me/active`);
|
|
135
|
+
return resp.data
|
|
136
|
+
} catch (e) {
|
|
137
|
+
return { competition_seasons:[], competition_season_players:[], competition_season_results:[] }
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
getMyActiveBracketCompetitions:async():Promise<{ bracket_competitions:BracketCompetitionProps[], competition_player_brackets:CompetitionPlayerBracketProps[], player_brackets:PlayerBracketProps[] }> => {
|
|
141
|
+
try {
|
|
142
|
+
const resp = await axios.get(`${TP_SVC_API}/v1/brackets/me/active`);
|
|
143
|
+
return resp.data
|
|
144
|
+
} catch (e) {
|
|
145
|
+
return { bracket_competitions:[], competition_player_brackets:[], player_brackets:[] }
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
getMyActiveAdminBracketCompetitions: async() => {
|
|
149
|
+
try {
|
|
150
|
+
const resp = await axios.get(`${TP_SVC_API}/v1/brackets/admin/active`);
|
|
151
|
+
return resp.data.bracket_competitions
|
|
152
|
+
} catch (e) {
|
|
153
|
+
return []
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
export const MyActionHelpers = {
|
|
161
|
+
sortAction: (orders:OrderProps[], parlays:ParlayProps[], parlay_orders:OrderProps[], polls:PollProps[], competitions:CompetitionProps[], squares_competitions:SquaresCompetitionProps[], bracket_competitions:BracketCompetitionProps[]) => {
|
|
162
|
+
//Lets set up an array of data types
|
|
163
|
+
let action_types:ActionListProps[] = []
|
|
164
|
+
//Go through orders and we will group these into contests
|
|
165
|
+
let contests = [ ...new Set(orders.map(o => `${o.event_type}:${o.event_id}`)) ]
|
|
166
|
+
//Go through orders
|
|
167
|
+
contests.map(c => {
|
|
168
|
+
let event_id = c.split(':')[1]
|
|
169
|
+
let event_type = c.split(':')[0] as 'team'|'tournament'|'match'|undefined
|
|
170
|
+
if(!event_id || !event_type){ return }
|
|
171
|
+
let c_orders = orders.filter(o => o.event_id == event_id && o.event_type == event_type)
|
|
172
|
+
let expire_time = c_orders[0]?.expire_datetime
|
|
173
|
+
action_types.push({ id:event_id, contest_type:event_type, action_datetime: moment(expire_time), type: 'contest', orders: c_orders });
|
|
174
|
+
})
|
|
175
|
+
parlays.map(p => {
|
|
176
|
+
const p_orders = parlay_orders.filter(po => po.parlay_id == p.parlay_id);
|
|
177
|
+
action_types.push({ id: p.parlay_id, type:'parlay', action_datetime:moment(p.create_datetime), orders: p_orders});
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
polls.map(p => {
|
|
181
|
+
action_types.push({ id: p.poll_id, action_datetime: moment(p.end_datetime), type:'flash', orders:[] })
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
competitions.map(c => {
|
|
185
|
+
action_types.push({ id: c.competition_id, type:'competition', action_datetime:moment(c.scheduled_datetime), orders:[] });
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
squares_competitions.map(sc => {
|
|
189
|
+
action_types.push({ id: sc.sq_comp_id, type:'squares', action_datetime:moment(sc.begin_datetime), orders:[] });
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
bracket_competitions.map(bc => {
|
|
193
|
+
action_types.push({ id:bc.bracket_competition_id, type:'bracket', action_datetime: moment(bc.scheduled_datetime), orders: [] });
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
return action_types.sort((a,b) => moment(b.action_datetime).unix() - moment(a.action_datetime).unix());
|
|
197
|
+
},
|
|
198
|
+
getContestsFromOrders: (orders:OrderProps[]) => {
|
|
199
|
+
let event_ids = [ ...new Set(orders.filter(o => o.event_type == 'team').map(o => o.event_id))]
|
|
200
|
+
let tournament_ids = [ ...new Set(orders.filter(o => o.event_type == 'tournament').map(o => o.event_id))]
|
|
201
|
+
let match_ids = [ ...new Set(orders.filter(o => o.event_type == 'match').map(o => o.event_id))]
|
|
202
|
+
|
|
203
|
+
//Now lets grab all the athletes and teams that are needed as well
|
|
204
|
+
let athlete_ids = [ ...new Set(orders.filter(o => o.side_type == 'athlete').map(o => o.side_id)) ]
|
|
205
|
+
let team_ids = [ ...new Set(orders.filter(o => o.side_type == 'team').map(o => o.side_id)) ]
|
|
206
|
+
|
|
207
|
+
return { event_ids, tournament_ids, match_ids, athlete_ids, team_ids }
|
|
208
|
+
},
|
|
209
|
+
getContestsByIds: async(event_ids:string[], tournament_ids:string[], match_ids:string[], athlete_ids:string[], team_ids:string[]) => {
|
|
210
|
+
const events = await MyActionApi.ContestApi.getEventsByIds(event_ids);
|
|
211
|
+
const tournaments = await MyActionApi.ContestApi.getTournamentsByIds(tournament_ids);
|
|
212
|
+
const matches = await MyActionApi.ContestApi.getMatchesByIds(match_ids);
|
|
213
|
+
const athletes = await MyActionApi.ContestApi.getAthletesByIds(athlete_ids);
|
|
214
|
+
const teams = await MyActionApi.ContestApi.getTeamsByIds(team_ids);
|
|
215
|
+
return { events, tournaments, matches, athletes, teams }
|
|
216
|
+
},
|
|
217
|
+
getContestDetails: (contest_type:string, event?:EventProps, tournament?:TournamentProps, match?:MatchProps):{ contest_title:string, scheduled_datetime:Moment } => {
|
|
218
|
+
switch(contest_type){
|
|
219
|
+
case 'team':
|
|
220
|
+
if(!event){ return { contest_title: '', scheduled_datetime: moment() } }
|
|
221
|
+
return { contest_title: event.event_title, scheduled_datetime: moment(event.scheduled_datetime) }
|
|
222
|
+
case 'tournament':
|
|
223
|
+
if(!tournament){ return { contest_title: '', scheduled_datetime: moment() } }
|
|
224
|
+
return { contest_title: tournament.tournament_name, scheduled_datetime: moment(tournament.scheduled_datetime) }
|
|
225
|
+
case 'match':
|
|
226
|
+
if(!match){ return { contest_title: '', scheduled_datetime: moment() } }
|
|
227
|
+
return { contest_title: match.match_title, scheduled_datetime: moment(match.scheduled_datetime) }
|
|
228
|
+
default: return { contest_title: '', scheduled_datetime: moment() }
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
calcAllOrderStats: (orders:OrderProps[], parlay_positions?:ParlayPositionProps[], flash_responses?:PollResponseProps[]):OrderStatsProps => {
|
|
232
|
+
let open_order_count = 0, open_amt = 0, potential_winnings = 0, called_amt = 0, commission = 0;
|
|
233
|
+
let resolved_stake = 0, original_stake = 0, delayed_cash = 0, winnings = 0, net_winnings = 0, unresolved_stake = 0, resolved_potential_winnings = 0, unresolved_potential_winnings = 0, unresolved_potential_net_winnings = 0, num_trades = 0, cash_rcvd = 0;
|
|
234
|
+
let unique_order_titles = [ ...new Set(orders.map(o => o.title)) ]
|
|
235
|
+
let result_ind:string|undefined = undefined
|
|
236
|
+
let order_ids:string[] = []
|
|
237
|
+
let open_orders:string[] = []
|
|
238
|
+
let wins = 0, losses = 0, draws = 0;
|
|
239
|
+
console.log(flash_responses)
|
|
240
|
+
orders.map(o => {
|
|
241
|
+
let commission_pct = 0
|
|
242
|
+
if(o.commission_pct){ commission_pct = o.commission_pct }
|
|
243
|
+
order_ids.push(o.order_id)
|
|
244
|
+
if(o.status === 'approved'){
|
|
245
|
+
open_orders.push(o.order_id)
|
|
246
|
+
open_amt += o.open_amt
|
|
247
|
+
open_order_count += 1
|
|
248
|
+
potential_winnings += o.potential_winnings
|
|
249
|
+
called_amt += o.called_amt
|
|
250
|
+
}
|
|
251
|
+
if(!o.positions){ return }
|
|
252
|
+
o.positions.map(p => {
|
|
253
|
+
if(!p){ return }
|
|
254
|
+
num_trades += 1
|
|
255
|
+
cash_rcvd += p.cash_rcvd
|
|
256
|
+
if(!p.result_ind){
|
|
257
|
+
delayed_cash += p.delayed_cash
|
|
258
|
+
unresolved_stake += p.stake
|
|
259
|
+
unresolved_potential_winnings += p.potential_winnings
|
|
260
|
+
unresolved_potential_net_winnings += (p.potential_winnings - ((p.potential_winnings - p.stake) * commission_pct))
|
|
261
|
+
|
|
262
|
+
} else {
|
|
263
|
+
resolved_stake += p.stake
|
|
264
|
+
original_stake += p.original_stake
|
|
265
|
+
winnings += p.winnings
|
|
266
|
+
net_winnings += p.net_winnings
|
|
267
|
+
result_ind = p.result_ind
|
|
268
|
+
commission += p.commission
|
|
269
|
+
resolved_potential_winnings += p.potential_winnings
|
|
270
|
+
}
|
|
271
|
+
})
|
|
272
|
+
if(result_ind == 'win'){ wins += 1 }
|
|
273
|
+
if(result_ind == 'lose'){ losses += 1 }
|
|
274
|
+
if(result_ind == 'draw'){ draws += 1 }
|
|
275
|
+
})
|
|
276
|
+
|
|
277
|
+
if(parlay_positions && parlay_positions.length > 0){
|
|
278
|
+
parlay_positions.map(pp => {
|
|
279
|
+
if(!pp.result_ind){
|
|
280
|
+
unresolved_stake += pp.stake
|
|
281
|
+
original_stake += pp.stake
|
|
282
|
+
unresolved_potential_winnings += pp.potential_winnings
|
|
283
|
+
unresolved_potential_net_winnings += (pp.potential_winnings - ((pp.potential_winnings - pp.stake) * pp.commission_pct))
|
|
284
|
+
} else {
|
|
285
|
+
resolved_stake += pp.stake
|
|
286
|
+
original_stake += pp.stake
|
|
287
|
+
winnings += pp.winnings
|
|
288
|
+
net_winnings += pp.net_winnings
|
|
289
|
+
commission += pp.commission
|
|
290
|
+
resolved_potential_winnings += pp.potential_winnings
|
|
291
|
+
}
|
|
292
|
+
if(pp.result_ind == 'win'){ wins += 1 }
|
|
293
|
+
if(pp.result_ind == 'lose'){ losses += 1 }
|
|
294
|
+
if(pp.result_ind == 'draw'){ draws += 1 }
|
|
295
|
+
})
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
let unresolved_position_probability = unresolved_stake / unresolved_potential_winnings
|
|
299
|
+
let resolved_position_probability = resolved_stake / resolved_potential_winnings
|
|
300
|
+
let unresolved_position_odds = MarketComponentHelpers.calcAmericanOddsFromProbability(unresolved_position_probability)
|
|
301
|
+
let resolved_position_odds = MarketComponentHelpers.calcAmericanOddsFromProbability(resolved_position_probability)
|
|
302
|
+
let offer_probability = open_amt / potential_winnings
|
|
303
|
+
let offer_odds = MarketComponentHelpers.calcAmericanOddsFromProbability(offer_probability)
|
|
304
|
+
let earnings = winnings + cash_rcvd - original_stake
|
|
305
|
+
let net_earnings = net_winnings + cash_rcvd - original_stake
|
|
306
|
+
let roi = earnings / resolved_stake
|
|
307
|
+
return {
|
|
308
|
+
stat_id: 'ALL',
|
|
309
|
+
unresolved_stake,
|
|
310
|
+
earnings,
|
|
311
|
+
resolved_stake,
|
|
312
|
+
original_stake,
|
|
313
|
+
net_earnings,
|
|
314
|
+
roi,
|
|
315
|
+
wins,
|
|
316
|
+
losses,
|
|
317
|
+
commission,
|
|
318
|
+
net_winnings,
|
|
319
|
+
unresolved_potential_net_winnings,
|
|
320
|
+
unique_order_titles,
|
|
321
|
+
draws,
|
|
322
|
+
unresolved_position_odds,
|
|
323
|
+
resolved_position_odds,
|
|
324
|
+
result_ind,
|
|
325
|
+
delayed_cash,
|
|
326
|
+
unresolved_potential_winnings,
|
|
327
|
+
resolved_potential_winnings,
|
|
328
|
+
resolved_position_probability,
|
|
329
|
+
unresolved_position_probability,
|
|
330
|
+
num_trades,
|
|
331
|
+
cash_rcvd,
|
|
332
|
+
winnings,
|
|
333
|
+
player_id: orders[0]?.player_id??'0',
|
|
334
|
+
event_id: 'ALL',
|
|
335
|
+
event_type: 'ALL',
|
|
336
|
+
open_amt, potential_winnings, called_amt, offer_odds, offer_probability,
|
|
337
|
+
orders: order_ids,
|
|
338
|
+
open_orders
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
getDetailsForOrder: (order:OrderProps, events:EventProps[], tournaments:TournamentProps[], matches:MatchProps[], athletes:AthleteProps[], teams:TeamProps[], leagues:LeagueProps[]) => {
|
|
342
|
+
let event = order.event_type == 'team' ? events.find(e => e.event_id == order.event_id) : undefined
|
|
343
|
+
let tournament = order.event_type == 'tournament' ? tournaments.find(t => t.tournament_id == order.event_id) : undefined
|
|
344
|
+
let match = order.event_type == 'match' ? matches.find(m => m.match_id == order.event_id) : undefined
|
|
345
|
+
let match_tournament = tournaments.find(t => t.tournament_id == match?.tournament_id)
|
|
346
|
+
let deets = MyActionHelpers.getContestDetails(order.event_type, event, tournament, match);
|
|
347
|
+
let athlete = order.side_type == 'athlete' ? athletes.find(a => a.athlete_id == order.side_id) : undefined
|
|
348
|
+
let team = order.side_type == 'team' ? teams.find(t => t.team_id == order.side_id) : undefined
|
|
349
|
+
let league = event ? leagues.find(l => l.league_id == event.league_id) : tournament ? leagues.find(l => l.league_id == tournament.league_id) : match_tournament ? leagues.find(l => l.league_id == match_tournament.league_id) : undefined
|
|
350
|
+
return { event, tournament, match, athlete, team, contest_title: deets.contest_title, scheduled_datetime: deets.scheduled_datetime, league }
|
|
351
|
+
},
|
|
352
|
+
aggregatePositions: (parlay:ParlayProps, pp:ParlayPositionProps[]) => {
|
|
353
|
+
let stake = 0, potential_winnings = 0, winnings = 0, net_winnings = 0, offer_side = parlay.offer_side, commission = 0, status = 'inprogress'
|
|
354
|
+
let result_ind = pp[0]?.result_ind
|
|
355
|
+
pp.map(p => {
|
|
356
|
+
stake += p.stake
|
|
357
|
+
commission += p.commission
|
|
358
|
+
net_winnings += p.net_winnings
|
|
359
|
+
winnings += p.winnings
|
|
360
|
+
result_ind = p.result_ind
|
|
361
|
+
potential_winnings += p.potential_winnings
|
|
362
|
+
if(p.side == 'maker'){ offer_side = 'maker' }
|
|
363
|
+
if(p.status != 'inprogress'){ status = 'closed' }
|
|
364
|
+
});
|
|
365
|
+
let earnings = winnings - stake
|
|
366
|
+
return { stake, potential_winnings, earnings, winnings, commission, status, net_winnings , offer_side, result_ind}
|
|
367
|
+
},
|
|
368
|
+
getActionStats: (orders:OrderProps[], parlays:ParlayProps[], parlay_positions:ParlayPositionProps[], competitions:CompetitionProps[], squares_competitions:SquaresCompetitionProps[], bracket_competitions:BracketCompetitionProps[]) => {
|
|
369
|
+
let risk = 0
|
|
370
|
+
console.log(parlays)
|
|
371
|
+
orders.map(o => {
|
|
372
|
+
if(!o.positions || !o.positions[0]){ return }
|
|
373
|
+
o.positions.map(p => {
|
|
374
|
+
risk += p.stake
|
|
375
|
+
})
|
|
376
|
+
});
|
|
377
|
+
competitions.map(c => {
|
|
378
|
+
risk += parseFloat(c.buy_in as string)
|
|
379
|
+
});
|
|
380
|
+
squares_competitions.map(sc => {
|
|
381
|
+
console.log(sc);
|
|
382
|
+
risk += 0
|
|
383
|
+
});
|
|
384
|
+
bracket_competitions.map(bc => {
|
|
385
|
+
risk += bc.buy_in
|
|
386
|
+
});
|
|
387
|
+
parlay_positions.map(pp => {
|
|
388
|
+
risk += pp.stake
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
return { risk }
|
|
392
|
+
}
|
|
393
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text, View } from "../../Components/Themed"
|
|
3
|
+
import type { BracketCompetitionProps } from "../../types"
|
|
4
|
+
import { useColors } from '../../constants/useColors';
|
|
5
|
+
import { Icons } from '../../Components';
|
|
6
|
+
|
|
7
|
+
type BracketRowProps = {
|
|
8
|
+
market_type:'FOR_MONEY'|'FREE',
|
|
9
|
+
bracket_competition:BracketCompetitionProps,
|
|
10
|
+
width:number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const BracketRow = ({ market_type, bracket_competition, width }:BracketRowProps) => {
|
|
14
|
+
const Colors = useColors();
|
|
15
|
+
const cl = market_type == 'FOR_MONEY' ? '$' : 'E'
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<View>
|
|
19
|
+
<View type='row' style={{ padding:10, borderBottomWidth:1, borderColor:Colors.borders.light, flexWrap:'wrap' }}>
|
|
20
|
+
<Icons.BracketIcon size={22} color={Colors.text.h1} />
|
|
21
|
+
<View transparent style={{ borderRadius:0, padding:0, borderLeftWidth:1, borderColor:Colors.borders.light, flexGrow:1, marginLeft:6, paddingLeft:6, minWidth:75 }}>
|
|
22
|
+
<Text theme='h1' style={{ maxWidth:width * 0.55 }}>{bracket_competition.competition_name}</Text>
|
|
23
|
+
<Text theme='light' style={{ marginTop:3 }} color={Colors.text.action}>{}</Text>
|
|
24
|
+
</View>
|
|
25
|
+
<View style={{ margin:5, minWidth:40, justifyContent:'center', alignItems:'center' }}>
|
|
26
|
+
<Text theme='h1'>{cl}{(bracket_competition.buy_in as number).toFixed(2)}</Text>
|
|
27
|
+
<Text theme='light'>Risk</Text>
|
|
28
|
+
</View>
|
|
29
|
+
</View>
|
|
30
|
+
</View>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default BracketRow
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text, View } from "../../Components/Themed"
|
|
3
|
+
import type { CompetitionPlayerProps, CompetitionProps, CompetitionRecordProps, CompetitionResultProps, CompetitionResultTypeProps, CompetitionTypeProps } from "../../types"
|
|
4
|
+
import { useColors } from '../../constants/useColors';
|
|
5
|
+
import { Icons } from '../../Components';
|
|
6
|
+
|
|
7
|
+
type CompetitionRowProps = {
|
|
8
|
+
market_type:'FOR_MONEY'|'FREE',
|
|
9
|
+
competition:CompetitionProps,
|
|
10
|
+
competition_type:CompetitionTypeProps,
|
|
11
|
+
competition_result_type:CompetitionResultTypeProps,
|
|
12
|
+
competition_player:CompetitionPlayerProps,
|
|
13
|
+
competition_result:CompetitionResultProps,
|
|
14
|
+
competition_record:CompetitionRecordProps,
|
|
15
|
+
width:number
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const CompetitionRow = ({ market_type, competition, competition_record, width }:CompetitionRowProps) => {
|
|
19
|
+
const Colors = useColors();
|
|
20
|
+
const cl = market_type == 'FOR_MONEY' ? '$' : 'E'
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<View>
|
|
24
|
+
<View type='row' style={{ padding:10, borderBottomWidth:1, borderColor:Colors.borders.light, flexWrap:'wrap' }}>
|
|
25
|
+
<Icons.PickEmIcon size={22} color={Colors.text.h1} />
|
|
26
|
+
<View transparent style={{ borderRadius:0, padding:0, borderLeftWidth:1, borderColor:Colors.borders.light, flexGrow:1, marginLeft:6, paddingLeft:6, minWidth:75 }}>
|
|
27
|
+
<Text theme='h1' style={{ maxWidth:width * 0.55 }}>{competition.competition_name}</Text>
|
|
28
|
+
<Text theme='light' style={{ marginTop:3 }} color={Colors.text.action}>{competition_record.wins} - {competition_record.losses}</Text>
|
|
29
|
+
</View>
|
|
30
|
+
<View style={{ margin:5, minWidth:40, justifyContent:'center', alignItems:'center' }}>
|
|
31
|
+
<Text theme='h1'>{cl}{(competition.buy_in as number).toFixed(2)}</Text>
|
|
32
|
+
<Text theme='light'>Risk</Text>
|
|
33
|
+
</View>
|
|
34
|
+
</View>
|
|
35
|
+
</View>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default CompetitionRow
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Button, Text, View } from "../../Components/Themed"
|
|
3
|
+
import type { AthleteProps, EventProps, LeagueProps, MatchProps, OrderProps, TeamProps, TournamentProps } from "../../types"
|
|
4
|
+
import { useColors } from '../../constants/useColors';
|
|
5
|
+
import { Icons } from '../../Components';
|
|
6
|
+
import { MyActionHelpers } from '../api';
|
|
7
|
+
import { FlatList, Image } from 'react-native';
|
|
8
|
+
import { AthleteImage, TeamImage } from '../../Components/Jerseys';
|
|
9
|
+
import { MarketComponentHelpers } from '../../MarketComponents/api';
|
|
10
|
+
|
|
11
|
+
type ContestStatRowProps = {
|
|
12
|
+
market_type:'FOR_MONEY'|'FREE',
|
|
13
|
+
contest_label:string,
|
|
14
|
+
time_detail:string,
|
|
15
|
+
orders:OrderProps[],
|
|
16
|
+
leagues:LeagueProps[],
|
|
17
|
+
events:EventProps[],
|
|
18
|
+
tournaments:TournamentProps[],
|
|
19
|
+
matches:MatchProps[],
|
|
20
|
+
athletes:AthleteProps[],
|
|
21
|
+
teams:TeamProps[],
|
|
22
|
+
width:number
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const ContestStatRow = ({ market_type, contest_label, orders, width, events, tournaments, matches, athletes, teams, leagues }:ContestStatRowProps) => {
|
|
26
|
+
const Colors = useColors();
|
|
27
|
+
const [ expanded, setExpanded ] = useState(false);
|
|
28
|
+
const stats = MyActionHelpers.calcAllOrderStats(orders);
|
|
29
|
+
const stake = stats.unresolved_stake + stats.resolved_stake
|
|
30
|
+
const potential_winnings = stats.unresolved_potential_winnings + stats.resolved_potential_winnings
|
|
31
|
+
const cl = market_type == 'FOR_MONEY' ? '$' : 'E'
|
|
32
|
+
//Is this in progress?
|
|
33
|
+
const in_progress = stats.open_amt > 0 ? true : false
|
|
34
|
+
const settled = stats.result_ind ? true : false
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
const renderLegResult = (result_ind?:'win'|'lose'|'draw'|'inprogress') => {
|
|
38
|
+
switch(result_ind){
|
|
39
|
+
case 'win':
|
|
40
|
+
return <Icons.CheckIcon size={14} color={Colors.text.success} />
|
|
41
|
+
case 'lose':
|
|
42
|
+
return <Icons.CloseIcon size={14} color={Colors.text.error} />
|
|
43
|
+
case 'draw':
|
|
44
|
+
return <Icons.AlertIcon size={14} color={Colors.text.warning}/>
|
|
45
|
+
default:
|
|
46
|
+
return <Icons.ActivityIcon size={14} color={Colors.text.h1} />
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const renderOrders = (data:{ item:OrderProps, index:number }) => {
|
|
51
|
+
const { contest_title, athlete, team, league } = MyActionHelpers.getDetailsForOrder(data.item, events, tournaments, matches, athletes, teams, leagues);
|
|
52
|
+
const result_ind = data.item.positions[0]?.result_ind
|
|
53
|
+
return (
|
|
54
|
+
<View type='row' style={{ padding:10, borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
55
|
+
{team ?
|
|
56
|
+
<TeamImage
|
|
57
|
+
team={team}
|
|
58
|
+
league={league}
|
|
59
|
+
size={10}
|
|
60
|
+
/>
|
|
61
|
+
:athlete ?
|
|
62
|
+
<AthleteImage
|
|
63
|
+
athlete={athlete}
|
|
64
|
+
league={league}
|
|
65
|
+
size={24}
|
|
66
|
+
/>
|
|
67
|
+
:league ?
|
|
68
|
+
<Image
|
|
69
|
+
source={{ uri: league.league_image }}
|
|
70
|
+
style={{ height:18, width:18 }}
|
|
71
|
+
resizeMode="cover"
|
|
72
|
+
/>
|
|
73
|
+
:<></>
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
<View transparent style={{ flex:1, marginLeft:8 }}>
|
|
77
|
+
<Text theme='h2'>{data.item.title}</Text>
|
|
78
|
+
<View transparent style={{ marginTop:3 }}>
|
|
79
|
+
<Text theme="description">{contest_title}</Text>
|
|
80
|
+
</View>
|
|
81
|
+
</View>
|
|
82
|
+
{data.item.resolution_status != 'closed' ?
|
|
83
|
+
<Button float style={{ marginRight:4, marginLeft:4, padding:10, flexDirection:'row', justifyContent:'center', alignItems:'center' }} onPress={() => console.log('ehy')}>
|
|
84
|
+
<Icons.ActivityIcon size={18} color={Colors.text.action} />
|
|
85
|
+
<Text theme="action"> View</Text>
|
|
86
|
+
</Button>
|
|
87
|
+
:<></>}
|
|
88
|
+
<View style={{ padding:10 }}>
|
|
89
|
+
<Text theme="description">{MarketComponentHelpers.getOddsLabel(data.item.odds)}</Text>
|
|
90
|
+
</View>
|
|
91
|
+
{renderLegResult(result_ind)}
|
|
92
|
+
{result_ind == 'draw' ?
|
|
93
|
+
<View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, justifyContent:'center' }}>
|
|
94
|
+
<View style={{ borderBottomWidth:1, borderColor:Colors.borders.light, marginRight:20, marginLeft:20 }} />
|
|
95
|
+
</View>
|
|
96
|
+
:<></>}
|
|
97
|
+
</View>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<View transparent style={{ borderWidth:expanded ? 1: 0, borderColor:expanded ? Colors.text.action: undefined }}>
|
|
103
|
+
<View type='row' style={{ padding:10, borderBottomWidth:1, borderColor:Colors.borders.light, flexWrap:'wrap' }}>
|
|
104
|
+
<Button float style={{ padding:5 }}>
|
|
105
|
+
<Icons.OrderIcon size={14} color={Colors.text.action} />
|
|
106
|
+
</Button>
|
|
107
|
+
<Button transparent style={{ borderRadius:0, padding:0, borderLeftWidth:1, borderColor:Colors.borders.light, flexGrow:1, marginLeft:6, paddingLeft:6, minWidth:75 }} onPress={() => setExpanded(!expanded)}>
|
|
108
|
+
<Text theme='h1' style={{ maxWidth: width * 0.5 }}>{contest_label}</Text>
|
|
109
|
+
<Text theme='light' color={Colors.text.action} style={{ marginTop:3 }}>See {orders.length} Orders</Text>
|
|
110
|
+
</Button>
|
|
111
|
+
{width > 500 ?
|
|
112
|
+
<View style={{ margin:5, minWidth:40, justifyContent:'center', alignItems:'center' }}>
|
|
113
|
+
<Text theme='h1'>{orders.length}</Text>
|
|
114
|
+
<Text theme='light'>Orders</Text>
|
|
115
|
+
</View>
|
|
116
|
+
:<></>}
|
|
117
|
+
{in_progress ?
|
|
118
|
+
<View style={{ margin:5, minWidth:40, justifyContent:'center', alignItems:'center' }}>
|
|
119
|
+
<Text theme='h1' color={Colors.text.warning}>{stats.open_amt.toFixed(2)}</Text>
|
|
120
|
+
<Text theme='light' color={Colors.text.warning}>Open</Text>
|
|
121
|
+
</View>
|
|
122
|
+
:<></>}
|
|
123
|
+
<View style={{ margin:5, minWidth:40, justifyContent:'center', alignItems:'center' }}>
|
|
124
|
+
<Text theme='h1'>{cl}{stake.toFixed(2)}</Text>
|
|
125
|
+
<Text theme='light'>Risk</Text>
|
|
126
|
+
</View>
|
|
127
|
+
{settled ?
|
|
128
|
+
<View style={{ margin:5, minWidth:40, justifyContent:'center', alignItems:'center' }}>
|
|
129
|
+
<Text theme='h1'>{cl}{stats.winnings.toFixed(2)}</Text>
|
|
130
|
+
<Text theme='light'>Winnings</Text>
|
|
131
|
+
</View>
|
|
132
|
+
:
|
|
133
|
+
<View style={{ margin:5, minWidth:40, justifyContent:'center', alignItems:'center' }}>
|
|
134
|
+
<Text theme='h1'>{cl}{potential_winnings.toFixed(2)}</Text>
|
|
135
|
+
<Text theme='light'>Potential</Text>
|
|
136
|
+
</View>
|
|
137
|
+
}
|
|
138
|
+
</View>
|
|
139
|
+
{expanded ?
|
|
140
|
+
<View transparent style={{ padding:10 }}>
|
|
141
|
+
<FlatList
|
|
142
|
+
data={orders}
|
|
143
|
+
keyExtractor={item => item.order_id.toString()}
|
|
144
|
+
renderItem={renderOrders}
|
|
145
|
+
key={`contest_${contest_label}_orders`}
|
|
146
|
+
/>
|
|
147
|
+
</View>
|
|
148
|
+
:<></>}
|
|
149
|
+
</View>
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export default ContestStatRow
|