be-components 6.8.1 → 6.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/Competition/components/CompetitionLeaderboard.js +244 -143
- package/lib/commonjs/Competition/components/CompetitionLeaderboard.js.map +1 -1
- package/lib/commonjs/Competition/index.js +91 -55
- package/lib/commonjs/Competition/index.js.map +1 -1
- package/lib/commonjs/Components/ImageUploader.js +3 -1
- package/lib/commonjs/Components/ImageUploader.js.map +1 -1
- package/lib/commonjs/CreateEngagement/index.js +4 -3
- package/lib/commonjs/CreateEngagement/index.js.map +1 -1
- package/lib/commonjs/SquaresManager/api/index.js +129 -0
- package/lib/commonjs/SquaresManager/api/index.js.map +1 -0
- package/lib/commonjs/SquaresManager/index.js +629 -0
- package/lib/commonjs/SquaresManager/index.js.map +1 -0
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/Competition/components/CompetitionLeaderboard.js +244 -143
- package/lib/module/Competition/components/CompetitionLeaderboard.js.map +1 -1
- package/lib/module/Competition/index.js +91 -55
- package/lib/module/Competition/index.js.map +1 -1
- package/lib/module/Components/ImageUploader.js +3 -1
- package/lib/module/Components/ImageUploader.js.map +1 -1
- package/lib/module/CreateEngagement/index.js +4 -3
- package/lib/module/CreateEngagement/index.js.map +1 -1
- package/lib/module/SquaresManager/api/index.js +123 -0
- package/lib/module/SquaresManager/api/index.js.map +1 -0
- package/lib/module/SquaresManager/index.js +621 -0
- package/lib/module/SquaresManager/index.js.map +1 -0
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/Competition/components/CompetitionLeaderboard.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Competition/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Components/ImageUploader.d.ts +2 -1
- package/lib/typescript/lib/commonjs/Components/ImageUploader.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/CreateEngagement/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/SquaresManager/api/index.d.ts +19 -0
- package/lib/typescript/lib/commonjs/SquaresManager/api/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/SquaresManager/index.d.ts +13 -0
- package/lib/typescript/lib/commonjs/SquaresManager/index.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/Competition/components/CompetitionLeaderboard.d.ts.map +1 -1
- package/lib/typescript/lib/module/Competition/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Components/ImageUploader.d.ts +2 -1
- package/lib/typescript/lib/module/Components/ImageUploader.d.ts.map +1 -1
- package/lib/typescript/lib/module/CreateEngagement/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/SquaresManager/api/index.d.ts +18 -0
- package/lib/typescript/lib/module/SquaresManager/api/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/SquaresManager/index.d.ts +13 -0
- package/lib/typescript/lib/module/SquaresManager/index.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/Competition/components/CompetitionLeaderboard.d.ts.map +1 -1
- package/lib/typescript/src/Competition/index.d.ts.map +1 -1
- package/lib/typescript/src/Components/ImageUploader.d.ts +3 -1
- package/lib/typescript/src/Components/ImageUploader.d.ts.map +1 -1
- package/lib/typescript/src/SquaresManager/api/index.d.ts +36 -0
- package/lib/typescript/src/SquaresManager/api/index.d.ts.map +1 -0
- package/lib/typescript/src/SquaresManager/index.d.ts +16 -0
- package/lib/typescript/src/SquaresManager/index.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 +1 -1
- package/src/Competition/components/CompetitionLeaderboard.tsx +115 -62
- package/src/Competition/index.tsx +69 -49
- package/src/Components/ImageUploader.tsx +4 -3
- package/src/CreateEngagement/index.tsx +6 -2
- package/src/SquaresManager/api/index.ts +99 -0
- package/src/SquaresManager/index.tsx +395 -0
- package/src/index.tsx +2 -0
- package/src/types.d.ts +1 -1
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react"
|
|
2
|
+
import { SquaresManagerApi, SquaresManagerHelpers } from "./api";
|
|
3
|
+
import { Button, Text, TextInput, View } from "../Components/Themed";
|
|
4
|
+
import { FlatList, Image, type ViewStyle } from "react-native";
|
|
5
|
+
import type { CompanyProps, EventProps, FocusPositionProps, GroupProps, LeagueProps, MyPlayerProps, SquaresCompetitionProps } from "../types";
|
|
6
|
+
import { useColors } from "../constants/useColors";
|
|
7
|
+
import LeagueSchedule from "../MarketComponents/components/LeagueSchedule";
|
|
8
|
+
import { Icons, Switch, Toggle } from "../Components";
|
|
9
|
+
import moment from "moment-mini";
|
|
10
|
+
import ImageUploader from "../Components/ImageUploader";
|
|
11
|
+
import GroupSelector from "../CompetitionManager/components/GroupSelector";
|
|
12
|
+
import CompanySelector from "../CompetitionManager/components/CompanySelector";
|
|
13
|
+
|
|
14
|
+
type SquaresManagerProps = {
|
|
15
|
+
sq_comp_id:string,
|
|
16
|
+
onFocusPosition?:(pos:FocusPositionProps) => void,
|
|
17
|
+
float?:boolean,
|
|
18
|
+
player?:MyPlayerProps,
|
|
19
|
+
onActivate:(sq:SquaresCompetitionProps) => void,
|
|
20
|
+
onClose:() => void,
|
|
21
|
+
header_style?:ViewStyle,
|
|
22
|
+
footer_style?:ViewStyle
|
|
23
|
+
}
|
|
24
|
+
const sections = ['header','toggle','info','event']
|
|
25
|
+
const SquaresManager = ({ sq_comp_id, float, player, header_style, onFocusPosition, footer_style, onClose, onActivate }:SquaresManagerProps) => {
|
|
26
|
+
const Colors = useColors();
|
|
27
|
+
const [ my_data, setMyData ] = useState<{
|
|
28
|
+
groups:GroupProps[],
|
|
29
|
+
companies:CompanyProps[]
|
|
30
|
+
}>({
|
|
31
|
+
groups: [],
|
|
32
|
+
companies: []
|
|
33
|
+
});
|
|
34
|
+
const { groups, companies } = my_data;
|
|
35
|
+
const [ sq_state, setState ] = useState<{
|
|
36
|
+
loading: boolean,
|
|
37
|
+
active_tab: 'info'|'event',
|
|
38
|
+
leagues_visible?:boolean,
|
|
39
|
+
active_event?:EventProps,
|
|
40
|
+
active_league?:LeagueProps,
|
|
41
|
+
min_square_price:string,
|
|
42
|
+
leagues:LeagueProps[],
|
|
43
|
+
league_schedule:boolean,
|
|
44
|
+
draft_competition?:SquaresCompetitionProps,
|
|
45
|
+
squares_competition?:SquaresCompetitionProps
|
|
46
|
+
}>({
|
|
47
|
+
loading:false,
|
|
48
|
+
active_tab: 'info',
|
|
49
|
+
leagues_visible:false,
|
|
50
|
+
leagues:[],
|
|
51
|
+
min_square_price: '0',
|
|
52
|
+
league_schedule: false
|
|
53
|
+
});
|
|
54
|
+
const { loading, squares_competition, min_square_price, active_tab, leagues, league_schedule, draft_competition, leagues_visible, active_event, active_league } = sq_state
|
|
55
|
+
const active_group = groups.find(g => g.group_id == draft_competition?.group_id)
|
|
56
|
+
const active_company = companies.find(c => c.company_id == draft_competition?.company_id);
|
|
57
|
+
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
SquaresManagerApi.setEnvironment();
|
|
60
|
+
getData(sq_comp_id)
|
|
61
|
+
if(player){ getMyData() }
|
|
62
|
+
},[sq_comp_id, player]);
|
|
63
|
+
|
|
64
|
+
const errors = SquaresManagerHelpers.isValid(draft_competition);
|
|
65
|
+
|
|
66
|
+
const getMyData = async() => {
|
|
67
|
+
const my_groups = await SquaresManagerApi.getMyGroups(0);
|
|
68
|
+
const my_comps = await SquaresManagerApi.getMyCompanies();
|
|
69
|
+
setMyData({
|
|
70
|
+
...my_data,
|
|
71
|
+
groups: my_groups.groups,
|
|
72
|
+
companies: my_comps.companies
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const getData = async(id:string) => {
|
|
77
|
+
setState({ ...sq_state, loading: true });
|
|
78
|
+
const sq_data = await SquaresManagerApi.getSquareCompetitionById(id);
|
|
79
|
+
const lgs = await SquaresManagerApi.getLeagues();
|
|
80
|
+
if(!sq_data){ return alert('Unable to get Squares Details - please try again') }
|
|
81
|
+
let active_ev_id = sq_data.squares_competition.event_id
|
|
82
|
+
let active_ev:EventProps | undefined = undefined
|
|
83
|
+
if(active_ev_id){
|
|
84
|
+
const evs = await SquaresManagerApi.getEventsByEventIds([active_ev_id])
|
|
85
|
+
active_ev = evs[0]
|
|
86
|
+
}
|
|
87
|
+
let active_league = lgs.find(l => l.league_id == active_ev?.league_id);
|
|
88
|
+
setState({
|
|
89
|
+
...sq_state,
|
|
90
|
+
loading: false,
|
|
91
|
+
leagues: lgs.filter(l => l.sport == 'Football'),
|
|
92
|
+
active_event: active_ev,
|
|
93
|
+
min_square_price: sq_data.squares_competition.minimum_square_price.toFixed(2),
|
|
94
|
+
active_league: active_league,
|
|
95
|
+
draft_competition: sq_data.squares_competition,
|
|
96
|
+
squares_competition: sq_data.squares_competition
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const handleActivate = async() => {
|
|
101
|
+
if(!squares_competition || loading){ return }
|
|
102
|
+
if(errors.length > 0){ return alert(errors.map(e => e)) }
|
|
103
|
+
setState({ ...sq_state, loading: true });
|
|
104
|
+
const activate_resp = await SquaresManagerApi.activateSquares(squares_competition.sq_comp_id);
|
|
105
|
+
if(!activate_resp){ return alert('Unable to activate competition') }
|
|
106
|
+
setState({
|
|
107
|
+
...sq_state, loading:false,
|
|
108
|
+
squares_competition: activate_resp.squares_competition,
|
|
109
|
+
draft_competition: activate_resp.squares_competition
|
|
110
|
+
});
|
|
111
|
+
onActivate(activate_resp.squares_competition)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const updateCompetition = async(sq_comp:SquaresCompetitionProps) => {
|
|
115
|
+
if(errors.length > 0){ return alert(errors.map(e => e)) }
|
|
116
|
+
if(loading){ return }//No mashy
|
|
117
|
+
setState({ ...sq_state, loading:true });
|
|
118
|
+
const new_comp = await SquaresManagerApi.updateSquaresCompetition({ ...sq_comp, minimum_square_price: parseFloat(min_square_price)});
|
|
119
|
+
if(!new_comp){ return alert('Unable to update squares competition') }
|
|
120
|
+
setState({
|
|
121
|
+
...sq_state,
|
|
122
|
+
squares_competition: new_comp,
|
|
123
|
+
draft_competition: new_comp,
|
|
124
|
+
loading:false,
|
|
125
|
+
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const renderLeagues = (data:{item:LeagueProps, index:number}) => {
|
|
130
|
+
const selected = active_league?.league_id == data.item.league_id ? true : false
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<Button
|
|
134
|
+
transparent
|
|
135
|
+
style={{ flexDirection:'row', borderRadius:0, padding:10, alignItems:'center', borderBottomWidth:1, borderColor:Colors.borders.light }}
|
|
136
|
+
onPress={() => setState({ ...sq_state, active_league: selected?undefined : data.item, leagues_visible:false, league_schedule: selected?false:true })}
|
|
137
|
+
>
|
|
138
|
+
<Image
|
|
139
|
+
source={{ uri: data.item.league_image }}
|
|
140
|
+
style={{ height:30, width:30 }}
|
|
141
|
+
resizeMode='contain'
|
|
142
|
+
/>
|
|
143
|
+
<View transparent style={{ flex:1, marginLeft:10 }}>
|
|
144
|
+
<Text theme='h1'>{data.item.league_name}</Text>
|
|
145
|
+
<Text theme='description' style={{ marginTop:3 }}>{data.item.sport}</Text>
|
|
146
|
+
</View>
|
|
147
|
+
</Button>
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
const renderSections = (data:{ item:string, index:number }) => {
|
|
153
|
+
switch(data.item){
|
|
154
|
+
case 'header':
|
|
155
|
+
if(!squares_competition || !draft_competition){ return <></> }
|
|
156
|
+
return (
|
|
157
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10, ...header_style }}>
|
|
158
|
+
<ImageUploader style={{padding:0}} public_id={`sq_pic_${squares_competition.sq_comp_id}`} onFinishUpload={async(obj) => {
|
|
159
|
+
updateCompetition({ ...draft_competition, image: { ...obj, url: obj.secure_url } })
|
|
160
|
+
|
|
161
|
+
}}>
|
|
162
|
+
<View transparent style={{ alignItems:'center' }}>
|
|
163
|
+
{draft_competition.image?
|
|
164
|
+
<Image
|
|
165
|
+
source={{ uri: draft_competition.image?.url }}
|
|
166
|
+
resizeMode="cover"
|
|
167
|
+
style={{ height:40, width:40 }}
|
|
168
|
+
/>
|
|
169
|
+
:
|
|
170
|
+
<Icons.ImageIcon size={30} color={Colors.text.h1} />
|
|
171
|
+
}
|
|
172
|
+
</View>
|
|
173
|
+
|
|
174
|
+
<Text theme="action" textAlign="center">{draft_competition.image?.url ? 'Change' : 'Add Image'}</Text>
|
|
175
|
+
</ImageUploader>
|
|
176
|
+
<View transparent style={{flex:1, marginLeft:10, marginRight:10}}>
|
|
177
|
+
<Text theme='h1'>{squares_competition.sq_comp_name}</Text>
|
|
178
|
+
<Text theme="description" style={{ marginTop:3 }}>{squares_competition.sq_comp_description}</Text>
|
|
179
|
+
</View>
|
|
180
|
+
<Button
|
|
181
|
+
title="X"
|
|
182
|
+
style={{ padding:10 }}
|
|
183
|
+
float
|
|
184
|
+
title_color={Colors.text.error}
|
|
185
|
+
onPress={() => onClose()}
|
|
186
|
+
/>
|
|
187
|
+
</View>
|
|
188
|
+
)
|
|
189
|
+
case 'toggle':
|
|
190
|
+
return (
|
|
191
|
+
<View transparent>
|
|
192
|
+
<Toggle
|
|
193
|
+
border_radius={0}
|
|
194
|
+
toggle_padding={10}
|
|
195
|
+
padding={0}
|
|
196
|
+
options={[
|
|
197
|
+
{ key: 'info', label: 'Info', icon: <Icons.MenuIcon size={14} color={Colors.text.warning} /> },
|
|
198
|
+
{ key: 'event', label: 'Event', icon: <Icons.ActivityIcon size={14} color={Colors.text.warning} /> },
|
|
199
|
+
]}
|
|
200
|
+
selected_option={active_tab}
|
|
201
|
+
onSelectOption={(key) => setState({ ...sq_state, active_tab: key as 'info'|'event'})}
|
|
202
|
+
title_renderer={(option) => {
|
|
203
|
+
const selected = option.key == active_tab ? true : false
|
|
204
|
+
return (
|
|
205
|
+
<View transparent style={{ justifyContent:'center', alignItems:'center' }}>
|
|
206
|
+
<View transparent>
|
|
207
|
+
{option.icon}
|
|
208
|
+
</View>
|
|
209
|
+
<Text style={{ marginTop:5 }} theme={selected?'h2':'description'} color={selected?Colors.toggle.text.active : Colors.toggle.text.inactive}>{option.label}</Text>
|
|
210
|
+
</View>
|
|
211
|
+
)
|
|
212
|
+
}}
|
|
213
|
+
/>
|
|
214
|
+
</View>
|
|
215
|
+
)
|
|
216
|
+
case 'info':
|
|
217
|
+
if(!draft_competition){ return <></> }
|
|
218
|
+
if(active_tab != 'info'){ return <></> }
|
|
219
|
+
return (
|
|
220
|
+
<View>
|
|
221
|
+
<View style={{ padding:10 }}>
|
|
222
|
+
<Text theme='h1' style={{ marginBottom:10 }}>Competition Name</Text>
|
|
223
|
+
<TextInput
|
|
224
|
+
placeholder='Add Name here...'
|
|
225
|
+
value={draft_competition.sq_comp_name}
|
|
226
|
+
onFocusPosition={onFocusPosition}
|
|
227
|
+
style={{ borderColor:draft_competition.sq_comp_name ? Colors.text.success : Colors.text.warning }}
|
|
228
|
+
onChangeText={(text) => setState({ ...sq_state, draft_competition: { ...draft_competition, sq_comp_name: text }})}
|
|
229
|
+
/>
|
|
230
|
+
</View>
|
|
231
|
+
<View style={{ padding:10 }}>
|
|
232
|
+
<Text theme='h1' style={{ marginBottom:10 }}>Competition Description</Text>
|
|
233
|
+
<TextInput
|
|
234
|
+
placeholder='Add Decription here...'
|
|
235
|
+
onFocusPosition={onFocusPosition}
|
|
236
|
+
value={draft_competition.sq_comp_description}
|
|
237
|
+
style={{ borderColor:draft_competition.sq_comp_description ? Colors.text.success : Colors.text.warning }}
|
|
238
|
+
onChangeText={(text) => setState({ ...sq_state, draft_competition: { ...draft_competition, sq_comp_description: text } })}
|
|
239
|
+
/>
|
|
240
|
+
</View>
|
|
241
|
+
<View style={{ padding:10 }}>
|
|
242
|
+
<Text theme='h1' style={{ marginBottom:10 }}>Minimum Squares Price</Text>
|
|
243
|
+
<TextInput
|
|
244
|
+
placeholder='1'
|
|
245
|
+
onFocusPosition={onFocusPosition}
|
|
246
|
+
value={min_square_price}
|
|
247
|
+
style={{ textAlign:'center', borderColor:draft_competition.minimum_square_price <= 0 ? Colors.text.warning : Colors.text.success }}
|
|
248
|
+
onChangeText={(text) => setState({ ...sq_state, min_square_price: text })}
|
|
249
|
+
/>
|
|
250
|
+
</View>
|
|
251
|
+
<View type='row' nativeID="invite_only" style={{ flexWrap:'wrap', padding:20, borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
252
|
+
<View style={{ flex:1, marginRight:15 }}>
|
|
253
|
+
<Text theme='h1'>Make Private</Text>
|
|
254
|
+
<Text style={{ marginTop:3 }} theme='description'>Only access this competition using an invite code.</Text>
|
|
255
|
+
</View>
|
|
256
|
+
<Switch
|
|
257
|
+
value={draft_competition.invite_only_ind}
|
|
258
|
+
switch_type="on_off"
|
|
259
|
+
onChange={(value) => {
|
|
260
|
+
if(player?.role != 'admin'){ return alert('You do not have access to make public competitions at this time.') }
|
|
261
|
+
updateCompetition({ ...draft_competition, invite_only_ind: value })
|
|
262
|
+
}}
|
|
263
|
+
/>
|
|
264
|
+
</View>
|
|
265
|
+
{draft_competition.invite_only_ind ?
|
|
266
|
+
<View style={{ padding:10 }}>
|
|
267
|
+
<Text theme='h1' style={{ marginBottom:10 }}>Competition Invite Code</Text>
|
|
268
|
+
<TextInput
|
|
269
|
+
placeholder='Add Invite Code here...'
|
|
270
|
+
onFocusPosition={onFocusPosition}
|
|
271
|
+
value={draft_competition.competition_code}
|
|
272
|
+
style={{ borderColor:draft_competition.competition_code ? Colors.text.success : Colors.text.warning }}
|
|
273
|
+
onChangeText={(text) => setState({ ...sq_state, draft_competition: { ...draft_competition, competition_code: text } })}
|
|
274
|
+
/>
|
|
275
|
+
</View>
|
|
276
|
+
:<></>}
|
|
277
|
+
{groups.length > 0 ?
|
|
278
|
+
<View style={{ padding:20, borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
279
|
+
<View style={{ marginBottom:10 }}>
|
|
280
|
+
<Text theme='h1'>My Groups</Text>
|
|
281
|
+
<Text style={{ marginTop:3 }} theme='description'>Add this competition to a group that you are a member of</Text>
|
|
282
|
+
</View>
|
|
283
|
+
<GroupSelector
|
|
284
|
+
active_group={active_group}
|
|
285
|
+
groups={groups}
|
|
286
|
+
onSelectGroup={(g) => updateCompetition({ ...draft_competition, group_id: g?.group_id })}
|
|
287
|
+
/>
|
|
288
|
+
</View>
|
|
289
|
+
:<></>}
|
|
290
|
+
{companies.length > 0 ?
|
|
291
|
+
<View style={{ padding:20, borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
292
|
+
<View style={{ marginBottom:10 }}>
|
|
293
|
+
<Text theme='h1'>My Companies</Text>
|
|
294
|
+
<Text style={{ marginTop:3 }} theme='description'>Add this competition to a company that you are a member of</Text>
|
|
295
|
+
</View>
|
|
296
|
+
<CompanySelector
|
|
297
|
+
active_company={active_company}
|
|
298
|
+
companies={companies}
|
|
299
|
+
onSelectCompany={(c) => updateCompetition({ ...draft_competition, company_id: c?.company_id })}
|
|
300
|
+
/>
|
|
301
|
+
</View>
|
|
302
|
+
:<></>}
|
|
303
|
+
</View>
|
|
304
|
+
)
|
|
305
|
+
case 'event':
|
|
306
|
+
if(active_tab != 'event'){ return <></> }
|
|
307
|
+
return (
|
|
308
|
+
<View>
|
|
309
|
+
<View style={{ padding:10 }}>
|
|
310
|
+
<Text theme='h1' style={{ marginBottom:10 }}>Squares Event</Text>
|
|
311
|
+
<Button float style={{ borderColor:active_league?Colors.text.success:Colors.text.warning }} onPress={() => setState({ ...sq_state, leagues_visible: !leagues_visible })}>
|
|
312
|
+
<View transparent style={{ flexDirection:'row', alignItems:'center' }}>
|
|
313
|
+
<Text style={{ flex:1, marginRight:10 }} theme='h1'>{active_league?.league_name ?? 'Select League'}</Text>
|
|
314
|
+
<Icons.ChevronIcon direction={leagues_visible?'up':'down'} color={Colors.text.h1} size={8} />
|
|
315
|
+
</View>
|
|
316
|
+
{leagues_visible ?
|
|
317
|
+
<View transparent style={{ marginTop:20 }}>
|
|
318
|
+
<FlatList
|
|
319
|
+
data={leagues.sort((a,b) => a.priority - b.priority)}
|
|
320
|
+
key={'competition_reult_types'}
|
|
321
|
+
keyExtractor={item => item.league_id.toString()}
|
|
322
|
+
renderItem={renderLeagues}
|
|
323
|
+
/>
|
|
324
|
+
</View>
|
|
325
|
+
:<></>}
|
|
326
|
+
</Button>
|
|
327
|
+
</View>
|
|
328
|
+
<View float style={{ margin:10 }}>
|
|
329
|
+
{active_league && league_schedule ?
|
|
330
|
+
<LeagueSchedule
|
|
331
|
+
onSelectEvent={(e) => {
|
|
332
|
+
if(!draft_competition){ return }
|
|
333
|
+
setState({
|
|
334
|
+
...sq_state,
|
|
335
|
+
active_event: e,
|
|
336
|
+
league_schedule:false,
|
|
337
|
+
draft_competition: {
|
|
338
|
+
...draft_competition,
|
|
339
|
+
sport: active_league?.league_name ?? draft_competition.sport,
|
|
340
|
+
begin_datetime: moment(e.scheduled_datetime).add(4, 'minutes'),
|
|
341
|
+
event_id: e.event_id
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
}}
|
|
345
|
+
league={active_league}
|
|
346
|
+
active_event={active_event?.event_id}
|
|
347
|
+
/>
|
|
348
|
+
: active_event ?
|
|
349
|
+
<Button style={{ borderColor:active_event?Colors.text.success:Colors.text.warning }} float onPress={() => setState({ ...sq_state, league_schedule: true })}>
|
|
350
|
+
<Text theme='h1'>{active_event.event_title}</Text>
|
|
351
|
+
</Button>
|
|
352
|
+
:<></>}
|
|
353
|
+
</View>
|
|
354
|
+
</View>
|
|
355
|
+
|
|
356
|
+
)
|
|
357
|
+
default: return <></>
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
const is_changed = JSON.stringify(squares_competition) != JSON.stringify(draft_competition) ? true : parseFloat(min_square_price) != draft_competition?.minimum_square_price ? true : false
|
|
361
|
+
return (
|
|
362
|
+
<View float={float} style={{ flex:1 }}>
|
|
363
|
+
<View transparent style={{ flex:1 }}>
|
|
364
|
+
<FlatList
|
|
365
|
+
data={sections}
|
|
366
|
+
key={'manage_squares'}
|
|
367
|
+
keyExtractor={item => item}
|
|
368
|
+
renderItem={renderSections}
|
|
369
|
+
/>
|
|
370
|
+
</View>
|
|
371
|
+
<View type='footer' style={{ flexDirection:'row', alignItems:'center', padding:10, ...footer_style }}>
|
|
372
|
+
<Button
|
|
373
|
+
disabled={!is_changed}
|
|
374
|
+
style={{ flex:1, opacity: !is_changed || loading || errors.length > 0 ? 0.5: 1 }}
|
|
375
|
+
loading={loading}
|
|
376
|
+
title="SAVE"
|
|
377
|
+
type='action'
|
|
378
|
+
onPress={() => draft_competition ? updateCompetition(draft_competition) : console.log('')}
|
|
379
|
+
/>
|
|
380
|
+
{squares_competition?.status == 'pending' ?
|
|
381
|
+
<Button
|
|
382
|
+
disabled={errors.length > 0 || loading ? true : false}
|
|
383
|
+
style={{ flex:2, marginLeft:10, opacity: errors.length > 0 ? 0.5: 1 }}
|
|
384
|
+
loading={loading}
|
|
385
|
+
title="ACTIVATE!"
|
|
386
|
+
type='success'
|
|
387
|
+
onPress={() => handleActivate()}
|
|
388
|
+
/>
|
|
389
|
+
:<></>}
|
|
390
|
+
</View>
|
|
391
|
+
</View>
|
|
392
|
+
)
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
export default SquaresManager
|
package/src/index.tsx
CHANGED
|
@@ -60,6 +60,7 @@ import GuideView from './Guide';
|
|
|
60
60
|
import GroupComponent from './Group';
|
|
61
61
|
import CreateGroupWizard from './Group/components/CreateGroupWizard';
|
|
62
62
|
import CreateEngagement from './CreateEngagement';
|
|
63
|
+
import SquaresManager from './SquaresManager';
|
|
63
64
|
export {
|
|
64
65
|
Authenticator,
|
|
65
66
|
Observer,
|
|
@@ -67,6 +68,7 @@ export {
|
|
|
67
68
|
BEEventApi,
|
|
68
69
|
RankingsCard,
|
|
69
70
|
BELinkApi,
|
|
71
|
+
SquaresManager,
|
|
70
72
|
GuideView,
|
|
71
73
|
BetMatch,
|
|
72
74
|
ManageFilter,
|
package/src/types.d.ts
CHANGED
|
@@ -2205,7 +2205,7 @@ export interface SquaresCompetitionProps {
|
|
|
2205
2205
|
market_type:'FOR_MONEY'|'FREE', potential_winnings:number, last_iteration_scored:number, competition_code?:string, available_squares?:number,
|
|
2206
2206
|
begin_datetime:any, create_datetime:any, last_update_datetime:any, complete_datetime?:any, event_backup?:EventProps, guaranteed_payout?:number,
|
|
2207
2207
|
sq_comp_description?:string, image?:{ url:string }, prize_override?:string, prize_image?:{url:string},
|
|
2208
|
-
auth_strategy_id?:string, group_id?:string
|
|
2208
|
+
auth_strategy_id?:string, group_id?:string, status?:string
|
|
2209
2209
|
}
|
|
2210
2210
|
|
|
2211
2211
|
export interface SquaresExpectedValueProps {
|