be-components 4.6.1 → 4.6.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/components/BracketCompetitionActions.js +3 -3
- package/lib/commonjs/Bracket/components/BracketCompetitionActions.js.map +1 -1
- package/lib/commonjs/Bracket/components/BracketPlay/BracketNavigator.js +127 -59
- package/lib/commonjs/Bracket/components/BracketPlay/BracketNavigator.js.map +1 -1
- package/lib/commonjs/Bracket/components/BracketPlay/BracketRound.js +40 -5
- package/lib/commonjs/Bracket/components/BracketPlay/BracketRound.js.map +1 -1
- package/lib/commonjs/Bracket/components/BracketPlay/RoundEvent.js +53 -16
- package/lib/commonjs/Bracket/components/BracketPlay/RoundEvent.js.map +1 -1
- package/lib/commonjs/Bracket/components/BracketPlay/index.js +64 -8
- package/lib/commonjs/Bracket/components/BracketPlay/index.js.map +1 -1
- package/lib/commonjs/Bracket/components/PlayerBrackets.js +54 -13
- package/lib/commonjs/Bracket/components/PlayerBrackets.js.map +1 -1
- package/lib/commonjs/Bracket/index.js +100 -14
- package/lib/commonjs/Bracket/index.js.map +1 -1
- package/lib/commonjs/Components/Checkbox.js +2 -2
- package/lib/commonjs/Components/Checkbox.js.map +1 -1
- package/lib/commonjs/Components/Icons.js +26 -0
- package/lib/commonjs/Components/Icons.js.map +1 -1
- package/lib/module/Bracket/components/BracketCompetitionActions.js +3 -3
- package/lib/module/Bracket/components/BracketCompetitionActions.js.map +1 -1
- package/lib/module/Bracket/components/BracketPlay/BracketNavigator.js +124 -56
- package/lib/module/Bracket/components/BracketPlay/BracketNavigator.js.map +1 -1
- package/lib/module/Bracket/components/BracketPlay/BracketRound.js +41 -6
- package/lib/module/Bracket/components/BracketPlay/BracketRound.js.map +1 -1
- package/lib/module/Bracket/components/BracketPlay/RoundEvent.js +53 -16
- package/lib/module/Bracket/components/BracketPlay/RoundEvent.js.map +1 -1
- package/lib/module/Bracket/components/BracketPlay/index.js +64 -8
- package/lib/module/Bracket/components/BracketPlay/index.js.map +1 -1
- package/lib/module/Bracket/components/PlayerBrackets.js +56 -15
- package/lib/module/Bracket/components/PlayerBrackets.js.map +1 -1
- package/lib/module/Bracket/index.js +100 -14
- package/lib/module/Bracket/index.js.map +1 -1
- package/lib/module/Components/Checkbox.js +2 -2
- package/lib/module/Components/Checkbox.js.map +1 -1
- package/lib/module/Components/Icons.js +26 -0
- package/lib/module/Components/Icons.js.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/BracketNavigator.d.ts +4 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/BracketNavigator.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/BracketRound.d.ts +5 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/BracketRound.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/RoundEvent.d.ts +3 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/RoundEvent.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/index.d.ts +4 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/PlayerBrackets.d.ts +1 -5
- package/lib/typescript/lib/commonjs/Bracket/components/PlayerBrackets.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/index.d.ts +2 -1
- package/lib/typescript/lib/commonjs/Bracket/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Components/Icons.d.ts +5 -0
- package/lib/typescript/lib/commonjs/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/BracketNavigator.d.ts +6 -3
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/BracketNavigator.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/BracketRound.d.ts +5 -1
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/BracketRound.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/RoundEvent.d.ts +3 -1
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/RoundEvent.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/index.d.ts +4 -1
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/PlayerBrackets.d.ts +1 -5
- package/lib/typescript/lib/module/Bracket/components/PlayerBrackets.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/index.d.ts +2 -1
- package/lib/typescript/lib/module/Bracket/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Components/Icons.d.ts +5 -0
- package/lib/typescript/lib/module/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/BracketPlay/BracketNavigator.d.ts +9 -1
- package/lib/typescript/src/Bracket/components/BracketPlay/BracketNavigator.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/BracketPlay/BracketRound.d.ts +6 -2
- package/lib/typescript/src/Bracket/components/BracketPlay/BracketRound.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/BracketPlay/RoundEvent.d.ts +4 -2
- package/lib/typescript/src/Bracket/components/BracketPlay/RoundEvent.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/BracketPlay/index.d.ts +9 -1
- package/lib/typescript/src/Bracket/components/BracketPlay/index.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/PlayerBrackets.d.ts +2 -8
- package/lib/typescript/src/Bracket/components/PlayerBrackets.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/index.d.ts +2 -1
- package/lib/typescript/src/Bracket/index.d.ts.map +1 -1
- package/lib/typescript/src/Components/Icons.d.ts +1 -0
- package/lib/typescript/src/Components/Icons.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Bracket/components/BracketCompetitionActions.tsx +3 -3
- package/src/Bracket/components/BracketPlay/BracketNavigator.tsx +86 -43
- package/src/Bracket/components/BracketPlay/BracketRound.tsx +18 -6
- package/src/Bracket/components/BracketPlay/RoundEvent.tsx +41 -25
- package/src/Bracket/components/BracketPlay/index.tsx +44 -10
- package/src/Bracket/components/PlayerBrackets.tsx +52 -16
- package/src/Bracket/index.tsx +69 -15
- package/src/Components/Checkbox.tsx +1 -1
- package/src/Components/Icons.tsx +16 -0
- package/src/types.d.ts +1 -0
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { FlatList,
|
|
2
|
+
import { FlatList, Modal } from "react-native";
|
|
3
3
|
import type { BracketGroupProps, BracketRoundProps } from '../../../types';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
4
|
+
import { Checkbox } from '../../../Components';
|
|
5
|
+
import { Button, Text, View } from '../../../Components/Themed';
|
|
6
|
+
import { useColors } from '../../../constants/useColors';
|
|
6
7
|
|
|
7
8
|
type BracketNavigatorProps = {
|
|
9
|
+
visible:boolean,
|
|
10
|
+
view_mode?:'desktop'|'mobile',
|
|
11
|
+
insets?:{ top:number, bottom:number, left:number, right:number },
|
|
8
12
|
bracket_rounds:BracketRoundProps[],
|
|
9
13
|
bracket_groups:BracketGroupProps[],
|
|
10
14
|
selected_round?:BracketRoundProps,
|
|
@@ -14,61 +18,100 @@ type BracketNavigatorProps = {
|
|
|
14
18
|
onClose: () => void
|
|
15
19
|
}
|
|
16
20
|
|
|
17
|
-
const
|
|
18
|
-
|
|
21
|
+
const nav_sections = [ 'groups', 'rounds' ];
|
|
22
|
+
const BracketNavigator = ({ visible, view_mode, insets, bracket_rounds, bracket_groups, selected_round, selected_group, onSelectGroup, onSelectRound, onClose }:BracketNavigatorProps) => {
|
|
23
|
+
const Colors = useColors();
|
|
19
24
|
const renderRounds = (data : { item:BracketRoundProps, index:number }) => {
|
|
20
25
|
const selected = selected_round?.bracket_round_id == data.item.bracket_round_id ? true : false
|
|
21
26
|
return (
|
|
22
|
-
<
|
|
23
|
-
<Checkbox size={20} fill_style={{ borderRadius:100 }} style={{ borderRadius:100, marginRight:
|
|
24
|
-
<Text size={14}
|
|
25
|
-
</
|
|
27
|
+
<Button style={{ flexDirection:'row', borderRadius:0, alignItems:'center', padding:16, borderBottomWidth:1, borderColor:Colors.borders.light }} onPress={() => onSelectRound(data.item)}>
|
|
28
|
+
<Checkbox size={20} fill_style={{ borderRadius:100 }} style={{ borderRadius:100, marginRight:15 }} color={Colors.text.action} checked={selected} disabled onSelect={() => console.log('')}/>
|
|
29
|
+
<Text size={14} theme={selected?'h1':'description'}>{data.item.round_name}</Text>
|
|
30
|
+
</Button>
|
|
26
31
|
)
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
const renderGroups = (data : { item:BracketGroupProps, index:number }) => {
|
|
30
35
|
const selected = selected_group?.bracket_group_id == data.item.bracket_group_id ? true : false
|
|
31
36
|
return (
|
|
32
|
-
<
|
|
33
|
-
<Checkbox size={20} fill_style={{ borderRadius:100 }} style={{ borderRadius:100, marginRight:
|
|
34
|
-
<Text size={14}
|
|
35
|
-
</
|
|
37
|
+
<Button style={{ flexDirection:'row', alignItems:'center', borderRadius:0, padding:16, borderBottomWidth:1, borderColor:Colors.borders.light }} onPress={() => onSelectGroup(data.item)}>
|
|
38
|
+
<Checkbox size={20} fill_style={{ borderRadius:100 }} style={{ borderRadius:100, marginRight:15 }} color={Colors.text.action} checked={selected} disabled onSelect={() => console.log('')}/>
|
|
39
|
+
<Text size={14} theme={selected?'h1':'description'}>{data.item.group_name}</Text>
|
|
40
|
+
</Button>
|
|
36
41
|
)
|
|
37
42
|
}
|
|
38
43
|
|
|
44
|
+
const renderSections = (data:{item:string, index:number}) => {
|
|
45
|
+
switch(data.item){
|
|
46
|
+
case 'groups':
|
|
47
|
+
return (
|
|
48
|
+
<View style={{ marginTop:5 }}>
|
|
49
|
+
<View type='header' style={{ padding:10 }}>
|
|
50
|
+
<Text theme='h1'>Groups</Text>
|
|
51
|
+
<Text theme='description' style={{ marginTop:4 }}>Select bracket group filter below</Text>
|
|
52
|
+
</View>
|
|
53
|
+
<FlatList
|
|
54
|
+
data={bracket_groups}
|
|
55
|
+
renderItem={renderGroups}
|
|
56
|
+
keyExtractor={(item) => item.bracket_group_id.toString()}
|
|
57
|
+
/>
|
|
58
|
+
</View>
|
|
59
|
+
)
|
|
60
|
+
case 'rounds':
|
|
61
|
+
return (
|
|
62
|
+
<View style={{ marginTop:5 }}>
|
|
63
|
+
<View type='header' style={{ padding:10 }}>
|
|
64
|
+
<Text theme='h1'>Rounds</Text>
|
|
65
|
+
<Text theme='description' style={{ marginTop:4 }}>Select round filter below</Text>
|
|
66
|
+
</View>
|
|
67
|
+
<FlatList
|
|
68
|
+
data={bracket_rounds}
|
|
69
|
+
renderItem={renderRounds}
|
|
70
|
+
keyExtractor={(item) => item.bracket_round_id.toString()}
|
|
71
|
+
/>
|
|
72
|
+
</View>
|
|
73
|
+
)
|
|
74
|
+
default: return <></>
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
39
78
|
return (
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
79
|
+
<Modal
|
|
80
|
+
visible={visible}
|
|
81
|
+
style={{ flex:1 }}
|
|
82
|
+
transparent
|
|
83
|
+
animationType={view_mode == 'desktop' ? 'fade' : 'slide'}
|
|
84
|
+
>
|
|
85
|
+
<View type='blur' style={view_mode == 'desktop' ? { flex:1, justifyContent:'center', alignItems:'center' } : { flex:1, justifyContent:'flex-end', paddingBottom:(insets?.bottom ?? 0) }}>
|
|
86
|
+
<View float style={view_mode == 'desktop' ? { width:500 }:{ margin:10, maxHeight:650 }}>
|
|
87
|
+
<View type='header' style={{ padding:10, flexDirection:'row', alignItems:'center', borderTopRightRadius:8, borderTopLeftRadius:8 }}>
|
|
88
|
+
<Text style={{ flex:1 }} size={14} theme='h1'>Bracket Filters</Text>
|
|
89
|
+
<Button
|
|
90
|
+
title='X'
|
|
91
|
+
type='close'
|
|
92
|
+
style={{ padding:10 }}
|
|
93
|
+
backgroundColor='transparent'
|
|
94
|
+
onPress={() => onClose()}
|
|
95
|
+
/>
|
|
96
|
+
</View>
|
|
97
|
+
<FlatList
|
|
98
|
+
key='nav_sections'
|
|
99
|
+
keyExtractor={(item) => item}
|
|
100
|
+
renderItem={renderSections}
|
|
101
|
+
data={nav_sections}
|
|
102
|
+
/>
|
|
103
|
+
<View type='footer' style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomRightRadius:8, borderBottomLeftRadius:8 }}>
|
|
104
|
+
<Button
|
|
105
|
+
type='close'
|
|
106
|
+
title='CLOSE'
|
|
107
|
+
style={{ flex:1 }}
|
|
108
|
+
onPress={() => onClose()}
|
|
109
|
+
/>
|
|
110
|
+
</View>
|
|
54
111
|
</View>
|
|
55
|
-
<FlatList
|
|
56
|
-
data={bracket_groups}
|
|
57
|
-
renderItem={renderGroups}
|
|
58
|
-
keyExtractor={(item) => item.bracket_group_id.toString()}
|
|
59
|
-
/>
|
|
60
|
-
</View>
|
|
61
|
-
<View style={{ borderBottomWidth:1, borderColor:Colors.shades.shade600, padding:10 }}>
|
|
62
|
-
<View style={{ padding:5 }}>
|
|
63
|
-
<Text size={14} color={Colors.brand.midnight} weight='bold'>Rounds</Text>
|
|
64
112
|
</View>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
renderItem={renderRounds}
|
|
68
|
-
keyExtractor={(item) => item.bracket_round_id.toString()}
|
|
69
|
-
/>
|
|
70
|
-
</View>
|
|
71
|
-
</View>
|
|
113
|
+
</Modal>
|
|
114
|
+
|
|
72
115
|
)
|
|
73
116
|
}
|
|
74
117
|
|
|
@@ -1,27 +1,34 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { AthleteProps, BracketRoundProps, PlayerBracketPickProps, RoundEventProps, TeamProps } from '../../../types';
|
|
2
|
+
import type { AthleteProps, BracketProps, BracketRoundProps, PlayerBracketPickProps, RoundEventProps, TeamProps } from '../../../types';
|
|
3
3
|
import RoundEventCard from './RoundEvent';
|
|
4
4
|
import { view_styles } from '../../../constants/styles';
|
|
5
|
-
import { Text, View } from '../../../Components/Themed';
|
|
5
|
+
import { Button, Text, View } from '../../../Components/Themed';
|
|
6
|
+
import { Checkbox } from '../../../Components';
|
|
7
|
+
import { useColors } from '../../../constants/useColors';
|
|
6
8
|
|
|
7
9
|
type BracketRoundSectionProps = {
|
|
8
10
|
player_bracket_id?:string,
|
|
9
11
|
round_event_loading?:string,
|
|
10
12
|
player_bracket_picks: PlayerBracketPickProps[],
|
|
11
13
|
bracket_round:BracketRoundProps,
|
|
14
|
+
selected?:boolean,
|
|
15
|
+
bracket?:BracketProps,
|
|
12
16
|
round_events:RoundEventProps[],
|
|
13
17
|
teams:TeamProps[],
|
|
14
18
|
athletes:AthleteProps[],
|
|
15
19
|
hide_titles?:boolean,
|
|
16
20
|
width:number,
|
|
17
21
|
orientation:'left'|'right',
|
|
22
|
+
onSelectRound:(bracket_round:BracketRoundProps) => void,
|
|
23
|
+
onSelectContest?:(contest_type:string, contest_id:string) => void
|
|
18
24
|
active_bracket_group_id?:string,
|
|
19
25
|
onPick: (player_bracket_pick:PlayerBracketPickProps) => void,
|
|
20
26
|
left_bar?:boolean,
|
|
21
27
|
right_bar?:boolean
|
|
22
28
|
}
|
|
23
29
|
|
|
24
|
-
const BracketRoundSection = ({ bracket_round, round_event_loading, teams, round_events, width, hide_titles, player_bracket_picks, active_bracket_group_id, onPick }:BracketRoundSectionProps) => {
|
|
30
|
+
const BracketRoundSection = ({ bracket_round, selected, bracket, round_event_loading, teams, round_events, width, hide_titles, player_bracket_picks, active_bracket_group_id, onSelectContest, onSelectRound, onPick }:BracketRoundSectionProps) => {
|
|
31
|
+
const Colors = useColors();
|
|
25
32
|
if(active_bracket_group_id){
|
|
26
33
|
round_events = round_events.filter(re => re.bracket_group_id == active_bracket_group_id)
|
|
27
34
|
}
|
|
@@ -37,13 +44,14 @@ const BracketRoundSection = ({ bracket_round, round_event_loading, teams, round_
|
|
|
37
44
|
const away_team = teams.find(t => t.team_id == data.item.away_side_id);
|
|
38
45
|
const loading = round_event_loading == data.item.round_event_id ? true : false
|
|
39
46
|
return (
|
|
40
|
-
<View key={`${data.item.bracket_id}_${data.item.round_event_id}`} transparent style={{ margin:
|
|
47
|
+
<View key={`${data.item.bracket_id}_${data.item.round_event_id}`} transparent style={{ margin:4, marginTop:13, flex:1, flexGrow:1, justifyContent:'center' }}>
|
|
41
48
|
<View transparent style={{ margin:1, ...view_styles.float }}>
|
|
42
49
|
<RoundEventCard
|
|
43
50
|
round_event={data.item}
|
|
44
51
|
loading={loading}
|
|
45
52
|
round_events={round_events}
|
|
46
53
|
away_team={away_team}
|
|
54
|
+
bracket={bracket}
|
|
47
55
|
home_team={home_team}
|
|
48
56
|
away_placeholder_team={away_placeholder_team}
|
|
49
57
|
home_placeholder_team={home_placeholder_team}
|
|
@@ -56,6 +64,7 @@ const BracketRoundSection = ({ bracket_round, round_event_loading, teams, round_
|
|
|
56
64
|
if(bracket_round.carry_through){ return alert('Event is not eligible for picks') }
|
|
57
65
|
onPick(player_bracket_pick)
|
|
58
66
|
}}
|
|
67
|
+
onSelectContest={onSelectContest}
|
|
59
68
|
/>
|
|
60
69
|
</View>
|
|
61
70
|
</View>
|
|
@@ -66,8 +75,11 @@ const BracketRoundSection = ({ bracket_round, round_event_loading, teams, round_
|
|
|
66
75
|
return (
|
|
67
76
|
<View key={`${bracket_round.bracket_id}_${bracket_round.bracket_round_id}`} transparent style={{ }}>
|
|
68
77
|
{!hide_titles ?
|
|
69
|
-
<View transparent style={{
|
|
70
|
-
<
|
|
78
|
+
<View transparent style={{ borderBottomWidth:selected?2:1, borderColor:selected?Colors.text.action:Colors.borders.light, margin:3 }}>
|
|
79
|
+
<Button type='text' style={{ flexDirection:'row', alignItems:'center', padding:10 }} onPress={() => onSelectRound(bracket_round)}>
|
|
80
|
+
<Checkbox checked={selected} color={Colors.text.action} disabled size={18} style={{ borderRadius:100 }} fill_style={{ borderRadius:100 }} onSelect={() => console.log('')} />
|
|
81
|
+
<Text style={{ marginLeft:10 }} size={14} theme='h1' textAlign="center">{bracket_round.round_name}</Text>
|
|
82
|
+
</Button>
|
|
71
83
|
</View>
|
|
72
84
|
:<></>}
|
|
73
85
|
<View transparent nativeID="round_events" style={{ flex:1 }}>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Image, ActivityIndicator } from "react-native"
|
|
3
|
-
import type { AthleteProps, EventProps, PlayerBracketPickProps, RoundEventProps, TeamProps } from "../../../types"
|
|
3
|
+
import type { AthleteProps, BracketProps, EventProps, PlayerBracketPickProps, RoundEventProps, TeamProps } from "../../../types"
|
|
4
4
|
import { BracketCompetitionHelpers } from '../../api';
|
|
5
5
|
import { useColors } from '../../../constants/useColors';
|
|
6
6
|
import { Button, Text, View } from '../../../Components/Themed';
|
|
7
|
+
import { Icons } from '../../../Components';
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
type RoundEventCardProps = {
|
|
@@ -16,16 +17,18 @@ type RoundEventCardProps = {
|
|
|
16
17
|
away_placeholder_team?:TeamProps,
|
|
17
18
|
home_placeholder_team?:TeamProps,
|
|
18
19
|
away_athlete?:AthleteProps,
|
|
20
|
+
bracket?:BracketProps,
|
|
19
21
|
home_athlete?:AthleteProps,
|
|
20
22
|
loading?:boolean,
|
|
21
23
|
width:number,
|
|
22
24
|
no_pick?:boolean,
|
|
23
25
|
away_placeholder_pick?:PlayerBracketPickProps,
|
|
24
26
|
home_placeholder_pick?:PlayerBracketPickProps,
|
|
25
|
-
onPick:(player_bracket_pick:PlayerBracketPickProps) => void
|
|
27
|
+
onPick:(player_bracket_pick:PlayerBracketPickProps) => void,
|
|
28
|
+
onSelectContest?:(contest_type:string, contest_id:string) => void
|
|
26
29
|
}
|
|
27
30
|
|
|
28
|
-
const RoundEventCard = ({ event, loading, away_team, away_placeholder_team, home_placeholder_team, home_team, width, no_pick, round_event, player_bracket_pick, away_placeholder_pick, home_placeholder_pick, onPick }:RoundEventCardProps) => {
|
|
31
|
+
const RoundEventCard = ({ event, loading, bracket, away_team, away_placeholder_team, home_placeholder_team, home_team, width, no_pick, round_event, player_bracket_pick, away_placeholder_pick, home_placeholder_pick, onPick, onSelectContest }:RoundEventCardProps) => {
|
|
29
32
|
//AWAY PLACEHOLDER
|
|
30
33
|
const round_width = width//width > 600 ? undefined : width / 2
|
|
31
34
|
const Colors = useColors();
|
|
@@ -53,7 +56,7 @@ const RoundEventCard = ({ event, loading, away_team, away_placeholder_team, home
|
|
|
53
56
|
|
|
54
57
|
const handleSelectHome = () => {
|
|
55
58
|
//Okay! Lets get the side_id
|
|
56
|
-
if(loading){ return }
|
|
59
|
+
if(loading){ return console.log('HEY WAS LOGIN!!!') }
|
|
57
60
|
let side:'home' = 'home'
|
|
58
61
|
let side_id:string|undefined = undefined
|
|
59
62
|
let side_type:string = 'team'
|
|
@@ -148,7 +151,7 @@ const RoundEventCard = ({ event, loading, away_team, away_placeholder_team, home
|
|
|
148
151
|
<Text size={10} theme='h2' color={away_placeholder_pick.result_ind=='win'?Colors.text.success:Colors.text.error}>{away_placeholder_team.market_name} {away_placeholder_team.name}</Text>
|
|
149
152
|
</View>
|
|
150
153
|
:<></>}
|
|
151
|
-
<View style={{ flexDirection:'row', alignItems:'center', padding:
|
|
154
|
+
<View style={{ flexDirection:'row', alignItems:'center', padding:12, borderTopRightRadius:!round_event?.away_side_id || !round_event.away_placeholder?8:0, borderTopLeftRadius:!round_event?.away_side_id || !round_event.away_placeholder?8:0 }}>
|
|
152
155
|
<View transparent style={{ flex:1, marginRight:10, marginLeft:0 }}>
|
|
153
156
|
{round_event.away_side_id && away_team ?
|
|
154
157
|
<View style={{ flexGrow:1, flexDirection:'row', alignItems:'center' }}>
|
|
@@ -157,7 +160,7 @@ const RoundEventCard = ({ event, loading, away_team, away_placeholder_team, home
|
|
|
157
160
|
style={{ height:20, width:20, marginRight:2 }}
|
|
158
161
|
resizeMode="cover"
|
|
159
162
|
/>
|
|
160
|
-
<Text style={{ paddingRight: 5, borderRightWidth:1, borderColor:Colors.borders.light }} size={10} theme='description'>{round_event.away_seed}</Text>
|
|
163
|
+
<Text style={{ paddingRight: 5, borderRightWidth:1, borderColor:Colors.borders.light }} size={10} theme='description'>{!bracket?.hide_seeds?round_event.away_seed:''}</Text>
|
|
161
164
|
<Text style={{ flex:1 }} size={10} color={getPickColor('away', player_bracket_pick)} theme='h2'>{away_team.market_name} {away_team.name}</Text>
|
|
162
165
|
</View>
|
|
163
166
|
:
|
|
@@ -169,7 +172,7 @@ const RoundEventCard = ({ event, loading, away_team, away_placeholder_team, home
|
|
|
169
172
|
style={{ height:20, width:20, marginRight:2 }}
|
|
170
173
|
resizeMode="cover"
|
|
171
174
|
/>
|
|
172
|
-
<Text style={{ paddingRight: 5, borderRightWidth:1, borderColor:Colors.borders.light }} size={10} theme='description'>{away_placeholder_pick.pick_seed}</Text>
|
|
175
|
+
<Text style={{ paddingRight: 5, borderRightWidth:1, borderColor:Colors.borders.light }} size={10} theme='description'>{!bracket?.hide_seeds?away_placeholder_pick.pick_seed:''}</Text>
|
|
173
176
|
<Text style={{ flex:1 }} size={10} theme='h1'>{away_placeholder_team.market_name} {away_placeholder_team.name}</Text>
|
|
174
177
|
</View>
|
|
175
178
|
:
|
|
@@ -182,7 +185,9 @@ const RoundEventCard = ({ event, loading, away_team, away_placeholder_team, home
|
|
|
182
185
|
{round_event.event_id ?
|
|
183
186
|
<Text style={{ margin:5}} size={10} theme='h2'>{getScore(away_team?.team_id)}</Text>
|
|
184
187
|
:<></>}
|
|
185
|
-
{
|
|
188
|
+
<View transparent style={{ marginLeft:5 }}>
|
|
189
|
+
{renderButton('away')}
|
|
190
|
+
</View>
|
|
186
191
|
</View>
|
|
187
192
|
</View>
|
|
188
193
|
</View>
|
|
@@ -190,7 +195,7 @@ const RoundEventCard = ({ event, loading, away_team, away_placeholder_team, home
|
|
|
190
195
|
case 'home':
|
|
191
196
|
return (
|
|
192
197
|
<View transparent>
|
|
193
|
-
<View style={{ flexDirection:'row', alignItems:'center', padding:
|
|
198
|
+
<View style={{ flexDirection:'row', alignItems:'center', padding:12, borderBottomRightRadius:!round_event?.home_side_id || !round_event.home_placeholder?8:0, borderBottomLeftRadius:!round_event?.home_side_id || !round_event.home_placeholder?8:0 }}>
|
|
194
199
|
|
|
195
200
|
<View transparent style={{ flex:1, marginRight:10 }}>
|
|
196
201
|
{round_event.home_side_id && home_team ?
|
|
@@ -200,7 +205,7 @@ const RoundEventCard = ({ event, loading, away_team, away_placeholder_team, home
|
|
|
200
205
|
style={{ height:20, width:20, marginRight:2 }}
|
|
201
206
|
resizeMode="cover"
|
|
202
207
|
/>
|
|
203
|
-
<Text style={{ paddingRight: 5, borderRightWidth:1, borderColor:Colors.borders.light }} size={10} theme='description'>{round_event.home_seed}</Text>
|
|
208
|
+
<Text style={{ paddingRight: 5, borderRightWidth:1, borderColor:Colors.borders.light }} size={10} theme='description'>{!bracket?.hide_seeds?round_event.home_seed:''}</Text>
|
|
204
209
|
<Text style={{ flex:1 }} size={10} color={getPickColor('home', player_bracket_pick)} theme='h2'>{home_team.market_name} {home_team.name}</Text>
|
|
205
210
|
</View>
|
|
206
211
|
:
|
|
@@ -212,7 +217,7 @@ const RoundEventCard = ({ event, loading, away_team, away_placeholder_team, home
|
|
|
212
217
|
style={{ height:20, width:20, marginRight:2 }}
|
|
213
218
|
resizeMode="cover"
|
|
214
219
|
/>
|
|
215
|
-
<Text style={{ paddingRight: 5, borderRightWidth:1, borderColor:Colors.borders.light }} size={10} theme='action'>{home_placeholder_pick.pick_seed}</Text>
|
|
220
|
+
<Text style={{ paddingRight: 5, borderRightWidth:1, borderColor:Colors.borders.light }} size={10} theme='action'>{!bracket?.hide_seeds?home_placeholder_pick.pick_seed:''}</Text>
|
|
216
221
|
<Text style={{ flex:1 }} size={10} theme='h2'>{home_placeholder_team.market_name} {home_placeholder_team.name}</Text>
|
|
217
222
|
</View>
|
|
218
223
|
:
|
|
@@ -225,7 +230,9 @@ const RoundEventCard = ({ event, loading, away_team, away_placeholder_team, home
|
|
|
225
230
|
{round_event.event_id ?
|
|
226
231
|
<Text style={{ margin:5}} size={10} theme='h2'>{getScore(home_team?.team_id)}</Text>
|
|
227
232
|
:<></>}
|
|
228
|
-
{
|
|
233
|
+
<View transparent style={{ marginLeft:5 }}>
|
|
234
|
+
{renderButton('home')}
|
|
235
|
+
</View>
|
|
229
236
|
</View>
|
|
230
237
|
</View>
|
|
231
238
|
{round_event?.home_side_id && home_placeholder_pick && home_placeholder_team?
|
|
@@ -240,22 +247,31 @@ const RoundEventCard = ({ event, loading, away_team, away_placeholder_team, home
|
|
|
240
247
|
|
|
241
248
|
|
|
242
249
|
return (
|
|
243
|
-
<View float
|
|
244
|
-
|
|
245
|
-
|
|
250
|
+
<View transparent float style={{ flexDirection:'row', borderRadius:8 }}>
|
|
251
|
+
{round_event.event_id && onSelectContest ?
|
|
252
|
+
<Button style={{ padding:10, justifyContent:'center', alignItems:'center', borderRightWidth:1, borderColor:Colors.borders.light, borderRadius:0, borderTopLeftRadius:8, borderBottomLeftRadius:8 }}
|
|
253
|
+
onPress={() => onSelectContest('team', round_event?.event_id??'')}>
|
|
254
|
+
<Icons.AlertIcon size={16} color={Colors.text.action} />
|
|
246
255
|
</Button>
|
|
247
|
-
<Button transparent style={{ padding:0 }} onPress={() => handleSelectHome()}>
|
|
248
|
-
{renderSide('home')}
|
|
249
|
-
</Button>
|
|
250
|
-
{loading ?
|
|
251
|
-
<View style={{ position:'absolute', top:0, left:0, right:0, bottom:0, justifyContent:'center', alignItems:'center' }}>
|
|
252
|
-
<ActivityIndicator
|
|
253
|
-
size='large'
|
|
254
|
-
color={Colors.text.h1}
|
|
255
|
-
/>
|
|
256
|
-
</View>
|
|
257
256
|
:<></>}
|
|
257
|
+
<View transparent style={{ flex:1, minWidth:125, width:round_width }}>
|
|
258
|
+
<Button transparent style={{ padding:0, borderBottomWidth:1, borderColor:Colors.borders.light}} onPress={() => handleSelectAway()}>
|
|
259
|
+
{renderSide('away')}
|
|
260
|
+
</Button>
|
|
261
|
+
<Button transparent style={{ padding:0 }} onPress={() => handleSelectHome()}>
|
|
262
|
+
{renderSide('home')}
|
|
263
|
+
</Button>
|
|
264
|
+
{loading ?
|
|
265
|
+
<View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, borderRadius:8, justifyContent:'center', alignItems:'center' }}>
|
|
266
|
+
<ActivityIndicator
|
|
267
|
+
size='large'
|
|
268
|
+
color={Colors.text.h1}
|
|
269
|
+
/>
|
|
270
|
+
</View>
|
|
271
|
+
:<></>}
|
|
272
|
+
</View>
|
|
258
273
|
</View>
|
|
274
|
+
|
|
259
275
|
)
|
|
260
276
|
}
|
|
261
277
|
|
|
@@ -5,20 +5,26 @@ import { BracketApi, BracketComeptitionApi, BracketCompetitionHelpers } from '..
|
|
|
5
5
|
import BracketRoundSection from './BracketRound';
|
|
6
6
|
import { Button, Text, View } from '../../../Components/Themed';
|
|
7
7
|
import { useColors } from '../../../constants/useColors';
|
|
8
|
+
import BracketNavigator from './BracketNavigator';
|
|
9
|
+
import { Icons } from '../../../Components';
|
|
8
10
|
|
|
9
11
|
type BracketPlayProps = {
|
|
10
12
|
player?:MyPlayerProps
|
|
13
|
+
view_mode?:'desktop'|'mobile',
|
|
14
|
+
insets?:{ top:number, bottom:number, left:number, right:number },
|
|
11
15
|
player_bracket_id?:string,
|
|
12
16
|
bracket_id?:string,
|
|
13
17
|
width:number,
|
|
14
18
|
onRequestAuthenticate: () => void,
|
|
19
|
+
onSelectContest?:(contest_type:string, contest_id:string) => void
|
|
15
20
|
onChangePlayerBracket: (bracket_id:string) => void,
|
|
16
21
|
onPlayerBracketUpdate: (pb:PlayerBracketProps, cpbs:CompetitionPlayerBracketProps[]) => void,
|
|
17
22
|
}
|
|
18
23
|
|
|
19
|
-
const BracketPlay = ({ player, width, bracket_id, player_bracket_id, onPlayerBracketUpdate, onChangePlayerBracket, onRequestAuthenticate }:BracketPlayProps) => {
|
|
24
|
+
const BracketPlay = ({ player, view_mode, width, bracket_id, onSelectContest, player_bracket_id, insets, onPlayerBracketUpdate, onChangePlayerBracket, onRequestAuthenticate }:BracketPlayProps) => {
|
|
20
25
|
const Colors = useColors();
|
|
21
26
|
const [ round_event_loading, setRoundEventLoading ] = useState<string|undefined>(undefined);
|
|
27
|
+
const [ show_filter, setShowFilter ] = useState(false);
|
|
22
28
|
const [ play_data, setPlayData ] = useState<{
|
|
23
29
|
play_loading:boolean,
|
|
24
30
|
player_bracket?:PlayerBracketProps,
|
|
@@ -48,7 +54,7 @@ const BracketPlay = ({ player, width, bracket_id, player_bracket_id, onPlayerBra
|
|
|
48
54
|
events: []
|
|
49
55
|
})
|
|
50
56
|
const { play_loading, player_bracket, player_bracket_picks } = play_data;
|
|
51
|
-
const { loading, bracket_rounds, round_events, bracket, teams, athletes, selected_round } = bracket_data;
|
|
57
|
+
const { loading, bracket_groups, selected_group, bracket_rounds, round_events, bracket, teams, athletes, selected_round } = bracket_data;
|
|
52
58
|
|
|
53
59
|
const champion_team = player_bracket?.champion_id_type == 'team' ? teams.find(t => t.team_id == player_bracket?.champion_id) : undefined
|
|
54
60
|
const champion_athlete = player_bracket?.champion_id_type == 'athlete' ? athletes.find(a => a.athlete_id == player_bracket?.champion_id) : undefined
|
|
@@ -143,16 +149,21 @@ const BracketPlay = ({ player, width, bracket_id, player_bracket_id, onPlayerBra
|
|
|
143
149
|
}
|
|
144
150
|
|
|
145
151
|
const renderBracketRounds = (data: { item:BracketRoundProps, index:number }) => {
|
|
152
|
+
const selected = selected_round?.bracket_round_id == data.item.bracket_round_id ? true : false
|
|
146
153
|
return (
|
|
147
154
|
<BracketRoundSection
|
|
148
155
|
round_event_loading={round_event_loading}
|
|
149
156
|
bracket_round={data.item}
|
|
150
157
|
round_events={round_events}
|
|
158
|
+
selected={selected}
|
|
159
|
+
bracket={bracket}
|
|
151
160
|
teams={teams}
|
|
161
|
+
onSelectContest={onSelectContest}
|
|
152
162
|
athletes={athletes}
|
|
153
163
|
player_bracket_picks={player_bracket_picks}
|
|
154
164
|
width={round_width}
|
|
155
165
|
orientation='right'
|
|
166
|
+
onSelectRound={(br) => setData({ ...bracket_data, selected_round: selected_round?.bracket_round_id == br.bracket_round_id ? undefined: br })}
|
|
156
167
|
onPick={(pick) => handlePick(pick)}
|
|
157
168
|
|
|
158
169
|
/>
|
|
@@ -167,9 +178,34 @@ const BracketPlay = ({ player, width, bracket_id, player_bracket_id, onPlayerBra
|
|
|
167
178
|
)
|
|
168
179
|
}
|
|
169
180
|
return (
|
|
170
|
-
<View
|
|
181
|
+
<View style={{ flex:1 }}>
|
|
182
|
+
<BracketNavigator
|
|
183
|
+
visible={show_filter}
|
|
184
|
+
view_mode={view_mode}
|
|
185
|
+
insets={insets}
|
|
186
|
+
bracket_groups={bracket_groups}
|
|
187
|
+
bracket_rounds={bracket_rounds}
|
|
188
|
+
selected_group={selected_group}
|
|
189
|
+
selected_round={selected_round}
|
|
190
|
+
onSelectGroup={(g) => {
|
|
191
|
+
setData({ ...bracket_data, selected_group: selected_group?.bracket_group_id == g.bracket_group_id ? undefined : g })
|
|
192
|
+
setShowFilter(false)
|
|
193
|
+
}}
|
|
194
|
+
onSelectRound={(r) => {
|
|
195
|
+
setData({ ...bracket_data, selected_round: selected_round?.bracket_round_id == r.bracket_round_id ? undefined : r })
|
|
196
|
+
setShowFilter(false)
|
|
197
|
+
}}
|
|
198
|
+
onClose={() => setShowFilter(false)}
|
|
199
|
+
/>
|
|
171
200
|
{player_bracket ?
|
|
172
201
|
<View float style={{ padding:10, borderRadius:0, flexDirection:'row', alignItems:'center' }}>
|
|
202
|
+
<Button
|
|
203
|
+
title='Change'
|
|
204
|
+
style={{ padding:10, marginRight:10}}
|
|
205
|
+
type='info'
|
|
206
|
+
title_color={Colors.text.action}
|
|
207
|
+
onPress={() => onChangePlayerBracket(bracket.bracket_id)}
|
|
208
|
+
/>
|
|
173
209
|
{champion_team ?
|
|
174
210
|
<View transparent style={{ justifyContent:'center', alignItems:'center', marginRight:10 }}>
|
|
175
211
|
<Image
|
|
@@ -193,12 +229,10 @@ const BracketPlay = ({ player, width, bracket_id, player_bracket_id, onPlayerBra
|
|
|
193
229
|
<Text size={14} theme='h1'>{player_bracket.bracket_name}</Text>
|
|
194
230
|
<Text style={{ marginTop:3 }} size={12} theme='description'>{(player_bracket.completion_pct*100).toFixed(2)}% Complete</Text>
|
|
195
231
|
</View>
|
|
196
|
-
<Button
|
|
197
|
-
|
|
198
|
-
style={{
|
|
199
|
-
|
|
200
|
-
onPress={() => onChangePlayerBracket(bracket.bracket_id)}
|
|
201
|
-
/>
|
|
232
|
+
<Button float style={{ padding:10, justifyContent:'center', alignItems:'center' }} onPress={() => setShowFilter(!show_filter)}>
|
|
233
|
+
<Icons.FilterIcon size={16} color={Colors.text.action}/>
|
|
234
|
+
<Text style={{ marginTop:3 }} theme='action'>FILTER</Text>
|
|
235
|
+
</Button>
|
|
202
236
|
</View>
|
|
203
237
|
:
|
|
204
238
|
<View style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
|
|
@@ -215,7 +249,6 @@ const BracketPlay = ({ player, width, bracket_id, player_bracket_id, onPlayerBra
|
|
|
215
249
|
</View>
|
|
216
250
|
}
|
|
217
251
|
|
|
218
|
-
|
|
219
252
|
<ScrollView>
|
|
220
253
|
<ScrollView horizontal style={{ flexDirection:'row', padding:10 }}>
|
|
221
254
|
{visible_rounds.sort((a,b) => a.round_number - b.round_number).map((br,i) => {
|
|
@@ -223,6 +256,7 @@ const BracketPlay = ({ player, width, bracket_id, player_bracket_id, onPlayerBra
|
|
|
223
256
|
})}
|
|
224
257
|
</ScrollView>
|
|
225
258
|
</ScrollView>
|
|
259
|
+
|
|
226
260
|
</View>
|
|
227
261
|
)
|
|
228
262
|
}
|