be-components 5.0.0 → 5.0.1
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/Authenticator/index.js +6 -4
- package/lib/commonjs/Authenticator/index.js.map +1 -1
- package/lib/commonjs/Bracket/api/index.js +110 -53
- package/lib/commonjs/Bracket/api/index.js.map +1 -1
- package/lib/commonjs/Bracket/components/BracketCompetitionActions.js +5 -1
- package/lib/commonjs/Bracket/components/BracketCompetitionActions.js.map +1 -1
- package/lib/commonjs/Bracket/components/BracketPlay/BracketRound.js +21 -2
- package/lib/commonjs/Bracket/components/BracketPlay/BracketRound.js.map +1 -1
- package/lib/commonjs/Bracket/components/BracketPlay/RoundEvent.js +315 -9
- package/lib/commonjs/Bracket/components/BracketPlay/RoundEvent.js.map +1 -1
- package/lib/commonjs/Bracket/components/BracketPlay/index.js +301 -5
- package/lib/commonjs/Bracket/components/BracketPlay/index.js.map +1 -1
- package/lib/commonjs/Bracket/index.js +25 -10
- package/lib/commonjs/Bracket/index.js.map +1 -1
- package/lib/commonjs/Share/index.js +9 -8
- package/lib/commonjs/Share/index.js.map +1 -1
- package/lib/module/Authenticator/index.js +6 -4
- package/lib/module/Authenticator/index.js.map +1 -1
- package/lib/module/Bracket/api/index.js +110 -53
- package/lib/module/Bracket/api/index.js.map +1 -1
- package/lib/module/Bracket/components/BracketCompetitionActions.js +5 -1
- package/lib/module/Bracket/components/BracketCompetitionActions.js.map +1 -1
- package/lib/module/Bracket/components/BracketPlay/BracketRound.js +22 -3
- package/lib/module/Bracket/components/BracketPlay/BracketRound.js.map +1 -1
- package/lib/module/Bracket/components/BracketPlay/RoundEvent.js +315 -9
- package/lib/module/Bracket/components/BracketPlay/RoundEvent.js.map +1 -1
- package/lib/module/Bracket/components/BracketPlay/index.js +303 -7
- package/lib/module/Bracket/components/BracketPlay/index.js.map +1 -1
- package/lib/module/Bracket/index.js +25 -10
- package/lib/module/Bracket/index.js.map +1 -1
- package/lib/module/Share/index.js +9 -8
- package/lib/module/Share/index.js.map +1 -1
- package/lib/typescript/dist/embeds/bracket.bundle.d.ts +1 -0
- package/lib/typescript/dist/embeds/bracket.bundle.d.ts.map +1 -0
- package/lib/typescript/dist/embeds/common.bundle.d.ts +1 -0
- package/lib/typescript/dist/embeds/common.bundle.d.ts.map +1 -0
- package/lib/typescript/dist/embeds/main.bundle.d.ts +1 -0
- package/lib/typescript/dist/embeds/main.bundle.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Authenticator/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/api/index.d.ts +16 -10
- package/lib/typescript/lib/commonjs/Bracket/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketCompetitionActions.d.ts +2 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketCompetitionActions.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/BracketRound.d.ts +4 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/BracketRound.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/RoundEvent.d.ts +3 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/RoundEvent.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/index.d.ts +3 -1
- package/lib/typescript/lib/commonjs/Bracket/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Share/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Authenticator/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/api/index.d.ts +16 -10
- package/lib/typescript/lib/module/Bracket/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/BracketCompetitionActions.d.ts +2 -1
- package/lib/typescript/lib/module/Bracket/components/BracketCompetitionActions.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/BracketRound.d.ts +4 -1
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/BracketRound.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/RoundEvent.d.ts +3 -1
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/RoundEvent.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/index.d.ts +3 -1
- package/lib/typescript/lib/module/Bracket/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Components/Spring.d.ts +93 -93
- package/lib/typescript/lib/module/Share/index.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/api/index.d.ts +15 -3
- package/lib/typescript/src/Bracket/api/index.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/BracketCompetitionActions.d.ts +2 -1
- package/lib/typescript/src/Bracket/components/BracketCompetitionActions.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/BracketPlay/BracketRound.d.ts +3 -1
- package/lib/typescript/src/Bracket/components/BracketPlay/BracketRound.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/BracketPlay/RoundEvent.d.ts +3 -1
- package/lib/typescript/src/Bracket/components/BracketPlay/RoundEvent.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/BracketPlay/index.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/index.d.ts +4 -2
- package/lib/typescript/src/Bracket/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketMaker/api/index.d.ts +1 -1
- package/package.json +5 -2
- package/src/Authenticator/index.tsx +4 -4
- package/src/Bracket/api/index.ts +84 -52
- package/src/Bracket/components/BracketCompetitionActions.tsx +4 -2
- package/src/Bracket/components/BracketPlay/BracketRound.tsx +16 -5
- package/src/Bracket/components/BracketPlay/RoundEvent.tsx +149 -5
- package/src/Bracket/components/BracketPlay/index.tsx +182 -12
- package/src/Bracket/index.tsx +43 -36
- package/src/Share/index.tsx +3 -3
- package/src/types.d.ts +7 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { ActivityIndicator, ScrollView, Image } from "react-native";
|
|
2
|
+
import { ActivityIndicator, ScrollView, Image, FlatList } from "react-native";
|
|
3
3
|
import type { AthleteProps, BracketGroupProps, BracketProps, BracketRoundProps, CompetitionPlayerBracketProps, EventProps, MyPlayerProps, PlayerBracketPickProps, PlayerBracketProps, RoundEventProps, TeamProps } from '../../../types';
|
|
4
4
|
import { BracketApi, BracketComeptitionApi, BracketCompetitionHelpers } from '../../api';
|
|
5
5
|
import BracketRoundSection from './BracketRound';
|
|
6
6
|
import { Button, Text, View } from '../../../Components/Themed';
|
|
7
7
|
import { useColors } from '../../../constants/useColors';
|
|
8
8
|
import BracketNavigator from './BracketNavigator';
|
|
9
|
-
import { Icons } from '../../../Components';
|
|
9
|
+
import { Checkbox, Icons } from '../../../Components';
|
|
10
|
+
import RoundEventCard from './RoundEvent';
|
|
10
11
|
|
|
11
12
|
type BracketPlayProps = {
|
|
12
13
|
player?:MyPlayerProps
|
|
@@ -26,6 +27,9 @@ const BracketPlay = ({ player, view_mode, width, bracket_id, onSelectContest, pl
|
|
|
26
27
|
const Colors = useColors();
|
|
27
28
|
const [ round_event_loading, setRoundEventLoading ] = useState<string|undefined>(undefined);
|
|
28
29
|
const [ show_filter, setShowFilter ] = useState(false);
|
|
30
|
+
let round_margin = 4
|
|
31
|
+
const [ final_four_size, setFinalFourSize ] = useState({ height: 0, width:0 });
|
|
32
|
+
const [ bracket_size, setBracketSize ] = useState({ height:0, width:0, x: 0, y: 0 });
|
|
29
33
|
const [ play_data, setPlayData ] = useState<{
|
|
30
34
|
play_loading:boolean,
|
|
31
35
|
player_bracket?:PlayerBracketProps,
|
|
@@ -56,6 +60,9 @@ const BracketPlay = ({ player, view_mode, width, bracket_id, onSelectContest, pl
|
|
|
56
60
|
})
|
|
57
61
|
const { play_loading, player_bracket, player_bracket_picks } = play_data;
|
|
58
62
|
const { loading, bracket_groups, selected_group, bracket_rounds, round_events, bracket, teams, athletes, selected_round } = bracket_data;
|
|
63
|
+
const no_group_round_events = [ ...new Set(round_events.filter(ffe => ffe.bracket_group_id == '0').map(re => re.bracket_round_id)) ];
|
|
64
|
+
const no_group_rounds = bracket_rounds.filter(br => no_group_round_events.includes(br.bracket_round_id));
|
|
65
|
+
const { round_statuses, group_statuses } = BracketCompetitionHelpers.getPlayerBracketStatus(bracket_rounds, bracket_groups, round_events, player_bracket_picks);
|
|
59
66
|
|
|
60
67
|
const champion_team = player_bracket?.champion_id_type == 'team' ? teams.find(t => t.team_id == player_bracket?.champion_id) : undefined
|
|
61
68
|
const champion_athlete = player_bracket?.champion_id_type == 'athlete' ? athletes.find(a => a.athlete_id == player_bracket?.champion_id) : undefined
|
|
@@ -66,7 +73,12 @@ const BracketPlay = ({ player, view_mode, width, bracket_id, onSelectContest, pl
|
|
|
66
73
|
visible_rounds = bracket_rounds.filter((_, i) => i == next_round || i == next_round + 1)
|
|
67
74
|
}
|
|
68
75
|
|
|
69
|
-
let round_width = BracketCompetitionHelpers.calcRoundWidth(width, bracket_rounds.length,
|
|
76
|
+
let round_width = BracketCompetitionHelpers.calcRoundWidth(width, bracket_rounds.length, round_margin, false)
|
|
77
|
+
const full_width = BracketCompetitionHelpers.calcFullBracketSize(round_width, (bracket_rounds.length - no_group_rounds.length), 8);
|
|
78
|
+
const final_four_events = BracketCompetitionHelpers.getNonGroupGames(round_events, bracket_groups, player_bracket_picks)
|
|
79
|
+
const left_final_four = final_four_events.find(ffe => ffe.orientation == 'left');
|
|
80
|
+
const right_final_four = final_four_events.find(ffe => ffe.orientation == 'right');
|
|
81
|
+
const championship = final_four_events.find(ffe => ffe.championship);
|
|
70
82
|
|
|
71
83
|
useEffect(() => {
|
|
72
84
|
if(!bracket_id){ return }
|
|
@@ -150,22 +162,52 @@ const BracketPlay = ({ player, view_mode, width, bracket_id, onSelectContest, pl
|
|
|
150
162
|
})
|
|
151
163
|
}
|
|
152
164
|
|
|
153
|
-
const
|
|
165
|
+
const renderBracketGroups = (data: { item:BracketGroupProps, index:number, hide_titles?:boolean }) => {
|
|
166
|
+
let sorted_rounds = [ ...bracket_rounds ].sort((a,b) => a.round_number - b.round_number);
|
|
167
|
+
if(data.item.orientation == 'left'){ sorted_rounds = sorted_rounds.sort((a,b) => b.round_number - a.round_number) }
|
|
168
|
+
sorted_rounds = sorted_rounds.filter(sr => !no_group_rounds.map(r => r.bracket_round_id.toString()).includes(sr.bracket_round_id.toString()))
|
|
169
|
+
if(selected_group && selected_group.bracket_group_id != data.item.bracket_group_id){ return <></> }
|
|
170
|
+
return (
|
|
171
|
+
<View style={{ padding:4, marginRight: data.item.orientation == 'right' ? 50:0, marginLeft:data.item.orientation == 'left' ? 50 : 0 }}>
|
|
172
|
+
<Text style={{ padding:5 }} size={14} weight='bold' textAlign={data.item.orientation == 'right' ? 'left' : 'right'}>{data.item.group_name}</Text>
|
|
173
|
+
<View style={{alignItems:'flex-start' }}>
|
|
174
|
+
<FlatList
|
|
175
|
+
data={sorted_rounds}
|
|
176
|
+
keyExtractor={(item) => item.bracket_round_id.toString()}
|
|
177
|
+
horizontal
|
|
178
|
+
renderItem={({ item, index }) => renderBracketRounds({
|
|
179
|
+
item,
|
|
180
|
+
index,
|
|
181
|
+
bracket_group_id:data.item.bracket_group_id,
|
|
182
|
+
orientation:data.item.orientation,
|
|
183
|
+
hide_titles:data.hide_titles,
|
|
184
|
+
})}
|
|
185
|
+
/>
|
|
186
|
+
</View>
|
|
187
|
+
</View>
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
const renderBracketRounds = (data: { item:BracketRoundProps, index:number, bracket_group_id?:string, orientation:'left'|'right', hide_titles?:boolean, width?:number }) => {
|
|
154
191
|
const selected = selected_round?.bracket_round_id == data.item.bracket_round_id ? true : false
|
|
155
192
|
if(!bracket){ return <></> }
|
|
193
|
+
const pick_status = round_statuses.find(rs => rs.bracket_round_id == data.item.bracket_round_id)?.status
|
|
156
194
|
return (
|
|
157
195
|
<BracketRoundSection
|
|
158
196
|
round_event_loading={round_event_loading}
|
|
159
197
|
bracket_round={data.item}
|
|
160
198
|
round_events={round_events}
|
|
161
199
|
selected={selected}
|
|
200
|
+
active_bracket_group_id={data.bracket_group_id || selected_group?.bracket_group_id}
|
|
162
201
|
bracket={bracket}
|
|
163
|
-
teams={teams}
|
|
202
|
+
teams={teams}
|
|
203
|
+
compact={false}
|
|
204
|
+
hide_titles={data.hide_titles}
|
|
205
|
+
pick_status={pick_status}
|
|
164
206
|
onSelectContest={(round_event, player_bracket_pick, away_placeholder_pick, home_placeholder_pick) => onSelectContest ? onSelectContest(round_event, bracket, player_bracket_pick, away_placeholder_pick, home_placeholder_pick):undefined}
|
|
165
207
|
athletes={athletes}
|
|
166
208
|
player_bracket_picks={player_bracket_picks}
|
|
167
|
-
width={round_width}
|
|
168
|
-
orientation=
|
|
209
|
+
width={data.width ?? round_width}
|
|
210
|
+
orientation={data.orientation}
|
|
169
211
|
onSelectRound={(br) => setData({ ...bracket_data, selected_round: selected_round?.bracket_round_id == br.bracket_round_id ? undefined: br })}
|
|
170
212
|
onPick={(pick) => handlePick(pick)}
|
|
171
213
|
|
|
@@ -173,6 +215,27 @@ const BracketPlay = ({ player, view_mode, width, bracket_id, onSelectContest, pl
|
|
|
173
215
|
)
|
|
174
216
|
}
|
|
175
217
|
|
|
218
|
+
const renderNavGroups = (data:{ item:BracketGroupProps, index:number }) => {
|
|
219
|
+
const pick_status = group_statuses.find(s => s.bracket_group_id == data.item.bracket_group_id)?.status
|
|
220
|
+
const selected = selected_group?.bracket_group_id == data.item.bracket_group_id ? true : false
|
|
221
|
+
return (
|
|
222
|
+
<Button type='text' style={{ flexDirection:'row', alignItems:'center', padding:10, margin:5 }} onPress={() => {
|
|
223
|
+
setData({ ...bracket_data, selected_group: selected_group?.bracket_group_id == data.item.bracket_group_id ? undefined : data.item })
|
|
224
|
+
|
|
225
|
+
}}>
|
|
226
|
+
<View style={{ flexDirection:'row', alignItems:'center', flex:1, marginRight:25 }}>
|
|
227
|
+
<Checkbox checked={selected} color={Colors.text.action} disabled size={18} style={{ borderRadius:100 }} fill_style={{ borderRadius:100 }} onSelect={() => console.log('')} />
|
|
228
|
+
<Text style={{ marginLeft:10 }} size={14} theme='h1' textAlign="center">{data.item.group_name}</Text>
|
|
229
|
+
</View>
|
|
230
|
+
{pick_status == 'complete' ?
|
|
231
|
+
<Icons.CheckCirlceIcon color={Colors.text.success} size={14} />
|
|
232
|
+
:
|
|
233
|
+
<Icons.AlertIcon color={Colors.text.warning} size={14} />
|
|
234
|
+
}
|
|
235
|
+
</Button>
|
|
236
|
+
)
|
|
237
|
+
}
|
|
238
|
+
|
|
176
239
|
if(!bracket || loading || play_loading){
|
|
177
240
|
return (
|
|
178
241
|
<View type='blur'>
|
|
@@ -180,8 +243,9 @@ const BracketPlay = ({ player, view_mode, width, bracket_id, onSelectContest, pl
|
|
|
180
243
|
</View>
|
|
181
244
|
)
|
|
182
245
|
}
|
|
246
|
+
|
|
183
247
|
return (
|
|
184
|
-
<View style={{ flex:1 }}>
|
|
248
|
+
<View transparent style={{ flex:1 }}>
|
|
185
249
|
<BracketNavigator
|
|
186
250
|
visible={show_filter}
|
|
187
251
|
view_mode={view_mode}
|
|
@@ -251,12 +315,118 @@ const BracketPlay = ({ player, view_mode, width, bracket_id, onSelectContest, pl
|
|
|
251
315
|
/>
|
|
252
316
|
</View>
|
|
253
317
|
}
|
|
254
|
-
|
|
318
|
+
|
|
319
|
+
<View transparent style={{ paddingLeft:10, borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
320
|
+
<FlatList
|
|
321
|
+
data={bracket_groups}
|
|
322
|
+
key={'group_list'}
|
|
323
|
+
horizontal
|
|
324
|
+
renderItem={renderNavGroups}
|
|
325
|
+
keyExtractor={(item) => item.bracket_group_id.toString()}
|
|
326
|
+
/>
|
|
327
|
+
</View>
|
|
255
328
|
<ScrollView>
|
|
256
329
|
<ScrollView horizontal style={{ flexDirection:'row', padding:10 }}>
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
330
|
+
<View transparent>
|
|
331
|
+
{width > 1000 && !selected_round && !selected_group ?
|
|
332
|
+
<View onLayout={(ev) => {
|
|
333
|
+
const { height, width, x, y } = ev.nativeEvent.layout;
|
|
334
|
+
setBracketSize({ height, width, x, y })
|
|
335
|
+
}}>
|
|
336
|
+
<View style={{ flex:1, width: width, flexDirection:'row', flexWrap:'wrap' }} >
|
|
337
|
+
<FlatList
|
|
338
|
+
numColumns={2}
|
|
339
|
+
data={bracket_groups.sort((a,b) => a.sequence - b.sequence)}
|
|
340
|
+
renderItem={({ item, index }) => renderBracketGroups({ item, index, hide_titles:item.sequence<3?false:true })}
|
|
341
|
+
/>
|
|
342
|
+
{ final_four_events.length > 0 ?
|
|
343
|
+
<View nativeID="final_four"
|
|
344
|
+
float
|
|
345
|
+
style={{ position:'absolute',
|
|
346
|
+
padding:20,
|
|
347
|
+
top: (bracket_size.height / 2) + (4*8) - (final_four_size.height / 2),
|
|
348
|
+
left: (full_width / 2) - (final_four_size.width / 2),
|
|
349
|
+
flexDirection:'row', alignItems:'center', justifyContent:'center'}} onLayout={(ev) => {
|
|
350
|
+
const { height, width } = ev.nativeEvent.layout;
|
|
351
|
+
setFinalFourSize({ height, width })
|
|
352
|
+
}}>
|
|
353
|
+
{right_final_four ?
|
|
354
|
+
<View style={{ borderRadius:8, padding:2, borderBottomRightRadius:0, borderTopRightRadius:0 }}>
|
|
355
|
+
<Text style={{ marginBottom:10 }} size={14} textAlign="center" weight='bold'>Final Four</Text>
|
|
356
|
+
<RoundEventCard
|
|
357
|
+
round_event={right_final_four.round_event}
|
|
358
|
+
orientation={right_final_four.orientation}
|
|
359
|
+
width={round_width}
|
|
360
|
+
round_events={round_events}
|
|
361
|
+
player_bracket_pick={right_final_four.player_bracket_pick}
|
|
362
|
+
away_placeholder_pick={right_final_four.away_placeholder_pick}
|
|
363
|
+
home_placeholder_pick={right_final_four.home_placeholder_pick}
|
|
364
|
+
onPick={(player_bracket_pick) => handlePick(player_bracket_pick)}
|
|
365
|
+
/>
|
|
366
|
+
</View>
|
|
367
|
+
:<></>}
|
|
368
|
+
<View style={{ zIndex:1, borderRadius:8, margin:10 }}>
|
|
369
|
+
<View style={{ padding:8, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
|
|
370
|
+
<Text size={16} textAlign="center" weight="bold">Championship</Text>
|
|
371
|
+
</View>
|
|
372
|
+
{championship ?
|
|
373
|
+
<RoundEventCard
|
|
374
|
+
round_event={championship.round_event}
|
|
375
|
+
orientation={'right'}
|
|
376
|
+
width={round_width}
|
|
377
|
+
round_events={round_events}
|
|
378
|
+
player_bracket_pick={championship.player_bracket_pick}
|
|
379
|
+
away_placeholder_pick={championship.away_placeholder_pick}
|
|
380
|
+
home_placeholder_pick={championship.home_placeholder_pick}
|
|
381
|
+
onPick={(player_bracket_pick) => handlePick(player_bracket_pick)}
|
|
382
|
+
/>
|
|
383
|
+
:<></>}
|
|
384
|
+
{champion_team ?
|
|
385
|
+
<View style={{ padding:10, flexDirection:'row', alignItems:'center' }}>
|
|
386
|
+
<View style={{ marginRight:10 }}>
|
|
387
|
+
<Image
|
|
388
|
+
source={{ uri: champion_team.image?.url }}
|
|
389
|
+
style={{ height:30, width:30 }}
|
|
390
|
+
resizeMode="center"
|
|
391
|
+
/>
|
|
392
|
+
</View>
|
|
393
|
+
<View>
|
|
394
|
+
<Text size={10} weight="semibold">Champion Pick:</Text>
|
|
395
|
+
<Text style={{ marginTop:4 }} size={14} weight="bold">{champion_team.market_name} {champion_team.name}</Text>
|
|
396
|
+
</View>
|
|
397
|
+
</View>
|
|
398
|
+
:<></>}
|
|
399
|
+
</View>
|
|
400
|
+
{left_final_four ?
|
|
401
|
+
<View style={{ borderRadius:8, borderTopLeftRadius:0, borderBottomLeftRadius:0, padding:2 }}>
|
|
402
|
+
<Text style={{ marginBottom:10 }} size={14} textAlign="center" weight='bold'>Final Four</Text>
|
|
403
|
+
<RoundEventCard
|
|
404
|
+
width={round_width}
|
|
405
|
+
round_event={left_final_four.round_event}
|
|
406
|
+
orientation={left_final_four.orientation}
|
|
407
|
+
round_events={round_events}
|
|
408
|
+
player_bracket_pick={left_final_four.player_bracket_pick}
|
|
409
|
+
away_placeholder_pick={left_final_four.away_placeholder_pick}
|
|
410
|
+
home_placeholder_pick={left_final_four.home_placeholder_pick}
|
|
411
|
+
onPick={(player_bracket_pick) => handlePick(player_bracket_pick)}
|
|
412
|
+
/>
|
|
413
|
+
</View>
|
|
414
|
+
:<></>}
|
|
415
|
+
</View>
|
|
416
|
+
:<></>}
|
|
417
|
+
</View>
|
|
418
|
+
</View>
|
|
419
|
+
:
|
|
420
|
+
<View style={{ flexDirection:'row' }}>
|
|
421
|
+
{visible_rounds.sort((a,b) => a.round_number - b.round_number).map((br,i) => {
|
|
422
|
+
return renderBracketRounds({ item:br, index:i, orientation:'right' })
|
|
423
|
+
})}
|
|
424
|
+
</View>
|
|
425
|
+
}
|
|
426
|
+
</View>
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
|
|
260
430
|
</ScrollView>
|
|
261
431
|
</ScrollView>
|
|
262
432
|
|
package/src/Bracket/index.tsx
CHANGED
|
@@ -18,22 +18,24 @@ type BracketRoomProps = {
|
|
|
18
18
|
bracket_id?:string,
|
|
19
19
|
insets?: { top:number, bottom:number, right:number, left:number },
|
|
20
20
|
width:number,
|
|
21
|
+
hide_home?:boolean,
|
|
21
22
|
height?:number,
|
|
23
|
+
restrict_competition?:boolean,
|
|
22
24
|
player_balance?:PlayerBalanceProps,
|
|
23
25
|
bracket_competition_id?:string,
|
|
24
26
|
onManageCompetition:(bracket_competition_id:string) => void,
|
|
25
27
|
onFocusPosition?:(data:{ x:number, y:number, height:number, width:number }) => void,
|
|
26
28
|
onShareCompetition:(bracket_competition:BracketCompetitionProps) => void,
|
|
27
|
-
onRequestAuthenticate: (auth_strategy_id?:string) => void,
|
|
29
|
+
onRequestAuthenticate: (auth_strategy_id?:string, opt_in_url?:string) => void,
|
|
28
30
|
onNotEnoughBalance:(data:{ bracket_competition:BracketCompetitionProps }) => void,
|
|
29
31
|
onSelectContest?:(round_event:RoundEventProps, bracket:BracketProps, player_bracket_pick?:PlayerBracketPickProps, away_placeholder_pick?:PlayerBracketPickProps, home_placeholder_pick?:PlayerBracketPickProps) => void
|
|
30
32
|
onClose?:() => void,
|
|
31
33
|
onCreateNewCompetition?:(bracket_id?:string) => void
|
|
32
34
|
}
|
|
33
35
|
const sections = ['header', 'home', 'bracket_selector', 'bracket']
|
|
34
|
-
const MAX_WIDTH =
|
|
36
|
+
const MAX_WIDTH = 2000
|
|
35
37
|
|
|
36
|
-
const BracketRoom = ({ player_id, width, height, view_mode, bracket_id, insets, onSelectContest, onCreateNewCompetition, onManageCompetition, bracket_competition_id, player_balance, onRequestAuthenticate, onFocusPosition, onShareCompetition }:BracketRoomProps) => {
|
|
38
|
+
const BracketRoom = ({ player_id, hide_home, restrict_competition, width, height, view_mode, bracket_id, insets, onSelectContest, onCreateNewCompetition, onManageCompetition, bracket_competition_id, player_balance, onRequestAuthenticate, onFocusPosition, onShareCompetition }:BracketRoomProps) => {
|
|
37
39
|
const Colors = useColors();
|
|
38
40
|
const [ loading, setLoading ] = useState<string|undefined>(undefined);
|
|
39
41
|
const [ load_pb, setLoadPb ] = useState<PlayerBracketProps|undefined>(undefined);
|
|
@@ -48,7 +50,6 @@ const BracketRoom = ({ player_id, width, height, view_mode, bracket_id, insets,
|
|
|
48
50
|
entered_pbs: []
|
|
49
51
|
});
|
|
50
52
|
let mode = width < 600 ? 'small' : width < 1500 ? 'medium' : 'large'
|
|
51
|
-
let navigator_width = mode == 'large' ? 300 : mode == 'medium' ? 100 : 0
|
|
52
53
|
|
|
53
54
|
const [ play_data, setPlayData ] = useState<{
|
|
54
55
|
player_brackets:PlayerBracketProps[],
|
|
@@ -105,7 +106,7 @@ const BracketRoom = ({ player_id, width, height, view_mode, bracket_id, insets,
|
|
|
105
106
|
},[active_player_bracket])
|
|
106
107
|
|
|
107
108
|
let comp_action_width = mode != 'small' && active_bracket_id ? 300 : 0
|
|
108
|
-
let section_width = width -
|
|
109
|
+
let section_width = width - comp_action_width > MAX_WIDTH ? MAX_WIDTH : width - comp_action_width
|
|
109
110
|
|
|
110
111
|
//Very First Time we Launch - do this
|
|
111
112
|
useEffect(() => {
|
|
@@ -206,6 +207,7 @@ const BracketRoom = ({ player_id, width, height, view_mode, bracket_id, insets,
|
|
|
206
207
|
const renderSections = (data:{ item:string, index:number }) => {
|
|
207
208
|
switch(data.item){
|
|
208
209
|
case 'header':
|
|
210
|
+
if(hide_home){ return <></> }
|
|
209
211
|
return (
|
|
210
212
|
<BracketHeader
|
|
211
213
|
view_mode={view_mode}
|
|
@@ -248,7 +250,7 @@ const BracketRoom = ({ player_id, width, height, view_mode, bracket_id, insets,
|
|
|
248
250
|
player={player}
|
|
249
251
|
onSelectContest={onSelectContest}
|
|
250
252
|
insets={insets}
|
|
251
|
-
onRequestAuthenticate={() => onRequestAuthenticate(active_competition?.auth_strategy_id)}
|
|
253
|
+
onRequestAuthenticate={() => onRequestAuthenticate(active_competition?.auth_strategy_id, active_competition?.opt_in_url)}
|
|
252
254
|
|
|
253
255
|
onChangePlayerBracket={(bracket_id) => {
|
|
254
256
|
setBracketSelector(bracket_id)
|
|
@@ -275,7 +277,7 @@ const BracketRoom = ({ player_id, width, height, view_mode, bracket_id, insets,
|
|
|
275
277
|
<View style={{ flex:1 }}>
|
|
276
278
|
<View style={{ flex:1, flexDirection:'row' }}>
|
|
277
279
|
<View style={{ flex:1, alignItems:mode != 'small' ? 'center' : undefined }}>
|
|
278
|
-
<View style={{
|
|
280
|
+
<View transparent style={{ flex:1, width:section_width }}>
|
|
279
281
|
<FlatList
|
|
280
282
|
data={sections}
|
|
281
283
|
keyExtractor={(item) => item}
|
|
@@ -381,6 +383,7 @@ const BracketRoom = ({ player_id, width, height, view_mode, bracket_id, insets,
|
|
|
381
383
|
<BracketCompetitionActions
|
|
382
384
|
height_override={height}
|
|
383
385
|
view_mode={view_mode}
|
|
386
|
+
restrict_competition={restrict_competition}
|
|
384
387
|
onShowLeaderboard={(pbs, cpbs) => {
|
|
385
388
|
setShowCompetitionActions(false);
|
|
386
389
|
setTimeout(() => {
|
|
@@ -390,7 +393,7 @@ const BracketRoom = ({ player_id, width, height, view_mode, bracket_id, insets,
|
|
|
390
393
|
onRequestAuthenticate={() => {
|
|
391
394
|
setShowCompetitionActions(false);
|
|
392
395
|
setTimeout(() => {
|
|
393
|
-
onRequestAuthenticate(active_competition?.auth_strategy_id)
|
|
396
|
+
onRequestAuthenticate(active_competition?.auth_strategy_id, active_competition?.opt_in_url)
|
|
394
397
|
}, 500);
|
|
395
398
|
}}
|
|
396
399
|
player={player}
|
|
@@ -486,7 +489,7 @@ const BracketRoom = ({ player_id, width, height, view_mode, bracket_id, insets,
|
|
|
486
489
|
onPress={() => console.log('')}
|
|
487
490
|
/>
|
|
488
491
|
</View>
|
|
489
|
-
:
|
|
492
|
+
: !restrict_competition ?
|
|
490
493
|
<View transparent style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
|
|
491
494
|
<Icons.TrophyIcon size={20} color={Colors.text.white} />
|
|
492
495
|
<View transparent style={{ flex:1, marginLeft:10 }}>
|
|
@@ -501,45 +504,47 @@ const BracketRoom = ({ player_id, width, height, view_mode, bracket_id, insets,
|
|
|
501
504
|
onPress={() => console.log('')}
|
|
502
505
|
/>
|
|
503
506
|
</View>
|
|
504
|
-
}
|
|
507
|
+
:<></>}
|
|
505
508
|
</Button>
|
|
506
509
|
:<></>}
|
|
507
510
|
</View>
|
|
508
511
|
{mode != 'small' && active_bracket_id ?
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
512
|
+
<View type='header' style={{ width:300, height, overflow:'scroll', borderLeftWidth:1, borderColor:Colors.borders.light }}>
|
|
513
|
+
{active_competition ?
|
|
514
|
+
<View transparent>
|
|
515
|
+
<Image
|
|
516
|
+
source={{ uri: active_competition.image?.url }}
|
|
517
|
+
style={{ height:300, width:300 }}
|
|
518
|
+
resizeMode='cover'
|
|
519
|
+
/>
|
|
520
|
+
<View transparent style={{ padding:16, flexDirection:'row', alignItems:'center', backgroundColor:Colors.text.highlight }}>
|
|
521
|
+
<View transparent style={{ flex:1, marginRight:10 }}>
|
|
522
|
+
<Text theme='h2' color={Colors.text.white}>{active_competition.competition_name}</Text>
|
|
523
|
+
<Text style={{ marginTop:3 }} theme='description' color={Colors.text.white}>{active_competition.competition_name}</Text>
|
|
524
|
+
</View>
|
|
525
|
+
<Button
|
|
526
|
+
type='text'
|
|
527
|
+
float
|
|
528
|
+
style={{ padding:10, flexDirection:'row', alignItems:'center' }}
|
|
529
|
+
onPress={() => {
|
|
530
|
+
setShowCompetitionActions(false)
|
|
531
|
+
setTimeout(() => {
|
|
532
|
+
onShareCompetition(active_competition)
|
|
533
|
+
}, 500);
|
|
534
|
+
}}
|
|
535
|
+
>
|
|
536
|
+
<Icons.ShareIcon size={14} color={Colors.text.white} />
|
|
537
|
+
</Button>
|
|
521
538
|
</View>
|
|
522
|
-
<Button
|
|
523
|
-
type='text'
|
|
524
|
-
float
|
|
525
|
-
style={{ padding:10, flexDirection:'row', alignItems:'center' }}
|
|
526
|
-
onPress={() => {
|
|
527
|
-
setShowCompetitionActions(false)
|
|
528
|
-
setTimeout(() => {
|
|
529
|
-
onShareCompetition(active_competition)
|
|
530
|
-
}, 500);
|
|
531
|
-
}}
|
|
532
|
-
>
|
|
533
|
-
<Icons.ShareIcon size={14} color={Colors.text.white} />
|
|
534
|
-
</Button>
|
|
535
539
|
</View>
|
|
536
|
-
</View>
|
|
537
540
|
:<></>}
|
|
541
|
+
<View style={{ flex:1 }}>
|
|
538
542
|
<BracketCompetitionActions
|
|
539
543
|
view_mode={view_mode}
|
|
540
544
|
onRequestAuthenticate={() => onRequestAuthenticate(active_competition?.auth_strategy_id)}
|
|
541
545
|
player={player}
|
|
542
546
|
hide_image
|
|
547
|
+
restrict_competition={restrict_competition}
|
|
543
548
|
onShowLeaderboard={(pbs, cpbs) => {
|
|
544
549
|
setShowLeaderboard({ visible: true, entered_pbs:pbs, entered_cpbs: cpbs });
|
|
545
550
|
}}
|
|
@@ -601,6 +606,8 @@ const BracketRoom = ({ player_id, width, height, view_mode, bracket_id, insets,
|
|
|
601
606
|
competition_player_brackets={competition_player_brackets}
|
|
602
607
|
/>
|
|
603
608
|
</View>
|
|
609
|
+
|
|
610
|
+
</View>
|
|
604
611
|
:<></>}
|
|
605
612
|
</View>
|
|
606
613
|
{loading ?
|
package/src/Share/index.tsx
CHANGED
|
@@ -151,7 +151,7 @@ const ShareWidget = ({ generated_link_id, title, body, redirect_url, generator,
|
|
|
151
151
|
switch(data.item){
|
|
152
152
|
case 'header':
|
|
153
153
|
return (
|
|
154
|
-
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:20, borderTopRightRadius:
|
|
154
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:20, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
|
|
155
155
|
<View transparent style={{ flex:1 }}>
|
|
156
156
|
<Text theme='h1'>Share Modal</Text>
|
|
157
157
|
<Text style={{ marginTop:3 }} theme='description'>{title}</Text>
|
|
@@ -371,7 +371,7 @@ const ShareWidget = ({ generated_link_id, title, body, redirect_url, generator,
|
|
|
371
371
|
)
|
|
372
372
|
case 'footer':
|
|
373
373
|
return (
|
|
374
|
-
<View type='footer'>
|
|
374
|
+
<View type='footer' style={{ borderBottomRightRadius:8, borderBottomLeftRadius:8, padding:2 }}>
|
|
375
375
|
{active_tab == 'embed' ?
|
|
376
376
|
<Button transparent style={{ flexDirection:'row', alignItems:'center' }} onPress={() => setActiveTab('link')}>
|
|
377
377
|
<View transparent style={{ flex:1, marginRight:10 }}>
|
|
@@ -402,7 +402,7 @@ const ShareWidget = ({ generated_link_id, title, body, redirect_url, generator,
|
|
|
402
402
|
const link_is_changed = JSON.stringify(draft_generated_link) != JSON.stringify(generated_link)
|
|
403
403
|
const needs_verification = link_is_changed && !visible_id_valid
|
|
404
404
|
return (
|
|
405
|
-
<View float
|
|
405
|
+
<View float>
|
|
406
406
|
<FlatList
|
|
407
407
|
data={share_sections}
|
|
408
408
|
renderItem={renderSections}
|
package/src/types.d.ts
CHANGED
|
@@ -34,7 +34,13 @@ export interface FocusPositionProps {
|
|
|
34
34
|
width:number
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
export interface BracketPickStatProps {
|
|
38
|
+
bracket_id:string,
|
|
39
|
+
round_event_id:string,
|
|
40
|
+
pick_side_type:string,
|
|
41
|
+
pick_side_id:string,
|
|
42
|
+
pick_count:number
|
|
43
|
+
}
|
|
38
44
|
|
|
39
45
|
export interface ArticleFeedProps {
|
|
40
46
|
article_feed_id: string,
|