be-components 1.2.7 → 1.2.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/Competition/components/CompetitionCard.js +1 -1
- package/lib/commonjs/Competition/components/CompetitionCard.js.map +1 -1
- package/lib/commonjs/Competition/components/EnterCompetitionPrompt.js +1 -1
- package/lib/commonjs/Competition/components/EnterCompetitionPrompt.js.map +1 -1
- package/lib/commonjs/CompetitionManager/api/index.js +577 -0
- package/lib/commonjs/CompetitionManager/api/index.js.map +1 -0
- package/lib/commonjs/CompetitionManager/components/CompetitionContestsForm.js +439 -0
- package/lib/commonjs/CompetitionManager/components/CompetitionContestsForm.js.map +1 -0
- package/lib/commonjs/CompetitionManager/components/CompetitionInfoForm.js +269 -0
- package/lib/commonjs/CompetitionManager/components/CompetitionInfoForm.js.map +1 -0
- package/lib/commonjs/CompetitionManager/components/CompetitionMatchMarketCard.js +142 -0
- package/lib/commonjs/CompetitionManager/components/CompetitionMatchMarketCard.js.map +1 -0
- package/lib/commonjs/CompetitionManager/components/CompetitionSettingsForm.js +370 -0
- package/lib/commonjs/CompetitionManager/components/CompetitionSettingsForm.js.map +1 -0
- package/lib/commonjs/CompetitionManager/components/MarketSelector.js +99 -0
- package/lib/commonjs/CompetitionManager/components/MarketSelector.js.map +1 -0
- package/lib/commonjs/CompetitionManager/index.js +188 -0
- package/lib/commonjs/CompetitionManager/index.js.map +1 -0
- package/lib/commonjs/Components/Dropdown.js +98 -0
- package/lib/commonjs/Components/Dropdown.js.map +1 -0
- package/lib/commonjs/Components/Icons.js +1 -1
- package/lib/commonjs/Components/Icons.js.map +1 -1
- package/lib/commonjs/Markets/api/index.js +28 -0
- package/lib/commonjs/Markets/api/index.js.map +1 -0
- package/lib/commonjs/Markets/components/MarketButton.js +25 -0
- package/lib/commonjs/Markets/components/MarketButton.js.map +1 -0
- package/lib/commonjs/Squares/api/index.js.map +1 -1
- package/lib/commonjs/Squares/components/PrizeCard.js +161 -0
- package/lib/commonjs/Squares/components/PrizeCard.js.map +1 -0
- package/lib/commonjs/Squares/components/SquareCard.js.map +1 -1
- package/lib/commonjs/Squares/index.js +10 -1
- package/lib/commonjs/Squares/index.js.map +1 -1
- package/lib/commonjs/constants/styles.js +10 -0
- package/lib/commonjs/constants/styles.js.map +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/Competition/components/CompetitionCard.js +1 -1
- package/lib/module/Competition/components/CompetitionCard.js.map +1 -1
- package/lib/module/Competition/components/EnterCompetitionPrompt.js +1 -1
- package/lib/module/Competition/components/EnterCompetitionPrompt.js.map +1 -1
- package/lib/module/CompetitionManager/api/index.js +571 -0
- package/lib/module/CompetitionManager/api/index.js.map +1 -0
- package/lib/module/CompetitionManager/components/CompetitionContestsForm.js +434 -0
- package/lib/module/CompetitionManager/components/CompetitionContestsForm.js.map +1 -0
- package/lib/module/CompetitionManager/components/CompetitionInfoForm.js +262 -0
- package/lib/module/CompetitionManager/components/CompetitionInfoForm.js.map +1 -0
- package/lib/module/CompetitionManager/components/CompetitionMatchMarketCard.js +135 -0
- package/lib/module/CompetitionManager/components/CompetitionMatchMarketCard.js.map +1 -0
- package/lib/module/CompetitionManager/components/CompetitionSettingsForm.js +364 -0
- package/lib/module/CompetitionManager/components/CompetitionSettingsForm.js.map +1 -0
- package/lib/module/CompetitionManager/components/MarketSelector.js +92 -0
- package/lib/module/CompetitionManager/components/MarketSelector.js.map +1 -0
- package/lib/module/CompetitionManager/index.js +179 -0
- package/lib/module/CompetitionManager/index.js.map +1 -0
- package/lib/module/Components/Dropdown.js +89 -0
- package/lib/module/Components/Dropdown.js.map +1 -0
- package/lib/module/Components/Icons.js +1 -1
- package/lib/module/Components/Icons.js.map +1 -1
- package/lib/module/Markets/api/index.js +23 -0
- package/lib/module/Markets/api/index.js.map +1 -0
- package/lib/module/Markets/components/MarketButton.js +18 -0
- package/lib/module/Markets/components/MarketButton.js.map +1 -0
- package/lib/module/Squares/api/index.js.map +1 -1
- package/lib/module/Squares/components/PrizeCard.js +152 -0
- package/lib/module/Squares/components/PrizeCard.js.map +1 -0
- package/lib/module/Squares/components/SquareCard.js.map +1 -1
- package/lib/module/Squares/index.js +10 -1
- package/lib/module/Squares/index.js.map +1 -1
- package/lib/module/constants/styles.js +10 -0
- package/lib/module/constants/styles.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/CompetitionManager/api/index.d.ts +109 -0
- package/lib/typescript/src/CompetitionManager/api/index.d.ts.map +1 -0
- package/lib/typescript/src/CompetitionManager/components/CompetitionContestsForm.d.ts +23 -0
- package/lib/typescript/src/CompetitionManager/components/CompetitionContestsForm.d.ts.map +1 -0
- package/lib/typescript/src/CompetitionManager/components/CompetitionInfoForm.d.ts +10 -0
- package/lib/typescript/src/CompetitionManager/components/CompetitionInfoForm.d.ts.map +1 -0
- package/lib/typescript/src/CompetitionManager/components/CompetitionMatchMarketCard.d.ts +17 -0
- package/lib/typescript/src/CompetitionManager/components/CompetitionMatchMarketCard.d.ts.map +1 -0
- package/lib/typescript/src/CompetitionManager/components/CompetitionSettingsForm.d.ts +13 -0
- package/lib/typescript/src/CompetitionManager/components/CompetitionSettingsForm.d.ts.map +1 -0
- package/lib/typescript/src/CompetitionManager/components/MarketSelector.d.ts +13 -0
- package/lib/typescript/src/CompetitionManager/components/MarketSelector.d.ts.map +1 -0
- package/lib/typescript/src/CompetitionManager/index.d.ts +8 -0
- package/lib/typescript/src/CompetitionManager/index.d.ts.map +1 -0
- package/lib/typescript/src/Components/Dropdown.d.ts +15 -0
- package/lib/typescript/src/Components/Dropdown.d.ts.map +1 -0
- package/lib/typescript/src/Markets/api/index.d.ts +7 -0
- package/lib/typescript/src/Markets/api/index.d.ts.map +1 -0
- package/lib/typescript/src/Markets/components/MarketButton.d.ts +11 -0
- package/lib/typescript/src/Markets/components/MarketButton.d.ts.map +1 -0
- package/lib/typescript/src/Squares/api/index.d.ts +2 -1
- package/lib/typescript/src/Squares/api/index.d.ts.map +1 -1
- package/lib/typescript/src/Squares/components/PrizeCard.d.ts +11 -0
- package/lib/typescript/src/Squares/components/PrizeCard.d.ts.map +1 -0
- package/lib/typescript/src/Squares/components/SquareCard.d.ts.map +1 -1
- package/lib/typescript/src/Squares/index.d.ts.map +1 -1
- package/lib/typescript/src/constants/styles.d.ts +10 -0
- package/lib/typescript/src/constants/styles.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Competition/components/CompetitionCard.tsx +1 -1
- package/src/Competition/components/EnterCompetitionPrompt.tsx +2 -2
- package/src/CompetitionManager/api/index.ts +484 -0
- package/src/CompetitionManager/components/CompetitionContestsForm.tsx +473 -0
- package/src/CompetitionManager/components/CompetitionInfoForm.tsx +171 -0
- package/src/CompetitionManager/components/CompetitionMatchMarketCard.tsx +155 -0
- package/src/CompetitionManager/components/CompetitionSettingsForm.tsx +229 -0
- package/src/CompetitionManager/components/MarketSelector.tsx +66 -0
- package/src/CompetitionManager/index.tsx +163 -0
- package/src/Components/Dropdown.tsx +78 -0
- package/src/Components/Icons.tsx +1 -1
- package/src/Markets/api/index.ts +18 -0
- package/src/Markets/components/MarketButton.tsx +24 -0
- package/src/Squares/api/index.ts +2 -2
- package/src/Squares/components/PrizeCard.tsx +90 -0
- package/src/Squares/components/SquareCard.tsx +0 -1
- package/src/Squares/index.tsx +12 -2
- package/src/constants/styles.ts +5 -0
- package/src/index.tsx +2 -0
- package/src/types.d.ts +26 -2
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
//import { FlatList, Image, TouchableOpacity, View } from "react-native"
|
|
10
|
+
|
|
11
|
+
//import { ManageCompetitionApi } from '../api';
|
|
12
|
+
//import Colors from '../../constants/colors';
|
|
13
|
+
//import { Button, Icons, Text } from '../../Components';
|
|
14
|
+
//import CompetitionMatchMarketCard from './CompetitionMatchMarketCard';
|
|
15
|
+
//import moment from 'moment-mini';
|
|
16
|
+
//import { view_styles } from '../../constants/styles';
|
|
17
|
+
//import MarketSelector from './MarketSelector';
|
|
18
|
+
|
|
19
|
+
const CompetitionContestsForm = ({}) => {
|
|
20
|
+
/*
|
|
21
|
+
const [ expanded, setExpanded ] = useState(true);
|
|
22
|
+
const [ contests_visible, setContestsVisible ] = useState(false);
|
|
23
|
+
const [ show_match_markets, setShowMatchMarkets ] = useState<string[]>([]);
|
|
24
|
+
const [ selectable_athletes, setAthletes ] = useState<AthleteProps[]>([]);
|
|
25
|
+
const [ selectable_events, setTeamEvents ] = useState<EventProps[]>([]);
|
|
26
|
+
const [ competition_summaries, setCompetitionSummaries ] = useState<any[]>([]);
|
|
27
|
+
const [ show_athletes, setShowAthletes ] = useState<{
|
|
28
|
+
visible:boolean,
|
|
29
|
+
event_id?:string,
|
|
30
|
+
event_type?:string,
|
|
31
|
+
market_id?:string,
|
|
32
|
+
team_ids:string[],
|
|
33
|
+
restricted_ids?:string[],
|
|
34
|
+
top:number,
|
|
35
|
+
right:number,
|
|
36
|
+
positions:string[],
|
|
37
|
+
selected_athletes:string[],
|
|
38
|
+
}>({
|
|
39
|
+
visible:false,
|
|
40
|
+
positions:[],
|
|
41
|
+
top:0,
|
|
42
|
+
right:0,
|
|
43
|
+
selected_athletes:[],
|
|
44
|
+
team_ids:[]
|
|
45
|
+
})
|
|
46
|
+
const [ show_markets, setShowMarkets ] = useState<{
|
|
47
|
+
visible:boolean,
|
|
48
|
+
event_id?:string,
|
|
49
|
+
event_type?: string,
|
|
50
|
+
selected_markets:string[],
|
|
51
|
+
supported_markets:MarketProps[],
|
|
52
|
+
}>({
|
|
53
|
+
visible:false,
|
|
54
|
+
supported_markets: [],
|
|
55
|
+
selected_markets: [],
|
|
56
|
+
});
|
|
57
|
+
const unique_team_events = [ ...new Set(competition_matches.filter(cm => cm.event_type == 'team').map(cm => cm.event_id)) ]
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
/*
|
|
61
|
+
const handleSelectEvent = async(event:EventProps) => {
|
|
62
|
+
onSaveCompetitionMatch(competition.competition_id, event.event_id, 'team', 'event', event)
|
|
63
|
+
//setTeamEvents(team_events.concat(event))
|
|
64
|
+
}
|
|
65
|
+
*/
|
|
66
|
+
/*
|
|
67
|
+
const handleSelectAthlete = async(athlete:AthleteProps) => {
|
|
68
|
+
|
|
69
|
+
if(!show_athletes?.event_id){ return alert('Unable to process') }
|
|
70
|
+
setAthletes(athletes.concat(athlete))
|
|
71
|
+
let latest_trades = await MarketApi.getLatestTradesByEventIds([show_athletes.event_id], show_athletes.event_type);
|
|
72
|
+
latest_trades = latest_trades.filter(lt => lt.market_id == show_athletes.market_id && lt.market_type == 'FOR_MONEY' && lt.side_type == 'athlete' && lt.side_id == athlete.athlete_id);
|
|
73
|
+
if(latest_trades.length !== 2){ return alert('We do not have data for this athlete') }
|
|
74
|
+
//First we need to check if we have an empty competition match (match with no side_id_override)
|
|
75
|
+
const existing_cm = competition_matches.find(cm => cm.event_id == show_athletes.event_id && cm.event_type == show_athletes.event_type && cm.market_id_override == show_athletes.market_id && !cm.side_id_override);
|
|
76
|
+
if(existing_cm){
|
|
77
|
+
//Then we just need to add the side_id override to the cm and then create the cmms
|
|
78
|
+
onUpdateCompetitionMatch({ ...existing_cm, side_id_override: athlete.athlete_id })
|
|
79
|
+
//Create the cmms
|
|
80
|
+
const cmms:CompetitionMatchMarketProps[] = []
|
|
81
|
+
latest_trades.map(t => cmms.push({ ...createCompetitionMatchMarketFromTrade(t), competition_match_id: existing_cm.competition_match_id }))
|
|
82
|
+
if(cmms.length != 2){ return alert('Unable to process') }
|
|
83
|
+
onSaveCompetitionMatchMarkets(cmms)
|
|
84
|
+
} else {
|
|
85
|
+
//There was not an existing placeholder - we now need to auto create a match
|
|
86
|
+
switch(show_athletes.event_type){
|
|
87
|
+
case 'team':
|
|
88
|
+
const event = team_events.find(e => e.event_id == show_athletes.event_id)
|
|
89
|
+
if(!event){ return alert('Unable to process') }
|
|
90
|
+
const new_cm = await onSaveCompetitionMatch(competition.competition_id, show_athletes.event_id, show_athletes.event_type, 'athlete', event, show_athletes.market_id, 'athlete', athlete.athlete_id);
|
|
91
|
+
const cmms:CompetitionMatchMarketProps[] = []
|
|
92
|
+
latest_trades.map(t => cmms.push({ ...createCompetitionMatchMarketFromTrade(t), competition_match_id: new_cm.competition_match_id }))
|
|
93
|
+
if(cmms.length != 2){ return alert('Unable to process') }
|
|
94
|
+
onSaveCompetitionMatchMarkets(cmms)
|
|
95
|
+
break
|
|
96
|
+
default: return alert('Not handled for this!')
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
setShowAthletes({
|
|
100
|
+
...show_athletes,
|
|
101
|
+
selected_athletes: show_athletes.selected_athletes.concat(athlete.athlete_id)
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
}
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
/*
|
|
108
|
+
const handleSelectMarket = async(market:MarketProps) => {
|
|
109
|
+
|
|
110
|
+
if(!show_markets){ return alert('Unable to process') }
|
|
111
|
+
if(market.level == 'event' && market.primary_market){
|
|
112
|
+
let competition_match = competition_matches.find(cm => cm.event_id == show_markets.event_id && cm.event_type == show_markets.event_type && !cm.market_id_override)
|
|
113
|
+
if(!competition_match){ return alert('Unable to process this primary market!') }
|
|
114
|
+
//HERE IS HWERE WE WILL CREATE THE EMPTY MATCH MARKET!
|
|
115
|
+
let latest_trades = await MarketApi.getLatestTradesByEventIds([show_markets.event_id], show_markets.event_type);
|
|
116
|
+
latest_trades = latest_trades.filter(lt => lt.market_id == market.market_id && lt.market_type == 'FOR_MONEY');
|
|
117
|
+
if(latest_trades.length != 2){ return alert('Unable to add this market') }
|
|
118
|
+
const cmms:CompetitionMatchMarketProps[] = []
|
|
119
|
+
latest_trades.map(t => cmms.push({ ...createCompetitionMatchMarketFromTrade(t), competition_match_id: competition_match.competition_match_id }))
|
|
120
|
+
if(cmms.length != 2){ return alert('Unable to process') }
|
|
121
|
+
onSaveCompetitionMatchMarkets(cmms)
|
|
122
|
+
setShowMarkets({ ...show_markets, selected_markets: show_markets.selected_markets.concat(market.market_id)})
|
|
123
|
+
return
|
|
124
|
+
}
|
|
125
|
+
//Okay! This was a non-primary market
|
|
126
|
+
//There will not be an existing competition match so we need to create a new one!
|
|
127
|
+
if(market.event_type == 'team'){
|
|
128
|
+
let event = team_events.find(e => e.event_id == show_markets.event_id);
|
|
129
|
+
if(!event){ return alert('Unable to process this') }
|
|
130
|
+
onSaveCompetitionMatch(competition.competition_id, show_markets.event_id, show_markets.event_type, market.level, event, market.market_id, market.level, undefined);
|
|
131
|
+
setShowMarkets({ ...show_markets, selected_markets: show_markets.selected_markets.concat(market.market_id)})
|
|
132
|
+
return
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
}
|
|
136
|
+
*/
|
|
137
|
+
|
|
138
|
+
/*
|
|
139
|
+
const renderMarkets = (data: { item:string, index:number, event_id:string, event_type:string }) => {
|
|
140
|
+
const market = markets.find(m => m.market_id == data.item);
|
|
141
|
+
if(!market){ return <></> }
|
|
142
|
+
const show_details = show_match_markets.includes(`${data.event_type}:${data.event_id}:${data.item}`) ? true : false
|
|
143
|
+
return (
|
|
144
|
+
<TouchableOpacity style={{ flex:1,borderRadius:8, borderWidth:1, borderColor:Colors.shades.shade600, padding:10, margin:3, maxWidth:125, minWidth:75, backgroundColor:show_details ? Colors.brand.midnight : Colors.shades.white }}
|
|
145
|
+
onPress={() => {
|
|
146
|
+
if(show_details){ return setShowMatchMarkets(show_match_markets.filter(smm => smm != `${data.event_type}:${data.event_id}:${data.item}`)) }
|
|
147
|
+
return setShowMatchMarkets(show_match_markets.concat(`${data.event_type}:${data.event_id}:${data.item}`))
|
|
148
|
+
}}>
|
|
149
|
+
<Text size={14} color={show_details?Colors.shades.white:Colors.brand.midnight} weight="bold" textAlign="center">{market.stat_label ?? market.type}</Text>
|
|
150
|
+
<Text style={{ marginTop:3 }} size={12} color={show_details?Colors.shades.white:Colors.brand.midnight} textAlign="center">{market.description}</Text>
|
|
151
|
+
{market.level == 'athlete' && show_details ?
|
|
152
|
+
<Button
|
|
153
|
+
title="Add Athlete"
|
|
154
|
+
title_size={10}
|
|
155
|
+
style={{ marginTop:5 }}
|
|
156
|
+
title_color={Colors.brand.electric}
|
|
157
|
+
backgroundColor={Colors.shades.white}
|
|
158
|
+
onPress={async(evt) => {
|
|
159
|
+
|
|
160
|
+
if(data.event_type != 'team'){ return alert('Only supported for team based events currently') }
|
|
161
|
+
let latest_trades = await MarketApi.getLatestTradesByEventIds([data.event_id], data.event_type);
|
|
162
|
+
latest_trades = latest_trades.filter(lt => lt.market_id == data.item && lt.market_type == 'FOR_MONEY' && lt.side_type == 'athlete');
|
|
163
|
+
let restricted_ids = [ ...new Set(latest_trades.map(t => t.side_id)) ]
|
|
164
|
+
const event = team_events.find(e => e.event_id == data.event_id)
|
|
165
|
+
let team_ids = [event.away_team_id, event.home_team_id]
|
|
166
|
+
const selected_athletes = competition_matches.filter(cm => cm.event_id == data.event_id && cm.event_type == data.event_type && cm.market_id_override == data.item && cm.side_type_override=='athlete').map(cm => cm.side_id_override);
|
|
167
|
+
setShowAthletes({
|
|
168
|
+
visible: true,
|
|
169
|
+
selected_athletes,
|
|
170
|
+
team_ids,
|
|
171
|
+
market_id:data.item,
|
|
172
|
+
restricted_ids,
|
|
173
|
+
positions:market.supported_positions ?? [],
|
|
174
|
+
event_id:data.event_id,
|
|
175
|
+
event_type: data.event_type,
|
|
176
|
+
top:evt.nativeEvent.offsetX,
|
|
177
|
+
right:evt.nativeEvent.offsetY
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
}}
|
|
181
|
+
/>
|
|
182
|
+
:<></>}
|
|
183
|
+
</TouchableOpacity>
|
|
184
|
+
|
|
185
|
+
)
|
|
186
|
+
}
|
|
187
|
+
*/
|
|
188
|
+
|
|
189
|
+
/*
|
|
190
|
+
const showDetails = (show_event_id:string, show_event_type:string) => {
|
|
191
|
+
|
|
192
|
+
let show_cms:CompetitionMatchProps[] = []
|
|
193
|
+
show_match_markets.map(smm => {
|
|
194
|
+
let split_smm = smm.split(':')
|
|
195
|
+
let event_type = split_smm[0]
|
|
196
|
+
let event_id = split_smm[1]
|
|
197
|
+
let market_id = split_smm[2]
|
|
198
|
+
if(event_id != show_event_id){ return }
|
|
199
|
+
if(show_event_type != event_type){ return }
|
|
200
|
+
const market = markets.find(m => m.market_id == market_id);
|
|
201
|
+
if(market.level == 'event' && market.primary_market){
|
|
202
|
+
const primary_cm = competition_matches.find(cm => cm.event_id == event_id && cm.event_type == event_type && !cm.market_id_override);
|
|
203
|
+
const primary_cmms = competition_match_markets.filter(cmm => cmm.competition_match_id == primary_cm?.competition_match_id && cmm.market_id == market_id);
|
|
204
|
+
show_cms.push({ ...primary_cm, competition_match_markets:primary_cmms })
|
|
205
|
+
}
|
|
206
|
+
if(market.level == 'athlete'){
|
|
207
|
+
const cms = competition_matches.filter(cm => cm.event_id == event_id && cm.event_type == event_type && cm.market_id_override == market_id)
|
|
208
|
+
cms.map(cm => {
|
|
209
|
+
let cmm = competition_match_markets.filter(cmm => cmm.competition_match_id == cm.competition_match_id);
|
|
210
|
+
if(cmm.length == 2){
|
|
211
|
+
show_cms.push({ ...cm, competition_match_markets: cmm })
|
|
212
|
+
}
|
|
213
|
+
})
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
})
|
|
217
|
+
return show_cms
|
|
218
|
+
|
|
219
|
+
return []
|
|
220
|
+
}
|
|
221
|
+
*/
|
|
222
|
+
|
|
223
|
+
/*
|
|
224
|
+
const getMatchTitle = (cm:CompetitionMatchProps, market:MarketProps):{image_url?:string, header:string, description:string} => {
|
|
225
|
+
|
|
226
|
+
let error = { header: 'Market', description:market.description }
|
|
227
|
+
switch(cm.event_type){
|
|
228
|
+
case 'team':
|
|
229
|
+
const event = team_events.find(e => e.event_id == cm.event_id)
|
|
230
|
+
if(!event){ return error }
|
|
231
|
+
if(!cm.market_id_override){
|
|
232
|
+
//This is a primary one that we can just do the market name and event title
|
|
233
|
+
return { header: event.event_title, description: market.description }
|
|
234
|
+
}
|
|
235
|
+
switch(cm.side_type_override){
|
|
236
|
+
case 'athlete':
|
|
237
|
+
const athlete = athletes.find(a => a.athlete_id == cm.side_id_override)
|
|
238
|
+
if(!athlete){ return error }
|
|
239
|
+
return { image_url:athlete.image?.url, header: `${athlete.first_name} ${athlete.last_name} ${market.stat_label}`, description:market.description }
|
|
240
|
+
default: return error
|
|
241
|
+
}
|
|
242
|
+
default: return error
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
}
|
|
246
|
+
*/
|
|
247
|
+
|
|
248
|
+
/*
|
|
249
|
+
const renderCompetitionMatches = (data: { item:CompetitionMatchProps, index:number }) => {
|
|
250
|
+
if(!data.item.competition_match_markets){ return }
|
|
251
|
+
const market = markets.find(m => data.item.competition_match_markets && m.market_id == data.item.competition_match_markets[0]?.market_id)
|
|
252
|
+
if(!market){ return <></> }
|
|
253
|
+
const { image_url, header, description } = getMatchTitle(data.item, market)
|
|
254
|
+
let match_summaries = competition_summaries.filter(cs => cs.competition_match_id == data.item.competition_match_id && cs.market_id == market.market_id)
|
|
255
|
+
if(data.item.side_id_override){
|
|
256
|
+
match_summaries = match_summaries.filter(ms => ms.side_id == data.item.side_id_override);
|
|
257
|
+
}
|
|
258
|
+
return (
|
|
259
|
+
<View style={{ padding:10, flexDirection:'row', alignItems:'center', borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
260
|
+
<Button
|
|
261
|
+
title="X"
|
|
262
|
+
style={{ marginRight:5 }}
|
|
263
|
+
borderWidth={0}
|
|
264
|
+
title_size={12}
|
|
265
|
+
title_color={Colors.utility.error}
|
|
266
|
+
onPress={() => {
|
|
267
|
+
if(data.item.market_id_override){
|
|
268
|
+
//return onDeleteCompetitionMatch(data.item.competition_match_id)
|
|
269
|
+
}
|
|
270
|
+
//return onDeleteCompetitionMatchMarkets(data.item.competition_match_markets)
|
|
271
|
+
}}
|
|
272
|
+
/>
|
|
273
|
+
{image_url ?
|
|
274
|
+
<View style={{ padding:5 }}>
|
|
275
|
+
<Image
|
|
276
|
+
source={{ uri:image_url }}
|
|
277
|
+
style={{ marginRight:10, height:40, width:40, borderRadius:100 }}
|
|
278
|
+
resizeMode="center"
|
|
279
|
+
/>
|
|
280
|
+
</View>
|
|
281
|
+
:<></>}
|
|
282
|
+
<View style={{ flex:1 }}>
|
|
283
|
+
<Text size={14} weight='bold'>{header}</Text>
|
|
284
|
+
<Text style={{ marginTop:3 }} size={12} weight='bold'>{description}</Text>
|
|
285
|
+
</View>
|
|
286
|
+
<CompetitionMatchMarketCard
|
|
287
|
+
event_id={data.item.event_id}
|
|
288
|
+
event_type={data.item.event_type}
|
|
289
|
+
competition_match_id={data.item.competition_match_id}
|
|
290
|
+
competition_match_markets={data.item.competition_match_markets}
|
|
291
|
+
competition_summaries={match_summaries}
|
|
292
|
+
market={market}
|
|
293
|
+
onSaveMarkets={(cmms) => console.log(cmms)}
|
|
294
|
+
onUpdateMarkets={(cmms) => console.log(cmms)}
|
|
295
|
+
onGenerateMarkets={() => console.log('Blah')}
|
|
296
|
+
/>
|
|
297
|
+
</View>
|
|
298
|
+
)
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
const renderTeamEvents = (data: { item:string, index:number }) => {
|
|
302
|
+
const event = events.find(e => e.event_id == data.item);
|
|
303
|
+
if(!event){ return <></> }
|
|
304
|
+
if(!event.supported_markets){ return <></> }
|
|
305
|
+
const supported_markets = markets.filter(m => event.supported_markets?.map(sm => sm.market_id.toString()).includes(m.market_id.toString()));
|
|
306
|
+
const cms = competition_matches.filter(cm => cm.event_id == data.item && cm.event_type == 'team');
|
|
307
|
+
const cmms = competition_match_markets.filter(cmm => cms.map(cm => cm.competition_match_id.toString()).includes(cmm.competition_match_id));
|
|
308
|
+
const unique_market_ids = [ ...new Set(cmms.map(cmm => cmm.market_id).concat(cms.filter(cm => cm.market_id_override).map(cm => cm.market_id_override))) ]
|
|
309
|
+
const league = leagues.find(l => l.league_id == event.league_id);
|
|
310
|
+
const visible_matches = showDetails(data.item, 'team')
|
|
311
|
+
return (
|
|
312
|
+
<View style={{ borderWidth:1, borderColor:Colors.shades.shade600, borderRadius:8, margin:10, zIndex: data.index * -1 }}>
|
|
313
|
+
<View style={{ flexDirection:'row', padding:15, zIndex:1}}>
|
|
314
|
+
{['pending','paused'].includes(competition.status) && cms.length == 1 && cmms.length == 0 ?
|
|
315
|
+
<Button
|
|
316
|
+
title="X"
|
|
317
|
+
title_color={Colors.utility.error}
|
|
318
|
+
borderRadius={8}
|
|
319
|
+
borderWidth={1}
|
|
320
|
+
borderColor={Colors.utility.error}
|
|
321
|
+
onPress={() => onDeleteCompetitionMatch(cms[0]?.competition_match_id)}
|
|
322
|
+
/>
|
|
323
|
+
:<></>}
|
|
324
|
+
<View style={{ flex:1, flexDirection:'row', alignItems:'center' }}>
|
|
325
|
+
{league?.league_image ?
|
|
326
|
+
<Image
|
|
327
|
+
source={{ uri: league.league_image }}
|
|
328
|
+
style={{ height:30, width:30, marginRight:10 }}
|
|
329
|
+
resizeMode="cover"
|
|
330
|
+
/>
|
|
331
|
+
:<></>}
|
|
332
|
+
<View>
|
|
333
|
+
<Text size={14} color={Colors.brand.midnight} weight='bold'>{event.away.market_name} {event.away.name} vs {event.home.market_name} {event.home.name}</Text>
|
|
334
|
+
<Text style={{ marginTop:4 }} size={12} color={Colors.brand.midnight}>{moment(event.scheduled_datetime).format('MMMM DD hh:mm a')}</Text>
|
|
335
|
+
</View>
|
|
336
|
+
</View>
|
|
337
|
+
<Button
|
|
338
|
+
title="Add Markets"
|
|
339
|
+
title_color={Colors.shades.white}
|
|
340
|
+
backgroundColor={Colors.brand.midnight}
|
|
341
|
+
onPress={() => {
|
|
342
|
+
setShowMarkets({
|
|
343
|
+
visible:true,
|
|
344
|
+
event_id: data.item,
|
|
345
|
+
event_type: 'team',
|
|
346
|
+
selected_markets:unique_market_ids,
|
|
347
|
+
supported_markets,
|
|
348
|
+
})
|
|
349
|
+
}}
|
|
350
|
+
/>
|
|
351
|
+
<View style={{ position:'absolute', top:0, right:0, ...view_styles.section, maxWidth:300 }}>
|
|
352
|
+
<MarketSelector
|
|
353
|
+
visible={show_markets.event_id == data.item ? true : false}
|
|
354
|
+
markets={show_markets.supported_markets}
|
|
355
|
+
selected_markets={show_markets.selected_markets}
|
|
356
|
+
onSelectMarket={(market) => handleSelectMarket(market)}
|
|
357
|
+
onDeselectMarket={(market) => console.log(market)}
|
|
358
|
+
onClose={() => setShowMarkets({ visible: false, supported_markets:[], selected_markets:[] })}
|
|
359
|
+
/>
|
|
360
|
+
</View>
|
|
361
|
+
</View>
|
|
362
|
+
{unique_market_ids.length > 0 ?
|
|
363
|
+
<View style={{ padding:10, backgroundColor:Colors.shades.shade100 }}>
|
|
364
|
+
<Text style={{ marginBottom:5 }} size={16} weight='bold'>Selected Markets</Text>
|
|
365
|
+
<View style={{ flexDirection:'row', flexWrap: 'wrap', padding:10 }}>
|
|
366
|
+
{unique_market_ids.map((market_id, index) => {
|
|
367
|
+
return (
|
|
368
|
+
renderMarkets({ item: market_id, index, event_id:data.item, event_type:'team' })
|
|
369
|
+
)
|
|
370
|
+
})}
|
|
371
|
+
</View>
|
|
372
|
+
</View>
|
|
373
|
+
:<></>}
|
|
374
|
+
{visible_matches.length > 0 ?
|
|
375
|
+
<FlatList
|
|
376
|
+
data={visible_matches}
|
|
377
|
+
renderItem={renderCompetitionMatches}
|
|
378
|
+
keyExtractor={(item) => item.competition_match_id.toString()}
|
|
379
|
+
/>
|
|
380
|
+
:<></>}
|
|
381
|
+
</View>
|
|
382
|
+
)
|
|
383
|
+
}
|
|
384
|
+
*/
|
|
385
|
+
|
|
386
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
387
|
+
/*
|
|
388
|
+
return (
|
|
389
|
+
<View style={{ ...view_styles.section, minWidth:350, flexGrow:1, maxWidth:width }}>
|
|
390
|
+
<TouchableOpacity style={{ ...view_styles.section_header }} onPress={() => setExpanded(!expanded)}>
|
|
391
|
+
<View style={{ flex:1, marginRight:10 }}>
|
|
392
|
+
<Text theme='header'>Competition Contests</Text>
|
|
393
|
+
<Text style={{ marginTop:3 }} theme='body'>Competitions require contests for users to make picks / wagers. Select 'Add Contests' to get started.</Text>
|
|
394
|
+
</View>
|
|
395
|
+
<Icons.ChevronIcon direction={expanded ? 'up' : 'down'} size={8} color={Colors.brand.midnight} />
|
|
396
|
+
</TouchableOpacity>
|
|
397
|
+
{expanded ?
|
|
398
|
+
<View style={{ ...view_styles.section_body }}>
|
|
399
|
+
{unique_team_events.map((id, index) => {
|
|
400
|
+
return renderTeamEvents({ item:id, index })
|
|
401
|
+
})}
|
|
402
|
+
</View>
|
|
403
|
+
:<></>}
|
|
404
|
+
</View>
|
|
405
|
+
)
|
|
406
|
+
*/
|
|
407
|
+
};
|
|
408
|
+
var _default = exports.default = CompetitionContestsForm;
|
|
409
|
+
/*
|
|
410
|
+
<View style={{ position:'absolute', top:show_athletes.top, right:show_athletes.right }}>
|
|
411
|
+
<AthleteSelector
|
|
412
|
+
onClose={() => setShowAthletes({ visible:false, positions:[], selected_athletes: [], top:0, right:0, team_ids:[] })}
|
|
413
|
+
onDeselectAthlete={(athlete) => console.log(athlete)}
|
|
414
|
+
onSelectAthlete={(athlete) => handleSelectAthlete(athlete)}
|
|
415
|
+
team_ids={show_athletes.team_ids}
|
|
416
|
+
restricted_ids={show_athletes.restricted_ids}
|
|
417
|
+
selected_athletes={show_athletes.selected_athletes}
|
|
418
|
+
visible={show_athletes.visible}
|
|
419
|
+
/>
|
|
420
|
+
</View>
|
|
421
|
+
*/
|
|
422
|
+
/*
|
|
423
|
+
<Button
|
|
424
|
+
title="Add Contests"
|
|
425
|
+
backgroundColor={Colors.brand.electric}
|
|
426
|
+
title_color={Colors.shades.white}
|
|
427
|
+
onPress={() => setContestsVisible(true)}
|
|
428
|
+
/>
|
|
429
|
+
<View style={{ position:'absolute', top:0, right:0 }}>
|
|
430
|
+
<ContestSelector
|
|
431
|
+
visible={contests_visible}
|
|
432
|
+
selected_events={unique_team_events}
|
|
433
|
+
onSelectEvent={(event) => handleSelectEvent(event)}
|
|
434
|
+
onDeselectEvent={(event) => console.log(event)}
|
|
435
|
+
onClose={() => setContestsVisible(false)}
|
|
436
|
+
/>
|
|
437
|
+
</View>
|
|
438
|
+
*/
|
|
439
|
+
//# sourceMappingURL=CompetitionContestsForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","obj","__esModule","default","CompetitionContestsForm","createElement","Fragment","_default","exports"],"sourceRoot":"../../../../src","sources":["CompetitionManager/components/CompetitionContestsForm.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA+B,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAC/B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAwBA,MAAMG,uBAAuB,GAAGA,CAAC,CAA+B,CAAC,KAAK;EAElE;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAIA;AACA;AACA;AACA;AACA;AACA;EACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAEI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAGI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAOI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAEI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAGI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAMI,oBAAQN,MAAA,CAAAK,OAAA,CAAAE,aAAA,CAAAP,MAAA,CAAAK,OAAA,CAAAG,QAAA,MAAI,CAAC;EACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAL,OAAA,GAEcC,uBAAuB;AAItC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|