be-components 4.5.4 → 4.5.6
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/Bracket/api/index.js +0 -2
- package/lib/commonjs/Bracket/api/index.js.map +1 -1
- package/lib/commonjs/Bracket/components/BracketCompetitionActions.js +8 -7
- package/lib/commonjs/Bracket/components/BracketCompetitionActions.js.map +1 -1
- package/lib/commonjs/Bracket/components/BracketPlay/BracketRound.js +2 -0
- package/lib/commonjs/Bracket/components/BracketPlay/BracketRound.js.map +1 -1
- package/lib/commonjs/Bracket/components/BracketPlay/index.js +0 -8
- package/lib/commonjs/Bracket/components/BracketPlay/index.js.map +1 -1
- package/lib/commonjs/Bracket/components/EditPlayerBracket.js +32 -3
- package/lib/commonjs/Bracket/components/EditPlayerBracket.js.map +1 -1
- package/lib/commonjs/Bracket/components/EnteredCompetitionsModal.js +197 -0
- package/lib/commonjs/Bracket/components/EnteredCompetitionsModal.js.map +1 -0
- package/lib/commonjs/Bracket/components/ManageBracketCompetitionForm.js +5 -5
- package/lib/commonjs/Bracket/components/ManageBracketCompetitionForm.js.map +1 -1
- package/lib/commonjs/Bracket/components/PlayerBracketCard.js +21 -4
- package/lib/commonjs/Bracket/components/PlayerBracketCard.js.map +1 -1
- package/lib/commonjs/Bracket/components/PlayerBrackets.js +27 -4
- package/lib/commonjs/Bracket/components/PlayerBrackets.js.map +1 -1
- package/lib/commonjs/Bracket/components/RoomHome.js +408 -107
- package/lib/commonjs/Bracket/components/RoomHome.js.map +1 -1
- package/lib/commonjs/Bracket/index.js +246 -420
- package/lib/commonjs/Bracket/index.js.map +1 -1
- package/lib/module/Bracket/api/index.js +0 -2
- package/lib/module/Bracket/api/index.js.map +1 -1
- package/lib/module/Bracket/components/BracketCompetitionActions.js +8 -7
- package/lib/module/Bracket/components/BracketCompetitionActions.js.map +1 -1
- package/lib/module/Bracket/components/BracketPlay/BracketRound.js +2 -0
- package/lib/module/Bracket/components/BracketPlay/BracketRound.js.map +1 -1
- package/lib/module/Bracket/components/BracketPlay/index.js +0 -8
- package/lib/module/Bracket/components/BracketPlay/index.js.map +1 -1
- package/lib/module/Bracket/components/EditPlayerBracket.js +33 -4
- package/lib/module/Bracket/components/EditPlayerBracket.js.map +1 -1
- package/lib/module/Bracket/components/EnteredCompetitionsModal.js +190 -0
- package/lib/module/Bracket/components/EnteredCompetitionsModal.js.map +1 -0
- package/lib/module/Bracket/components/ManageBracketCompetitionForm.js +5 -5
- package/lib/module/Bracket/components/ManageBracketCompetitionForm.js.map +1 -1
- package/lib/module/Bracket/components/PlayerBracketCard.js +21 -4
- package/lib/module/Bracket/components/PlayerBracketCard.js.map +1 -1
- package/lib/module/Bracket/components/PlayerBrackets.js +28 -5
- package/lib/module/Bracket/components/PlayerBrackets.js.map +1 -1
- package/lib/module/Bracket/components/RoomHome.js +410 -109
- package/lib/module/Bracket/components/RoomHome.js.map +1 -1
- package/lib/module/Bracket/index.js +247 -421
- package/lib/module/Bracket/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/api/index.d.ts.map +1 -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.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/index.d.ts +1 -2
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/EditPlayerBracket.d.ts +3 -1
- package/lib/typescript/lib/commonjs/Bracket/components/EditPlayerBracket.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/EnteredCompetitionsModal.d.ts +14 -0
- package/lib/typescript/lib/commonjs/Bracket/components/EnteredCompetitionsModal.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Bracket/components/PlayerBrackets.d.ts +4 -1
- package/lib/typescript/lib/commonjs/Bracket/components/PlayerBrackets.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/RoomHome.d.ts +3 -14
- package/lib/typescript/lib/commonjs/Bracket/components/RoomHome.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/api/index.d.ts.map +1 -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.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/index.d.ts +1 -2
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/EditPlayerBracket.d.ts +5 -2
- package/lib/typescript/lib/module/Bracket/components/EditPlayerBracket.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/EnteredCompetitionsModal.d.ts +15 -0
- package/lib/typescript/lib/module/Bracket/components/EnteredCompetitionsModal.d.ts.map +1 -0
- package/lib/typescript/lib/module/Bracket/components/PlayerBracketCard.d.ts +3 -1
- package/lib/typescript/lib/module/Bracket/components/PlayerBracketCard.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/PlayerBrackets.d.ts +6 -2
- package/lib/typescript/lib/module/Bracket/components/PlayerBrackets.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/RoomHome.d.ts +3 -14
- package/lib/typescript/lib/module/Bracket/components/RoomHome.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/index.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/api/index.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/BracketCompetitionActions.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/BracketPlay/index.d.ts +1 -2
- package/lib/typescript/src/Bracket/components/BracketPlay/index.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/EditPlayerBracket.d.ts +8 -1
- package/lib/typescript/src/Bracket/components/EditPlayerBracket.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/EnteredCompetitionsModal.d.ts +21 -0
- package/lib/typescript/src/Bracket/components/EnteredCompetitionsModal.d.ts.map +1 -0
- package/lib/typescript/src/Bracket/components/PlayerBracketCard.d.ts +3 -2
- package/lib/typescript/src/Bracket/components/PlayerBracketCard.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/PlayerBrackets.d.ts +9 -1
- package/lib/typescript/src/Bracket/components/PlayerBrackets.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/RoomHome.d.ts +10 -18
- package/lib/typescript/src/Bracket/components/RoomHome.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Bracket/api/index.ts +0 -2
- package/src/Bracket/components/BracketCompetitionActions.tsx +7 -6
- package/src/Bracket/components/BracketPlay/BracketRound.tsx +2 -2
- package/src/Bracket/components/BracketPlay/index.tsx +13 -18
- package/src/Bracket/components/EditPlayerBracket.tsx +58 -42
- package/src/Bracket/components/EnteredCompetitionsModal.tsx +113 -0
- package/src/Bracket/components/ManageBracketCompetitionForm.tsx +5 -5
- package/src/Bracket/components/PlayerBracketCard.tsx +9 -4
- package/src/Bracket/components/PlayerBrackets.tsx +45 -33
- package/src/Bracket/components/RoomHome.tsx +335 -112
- package/src/Bracket/index.tsx +280 -410
package/src/Bracket/index.tsx
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { BracketApi, BracketComeptitionApi
|
|
3
|
-
import type {
|
|
2
|
+
import { BracketApi, BracketComeptitionApi } from './api';
|
|
3
|
+
import type { BracketCompetitionProps, CompetitionPlayerBracketProps, CompetitionResultTypeProps, LeagueProps, MyPlayerProps, PlayerBalanceProps, PlayerBracketProps } from '../types';
|
|
4
4
|
import BracketPlay from './components/BracketPlay';
|
|
5
5
|
import { Button, Text, View } from '../Components/Themed';
|
|
6
6
|
import { ActivityIndicator, FlatList, Image, Modal } from 'react-native';
|
|
7
7
|
import BracketHeader from './components/BracketHeader';
|
|
8
8
|
import RoomHome from './components/RoomHome';
|
|
9
9
|
import BracketCompetitionActions from './components/BracketCompetitionActions';
|
|
10
|
-
import EditPlayerBracket from './components/EditPlayerBracket';
|
|
11
10
|
import { useColors } from '../constants/useColors';
|
|
12
|
-
import PlayerBracketSelector from './components/PlayerBrackets';
|
|
13
11
|
import { Icons } from '../Components';
|
|
14
12
|
|
|
15
13
|
type BracketRoomProps = {
|
|
@@ -37,7 +35,19 @@ const BracketRoom = ({ player_id, width, view_mode, bracket_id, insets, onCreate
|
|
|
37
35
|
const [ show_competition_actions, setShowCompetitionActions ] = useState(false);
|
|
38
36
|
let mode = width < 600 ? 'small' : width < 1500 ? 'medium' : 'large'
|
|
39
37
|
let navigator_width = mode == 'large' ? 300 : mode == 'medium' ? 100 : 0
|
|
38
|
+
|
|
39
|
+
const [ play_data, setPlayData ] = useState<{
|
|
40
|
+
player_brackets:PlayerBracketProps[],
|
|
41
|
+
competition_player_brackets:CompetitionPlayerBracketProps[],
|
|
42
|
+
}>({
|
|
43
|
+
competition_player_brackets: [],
|
|
44
|
+
player_brackets: []
|
|
45
|
+
});
|
|
46
|
+
const { player_brackets, competition_player_brackets } = play_data;
|
|
47
|
+
|
|
40
48
|
const [ local_balance, setLocalBalance ] = useState<PlayerBalanceProps|undefined>(player_balance);
|
|
49
|
+
const [ player, setPlayer ] = useState<MyPlayerProps|undefined>(undefined);
|
|
50
|
+
|
|
41
51
|
const [ static_data, setStaticData ] = useState<{
|
|
42
52
|
static_loaded:boolean,
|
|
43
53
|
leagues:LeagueProps[],
|
|
@@ -49,92 +59,82 @@ const BracketRoom = ({ player_id, width, view_mode, bracket_id, insets, onCreate
|
|
|
49
59
|
});
|
|
50
60
|
const { competition_result_types, leagues, static_loaded } = static_data;
|
|
51
61
|
|
|
52
|
-
const [ room_data, setRoomData ] = useState<{
|
|
53
|
-
room_loaded: boolean,
|
|
54
|
-
public_competitions:BracketCompetitionProps[],
|
|
55
|
-
active_brackets:BracketProps[]
|
|
56
|
-
}>({
|
|
57
|
-
room_loaded:false,
|
|
58
|
-
public_competitions: [],
|
|
59
|
-
active_brackets: []
|
|
60
|
-
});
|
|
61
|
-
const { room_loaded, public_competitions, active_brackets } = room_data;
|
|
62
|
-
const [ show_pb_selector, setShowPBSelector ] = useState(false);
|
|
63
|
-
const [ editing_player_bracket, setEditingPlayerBracket ] = useState<PlayerBracketProps | undefined>(undefined);
|
|
64
62
|
const [ nav_data, setNavData ] = useState<{
|
|
65
63
|
active_nav: string,
|
|
66
|
-
|
|
64
|
+
active_competition?:BracketCompetitionProps,
|
|
67
65
|
active_bracket_id?:string,
|
|
68
66
|
active_player_bracket_id?:string
|
|
69
67
|
}>({
|
|
70
68
|
active_nav: 'home'
|
|
71
69
|
});
|
|
72
|
-
|
|
70
|
+
|
|
71
|
+
const { active_nav, active_bracket_id, active_competition, active_player_bracket_id } = nav_data;
|
|
72
|
+
|
|
73
73
|
let comp_action_width = mode != 'small' && active_bracket_id ? 300 : 0
|
|
74
74
|
let section_width = width - navigator_width - comp_action_width > MAX_WIDTH ? MAX_WIDTH : width - navigator_width - comp_action_width
|
|
75
|
-
|
|
76
|
-
player?:MyPlayerProps,
|
|
77
|
-
teams:TeamProps[],
|
|
78
|
-
athletes:AthleteProps[],
|
|
79
|
-
bracket_competitions:BracketCompetitionProps[],
|
|
80
|
-
player_brackets:PlayerBracketProps[],
|
|
81
|
-
brackets:BracketProps[],
|
|
82
|
-
competition_player_brackets:CompetitionPlayerBracketProps[]
|
|
83
|
-
}>({
|
|
84
|
-
teams:[],
|
|
85
|
-
athletes:[],
|
|
86
|
-
player_brackets: [],
|
|
87
|
-
brackets:[],
|
|
88
|
-
bracket_competitions:[],
|
|
89
|
-
competition_player_brackets: []
|
|
90
|
-
});
|
|
91
|
-
const { teams, athletes, brackets, bracket_competitions, player_brackets, competition_player_brackets, player } = my_data
|
|
92
|
-
const [ my_admin_data, setMyAdminData ] = useState<{
|
|
93
|
-
admin_offset:number,
|
|
94
|
-
admin_competitions:BracketCompetitionProps[]
|
|
95
|
-
}>({
|
|
96
|
-
admin_offset:0,
|
|
97
|
-
admin_competitions: []
|
|
98
|
-
});
|
|
99
|
-
const { admin_competitions, admin_offset } = my_admin_data;
|
|
100
|
-
const active_player_bracket = player_brackets.filter(pb => pb.status != 'deleted').find(pb => pb.player_bracket_id == active_player_bracket_id);
|
|
101
|
-
const active_bracket = brackets.find(b => b.bracket_id == active_bracket_id);
|
|
102
|
-
const active_competition = public_competitions.find(bc => bc.bracket_competition_id == active_competition_id);
|
|
75
|
+
|
|
103
76
|
//Very First Time we Launch - do this
|
|
104
77
|
useEffect(() => {
|
|
105
78
|
BracketApi.setEnvironment();
|
|
106
|
-
|
|
107
|
-
},[
|
|
79
|
+
getStaticData()
|
|
80
|
+
},[]);
|
|
108
81
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if(!
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
82
|
+
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if(!static_loaded){ return }
|
|
85
|
+
if(!player_id){ return }
|
|
86
|
+
getMyData()
|
|
87
|
+
},[static_loaded, player_id]);
|
|
88
|
+
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if(!bracket_id && !bracket_competition_id){ return }
|
|
91
|
+
if(!static_loaded){ return }
|
|
92
|
+
setUpInitData(bracket_id, bracket_competition_id)
|
|
93
|
+
},[static_loaded, player_id, bracket_id, bracket_competition_id])
|
|
94
|
+
|
|
95
|
+
const setUpInitData = async(bracket_id?:string, bracket_competition_id?:string) => {
|
|
96
|
+
let init_bracket_id = bracket_id
|
|
97
|
+
let bc:BracketCompetitionProps | undefined = undefined
|
|
98
|
+
let active_pb_id:string|undefined = undefined
|
|
99
|
+
if(bracket_competition_id){
|
|
100
|
+
let resp = await BracketComeptitionApi.getBracketCompetitionById(bracket_competition_id);
|
|
101
|
+
bc = resp?.bracket_competition
|
|
102
|
+
if(bc){ init_bracket_id = bc.bracket_id }
|
|
120
103
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
104
|
+
|
|
105
|
+
if(player_id && init_bracket_id){
|
|
106
|
+
//Get the play data for whaat is provided!!
|
|
107
|
+
const my_data = await BracketComeptitionApi.getMyPlayerBrackets(init_bracket_id);
|
|
108
|
+
//Try to find an already entered bracket
|
|
109
|
+
active_pb_id = my_data.competition_player_brackets.find(cpb => cpb.bracket_competition_id == bracket_competition_id)?.player_bracket_id
|
|
110
|
+
if(!active_pb_id){
|
|
111
|
+
//Pick a random one
|
|
112
|
+
active_pb_id = my_data.player_brackets[0]?.player_bracket_id
|
|
113
|
+
}
|
|
114
|
+
setPlayData({
|
|
115
|
+
...play_data,
|
|
116
|
+
player_brackets: my_data.player_brackets,
|
|
117
|
+
competition_player_brackets: my_data.competition_player_brackets,
|
|
118
|
+
})
|
|
124
119
|
}
|
|
125
|
-
|
|
120
|
+
setNavData({
|
|
121
|
+
...nav_data,
|
|
122
|
+
active_nav: 'bracket',
|
|
123
|
+
active_player_bracket_id:active_pb_id,
|
|
124
|
+
active_bracket_id:init_bracket_id,
|
|
125
|
+
active_competition:bc
|
|
126
|
+
})
|
|
126
127
|
}
|
|
127
128
|
|
|
128
|
-
const
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
});
|
|
129
|
+
const getMyData = async() => {
|
|
130
|
+
const pb = await BracketComeptitionApi.getMyBalance();
|
|
131
|
+
const pl = await BracketComeptitionApi.getMyDetails();
|
|
132
|
+
setLocalBalance(pb);
|
|
133
|
+
setPlayer(pl);
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
const getStaticData = async() => {
|
|
137
|
-
setLoading('
|
|
137
|
+
setLoading('Setting Up Bracket')
|
|
138
138
|
const comp_options = await BracketComeptitionApi.getCompetitionOptions();
|
|
139
139
|
const lgs = await BracketApi.getLeagues();
|
|
140
140
|
setStaticData({
|
|
@@ -143,82 +143,24 @@ const BracketRoom = ({ player_id, width, view_mode, bracket_id, insets, onCreate
|
|
|
143
143
|
leagues:lgs,
|
|
144
144
|
competition_result_types: comp_options.competition_result_types
|
|
145
145
|
});
|
|
146
|
+
setTimeout(() => setLoading(undefined),500)
|
|
146
147
|
}
|
|
147
148
|
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
pub_competitions = pub_competitions.filter(pc => pc.bracket_competition_id != bc.bracket_competition.bracket_competition_id).concat(bc.bracket_competition);
|
|
156
|
-
setNavData({
|
|
157
|
-
...nav_data,
|
|
158
|
-
active_bracket_id: bc.bracket_competition.bracket_id,
|
|
159
|
-
active_competition_id: bracket_competition_id,
|
|
160
|
-
active_player_bracket_id: pb?.player_bracket_id,
|
|
161
|
-
active_nav: 'bracket'
|
|
162
|
-
});
|
|
163
|
-
setRoomData({
|
|
164
|
-
...room_data,
|
|
165
|
-
room_loaded: true,
|
|
166
|
-
active_brackets: pub_brackets,
|
|
167
|
-
public_competitions: pub_competitions.filter(pc => pc.status == 'scheduled')
|
|
168
|
-
});
|
|
169
|
-
if(mode == 'small'){ return setShowCompetitionActions(true) }
|
|
170
|
-
return
|
|
171
|
-
}
|
|
172
|
-
if(bracket_id){
|
|
173
|
-
let pb = player_brackets.find(pb => pb.status != 'deleted' && pb.bracket_id == bracket_id);
|
|
174
|
-
setNavData({
|
|
175
|
-
...nav_data,
|
|
176
|
-
active_bracket_id: bracket_id,
|
|
177
|
-
active_competition_id: undefined,
|
|
178
|
-
active_player_bracket_id: pb?.player_bracket_id,
|
|
179
|
-
active_nav: 'bracket'
|
|
180
|
-
})
|
|
181
|
-
}
|
|
182
|
-
setRoomData({
|
|
183
|
-
...room_data,
|
|
184
|
-
room_loaded: true,
|
|
185
|
-
active_brackets: pub_brackets,
|
|
186
|
-
public_competitions: pub_competitions.filter(pc => pc.status == 'scheduled')
|
|
149
|
+
const handleView = async(bracket_id:string, player_bracket_id?:string, bracket_competition?:BracketCompetitionProps) => {
|
|
150
|
+
setNavData({
|
|
151
|
+
...nav_data,
|
|
152
|
+
active_nav:'bracket',
|
|
153
|
+
active_player_bracket_id:player_bracket_id,
|
|
154
|
+
active_bracket_id: bracket_id,
|
|
155
|
+
active_competition: bracket_competition
|
|
187
156
|
});
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
let pb = await BracketComeptitionApi.getMyBalance();
|
|
194
|
-
await getAdminData(0);
|
|
195
|
-
setLocalBalance(pb)
|
|
196
|
-
let my_resp = await BracketComeptitionApi.getMyPlayerBrackets();
|
|
197
|
-
let champ_team_ids = my_resp.player_brackets.filter(pb => pb.champion_id_type == 'team').map(b => b.champion_id ?? '')
|
|
198
|
-
const champ_teams = await BracketApi.getTeamsByIds(champ_team_ids);
|
|
199
|
-
let champ_athlete_ids = my_resp.player_brackets.filter(pb => pb.champion_id_type == 'athlete').map(b => b.champion_id ?? '')
|
|
200
|
-
const champ_athletes = await BracketApi.getAthletesByIds(champ_athlete_ids);
|
|
201
|
-
//Now get more if there is a bracket_id or competition_id
|
|
202
|
-
if(bracket_id || bracket_competition_id){
|
|
203
|
-
let bracket_pbs = await BracketComeptitionApi.getMyPlayerBrackets(bracket_id, bracket_competition_id)
|
|
204
|
-
my_resp = BracketCompetitionHelpers.combinePlayerBrackets(my_resp, bracket_pbs);
|
|
205
|
-
}
|
|
206
|
-
//Get brackets
|
|
207
|
-
let bks = await BracketApi.getBracketsByIds(my_resp.player_brackets.map(pb => pb.bracket_id));
|
|
208
|
-
|
|
209
|
-
setMyData({
|
|
210
|
-
...my_data,
|
|
211
|
-
athletes: champ_athletes,
|
|
212
|
-
teams: champ_teams,
|
|
213
|
-
brackets: bks,
|
|
214
|
-
player: p,
|
|
215
|
-
player_brackets: my_resp.player_brackets.filter(pb => pb.status != 'deleted'),
|
|
216
|
-
bracket_competitions: my_resp.bracket_competitions,
|
|
217
|
-
competition_player_brackets: my_resp.competition_player_brackets
|
|
157
|
+
const my_data = await BracketComeptitionApi.getMyPlayerBrackets(bracket_id);
|
|
158
|
+
setPlayData({
|
|
159
|
+
...play_data,
|
|
160
|
+
player_brackets: my_data.player_brackets,
|
|
161
|
+
competition_player_brackets: my_data.competition_player_brackets
|
|
218
162
|
})
|
|
219
|
-
return my_resp
|
|
220
163
|
}
|
|
221
|
-
|
|
222
164
|
|
|
223
165
|
const renderSections = (data:{ item:string, index:number }) => {
|
|
224
166
|
switch(data.item){
|
|
@@ -227,55 +169,29 @@ const BracketRoom = ({ player_id, width, view_mode, bracket_id, insets, onCreate
|
|
|
227
169
|
<BracketHeader
|
|
228
170
|
view_mode={view_mode}
|
|
229
171
|
active_nav={active_nav}
|
|
230
|
-
bracket={
|
|
231
|
-
bracket_competition={
|
|
172
|
+
bracket={undefined}
|
|
173
|
+
bracket_competition={undefined}
|
|
232
174
|
onGoHome={() => setNavData({
|
|
233
175
|
...nav_data,
|
|
234
176
|
active_bracket_id:undefined,
|
|
235
177
|
active_nav:'home',
|
|
236
|
-
|
|
178
|
+
active_competition: undefined,
|
|
237
179
|
active_player_bracket_id: undefined
|
|
238
180
|
})}
|
|
239
181
|
/>
|
|
240
182
|
)
|
|
241
183
|
case 'home':
|
|
184
|
+
if(!static_loaded){ return <></> }
|
|
242
185
|
return (
|
|
243
186
|
<RoomHome
|
|
244
187
|
player={player}
|
|
188
|
+
visible={active_nav == 'home' ? true : false}
|
|
245
189
|
width={section_width}
|
|
246
|
-
admin_competitions={admin_competitions}
|
|
247
|
-
onMoreAdmin={(offset) => getAdminData(offset)}
|
|
248
|
-
admin_offset={admin_offset}
|
|
249
|
-
brackets={brackets}
|
|
250
190
|
onManageCompetition={onManageCompetition}
|
|
251
|
-
onUpdatePlayerBracket={(new_pb) => {
|
|
252
|
-
setMyData({
|
|
253
|
-
...my_data,
|
|
254
|
-
player_brackets: player_brackets.filter(pb => pb.player_bracket_id != new_pb.player_bracket_id).concat(new_pb)
|
|
255
|
-
})
|
|
256
|
-
}}
|
|
257
191
|
onCreateNewCompetition={onCreateNewCompetition}
|
|
258
|
-
visible={active_nav == 'home' ? true : false}
|
|
259
|
-
active_brackets={active_brackets}
|
|
260
192
|
view_mode={view_mode}
|
|
261
|
-
competition_result_types={competition_result_types}
|
|
262
193
|
leagues={leagues}
|
|
263
|
-
|
|
264
|
-
onView={(bracket_id, player_bracket_id, bracket_competition_id) => {
|
|
265
|
-
setNavData({
|
|
266
|
-
...nav_data,
|
|
267
|
-
active_nav: 'bracket',
|
|
268
|
-
active_player_bracket_id: player_bracket_id,
|
|
269
|
-
active_bracket_id: bracket_id,
|
|
270
|
-
active_competition_id: bracket_competition_id
|
|
271
|
-
})
|
|
272
|
-
}}
|
|
273
|
-
player_brackets={player_brackets.filter(pb => pb.status != 'deleted')}
|
|
274
|
-
competition_player_brackets={competition_player_brackets.filter(cpb => cpb.status != 'deleted')}
|
|
275
|
-
public_competitions={public_competitions}
|
|
276
|
-
bracket_competitions={bracket_competitions}
|
|
277
|
-
athletes={athletes}
|
|
278
|
-
teams={teams}
|
|
194
|
+
onView={handleView}
|
|
279
195
|
/>
|
|
280
196
|
)
|
|
281
197
|
case 'bracket':
|
|
@@ -284,18 +200,22 @@ const BracketRoom = ({ player_id, width, view_mode, bracket_id, insets, onCreate
|
|
|
284
200
|
return (
|
|
285
201
|
<BracketPlay
|
|
286
202
|
width={section_width}
|
|
287
|
-
|
|
203
|
+
player={player}
|
|
288
204
|
onRequestAuthenticate={() => onRequestAuthenticate(active_competition?.auth_strategy_id)}
|
|
289
|
-
|
|
290
|
-
setEditingPlayerBracket(pb);
|
|
291
|
-
}}
|
|
205
|
+
|
|
292
206
|
onChangePlayerBracket={() => {
|
|
293
|
-
|
|
207
|
+
setNavData({
|
|
208
|
+
...nav_data,
|
|
209
|
+
active_nav:'home',
|
|
210
|
+
active_bracket_id:undefined,
|
|
211
|
+
active_competition:undefined,
|
|
212
|
+
active_player_bracket_id:undefined
|
|
213
|
+
})
|
|
294
214
|
}}
|
|
295
215
|
onPlayerBracketUpdate={(newpb, ncpbs) => {
|
|
296
|
-
|
|
297
|
-
...
|
|
298
|
-
player_brackets:
|
|
216
|
+
setPlayData({
|
|
217
|
+
...play_data,
|
|
218
|
+
player_brackets:player_brackets.filter(pb => pb.player_bracket_id != newpb.player_bracket_id).concat(newpb),
|
|
299
219
|
competition_player_brackets: competition_player_brackets.filter(cpb => !ncpbs.find(ncpb => ncpb.competition_player_bracket_id == cpb.competition_player_bracket_id)).concat(ncpbs)
|
|
300
220
|
})
|
|
301
221
|
}}
|
|
@@ -307,7 +227,6 @@ const BracketRoom = ({ player_id, width, view_mode, bracket_id, insets, onCreate
|
|
|
307
227
|
}
|
|
308
228
|
}
|
|
309
229
|
|
|
310
|
-
|
|
311
230
|
return (
|
|
312
231
|
<View style={{ flex:1 }}>
|
|
313
232
|
<View style={{ flex:1, flexDirection:'row' }}>
|
|
@@ -317,11 +236,122 @@ const BracketRoom = ({ player_id, width, view_mode, bracket_id, insets, onCreate
|
|
|
317
236
|
data={sections}
|
|
318
237
|
keyExtractor={(item) => item}
|
|
319
238
|
refreshing={loading ? true : false}
|
|
320
|
-
onRefresh={() => loadData()}
|
|
321
239
|
key={'bracket_sections'}
|
|
322
240
|
renderItem={renderSections}
|
|
323
241
|
/>
|
|
324
242
|
</View>
|
|
243
|
+
<Modal
|
|
244
|
+
visible={show_competition_actions}
|
|
245
|
+
transparent
|
|
246
|
+
style={{ flex:1 }}
|
|
247
|
+
animationType={'slide'}
|
|
248
|
+
>
|
|
249
|
+
<View type='blur' style={{ flex:1, justifyContent:'flex-end', padding:10, paddingBottom:(insets?.bottom ?? 0)+10 }}>
|
|
250
|
+
<View float style={{ maxHeight:700 }}>
|
|
251
|
+
{active_competition ?
|
|
252
|
+
<View transparent style={{ backgroundColor:Colors.text.action, flexDirection:'row', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
|
|
253
|
+
<Image
|
|
254
|
+
source={{ uri: active_competition.image?.url }}
|
|
255
|
+
style={{ height:40, width:40 }}
|
|
256
|
+
resizeMode='cover'
|
|
257
|
+
/>
|
|
258
|
+
<View transparent style={{ flex:1, marginLeft:10 }}>
|
|
259
|
+
<Text theme='h2' color={Colors.text.white}>{active_competition.competition_name}</Text>
|
|
260
|
+
<Text style={{ marginTop:3 }} theme='description' color={Colors.text.white}>{active_competition.competition_name}</Text>
|
|
261
|
+
</View>
|
|
262
|
+
|
|
263
|
+
<Button
|
|
264
|
+
type='text'
|
|
265
|
+
float
|
|
266
|
+
style={{ padding:10, flexDirection:'row', alignItems:'center' }}
|
|
267
|
+
onPress={() => {
|
|
268
|
+
setShowCompetitionActions(false)
|
|
269
|
+
setTimeout(() => {
|
|
270
|
+
onShareCompetition(active_competition)
|
|
271
|
+
}, 500);
|
|
272
|
+
}}
|
|
273
|
+
>
|
|
274
|
+
<Icons.ShareIcon size={14} color={Colors.text.white} />
|
|
275
|
+
</Button>
|
|
276
|
+
</View>
|
|
277
|
+
:<></>}
|
|
278
|
+
<View style={{ flexGrow:1 }}>
|
|
279
|
+
{active_bracket_id ?
|
|
280
|
+
<BracketCompetitionActions
|
|
281
|
+
view_mode={view_mode}
|
|
282
|
+
onRequestAuthenticate={() => onRequestAuthenticate(active_competition?.auth_strategy_id)}
|
|
283
|
+
player={player}
|
|
284
|
+
hide_image
|
|
285
|
+
onManage={onManageCompetition}
|
|
286
|
+
onCreateNewCompetition={(bracket_id) => {
|
|
287
|
+
if(!onCreateNewCompetition){ return }
|
|
288
|
+
setShowCompetitionActions(false);
|
|
289
|
+
setTimeout(() => {
|
|
290
|
+
onCreateNewCompetition(bracket_id);
|
|
291
|
+
}, 500);
|
|
292
|
+
}}
|
|
293
|
+
insets={insets}
|
|
294
|
+
onFoundCompetition={(bc) => {
|
|
295
|
+
setNavData({
|
|
296
|
+
...nav_data,
|
|
297
|
+
active_competition:bc,
|
|
298
|
+
active_bracket_id: bc.bracket_id
|
|
299
|
+
})
|
|
300
|
+
}}
|
|
301
|
+
onSelectCompetition={async(bc) => {
|
|
302
|
+
setNavData({
|
|
303
|
+
...nav_data,
|
|
304
|
+
active_bracket_id: bc.bracket_id,
|
|
305
|
+
active_competition: bc
|
|
306
|
+
})
|
|
307
|
+
}}
|
|
308
|
+
onFocusPosition={onFocusPosition}
|
|
309
|
+
player_brackets={player_brackets}
|
|
310
|
+
onEnterCompetition={(new_bc, new_cpb, new_pb) => {
|
|
311
|
+
if(new_pb){
|
|
312
|
+
setNavData({
|
|
313
|
+
...nav_data,
|
|
314
|
+
active_player_bracket_id: new_pb?.player_bracket_id,
|
|
315
|
+
active_competition:new_bc
|
|
316
|
+
})
|
|
317
|
+
}
|
|
318
|
+
setPlayData({
|
|
319
|
+
...play_data,
|
|
320
|
+
player_brackets: new_pb ? player_brackets.concat(new_pb) : player_brackets,
|
|
321
|
+
competition_player_brackets: competition_player_brackets.concat(new_cpb)
|
|
322
|
+
|
|
323
|
+
})
|
|
324
|
+
}}
|
|
325
|
+
competition_id={active_competition?.bracket_competition_id}
|
|
326
|
+
onLeaveCompetition={(bc, rem_cpb) => {
|
|
327
|
+
setNavData({
|
|
328
|
+
...nav_data,
|
|
329
|
+
active_competition: bc
|
|
330
|
+
});
|
|
331
|
+
setPlayData({
|
|
332
|
+
...play_data,
|
|
333
|
+
competition_player_brackets: competition_player_brackets.filter(cpb => cpb.competition_player_bracket_id != rem_cpb.competition_player_bracket_id)
|
|
334
|
+
})
|
|
335
|
+
}}
|
|
336
|
+
competition_result_types={competition_result_types}
|
|
337
|
+
bracket_id={active_bracket_id}
|
|
338
|
+
player_balance={local_balance}
|
|
339
|
+
player_bracket={player_brackets.find(pb => pb.player_bracket_id == active_player_bracket_id)}
|
|
340
|
+
competition_player_brackets={competition_player_brackets}
|
|
341
|
+
/>
|
|
342
|
+
:<></>}
|
|
343
|
+
</View>
|
|
344
|
+
<View type='footer' style={{ flexDirection:'row', padding:10 }}>
|
|
345
|
+
<Button
|
|
346
|
+
style={{ flex:1 }}
|
|
347
|
+
title='CLOSE'
|
|
348
|
+
type='close'
|
|
349
|
+
onPress={() => setShowCompetitionActions(false)}
|
|
350
|
+
/>
|
|
351
|
+
</View>
|
|
352
|
+
</View>
|
|
353
|
+
</View>
|
|
354
|
+
</Modal>
|
|
325
355
|
{mode == 'small' && active_bracket_id ?
|
|
326
356
|
<Button float style={{ padding:0, backgroundColor:Colors.text.action, borderBottomRightRadius:0, borderBottomLeftRadius:0 }} onPress={() => setShowCompetitionActions(true)}>
|
|
327
357
|
{active_competition ?
|
|
@@ -345,7 +375,7 @@ const BracketRoom = ({ player_id, width, view_mode, bracket_id, insets, onCreate
|
|
|
345
375
|
</View>
|
|
346
376
|
:
|
|
347
377
|
<View transparent style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
|
|
348
|
-
<Icons.
|
|
378
|
+
<Icons.TrophyIcon size={20} color={Colors.text.white} />
|
|
349
379
|
<View transparent style={{ flex:1, marginLeft:10 }}>
|
|
350
380
|
<Text theme='h2' color={Colors.text.white}>Available Competitions</Text>
|
|
351
381
|
<Text style={{ marginTop:3 }} theme='description' color={Colors.text.white}>Press here to see eligible competitions to join!</Text>
|
|
@@ -362,236 +392,75 @@ const BracketRoom = ({ player_id, width, view_mode, bracket_id, insets, onCreate
|
|
|
362
392
|
</Button>
|
|
363
393
|
:<></>}
|
|
364
394
|
</View>
|
|
365
|
-
|
|
366
395
|
{mode != 'small' && active_bracket_id ?
|
|
367
396
|
<View type='header' style={{ width:300 }}>
|
|
368
397
|
<BracketCompetitionActions
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
competition_player_brackets: competition_player_brackets.filter(cpb => cpb.competition_player_bracket_id != new_cpb.competition_player_bracket_id).concat(new_cpb)
|
|
411
|
-
})}
|
|
412
|
-
competition_result_types={competition_result_types}
|
|
413
|
-
bracket_id={active_bracket_id}
|
|
414
|
-
player_balance={local_balance}
|
|
415
|
-
player_bracket={active_player_bracket}
|
|
416
|
-
competition_player_brackets={competition_player_brackets}
|
|
417
|
-
/>
|
|
418
|
-
</View>
|
|
419
|
-
:<></>}
|
|
420
|
-
</View>
|
|
421
|
-
<Modal
|
|
422
|
-
visible={show_competition_actions}
|
|
423
|
-
transparent
|
|
424
|
-
style={{ flex:1 }}
|
|
425
|
-
animationType={'slide'}
|
|
426
|
-
>
|
|
427
|
-
<View type='blur' style={{ flex:1, justifyContent:'flex-end', padding:10, paddingBottom:(insets?.bottom ?? 0)+10 }}>
|
|
428
|
-
<View float style={{ maxHeight:700 }}>
|
|
429
|
-
{active_competition ?
|
|
430
|
-
<View transparent style={{ backgroundColor:Colors.text.action, flexDirection:'row', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
|
|
431
|
-
<Image
|
|
432
|
-
source={{ uri: active_competition.image?.url }}
|
|
433
|
-
style={{ height:40, width:40 }}
|
|
434
|
-
resizeMode='cover'
|
|
435
|
-
/>
|
|
436
|
-
<View transparent style={{ flex:1, marginLeft:10 }}>
|
|
437
|
-
<Text theme='h2' color={Colors.text.white}>{active_competition.competition_name}</Text>
|
|
438
|
-
<Text style={{ marginTop:3 }} theme='description' color={Colors.text.white}>{active_competition.competition_name}</Text>
|
|
439
|
-
</View>
|
|
440
|
-
|
|
441
|
-
<Button
|
|
442
|
-
type='text'
|
|
443
|
-
float
|
|
444
|
-
style={{ padding:10, flexDirection:'row', alignItems:'center' }}
|
|
445
|
-
onPress={() => {
|
|
446
|
-
setShowCompetitionActions(false)
|
|
447
|
-
setTimeout(() => {
|
|
448
|
-
onShareCompetition(active_competition)
|
|
449
|
-
}, 500);
|
|
450
|
-
}}
|
|
451
|
-
>
|
|
452
|
-
<Icons.ShareIcon size={14} color={Colors.text.white} />
|
|
453
|
-
</Button>
|
|
454
|
-
</View>
|
|
455
|
-
:<></>}
|
|
456
|
-
<View style={{ flex:1 }}>
|
|
457
|
-
{active_bracket_id ?
|
|
458
|
-
<BracketCompetitionActions
|
|
459
|
-
view_mode={view_mode}
|
|
460
|
-
onRequestAuthenticate={() => onRequestAuthenticate(active_competition?.auth_strategy_id)}
|
|
461
|
-
player={player}
|
|
462
|
-
hide_image
|
|
463
|
-
onManage={onManageCompetition}
|
|
464
|
-
onCreateNewCompetition={(bracket_id) => {
|
|
465
|
-
if(!onCreateNewCompetition){ return }
|
|
466
|
-
setShowCompetitionActions(false);
|
|
467
|
-
setTimeout(() => {
|
|
468
|
-
onCreateNewCompetition(bracket_id);
|
|
469
|
-
}, 500);
|
|
470
|
-
}}
|
|
471
|
-
insets={insets}
|
|
472
|
-
onFoundCompetition={(bc) => {
|
|
473
|
-
setRoomData({
|
|
474
|
-
...room_data,
|
|
475
|
-
public_competitions: public_competitions.filter(pc => pc.bracket_competition_id != bc.bracket_competition_id).concat(bc)
|
|
476
|
-
});
|
|
477
|
-
setNavData({
|
|
478
|
-
...nav_data,
|
|
479
|
-
active_competition_id: bc.bracket_competition_id,
|
|
480
|
-
active_bracket_id: bc.bracket_id,
|
|
481
|
-
active_player_bracket_id: active_player_bracket?.bracket_id == bc.bracket_id ? active_player_bracket_id : player_brackets.find(pb => pb.status != 'deleted' && pb.bracket_id == bc.bracket_id)?.player_bracket_id
|
|
482
|
-
})
|
|
483
|
-
}}
|
|
484
|
-
onSelectCompetition={(bc) => {
|
|
485
|
-
setNavData({
|
|
486
|
-
...nav_data,
|
|
487
|
-
active_competition_id: bc.bracket_competition_id
|
|
488
|
-
})
|
|
489
|
-
}}
|
|
490
|
-
onFocusPosition={onFocusPosition}
|
|
491
|
-
player_brackets={player_brackets}
|
|
492
|
-
onEnterCompetition={(new_bc, new_cpb, new_pb) => {
|
|
493
|
-
setMyData({
|
|
494
|
-
...my_data,
|
|
495
|
-
bracket_competitions: bracket_competitions.filter(bc => bc.bracket_competition_id != new_bc.bracket_competition_id).concat(new_bc),
|
|
496
|
-
competition_player_brackets: competition_player_brackets.filter(cpb => cpb.competition_player_bracket_id != new_cpb.competition_player_bracket_id).concat(new_cpb),
|
|
497
|
-
player_brackets: !new_pb ? player_brackets : player_brackets.filter(pb => pb.player_bracket_id != new_pb.player_bracket_id).concat(new_pb)
|
|
498
|
-
});
|
|
499
|
-
if(new_pb){
|
|
500
|
-
setNavData({ ...nav_data, active_player_bracket_id: new_pb.player_bracket_id })
|
|
501
|
-
}
|
|
502
|
-
}}
|
|
503
|
-
competition_id={active_competition_id}
|
|
504
|
-
onLeaveCompetition={(new_bc, new_cpb) => setMyData({
|
|
505
|
-
...my_data,
|
|
506
|
-
bracket_competitions: bracket_competitions.filter(bc => bc.bracket_competition_id != new_bc.bracket_competition_id).concat(new_bc),
|
|
507
|
-
competition_player_brackets: competition_player_brackets.filter(cpb => cpb.competition_player_bracket_id != new_cpb.competition_player_bracket_id).concat(new_cpb)
|
|
508
|
-
})}
|
|
509
|
-
competition_result_types={competition_result_types}
|
|
510
|
-
bracket_id={active_bracket_id}
|
|
511
|
-
player_balance={local_balance}
|
|
512
|
-
player_bracket={active_player_bracket}
|
|
513
|
-
competition_player_brackets={competition_player_brackets}
|
|
514
|
-
/>
|
|
515
|
-
:<></>}
|
|
516
|
-
</View>
|
|
517
|
-
<View type='footer' style={{ flexDirection:'row', padding:10 }}>
|
|
518
|
-
<Button
|
|
519
|
-
style={{ flex:1 }}
|
|
520
|
-
title='CLOSE'
|
|
521
|
-
type='close'
|
|
522
|
-
onPress={() => setShowCompetitionActions(false)}
|
|
523
|
-
/>
|
|
524
|
-
</View>
|
|
525
|
-
</View>
|
|
526
|
-
</View>
|
|
527
|
-
</Modal>
|
|
528
|
-
<Modal
|
|
529
|
-
visible={show_pb_selector}
|
|
530
|
-
style={{ flex:1 }}
|
|
531
|
-
transparent
|
|
532
|
-
animationType={view_mode == 'desktop' ? 'fade' : 'slide'}
|
|
533
|
-
>
|
|
534
|
-
<View type='blur' style={view_mode == 'desktop' ? { flex:1, justifyContent:'center', alignItems:'center' } : { flex:1, justifyContent:'flex-end', paddingBottom:(insets?.bottom ?? 0) }}>
|
|
535
|
-
<View float style={view_mode == 'desktop' ? { width:500 }:{ margin:10 }}>
|
|
536
|
-
<PlayerBracketSelector
|
|
537
|
-
player_brackets={player_brackets.filter(pb => pb.bracket_id == active_bracket_id && pb.status != 'deleted')}
|
|
538
|
-
brackets={brackets}
|
|
539
|
-
leagues={leagues}
|
|
540
|
-
bracket_id={active_bracket_id}
|
|
541
|
-
onCreateNew={(newpb) => {
|
|
542
|
-
setShowPBSelector(false);
|
|
543
|
-
setNavData({
|
|
544
|
-
...nav_data,
|
|
545
|
-
active_player_bracket_id: newpb.player_bracket_id
|
|
546
|
-
});
|
|
547
|
-
setMyData({
|
|
548
|
-
...my_data,
|
|
549
|
-
player_brackets: player_brackets.filter(pb => pb.player_bracket_id != newpb.player_bracket_id).concat(newpb)
|
|
550
|
-
})
|
|
551
|
-
}}
|
|
552
|
-
teams={teams}
|
|
553
|
-
athletes={athletes}
|
|
554
|
-
bracket_competitions={bracket_competitions}
|
|
555
|
-
competition_player_brackets={competition_player_brackets}
|
|
556
|
-
onClose={() => setShowPBSelector(false)}
|
|
557
|
-
onSelect={(pb) => {
|
|
558
|
-
setShowPBSelector(false);
|
|
559
|
-
setNavData({ ...nav_data, active_player_bracket_id: pb.player_bracket_id })
|
|
560
|
-
}}
|
|
561
|
-
/>
|
|
562
|
-
</View>
|
|
563
|
-
</View>
|
|
564
|
-
</Modal>
|
|
565
|
-
<Modal
|
|
566
|
-
visible={editing_player_bracket ? true : false}
|
|
567
|
-
style={{ flex:1 }}
|
|
568
|
-
transparent
|
|
569
|
-
animationType={view_mode == 'desktop' ? 'fade' : 'slide'}
|
|
570
|
-
>
|
|
571
|
-
<View type='blur' style={view_mode == 'desktop' ? { flex:1, justifyContent:'center', alignItems:'center' } : { flex:1, justifyContent:'flex-end', paddingBottom:(insets?.bottom ?? 0)}}>
|
|
572
|
-
<View float style={view_mode == 'desktop' ? { width:500 }:{ margin:10 }}>
|
|
573
|
-
<EditPlayerBracket
|
|
574
|
-
player_bracket={editing_player_bracket}
|
|
575
|
-
onClose={() => setEditingPlayerBracket(undefined)}
|
|
576
|
-
onFocusPosition={onFocusPosition}
|
|
577
|
-
onUpdatePlayerBracket={(new_pb) => {
|
|
578
|
-
setNavData({ ...nav_data, active_player_bracket_id: undefined });
|
|
398
|
+
view_mode={view_mode}
|
|
399
|
+
onRequestAuthenticate={() => onRequestAuthenticate(active_competition?.auth_strategy_id)}
|
|
400
|
+
player={player}
|
|
401
|
+
hide_image
|
|
402
|
+
onManage={onManageCompetition}
|
|
403
|
+
onCreateNewCompetition={(bracket_id) => {
|
|
404
|
+
if(!onCreateNewCompetition){ return }
|
|
405
|
+
setShowCompetitionActions(false);
|
|
406
|
+
setTimeout(() => {
|
|
407
|
+
onCreateNewCompetition(bracket_id);
|
|
408
|
+
}, 500);
|
|
409
|
+
}}
|
|
410
|
+
insets={insets}
|
|
411
|
+
onFoundCompetition={(bc) => {
|
|
412
|
+
setNavData({
|
|
413
|
+
...nav_data,
|
|
414
|
+
active_competition:bc,
|
|
415
|
+
active_bracket_id: bc.bracket_id
|
|
416
|
+
})
|
|
417
|
+
}}
|
|
418
|
+
onSelectCompetition={async(bc) => {
|
|
419
|
+
setNavData({
|
|
420
|
+
...nav_data,
|
|
421
|
+
active_bracket_id: bc.bracket_id,
|
|
422
|
+
active_competition: bc
|
|
423
|
+
})
|
|
424
|
+
}}
|
|
425
|
+
onFocusPosition={onFocusPosition}
|
|
426
|
+
player_brackets={player_brackets}
|
|
427
|
+
onEnterCompetition={(new_bc, new_cpb, new_pb) => {
|
|
428
|
+
if(new_pb){
|
|
429
|
+
setNavData({
|
|
430
|
+
...nav_data,
|
|
431
|
+
active_player_bracket_id: new_pb?.player_bracket_id,
|
|
432
|
+
active_competition:new_bc
|
|
433
|
+
})
|
|
434
|
+
}
|
|
435
|
+
setPlayData({
|
|
436
|
+
...play_data,
|
|
437
|
+
player_brackets: new_pb ? player_brackets.concat(new_pb) : player_brackets,
|
|
438
|
+
competition_player_brackets: competition_player_brackets.concat(new_cpb)
|
|
579
439
|
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
440
|
+
})
|
|
441
|
+
}}
|
|
442
|
+
competition_id={active_competition?.bracket_competition_id}
|
|
443
|
+
onLeaveCompetition={(bc, rem_cpb) => {
|
|
444
|
+
setNavData({
|
|
445
|
+
...nav_data,
|
|
446
|
+
active_competition: bc
|
|
447
|
+
});
|
|
448
|
+
setPlayData({
|
|
449
|
+
...play_data,
|
|
450
|
+
competition_player_brackets: competition_player_brackets.filter(cpb => cpb.competition_player_bracket_id != rem_cpb.competition_player_bracket_id)
|
|
451
|
+
})
|
|
452
|
+
}}
|
|
453
|
+
competition_result_types={competition_result_types}
|
|
454
|
+
bracket_id={active_bracket_id}
|
|
455
|
+
player_balance={local_balance}
|
|
456
|
+
player_bracket={player_brackets.find(pb => pb.player_bracket_id == active_player_bracket_id)}
|
|
457
|
+
competition_player_brackets={competition_player_brackets}
|
|
458
|
+
/>
|
|
592
459
|
</View>
|
|
593
|
-
|
|
594
|
-
|
|
460
|
+
:<></>}
|
|
461
|
+
|
|
462
|
+
</View>
|
|
463
|
+
|
|
595
464
|
{loading ?
|
|
596
465
|
<View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, justifyContent:'center', alignItems:'center' }}>
|
|
597
466
|
<View float style={{ width:300, height:300 }}>
|
|
@@ -605,8 +474,9 @@ const BracketRoom = ({ player_id, width, view_mode, bracket_id, insets, onCreate
|
|
|
605
474
|
</View>
|
|
606
475
|
</View>
|
|
607
476
|
:<></>}
|
|
477
|
+
|
|
608
478
|
</View>
|
|
609
479
|
)
|
|
610
480
|
}
|
|
611
481
|
|
|
612
|
-
export default BracketRoom
|
|
482
|
+
export default BracketRoom
|