be-components 4.5.5 → 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 +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 +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 +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 +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 +3 -3
- 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
|
@@ -1,38 +1,27 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { Button, Text, View } from '../../Components/Themed';
|
|
3
|
-
import type { AthleteProps, BracketCompetitionProps, BracketProps, CompetitionPlayerBracketProps,
|
|
3
|
+
import type { AthleteProps, BracketCompetitionProps, BracketProps, CompetitionPlayerBracketProps, LeagueProps, MyPlayerProps, PlayerBracketProps, TeamProps } from '../../types';
|
|
4
4
|
import { FlatList, Image } from 'react-native';
|
|
5
5
|
import PlayerBracketCard from './PlayerBracketCard';
|
|
6
6
|
import SearchBox from '../../Components/SearchBox';
|
|
7
7
|
import { Icons, Toggle } from '../../Components';
|
|
8
8
|
import { useColors } from '../../constants/useColors';
|
|
9
9
|
import moment from 'moment-mini';
|
|
10
|
-
import { BracketComeptitionApi } from '../api';
|
|
10
|
+
import { BracketApi, BracketComeptitionApi } from '../api';
|
|
11
|
+
import EditPlayerBracket from './EditPlayerBracket';
|
|
12
|
+
import EnteredCompetitionsModal from './EnteredCompetitionsModal';
|
|
11
13
|
|
|
12
14
|
type RoomHomeProps = {
|
|
13
15
|
player?:MyPlayerProps,
|
|
14
|
-
visible
|
|
15
|
-
player_brackets:PlayerBracketProps[],
|
|
16
|
-
bracket_competitions:BracketCompetitionProps[],
|
|
17
|
-
competition_player_brackets:CompetitionPlayerBracketProps[],
|
|
18
|
-
brackets:BracketProps[],
|
|
16
|
+
visible:boolean,
|
|
19
17
|
onManageCompetition:(bracket_competition_id:string) => void,
|
|
20
|
-
onMoreAdmin:(offset:number) => void,
|
|
21
|
-
admin_offset:number,
|
|
22
|
-
admin_competitions:BracketCompetitionProps[],
|
|
23
18
|
onFocusPosition?:(pos:{ x:number, y:number, height:number, width:number }) => void,
|
|
24
19
|
width:number,
|
|
25
|
-
|
|
26
|
-
active_brackets:BracketProps[],
|
|
20
|
+
insets?: { top:number, bottom:number, right:number, left:number },
|
|
27
21
|
view_mode:'mobile'|'desktop'
|
|
28
|
-
competition_result_types:CompetitionResultTypeProps[],
|
|
29
22
|
leagues:LeagueProps[],
|
|
30
23
|
onCreateNewCompetition?:(bracket_id?:string) => void,
|
|
31
|
-
|
|
32
|
-
onUpdatePlayerBracket:(player_bracket:PlayerBracketProps) => void,
|
|
33
|
-
onEditPlayerBracket:(player_bracket:PlayerBracketProps) => void,
|
|
34
|
-
onView: (bracket_id:string, player_bracket_id?:string, bracket_competition_id?:string) => void,
|
|
35
|
-
teams:TeamProps[]
|
|
24
|
+
onView: (bracket_id:string, player_bracket_id?:string, bracket_competition?:BracketCompetitionProps) => void,
|
|
36
25
|
}
|
|
37
26
|
|
|
38
27
|
const MIN_CARD_WIDTH = 330
|
|
@@ -47,59 +36,234 @@ const calcCardWidth = (width:number, margin:number) => {
|
|
|
47
36
|
|
|
48
37
|
const sections = [ 'toggle', 'active_brackets', 'past_brackets', 'tournaments', 'admin_competitions', 'competitions']
|
|
49
38
|
|
|
50
|
-
const RoomHome = ({ visible, width, player, leagues,
|
|
39
|
+
const RoomHome = ({ view_mode, visible, width, player, leagues, insets, onManageCompetition, onCreateNewCompetition, onView, onFocusPosition}:RoomHomeProps) => {
|
|
51
40
|
const Colors = useColors();
|
|
41
|
+
const [ active_toggle, setActiveToggle ] = useState('my_brackets');
|
|
42
|
+
const [ show_comps, setShowComps ] = useState<{
|
|
43
|
+
player_bracket?:PlayerBracketProps,
|
|
44
|
+
champion_team?:TeamProps,
|
|
45
|
+
champion_athlete?:AthleteProps,
|
|
46
|
+
entered_competitions:BracketCompetitionProps[],
|
|
47
|
+
entered_brackets:CompetitionPlayerBracketProps[]
|
|
48
|
+
}>({
|
|
49
|
+
entered_brackets: [],
|
|
50
|
+
entered_competitions:[]
|
|
51
|
+
})
|
|
52
|
+
const [ editing_player_bracket, setEditingPlayerBracket ] = useState<PlayerBracketProps|undefined>(undefined);
|
|
53
|
+
const [ admin_data, setAdminData ] = useState<{
|
|
54
|
+
admin_loading:boolean,
|
|
55
|
+
admin_competitions:BracketCompetitionProps[],
|
|
56
|
+
admin_brackets:BracketProps[],
|
|
57
|
+
admin_offset:number
|
|
58
|
+
}>({
|
|
59
|
+
admin_loading: false,
|
|
60
|
+
admin_brackets: [],
|
|
61
|
+
admin_competitions:[],
|
|
62
|
+
admin_offset:0
|
|
63
|
+
});
|
|
64
|
+
const { admin_competitions, admin_offset } = admin_data;
|
|
65
|
+
const [ competitions_data, setCompetitionsData ] = useState<{
|
|
66
|
+
competitions_loaded:boolean,
|
|
67
|
+
competitions_loading: boolean,
|
|
68
|
+
public_competitions:BracketCompetitionProps[],
|
|
69
|
+
competition_brackets:BracketProps[]
|
|
70
|
+
}>({
|
|
71
|
+
competitions_loading: false,
|
|
72
|
+
competitions_loaded: false,
|
|
73
|
+
public_competitions:[],
|
|
74
|
+
competition_brackets:[]
|
|
75
|
+
});
|
|
76
|
+
const { public_competitions, competition_brackets } = competitions_data
|
|
77
|
+
const [ comp_search, setCompSearch ] = useState({
|
|
78
|
+
visible: false,
|
|
79
|
+
value: ''
|
|
80
|
+
});
|
|
81
|
+
let visisble_comps = [ ...public_competitions ]
|
|
82
|
+
if(comp_search.visible){
|
|
83
|
+
visisble_comps = visisble_comps.filter(c => `${c.competition_name} ${c.competition_description}`.toLowerCase().includes(comp_search.value.toLowerCase()))
|
|
84
|
+
}
|
|
85
|
+
const unique_competition_leagues = [ ...new Set(competition_brackets.filter(b => visisble_comps.map(c => c.bracket_id.toString()).includes(b.bracket_id.toString())).map(b => b.league_id)) ]
|
|
86
|
+
|
|
87
|
+
const [ tournaments_data, setTournamentsData ] = useState<{
|
|
88
|
+
tournaments_loading:boolean,
|
|
89
|
+
tournament_brackets:BracketProps[]
|
|
90
|
+
}>({
|
|
91
|
+
tournaments_loading: false,
|
|
92
|
+
tournament_brackets: []
|
|
93
|
+
});
|
|
94
|
+
const { tournament_brackets } = tournaments_data;
|
|
95
|
+
let visisble_tourney_brackets = [ ...tournament_brackets ]
|
|
96
|
+
|
|
97
|
+
const [ selected_league, setSelectedLeague ] = useState<string | undefined>(undefined);
|
|
98
|
+
if(selected_league){
|
|
99
|
+
visisble_tourney_brackets = visisble_tourney_brackets.filter(b => b.league_id == selected_league)
|
|
100
|
+
}
|
|
101
|
+
const [ tourney_search, setTourneySearch ] = useState({
|
|
102
|
+
visible:false, value:''
|
|
103
|
+
});
|
|
104
|
+
if(tourney_search.visible){
|
|
105
|
+
visisble_tourney_brackets = visisble_tourney_brackets.filter(b => `${b.bracket_name}`.toLowerCase().includes(tourney_search.value.toLowerCase()));
|
|
106
|
+
}
|
|
107
|
+
const unique_tournament_leagues = [ ...new Set(visisble_tourney_brackets.map(b => b.league_id)) ];
|
|
108
|
+
|
|
109
|
+
const [ my_brackets_data, setMyBrackets ] = useState<{
|
|
110
|
+
my_brackets_loading: boolean,
|
|
111
|
+
my_brackets_loaded:boolean,
|
|
112
|
+
competition_player_brackets:CompetitionPlayerBracketProps[],
|
|
113
|
+
my_competitions:BracketCompetitionProps[],
|
|
114
|
+
my_brackets:BracketProps[],
|
|
115
|
+
player_brackets:PlayerBracketProps[],
|
|
116
|
+
champion_teams:TeamProps[],
|
|
117
|
+
champion_athletes:AthleteProps[],
|
|
118
|
+
}>({
|
|
119
|
+
my_brackets_loading: false,
|
|
120
|
+
my_brackets_loaded: false,
|
|
121
|
+
competition_player_brackets: [],
|
|
122
|
+
my_brackets:[],
|
|
123
|
+
champion_athletes:[],
|
|
124
|
+
champion_teams: [],
|
|
125
|
+
my_competitions:[],
|
|
126
|
+
player_brackets:[]
|
|
127
|
+
});
|
|
128
|
+
const { my_brackets_loaded, my_brackets_loading, my_brackets, my_competitions, competition_player_brackets, player_brackets, champion_athletes, champion_teams } = my_brackets_data;
|
|
129
|
+
const active_brackets = player_brackets.filter(pb => pb.status == 'active');
|
|
130
|
+
const closed_brackets = player_brackets.filter(pb => pb.status == 'closed');
|
|
131
|
+
|
|
132
|
+
const [ past_search, setPastSearch ] = useState({
|
|
133
|
+
visible: false,
|
|
134
|
+
value:''
|
|
135
|
+
});
|
|
136
|
+
let closed_bracket_ids = [ ...new Set(closed_brackets.map(b => b.bracket_id)) ].slice(0,10)
|
|
137
|
+
if(past_search.visible){
|
|
138
|
+
let filtered_brackets = [ ...closed_brackets].filter(b => `${b.bracket_name}`.toLowerCase().includes(past_search.value.toLowerCase()))
|
|
139
|
+
closed_bracket_ids = [ ...new Set(filtered_brackets.map(b => b.bracket_id)) ].slice(0,10)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const [ active_search, setActiveSearch ] = useState({
|
|
143
|
+
visible:false,
|
|
144
|
+
value:''
|
|
145
|
+
});
|
|
146
|
+
let active_bracket_ids = [ ...new Set(active_brackets.map(b => b.bracket_id)) ]
|
|
147
|
+
if(active_search.visible){
|
|
148
|
+
let filtered_a_brackets = [ ...active_brackets].filter(b => `${b.bracket_name}`.toLowerCase().includes(active_search.value.toLowerCase()))
|
|
149
|
+
active_bracket_ids = [ ...new Set(filtered_a_brackets.map(b => b.bracket_id)) ].slice(0,10)
|
|
150
|
+
}
|
|
151
|
+
|
|
52
152
|
const [ action_loading, setActionLoading ] = useState<string|undefined>(undefined)//This will be a bracket id
|
|
53
|
-
const [ active_toggle, setActiveToggle ] = useState('competitions');
|
|
54
|
-
const [ past_search, setPastSearch ] = useState('');
|
|
55
|
-
const [ show_active_search, setShowActiveSearch ] = useState(false);
|
|
56
153
|
const [ expanded_brackets, setExpandedBrackets ] = useState<string[]>([]);
|
|
57
154
|
const [ expanded_leagues, setExpandedLeagues ] = useState<string[]>([]);
|
|
58
155
|
const [ expanded_c_leagues, setExpandedCLeagues ] = useState<string[]>([])
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const filterPlayerBrackets = (bs:BracketProps[], pbs:PlayerBracketProps[], status:'active'|'closed', search:string) => {
|
|
74
|
-
let init_pbs = pbs.filter(pb => pb.status == status);
|
|
75
|
-
if(!search || search == ''){ return init_pbs }
|
|
76
|
-
let brackets = bs.filter(b => `${b.bracket_name.toLowerCase()}`.includes(search.toLowerCase()));
|
|
77
|
-
return init_pbs.filter(pb => brackets.map(b => b.bracket_id.toString()).includes(pb.bracket_id.toString()));
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
if(!visible){ return }
|
|
160
|
+
getData(active_toggle)
|
|
161
|
+
},[visible, active_toggle]);
|
|
162
|
+
|
|
163
|
+
const getData = async(toggle:string) => {
|
|
164
|
+
switch(toggle){
|
|
165
|
+
case 'my_brackets': getMyBrackets(); return
|
|
166
|
+
case 'tournaments': getTournaments(); return
|
|
167
|
+
case 'competitions': getCompetitions(); return
|
|
168
|
+
default: return
|
|
169
|
+
}
|
|
78
170
|
}
|
|
79
171
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
172
|
+
const getCompetitions = async() => {
|
|
173
|
+
setCompetitionsData({ ...competitions_data, competitions_loading: true });
|
|
174
|
+
const pub_comps = await BracketComeptitionApi.getActivePublicBrackets();
|
|
175
|
+
const unique_brackets = [ ...new Set(pub_comps.map(c => c.bracket_id)) ]
|
|
176
|
+
const comp_brackets = await BracketApi.getBracketsByIds(unique_brackets);
|
|
177
|
+
setCompetitionsData({
|
|
178
|
+
...competitions_data,
|
|
179
|
+
public_competitions: pub_comps,
|
|
180
|
+
competitions_loaded: true,
|
|
181
|
+
competition_brackets: comp_brackets,
|
|
182
|
+
competitions_loading: false
|
|
183
|
+
})
|
|
184
|
+
getAdminComps(0);
|
|
185
|
+
}
|
|
83
186
|
|
|
84
|
-
const
|
|
187
|
+
const getAdminComps = async(offset:number) => {
|
|
188
|
+
const admin_comps = await BracketComeptitionApi.getMyAdminCompetitions(offset);
|
|
189
|
+
setAdminData({
|
|
190
|
+
admin_loading: false,
|
|
191
|
+
admin_brackets:[],
|
|
192
|
+
admin_competitions:admin_comps,
|
|
193
|
+
admin_offset:offset
|
|
194
|
+
})
|
|
195
|
+
}
|
|
85
196
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
197
|
+
const getTournaments = async() => {
|
|
198
|
+
setTournamentsData({ ...tournaments_data, tournaments_loading: true });
|
|
199
|
+
const tourney_brackets = await BracketApi.getActiveBrackets();
|
|
200
|
+
setTournamentsData({
|
|
201
|
+
...tournaments_data,
|
|
202
|
+
tournaments_loading: false,
|
|
203
|
+
tournament_brackets: tourney_brackets
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const getMyBrackets = async() => {
|
|
208
|
+
setMyBrackets({ ...my_brackets_data, my_brackets_loading: true });
|
|
209
|
+
const my_response = await BracketComeptitionApi.getMyPlayerBrackets();
|
|
210
|
+
const bracket_ids = [ ...new Set(my_response.player_brackets.map(pb => pb.bracket_id))]
|
|
211
|
+
let brackets = await BracketApi.getBracketsByIds(bracket_ids);
|
|
212
|
+
let champ_team_ids = my_response.player_brackets.filter(pb => pb.champion_id_type == 'team').map(b => b.champion_id ?? '')
|
|
213
|
+
const champ_teams = await BracketApi.getTeamsByIds(champ_team_ids);
|
|
214
|
+
let champ_athlete_ids = my_response.player_brackets.filter(pb => pb.champion_id_type == 'athlete').map(b => b.champion_id ?? '')
|
|
215
|
+
const champ_athletes = await BracketApi.getAthletesByIds(champ_athlete_ids);
|
|
216
|
+
//Filter to active and closed
|
|
217
|
+
setMyBrackets({
|
|
218
|
+
...my_brackets_data,
|
|
219
|
+
my_brackets_loading:false,
|
|
220
|
+
my_brackets_loaded: true,
|
|
221
|
+
champion_athletes: champ_athletes,
|
|
222
|
+
champion_teams: champ_teams,
|
|
223
|
+
my_brackets: brackets,
|
|
224
|
+
player_brackets: my_response.player_brackets,
|
|
225
|
+
competition_player_brackets: my_response.competition_player_brackets,
|
|
226
|
+
my_competitions: my_response.bracket_competitions
|
|
227
|
+
})
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const handleView = async(bracket_id:string, player_bracket_id?:string, bracket_competition?:BracketCompetitionProps) => {
|
|
231
|
+
if(bracket_id && player_bracket_id && bracket_competition){ return onView(bracket_id, player_bracket_id, bracket_competition) }
|
|
232
|
+
//Ok! Now - what if we do not have a player_bracket
|
|
233
|
+
let init_pb_id = player_bracket_id
|
|
234
|
+
if(!init_pb_id){
|
|
235
|
+
//Lets try and find one!
|
|
236
|
+
init_pb_id = player_brackets.find(pb => pb.bracket_id == bracket_id && pb.status != 'deleted')?.player_bracket_id
|
|
237
|
+
if(!init_pb_id && !my_brackets_loaded){
|
|
238
|
+
//Lets try and get the plyaers brackets and see!
|
|
239
|
+
const my_pbs = await BracketComeptitionApi.getMyPlayerBrackets();
|
|
240
|
+
init_pb_id = my_pbs.player_brackets.find(pb => pb.bracket_id == bracket_id && pb.status != 'deleted')?.player_bracket_id
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
//Ok! Now - what if we do not have a bracket competition!
|
|
245
|
+
let init_bc = bracket_competition
|
|
246
|
+
if(!init_bc){
|
|
247
|
+
//First check if my competitions has any!
|
|
248
|
+
init_bc = my_competitions.find(c => c.bracket_id == bracket_id)
|
|
249
|
+
if(!init_bc){ init_bc = public_competitions.find(pc => pc.bracket_id == bracket_id) }
|
|
250
|
+
if(!init_bc){
|
|
251
|
+
//Lets try and get one from the server
|
|
252
|
+
const comps_bc = await BracketComeptitionApi.getBracketCompetitionsByBracketId(bracket_id);
|
|
253
|
+
init_bc = comps_bc.find(bc => bc.bracket_id == bracket_id && !bc.invite_only)
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return onView(bracket_id, init_pb_id, init_bc)
|
|
257
|
+
}
|
|
91
258
|
|
|
92
|
-
const competition_bracket_ids = [ ...new Set(public_competitions.map(bc => bc.bracket_id)) ]
|
|
93
|
-
const competition_brackets = brackets.filter(b => competition_bracket_ids.includes(b.bracket_id));
|
|
94
|
-
const competition_league_ids = [ ...new Set(competition_brackets.map(cb => cb.league_id)) ];
|
|
95
259
|
|
|
96
260
|
const pb_width = calcCardWidth(width, 6);
|
|
97
261
|
|
|
98
262
|
const renderBrackets = (data:{ item:string, index:number }) => {
|
|
99
|
-
const bracket =
|
|
263
|
+
const bracket = my_brackets.find(b => b.bracket_id == data.item);
|
|
100
264
|
if(!bracket){ return <></> }
|
|
101
265
|
const expanded = expanded_brackets.includes(data.item) ? true : false
|
|
102
|
-
let my_player_brackets = player_brackets.filter(pb => pb.bracket_id == data.item);
|
|
266
|
+
let my_player_brackets = player_brackets.filter(pb => pb.bracket_id == data.item && pb.status != 'deleted');
|
|
103
267
|
let additional = my_player_brackets.length - 1
|
|
104
268
|
if(!expanded){
|
|
105
269
|
my_player_brackets = my_player_brackets.slice(0,1);
|
|
@@ -107,8 +271,8 @@ const RoomHome = ({ visible, width, player, leagues, active_brackets, public_com
|
|
|
107
271
|
const league = leagues.find(l => l.league_id == bracket.league_id);
|
|
108
272
|
const act_loading = action_loading == data.item ? true : false
|
|
109
273
|
return (
|
|
110
|
-
<View float style={{ margin:5, width: pb_width }}>
|
|
111
|
-
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
|
|
274
|
+
<View key={`${data.item}_${data.index}_bracket`} float style={{ margin:5, width: pb_width }}>
|
|
275
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
|
|
112
276
|
{league ?
|
|
113
277
|
<Image
|
|
114
278
|
style={{ height:40, width:40, marginRight:5 }}
|
|
@@ -144,9 +308,12 @@ const RoomHome = ({ visible, width, player, leagues, active_brackets, public_com
|
|
|
144
308
|
completion_status: 'inprogress',
|
|
145
309
|
status: 'active'
|
|
146
310
|
})
|
|
147
|
-
onUpdatePlayerBracket(new_pb);
|
|
148
311
|
setActionLoading(undefined);
|
|
149
312
|
if(!expanded){ setExpandedBrackets(expanded_brackets.concat(data.item)) }
|
|
313
|
+
setMyBrackets({
|
|
314
|
+
...my_brackets_data,
|
|
315
|
+
player_brackets: player_brackets.filter(pb => pb.player_bracket_id != new_pb.player_bracket_id).concat(new_pb)
|
|
316
|
+
})
|
|
150
317
|
}}
|
|
151
318
|
/>
|
|
152
319
|
:<></>}
|
|
@@ -173,7 +340,7 @@ const RoomHome = ({ visible, width, player, leagues, active_brackets, public_com
|
|
|
173
340
|
const renderCompetitions = (data:{ item:BracketCompetitionProps, index:number }) => {
|
|
174
341
|
return (
|
|
175
342
|
<Button style={{ padding:10, flexDirection:'row', alignItems:'center', borderRadius:0, borderBottomWidth:1, borderColor:Colors.borders.light }}
|
|
176
|
-
onPress={() =>
|
|
343
|
+
onPress={() => handleView(data.item.bracket_id, undefined, data.item)}>
|
|
177
344
|
<View transparent>
|
|
178
345
|
<Image
|
|
179
346
|
source={{ uri: data.item.image?.url }}
|
|
@@ -207,7 +374,7 @@ const RoomHome = ({ visible, width, player, leagues, active_brackets, public_com
|
|
|
207
374
|
<Icons.BracketIcon size={50} color={Colors.text.h1} />
|
|
208
375
|
}
|
|
209
376
|
</View>
|
|
210
|
-
<View type='footer' style={{ padding:8 }}>
|
|
377
|
+
<View type='footer' style={{ padding:8, borderBottomLeftRadius:8, borderBottomRightRadius:8 }}>
|
|
211
378
|
<Button
|
|
212
379
|
type='action'
|
|
213
380
|
style={{ padding:5 }}
|
|
@@ -219,14 +386,21 @@ const RoomHome = ({ visible, width, player, leagues, active_brackets, public_com
|
|
|
219
386
|
)
|
|
220
387
|
}
|
|
221
388
|
|
|
222
|
-
const
|
|
389
|
+
const handleSearchPrivate = async(code:string) => {
|
|
390
|
+
const bc = await BracketComeptitionApi.getBracketcompetitionByCode(code);
|
|
391
|
+
if(!bc){ return alert('Unable to find private competition by that code')}
|
|
392
|
+
let pb_response = await BracketComeptitionApi.getMyPlayerBrackets(bc.bracket_id);
|
|
393
|
+
return handleView(bc.bracket_id, pb_response.player_brackets[0]?.player_bracket_id, bc)
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
const renderPlayerBrackets = (data:{ item:PlayerBracketProps, index:number}) => {
|
|
223
397
|
const cpbs = competition_player_brackets.filter(cpb => cpb.status != 'deleted' && cpb.player_bracket_id == data.item.player_bracket_id);
|
|
224
|
-
const comps =
|
|
225
|
-
const bracket =
|
|
398
|
+
const comps = my_competitions.filter(bc => cpbs.map(cpb => cpb.bracket_competition_id.toString()).includes(bc.bracket_competition_id.toString()));
|
|
399
|
+
const bracket = my_brackets.find(b => b.bracket_id == data.item.bracket_id);
|
|
226
400
|
if(!bracket){ return <></> }
|
|
227
401
|
const league = leagues.find(l => l.league_id == bracket.league_id);
|
|
228
|
-
const champion_team =
|
|
229
|
-
const champion_athlete =
|
|
402
|
+
const champion_team = champion_teams.find(t => data.item.champion_id_type == 'team' && t.team_id == data.item.champion_id)
|
|
403
|
+
const champion_athlete = champion_athletes.find(t => data.item.champion_id_type == 'athlete' && t.athlete_id == data.item.champion_id)
|
|
230
404
|
return (
|
|
231
405
|
<View style={{ borderBottomWidth:1, borderColor:Colors.borders.light, padding:5 }}>
|
|
232
406
|
<PlayerBracketCard
|
|
@@ -237,12 +411,13 @@ const RoomHome = ({ visible, width, player, leagues, active_brackets, public_com
|
|
|
237
411
|
competition_player_brackets={cpbs}
|
|
238
412
|
bracket={bracket}
|
|
239
413
|
bracket_competitions={comps}
|
|
240
|
-
onView={
|
|
241
|
-
onEdit={
|
|
414
|
+
onView={(bracket_id, player_bracket_id) => handleView(bracket_id, player_bracket_id)}
|
|
415
|
+
onEdit={() => setEditingPlayerBracket(data.item)}
|
|
416
|
+
onShowCompetitions={() => setShowComps({ player_bracket: data.item, entered_competitions:comps, entered_brackets: cpbs, champion_team, champion_athlete })}
|
|
242
417
|
/>
|
|
243
418
|
</View>
|
|
244
419
|
)
|
|
245
|
-
}
|
|
420
|
+
};
|
|
246
421
|
|
|
247
422
|
const renderLeagueFilters = (data:{ item:string, index:number }) => {
|
|
248
423
|
const league = leagues.find(l => l.league_id == data.item);
|
|
@@ -251,7 +426,7 @@ const RoomHome = ({ visible, width, player, leagues, active_brackets, public_com
|
|
|
251
426
|
return (
|
|
252
427
|
<Button
|
|
253
428
|
float
|
|
254
|
-
style={{ flexDirection:'row', alignItems:'center', padding:5, paddingRight:10, paddingLeft:10, borderRadius:100, margin:5 }}
|
|
429
|
+
style={{ flexDirection:'row', alignItems:'center', padding:5, paddingRight:10, paddingLeft:10, borderRadius:100, margin:5, backgroundColor:selected?Colors.text.highlight:undefined }}
|
|
255
430
|
onPress={() => selected ? setSelectedLeague(undefined): setSelectedLeague(data.item)}
|
|
256
431
|
>
|
|
257
432
|
<Image
|
|
@@ -267,7 +442,7 @@ const RoomHome = ({ visible, width, player, leagues, active_brackets, public_com
|
|
|
267
442
|
const renderLeagueBrackets = (data:{ item:BracketProps, index:number }) => {
|
|
268
443
|
return (
|
|
269
444
|
<Button style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomWidth:1, borderColor:Colors.borders.light }}
|
|
270
|
-
onPress={() =>
|
|
445
|
+
onPress={() => handleView(data.item.bracket_id)}>
|
|
271
446
|
<Icons.BracketIcon size={18} color={Colors.text.h1} />
|
|
272
447
|
<View transparent style={{ flex:1, marginLeft:10, paddingLeft:5, borderLeftWidth:1, borderColor:Colors.borders.light }}>
|
|
273
448
|
<Text theme='h2'>{data.item.bracket_name}</Text>
|
|
@@ -283,7 +458,7 @@ const RoomHome = ({ visible, width, player, leagues, active_brackets, public_com
|
|
|
283
458
|
if(!league){ return <></> }
|
|
284
459
|
const expanded = expanded_c_leagues.includes(data.item) ? true : false
|
|
285
460
|
//Find all the brackets for this league
|
|
286
|
-
let league_brackets =
|
|
461
|
+
let league_brackets = competition_brackets.filter(b => b.league_id == data.item);
|
|
287
462
|
let league_competitions = public_competitions.filter(bc => league_brackets.map(lb => lb.bracket_id.toString()).includes(bc.bracket_id.toString()));
|
|
288
463
|
const num_comps = league_competitions.length
|
|
289
464
|
let additional = league_competitions.length - 1
|
|
@@ -330,7 +505,7 @@ const RoomHome = ({ visible, width, player, leagues, active_brackets, public_com
|
|
|
330
505
|
const league = leagues.find(l => l.league_id == data.item);
|
|
331
506
|
if(!league){ return <></> }
|
|
332
507
|
const expanded = expanded_leagues.includes(data.item) ? true : false
|
|
333
|
-
let league_brackets =
|
|
508
|
+
let league_brackets = tournament_brackets.filter(b => b.league_id == data.item);
|
|
334
509
|
let additional = league_brackets.length - 1
|
|
335
510
|
if(!expanded){
|
|
336
511
|
league_brackets = league_brackets.slice(0,1);
|
|
@@ -375,7 +550,7 @@ const RoomHome = ({ visible, width, player, leagues, active_brackets, public_com
|
|
|
375
550
|
switch(data.item){
|
|
376
551
|
case 'toggle':
|
|
377
552
|
return (
|
|
378
|
-
<View style={{ margin:
|
|
553
|
+
<View style={{ margin:10, marginTop:18 }}>
|
|
379
554
|
<Toggle
|
|
380
555
|
options={[
|
|
381
556
|
{ key: 'my_brackets', label:'My Brackets' },
|
|
@@ -391,8 +566,8 @@ const RoomHome = ({ visible, width, player, leagues, active_brackets, public_com
|
|
|
391
566
|
case 'active_brackets':
|
|
392
567
|
if(active_toggle != 'my_brackets'){ return <></> }
|
|
393
568
|
return (
|
|
394
|
-
<View nativeID='my_competitions'>
|
|
395
|
-
<View
|
|
569
|
+
<View nativeID='my_competitions' style={{ marginTop:18 }}>
|
|
570
|
+
<View style={{ padding:18, flexDirection:'row', alignItems:'center', borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
396
571
|
<View transparent style={{ flex:1, marginRight:10 }}>
|
|
397
572
|
<Text theme='h1'>My Active Brackets</Text>
|
|
398
573
|
<Text style={{ marginTop:4 }}>View / Edit your active brackets</Text>
|
|
@@ -400,24 +575,24 @@ const RoomHome = ({ visible, width, player, leagues, active_brackets, public_com
|
|
|
400
575
|
<Button
|
|
401
576
|
float
|
|
402
577
|
style={{ padding:0, height:35, width:35, justifyContent:'center', alignItems:'center' }}
|
|
403
|
-
onPress={() =>
|
|
578
|
+
onPress={() => setActiveSearch({ visible: !active_search.visible, value:'' })}
|
|
404
579
|
>
|
|
405
|
-
{
|
|
580
|
+
{active_search.visible ?
|
|
406
581
|
<Icons.CloseIcon size={14} color={Colors.text.error} />
|
|
407
582
|
:
|
|
408
583
|
<Icons.SearchIcon size={14} color={Colors.text.action} />
|
|
409
584
|
}
|
|
410
585
|
</Button>
|
|
411
586
|
</View>
|
|
412
|
-
{
|
|
587
|
+
{active_search.visible ?
|
|
413
588
|
<SearchBox
|
|
414
|
-
onChange={(text) => setActiveSearch(text)}
|
|
589
|
+
onChange={(text) => setActiveSearch({ ...active_search, value: text })}
|
|
415
590
|
hide_search_button
|
|
416
591
|
placeholder='Search Active Brackets'
|
|
417
592
|
onFocusPosition={onFocusPosition}
|
|
418
593
|
/>
|
|
419
594
|
:<></>}
|
|
420
|
-
<View type='
|
|
595
|
+
<View type='header' style={{ padding:10, flexDirection:'row', flexWrap:'wrap', justifyContent:'center'}}>
|
|
421
596
|
{active_bracket_ids.map((id, index) => {
|
|
422
597
|
return renderBrackets({ item:id, index })
|
|
423
598
|
})}
|
|
@@ -436,38 +611,38 @@ const RoomHome = ({ visible, width, player, leagues, active_brackets, public_com
|
|
|
436
611
|
<Button
|
|
437
612
|
float
|
|
438
613
|
style={{ padding:0, height:35, width:35, justifyContent:'center', alignItems:'center' }}
|
|
439
|
-
onPress={() =>
|
|
614
|
+
onPress={() => setTourneySearch({ visible: !tourney_search.visible, value: '' })}
|
|
440
615
|
>
|
|
441
|
-
{
|
|
616
|
+
{tourney_search.visible ?
|
|
442
617
|
<Icons.CloseIcon size={14} color={Colors.text.error} />
|
|
443
618
|
:
|
|
444
619
|
<Icons.SearchIcon size={14} color={Colors.text.action} />
|
|
445
620
|
}
|
|
446
621
|
</Button>
|
|
447
622
|
</View>
|
|
448
|
-
{
|
|
623
|
+
{tourney_search.visible ?
|
|
449
624
|
|
|
450
625
|
<View style={{ padding:5 }}>
|
|
451
626
|
<FlatList
|
|
452
627
|
key='unique_leagues'
|
|
453
628
|
keyExtractor={(item) => item}
|
|
454
|
-
data={
|
|
629
|
+
data={unique_tournament_leagues}
|
|
455
630
|
renderItem={renderLeagueFilters}
|
|
456
631
|
horizontal
|
|
457
632
|
/>
|
|
458
633
|
</View>
|
|
459
634
|
:<></>}
|
|
460
635
|
|
|
461
|
-
{
|
|
636
|
+
{tourney_search.visible ?
|
|
462
637
|
<SearchBox
|
|
463
|
-
onChange={(text) =>
|
|
638
|
+
onChange={(text) => setTourneySearch({ ...tourney_search, value: text })}
|
|
464
639
|
hide_search_button
|
|
465
640
|
placeholder='Search Active Tournaments'
|
|
466
641
|
onFocusPosition={onFocusPosition}
|
|
467
642
|
/>
|
|
468
643
|
:<></>}
|
|
469
644
|
<View type='body' style={{ marginTop:10, marginBottom:10, flexDirection:'row', flexWrap:'wrap', justifyContent:'center'}}>
|
|
470
|
-
{
|
|
645
|
+
{unique_tournament_leagues.map((id, index) => {
|
|
471
646
|
return renderLeagues({ item:id, index })
|
|
472
647
|
})}
|
|
473
648
|
</View>
|
|
@@ -477,34 +652,34 @@ const RoomHome = ({ visible, width, player, leagues, active_brackets, public_com
|
|
|
477
652
|
case 'past_brackets':
|
|
478
653
|
if(active_toggle != 'my_brackets'){ return <></> }
|
|
479
654
|
return (
|
|
480
|
-
<View nativeID='past_brackets'>
|
|
481
|
-
<View
|
|
655
|
+
<View nativeID='past_brackets' style={{ marginTop:18 }}>
|
|
656
|
+
<View style={{ padding:18, flexDirection:'row', alignItems:'center', borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
482
657
|
<View transparent style={{ flex:1, marginRight:10 }}>
|
|
483
|
-
<Text theme='h1'>
|
|
658
|
+
<Text theme='h1'>My Past Brackets</Text>
|
|
484
659
|
<Text style={{ marginTop:4 }}>View your past brackets</Text>
|
|
485
660
|
</View>
|
|
486
661
|
<Button
|
|
487
662
|
float
|
|
488
663
|
style={{ padding:0, height:35, width:35, justifyContent:'center', alignItems:'center' }}
|
|
489
|
-
onPress={() =>
|
|
664
|
+
onPress={() => setPastSearch({ visible: !past_search.visible, value: '' })}
|
|
490
665
|
>
|
|
491
|
-
{
|
|
666
|
+
{past_search.visible ?
|
|
492
667
|
<Icons.CloseIcon size={14} color={Colors.text.error} />
|
|
493
668
|
:
|
|
494
669
|
<Icons.SearchIcon size={14} color={Colors.text.action} />
|
|
495
670
|
}
|
|
496
671
|
</Button>
|
|
497
672
|
</View>
|
|
498
|
-
{
|
|
673
|
+
{past_search.visible ?
|
|
499
674
|
<SearchBox
|
|
500
|
-
onChange={(text) => setPastSearch(text)}
|
|
675
|
+
onChange={(text) => setPastSearch({ ...past_search, value:text })}
|
|
501
676
|
hide_search_button
|
|
502
677
|
placeholder='Search Past Brackets'
|
|
503
678
|
onFocusPosition={onFocusPosition}
|
|
504
679
|
/>
|
|
505
680
|
:<></>}
|
|
506
|
-
<View type='
|
|
507
|
-
{
|
|
681
|
+
<View type='header' style={{ padding:10, flexDirection:'row', flexWrap:'wrap', justifyContent:'center'}}>
|
|
682
|
+
{closed_bracket_ids.map((id, index) => {
|
|
508
683
|
return renderBrackets({ item:id, index })
|
|
509
684
|
})}
|
|
510
685
|
</View>
|
|
@@ -524,23 +699,43 @@ const RoomHome = ({ visible, width, player, leagues, active_brackets, public_com
|
|
|
524
699
|
title='PREV'
|
|
525
700
|
type='text'
|
|
526
701
|
style={{ padding:0, marginRight:10 }}
|
|
527
|
-
onPress={() =>
|
|
702
|
+
onPress={() => getAdminComps(admin_offset - 1)}
|
|
528
703
|
/>
|
|
529
704
|
:<></>}
|
|
530
705
|
<Button
|
|
531
706
|
title='MORE'
|
|
532
707
|
type='text'
|
|
533
708
|
style={{ padding:0 }}
|
|
534
|
-
onPress={() =>
|
|
709
|
+
onPress={() => getAdminComps(admin_offset + 1)}
|
|
535
710
|
/>
|
|
536
711
|
</View>
|
|
537
712
|
<View style={{ padding:10 }}>
|
|
538
|
-
<
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
713
|
+
<View style={{ flexDirection:'row' }}>
|
|
714
|
+
{onCreateNewCompetition ?
|
|
715
|
+
<View float style={{ width:100, margin:5, borderWidth:1, borderColor:Colors.text.success }}>
|
|
716
|
+
<View type='header' style={{ borderTopRightRadius:8, borderTopLeftRadius:8, padding:5 }}>
|
|
717
|
+
<Text style={{ padding:5 }} theme='description' textAlign='center'>NEW</Text>
|
|
718
|
+
</View>
|
|
719
|
+
<View style={{ flex:1, justifyContent:'center', alignItems:'center' }}>
|
|
720
|
+
<Icons.BracketIcon size={40} color={Colors.text.h1} />
|
|
721
|
+
</View>
|
|
722
|
+
<View type='footer' style={{ padding:8, borderBottomLeftRadius:8, borderBottomRightRadius:8 }}>
|
|
723
|
+
<Button
|
|
724
|
+
title='CREATE'
|
|
725
|
+
type='success'
|
|
726
|
+
style={{padding:5}}
|
|
727
|
+
onPress={() => onCreateNewCompetition()}
|
|
728
|
+
/>
|
|
729
|
+
</View>
|
|
730
|
+
</View>
|
|
731
|
+
:<></>}
|
|
732
|
+
<FlatList
|
|
733
|
+
data={admin_competitions}
|
|
734
|
+
renderItem={renderAdminCompetitions}
|
|
735
|
+
keyExtractor={(item) => `admin_${item.bracket_competition_id.toString()}`}
|
|
736
|
+
horizontal
|
|
737
|
+
/>
|
|
738
|
+
</View>
|
|
544
739
|
</View>
|
|
545
740
|
</View>
|
|
546
741
|
)
|
|
@@ -556,9 +751,9 @@ const RoomHome = ({ visible, width, player, leagues, active_brackets, public_com
|
|
|
556
751
|
<Button
|
|
557
752
|
float
|
|
558
753
|
style={{ padding:0, height:35, width:35, justifyContent:'center', alignItems:'center' }}
|
|
559
|
-
onPress={() =>
|
|
754
|
+
onPress={() => setCompSearch({ visible: !comp_search.visible, value: '' })}
|
|
560
755
|
>
|
|
561
|
-
{
|
|
756
|
+
{comp_search.visible ?
|
|
562
757
|
<Icons.CloseIcon size={12} color={Colors.text.error} />
|
|
563
758
|
:
|
|
564
759
|
<Icons.SearchIcon size={12} color={Colors.text.action} />
|
|
@@ -575,16 +770,16 @@ const RoomHome = ({ visible, width, player, leagues, active_brackets, public_com
|
|
|
575
770
|
</Button>
|
|
576
771
|
:<></>}
|
|
577
772
|
</View>
|
|
578
|
-
{
|
|
773
|
+
{comp_search.visible ?
|
|
579
774
|
<SearchBox
|
|
580
|
-
onChange={(text) =>
|
|
581
|
-
onSearch={(text) =>
|
|
775
|
+
onChange={(text) => setCompSearch({ ...comp_search, value:text })}
|
|
776
|
+
onSearch={(text) => handleSearchPrivate(text)}
|
|
582
777
|
placeholder='Search or Enter Private Code'
|
|
583
778
|
onFocusPosition={onFocusPosition}
|
|
584
779
|
/>
|
|
585
780
|
:<></>}
|
|
586
781
|
<View type='body' style={{ marginTop:10, marginBottom:10, flexDirection:'row', flexWrap:'wrap', justifyContent:'center'}}>
|
|
587
|
-
{
|
|
782
|
+
{unique_competition_leagues.map((id, index) => {
|
|
588
783
|
return renderLeaguesForCompetitions({ item:id, index })
|
|
589
784
|
})}
|
|
590
785
|
</View>
|
|
@@ -595,15 +790,43 @@ const RoomHome = ({ visible, width, player, leagues, active_brackets, public_com
|
|
|
595
790
|
}
|
|
596
791
|
|
|
597
792
|
if(!visible){ return <></> }
|
|
598
|
-
|
|
599
793
|
return (
|
|
600
794
|
<View style={{ flex:1 }}>
|
|
601
795
|
<FlatList
|
|
602
796
|
data={sections}
|
|
603
797
|
key='room_sections'
|
|
798
|
+
refreshing={my_brackets_loading}
|
|
604
799
|
keyExtractor={(item) => item}
|
|
605
800
|
renderItem={renderSections}
|
|
606
801
|
/>
|
|
802
|
+
<EditPlayerBracket
|
|
803
|
+
player_bracket={editing_player_bracket}
|
|
804
|
+
view_mode={view_mode}
|
|
805
|
+
insets={insets}
|
|
806
|
+
onClose={() => setEditingPlayerBracket(undefined)}
|
|
807
|
+
onFocusPosition={onFocusPosition}
|
|
808
|
+
onUpdatePlayerBracket={(new_pb) => {
|
|
809
|
+
setEditingPlayerBracket(undefined);
|
|
810
|
+
setMyBrackets({
|
|
811
|
+
...my_brackets_data,
|
|
812
|
+
player_brackets: player_brackets.filter(pb => pb.player_bracket_id != new_pb.player_bracket_id).concat(new_pb)
|
|
813
|
+
})
|
|
814
|
+
}}
|
|
815
|
+
/>
|
|
816
|
+
<EnteredCompetitionsModal
|
|
817
|
+
player_bracket={show_comps.player_bracket}
|
|
818
|
+
onSelectCompetition={(bc) => {
|
|
819
|
+
if(!show_comps.player_bracket){ return }
|
|
820
|
+
onView(show_comps.player_bracket.bracket_id, show_comps.player_bracket.player_bracket_id, bc)
|
|
821
|
+
}}
|
|
822
|
+
insets={insets}
|
|
823
|
+
champion_team={show_comps.champion_team}
|
|
824
|
+
champion_athlete={show_comps.champion_athlete}
|
|
825
|
+
onClose={() => setShowComps({ entered_brackets:[], entered_competitions:[] })}
|
|
826
|
+
entered_brackets={show_comps.entered_brackets}
|
|
827
|
+
entered_competitions={show_comps.entered_competitions}
|
|
828
|
+
view_mode={view_mode}
|
|
829
|
+
/>
|
|
607
830
|
</View>
|
|
608
831
|
)
|
|
609
832
|
}
|