be-components 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/lib/commonjs/Bracket/api/index.js +9 -1
  2. package/lib/commonjs/Bracket/api/index.js.map +1 -1
  3. package/lib/commonjs/Bracket/components/BracketCompetitionCard.js +60 -10
  4. package/lib/commonjs/Bracket/components/BracketCompetitionCard.js.map +1 -1
  5. package/lib/commonjs/Bracket/components/BracketCompetitionSelector.js +10 -2
  6. package/lib/commonjs/Bracket/components/BracketCompetitionSelector.js.map +1 -1
  7. package/lib/commonjs/Bracket/components/BracketPlay/index.js +15 -4
  8. package/lib/commonjs/Bracket/components/BracketPlay/index.js.map +1 -1
  9. package/lib/commonjs/Bracket/components/BracketSelector.js +11 -3
  10. package/lib/commonjs/Bracket/components/BracketSelector.js.map +1 -1
  11. package/lib/commonjs/Bracket/components/CompetitionLeaderboard.js +34 -7
  12. package/lib/commonjs/Bracket/components/CompetitionLeaderboard.js.map +1 -1
  13. package/lib/commonjs/Bracket/components/JoinCompetitionCard.js +34 -4
  14. package/lib/commonjs/Bracket/components/JoinCompetitionCard.js.map +1 -1
  15. package/lib/commonjs/Bracket/components/PlayerBracketManager.js +11 -3
  16. package/lib/commonjs/Bracket/components/PlayerBracketManager.js.map +1 -1
  17. package/lib/commonjs/Bracket/components/PlayerBrackets.js +10 -2
  18. package/lib/commonjs/Bracket/components/PlayerBrackets.js.map +1 -1
  19. package/lib/commonjs/Bracket/index.js +0 -2
  20. package/lib/commonjs/Bracket/index.js.map +1 -1
  21. package/lib/module/Bracket/api/index.js +9 -1
  22. package/lib/module/Bracket/api/index.js.map +1 -1
  23. package/lib/module/Bracket/components/BracketCompetitionCard.js +61 -11
  24. package/lib/module/Bracket/components/BracketCompetitionCard.js.map +1 -1
  25. package/lib/module/Bracket/components/BracketCompetitionSelector.js +11 -3
  26. package/lib/module/Bracket/components/BracketCompetitionSelector.js.map +1 -1
  27. package/lib/module/Bracket/components/BracketPlay/index.js +15 -4
  28. package/lib/module/Bracket/components/BracketPlay/index.js.map +1 -1
  29. package/lib/module/Bracket/components/BracketSelector.js +12 -4
  30. package/lib/module/Bracket/components/BracketSelector.js.map +1 -1
  31. package/lib/module/Bracket/components/CompetitionLeaderboard.js +35 -8
  32. package/lib/module/Bracket/components/CompetitionLeaderboard.js.map +1 -1
  33. package/lib/module/Bracket/components/JoinCompetitionCard.js +34 -6
  34. package/lib/module/Bracket/components/JoinCompetitionCard.js.map +1 -1
  35. package/lib/module/Bracket/components/PlayerBracketManager.js +12 -4
  36. package/lib/module/Bracket/components/PlayerBracketManager.js.map +1 -1
  37. package/lib/module/Bracket/components/PlayerBrackets.js +11 -3
  38. package/lib/module/Bracket/components/PlayerBrackets.js.map +1 -1
  39. package/lib/module/Bracket/index.js +0 -2
  40. package/lib/module/Bracket/index.js.map +1 -1
  41. package/lib/typescript/src/Bracket/api/index.d.ts +1 -0
  42. package/lib/typescript/src/Bracket/api/index.d.ts.map +1 -1
  43. package/lib/typescript/src/Bracket/components/BracketCompetitionCard.d.ts.map +1 -1
  44. package/lib/typescript/src/Bracket/components/BracketCompetitionSelector.d.ts.map +1 -1
  45. package/lib/typescript/src/Bracket/components/BracketPlay/index.d.ts.map +1 -1
  46. package/lib/typescript/src/Bracket/components/BracketSelector.d.ts.map +1 -1
  47. package/lib/typescript/src/Bracket/components/CompetitionLeaderboard.d.ts.map +1 -1
  48. package/lib/typescript/src/Bracket/components/JoinCompetitionCard.d.ts.map +1 -1
  49. package/lib/typescript/src/Bracket/components/PlayerBracketManager.d.ts.map +1 -1
  50. package/lib/typescript/src/Bracket/index.d.ts.map +1 -1
  51. package/package.json +1 -1
  52. package/src/Bracket/api/index.ts +5 -1
  53. package/src/Bracket/components/BracketCompetitionCard.tsx +33 -11
  54. package/src/Bracket/components/BracketCompetitionSelector.tsx +5 -4
  55. package/src/Bracket/components/BracketPlay/index.tsx +11 -8
  56. package/src/Bracket/components/BracketSelector.tsx +9 -7
  57. package/src/Bracket/components/CompetitionLeaderboard.tsx +28 -7
  58. package/src/Bracket/components/JoinCompetitionCard.tsx +13 -6
  59. package/src/Bracket/components/PlayerBracketManager.tsx +5 -2
  60. package/src/Bracket/components/PlayerBrackets.tsx +4 -4
  61. package/src/Bracket/index.tsx +0 -2
