be-components 4.4.7 → 4.4.9
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 +108 -4
- package/lib/commonjs/Bracket/api/index.js.map +1 -1
- package/lib/commonjs/Bracket/components/BracketCompetitionActions.js +20 -1
- package/lib/commonjs/Bracket/components/BracketCompetitionActions.js.map +1 -1
- package/lib/commonjs/Bracket/components/BracketCompetitionCard.js +6 -0
- package/lib/commonjs/Bracket/components/BracketCompetitionCard.js.map +1 -1
- package/lib/commonjs/Bracket/components/BracketPlay/index.js +3 -0
- package/lib/commonjs/Bracket/components/BracketPlay/index.js.map +1 -1
- package/lib/commonjs/Bracket/components/ManageBracketCompetitionForm.js +1134 -0
- package/lib/commonjs/Bracket/components/ManageBracketCompetitionForm.js.map +1 -0
- package/lib/commonjs/Bracket/components/RoomHome.js +4 -3
- package/lib/commonjs/Bracket/components/RoomHome.js.map +1 -1
- package/lib/commonjs/Bracket/index.js +7 -260
- package/lib/commonjs/Bracket/index.js.map +1 -1
- package/lib/commonjs/Components/Switch.js +16 -12
- package/lib/commonjs/Components/Switch.js.map +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/Bracket/api/index.js +108 -4
- package/lib/module/Bracket/api/index.js.map +1 -1
- package/lib/module/Bracket/components/BracketCompetitionActions.js +20 -1
- package/lib/module/Bracket/components/BracketCompetitionActions.js.map +1 -1
- package/lib/module/Bracket/components/BracketCompetitionCard.js +6 -0
- package/lib/module/Bracket/components/BracketCompetitionCard.js.map +1 -1
- package/lib/module/Bracket/components/BracketPlay/index.js +3 -0
- package/lib/module/Bracket/components/BracketPlay/index.js.map +1 -1
- package/lib/module/Bracket/components/ManageBracketCompetitionForm.js +1125 -0
- package/lib/module/Bracket/components/ManageBracketCompetitionForm.js.map +1 -0
- package/lib/module/Bracket/components/RoomHome.js +4 -3
- package/lib/module/Bracket/components/RoomHome.js.map +1 -1
- package/lib/module/Bracket/index.js +7 -265
- package/lib/module/Bracket/index.js.map +1 -1
- package/lib/module/Components/Switch.js +16 -12
- package/lib/module/Components/Switch.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/api/index.d.ts +15 -0
- package/lib/typescript/lib/commonjs/Bracket/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketCompetitionActions.d.ts +2 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketCompetitionActions.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketCompetitionCard.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/ManageBracketCompetitionForm.d.ts +10 -0
- package/lib/typescript/lib/commonjs/Bracket/components/ManageBracketCompetitionForm.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Bracket/components/RoomHome.d.ts +2 -1
- package/lib/typescript/lib/commonjs/Bracket/components/RoomHome.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/Switch.d.ts +2 -1
- package/lib/typescript/lib/commonjs/Components/Switch.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/index.d.ts +1 -0
- package/lib/typescript/lib/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/api/index.d.ts +15 -0
- package/lib/typescript/lib/module/Bracket/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/BracketCompetitionActions.d.ts +2 -1
- package/lib/typescript/lib/module/Bracket/components/BracketCompetitionActions.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/BracketCompetitionCard.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/ManageBracketCompetitionForm.d.ts +10 -0
- package/lib/typescript/lib/module/Bracket/components/ManageBracketCompetitionForm.d.ts.map +1 -0
- package/lib/typescript/lib/module/Bracket/components/RoomHome.d.ts +2 -1
- package/lib/typescript/lib/module/Bracket/components/RoomHome.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/Switch.d.ts +2 -1
- package/lib/typescript/lib/module/Components/Switch.d.ts.map +1 -1
- package/lib/typescript/lib/module/index.d.ts +2 -1
- package/lib/typescript/lib/module/index.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/api/index.d.ts +17 -2
- package/lib/typescript/src/Bracket/api/index.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/BracketCompetitionActions.d.ts +2 -1
- package/lib/typescript/src/Bracket/components/BracketCompetitionActions.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/BracketCompetitionCard.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/BracketPlay/index.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/ManageBracketCompetitionForm.d.ts +16 -0
- package/lib/typescript/src/Bracket/components/ManageBracketCompetitionForm.d.ts.map +1 -0
- package/lib/typescript/src/Bracket/components/RoomHome.d.ts +2 -1
- package/lib/typescript/src/Bracket/components/RoomHome.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/Switch.d.ts +2 -1
- package/lib/typescript/src/Components/Switch.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Bracket/api/index.ts +63 -6
- package/src/Bracket/components/BracketCompetitionActions.tsx +12 -1
- package/src/Bracket/components/BracketCompetitionCard.tsx +2 -0
- package/src/Bracket/components/BracketPlay/index.tsx +1 -0
- package/src/Bracket/components/ManageBracketCompetitionForm.tsx +698 -0
- package/src/Bracket/components/RoomHome.tsx +5 -2
- package/src/Bracket/index.tsx +8 -269
- package/src/Components/Switch.tsx +12 -7
- package/src/index.tsx +2 -1
|
@@ -23,6 +23,7 @@ type RoomHomeProps = {
|
|
|
23
23
|
view_mode:'mobile'|'desktop'
|
|
24
24
|
competition_result_types:CompetitionResultTypeProps[],
|
|
25
25
|
leagues:LeagueProps[],
|
|
26
|
+
onCreateNewCompetition?:(bracket_id?:string) => void,
|
|
26
27
|
athletes:AthleteProps[],
|
|
27
28
|
onUpdatePlayerBracket:(player_bracket:PlayerBracketProps) => void,
|
|
28
29
|
onEditPlayerBracket:(player_bracket:PlayerBracketProps) => void,
|
|
@@ -42,7 +43,7 @@ const calcCardWidth = (width:number, margin:number) => {
|
|
|
42
43
|
|
|
43
44
|
const sections = [ 'toggle', 'active_brackets', 'past_brackets', 'tournaments', 'competitions']
|
|
44
45
|
|
|
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 RoomHome = ({ visible, width, player, leagues, active_brackets, public_competitions, onCreateNewCompetition, onView, onUpdatePlayerBracket, onEditPlayerBracket, onFocusPosition, brackets, player_brackets, bracket_competitions, competition_player_brackets, athletes, teams }:RoomHomeProps) => {
|
|
46
47
|
const Colors = useColors();
|
|
47
48
|
const [ action_loading, setActionLoading ] = useState<string|undefined>(undefined)//This will be a bracket id
|
|
48
49
|
const [ active_toggle, setActiveToggle ] = useState('competitions');
|
|
@@ -498,14 +499,16 @@ const RoomHome = ({ visible, width, player, leagues, active_brackets, public_com
|
|
|
498
499
|
<Icons.SearchIcon size={12} color={Colors.text.action} />
|
|
499
500
|
}
|
|
500
501
|
</Button>
|
|
502
|
+
{onCreateNewCompetition ?
|
|
501
503
|
<Button
|
|
502
504
|
type='success'
|
|
503
505
|
style={{ flexDirection:'row', alignItems:'center', marginLeft:5, padding:0, height:35, width:40, justifyContent:'center' }}
|
|
504
|
-
onPress={() =>
|
|
506
|
+
onPress={() => onCreateNewCompetition()}
|
|
505
507
|
>
|
|
506
508
|
<Text theme='h1' color={Colors.text.white}>+</Text>
|
|
507
509
|
<Icons.TrophyIcon color={Colors.text.white} size={14}/>
|
|
508
510
|
</Button>
|
|
511
|
+
:<></>}
|
|
509
512
|
</View>
|
|
510
513
|
{show_competition_search ?
|
|
511
514
|
<SearchBox
|
package/src/Bracket/index.tsx
CHANGED
|
@@ -24,12 +24,13 @@ type BracketRoomProps = {
|
|
|
24
24
|
onShareCompetition:(bracket_competition:BracketCompetitionProps) => void,
|
|
25
25
|
onRequestAuthenticate: (auth_strategy_id?:string) => void,
|
|
26
26
|
onNotEnoughBalance:(data:{ bracket_competition:BracketCompetitionProps }) => void,
|
|
27
|
-
onClose?:() => void
|
|
27
|
+
onClose?:() => void,
|
|
28
|
+
onCreateNewCompetition?:(bracket_id?:string) => void
|
|
28
29
|
}
|
|
29
30
|
const sections = ['header', 'home', 'bracket_selector', 'bracket']
|
|
30
31
|
const MAX_WIDTH = 1200
|
|
31
32
|
|
|
32
|
-
const BracketRoom = ({ player_id, width, view_mode, bracket_id, insets, bracket_competition_id, player_balance, onRequestAuthenticate, onFocusPosition, onShareCompetition }:BracketRoomProps) => {
|
|
33
|
+
const BracketRoom = ({ player_id, width, view_mode, bracket_id, insets, onCreateNewCompetition, bracket_competition_id, player_balance, onRequestAuthenticate, onFocusPosition, onShareCompetition }:BracketRoomProps) => {
|
|
33
34
|
const Colors = useColors();
|
|
34
35
|
const [ loading, setLoading ] = useState<string|undefined>(undefined);
|
|
35
36
|
const [ show_competition_actions, setShowCompetitionActions ] = useState(false);
|
|
@@ -132,6 +133,7 @@ const BracketRoom = ({ player_id, width, view_mode, bracket_id, insets, bracket_
|
|
|
132
133
|
let pub_brackets = await BracketApi.getActiveBrackets();
|
|
133
134
|
if(bracket_competition_id){
|
|
134
135
|
let bc = await BracketComeptitionApi.getBracketCompetitionById(bracket_competition_id);
|
|
136
|
+
if(!bc){ return }
|
|
135
137
|
let pb = local_pbs.find(pb => pb.status != 'deleted' && pb.bracket_id == bc.bracket_competition.bracket_id);
|
|
136
138
|
pub_competitions = pub_competitions.filter(pc => pc.bracket_competition_id != bc.bracket_competition.bracket_competition_id).concat(bc.bracket_competition);
|
|
137
139
|
setNavData({
|
|
@@ -231,6 +233,7 @@ const BracketRoom = ({ player_id, width, view_mode, bracket_id, insets, bracket_
|
|
|
231
233
|
player_brackets: player_brackets.filter(pb => pb.player_bracket_id != new_pb.player_bracket_id).concat(new_pb)
|
|
232
234
|
})
|
|
233
235
|
}}
|
|
236
|
+
onCreateNewCompetition={onCreateNewCompetition}
|
|
234
237
|
visible={active_nav == 'home' ? true : false}
|
|
235
238
|
active_brackets={active_brackets}
|
|
236
239
|
view_mode={view_mode}
|
|
@@ -336,12 +339,14 @@ const BracketRoom = ({ player_id, width, view_mode, bracket_id, insets, bracket_
|
|
|
336
339
|
</Button>
|
|
337
340
|
:<></>}
|
|
338
341
|
</View>
|
|
342
|
+
|
|
339
343
|
{mode != 'small' && active_bracket_id ?
|
|
340
344
|
<View type='header' style={{ width:300 }}>
|
|
341
345
|
<BracketCompetitionActions
|
|
342
346
|
view_mode={view_mode}
|
|
343
347
|
player={player}
|
|
344
348
|
insets={insets}
|
|
349
|
+
onCreateNewCompetition={onCreateNewCompetition}
|
|
345
350
|
onRequestAuthenticate={() => onRequestAuthenticate(active_competition?.auth_strategy_id)}
|
|
346
351
|
onSelectCompetition={(bc) => {
|
|
347
352
|
setNavData({
|
|
@@ -430,6 +435,7 @@ const BracketRoom = ({ player_id, width, view_mode, bracket_id, insets, bracket_
|
|
|
430
435
|
onRequestAuthenticate={() => onRequestAuthenticate(active_competition?.auth_strategy_id)}
|
|
431
436
|
player={player}
|
|
432
437
|
hide_image
|
|
438
|
+
onCreateNewCompetition={onCreateNewCompetition}
|
|
433
439
|
insets={insets}
|
|
434
440
|
onFoundCompetition={(bc) => {
|
|
435
441
|
setRoomData({
|
|
@@ -572,270 +578,3 @@ const BracketRoom = ({ player_id, width, view_mode, bracket_id, insets, bracket_
|
|
|
572
578
|
}
|
|
573
579
|
|
|
574
580
|
export default BracketRoom
|
|
575
|
-
|
|
576
|
-
/*
|
|
577
|
-
{view_mode == 'desktop' ?
|
|
578
|
-
<View type='header'>
|
|
579
|
-
<Navigator
|
|
580
|
-
onOptionSelect={(option) => setData({ ...room_data, active_navigation: option.key })}
|
|
581
|
-
active_option={active_navigation}
|
|
582
|
-
visible={true}
|
|
583
|
-
/>
|
|
584
|
-
</View>
|
|
585
|
-
:<></>}
|
|
586
|
-
*/
|
|
587
|
-
|
|
588
|
-
/*
|
|
589
|
-
<BracketPlay
|
|
590
|
-
player={player}
|
|
591
|
-
onRequestAuthenticate={onRequestAuthenticate}
|
|
592
|
-
onChangePlayerBracket={() => {
|
|
593
|
-
|
|
594
|
-
}}
|
|
595
|
-
onPlayerBracketUpdate={(pb, ncpbs) => {
|
|
596
|
-
|
|
597
|
-
}}
|
|
598
|
-
bracket_id={active_bracket_id}
|
|
599
|
-
room_size={room_size}
|
|
600
|
-
player_bracket_id={active_player_bracket}
|
|
601
|
-
/>
|
|
602
|
-
*/
|
|
603
|
-
|
|
604
|
-
/*
|
|
605
|
-
|
|
606
|
-
const getMyData = async() => {
|
|
607
|
-
if(!player_id){ setMyData({ ...my_data, my_data_loaded:true }) }
|
|
608
|
-
//Lets set the local balance
|
|
609
|
-
const pb = await BracketComeptitionApi.getMyBalance();
|
|
610
|
-
setLocalBalance(pb);
|
|
611
|
-
|
|
612
|
-
//Lets grab what I need from the player
|
|
613
|
-
const player = await BracketComeptitionApi.getMyDetails();
|
|
614
|
-
|
|
615
|
-
//Grab all their player brackets
|
|
616
|
-
let pbs = await BracketComeptitionApi.getMyPlayerBrackets();
|
|
617
|
-
|
|
618
|
-
let champ_team_ids = pbs.player_brackets.filter(pb => pb.champion_id_type == 'team').map(b => b.champion_id ?? '')
|
|
619
|
-
const champ_teams = await BracketApi.getTeamsByIds(champ_team_ids);
|
|
620
|
-
let champ_athlete_ids = pbs.player_brackets.filter(pb => pb.champion_id_type == 'athlete').map(b => b.champion_id ?? '')
|
|
621
|
-
const champ_athletes = await BracketApi.getAthletesByIds(champ_athlete_ids);
|
|
622
|
-
setMyData({
|
|
623
|
-
...my_data,
|
|
624
|
-
player: player,
|
|
625
|
-
my_data_loaded: true,
|
|
626
|
-
player_brackets: pbs.player_brackets.filter(pb => pb.status != 'deleted').sort((a,b) => moment(a.create_datetime).unix() - moment(b.create_datetime).unix()),
|
|
627
|
-
champion_athletes: champ_athletes,
|
|
628
|
-
champion_teams: champ_teams,
|
|
629
|
-
competition_player_brackets: pbs.competition_player_brackets
|
|
630
|
-
})
|
|
631
|
-
return pbs
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
*/
|
|
635
|
-
/*
|
|
636
|
-
const [ local_balance, setLocalBalance ] = useState<PlayerBalanceProps|undefined>(undefined);
|
|
637
|
-
const [ room_data, setData ] = useState<{
|
|
638
|
-
loaded:boolean,
|
|
639
|
-
active_navigation:'home'|'brackets'|'competitions',
|
|
640
|
-
leagues:LeagueProps[],
|
|
641
|
-
competition_result_types:CompetitionResultTypeProps[],
|
|
642
|
-
|
|
643
|
-
}>({
|
|
644
|
-
loaded:false,
|
|
645
|
-
leagues: [],
|
|
646
|
-
active_navigation: 'brackets',
|
|
647
|
-
competition_result_types: [],
|
|
648
|
-
});
|
|
649
|
-
const [ play_data, setPlayData ] = useState<{
|
|
650
|
-
active_player_bracket?:string,
|
|
651
|
-
active_action?:string
|
|
652
|
-
active_bracket_id?:string,
|
|
653
|
-
active_competition_id?:string
|
|
654
|
-
}>({});
|
|
655
|
-
const { active_bracket_id, active_player_bracket, active_competition_id } = play_data;
|
|
656
|
-
const { loaded, active_navigation, competition_result_types, leagues } = room_data;
|
|
657
|
-
|
|
658
|
-
const [ bracket_data, setBracketData ] = useState<{
|
|
659
|
-
brackets:BracketProps[],
|
|
660
|
-
bracket_competitions:BracketCompetitionProps[]
|
|
661
|
-
}>({
|
|
662
|
-
brackets:[],
|
|
663
|
-
bracket_competitions:[]
|
|
664
|
-
});
|
|
665
|
-
const { brackets, bracket_competitions } = bracket_data;
|
|
666
|
-
*/
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
/*
|
|
670
|
-
{view_mode == 'desktop' && active_bracket ?
|
|
671
|
-
<View type='header' style={{ width:300 }}>
|
|
672
|
-
<BracketCompetitionActions
|
|
673
|
-
bracket={active_bracket}
|
|
674
|
-
competition_id={active_competition_id}
|
|
675
|
-
competition_player_brackets={competition_player_brackets}
|
|
676
|
-
/>
|
|
677
|
-
</View>
|
|
678
|
-
:<></>}
|
|
679
|
-
*/
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
/*
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
<PlayerBrackets
|
|
686
|
-
visible={active_view == 'select_player_bracket' ? true : false}
|
|
687
|
-
brackets={brackets}
|
|
688
|
-
leagues={leagues}
|
|
689
|
-
teams={champion_teams}
|
|
690
|
-
athletes={champion_athletes}
|
|
691
|
-
player_brackets={visible_player_brackets}
|
|
692
|
-
competition_player_brackets={competition_player_brackets}
|
|
693
|
-
bracket_competitions={bracket_competitions}
|
|
694
|
-
onClose={() => setData({ ...room_data, active_view:'home' })}
|
|
695
|
-
onSelect={(pb) => setData({ ...room_data, active_view: 'manage_bracket', active_player_bracket: pb, active_bracket_id:pb.bracket_id })}
|
|
696
|
-
/>
|
|
697
|
-
<BracketSelector
|
|
698
|
-
brackets={brackets}
|
|
699
|
-
view_mode={view_mode}
|
|
700
|
-
leagues={leagues}
|
|
701
|
-
onSelectBracket={async(brack) => {
|
|
702
|
-
let my_p_b = visible_player_brackets.find(b => b.bracket_id == brack.bracket_id);
|
|
703
|
-
setData({
|
|
704
|
-
...room_data,
|
|
705
|
-
active_player_bracket:my_p_b,
|
|
706
|
-
active_bracket_id: brack.bracket_id,
|
|
707
|
-
active_action:'bracket'
|
|
708
|
-
})
|
|
709
|
-
}}
|
|
710
|
-
/>
|
|
711
|
-
<BracketPlay
|
|
712
|
-
player={player}
|
|
713
|
-
onClose={() => {
|
|
714
|
-
if(active_competition_id){ return setData({ ...room_data, active_toggle: 'brackets' }) }
|
|
715
|
-
setData({ ...room_data, active_toggle:'brackets' })
|
|
716
|
-
}}
|
|
717
|
-
onRequestAuthenticate={onRequestAuthenticate}
|
|
718
|
-
onChangePlayerBracket={() => {
|
|
719
|
-
setData({
|
|
720
|
-
...room_data,
|
|
721
|
-
active_toggle: 'brackets'
|
|
722
|
-
})
|
|
723
|
-
}}
|
|
724
|
-
onPlayerBracketUpdate={(pb, ncpbs) => {
|
|
725
|
-
setData({ ...room_data, active_player_bracket:pb })
|
|
726
|
-
setMyData({
|
|
727
|
-
...my_data,
|
|
728
|
-
player_brackets: player_brackets.filter(opb => opb.player_bracket_id != pb.player_bracket_id).concat(pb),
|
|
729
|
-
competition_player_brackets: competition_player_brackets.filter(cpb => !ncpbs.find(ncpb => ncpb.competition_player_bracket_id == cpb.competition_player_bracket_id)).concat(ncpbs)
|
|
730
|
-
})
|
|
731
|
-
}}
|
|
732
|
-
bracket_id={active_bracket_id}
|
|
733
|
-
room_size={room_size}
|
|
734
|
-
player_bracket_id={active_player_bracket?.player_bracket_id}
|
|
735
|
-
/>
|
|
736
|
-
<BracketCompetitionSelector
|
|
737
|
-
brackets={brackets}
|
|
738
|
-
leagues={leagues}
|
|
739
|
-
visible={active_view == 'select_competition' ? true: false}
|
|
740
|
-
onCompetitionSelect={(bc) => {
|
|
741
|
-
setData({ ...room_data, active_view: 'competition', active_competition_id:bc.bracket_competition_id })
|
|
742
|
-
}}
|
|
743
|
-
onClose={() => setData({ ...room_data, active_view:'home' })}
|
|
744
|
-
/>
|
|
745
|
-
<BracketCompetitionCard
|
|
746
|
-
player={player}
|
|
747
|
-
onNotEnoughBalance={onNotEnoughBalance}
|
|
748
|
-
player_balance={local_balance}
|
|
749
|
-
bracket_competition_id={active_competition_id}
|
|
750
|
-
competition_result_types={competition_result_types}
|
|
751
|
-
height={room_size.height}
|
|
752
|
-
onUpdateMyData={(data) => {
|
|
753
|
-
|
|
754
|
-
setMyData({
|
|
755
|
-
...my_data,
|
|
756
|
-
player_brackets: player_brackets.filter(pb => !data.player_brackets.find(npb => npb.player_bracket_id == pb.player_bracket_id)).concat(data.player_brackets),
|
|
757
|
-
competition_player_brackets: competition_player_brackets.filter(cpb => !data.competition_player_brackets.find(ncpb => ncpb.competition_player_bracket_id == cpb.competition_player_bracket_id)).concat(data.competition_player_brackets)
|
|
758
|
-
})
|
|
759
|
-
setData({
|
|
760
|
-
...room_data,
|
|
761
|
-
active_bracket_id: data.bracket_id
|
|
762
|
-
})
|
|
763
|
-
}}
|
|
764
|
-
onEnterCompetition={(result) => {
|
|
765
|
-
setMyData({
|
|
766
|
-
...my_data,
|
|
767
|
-
competition_player_brackets: competition_player_brackets.filter(cpb => cpb.competition_player_bracket_id != result.competition_player_bracket.competition_player_bracket_id).concat(result.competition_player_bracket)
|
|
768
|
-
})
|
|
769
|
-
}}
|
|
770
|
-
onLeaveCompetition={(result) => {
|
|
771
|
-
setMyData({
|
|
772
|
-
...my_data,
|
|
773
|
-
competition_player_brackets: competition_player_brackets.filter(cpb => cpb.competition_player_bracket_id != result.competition_player_bracket.competition_player_bracket_id)
|
|
774
|
-
})
|
|
775
|
-
}}
|
|
776
|
-
onShareCompetition={onShareCompetition}
|
|
777
|
-
onViewBracket={(bracket_id) => {
|
|
778
|
-
const cpb = competition_player_brackets.find(cpb => cpb.bracket_competition_id == active_competition_id);
|
|
779
|
-
let my_pb = visible_player_brackets.find(pb => pb.player_bracket_id == cpb?.player_bracket_id);
|
|
780
|
-
if(!my_pb){
|
|
781
|
-
my_pb = visible_player_brackets.find(pb => pb.bracket_id == bracket_id);
|
|
782
|
-
}
|
|
783
|
-
setData({
|
|
784
|
-
...room_data,
|
|
785
|
-
active_view: 'play_bracket',
|
|
786
|
-
active_bracket_id: bracket_id,
|
|
787
|
-
active_player_bracket: my_pb
|
|
788
|
-
})
|
|
789
|
-
}}
|
|
790
|
-
my_comp_player_brackets={competition_player_brackets.filter(cpb => cpb.bracket_competition_id == active_competition_id)}
|
|
791
|
-
my_player_brackets={visible_player_brackets.filter(pb => pb.bracket_id == active_bracket_id)}
|
|
792
|
-
onClose={() => setData({ ...room_data, active_view: 'select_competition', active_competition_id:undefined })}
|
|
793
|
-
visible={active_view == 'competition' ? true : false}
|
|
794
|
-
/>
|
|
795
|
-
<PlayerBracketManager
|
|
796
|
-
visible={active_view == 'manage_bracket' ? true : false}
|
|
797
|
-
player_bracket={active_player_bracket}
|
|
798
|
-
width={room_size.width}
|
|
799
|
-
teams={champion_teams}
|
|
800
|
-
athletes={champion_athletes}
|
|
801
|
-
onEditPicks={(pb) => {
|
|
802
|
-
setData({ ...room_data, active_player_bracket: pb, active_view: 'play_bracket' })
|
|
803
|
-
}}
|
|
804
|
-
competition_player_brackets={competition_player_brackets.filter(cpb => cpb.player_bracket_id == active_player_bracket?.player_bracket_id)}
|
|
805
|
-
onSelectCompetition={(bc) => {
|
|
806
|
-
setData({ ...room_data, active_view:'competition', active_competition_id: bc.bracket_competition_id })
|
|
807
|
-
}}
|
|
808
|
-
bracket_competitions={bracket_competitions.filter(bc => bc.bracket_id == active_player_bracket?.bracket_id)}
|
|
809
|
-
onClose={() => setData({ ...room_data, active_view: 'select_player_bracket' })}
|
|
810
|
-
onUpdateBracket={(pb) => {
|
|
811
|
-
setMyData({ ...my_data, player_brackets: player_brackets.filter(b => b.player_bracket_id != pb.player_bracket_id).concat(pb).sort((a,b) => moment(a.create_datetime).unix() - moment(b.create_datetime).unix()) })
|
|
812
|
-
setData({ ...room_data, active_player_bracket: pb })
|
|
813
|
-
}}
|
|
814
|
-
/>
|
|
815
|
-
<BracketPlay
|
|
816
|
-
visible={active_view == 'play_bracket' ? true : false}
|
|
817
|
-
player={player}
|
|
818
|
-
onClose={() => {
|
|
819
|
-
if(active_competition_id){ return setData({ ...room_data, active_view: 'competition' }) }
|
|
820
|
-
setData({ ...room_data, active_view:'select_bracket' })
|
|
821
|
-
}}
|
|
822
|
-
onRequestAuthenticate={onRequestAuthenticate}
|
|
823
|
-
onChangePlayerBracket={() => {
|
|
824
|
-
setData({
|
|
825
|
-
...room_data,
|
|
826
|
-
active_view: 'select_player_bracket'
|
|
827
|
-
})
|
|
828
|
-
}}
|
|
829
|
-
onPlayerBracketUpdate={(pb, ncpbs) => {
|
|
830
|
-
setData({ ...room_data, active_player_bracket:pb })
|
|
831
|
-
setMyData({
|
|
832
|
-
...my_data,
|
|
833
|
-
player_brackets: player_brackets.filter(opb => opb.player_bracket_id != pb.player_bracket_id).concat(pb),
|
|
834
|
-
competition_player_brackets: competition_player_brackets.filter(cpb => !ncpbs.find(ncpb => ncpb.competition_player_bracket_id == cpb.competition_player_bracket_id)).concat(ncpbs)
|
|
835
|
-
})
|
|
836
|
-
}}
|
|
837
|
-
bracket_id={active_bracket_id}
|
|
838
|
-
room_size={room_size}
|
|
839
|
-
player_bracket_id={active_player_bracket?.player_bracket_id}
|
|
840
|
-
/>
|
|
841
|
-
*/
|
|
@@ -7,9 +7,10 @@ type SwitchProps = {
|
|
|
7
7
|
value: boolean,
|
|
8
8
|
switch_type: 'binary' | 'on_off',
|
|
9
9
|
disabled?:boolean,
|
|
10
|
+
size?:number,
|
|
10
11
|
onChange:(value:boolean) => void
|
|
11
12
|
}
|
|
12
|
-
const Switch = ({ value, disabled, switch_type, onChange }:SwitchProps) => {
|
|
13
|
+
const Switch = ({ value, disabled, size, switch_type, onChange }:SwitchProps) => {
|
|
13
14
|
|
|
14
15
|
const handleChange = () => {
|
|
15
16
|
if(onChange){
|
|
@@ -17,20 +18,24 @@ const Switch = ({ value, disabled, switch_type, onChange }:SwitchProps) => {
|
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
|
|
21
|
+
const dot_size = size ?? 18
|
|
22
|
+
const switch_size = dot_size + 6
|
|
23
|
+
const switch_width = switch_size * 2
|
|
24
|
+
|
|
20
25
|
return (
|
|
21
26
|
<View style={{ flexDirection:'row', alignItems:'flex-start' }}>
|
|
22
27
|
{switch_type == 'on_off' ?
|
|
23
28
|
<TouchableOpacity
|
|
24
29
|
disabled={disabled}
|
|
25
|
-
style={{flexDirection:'row', justifyContent:'space-between', alignItems:'center', backgroundColor:value?Colors.highlights.highlight400:Colors.brand.slate, padding:3, borderRadius:12, width:
|
|
30
|
+
style={{flexDirection:'row', justifyContent:'space-between', alignItems:'center', backgroundColor:value?Colors.highlights.highlight400:Colors.brand.slate, padding:3, borderRadius:12, width:switch_width,height:switch_size}} onPress={() => handleChange()}>
|
|
26
31
|
{ value ?
|
|
27
32
|
<>
|
|
28
33
|
<View />
|
|
29
|
-
<View style={{ borderRadius:100, width:
|
|
34
|
+
<View style={{ borderRadius:100, width:dot_size, height:dot_size, backgroundColor:Colors.shades.white}} />
|
|
30
35
|
</>
|
|
31
36
|
:
|
|
32
37
|
<>
|
|
33
|
-
<View style={{ borderRadius:100, width:
|
|
38
|
+
<View style={{ borderRadius:100, width:dot_size, height:dot_size, backgroundColor:Colors.shades.white}} />
|
|
34
39
|
<View/>
|
|
35
40
|
</>
|
|
36
41
|
}
|
|
@@ -38,15 +43,15 @@ const Switch = ({ value, disabled, switch_type, onChange }:SwitchProps) => {
|
|
|
38
43
|
:
|
|
39
44
|
<TouchableOpacity
|
|
40
45
|
disabled={disabled}
|
|
41
|
-
style={{flexDirection:'row', justifyContent:'space-between', alignItems:'center', backgroundColor:Colors.shades.white, padding:3, borderRadius:12, width:
|
|
46
|
+
style={{flexDirection:'row', justifyContent:'space-between', alignItems:'center', backgroundColor:Colors.shades.white, padding:3, borderRadius:12, width:switch_width,height:switch_size}} onPress={() => handleChange()}>
|
|
42
47
|
{ value ?
|
|
43
48
|
<>
|
|
44
49
|
<View />
|
|
45
|
-
<View style={{ borderRadius:100, width:
|
|
50
|
+
<View style={{ borderRadius:100, width:dot_size, height:dot_size, backgroundColor:Colors.highlights.highlight400}} />
|
|
46
51
|
</>
|
|
47
52
|
:
|
|
48
53
|
<>
|
|
49
|
-
<View style={{ borderRadius:100, width:
|
|
54
|
+
<View style={{ borderRadius:100, width:dot_size, height:dot_size, backgroundColor:Colors.highlights.highlight400}} />
|
|
50
55
|
<View />
|
|
51
56
|
</>
|
|
52
57
|
}
|
package/src/index.tsx
CHANGED
|
@@ -38,13 +38,14 @@ import BracketCompetitionCard from './Engage/components/BracketCompetitionCard';
|
|
|
38
38
|
import SeasonCard from './Engage/components/SeasonCard';
|
|
39
39
|
import NotificationModule from './Notifications';
|
|
40
40
|
import { useNotifications } from './Notifications/useNotifications';
|
|
41
|
-
|
|
41
|
+
import ManageBracketCompetitionForm from './Bracket/components/ManageBracketCompetitionForm';
|
|
42
42
|
export {
|
|
43
43
|
Authenticator,
|
|
44
44
|
Observer,
|
|
45
45
|
BEEventApi,
|
|
46
46
|
BELinkApi,
|
|
47
47
|
LocationTracker,
|
|
48
|
+
ManageBracketCompetitionForm,
|
|
48
49
|
NotificationModule,
|
|
49
50
|
useNotifications,
|
|
50
51
|
ProfileManager,
|