be-components 1.2.7 → 1.2.9
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 +182 -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 +173 -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 +95 -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,473 @@
|
|
|
1
|
+
import React, { } from 'react';
|
|
2
|
+
//import { FlatList, Image, TouchableOpacity, View } from "react-native"
|
|
3
|
+
import type { AthleteProps, CompetitionMatchMarketProps, CompetitionMatchProps, CompetitionProps, EventProps, LeagueProps, MarketProps, MatchProps, TeamProps, TournamentProps } from '../../types';
|
|
4
|
+
//import { ManageCompetitionApi } from '../api';
|
|
5
|
+
//import Colors from '../../constants/colors';
|
|
6
|
+
//import { Button, Icons, Text } from '../../Components';
|
|
7
|
+
//import CompetitionMatchMarketCard from './CompetitionMatchMarketCard';
|
|
8
|
+
//import moment from 'moment-mini';
|
|
9
|
+
//import { view_styles } from '../../constants/styles';
|
|
10
|
+
//import MarketSelector from './MarketSelector';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
type CompetitionContestsFormProps = {
|
|
15
|
+
width:number,
|
|
16
|
+
competition:CompetitionProps,
|
|
17
|
+
markets:MarketProps[],
|
|
18
|
+
leagues:LeagueProps[],
|
|
19
|
+
events:EventProps[],
|
|
20
|
+
tournaments:TournamentProps[],
|
|
21
|
+
matches:MatchProps[],
|
|
22
|
+
athletes:AthleteProps[],
|
|
23
|
+
teams:TeamProps[],
|
|
24
|
+
competition_matches: CompetitionMatchProps[],
|
|
25
|
+
competition_match_markets:CompetitionMatchMarketProps[],
|
|
26
|
+
onSaveCompetitionMatch:(competition_id:string, event_id:string, event_type:string, match_type:string, event:EventProps, market_id_override?:string, side_type_override?:string, side_id_override?:string) => void,
|
|
27
|
+
onUpdateCompetitionMatch:(cm:CompetitionMatchProps) => void,
|
|
28
|
+
onSaveCompetitionMatchMarkets: (cmms:CompetitionMatchMarketProps[]) => void,
|
|
29
|
+
onDeleteCompetitionMatchMarkets:(cmms:CompetitionMatchMarketProps[]) => void,
|
|
30
|
+
onDeleteCompetitionMatch: (competition_match_id:string) => void
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
const CompetitionContestsForm = ({ }:CompetitionContestsFormProps) => {
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
const [ expanded, setExpanded ] = useState(true);
|
|
38
|
+
const [ contests_visible, setContestsVisible ] = useState(false);
|
|
39
|
+
const [ show_match_markets, setShowMatchMarkets ] = useState<string[]>([]);
|
|
40
|
+
const [ selectable_athletes, setAthletes ] = useState<AthleteProps[]>([]);
|
|
41
|
+
const [ selectable_events, setTeamEvents ] = useState<EventProps[]>([]);
|
|
42
|
+
const [ competition_summaries, setCompetitionSummaries ] = useState<any[]>([]);
|
|
43
|
+
const [ show_athletes, setShowAthletes ] = useState<{
|
|
44
|
+
visible:boolean,
|
|
45
|
+
event_id?:string,
|
|
46
|
+
event_type?:string,
|
|
47
|
+
market_id?:string,
|
|
48
|
+
team_ids:string[],
|
|
49
|
+
restricted_ids?:string[],
|
|
50
|
+
top:number,
|
|
51
|
+
right:number,
|
|
52
|
+
positions:string[],
|
|
53
|
+
selected_athletes:string[],
|
|
54
|
+
|
|
55
|
+
}>({
|
|
56
|
+
visible:false,
|
|
57
|
+
positions:[],
|
|
58
|
+
top:0,
|
|
59
|
+
right:0,
|
|
60
|
+
selected_athletes:[],
|
|
61
|
+
team_ids:[]
|
|
62
|
+
})
|
|
63
|
+
const [ show_markets, setShowMarkets ] = useState<{
|
|
64
|
+
visible:boolean,
|
|
65
|
+
event_id?:string,
|
|
66
|
+
event_type?: string,
|
|
67
|
+
selected_markets:string[],
|
|
68
|
+
supported_markets:MarketProps[],
|
|
69
|
+
}>({
|
|
70
|
+
visible:false,
|
|
71
|
+
supported_markets: [],
|
|
72
|
+
selected_markets: [],
|
|
73
|
+
});
|
|
74
|
+
const unique_team_events = [ ...new Set(competition_matches.filter(cm => cm.event_type == 'team').map(cm => cm.event_id)) ]
|
|
75
|
+
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
/*
|
|
79
|
+
const handleSelectEvent = async(event:EventProps) => {
|
|
80
|
+
onSaveCompetitionMatch(competition.competition_id, event.event_id, 'team', 'event', event)
|
|
81
|
+
//setTeamEvents(team_events.concat(event))
|
|
82
|
+
}
|
|
83
|
+
*/
|
|
84
|
+
/*
|
|
85
|
+
const handleSelectAthlete = async(athlete:AthleteProps) => {
|
|
86
|
+
|
|
87
|
+
if(!show_athletes?.event_id){ return alert('Unable to process') }
|
|
88
|
+
setAthletes(athletes.concat(athlete))
|
|
89
|
+
let latest_trades = await MarketApi.getLatestTradesByEventIds([show_athletes.event_id], show_athletes.event_type);
|
|
90
|
+
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);
|
|
91
|
+
if(latest_trades.length !== 2){ return alert('We do not have data for this athlete') }
|
|
92
|
+
//First we need to check if we have an empty competition match (match with no side_id_override)
|
|
93
|
+
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);
|
|
94
|
+
if(existing_cm){
|
|
95
|
+
//Then we just need to add the side_id override to the cm and then create the cmms
|
|
96
|
+
onUpdateCompetitionMatch({ ...existing_cm, side_id_override: athlete.athlete_id })
|
|
97
|
+
//Create the cmms
|
|
98
|
+
const cmms:CompetitionMatchMarketProps[] = []
|
|
99
|
+
latest_trades.map(t => cmms.push({ ...createCompetitionMatchMarketFromTrade(t), competition_match_id: existing_cm.competition_match_id }))
|
|
100
|
+
if(cmms.length != 2){ return alert('Unable to process') }
|
|
101
|
+
onSaveCompetitionMatchMarkets(cmms)
|
|
102
|
+
} else {
|
|
103
|
+
//There was not an existing placeholder - we now need to auto create a match
|
|
104
|
+
switch(show_athletes.event_type){
|
|
105
|
+
case 'team':
|
|
106
|
+
const event = team_events.find(e => e.event_id == show_athletes.event_id)
|
|
107
|
+
if(!event){ return alert('Unable to process') }
|
|
108
|
+
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);
|
|
109
|
+
const cmms:CompetitionMatchMarketProps[] = []
|
|
110
|
+
latest_trades.map(t => cmms.push({ ...createCompetitionMatchMarketFromTrade(t), competition_match_id: new_cm.competition_match_id }))
|
|
111
|
+
if(cmms.length != 2){ return alert('Unable to process') }
|
|
112
|
+
onSaveCompetitionMatchMarkets(cmms)
|
|
113
|
+
break
|
|
114
|
+
default: return alert('Not handled for this!')
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
setShowAthletes({
|
|
118
|
+
...show_athletes,
|
|
119
|
+
selected_athletes: show_athletes.selected_athletes.concat(athlete.athlete_id)
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
}
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
/*
|
|
126
|
+
|
|
127
|
+
const handleSelectMarket = async(market:MarketProps) => {
|
|
128
|
+
|
|
129
|
+
if(!show_markets){ return alert('Unable to process') }
|
|
130
|
+
if(market.level == 'event' && market.primary_market){
|
|
131
|
+
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)
|
|
132
|
+
if(!competition_match){ return alert('Unable to process this primary market!') }
|
|
133
|
+
//HERE IS HWERE WE WILL CREATE THE EMPTY MATCH MARKET!
|
|
134
|
+
let latest_trades = await MarketApi.getLatestTradesByEventIds([show_markets.event_id], show_markets.event_type);
|
|
135
|
+
latest_trades = latest_trades.filter(lt => lt.market_id == market.market_id && lt.market_type == 'FOR_MONEY');
|
|
136
|
+
if(latest_trades.length != 2){ return alert('Unable to add this market') }
|
|
137
|
+
const cmms:CompetitionMatchMarketProps[] = []
|
|
138
|
+
latest_trades.map(t => cmms.push({ ...createCompetitionMatchMarketFromTrade(t), competition_match_id: competition_match.competition_match_id }))
|
|
139
|
+
if(cmms.length != 2){ return alert('Unable to process') }
|
|
140
|
+
onSaveCompetitionMatchMarkets(cmms)
|
|
141
|
+
setShowMarkets({ ...show_markets, selected_markets: show_markets.selected_markets.concat(market.market_id)})
|
|
142
|
+
return
|
|
143
|
+
}
|
|
144
|
+
//Okay! This was a non-primary market
|
|
145
|
+
//There will not be an existing competition match so we need to create a new one!
|
|
146
|
+
if(market.event_type == 'team'){
|
|
147
|
+
let event = team_events.find(e => e.event_id == show_markets.event_id);
|
|
148
|
+
if(!event){ return alert('Unable to process this') }
|
|
149
|
+
onSaveCompetitionMatch(competition.competition_id, show_markets.event_id, show_markets.event_type, market.level, event, market.market_id, market.level, undefined);
|
|
150
|
+
setShowMarkets({ ...show_markets, selected_markets: show_markets.selected_markets.concat(market.market_id)})
|
|
151
|
+
return
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
}
|
|
155
|
+
*/
|
|
156
|
+
|
|
157
|
+
/*
|
|
158
|
+
|
|
159
|
+
const renderMarkets = (data: { item:string, index:number, event_id:string, event_type:string }) => {
|
|
160
|
+
const market = markets.find(m => m.market_id == data.item);
|
|
161
|
+
if(!market){ return <></> }
|
|
162
|
+
const show_details = show_match_markets.includes(`${data.event_type}:${data.event_id}:${data.item}`) ? true : false
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<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 }}
|
|
166
|
+
onPress={() => {
|
|
167
|
+
if(show_details){ return setShowMatchMarkets(show_match_markets.filter(smm => smm != `${data.event_type}:${data.event_id}:${data.item}`)) }
|
|
168
|
+
return setShowMatchMarkets(show_match_markets.concat(`${data.event_type}:${data.event_id}:${data.item}`))
|
|
169
|
+
}}>
|
|
170
|
+
<Text size={14} color={show_details?Colors.shades.white:Colors.brand.midnight} weight="bold" textAlign="center">{market.stat_label ?? market.type}</Text>
|
|
171
|
+
<Text style={{ marginTop:3 }} size={12} color={show_details?Colors.shades.white:Colors.brand.midnight} textAlign="center">{market.description}</Text>
|
|
172
|
+
{market.level == 'athlete' && show_details ?
|
|
173
|
+
<Button
|
|
174
|
+
title="Add Athlete"
|
|
175
|
+
title_size={10}
|
|
176
|
+
style={{ marginTop:5 }}
|
|
177
|
+
title_color={Colors.brand.electric}
|
|
178
|
+
backgroundColor={Colors.shades.white}
|
|
179
|
+
onPress={async(evt) => {
|
|
180
|
+
|
|
181
|
+
if(data.event_type != 'team'){ return alert('Only supported for team based events currently') }
|
|
182
|
+
|
|
183
|
+
let latest_trades = await MarketApi.getLatestTradesByEventIds([data.event_id], data.event_type);
|
|
184
|
+
latest_trades = latest_trades.filter(lt => lt.market_id == data.item && lt.market_type == 'FOR_MONEY' && lt.side_type == 'athlete');
|
|
185
|
+
let restricted_ids = [ ...new Set(latest_trades.map(t => t.side_id)) ]
|
|
186
|
+
const event = team_events.find(e => e.event_id == data.event_id)
|
|
187
|
+
let team_ids = [event.away_team_id, event.home_team_id]
|
|
188
|
+
|
|
189
|
+
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);
|
|
190
|
+
|
|
191
|
+
setShowAthletes({
|
|
192
|
+
visible: true,
|
|
193
|
+
selected_athletes,
|
|
194
|
+
team_ids,
|
|
195
|
+
market_id:data.item,
|
|
196
|
+
restricted_ids,
|
|
197
|
+
positions:market.supported_positions ?? [],
|
|
198
|
+
event_id:data.event_id,
|
|
199
|
+
event_type: data.event_type,
|
|
200
|
+
top:evt.nativeEvent.offsetX,
|
|
201
|
+
right:evt.nativeEvent.offsetY
|
|
202
|
+
})
|
|
203
|
+
|
|
204
|
+
}}
|
|
205
|
+
/>
|
|
206
|
+
:<></>}
|
|
207
|
+
</TouchableOpacity>
|
|
208
|
+
|
|
209
|
+
)
|
|
210
|
+
}
|
|
211
|
+
*/
|
|
212
|
+
|
|
213
|
+
/*
|
|
214
|
+
const showDetails = (show_event_id:string, show_event_type:string) => {
|
|
215
|
+
|
|
216
|
+
let show_cms:CompetitionMatchProps[] = []
|
|
217
|
+
show_match_markets.map(smm => {
|
|
218
|
+
let split_smm = smm.split(':')
|
|
219
|
+
let event_type = split_smm[0]
|
|
220
|
+
let event_id = split_smm[1]
|
|
221
|
+
let market_id = split_smm[2]
|
|
222
|
+
if(event_id != show_event_id){ return }
|
|
223
|
+
if(show_event_type != event_type){ return }
|
|
224
|
+
const market = markets.find(m => m.market_id == market_id);
|
|
225
|
+
if(market.level == 'event' && market.primary_market){
|
|
226
|
+
const primary_cm = competition_matches.find(cm => cm.event_id == event_id && cm.event_type == event_type && !cm.market_id_override);
|
|
227
|
+
const primary_cmms = competition_match_markets.filter(cmm => cmm.competition_match_id == primary_cm?.competition_match_id && cmm.market_id == market_id);
|
|
228
|
+
show_cms.push({ ...primary_cm, competition_match_markets:primary_cmms })
|
|
229
|
+
}
|
|
230
|
+
if(market.level == 'athlete'){
|
|
231
|
+
const cms = competition_matches.filter(cm => cm.event_id == event_id && cm.event_type == event_type && cm.market_id_override == market_id)
|
|
232
|
+
cms.map(cm => {
|
|
233
|
+
let cmm = competition_match_markets.filter(cmm => cmm.competition_match_id == cm.competition_match_id);
|
|
234
|
+
if(cmm.length == 2){
|
|
235
|
+
show_cms.push({ ...cm, competition_match_markets: cmm })
|
|
236
|
+
}
|
|
237
|
+
})
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
})
|
|
241
|
+
return show_cms
|
|
242
|
+
|
|
243
|
+
return []
|
|
244
|
+
}
|
|
245
|
+
*/
|
|
246
|
+
|
|
247
|
+
/*
|
|
248
|
+
|
|
249
|
+
const getMatchTitle = (cm:CompetitionMatchProps, market:MarketProps):{image_url?:string, header:string, description:string} => {
|
|
250
|
+
|
|
251
|
+
let error = { header: 'Market', description:market.description }
|
|
252
|
+
switch(cm.event_type){
|
|
253
|
+
case 'team':
|
|
254
|
+
const event = team_events.find(e => e.event_id == cm.event_id)
|
|
255
|
+
if(!event){ return error }
|
|
256
|
+
if(!cm.market_id_override){
|
|
257
|
+
//This is a primary one that we can just do the market name and event title
|
|
258
|
+
return { header: event.event_title, description: market.description }
|
|
259
|
+
}
|
|
260
|
+
switch(cm.side_type_override){
|
|
261
|
+
case 'athlete':
|
|
262
|
+
const athlete = athletes.find(a => a.athlete_id == cm.side_id_override)
|
|
263
|
+
if(!athlete){ return error }
|
|
264
|
+
return { image_url:athlete.image?.url, header: `${athlete.first_name} ${athlete.last_name} ${market.stat_label}`, description:market.description }
|
|
265
|
+
default: return error
|
|
266
|
+
}
|
|
267
|
+
default: return error
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
}
|
|
271
|
+
*/
|
|
272
|
+
|
|
273
|
+
/*
|
|
274
|
+
|
|
275
|
+
const renderCompetitionMatches = (data: { item:CompetitionMatchProps, index:number }) => {
|
|
276
|
+
if(!data.item.competition_match_markets){ return }
|
|
277
|
+
const market = markets.find(m => data.item.competition_match_markets && m.market_id == data.item.competition_match_markets[0]?.market_id)
|
|
278
|
+
if(!market){ return <></> }
|
|
279
|
+
|
|
280
|
+
const { image_url, header, description } = getMatchTitle(data.item, market)
|
|
281
|
+
let match_summaries = competition_summaries.filter(cs => cs.competition_match_id == data.item.competition_match_id && cs.market_id == market.market_id)
|
|
282
|
+
if(data.item.side_id_override){
|
|
283
|
+
match_summaries = match_summaries.filter(ms => ms.side_id == data.item.side_id_override);
|
|
284
|
+
}
|
|
285
|
+
return (
|
|
286
|
+
<View style={{ padding:10, flexDirection:'row', alignItems:'center', borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
287
|
+
<Button
|
|
288
|
+
title="X"
|
|
289
|
+
style={{ marginRight:5 }}
|
|
290
|
+
borderWidth={0}
|
|
291
|
+
title_size={12}
|
|
292
|
+
title_color={Colors.utility.error}
|
|
293
|
+
onPress={() => {
|
|
294
|
+
if(data.item.market_id_override){
|
|
295
|
+
//return onDeleteCompetitionMatch(data.item.competition_match_id)
|
|
296
|
+
}
|
|
297
|
+
//return onDeleteCompetitionMatchMarkets(data.item.competition_match_markets)
|
|
298
|
+
}}
|
|
299
|
+
/>
|
|
300
|
+
{image_url ?
|
|
301
|
+
<View style={{ padding:5 }}>
|
|
302
|
+
<Image
|
|
303
|
+
source={{ uri:image_url }}
|
|
304
|
+
style={{ marginRight:10, height:40, width:40, borderRadius:100 }}
|
|
305
|
+
resizeMode="center"
|
|
306
|
+
/>
|
|
307
|
+
</View>
|
|
308
|
+
:<></>}
|
|
309
|
+
<View style={{ flex:1 }}>
|
|
310
|
+
<Text size={14} weight='bold'>{header}</Text>
|
|
311
|
+
<Text style={{ marginTop:3 }} size={12} weight='bold'>{description}</Text>
|
|
312
|
+
</View>
|
|
313
|
+
<CompetitionMatchMarketCard
|
|
314
|
+
event_id={data.item.event_id}
|
|
315
|
+
event_type={data.item.event_type}
|
|
316
|
+
competition_match_id={data.item.competition_match_id}
|
|
317
|
+
competition_match_markets={data.item.competition_match_markets}
|
|
318
|
+
competition_summaries={match_summaries}
|
|
319
|
+
market={market}
|
|
320
|
+
onSaveMarkets={(cmms) => console.log(cmms)}
|
|
321
|
+
onUpdateMarkets={(cmms) => console.log(cmms)}
|
|
322
|
+
onGenerateMarkets={() => console.log('Blah')}
|
|
323
|
+
/>
|
|
324
|
+
</View>
|
|
325
|
+
)
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const renderTeamEvents = (data: { item:string, index:number }) => {
|
|
329
|
+
const event = events.find(e => e.event_id == data.item);
|
|
330
|
+
if(!event){ return <></> }
|
|
331
|
+
if(!event.supported_markets){ return <></> }
|
|
332
|
+
const supported_markets = markets.filter(m => event.supported_markets?.map(sm => sm.market_id.toString()).includes(m.market_id.toString()));
|
|
333
|
+
const cms = competition_matches.filter(cm => cm.event_id == data.item && cm.event_type == 'team');
|
|
334
|
+
const cmms = competition_match_markets.filter(cmm => cms.map(cm => cm.competition_match_id.toString()).includes(cmm.competition_match_id));
|
|
335
|
+
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))) ]
|
|
336
|
+
const league = leagues.find(l => l.league_id == event.league_id);
|
|
337
|
+
const visible_matches = showDetails(data.item, 'team')
|
|
338
|
+
|
|
339
|
+
return (
|
|
340
|
+
<View style={{ borderWidth:1, borderColor:Colors.shades.shade600, borderRadius:8, margin:10, zIndex: data.index * -1 }}>
|
|
341
|
+
<View style={{ flexDirection:'row', padding:15, zIndex:1}}>
|
|
342
|
+
{['pending','paused'].includes(competition.status) && cms.length == 1 && cmms.length == 0 ?
|
|
343
|
+
<Button
|
|
344
|
+
title="X"
|
|
345
|
+
title_color={Colors.utility.error}
|
|
346
|
+
borderRadius={8}
|
|
347
|
+
borderWidth={1}
|
|
348
|
+
borderColor={Colors.utility.error}
|
|
349
|
+
onPress={() => onDeleteCompetitionMatch(cms[0]?.competition_match_id)}
|
|
350
|
+
/>
|
|
351
|
+
:<></>}
|
|
352
|
+
<View style={{ flex:1, flexDirection:'row', alignItems:'center' }}>
|
|
353
|
+
{league?.league_image ?
|
|
354
|
+
<Image
|
|
355
|
+
source={{ uri: league.league_image }}
|
|
356
|
+
style={{ height:30, width:30, marginRight:10 }}
|
|
357
|
+
resizeMode="cover"
|
|
358
|
+
/>
|
|
359
|
+
:<></>}
|
|
360
|
+
<View>
|
|
361
|
+
<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>
|
|
362
|
+
<Text style={{ marginTop:4 }} size={12} color={Colors.brand.midnight}>{moment(event.scheduled_datetime).format('MMMM DD hh:mm a')}</Text>
|
|
363
|
+
</View>
|
|
364
|
+
</View>
|
|
365
|
+
<Button
|
|
366
|
+
title="Add Markets"
|
|
367
|
+
title_color={Colors.shades.white}
|
|
368
|
+
backgroundColor={Colors.brand.midnight}
|
|
369
|
+
onPress={() => {
|
|
370
|
+
setShowMarkets({
|
|
371
|
+
visible:true,
|
|
372
|
+
event_id: data.item,
|
|
373
|
+
event_type: 'team',
|
|
374
|
+
selected_markets:unique_market_ids,
|
|
375
|
+
supported_markets,
|
|
376
|
+
})
|
|
377
|
+
}}
|
|
378
|
+
/>
|
|
379
|
+
<View style={{ position:'absolute', top:0, right:0, ...view_styles.section, maxWidth:300 }}>
|
|
380
|
+
<MarketSelector
|
|
381
|
+
visible={show_markets.event_id == data.item ? true : false}
|
|
382
|
+
markets={show_markets.supported_markets}
|
|
383
|
+
selected_markets={show_markets.selected_markets}
|
|
384
|
+
onSelectMarket={(market) => handleSelectMarket(market)}
|
|
385
|
+
onDeselectMarket={(market) => console.log(market)}
|
|
386
|
+
onClose={() => setShowMarkets({ visible: false, supported_markets:[], selected_markets:[] })}
|
|
387
|
+
/>
|
|
388
|
+
</View>
|
|
389
|
+
</View>
|
|
390
|
+
{unique_market_ids.length > 0 ?
|
|
391
|
+
<View style={{ padding:10, backgroundColor:Colors.shades.shade100 }}>
|
|
392
|
+
<Text style={{ marginBottom:5 }} size={16} weight='bold'>Selected Markets</Text>
|
|
393
|
+
<View style={{ flexDirection:'row', flexWrap: 'wrap', padding:10 }}>
|
|
394
|
+
{unique_market_ids.map((market_id, index) => {
|
|
395
|
+
return (
|
|
396
|
+
renderMarkets({ item: market_id, index, event_id:data.item, event_type:'team' })
|
|
397
|
+
)
|
|
398
|
+
})}
|
|
399
|
+
</View>
|
|
400
|
+
</View>
|
|
401
|
+
:<></>}
|
|
402
|
+
{visible_matches.length > 0 ?
|
|
403
|
+
<FlatList
|
|
404
|
+
data={visible_matches}
|
|
405
|
+
renderItem={renderCompetitionMatches}
|
|
406
|
+
keyExtractor={(item) => item.competition_match_id.toString()}
|
|
407
|
+
/>
|
|
408
|
+
:<></>}
|
|
409
|
+
</View>
|
|
410
|
+
)
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
*/
|
|
414
|
+
|
|
415
|
+
return (<></>)
|
|
416
|
+
/*
|
|
417
|
+
return (
|
|
418
|
+
<View style={{ ...view_styles.section, minWidth:350, flexGrow:1, maxWidth:width }}>
|
|
419
|
+
<TouchableOpacity style={{ ...view_styles.section_header }} onPress={() => setExpanded(!expanded)}>
|
|
420
|
+
<View style={{ flex:1, marginRight:10 }}>
|
|
421
|
+
<Text theme='header'>Competition Contests</Text>
|
|
422
|
+
<Text style={{ marginTop:3 }} theme='body'>Competitions require contests for users to make picks / wagers. Select 'Add Contests' to get started.</Text>
|
|
423
|
+
</View>
|
|
424
|
+
<Icons.ChevronIcon direction={expanded ? 'up' : 'down'} size={8} color={Colors.brand.midnight} />
|
|
425
|
+
</TouchableOpacity>
|
|
426
|
+
{expanded ?
|
|
427
|
+
<View style={{ ...view_styles.section_body }}>
|
|
428
|
+
{unique_team_events.map((id, index) => {
|
|
429
|
+
return renderTeamEvents({ item:id, index })
|
|
430
|
+
})}
|
|
431
|
+
</View>
|
|
432
|
+
:<></>}
|
|
433
|
+
</View>
|
|
434
|
+
)
|
|
435
|
+
*/
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
export default CompetitionContestsForm
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
/*
|
|
443
|
+
<View style={{ position:'absolute', top:show_athletes.top, right:show_athletes.right }}>
|
|
444
|
+
<AthleteSelector
|
|
445
|
+
onClose={() => setShowAthletes({ visible:false, positions:[], selected_athletes: [], top:0, right:0, team_ids:[] })}
|
|
446
|
+
onDeselectAthlete={(athlete) => console.log(athlete)}
|
|
447
|
+
onSelectAthlete={(athlete) => handleSelectAthlete(athlete)}
|
|
448
|
+
team_ids={show_athletes.team_ids}
|
|
449
|
+
restricted_ids={show_athletes.restricted_ids}
|
|
450
|
+
selected_athletes={show_athletes.selected_athletes}
|
|
451
|
+
visible={show_athletes.visible}
|
|
452
|
+
/>
|
|
453
|
+
</View>
|
|
454
|
+
*/
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
/*
|
|
458
|
+
<Button
|
|
459
|
+
title="Add Contests"
|
|
460
|
+
backgroundColor={Colors.brand.electric}
|
|
461
|
+
title_color={Colors.shades.white}
|
|
462
|
+
onPress={() => setContestsVisible(true)}
|
|
463
|
+
/>
|
|
464
|
+
<View style={{ position:'absolute', top:0, right:0 }}>
|
|
465
|
+
<ContestSelector
|
|
466
|
+
visible={contests_visible}
|
|
467
|
+
selected_events={unique_team_events}
|
|
468
|
+
onSelectEvent={(event) => handleSelectEvent(event)}
|
|
469
|
+
onDeselectEvent={(event) => console.log(event)}
|
|
470
|
+
onClose={() => setContestsVisible(false)}
|
|
471
|
+
/>
|
|
472
|
+
</View>
|
|
473
|
+
*/
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View, TouchableOpacity } from "react-native"
|
|
3
|
+
import { view_styles } from "../../constants/styles"
|
|
4
|
+
//import ImageUploader from '../../Components/ImageUploader';
|
|
5
|
+
import type { CompetitionProps } from '../../types';
|
|
6
|
+
import { Icons, Switch, Text, TextInput } from '../../Components';
|
|
7
|
+
import Colors from '../../constants/colors';
|
|
8
|
+
//import DropDown from '../../Components/Dropdown';
|
|
9
|
+
|
|
10
|
+
type CompetitionInfoFormProps = {
|
|
11
|
+
competition:CompetitionProps,
|
|
12
|
+
width: number,
|
|
13
|
+
onCompetitionUpdate:(competition:CompetitionProps) => void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const CompetitionInfoForm = ({ competition, width, onCompetitionUpdate }:CompetitionInfoFormProps) => {
|
|
17
|
+
const [ expanded, setExpanded ] = useState(false);
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<View style={{ ...view_styles.section, flexGrow:1 }}>
|
|
23
|
+
<TouchableOpacity style={view_styles.section_header} onPress={() => setExpanded(!expanded)}>
|
|
24
|
+
<View style={{ flex:1 }}>
|
|
25
|
+
<Text theme='header'>Competition Information</Text>
|
|
26
|
+
<Text style={{ marginTop:3 }} theme='body'>Manage the high level information of this competition</Text>
|
|
27
|
+
</View>
|
|
28
|
+
<Icons.ChevronIcon direction={expanded ? 'up' : 'down'} color={Colors.brand.midnight} size={8} />
|
|
29
|
+
</TouchableOpacity>
|
|
30
|
+
{expanded ?
|
|
31
|
+
<View nativeID="competition_info" style={{ ...view_styles.section_body, minWidth:300, maxWidth:width }}>
|
|
32
|
+
|
|
33
|
+
<View nativeID="competition_name" style={{ ...view_styles.body_row, flexWrap:'wrap', maxWidth:width}}>
|
|
34
|
+
<View style={{ flex:1, margin:5, minWidth:200 }}>
|
|
35
|
+
<Text theme='header_2'>Competition Name</Text>
|
|
36
|
+
<Text style={{ marginTop:3 }} theme='body'>Give the competition a memorable name that aligns with the type and payout.</Text>
|
|
37
|
+
</View>
|
|
38
|
+
<TextInput
|
|
39
|
+
style={{ ...view_styles.input, flexGrow:1, margin:5 }}
|
|
40
|
+
onChangeText={(text) => onCompetitionUpdate({ ...competition, competition_name:text })}
|
|
41
|
+
value={competition.competition_name}
|
|
42
|
+
placeholder="Competition Name"
|
|
43
|
+
placeholderTextColor={Colors.brand.slate}
|
|
44
|
+
/>
|
|
45
|
+
</View>
|
|
46
|
+
|
|
47
|
+
<View nativeID="competition_description" style={{ ...view_styles.body_row, flexWrap:'wrap', maxWidth:width}}>
|
|
48
|
+
<View style={{ flex:1, margin:5, minWidth:200 }}>
|
|
49
|
+
<Text theme='header_2'>Competition Description</Text>
|
|
50
|
+
<Text style={{ marginTop:3 }} theme='body'>Give the competition a memorable description that would entice users to participate.</Text>
|
|
51
|
+
</View>
|
|
52
|
+
<TextInput
|
|
53
|
+
style={{ ...view_styles.input, flexGrow:1, margin:5 }}
|
|
54
|
+
onChangeText={(text) => onCompetitionUpdate({ ...competition, competition_description:text })}
|
|
55
|
+
value={competition.competition_description}
|
|
56
|
+
placeholder="Pick 5 games ATS from NFL Week 6 matchups"
|
|
57
|
+
placeholderTextColor={Colors.brand.slate}
|
|
58
|
+
/>
|
|
59
|
+
</View>
|
|
60
|
+
|
|
61
|
+
<View nativeID="invite_only" style={{ ...view_styles.body_row, flexWrap:'wrap' }}>
|
|
62
|
+
<View style={{ flex:1, margin:5, marginRight:15 }}>
|
|
63
|
+
<Text theme='header_2'>Make Private</Text>
|
|
64
|
+
<Text style={{ marginTop:3 }} theme='body'>Only access this competition using an invite code.</Text>
|
|
65
|
+
</View>
|
|
66
|
+
<Switch
|
|
67
|
+
value={competition.invite_only}
|
|
68
|
+
switch_type="on_off"
|
|
69
|
+
onChange={(value) => onCompetitionUpdate({ ...competition, invite_only: value })}
|
|
70
|
+
/>
|
|
71
|
+
</View>
|
|
72
|
+
{false ?
|
|
73
|
+
<View nativeID="competition_description" style={{ ...view_styles.body_row, flexWrap:'wrap', maxWidth:width}}>
|
|
74
|
+
<View style={{ flex:1, margin:5, minWidth:200 }}>
|
|
75
|
+
<Text theme='header_2'>League Name</Text>
|
|
76
|
+
<Text style={{ marginTop:3 }} theme='body'>Set the name of the league</Text>
|
|
77
|
+
</View>
|
|
78
|
+
<TextInput
|
|
79
|
+
style={{ ...view_styles.input, flexGrow:1 }}
|
|
80
|
+
onChangeText={(text) => onCompetitionUpdate({ ...competition, league_name:text })}
|
|
81
|
+
value={competition.league_name}
|
|
82
|
+
placeholder="Add a league name"
|
|
83
|
+
placeholderTextColor={Colors.brand.slate}
|
|
84
|
+
/>
|
|
85
|
+
</View>
|
|
86
|
+
:<></>}
|
|
87
|
+
{false ?
|
|
88
|
+
<View nativeID="invite_only" style={{ ...view_styles.body_row, flexWrap:'wrap' }}>
|
|
89
|
+
<View style={{ flex:1, margin:5, minWidth:200 }}>
|
|
90
|
+
<Text theme='header_2'>Additional Prize</Text>
|
|
91
|
+
<Text style={{ marginTop:3 }} theme='body'>Is there an additional prize that will be delivered?</Text>
|
|
92
|
+
</View>
|
|
93
|
+
<Switch
|
|
94
|
+
value={competition.prize_override ? true : false}
|
|
95
|
+
switch_type="on_off"
|
|
96
|
+
onChange={(value) => onCompetitionUpdate({ ...competition, prize_override: value ? 'Additional Prize!': undefined })}
|
|
97
|
+
/>
|
|
98
|
+
</View>
|
|
99
|
+
:<></>}
|
|
100
|
+
</View>
|
|
101
|
+
:<></>}
|
|
102
|
+
</View>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export default CompetitionInfoForm
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
/*
|
|
110
|
+
{competition.prize_override || competition.prize_override == '' ?
|
|
111
|
+
<View nativeID="competition_info" style={{ margin:10, flex:4, flexGrow:4, minWidth:300, padding:10, borderRadius:4, marginRight:5, ...styles.float }}>
|
|
112
|
+
<View nativeID="header_row" style={{ flexDirection:'row', alignItems:'center', padding:5, borderBottomWidth:1, borderBottomColor:Colors.shades.shade600 }}>
|
|
113
|
+
<Text style={{ flex:1, marginRight:10 }} size={22} color={Colors.brand.slate} weight='bold'>Competition Prize Details</Text>
|
|
114
|
+
</View>
|
|
115
|
+
<View nativeID="competition_prize" style={{ flexDirection:'row', flexWrap:'wrap', alignItems:'center', padding:10 }}>
|
|
116
|
+
<View nativeID="prize_image">
|
|
117
|
+
<View style={{ flex:1, justifyContent:'center', alignItems:'center' }}>
|
|
118
|
+
{competition.prize_image?.url ?
|
|
119
|
+
<Image
|
|
120
|
+
source={{ uri : competition.prize_image.url }}
|
|
121
|
+
style={{ height: 100, width:100 }}
|
|
122
|
+
resizeMode="center"
|
|
123
|
+
/>
|
|
124
|
+
:
|
|
125
|
+
<Text>NO IMAGE!!</Text>
|
|
126
|
+
}
|
|
127
|
+
</View>
|
|
128
|
+
<ImageUploader
|
|
129
|
+
public_id={`comp_prize_${competition.competition_id}_image_${Math.random()}`}
|
|
130
|
+
label="Change Image"
|
|
131
|
+
onFinishUpload={(obj) => onCompetitionUpdate({ ...competition, prize_image: { ...obj, url: obj.secure_url } })}
|
|
132
|
+
/>
|
|
133
|
+
</View>
|
|
134
|
+
<View style={{ flex:1, minWidth:200 }}>
|
|
135
|
+
<View style={{ margin:5 }}>
|
|
136
|
+
<Text size={16} color={Colors.brand.midnight} weight='bold'>Prize Override</Text>
|
|
137
|
+
<Text size={14} color={Colors.brand.midnight} weight='regular'>Add details for the prize that will be delivered</Text>
|
|
138
|
+
</View>
|
|
139
|
+
<TextInput
|
|
140
|
+
style={{ minWidth:300, margin:5, padding:10, borderRadius:8,borderWidth:1, borderColor:Colors.shades.shade600 }}
|
|
141
|
+
onChangeText={(text) => onCompetitionUpdate({ ...competition, prize_override:text })}
|
|
142
|
+
value={competition.prize_override}
|
|
143
|
+
placeholder="Add a league name"
|
|
144
|
+
placeholderTextColor={Colors.brand.slate}
|
|
145
|
+
/>
|
|
146
|
+
</View>
|
|
147
|
+
</View>
|
|
148
|
+
</View>
|
|
149
|
+
:<></>}
|
|
150
|
+
*/
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
/*
|
|
154
|
+
<View style={{ ...view_styles.body_row, flexWrap:'wrap' }}>
|
|
155
|
+
<View style={{ flex:1, margin:5, minWidth:250 }}>
|
|
156
|
+
<Text theme='header_2'>Authenticate Strategy</Text>
|
|
157
|
+
<Text style={{ marginTop:3 }} theme='body'>What data would you like to collect in order to participate in this competition?</Text>
|
|
158
|
+
</View>
|
|
159
|
+
<DropDown
|
|
160
|
+
dropdown_options={[
|
|
161
|
+
{value: 'Strategy', eligible_options: auth_strategies.map(as => as.name)}
|
|
162
|
+
]}
|
|
163
|
+
selected_value={selected_strategy}
|
|
164
|
+
onOptionSelect={(option) => {
|
|
165
|
+
let strategy = auth_strategies.find(as => as.name == option)
|
|
166
|
+
if(competition.status != 'pending'){ return alert('Auth strategy cannot be changed after competition is activated') }
|
|
167
|
+
onCompetitionUpdate({ ...competition, auth_strategy_id: strategy.auth_strategy_id })
|
|
168
|
+
}}
|
|
169
|
+
/>
|
|
170
|
+
</View>
|
|
171
|
+
*/
|