@@ -1,10 +1,11 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { FlatList, View, TouchableOpacity, Image } from 'react-native';
2
+ import { FlatList, View, TouchableOpacity, Image, ScrollView, ActivityIndicator } from 'react-native';
3
3
  import type { AthleteProps, CompetitionPlayerBracketProps, PlayerBracketProps, PublicPlayerProps, TeamProps } from '../../types';
4
4
  import { BracketApi, BracketComeptitionApi } from '../api';
5
5
  import Colors from '../../constants/colors';
6
6
  import { Button, Text } from '../../Components';
7
7
  import { CompetitionHelpers } from '../../Competition/api';
8
+ import { view_styles } from '../../constants/styles';
8
9
 
9
10
  type CompetitionLeaderboardProps = {
10
11
  bracket_competition_id:string,
@@ -34,7 +35,7 @@ const CompetitionLeaderboard = ({ bracket_competition_id, my_competition_player_
34
35
  player_brackets:[],
35
36
  players:[]
36
37
  })
37
- const { competition_player_brackets, players, player_brackets, teams, athletes } = leaders_data;
38
+ const { loading, offset, competition_player_brackets, players, player_brackets, teams, athletes } = leaders_data;
38
39
 
39
40
  let visible_leaders = competition_player_brackets.sort((a,b) => a.place - b.place);
40
41
  if(view_mode == 'short'){ visible_leaders = competition_player_brackets.slice(0, 3) }
@@ -59,6 +60,7 @@ const CompetitionLeaderboard = ({ bracket_competition_id, my_competition_player_
59
60
  competition_player_brackets: resp.competition_player_brackets,
60
61
  player_brackets: resp.player_brackets.filter(pb => !my_player_brackets.find(mpb => mpb.player_bracket_id == pb.player_bracket_id)).concat(my_player_brackets),
61
62
  teams:ts,
63
+ offset: page,
62
64
  athletes: aths,
63
65
  players: ps
64
66
  })
@@ -72,7 +74,7 @@ const CompetitionLeaderboard = ({ bracket_competition_id, my_competition_player_
72
74
  if(show_champions && player_bracket.champion_id_type == 'team'){ champ_team = teams.find(t => t.team_id == player_bracket.champion_id) }
73
75
  if(show_champions && player_bracket.champion_id_type == 'athlete'){ champ_athlete = athletes.find(t => t.athlete_id == player_bracket.champion_id) }
74
76
  return (
75
- <TouchableOpacity style={{ flexDirection:'row', alignItems:'center', borderRadius:22, borderTopLeftRadius:4, borderBottomLeftRadius:4, margin:3, backgroundColor:Colors.shades.white, padding:4 }}>
77
+ <TouchableOpacity style={{ flexDirection:'row', alignItems:'center', borderRadius:22, margin:6, backgroundColor:Colors.shades.white, padding:4 }}>
76
78
  <View style={{ padding:5 }}>
77
79
  <Text size={14} color={Colors.brand.midnight} weight='bold'>{CompetitionHelpers.formatPlace(data.item.place)}</Text>
78
80
  </View>
@@ -113,7 +115,7 @@ const CompetitionLeaderboard = ({ bracket_competition_id, my_competition_player_
113
115
 
114
116
  return (
115
117
  <View style={{ flex:1 }}>
116
- <View style={{ flex:1 }}>
118
+ <ScrollView style={{ flex:1 }}>
117
119
  {my_competition_player_brackets.length > 0 ?
118
120
  <View style={{ backgroundColor:Colors.brand.midnight, padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
119
121
  <View style={{ marginBottom:5 }}>
@@ -130,11 +132,14 @@ const CompetitionLeaderboard = ({ bracket_competition_id, my_competition_player_
130
132
  <View style={{ marginBottom:5 }}>
131
133
  <Text size={14} color={Colors.brand.midnight}>RESULTS</Text>
132
134
  </View>
135
+ {loading ?
136
+ <ActivityIndicator size='large' color={Colors.brand.midnight} style={{ padding:25, alignSelf:'center' }} />
137
+ :
133
138
  <FlatList
134
139
  data={visible_leaders}
135
140
  renderItem={renderLeaders}
136
141
  keyExtractor={(item) => item.competition_player_bracket_id.toString()}
137
- />
142
+ />}
138
143
  </View>
139
144
  {view_mode == 'short' && onViewFull ?
140
145
  <View style={{ padding:10 }}>
@@ -146,9 +151,25 @@ const CompetitionLeaderboard = ({ bracket_competition_id, my_competition_player_
146
151
  />
147
152
  </View>
148
153
  :<></>}
149
- </View>
154
+ </ScrollView>
150
155
  {onClose ?
151
- <View style={{ padding:10 }}>
156
+ <View style={{ padding:10, ...view_styles.float }}>
157
+ <View style={{ padding:10, flexDirection:'row', alignItems:'center', justifyContent:'space-between' }}>
158
+ {offset > 0 ?
159
+ <Button
160
+ title='PREV'
161
+ title_color={Colors.brand.electric}
162
+ backgroundColor='transparent'
163
+ onPress={() => getLeaders(bracket_competition_id, offset - 1)}
164
+ />
165
+ :<View/>}
166
+ <Button
167
+ title='NEXT'
168
+ title_color={Colors.brand.electric}
169
+ backgroundColor='transparent'
170
+ onPress={() => getLeaders(bracket_competition_id, offset + 1)}
171
+ />
172
+ </View>
152
173
  <Button
153
174
  title='Close'
154
175
  style={{ padding:15 }}
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
- import { View, Image } from "react-native";
3
- import { Button, Text } from '../../Components';
1
+ import React, { useState } from 'react';
2
+ import { View, Image, TouchableOpacity, Linking } from "react-native";
3
+ import { Button, Checkbox, Text } from '../../Components';
4
4
  import type { BracketCompetitionProps, CompetitionPlayerBracketProps, MyPlayerProps, PlayerBalanceProps, PlayerBracketProps } from '../../types';
5
5
  import { BracketCompetitionHelpers } from '../api';
6
6
  import Colors from '../../constants/colors';
@@ -18,7 +18,8 @@ type JoinCompetitionCardProps = {
18
18
  }
19
19
 
20
20
  const JoinCompetitionCard = ({ player, player_balance, loading, player_bracket, bracket_competition, onNotEnoughBalance, onEnterCompetition, onClose }:JoinCompetitionCardProps) => {
21
-
21
+ const [ disclaimed, setDisclaimed ] = useState(true);
22
+
22
23
  const buy_in_label = BracketCompetitionHelpers.getBuyInTitle(bracket_competition)
23
24
 
24
25
  const handleEnter = () => {
@@ -54,6 +55,12 @@ const JoinCompetitionCard = ({ player, player_balance, loading, player_bracket,
54
55
  <Text style={{ marginTop:3 }} size={12} color={Colors.brand.slate} weight='regular'>{(player_bracket.completion_pct*100).toFixed(2)}% Complete</Text>
55
56
  </View>
56
57
  </View>
58
+ {bracket_competition.opt_in_url ?
59
+ <TouchableOpacity style={{ flexDirection:'row', alignItems:'center', padding:20, backgroundColor:Colors.shades.shade100 }} onPress={() => setDisclaimed(!disclaimed)}>
60
+ <Checkbox size={24} checked={disclaimed} disabled onSelect={() => console.log('')}/>
61
+ <Text color={Colors.brand.midnight} weight='regular' size={14} style={{ flex:1, marginLeft:10 }}>I agree to the terms and conditiions outlined <TouchableOpacity onPress={() => Linking.openURL(bracket_competition.opt_in_url??'')}><Text size={14} color={Colors.brand.electric} weight='bold'>HERE</Text></TouchableOpacity></Text>
62
+ </TouchableOpacity>
63
+ :<></>}
57
64
  <View style={{ flexDirection:'row', alignItems:'center', padding:10, backgroundColor:Colors.shades.shade100, borderBottomRightRadius:8, borderBottomLeftRadius:8 }}>
58
65
  <Button
59
66
  title='Close'
@@ -66,8 +73,8 @@ const JoinCompetitionCard = ({ player, player_balance, loading, player_bracket,
66
73
  />
67
74
  <Button
68
75
  title={buy_in_label}
69
- disabled={loading}
70
- style={{ flex:2, opacity: loading?0.5:1 }}
76
+ disabled={loading || !disclaimed}
77
+ style={{ flex:2, opacity: !disclaimed||loading?0.5:1 }}
71
78
  loading={loading}
72
79
  padding={15}
73
80
  title_color={Colors.shades.white}
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { View, TouchableOpacity, FlatList, Image } from "react-native";
2
+ import { View, TouchableOpacity, FlatList, Image, ScrollView } from "react-native";
3
3
  import type { AthleteProps, BracketCompetitionProps, CompetitionPlayerBracketProps, PlayerBracketProps, TeamProps } from '../../types';
4
4
  import Colors from '../../constants/colors';
5
5
  import { Button, Icons, Text, TextInput } from '../../Components';
@@ -109,7 +109,7 @@ const PlayerBracketManager = ({ visible, teams, athletes, player_bracket, bracke
109
109
  const can_delete = BracketCompetitionHelpers.canDeletePlayerBracket(player_bracket, competition_player_brackets)
110
110
 
111
111
  return (
112
- <View>
112
+ <View style={{ flex:1 }}>
113
113
  <TouchableOpacity style={{ flexDirection:'row', alignItems:'center', padding:20, borderBottomWidth:1, borderColor:Colors.shades.shade100 }} onPress={() => onClose()}>
114
114
  <Icons.ChevronIcon direction='left' size={12} color={Colors.brand.midnight} />
115
115
  <View style={{ flex:1, marginLeft:20 }}>
@@ -117,6 +117,8 @@ const PlayerBracketManager = ({ visible, teams, athletes, player_bracket, bracke
117
117
  <Text style={{ marginTop:4 }} size={14} color={Colors.brand.slate} weight='regular'>Manage your bracket and enter competitions</Text>
118
118
  </View>
119
119
  </TouchableOpacity>
120
+ <ScrollView style={{ flex:1}}>
121
+
120
122
  <View nativeID='bracket_info'>
121
123
  <TouchableOpacity style={{ padding:20, flexDirection:'row', alignItems:'center', backgroundColor:Colors.shades.shade100 }} onPress={() => setInfoExpanded(!info_expanded)}>
122
124
  <Text style={{flex:1}} size={16} color={Colors.brand.midnight} weight='bold'>Bracket Details</Text>
@@ -268,6 +270,7 @@ const PlayerBracketManager = ({ visible, teams, athletes, player_bracket, bracke
268
270
  </View>
269
271
  </View>
270
272
  :<></>}
273
+ </ScrollView>
271
274
  </View>
272
275
  )
273
276
  }
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { View, FlatList, TouchableOpacity, Image } from "react-native"
2
+ import { View, FlatList, TouchableOpacity, Image, ScrollView } from "react-native"
3
3
  import type { AthleteProps, BracketCompetitionProps, BracketProps, CompetitionPlayerBracketProps, LeagueProps, PlayerBracketProps, TeamProps } from '../../types';
4
4
  import { Button, Icons, Text } from '../../Components';
5
5
  import Colors from '../../constants/colors';
@@ -97,7 +97,7 @@ const PlayerBracketSelector = ({ visible, brackets, leagues, teams, athletes, pl
97
97
  if(!visible){ return <></> }
98
98
 
99
99
  return (
100
- <View>
100
+ <View style={{ flex:1 }}>
101
101
  <TouchableOpacity style={{ flexDirection:'row', alignItems:'center', padding:20, borderBottomWidth:1, borderColor:Colors.shades.shade100 }} onPress={() => onClose()}>
102
102
  <Icons.ChevronIcon direction='left' size={12} color={Colors.brand.midnight} />
103
103
  <View style={{ flex:1, marginLeft:20 }}>
@@ -105,13 +105,13 @@ const PlayerBracketSelector = ({ visible, brackets, leagues, teams, athletes, pl
105
105
  <Text style={{ marginTop:4 }} size={14} color={Colors.brand.slate} weight='regular'>Select a filled bracket below to manage it</Text>
106
106
  </View>
107
107
  </TouchableOpacity>
108
- <View>
108
+ <ScrollView style={{flex:1}}>
109
109
  <FlatList
110
110
  data={unique_bracket_ids}
111
111
  renderItem={renderBrackets}
112
112
  keyExtractor={(item) => item.toString()}
113
113
  />
114
- </View>
114
+ </ScrollView>
115
115
  </View>
116
116
  )
117
117
  }
@@ -194,8 +194,6 @@ const BracketRoom = ({ player_id, bracket_id, bracket_competition_id, player_bal
194
194
  competition_result_types={competition_result_types}
195
195
  height={room_size.height}
196
196
  onUpdateMyData={(data) => {
197
- console.log('updating data')
198
- console.log(data)
199
197
 
200
198
  setMyData({
201
199
  ...my_data,