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