be-components 4.4.1 → 4.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/Bracket/api/index.js +95 -3
- package/lib/commonjs/Bracket/api/index.js.map +1 -1
- package/lib/commonjs/Bracket/components/BracketCompetitionActions.js +534 -0
- package/lib/commonjs/Bracket/components/BracketCompetitionActions.js.map +1 -0
- package/lib/commonjs/Bracket/components/BracketCompetitionCard.js +4 -2
- package/lib/commonjs/Bracket/components/BracketCompetitionCard.js.map +1 -1
- package/lib/commonjs/Bracket/components/BracketCompetitionSelector.js +50 -25
- package/lib/commonjs/Bracket/components/BracketCompetitionSelector.js.map +1 -1
- package/lib/commonjs/Bracket/components/BracketHeader.js +63 -0
- package/lib/commonjs/Bracket/components/BracketHeader.js.map +1 -0
- package/lib/commonjs/Bracket/components/BracketPlay/BracketRound.js +4 -0
- package/lib/commonjs/Bracket/components/BracketPlay/BracketRound.js.map +1 -1
- package/lib/commonjs/Bracket/components/BracketPlay/RoundEvent.js +42 -21
- package/lib/commonjs/Bracket/components/BracketPlay/RoundEvent.js.map +1 -1
- package/lib/commonjs/Bracket/components/BracketPlay/index.js +76 -84
- package/lib/commonjs/Bracket/components/BracketPlay/index.js.map +1 -1
- package/lib/commonjs/Bracket/components/BracketSelector.js +12 -44
- package/lib/commonjs/Bracket/components/BracketSelector.js.map +1 -1
- package/lib/commonjs/Bracket/components/CompetitionLeaderboard.js +15 -23
- package/lib/commonjs/Bracket/components/CompetitionLeaderboard.js.map +1 -1
- package/lib/commonjs/Bracket/components/EditPlayerBracket.js +122 -0
- package/lib/commonjs/Bracket/components/EditPlayerBracket.js.map +1 -0
- package/lib/commonjs/Bracket/components/JoinCompetitionCard.js +61 -50
- package/lib/commonjs/Bracket/components/JoinCompetitionCard.js.map +1 -1
- package/lib/commonjs/Bracket/components/Navigator.js +102 -0
- package/lib/commonjs/Bracket/components/Navigator.js.map +1 -0
- package/lib/commonjs/Bracket/components/PlayerBalanceCard.js +16 -13
- package/lib/commonjs/Bracket/components/PlayerBalanceCard.js.map +1 -1
- package/lib/commonjs/Bracket/components/PlayerBracketCard.js +139 -0
- package/lib/commonjs/Bracket/components/PlayerBracketCard.js.map +1 -0
- package/lib/commonjs/Bracket/components/PlayerBrackets.js +67 -31
- package/lib/commonjs/Bracket/components/PlayerBrackets.js.map +1 -1
- package/lib/commonjs/Bracket/components/RoomHome.js +837 -0
- package/lib/commonjs/Bracket/components/RoomHome.js.map +1 -0
- package/lib/commonjs/Bracket/index.js +859 -281
- package/lib/commonjs/Bracket/index.js.map +1 -1
- package/lib/commonjs/Components/Icons.js +51 -0
- package/lib/commonjs/Components/Icons.js.map +1 -1
- package/lib/commonjs/Components/SearchBox.js +2 -0
- package/lib/commonjs/Components/SearchBox.js.map +1 -1
- package/lib/commonjs/Engage/components/BracketCompetitionCard.js +2 -0
- package/lib/commonjs/Engage/components/BracketCompetitionCard.js.map +1 -1
- package/lib/module/Bracket/api/index.js +95 -3
- package/lib/module/Bracket/api/index.js.map +1 -1
- package/lib/module/Bracket/components/BracketCompetitionActions.js +525 -0
- package/lib/module/Bracket/components/BracketCompetitionActions.js.map +1 -0
- package/lib/module/Bracket/components/BracketCompetitionCard.js +4 -2
- package/lib/module/Bracket/components/BracketCompetitionCard.js.map +1 -1
- package/lib/module/Bracket/components/BracketCompetitionSelector.js +51 -26
- package/lib/module/Bracket/components/BracketCompetitionSelector.js.map +1 -1
- package/lib/module/Bracket/components/BracketHeader.js +56 -0
- package/lib/module/Bracket/components/BracketHeader.js.map +1 -0
- package/lib/module/Bracket/components/BracketPlay/BracketRound.js +4 -0
- package/lib/module/Bracket/components/BracketPlay/BracketRound.js.map +1 -1
- package/lib/module/Bracket/components/BracketPlay/RoundEvent.js +42 -21
- package/lib/module/Bracket/components/BracketPlay/RoundEvent.js.map +1 -1
- package/lib/module/Bracket/components/BracketPlay/index.js +77 -84
- package/lib/module/Bracket/components/BracketPlay/index.js.map +1 -1
- package/lib/module/Bracket/components/BracketSelector.js +11 -45
- package/lib/module/Bracket/components/BracketSelector.js.map +1 -1
- package/lib/module/Bracket/components/CompetitionLeaderboard.js +16 -24
- package/lib/module/Bracket/components/CompetitionLeaderboard.js.map +1 -1
- package/lib/module/Bracket/components/EditPlayerBracket.js +114 -0
- package/lib/module/Bracket/components/EditPlayerBracket.js.map +1 -0
- package/lib/module/Bracket/components/JoinCompetitionCard.js +54 -43
- package/lib/module/Bracket/components/JoinCompetitionCard.js.map +1 -1
- package/lib/module/Bracket/components/Navigator.js +95 -0
- package/lib/module/Bracket/components/Navigator.js.map +1 -0
- package/lib/module/Bracket/components/PlayerBalanceCard.js +13 -10
- package/lib/module/Bracket/components/PlayerBalanceCard.js.map +1 -1
- package/lib/module/Bracket/components/PlayerBracketCard.js +133 -0
- package/lib/module/Bracket/components/PlayerBracketCard.js.map +1 -0
- package/lib/module/Bracket/components/PlayerBrackets.js +66 -32
- package/lib/module/Bracket/components/PlayerBrackets.js.map +1 -1
- package/lib/module/Bracket/components/RoomHome.js +828 -0
- package/lib/module/Bracket/components/RoomHome.js.map +1 -0
- package/lib/module/Bracket/index.js +866 -283
- package/lib/module/Bracket/index.js.map +1 -1
- package/lib/module/Components/Icons.js +51 -0
- package/lib/module/Components/Icons.js.map +1 -1
- package/lib/module/Components/SearchBox.js +2 -0
- package/lib/module/Components/SearchBox.js.map +1 -1
- package/lib/module/Engage/components/BracketCompetitionCard.js +2 -0
- package/lib/module/Engage/components/BracketCompetitionCard.js.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/api/index.d.ts +11 -1
- package/lib/typescript/lib/commonjs/Bracket/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketCompetitionActions.d.ts +24 -0
- package/lib/typescript/lib/commonjs/Bracket/components/BracketCompetitionActions.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Bracket/components/BracketCompetitionCard.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketCompetitionSelector.d.ts +2 -2
- package/lib/typescript/lib/commonjs/Bracket/components/BracketCompetitionSelector.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketHeader.d.ts +7 -0
- package/lib/typescript/lib/commonjs/Bracket/components/BracketHeader.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/BracketRound.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/RoundEvent.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/index.d.ts +3 -4
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketSelector.d.ts +1 -3
- package/lib/typescript/lib/commonjs/Bracket/components/BracketSelector.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/CompetitionLeaderboard.d.ts +3 -3
- package/lib/typescript/lib/commonjs/Bracket/components/CompetitionLeaderboard.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/EditPlayerBracket.d.ts +9 -0
- package/lib/typescript/lib/commonjs/Bracket/components/EditPlayerBracket.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Bracket/components/JoinCompetitionCard.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/Navigator.d.ts +9 -0
- package/lib/typescript/lib/commonjs/Bracket/components/Navigator.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Bracket/components/PlayerBalanceCard.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/PlayerBracketCard.d.ts +4 -0
- package/lib/typescript/lib/commonjs/Bracket/components/PlayerBracketCard.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Bracket/components/PlayerBrackets.d.ts +3 -2
- package/lib/typescript/lib/commonjs/Bracket/components/PlayerBrackets.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/RoomHome.d.ts +21 -0
- package/lib/typescript/lib/commonjs/Bracket/components/RoomHome.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Bracket/index.d.ts +5 -3
- package/lib/typescript/lib/commonjs/Bracket/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Components/Icons.d.ts +10 -0
- package/lib/typescript/lib/commonjs/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Components/SearchBox.d.ts +2 -1
- package/lib/typescript/lib/commonjs/Components/SearchBox.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Engage/components/BracketCompetitionCard.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/api/index.d.ts +11 -1
- package/lib/typescript/lib/module/Bracket/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/BracketCompetitionActions.d.ts +24 -0
- package/lib/typescript/lib/module/Bracket/components/BracketCompetitionActions.d.ts.map +1 -0
- package/lib/typescript/lib/module/Bracket/components/BracketCompetitionCard.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/BracketCompetitionSelector.d.ts +2 -2
- package/lib/typescript/lib/module/Bracket/components/BracketCompetitionSelector.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/BracketHeader.d.ts +7 -0
- package/lib/typescript/lib/module/Bracket/components/BracketHeader.d.ts.map +1 -0
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/BracketRound.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/RoundEvent.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/index.d.ts +4 -7
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/BracketSelector.d.ts +2 -6
- package/lib/typescript/lib/module/Bracket/components/BracketSelector.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/CompetitionLeaderboard.d.ts +3 -3
- package/lib/typescript/lib/module/Bracket/components/CompetitionLeaderboard.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/EditPlayerBracket.d.ts +11 -0
- package/lib/typescript/lib/module/Bracket/components/EditPlayerBracket.d.ts.map +1 -0
- package/lib/typescript/lib/module/Bracket/components/JoinCompetitionCard.d.ts +1 -2
- package/lib/typescript/lib/module/Bracket/components/JoinCompetitionCard.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/Navigator.d.ts +11 -0
- package/lib/typescript/lib/module/Bracket/components/Navigator.d.ts.map +1 -0
- package/lib/typescript/lib/module/Bracket/components/PlayerBalanceCard.d.ts +1 -2
- package/lib/typescript/lib/module/Bracket/components/PlayerBalanceCard.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/PlayerBracketCard.d.ts +10 -0
- package/lib/typescript/lib/module/Bracket/components/PlayerBracketCard.d.ts.map +1 -0
- package/lib/typescript/lib/module/Bracket/components/PlayerBrackets.d.ts +4 -5
- package/lib/typescript/lib/module/Bracket/components/PlayerBrackets.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/RoomHome.d.ts +23 -0
- package/lib/typescript/lib/module/Bracket/components/RoomHome.d.ts.map +1 -0
- package/lib/typescript/lib/module/Bracket/index.d.ts +6 -4
- package/lib/typescript/lib/module/Bracket/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Components/Icons.d.ts +10 -0
- package/lib/typescript/lib/module/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/lib/module/Components/SearchBox.d.ts +2 -1
- package/lib/typescript/lib/module/Components/SearchBox.d.ts.map +1 -1
- package/lib/typescript/lib/module/Engage/components/BracketCompetitionCard.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/api/index.d.ts +22 -3
- package/lib/typescript/src/Bracket/api/index.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/BracketCompetitionActions.d.ts +37 -0
- package/lib/typescript/src/Bracket/components/BracketCompetitionActions.d.ts.map +1 -0
- package/lib/typescript/src/Bracket/components/BracketCompetitionCard.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/BracketCompetitionSelector.d.ts +8 -2
- package/lib/typescript/src/Bracket/components/BracketCompetitionSelector.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/BracketHeader.d.ts +15 -0
- package/lib/typescript/src/Bracket/components/BracketHeader.d.ts.map +1 -0
- package/lib/typescript/src/Bracket/components/BracketPlay/BracketRound.d.ts +0 -4
- package/lib/typescript/src/Bracket/components/BracketPlay/BracketRound.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/BracketPlay/index.d.ts +3 -7
- package/lib/typescript/src/Bracket/components/BracketPlay/index.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/BracketSelector.d.ts +1 -3
- package/lib/typescript/src/Bracket/components/BracketSelector.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/CompetitionLeaderboard.d.ts +4 -2
- package/lib/typescript/src/Bracket/components/CompetitionLeaderboard.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/EditPlayerBracket.d.ts +16 -0
- package/lib/typescript/src/Bracket/components/EditPlayerBracket.d.ts.map +1 -0
- package/lib/typescript/src/Bracket/components/JoinCompetitionCard.d.ts +2 -2
- package/lib/typescript/src/Bracket/components/JoinCompetitionCard.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/Navigator.d.ts +16 -0
- package/lib/typescript/src/Bracket/components/Navigator.d.ts.map +1 -0
- package/lib/typescript/src/Bracket/components/PlayerBalanceCard.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/PlayerBracketCard.d.ts +16 -0
- package/lib/typescript/src/Bracket/components/PlayerBracketCard.d.ts.map +1 -0
- package/lib/typescript/src/Bracket/components/PlayerBrackets.d.ts +4 -2
- package/lib/typescript/src/Bracket/components/PlayerBrackets.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/RoomHome.d.ts +30 -0
- package/lib/typescript/src/Bracket/components/RoomHome.d.ts.map +1 -0
- package/lib/typescript/src/Bracket/index.d.ts +17 -3
- package/lib/typescript/src/Bracket/index.d.ts.map +1 -1
- package/lib/typescript/src/Components/Icons.d.ts +2 -0
- package/lib/typescript/src/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/src/Components/SearchBox.d.ts +7 -1
- package/lib/typescript/src/Components/SearchBox.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Bracket/api/index.ts +83 -5
- package/src/Bracket/components/BracketCompetitionActions.tsx +360 -0
- package/src/Bracket/components/BracketCompetitionCard.tsx +4 -2
- package/src/Bracket/components/BracketCompetitionSelector.tsx +35 -15
- package/src/Bracket/components/BracketHeader.tsx +41 -0
- package/src/Bracket/components/BracketPlay/BracketRound.tsx +4 -5
- package/src/Bracket/components/BracketPlay/RoundEvent.tsx +21 -21
- package/src/Bracket/components/BracketPlay/index.tsx +57 -52
- package/src/Bracket/components/BracketSelector.tsx +16 -21
- package/src/Bracket/components/CompetitionLeaderboard.tsx +19 -22
- package/src/Bracket/components/EditPlayerBracket.tsx +83 -0
- package/src/Bracket/components/JoinCompetitionCard.tsx +46 -33
- package/src/Bracket/components/Navigator.tsx +57 -0
- package/src/Bracket/components/PlayerBalanceCard.tsx +9 -10
- package/src/Bracket/components/PlayerBracketCard.tsx +105 -0
- package/src/Bracket/components/PlayerBrackets.tsx +46 -18
- package/src/Bracket/components/RoomHome.tsx +543 -0
- package/src/Bracket/index.tsx +660 -127
- package/src/Components/Icons.tsx +30 -0
- package/src/Components/SearchBox.tsx +3 -1
- package/src/Engage/components/BracketCompetitionCard.tsx +2 -2
- package/src/types.d.ts +1 -0
- package/lib/commonjs/Bracket/components/RoomMenu.js +0 -120
- package/lib/commonjs/Bracket/components/RoomMenu.js.map +0 -1
- package/lib/module/Bracket/components/RoomMenu.js +0 -113
- package/lib/module/Bracket/components/RoomMenu.js.map +0 -1
- package/lib/typescript/lib/commonjs/Bracket/components/RoomMenu.d.ts +0 -8
- package/lib/typescript/lib/commonjs/Bracket/components/RoomMenu.d.ts.map +0 -1
- package/lib/typescript/lib/module/Bracket/components/RoomMenu.d.ts +0 -10
- package/lib/typescript/lib/module/Bracket/components/RoomMenu.d.ts.map +0 -1
- package/lib/typescript/src/Bracket/components/RoomMenu.d.ts +0 -14
- package/lib/typescript/src/Bracket/components/RoomMenu.d.ts.map +0 -1
- package/src/Bracket/components/RoomMenu.tsx +0 -69
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
2
|
+
import { Button, Text, View } from '../../Components/Themed';
|
|
3
|
+
import type { AthleteProps, BracketCompetitionProps, BracketProps, CompetitionPlayerBracketProps, CompetitionResultTypeProps, LeagueProps, MyPlayerProps, PlayerBracketProps, TeamProps } from '../../types';
|
|
4
|
+
import { FlatList, Image } from 'react-native';
|
|
5
|
+
import PlayerBracketCard from './PlayerBracketCard';
|
|
6
|
+
import SearchBox from '../../Components/SearchBox';
|
|
7
|
+
import { Icons, Toggle } from '../../Components';
|
|
8
|
+
import { useColors } from '../../constants/useColors';
|
|
9
|
+
import moment from 'moment-mini';
|
|
10
|
+
import { BracketComeptitionApi } from '../api';
|
|
11
|
+
|
|
12
|
+
type RoomHomeProps = {
|
|
13
|
+
player?:MyPlayerProps,
|
|
14
|
+
visible?:boolean,
|
|
15
|
+
player_brackets:PlayerBracketProps[],
|
|
16
|
+
bracket_competitions:BracketCompetitionProps[],
|
|
17
|
+
competition_player_brackets:CompetitionPlayerBracketProps[],
|
|
18
|
+
brackets:BracketProps[],
|
|
19
|
+
onFocusPosition?:(pos:{ x:number, y:number, height:number, width:number }) => void,
|
|
20
|
+
width:number,
|
|
21
|
+
public_competitions:BracketCompetitionProps[],
|
|
22
|
+
active_brackets:BracketProps[],
|
|
23
|
+
view_mode:'mobile'|'desktop'
|
|
24
|
+
competition_result_types:CompetitionResultTypeProps[],
|
|
25
|
+
leagues:LeagueProps[],
|
|
26
|
+
athletes:AthleteProps[],
|
|
27
|
+
onUpdatePlayerBracket:(player_bracket:PlayerBracketProps) => void,
|
|
28
|
+
onEditPlayerBracket:(player_bracket:PlayerBracketProps) => void,
|
|
29
|
+
onView: (bracket_id:string, player_bracket_id?:string, bracket_competition_id?:string) => void,
|
|
30
|
+
teams:TeamProps[]
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const MIN_CARD_WIDTH = 330
|
|
34
|
+
|
|
35
|
+
const calcCardWidth = (width:number, margin:number) => {
|
|
36
|
+
let num_cards_possible = Math.floor((width) / MIN_CARD_WIDTH)
|
|
37
|
+
let buffer = margin * 2 * num_cards_possible
|
|
38
|
+
let card_widt = (width - buffer) / num_cards_possible
|
|
39
|
+
if(card_widt < MIN_CARD_WIDTH){ return MIN_CARD_WIDTH }
|
|
40
|
+
return card_widt
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const sections = [ 'toggle', 'active_brackets', 'past_brackets', 'tournaments', 'competitions']
|
|
44
|
+
|
|
45
|
+
const RoomHome = ({ visible, width, player, leagues, active_brackets, public_competitions, onView, onUpdatePlayerBracket, onEditPlayerBracket, onFocusPosition, brackets, player_brackets, bracket_competitions, competition_player_brackets, athletes, teams }:RoomHomeProps) => {
|
|
46
|
+
const Colors = useColors();
|
|
47
|
+
const [ action_loading, setActionLoading ] = useState<string|undefined>(undefined)//This will be a bracket id
|
|
48
|
+
const [ active_toggle, setActiveToggle ] = useState('competitions');
|
|
49
|
+
const [ past_search, setPastSearch ] = useState('');
|
|
50
|
+
const [ show_active_search, setShowActiveSearch ] = useState(false);
|
|
51
|
+
const [ expanded_brackets, setExpandedBrackets ] = useState<string[]>([]);
|
|
52
|
+
const [ expanded_leagues, setExpandedLeagues ] = useState<string[]>([]);
|
|
53
|
+
const [ expanded_c_leagues, setExpandedCLeagues ] = useState<string[]>([])
|
|
54
|
+
const [ active_search, setActiveSearch ] = useState('');
|
|
55
|
+
const [ show_past_search, setShowPastSearch ] = useState(false);
|
|
56
|
+
const [ show_brackets_search, setShowBracketsSearch ] = useState(false);
|
|
57
|
+
const [ selected_league, setSelectedLeague ] = useState<string | undefined>(undefined);
|
|
58
|
+
const [ brackets_search, setBracketsSearch ] = useState('');
|
|
59
|
+
console.log(brackets_search)
|
|
60
|
+
const [ competition_search, setCompetitionSearch ] = useState('');
|
|
61
|
+
console.log(competition_search)
|
|
62
|
+
const [ show_competition_search, setShowCompetitionSearch ] = useState(false);
|
|
63
|
+
let visible_active_brackets = [ ...active_brackets ]
|
|
64
|
+
const unique_leages = [ ...new Set(visible_active_brackets.map(b => b.league_id)) ];
|
|
65
|
+
if(selected_league){ visible_active_brackets = visible_active_brackets.filter(b => b.league_id == selected_league) }
|
|
66
|
+
//const inprogress_bracket_ids = [ ...new Set(visible_active_brackets.map(b => b.bracket_id)) ];
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
const filterPlayerBrackets = (bs:BracketProps[], pbs:PlayerBracketProps[], status:'active'|'closed', search:string) => {
|
|
70
|
+
let init_pbs = pbs.filter(pb => pb.status == status);
|
|
71
|
+
if(!search || search == ''){ return init_pbs }
|
|
72
|
+
let brackets = bs.filter(b => `${b.bracket_name.toLowerCase()}`.includes(search.toLowerCase()));
|
|
73
|
+
return init_pbs.filter(pb => brackets.map(b => b.bracket_id.toString()).includes(pb.bracket_id.toString()));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
let visible_player_brackets = useMemo(() => {
|
|
77
|
+
return filterPlayerBrackets(brackets, player_brackets, 'active', active_search);
|
|
78
|
+
},[brackets.length, player_brackets.length, active_search]);
|
|
79
|
+
|
|
80
|
+
const active_bracket_ids = [ ...new Set(visible_player_brackets.map(pb => pb.bracket_id)) ]
|
|
81
|
+
|
|
82
|
+
let past_player_brackets = useMemo(() => {
|
|
83
|
+
console.log('past rendering')
|
|
84
|
+
return filterPlayerBrackets(brackets, player_brackets, 'closed', past_search);
|
|
85
|
+
},[brackets.length, player_brackets.length, past_search])
|
|
86
|
+
|
|
87
|
+
const past_bracket_ids = [ ...new Set(past_player_brackets.map(pb => pb.bracket_id)) ]
|
|
88
|
+
|
|
89
|
+
const competition_bracket_ids = [ ...new Set(public_competitions.map(bc => bc.bracket_id)) ]
|
|
90
|
+
const competition_brackets = brackets.filter(b => competition_bracket_ids.includes(b.bracket_id));
|
|
91
|
+
const competition_league_ids = [ ...new Set(competition_brackets.map(cb => cb.league_id)) ];
|
|
92
|
+
|
|
93
|
+
const pb_width = calcCardWidth(width, 6)
|
|
94
|
+
|
|
95
|
+
const renderBrackets = (data:{ item:string, index:number }) => {
|
|
96
|
+
const bracket = brackets.find(b => b.bracket_id == data.item);
|
|
97
|
+
if(!bracket){ return <></> }
|
|
98
|
+
const expanded = expanded_brackets.includes(data.item) ? true : false
|
|
99
|
+
let my_player_brackets = player_brackets.filter(pb => pb.bracket_id == data.item);
|
|
100
|
+
let additional = my_player_brackets.length - 1
|
|
101
|
+
if(!expanded){
|
|
102
|
+
my_player_brackets = my_player_brackets.slice(0,1);
|
|
103
|
+
}
|
|
104
|
+
const league = leagues.find(l => l.league_id == bracket.league_id);
|
|
105
|
+
const act_loading = action_loading == data.item ? true : false
|
|
106
|
+
return (
|
|
107
|
+
<View float style={{ margin:5, width: pb_width }}>
|
|
108
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
|
|
109
|
+
{league ?
|
|
110
|
+
<Image
|
|
111
|
+
style={{ height:40, width:40, marginRight:5 }}
|
|
112
|
+
source={{ uri: league.league_image }}
|
|
113
|
+
resizeMode='cover'
|
|
114
|
+
/>
|
|
115
|
+
:<></>}
|
|
116
|
+
<View transparent style={{ flex:1 }}>
|
|
117
|
+
<Text theme='description'>{league?league.league_name:'Bracket'}</Text>
|
|
118
|
+
<Text style={{ marginTop:3 }} theme='h1'>{bracket.bracket_name}</Text>
|
|
119
|
+
</View>
|
|
120
|
+
<View transparent style={{ alignItems:'center' }}>
|
|
121
|
+
<Text theme='success' size={16}>{my_player_brackets.length}</Text>
|
|
122
|
+
<Text style={{ marginTop:3 }} theme='success' size={12} textAlign='center'>Brackets</Text>
|
|
123
|
+
</View>
|
|
124
|
+
{bracket.status == 'scheduled' ?
|
|
125
|
+
<Button
|
|
126
|
+
title='+'
|
|
127
|
+
type='success'
|
|
128
|
+
disabled={act_loading}
|
|
129
|
+
loading={act_loading}
|
|
130
|
+
style={{ padding:10, marginLeft:10, opacity: act_loading?0.5:1 }}
|
|
131
|
+
onPress={async() => {
|
|
132
|
+
if(action_loading || !player){ return }
|
|
133
|
+
setActionLoading(data.item);
|
|
134
|
+
const new_pb = await BracketComeptitionApi.createPlayerBracket({
|
|
135
|
+
player_bracket_id: '',
|
|
136
|
+
player_id: '',
|
|
137
|
+
bracket_name: `${player.username} Bracket ${Math.floor(Math.random() * (100 - 1 + 1) + 1)}`,
|
|
138
|
+
create_datetime: '', last_update_datetime: '',
|
|
139
|
+
bracket_id: data.item,
|
|
140
|
+
completion_pct: 0,
|
|
141
|
+
completion_status: 'inprogress',
|
|
142
|
+
status: 'active'
|
|
143
|
+
})
|
|
144
|
+
onUpdatePlayerBracket(new_pb);
|
|
145
|
+
setActionLoading(undefined);
|
|
146
|
+
if(!expanded){ setExpandedBrackets(expanded_brackets.concat(data.item)) }
|
|
147
|
+
}}
|
|
148
|
+
/>
|
|
149
|
+
:<></>}
|
|
150
|
+
</View>
|
|
151
|
+
<View style={{ flex:1 }}>
|
|
152
|
+
<FlatList
|
|
153
|
+
data={my_player_brackets}
|
|
154
|
+
key={`${data.item}_brackets`}
|
|
155
|
+
keyExtractor={(item) => item.player_bracket_id.toString()}
|
|
156
|
+
renderItem={renderPlayerBrackets}
|
|
157
|
+
/>
|
|
158
|
+
</View>
|
|
159
|
+
<Button style={{ flexDirection:'row', alignItems:'center', justifyContent:'flex-end', padding:10, backgroundColor:Colors.views.footer, borderTopRightRadius:0, borderTopLeftRadius:0 }}
|
|
160
|
+
onPress={() => expanded ? setExpandedBrackets(expanded_brackets.filter(b => b != data.item)) : setExpandedBrackets(expanded_brackets.concat(data.item))}
|
|
161
|
+
>
|
|
162
|
+
{additional > 0 ?
|
|
163
|
+
<Text theme='action' textAlign='right'>See {additional} More Brackets</Text>
|
|
164
|
+
:<></>}
|
|
165
|
+
</Button>
|
|
166
|
+
</View>
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const renderCompetitions = (data:{ item:BracketCompetitionProps, index:number }) => {
|
|
171
|
+
return (
|
|
172
|
+
<Button style={{ padding:10, flexDirection:'row', alignItems:'center', borderRadius:0, borderBottomWidth:1, borderColor:Colors.borders.light }}
|
|
173
|
+
onPress={() => onView(data.item.bracket_id, player_brackets.find(pb => pb.bracket_id == data.item.bracket_id)?.player_bracket_id, data.item.bracket_competition_id)}>
|
|
174
|
+
<View transparent>
|
|
175
|
+
<Image
|
|
176
|
+
source={{ uri: data.item.image?.url }}
|
|
177
|
+
style={{ height:40, width:40, borderRadius:4 }}
|
|
178
|
+
resizeMode='cover'
|
|
179
|
+
/>
|
|
180
|
+
</View>
|
|
181
|
+
<View transparent style={{ flex:1, marginLeft:5 }}>
|
|
182
|
+
<Text size={14} theme='h1' weight='bold'>{data.item.competition_name}</Text>
|
|
183
|
+
<Text style={{ marginTop:3 }} size={12} theme='light' weight='regular'>{data.item.competition_description}</Text>
|
|
184
|
+
</View>
|
|
185
|
+
<Icons.ChevronIcon size={10} color={Colors.text.h1} direction='right' />
|
|
186
|
+
</Button>
|
|
187
|
+
)
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const renderPlayerBrackets = useCallback((data:{ item:PlayerBracketProps, index:number }) => {
|
|
191
|
+
const cpbs = competition_player_brackets.filter(cpb => cpb.status != 'deleted' && cpb.player_bracket_id == data.item.player_bracket_id);
|
|
192
|
+
const comps = bracket_competitions.filter(bc => cpbs.map(cpb => cpb.bracket_competition_id.toString()).includes(bc.bracket_competition_id.toString()));
|
|
193
|
+
const bracket = brackets.find(b => b.bracket_id == data.item.bracket_id);
|
|
194
|
+
if(!bracket){ return <></> }
|
|
195
|
+
const league = leagues.find(l => l.league_id == bracket.league_id);
|
|
196
|
+
const champion_team = teams.find(t => data.item.champion_id_type == 'team' && t.team_id == data.item.champion_id)
|
|
197
|
+
const champion_athlete = athletes.find(t => data.item.champion_id_type == 'athlete' && t.athlete_id == data.item.champion_id)
|
|
198
|
+
return (
|
|
199
|
+
<View style={{ borderBottomWidth:1, borderColor:Colors.borders.light, padding:5 }}>
|
|
200
|
+
<PlayerBracketCard
|
|
201
|
+
league={league}
|
|
202
|
+
champion_athlete={champion_athlete}
|
|
203
|
+
champion_team={champion_team}
|
|
204
|
+
player_bracket={data.item}
|
|
205
|
+
competition_player_brackets={cpbs}
|
|
206
|
+
bracket={bracket}
|
|
207
|
+
bracket_competitions={comps}
|
|
208
|
+
onView={onView}
|
|
209
|
+
onEdit={onEditPlayerBracket}
|
|
210
|
+
/>
|
|
211
|
+
</View>
|
|
212
|
+
)
|
|
213
|
+
}, [JSON.stringify(player_brackets)]);
|
|
214
|
+
|
|
215
|
+
const renderLeagueFilters = (data:{ item:string, index:number }) => {
|
|
216
|
+
const league = leagues.find(l => l.league_id == data.item);
|
|
217
|
+
if(!league){ return <></> }
|
|
218
|
+
const selected = data.item == selected_league ? true : false
|
|
219
|
+
return (
|
|
220
|
+
<Button
|
|
221
|
+
float
|
|
222
|
+
style={{ flexDirection:'row', alignItems:'center', padding:5, paddingRight:10, paddingLeft:10, borderRadius:100, margin:5 }}
|
|
223
|
+
onPress={() => selected ? setSelectedLeague(undefined): setSelectedLeague(data.item)}
|
|
224
|
+
>
|
|
225
|
+
<Image
|
|
226
|
+
source={{ uri: league.league_image }}
|
|
227
|
+
style={{ height:30, width:30 }}
|
|
228
|
+
resizeMode='cover'
|
|
229
|
+
/>
|
|
230
|
+
<Text style={{ marginLeft:5 }}>{league.league_name}</Text>
|
|
231
|
+
</Button>
|
|
232
|
+
)
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const renderLeagueBrackets = (data:{ item:BracketProps, index:number }) => {
|
|
236
|
+
return (
|
|
237
|
+
<Button style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomWidth:1, borderColor:Colors.borders.light }}
|
|
238
|
+
onPress={() => onView(data.item.bracket_id, player_brackets.find(pb => pb.bracket_id == data.item.bracket_id)?.player_bracket_id, undefined)}>
|
|
239
|
+
<Icons.BracketIcon size={18} color={Colors.text.h1} />
|
|
240
|
+
<View transparent style={{ flex:1, marginLeft:10, paddingLeft:5, borderLeftWidth:1, borderColor:Colors.borders.light }}>
|
|
241
|
+
<Text theme='h2'>{data.item.bracket_name}</Text>
|
|
242
|
+
<Text theme='light' style={{ marginTop:4 }}>{moment(data.item.scheduled_datetime).format('YYYY-MM-DD @ hh:mm a')}</Text>
|
|
243
|
+
</View>
|
|
244
|
+
<Icons.ChevronIcon direction='right' color={Colors.text.h1} />
|
|
245
|
+
</Button>
|
|
246
|
+
)
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const renderLeaguesForCompetitions = (data:{ item:string, index:number }) => {
|
|
250
|
+
const league = leagues.find(l => l.league_id == data.item);
|
|
251
|
+
if(!league){ return <></> }
|
|
252
|
+
const expanded = expanded_c_leagues.includes(data.item) ? true : false
|
|
253
|
+
//Find all the brackets for this league
|
|
254
|
+
let league_brackets = active_brackets.filter(b => b.league_id == data.item);
|
|
255
|
+
let league_competitions = public_competitions.filter(bc => league_brackets.map(lb => lb.bracket_id.toString()).includes(bc.bracket_id.toString()));
|
|
256
|
+
const num_comps = league_competitions.length
|
|
257
|
+
let additional = league_competitions.length - 1
|
|
258
|
+
if(!expanded){
|
|
259
|
+
league_competitions = league_competitions.slice(0,1);
|
|
260
|
+
}
|
|
261
|
+
return (
|
|
262
|
+
<View float style={{ margin:5, width: pb_width }}>
|
|
263
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
|
|
264
|
+
<Image
|
|
265
|
+
style={{ height:40, width:40, marginRight:5 }}
|
|
266
|
+
source={{ uri: league.league_image }}
|
|
267
|
+
resizeMode='cover'
|
|
268
|
+
/>
|
|
269
|
+
<View transparent style={{ flex:1 }}>
|
|
270
|
+
<Text theme='description'>{league.league_name}</Text>
|
|
271
|
+
<Text style={{ marginTop:3 }} theme='h1'>{league.sport}</Text>
|
|
272
|
+
</View>
|
|
273
|
+
<View transparent style={{ alignItems:'center' }}>
|
|
274
|
+
<Text theme='success' size={16}>{num_comps}</Text>
|
|
275
|
+
<Text style={{ marginTop:3 }} theme='success' size={12} textAlign='center'>Comps</Text>
|
|
276
|
+
</View>
|
|
277
|
+
</View>
|
|
278
|
+
<View style={{ flex:1 }}>
|
|
279
|
+
<FlatList
|
|
280
|
+
data={league_competitions}
|
|
281
|
+
renderItem={renderCompetitions}
|
|
282
|
+
keyExtractor={(item) => item.bracket_competition_id.toString()}
|
|
283
|
+
key={'league brackets'}
|
|
284
|
+
/>
|
|
285
|
+
</View>
|
|
286
|
+
<Button style={{ flexDirection:'row', alignItems:'center', justifyContent:'flex-end', padding:10, backgroundColor:Colors.views.footer, borderTopRightRadius:0, borderTopLeftRadius:0 }}
|
|
287
|
+
onPress={() => expanded ? setExpandedCLeagues(expanded_c_leagues.filter(b => b != data.item)) : setExpandedCLeagues(expanded_c_leagues.concat(data.item))}
|
|
288
|
+
>
|
|
289
|
+
{additional > 0 ?
|
|
290
|
+
<Text theme='action' textAlign='right'>See {additional} More Competitions</Text>
|
|
291
|
+
:<></>}
|
|
292
|
+
</Button>
|
|
293
|
+
</View>
|
|
294
|
+
)
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const renderLeagues = (data:{ item:string, index:number }) => {
|
|
298
|
+
const league = leagues.find(l => l.league_id == data.item);
|
|
299
|
+
if(!league){ return <></> }
|
|
300
|
+
const expanded = expanded_leagues.includes(data.item) ? true : false
|
|
301
|
+
let league_brackets = active_brackets.filter(b => b.league_id == data.item);
|
|
302
|
+
let additional = league_brackets.length - 1
|
|
303
|
+
if(!expanded){
|
|
304
|
+
league_brackets = league_brackets.slice(0,1);
|
|
305
|
+
}
|
|
306
|
+
return (
|
|
307
|
+
<View float style={{ margin:5, width: pb_width }}>
|
|
308
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
|
|
309
|
+
<Image
|
|
310
|
+
style={{ height:40, width:40, marginRight:5 }}
|
|
311
|
+
source={{ uri: league.league_image }}
|
|
312
|
+
resizeMode='cover'
|
|
313
|
+
/>
|
|
314
|
+
<View transparent style={{ flex:1 }}>
|
|
315
|
+
<Text theme='description'>{league.league_name}</Text>
|
|
316
|
+
<Text style={{ marginTop:3 }} theme='h1'>{league.sport}</Text>
|
|
317
|
+
</View>
|
|
318
|
+
<View transparent style={{ alignItems:'center' }}>
|
|
319
|
+
<Text theme='success' size={16}>{league_brackets.length}</Text>
|
|
320
|
+
<Text style={{ marginTop:3 }} theme='success' size={12} textAlign='center'>Brackets</Text>
|
|
321
|
+
</View>
|
|
322
|
+
</View>
|
|
323
|
+
<View style={{ flex:1 }}>
|
|
324
|
+
<FlatList
|
|
325
|
+
data={league_brackets}
|
|
326
|
+
renderItem={renderLeagueBrackets}
|
|
327
|
+
keyExtractor={(item) => item.bracket_id}
|
|
328
|
+
key={'league brackets'}
|
|
329
|
+
/>
|
|
330
|
+
</View>
|
|
331
|
+
<Button style={{ flexDirection:'row', alignItems:'center', justifyContent:'flex-end', padding:10, backgroundColor:Colors.views.footer, borderTopRightRadius:0, borderTopLeftRadius:0 }}
|
|
332
|
+
onPress={() => expanded ? setExpandedLeagues(expanded_leagues.filter(b => b != data.item)) : setExpandedLeagues(expanded_leagues.concat(data.item))}
|
|
333
|
+
>
|
|
334
|
+
{additional > 0 ?
|
|
335
|
+
<Text theme='action' textAlign='right'>See {additional} More Brackets</Text>
|
|
336
|
+
:<></>}
|
|
337
|
+
</Button>
|
|
338
|
+
</View>
|
|
339
|
+
)
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
const renderSections = (data:{ item:string, index:number }) => {
|
|
343
|
+
switch(data.item){
|
|
344
|
+
case 'toggle':
|
|
345
|
+
return (
|
|
346
|
+
<View style={{ margin:5 }}>
|
|
347
|
+
<Toggle
|
|
348
|
+
options={[
|
|
349
|
+
{ key: 'my_brackets', label:'My Brackets' },
|
|
350
|
+
{ key: 'tournaments', label:'Tournments' },
|
|
351
|
+
{ key: 'competitions', label:'Competitions' }
|
|
352
|
+
]}
|
|
353
|
+
selected_option={active_toggle}
|
|
354
|
+
onSelectOption={(key) => setActiveToggle(key)}
|
|
355
|
+
|
|
356
|
+
/>
|
|
357
|
+
</View>
|
|
358
|
+
)
|
|
359
|
+
case 'active_brackets':
|
|
360
|
+
if(active_toggle != 'my_brackets'){ return <></> }
|
|
361
|
+
return (
|
|
362
|
+
<View nativeID='my_competitions'>
|
|
363
|
+
<View type='header' style={{ padding:10, flexDirection:'row', alignItems:'center' }}>
|
|
364
|
+
<View transparent style={{ flex:1, marginRight:10 }}>
|
|
365
|
+
<Text theme='h1'>My Active Brackets</Text>
|
|
366
|
+
<Text style={{ marginTop:4 }}>View / Edit your active brackets</Text>
|
|
367
|
+
</View>
|
|
368
|
+
<Button
|
|
369
|
+
float
|
|
370
|
+
style={{ padding:0, height:35, width:35, justifyContent:'center', alignItems:'center' }}
|
|
371
|
+
onPress={() => setShowActiveSearch(!show_active_search)}
|
|
372
|
+
>
|
|
373
|
+
{show_active_search ?
|
|
374
|
+
<Icons.CloseIcon size={14} color={Colors.text.error} />
|
|
375
|
+
:
|
|
376
|
+
<Icons.SearchIcon size={14} color={Colors.text.action} />
|
|
377
|
+
}
|
|
378
|
+
</Button>
|
|
379
|
+
</View>
|
|
380
|
+
{show_active_search ?
|
|
381
|
+
<SearchBox
|
|
382
|
+
onChange={(text) => setActiveSearch(text)}
|
|
383
|
+
hide_search_button
|
|
384
|
+
placeholder='Search Active Brackets'
|
|
385
|
+
onFocusPosition={onFocusPosition}
|
|
386
|
+
/>
|
|
387
|
+
:<></>}
|
|
388
|
+
<View type='body' style={{ marginBottom:10, flexDirection:'row', flexWrap:'wrap', justifyContent:'center'}}>
|
|
389
|
+
{active_bracket_ids.map((id, index) => {
|
|
390
|
+
return renderBrackets({ item:id, index })
|
|
391
|
+
})}
|
|
392
|
+
</View>
|
|
393
|
+
</View>
|
|
394
|
+
)
|
|
395
|
+
case 'tournaments':
|
|
396
|
+
if(active_toggle != 'tournaments'){ return <></> }
|
|
397
|
+
return (
|
|
398
|
+
<View>
|
|
399
|
+
<View type='header' style={{ padding:10, flexDirection:'row', alignItems:'center' }}>
|
|
400
|
+
<View transparent style={{ flex:1, marginRight:10 }}>
|
|
401
|
+
<Text theme='h1'>Active Brackets</Text>
|
|
402
|
+
<Text style={{ marginTop:4 }}>View and fill out active brackets</Text>
|
|
403
|
+
</View>
|
|
404
|
+
<Button
|
|
405
|
+
float
|
|
406
|
+
style={{ padding:0, height:35, width:35, justifyContent:'center', alignItems:'center' }}
|
|
407
|
+
onPress={() => setShowBracketsSearch(!show_brackets_search)}
|
|
408
|
+
>
|
|
409
|
+
{show_brackets_search ?
|
|
410
|
+
<Icons.CloseIcon size={14} color={Colors.text.error} />
|
|
411
|
+
:
|
|
412
|
+
<Icons.SearchIcon size={14} color={Colors.text.action} />
|
|
413
|
+
}
|
|
414
|
+
</Button>
|
|
415
|
+
</View>
|
|
416
|
+
{show_brackets_search ?
|
|
417
|
+
|
|
418
|
+
<View style={{ padding:5 }}>
|
|
419
|
+
<FlatList
|
|
420
|
+
key='unique_leagues'
|
|
421
|
+
keyExtractor={(item) => item}
|
|
422
|
+
data={unique_leages}
|
|
423
|
+
renderItem={renderLeagueFilters}
|
|
424
|
+
horizontal
|
|
425
|
+
/>
|
|
426
|
+
</View>
|
|
427
|
+
:<></>}
|
|
428
|
+
|
|
429
|
+
{show_brackets_search ?
|
|
430
|
+
<SearchBox
|
|
431
|
+
onChange={(text) => setBracketsSearch(text)}
|
|
432
|
+
hide_search_button
|
|
433
|
+
placeholder='Search Active Tournaments'
|
|
434
|
+
onFocusPosition={onFocusPosition}
|
|
435
|
+
/>
|
|
436
|
+
:<></>}
|
|
437
|
+
<View type='body' style={{ marginTop:10, marginBottom:10, flexDirection:'row', flexWrap:'wrap', justifyContent:'center'}}>
|
|
438
|
+
{unique_leages.map((id, index) => {
|
|
439
|
+
return renderLeagues({ item:id, index })
|
|
440
|
+
})}
|
|
441
|
+
</View>
|
|
442
|
+
|
|
443
|
+
</View>
|
|
444
|
+
)
|
|
445
|
+
case 'past_brackets':
|
|
446
|
+
if(active_toggle != 'my_brackets'){ return <></> }
|
|
447
|
+
return (
|
|
448
|
+
<View nativeID='past_brackets'>
|
|
449
|
+
<View type='header' style={{ padding:10, flexDirection:'row', alignItems:'center' }}>
|
|
450
|
+
<View transparent style={{ flex:1, marginRight:10 }}>
|
|
451
|
+
<Text theme='h1'>MY PAST BRACKETS</Text>
|
|
452
|
+
<Text style={{ marginTop:4 }}>View your past brackets</Text>
|
|
453
|
+
</View>
|
|
454
|
+
<Button
|
|
455
|
+
float
|
|
456
|
+
style={{ padding:0, height:35, width:35, justifyContent:'center', alignItems:'center' }}
|
|
457
|
+
onPress={() => setShowPastSearch(!show_past_search)}
|
|
458
|
+
>
|
|
459
|
+
{show_past_search ?
|
|
460
|
+
<Icons.CloseIcon size={14} color={Colors.text.error} />
|
|
461
|
+
:
|
|
462
|
+
<Icons.SearchIcon size={14} color={Colors.text.action} />
|
|
463
|
+
}
|
|
464
|
+
</Button>
|
|
465
|
+
</View>
|
|
466
|
+
{show_past_search ?
|
|
467
|
+
<SearchBox
|
|
468
|
+
onChange={(text) => setPastSearch(text)}
|
|
469
|
+
hide_search_button
|
|
470
|
+
placeholder='Search Past Brackets'
|
|
471
|
+
onFocusPosition={onFocusPosition}
|
|
472
|
+
/>
|
|
473
|
+
:<></>}
|
|
474
|
+
<View type='body' style={{ marginBottom:10, flexDirection:'row', flexWrap:'wrap', justifyContent:'center'}}>
|
|
475
|
+
{past_bracket_ids.map((id, index) => {
|
|
476
|
+
return renderBrackets({ item:id, index })
|
|
477
|
+
})}
|
|
478
|
+
</View>
|
|
479
|
+
</View>
|
|
480
|
+
)
|
|
481
|
+
case 'competitions':
|
|
482
|
+
if(active_toggle != 'competitions'){ return <></> }
|
|
483
|
+
return (
|
|
484
|
+
<View nativeID='competitions'>
|
|
485
|
+
<View type='header' style={{ padding:10, flexDirection:'row', alignItems:'center' }}>
|
|
486
|
+
<View transparent style={{ flex:1, marginRight:10 }}>
|
|
487
|
+
<Text theme='h1'>Active Competitions</Text>
|
|
488
|
+
<Text style={{ marginTop:4 }}>Join an active competition</Text>
|
|
489
|
+
</View>
|
|
490
|
+
<Button
|
|
491
|
+
float
|
|
492
|
+
style={{ padding:0, height:35, width:35, justifyContent:'center', alignItems:'center' }}
|
|
493
|
+
onPress={() => setShowCompetitionSearch(!show_competition_search)}
|
|
494
|
+
>
|
|
495
|
+
{show_competition_search ?
|
|
496
|
+
<Icons.CloseIcon size={12} color={Colors.text.error} />
|
|
497
|
+
:
|
|
498
|
+
<Icons.SearchIcon size={12} color={Colors.text.action} />
|
|
499
|
+
}
|
|
500
|
+
</Button>
|
|
501
|
+
<Button
|
|
502
|
+
type='success'
|
|
503
|
+
style={{ flexDirection:'row', alignItems:'center', marginLeft:5, padding:0, height:35, width:40, justifyContent:'center' }}
|
|
504
|
+
onPress={() => console.log('create a new competition')}
|
|
505
|
+
>
|
|
506
|
+
<Text theme='h1' color={Colors.text.white}>+</Text>
|
|
507
|
+
<Icons.TrophyIcon color={Colors.text.white} size={14}/>
|
|
508
|
+
</Button>
|
|
509
|
+
</View>
|
|
510
|
+
{show_competition_search ?
|
|
511
|
+
<SearchBox
|
|
512
|
+
onChange={(text) => setCompetitionSearch(text)}
|
|
513
|
+
onSearch={(text) => console.log(text)}
|
|
514
|
+
placeholder='Search or Enter Private Code'
|
|
515
|
+
onFocusPosition={onFocusPosition}
|
|
516
|
+
/>
|
|
517
|
+
:<></>}
|
|
518
|
+
<View type='body' style={{ marginTop:10, marginBottom:10, flexDirection:'row', flexWrap:'wrap', justifyContent:'center'}}>
|
|
519
|
+
{competition_league_ids.map((id, index) => {
|
|
520
|
+
return renderLeaguesForCompetitions({ item:id, index })
|
|
521
|
+
})}
|
|
522
|
+
</View>
|
|
523
|
+
</View>
|
|
524
|
+
)
|
|
525
|
+
default: return <></>
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
if(!visible){ return <></> }
|
|
530
|
+
|
|
531
|
+
return (
|
|
532
|
+
<View style={{ flex:1 }}>
|
|
533
|
+
<FlatList
|
|
534
|
+
data={sections}
|
|
535
|
+
key='room_sections'
|
|
536
|
+
keyExtractor={(item) => item}
|
|
537
|
+
renderItem={renderSections}
|
|
538
|
+
/>
|
|
539
|
+
</View>
|
|
540
|
+
)
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
export default RoomHome
|