be-components 1.4.8 → 1.5.0

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 (199) hide show
  1. package/lib/commonjs/Competition/api/index.js +15 -0
  2. package/lib/commonjs/Competition/api/index.js.map +1 -1
  3. package/lib/commonjs/Competition/components/CompetitionSeasonCard.js +1 -1
  4. package/lib/commonjs/Competition/components/CompetitionSeasonCard.js.map +1 -1
  5. package/lib/commonjs/Competition/components/SeasonCard.js +61 -0
  6. package/lib/commonjs/Competition/components/SeasonCard.js.map +1 -0
  7. package/lib/commonjs/Competition/index.js +23 -3
  8. package/lib/commonjs/Competition/index.js.map +1 -1
  9. package/lib/commonjs/CompetitionManager/api/index.js +3 -5
  10. package/lib/commonjs/CompetitionManager/api/index.js.map +1 -1
  11. package/lib/commonjs/CompetitionManager/components/CompetitionInfoForm.js +1 -61
  12. package/lib/commonjs/CompetitionManager/components/CompetitionInfoForm.js.map +1 -1
  13. package/lib/commonjs/CompetitionManager/components/CompetitionSettingsForm.js +6 -1
  14. package/lib/commonjs/CompetitionManager/components/CompetitionSettingsForm.js.map +1 -1
  15. package/lib/commonjs/CompetitionManager/components/ContestSettingsForm.js +4 -0
  16. package/lib/commonjs/CompetitionManager/components/ContestSettingsForm.js.map +1 -1
  17. package/lib/commonjs/CompetitionManager/components/CreateCompetitionForm.js +37 -3
  18. package/lib/commonjs/CompetitionManager/components/CreateCompetitionForm.js.map +1 -1
  19. package/lib/commonjs/CompetitionSeason/api/index.js +134 -0
  20. package/lib/commonjs/CompetitionSeason/api/index.js.map +1 -0
  21. package/lib/commonjs/CompetitionSeason/components/CompetitionsSection.js +127 -0
  22. package/lib/commonjs/CompetitionSeason/components/CompetitionsSection.js.map +1 -0
  23. package/lib/commonjs/CompetitionSeason/components/EnterSeasonPrompt.js +253 -0
  24. package/lib/commonjs/CompetitionSeason/components/EnterSeasonPrompt.js.map +1 -0
  25. package/lib/commonjs/CompetitionSeason/components/SeasonHeader.js +126 -0
  26. package/lib/commonjs/CompetitionSeason/components/SeasonHeader.js.map +1 -0
  27. package/lib/commonjs/CompetitionSeason/components/SeasonLeaderboard.js +324 -0
  28. package/lib/commonjs/CompetitionSeason/components/SeasonLeaderboard.js.map +1 -0
  29. package/lib/commonjs/CompetitionSeason/components/SeasonSettingsSection.js +175 -0
  30. package/lib/commonjs/CompetitionSeason/components/SeasonSettingsSection.js.map +1 -0
  31. package/lib/commonjs/CompetitionSeason/index.js +278 -0
  32. package/lib/commonjs/CompetitionSeason/index.js.map +1 -0
  33. package/lib/commonjs/CompetitionSeasonManager/api/index.js +182 -0
  34. package/lib/commonjs/CompetitionSeasonManager/api/index.js.map +1 -0
  35. package/lib/commonjs/CompetitionSeasonManager/components/CompetitionSelector.js +2 -0
  36. package/lib/commonjs/CompetitionSeasonManager/components/CompetitionSelector.js.map +1 -0
  37. package/lib/commonjs/CompetitionSeasonManager/components/CompetitionsForm.js +153 -0
  38. package/lib/commonjs/CompetitionSeasonManager/components/CompetitionsForm.js.map +1 -0
  39. package/lib/commonjs/CompetitionSeasonManager/components/CreateSeasonForm.js +388 -0
  40. package/lib/commonjs/CompetitionSeasonManager/components/CreateSeasonForm.js.map +1 -0
  41. package/lib/commonjs/CompetitionSeasonManager/components/SeasonHeader.js +108 -0
  42. package/lib/commonjs/CompetitionSeasonManager/components/SeasonHeader.js.map +1 -0
  43. package/lib/commonjs/CompetitionSeasonManager/components/SeasonInfoForm.js +242 -0
  44. package/lib/commonjs/CompetitionSeasonManager/components/SeasonInfoForm.js.map +1 -0
  45. package/lib/commonjs/CompetitionSeasonManager/components/SeasonSettingsForm.js +352 -0
  46. package/lib/commonjs/CompetitionSeasonManager/components/SeasonSettingsForm.js.map +1 -0
  47. package/lib/commonjs/CompetitionSeasonManager/index.js +190 -0
  48. package/lib/commonjs/CompetitionSeasonManager/index.js.map +1 -0
  49. package/lib/commonjs/Components/Switch.js +3 -0
  50. package/lib/commonjs/Components/Switch.js.map +1 -1
  51. package/lib/commonjs/Engage/index.js +28 -1
  52. package/lib/commonjs/Engage/index.js.map +1 -1
  53. package/lib/commonjs/index.js +14 -0
  54. package/lib/commonjs/index.js.map +1 -1
  55. package/lib/module/Competition/api/index.js +15 -0
  56. package/lib/module/Competition/api/index.js.map +1 -1
  57. package/lib/module/Competition/components/CompetitionSeasonCard.js +1 -1
  58. package/lib/module/Competition/components/CompetitionSeasonCard.js.map +1 -1
  59. package/lib/module/Competition/components/SeasonCard.js +54 -0
  60. package/lib/module/Competition/components/SeasonCard.js.map +1 -0
  61. package/lib/module/Competition/index.js +23 -3
  62. package/lib/module/Competition/index.js.map +1 -1
  63. package/lib/module/CompetitionManager/api/index.js +3 -5
  64. package/lib/module/CompetitionManager/api/index.js.map +1 -1
  65. package/lib/module/CompetitionManager/components/CompetitionInfoForm.js +1 -63
  66. package/lib/module/CompetitionManager/components/CompetitionInfoForm.js.map +1 -1
  67. package/lib/module/CompetitionManager/components/CompetitionSettingsForm.js +6 -1
  68. package/lib/module/CompetitionManager/components/CompetitionSettingsForm.js.map +1 -1
  69. package/lib/module/CompetitionManager/components/ContestSettingsForm.js +4 -0
  70. package/lib/module/CompetitionManager/components/ContestSettingsForm.js.map +1 -1
  71. package/lib/module/CompetitionManager/components/CreateCompetitionForm.js +37 -3
  72. package/lib/module/CompetitionManager/components/CreateCompetitionForm.js.map +1 -1
  73. package/lib/module/CompetitionSeason/api/index.js +128 -0
  74. package/lib/module/CompetitionSeason/api/index.js.map +1 -0
  75. package/lib/module/CompetitionSeason/components/CompetitionsSection.js +118 -0
  76. package/lib/module/CompetitionSeason/components/CompetitionsSection.js.map +1 -0
  77. package/lib/module/CompetitionSeason/components/EnterSeasonPrompt.js +244 -0
  78. package/lib/module/CompetitionSeason/components/EnterSeasonPrompt.js.map +1 -0
  79. package/lib/module/CompetitionSeason/components/SeasonHeader.js +119 -0
  80. package/lib/module/CompetitionSeason/components/SeasonHeader.js.map +1 -0
  81. package/lib/module/CompetitionSeason/components/SeasonLeaderboard.js +315 -0
  82. package/lib/module/CompetitionSeason/components/SeasonLeaderboard.js.map +1 -0
  83. package/lib/module/CompetitionSeason/components/SeasonSettingsSection.js +166 -0
  84. package/lib/module/CompetitionSeason/components/SeasonSettingsSection.js.map +1 -0
  85. package/lib/module/CompetitionSeason/index.js +269 -0
  86. package/lib/module/CompetitionSeason/index.js.map +1 -0
  87. package/lib/module/CompetitionSeasonManager/api/index.js +176 -0
  88. package/lib/module/CompetitionSeasonManager/api/index.js.map +1 -0
  89. package/lib/module/CompetitionSeasonManager/components/CompetitionSelector.js +2 -0
  90. package/lib/module/CompetitionSeasonManager/components/CompetitionSelector.js.map +1 -0
  91. package/lib/module/CompetitionSeasonManager/components/CompetitionsForm.js +144 -0
  92. package/lib/module/CompetitionSeasonManager/components/CompetitionsForm.js.map +1 -0
  93. package/lib/module/CompetitionSeasonManager/components/CreateSeasonForm.js +379 -0
  94. package/lib/module/CompetitionSeasonManager/components/CreateSeasonForm.js.map +1 -0
  95. package/lib/module/CompetitionSeasonManager/components/SeasonHeader.js +101 -0
  96. package/lib/module/CompetitionSeasonManager/components/SeasonHeader.js.map +1 -0
  97. package/lib/module/CompetitionSeasonManager/components/SeasonInfoForm.js +233 -0
  98. package/lib/module/CompetitionSeasonManager/components/SeasonInfoForm.js.map +1 -0
  99. package/lib/module/CompetitionSeasonManager/components/SeasonSettingsForm.js +343 -0
  100. package/lib/module/CompetitionSeasonManager/components/SeasonSettingsForm.js.map +1 -0
  101. package/lib/module/CompetitionSeasonManager/index.js +181 -0
  102. package/lib/module/CompetitionSeasonManager/index.js.map +1 -0
  103. package/lib/module/Components/Switch.js +3 -0
  104. package/lib/module/Components/Switch.js.map +1 -1
  105. package/lib/module/Engage/index.js +28 -1
  106. package/lib/module/Engage/index.js.map +1 -1
  107. package/lib/module/index.js +3 -1
  108. package/lib/module/index.js.map +1 -1
  109. package/lib/typescript/src/Competition/api/index.d.ts +1 -0
  110. package/lib/typescript/src/Competition/api/index.d.ts.map +1 -1
  111. package/lib/typescript/src/Competition/components/SeasonCard.d.ts +10 -0
  112. package/lib/typescript/src/Competition/components/SeasonCard.d.ts.map +1 -0
  113. package/lib/typescript/src/Competition/index.d.ts +3 -2
  114. package/lib/typescript/src/Competition/index.d.ts.map +1 -1
  115. package/lib/typescript/src/CompetitionManager/api/index.d.ts +1 -1
  116. package/lib/typescript/src/CompetitionManager/api/index.d.ts.map +1 -1
  117. package/lib/typescript/src/CompetitionManager/components/CompetitionInfoForm.d.ts.map +1 -1
  118. package/lib/typescript/src/CompetitionManager/components/CompetitionSettingsForm.d.ts.map +1 -1
  119. package/lib/typescript/src/CompetitionManager/components/ContestSettingsForm.d.ts.map +1 -1
  120. package/lib/typescript/src/CompetitionManager/components/CreateCompetitionForm.d.ts +3 -2
  121. package/lib/typescript/src/CompetitionManager/components/CreateCompetitionForm.d.ts.map +1 -1
  122. package/lib/typescript/src/CompetitionSeason/api/index.d.ts +41 -0
  123. package/lib/typescript/src/CompetitionSeason/api/index.d.ts.map +1 -0
  124. package/lib/typescript/src/CompetitionSeason/components/CompetitionsSection.d.ts +14 -0
  125. package/lib/typescript/src/CompetitionSeason/components/CompetitionsSection.d.ts.map +1 -0
  126. package/lib/typescript/src/CompetitionSeason/components/EnterSeasonPrompt.d.ts +16 -0
  127. package/lib/typescript/src/CompetitionSeason/components/EnterSeasonPrompt.d.ts.map +1 -0
  128. package/lib/typescript/src/CompetitionSeason/components/SeasonHeader.d.ts +15 -0
  129. package/lib/typescript/src/CompetitionSeason/components/SeasonHeader.d.ts.map +1 -0
  130. package/lib/typescript/src/CompetitionSeason/components/SeasonLeaderboard.d.ts +18 -0
  131. package/lib/typescript/src/CompetitionSeason/components/SeasonLeaderboard.d.ts.map +1 -0
  132. package/lib/typescript/src/CompetitionSeason/components/SeasonSettingsSection.d.ts +12 -0
  133. package/lib/typescript/src/CompetitionSeason/components/SeasonSettingsSection.d.ts.map +1 -0
  134. package/lib/typescript/src/CompetitionSeason/index.d.ts +12 -0
  135. package/lib/typescript/src/CompetitionSeason/index.d.ts.map +1 -0
  136. package/lib/typescript/src/CompetitionSeasonManager/api/index.d.ts +31 -0
  137. package/lib/typescript/src/CompetitionSeasonManager/api/index.d.ts.map +1 -0
  138. package/lib/typescript/src/CompetitionSeasonManager/components/CompetitionSelector.d.ts +1 -0
  139. package/lib/typescript/src/CompetitionSeasonManager/components/CompetitionSelector.d.ts.map +1 -0
  140. package/lib/typescript/src/CompetitionSeasonManager/components/CompetitionsForm.d.ts +12 -0
  141. package/lib/typescript/src/CompetitionSeasonManager/components/CompetitionsForm.d.ts.map +1 -0
  142. package/lib/typescript/src/CompetitionSeasonManager/components/CreateSeasonForm.d.ts +11 -0
  143. package/lib/typescript/src/CompetitionSeasonManager/components/CreateSeasonForm.d.ts.map +1 -0
  144. package/lib/typescript/src/CompetitionSeasonManager/components/SeasonHeader.d.ts +13 -0
  145. package/lib/typescript/src/CompetitionSeasonManager/components/SeasonHeader.d.ts.map +1 -0
  146. package/lib/typescript/src/CompetitionSeasonManager/components/SeasonInfoForm.d.ts +11 -0
  147. package/lib/typescript/src/CompetitionSeasonManager/components/SeasonInfoForm.d.ts.map +1 -0
  148. package/lib/typescript/src/CompetitionSeasonManager/components/SeasonSettingsForm.d.ts +12 -0
  149. package/lib/typescript/src/CompetitionSeasonManager/components/SeasonSettingsForm.d.ts.map +1 -0
  150. package/lib/typescript/src/CompetitionSeasonManager/index.d.ts +8 -0
  151. package/lib/typescript/src/CompetitionSeasonManager/index.d.ts.map +1 -0
  152. package/lib/typescript/src/Components/Switch.d.ts +2 -1
  153. package/lib/typescript/src/Components/Switch.d.ts.map +1 -1
  154. package/lib/typescript/src/Engage/index.d.ts.map +1 -1
  155. package/lib/typescript/src/index.d.ts +3 -1
  156. package/lib/typescript/src/index.d.ts.map +1 -1
  157. package/package.json +1 -1
  158. package/src/Competition/api/index.ts +15 -0
  159. package/src/Competition/components/CompetitionSeasonCard.tsx +1 -1
  160. package/src/Competition/components/SeasonCard.tsx +46 -0
  161. package/src/Competition/index.tsx +45 -27
  162. package/src/CompetitionManager/api/index.ts +2 -5
  163. package/src/CompetitionManager/components/CompetitionInfoForm.tsx +2 -64
  164. package/src/CompetitionManager/components/CompetitionSettingsForm.tsx +10 -3
  165. package/src/CompetitionManager/components/ContestSettingsForm.tsx +8 -2
  166. package/src/CompetitionManager/components/CreateCompetitionForm.tsx +20 -4
  167. package/src/CompetitionSeason/api/index.ts +111 -0
  168. package/src/CompetitionSeason/components/CompetitionsSection.tsx +99 -0
  169. package/src/CompetitionSeason/components/EnterSeasonPrompt.tsx +135 -0
  170. package/src/CompetitionSeason/components/SeasonHeader.tsx +81 -0
  171. package/src/CompetitionSeason/components/SeasonLeaderboard.tsx +205 -0
  172. package/src/CompetitionSeason/components/SeasonSettingsSection.tsx +92 -0
  173. package/src/CompetitionSeason/index.tsx +244 -0
  174. package/src/CompetitionSeasonManager/api/index.ts +127 -0
  175. package/src/CompetitionSeasonManager/components/CompetitionSelector.tsx +2 -0
  176. package/src/CompetitionSeasonManager/components/CompetitionsForm.tsx +113 -0
  177. package/src/CompetitionSeasonManager/components/CreateSeasonForm.tsx +238 -0
  178. package/src/CompetitionSeasonManager/components/SeasonHeader.tsx +75 -0
  179. package/src/CompetitionSeasonManager/components/SeasonInfoForm.tsx +124 -0
  180. package/src/CompetitionSeasonManager/components/SeasonSettingsForm.tsx +185 -0
  181. package/src/CompetitionSeasonManager/index.tsx +151 -0
  182. package/src/Components/Switch.tsx +8 -3
  183. package/src/Engage/index.tsx +20 -0
  184. package/src/index.tsx +4 -1
  185. package/src/types.d.ts +48 -5
  186. package/lib/commonjs/Competition/components/ManageSeasonForm.js +0 -605
  187. package/lib/commonjs/Competition/components/ManageSeasonForm.js.map +0 -1
  188. package/lib/commonjs/Competition/components/SeasonInfoModal.js +0 -400
  189. package/lib/commonjs/Competition/components/SeasonInfoModal.js.map +0 -1
  190. package/lib/module/Competition/components/ManageSeasonForm.js +0 -596
  191. package/lib/module/Competition/components/ManageSeasonForm.js.map +0 -1
  192. package/lib/module/Competition/components/SeasonInfoModal.js +0 -391
  193. package/lib/module/Competition/components/SeasonInfoModal.js.map +0 -1
  194. package/lib/typescript/src/Competition/components/ManageSeasonForm.d.ts +0 -10
  195. package/lib/typescript/src/Competition/components/ManageSeasonForm.d.ts.map +0 -1
  196. package/lib/typescript/src/Competition/components/SeasonInfoModal.d.ts +0 -14
  197. package/lib/typescript/src/Competition/components/SeasonInfoModal.d.ts.map +0 -1
  198. package/src/Competition/components/ManageSeasonForm.tsx +0 -271
  199. package/src/Competition/components/SeasonInfoModal.tsx +0 -212
@@ -0,0 +1,269 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { View, ActivityIndicator, ScrollView } from 'react-native';
3
+ import Colors from '../constants/colors';
4
+ import SeasonHeader from './components/SeasonHeader';
5
+ import { SeasonApi } from './api';
6
+ import CompetitionsSection from './components/CompetitionsSection';
7
+ import SeasonSettingsSection from './components/SeasonSettingsSection';
8
+ import EnterSeasonPrompt from './components/EnterSeasonPrompt';
9
+ import SeasonLeaderboard from './components/SeasonLeaderboard';
10
+ const SeasonModule = ({
11
+ competition_season_id,
12
+ player_id,
13
+ onShareSeason,
14
+ onRequestAuthenticate,
15
+ onCompetitionSelect
16
+ }) => {
17
+ const [module_size, setModuleSize] = useState({
18
+ width: 0,
19
+ height: 0
20
+ });
21
+ const [show_leaderboard, setShowLeaderboard] = useState(false);
22
+ const [show_enter, setShowEnter] = useState(false);
23
+ const [my_data, setMyData] = useState({
24
+ my_loading: false
25
+ });
26
+ const [module_data, setData] = useState({
27
+ loading: false,
28
+ action_loading: false,
29
+ competitions: [],
30
+ offset: 0,
31
+ competition_season_players: [],
32
+ competition_season_results: [],
33
+ competition_types: [],
34
+ players: [],
35
+ competition_result_types: [],
36
+ competition_payout_types: []
37
+ });
38
+ const {
39
+ action_loading,
40
+ competition_season,
41
+ competitions,
42
+ competition_season_players,
43
+ competition_season_results,
44
+ competition_types,
45
+ competition_payout_types,
46
+ competition_result_types
47
+ } = module_data;
48
+ const {
49
+ player,
50
+ player_balance
51
+ } = my_data;
52
+ useEffect(() => {
53
+ if (!competition_season_id) {
54
+ return;
55
+ }
56
+ SeasonApi.setEnvironment();
57
+ getSeasonData(competition_season_id);
58
+ }, [competition_season_id]);
59
+ useEffect(() => {
60
+ getMyDetails();
61
+ }, [player_id]);
62
+ const getMyDetails = async () => {
63
+ if (!player_id) {
64
+ return setMyData({
65
+ ...my_data,
66
+ player: undefined,
67
+ player_balance: undefined
68
+ });
69
+ }
70
+ setMyData({
71
+ ...my_data,
72
+ my_loading: true
73
+ });
74
+ let me = await SeasonApi.getMyDetails();
75
+ let pb = await SeasonApi.getMyBalance();
76
+ setMyData({
77
+ ...my_data,
78
+ my_loading: false,
79
+ player: me,
80
+ player_balance: pb
81
+ });
82
+ };
83
+ const getSeasonData = async id => {
84
+ setData({
85
+ ...module_data,
86
+ loading: true
87
+ });
88
+ const season = await SeasonApi.getSeasonById(id);
89
+ const comps = await SeasonApi.getCompetitionsBySeasonId(id);
90
+ const opts = await SeasonApi.getCompetitionOptions();
91
+ const season_player_resp = await SeasonApi.getSeasonPlayersBySeasonId(id, 0);
92
+ const players = await SeasonApi.getPlayersByPlayerIds([season.admin_id]);
93
+ let cmpny = undefined;
94
+ if (season.company_id) {
95
+ const companies = await SeasonApi.getCompaniesByIds([season.company_id]);
96
+ cmpny = companies[0];
97
+ }
98
+ setData({
99
+ ...module_data,
100
+ loading: false,
101
+ competition_season: season,
102
+ competitions: comps,
103
+ admin: players[0],
104
+ company: cmpny,
105
+ competition_payout_types: opts.competition_payout_types,
106
+ competition_result_types: opts.competition_result_types,
107
+ competition_types: opts.competition_types,
108
+ competition_season_players: season_player_resp.competition_season_players,
109
+ competition_season_results: season_player_resp.competition_season_results
110
+ });
111
+ };
112
+ const handleJoin = async () => {
113
+ if (action_loading) {
114
+ return;
115
+ } //No mashy
116
+ if (!player_id) {
117
+ return onRequestAuthenticate();
118
+ }
119
+ setData({
120
+ ...module_data,
121
+ action_loading: true
122
+ });
123
+ const resp = await SeasonApi.joinSeason(competition_season_id);
124
+ setData({
125
+ ...module_data,
126
+ action_loading: false,
127
+ competition_season: resp.competition_season,
128
+ competition_season_players: competition_season_players.filter(cp => cp.competition_season_player_id != resp.competition_season_player.competition_season_player_id).concat(resp.competition_season_player),
129
+ competition_season_results: competition_season_results.filter(cr => cr.competition_season_result_id != resp.competition_season_result.competition_season_result_id).concat(resp.competition_season_result),
130
+ competitions: competitions.filter(c => !resp.competitions.find(nc => nc.competition_id == c.competition_id)).concat(resp.competitions)
131
+ });
132
+ };
133
+ const handleLeave = async competition_season_player_id => {
134
+ if (action_loading) {
135
+ return;
136
+ }
137
+ if (!player_id) {
138
+ return onRequestAuthenticate();
139
+ }
140
+ setData({
141
+ ...module_data,
142
+ action_loading: true
143
+ });
144
+ const resp = await SeasonApi.leaveSeason(competition_season_player_id);
145
+ setData({
146
+ ...module_data,
147
+ action_loading: false,
148
+ competition_season: resp.competition_season,
149
+ competition_season_players: competition_season_players.filter(cp => cp.competition_season_player_id != resp.competition_season_player.competition_season_player_id),
150
+ competition_season_results: competition_season_results.filter(cr => cr.competition_season_result_id != resp.competition_season_result.competition_season_result_id).concat(resp.competition_season_result),
151
+ competitions: competitions.filter(c => !resp.competitions.find(nc => nc.competition_id == c.competition_id)).concat(resp.competitions)
152
+ });
153
+ };
154
+ if (!competition_season) {
155
+ return /*#__PURE__*/React.createElement(View, {
156
+ style: {
157
+ flex: 1
158
+ }
159
+ }, /*#__PURE__*/React.createElement(ActivityIndicator, {
160
+ size: "large",
161
+ style: {
162
+ padding: 20,
163
+ alignSelf: 'center'
164
+ },
165
+ color: Colors.brand.midnight
166
+ }));
167
+ }
168
+ const selected_season_type = competition_types.find(ct => ct.competition_type_id == competition_season.competition_type_id);
169
+ const selected_season_result_type = competition_result_types.find(crt => crt.competition_result_type_id == competition_season.competition_result_type_id);
170
+ const authenticated_season_player = competition_season_players.find(csp => csp.player_id == player_id);
171
+ const authenticated_season_result = competition_season_results.find(csp => csp.player_id == player_id);
172
+ return /*#__PURE__*/React.createElement(View, {
173
+ style: {
174
+ flex: 1
175
+ }
176
+ }, /*#__PURE__*/React.createElement(ScrollView, {
177
+ style: {
178
+ flex: 1
179
+ },
180
+ onLayout: ev => {
181
+ const {
182
+ width,
183
+ height
184
+ } = ev.nativeEvent.layout;
185
+ setModuleSize({
186
+ width,
187
+ height
188
+ });
189
+ }
190
+ }, /*#__PURE__*/React.createElement(SeasonHeader, {
191
+ competition_season: competition_season,
192
+ competitions: competitions,
193
+ action_loading: action_loading,
194
+ authenticated_season_player: authenticated_season_player,
195
+ onShareSeason: onShareSeason,
196
+ onJoin: () => setShowEnter(true),
197
+ onLeave: competition_season_player_id => handleLeave(competition_season_player_id)
198
+ }), selected_season_type ? /*#__PURE__*/React.createElement(SeasonLeaderboard, {
199
+ authenticated_player: player,
200
+ authenticated_season_player: authenticated_season_player,
201
+ authenticated_season_result: authenticated_season_result,
202
+ width: module_size.width,
203
+ onLeaderSelect: p => console.log(p),
204
+ view_mode: "short",
205
+ height: module_size.height,
206
+ competition_season: competition_season,
207
+ competition_type: selected_season_type,
208
+ onSeeFull: () => setShowLeaderboard(true)
209
+ }) : /*#__PURE__*/React.createElement(React.Fragment, null), selected_season_type && selected_season_result_type ? /*#__PURE__*/React.createElement(SeasonSettingsSection, {
210
+ competition_season: competition_season,
211
+ competition_result_type: selected_season_result_type,
212
+ competition_type: selected_season_type,
213
+ competition_payouts: competition_payout_types,
214
+ width: module_size.width
215
+ }) : /*#__PURE__*/React.createElement(React.Fragment, null), selected_season_type && selected_season_result_type ? /*#__PURE__*/React.createElement(CompetitionsSection, {
216
+ competitions: competitions,
217
+ competition_result_type: selected_season_result_type,
218
+ competition_type: selected_season_type,
219
+ onCompetitionSelect: c => onCompetitionSelect(c),
220
+ width: module_size.width
221
+ }) : /*#__PURE__*/React.createElement(React.Fragment, null)), show_enter && selected_season_result_type && selected_season_type ? /*#__PURE__*/React.createElement(View, {
222
+ style: {
223
+ position: 'absolute',
224
+ top: 0,
225
+ left: 0,
226
+ right: 0,
227
+ bottom: 0,
228
+ backgroundColor: Colors.shades.black_faded,
229
+ justifyContent: 'flex-end'
230
+ }
231
+ }, /*#__PURE__*/React.createElement(EnterSeasonPrompt, {
232
+ width: module_size.width,
233
+ competition_season: competition_season,
234
+ competition_result_type: selected_season_result_type,
235
+ competition_type: selected_season_type,
236
+ player_balance: player_balance,
237
+ player: player,
238
+ onEnter: promo => {
239
+ console.log(promo);
240
+ handleJoin();
241
+ setShowEnter(false);
242
+ },
243
+ onCancel: () => setShowEnter(false),
244
+ onVerify: () => console.log('VERIFY!')
245
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null), show_leaderboard && selected_season_type ? /*#__PURE__*/React.createElement(View, {
246
+ style: {
247
+ position: 'absolute',
248
+ top: 0,
249
+ left: 0,
250
+ right: 0,
251
+ bottom: 0,
252
+ backgroundColor: Colors.shades.black_faded
253
+ }
254
+ }, /*#__PURE__*/React.createElement(SeasonLeaderboard, {
255
+ authenticated_player: player,
256
+ authenticated_season_player: authenticated_season_player,
257
+ authenticated_season_result: authenticated_season_result,
258
+ width: module_size.width,
259
+ onLeaderSelect: p => console.log(p),
260
+ view_mode: "full",
261
+ height: module_size.height,
262
+ competition_season: competition_season,
263
+ competition_type: selected_season_type,
264
+ onSeeFull: () => console.log('See full'),
265
+ onClose: () => setShowLeaderboard(false)
266
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null));
267
+ };
268
+ export default SeasonModule;
269
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useEffect","useState","View","ActivityIndicator","ScrollView","Colors","SeasonHeader","SeasonApi","CompetitionsSection","SeasonSettingsSection","EnterSeasonPrompt","SeasonLeaderboard","SeasonModule","competition_season_id","player_id","onShareSeason","onRequestAuthenticate","onCompetitionSelect","module_size","setModuleSize","width","height","show_leaderboard","setShowLeaderboard","show_enter","setShowEnter","my_data","setMyData","my_loading","module_data","setData","loading","action_loading","competitions","offset","competition_season_players","competition_season_results","competition_types","players","competition_result_types","competition_payout_types","competition_season","player","player_balance","setEnvironment","getSeasonData","getMyDetails","undefined","me","pb","getMyBalance","id","season","getSeasonById","comps","getCompetitionsBySeasonId","opts","getCompetitionOptions","season_player_resp","getSeasonPlayersBySeasonId","getPlayersByPlayerIds","admin_id","cmpny","company_id","companies","getCompaniesByIds","admin","company","handleJoin","resp","joinSeason","filter","cp","competition_season_player_id","competition_season_player","concat","cr","competition_season_result_id","competition_season_result","c","find","nc","competition_id","handleLeave","leaveSeason","createElement","style","flex","size","padding","alignSelf","color","brand","midnight","selected_season_type","ct","competition_type_id","selected_season_result_type","crt","competition_result_type_id","authenticated_season_player","csp","authenticated_season_result","onLayout","ev","nativeEvent","layout","onJoin","onLeave","authenticated_player","onLeaderSelect","p","console","log","view_mode","competition_type","onSeeFull","Fragment","competition_result_type","competition_payouts","position","top","left","right","bottom","backgroundColor","shades","black_faded","justifyContent","onEnter","promo","onCancel","onVerify","onClose"],"sourceRoot":"../../../src","sources":["CompetitionSeason/index.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SAASC,IAAI,EAAEC,iBAAiB,EAAEC,UAAU,QAAQ,cAAc;AAElE,OAAOC,MAAM,MAAM,qBAAqB;AACxC,OAAOC,YAAY,MAAM,2BAA2B;AACpD,SAASC,SAAS,QAAQ,OAAO;AACjC,OAAOC,mBAAmB,MAAM,kCAAkC;AAClE,OAAOC,qBAAqB,MAAM,oCAAoC;AACtE,OAAOC,iBAAiB,MAAM,gCAAgC;AAC9D,OAAOC,iBAAiB,MAAM,gCAAgC;AAU9D,MAAMC,YAAY,GAAGA,CAAC;EAAEC,qBAAqB;EAAEC,SAAS;EAAEC,aAAa;EAAEC,qBAAqB;EAAEC;AAAsC,CAAC,KAAK;EACxI,MAAM,CAAEC,WAAW,EAAEC,aAAa,CAAE,GAAGlB,QAAQ,CAAC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AAsH,QAAA,MAAI,CAAC,EACL/F,gBAAgB,IAAIwE,oBAAoB,gBACzC/F,KAAA,CAAAsF,aAAA,CAACnF,IAAI;IAACoF,KAAK,EAAE;MAAEkC,QAAQ,EAAC,UAAU;MAAEC,GAAG,EAAC,CAAC;MAAEC,IAAI,EAAC,CAAC;MAAEC,KAAK,EAAC,CAAC;MAAEC,MAAM,EAAC,CAAC;MAAEC,eAAe,EAACxH,MAAM,CAACyH,MAAM,CAACC;IAAY;EAAE,gBAC9GhI,KAAA,CAAAsF,aAAA,CAAC1E,iBAAiB;IACdkG,oBAAoB,EAAEnE,MAAO;IAC7B0D,2BAA2B,EAAEA,2BAA4B;IACzDE,2BAA2B,EAAEA,2BAA4B;IACzDlF,KAAK,EAAEF,WAAW,CAACE,KAAM;IACzB0F,cAAc,EAAGC,CAAC,IAAKC,OAAO,CAACC,GAAG,CAACF,CAAC,CAAE;IACtCG,SAAS,EAAC,MAAM;IAChB7F,MAAM,EAAEH,WAAW,CAACG,MAAO;IAC3BoB,kBAAkB,EAAEA,kBAAmB;IACvC0E,gBAAgB,EAAErB,oBAAqB;IACvCsB,SAAS,EAAEA,CAAA,KAAMJ,OAAO,CAACC,GAAG,CAAC,UAAU,CAAE;IACzCoB,OAAO,EAAEA,CAAA,KAAM9G,kBAAkB,CAAC,KAAK;EAAE,CAC5C,CACC,CAAC,gBACNxB,KAAA,CAAAsF,aAAA,CAAAtF,KAAA,CAAAsH,QAAA,MAAI,CACH,CAAC;AAEf,CAAC;AAED,eAAezG,YAAY","ignoreList":[]}
@@ -0,0 +1,176 @@
1
+ import axios from "axios";
2
+ import { APIOverrides } from "../../ApiOverrides";
3
+ import moment from "moment-mini";
4
+ let AUTH_SVC_API = '';
5
+ let TP_SVC_API = '';
6
+ //let EVENT_SVC_API = ''
7
+ //let MK_SVC_API = ''
8
+
9
+ export { ManageSeasonApi, ManageSeasonHelpers };
10
+ const ManageSeasonApi = {
11
+ setEnvironment: () => {
12
+ const endpoints = APIOverrides.getEndpoints();
13
+ TP_SVC_API = endpoints['TP_SVC_API'];
14
+ //EVENT_SVC_API = endpoints['EVENT_SVC_API'] as string;
15
+ //MK_SVC_API = endpoints['MK_SVC_API'] as string;
16
+ AUTH_SVC_API = endpoints['AUTH_SVC_API'];
17
+ },
18
+ getCompetitionOptions: async () => {
19
+ const resp = await axios.get(`${TP_SVC_API}/v1/competitions/options`);
20
+ return resp.data;
21
+ },
22
+ getSeasonTemplates: async () => {
23
+ const resp = await axios.get(`${TP_SVC_API}/v2/competitions/seasons/templates`);
24
+ return resp.data.competition_seasons;
25
+ },
26
+ getMyDetails: async () => {
27
+ const resp = await axios.get(`${AUTH_SVC_API}/v1/players/player/me`);
28
+ return resp.data.player;
29
+ },
30
+ getMyCompanies: async () => {
31
+ const resp = await axios.get(`${AUTH_SVC_API}/v1/companies/me`);
32
+ const {
33
+ companies,
34
+ company_members
35
+ } = resp.data;
36
+ return {
37
+ companies,
38
+ company_members
39
+ };
40
+ },
41
+ activateSeason: async competition_season_id => {
42
+ const resp = await axios.post(`${TP_SVC_API}/v2/competitions/season/activate`, {
43
+ competition_season_id
44
+ });
45
+ return resp.data.competition_season;
46
+ },
47
+ deleteSeason: async competition_season_id => {
48
+ const resp = await axios.post(`${TP_SVC_API}/v2/competitions/season/delete`, {
49
+ competition_season_id
50
+ });
51
+ return resp.data.competition_season;
52
+ },
53
+ getSeasonById: async competition_season_id => {
54
+ const resp = await axios.get(`${TP_SVC_API}/v2/competitions/seasons/season/${competition_season_id}`);
55
+ return resp.data.competition_season;
56
+ },
57
+ getCompetitionsBySeasonId: async competition_season_id => {
58
+ const resp = await axios.get(`${TP_SVC_API}/v2/competitions/season/${competition_season_id}`);
59
+ return resp.data.competitions;
60
+ },
61
+ createSeason: async competition_season => {
62
+ const resp = await axios.post(`${TP_SVC_API}/v2/competitions/seasons/season/create`, {
63
+ competition_season
64
+ });
65
+ console.log(resp.data);
66
+ return resp.data.competition_season;
67
+ },
68
+ updateSeason: async competition_season => {
69
+ const resp = await axios.post(`${TP_SVC_API}/v2/competitions/seasons/season/update`, {
70
+ competition_season
71
+ });
72
+ return resp.data.competition_season;
73
+ }
74
+ };
75
+ const ManageSeasonHelpers = {
76
+ getPendingSeason: () => {
77
+ return {
78
+ competition_season_id: '',
79
+ admin_id: '',
80
+ season_name: '',
81
+ season_description: 'Pending Description',
82
+ invite_only: true,
83
+ ticket_revenue: 0,
84
+ tickets_available: 10,
85
+ tickets_sold: 0,
86
+ single_buy_in: true,
87
+ expected_competition_count: 1,
88
+ ticket_price: 0,
89
+ max_picks: 0,
90
+ initial_balance: 1000,
91
+ balance_rollover: false,
92
+ unallocated_funds: 0,
93
+ competition_type_id: '1',
94
+ allow_late_buy_in: false,
95
+ payout_allocation: 1,
96
+ competition_result_type_id: '1',
97
+ payout_amt: 0,
98
+ scheduled_datetime: moment().add(1, 'week'),
99
+ status: 'pending',
100
+ market_type: 'FOR_MONEY',
101
+ create_datetime: '',
102
+ last_update_datetime: ''
103
+ };
104
+ },
105
+ isSeasonValid: cs => {
106
+ let errors = [];
107
+ if (!cs.season_name) {
108
+ errors.push('Please provide a valid name');
109
+ }
110
+ if (!cs.competition_result_type_id) {
111
+ errors.push('Please give a valid competition result type');
112
+ }
113
+ return errors;
114
+ },
115
+ isInfoChanged: (cs, ds) => {
116
+ let init_cs = JSON.stringify({
117
+ season_name: cs.season_name,
118
+ season_description: cs.season_description,
119
+ invite_only: cs.invite_only
120
+ });
121
+ let draft_cs = JSON.stringify({
122
+ season_name: ds.season_name,
123
+ season_description: ds.season_description,
124
+ invite_only: ds.invite_only
125
+ });
126
+ return draft_cs != init_cs ? true : false;
127
+ },
128
+ isSettingsChanged: (cs, ds) => {
129
+ let init_cs = JSON.stringify({
130
+ ticket_price: cs.ticket_price,
131
+ payout_allocation: cs.payout_allocation,
132
+ competition_type_id: cs.competition_type_id,
133
+ competition_result_type_id: cs.competition_result_type_id,
134
+ max_picks: cs.max_picks,
135
+ initial_balance: cs.initial_balance,
136
+ allow_late_buy_in: cs.allow_late_buy_in
137
+ });
138
+ let draft_cs = JSON.stringify({
139
+ ticket_price: ds.ticket_price,
140
+ payout_allocation: ds.payout_allocation,
141
+ competition_type_id: ds.competition_type_id,
142
+ competition_result_type_id: ds.competition_result_type_id,
143
+ max_picks: ds.max_picks,
144
+ initial_balance: ds.initial_balance,
145
+ allow_late_buy_in: ds.allow_late_buy_in
146
+ });
147
+ return draft_cs != init_cs ? true : false;
148
+ },
149
+ isSettingsValid: ds => {
150
+ if (!ds.competition_type_id) {
151
+ return false;
152
+ }
153
+ if (!ds.competition_result_type_id) {
154
+ return false;
155
+ }
156
+ let payout_allocation = parseFloat(ds.payout_allocation);
157
+ let ticket_price = parseFloat(ds.ticket_price);
158
+ if (isNaN(payout_allocation)) {
159
+ return false;
160
+ }
161
+ if (isNaN(ticket_price)) {
162
+ return false;
163
+ }
164
+ if (ticket_price < 0) {
165
+ return false;
166
+ }
167
+ if (payout_allocation <= 0) {
168
+ return false;
169
+ }
170
+ if (payout_allocation > 1) {
171
+ return false;
172
+ }
173
+ return true;
174
+ }
175
+ };
176
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["axios","APIOverrides","moment","AUTH_SVC_API","TP_SVC_API","ManageSeasonApi","ManageSeasonHelpers","setEnvironment","endpoints","getEndpoints","getCompetitionOptions","resp","get","data","getSeasonTemplates","competition_seasons","getMyDetails","player","getMyCompanies","companies","company_members","activateSeason","competition_season_id","post","competition_season","deleteSeason","getSeasonById","getCompetitionsBySeasonId","competitions","createSeason","console","log","updateSeason","getPendingSeason","admin_id","season_name","season_description","invite_only","ticket_revenue","tickets_available","tickets_sold","single_buy_in","expected_competition_count","ticket_price","max_picks","initial_balance","balance_rollover","unallocated_funds","competition_type_id","allow_late_buy_in","payout_allocation","competition_result_type_id","payout_amt","scheduled_datetime","add","status","market_type","create_datetime","last_update_datetime","isSeasonValid","cs","errors","push","isInfoChanged","ds","init_cs","JSON","stringify","draft_cs","isSettingsChanged","isSettingsValid","parseFloat","isNaN"],"sourceRoot":"../../../../src","sources":["CompetitionSeasonManager/api/index.ts"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,QAAQ,oBAAoB;AAGjD,OAAOC,MAAM,MAAM,aAAa;AAGhC,IAAIC,YAAY,GAAG,EAAE;AACrB,IAAIC,UAAU,GAAG,EAAE;AACnB;AACA;;AAGA,SAASC,eAAe,EAAEC,mBAAmB;AAE7C,MAAMD,eAAe,GAAG;EACpBE,cAAc,EAAEA,CAAA,KAAM;IAClB,MAAMC,SAAS,GAAGP,YAAY,CAACQ,YAAY,CAAC,CAAC;IAC7CL,UAAU,GAAGI,SAAS,CAAC,YAAY,CAAW;IAC9C;IACA;IACAL,YAAY,GAAGK,SAAS,CAAC,cAAc,CAAW;EACtD,CAAC;EACDE,qBAAqB,EAAE,MAAAA,CAAA,KAA6K;IAChM,MAAMC,IAAI,GAAG,MAAMX,KAAK,CAACY,GAAG,CAAE,GAAER,UAAW,0BAAyB,CAAC;IACrE,OAAOO,IAAI,CAACE,IAAI;EACpB,CAAC;EACDC,kBAAkB,EAAE,MAAAA,CAAA,KAA6C;IAC7D,MAAMH,IAAI,GAAG,MAAMX,KAAK,CAACY,GAAG,CAAE,GAAER,UAAW,oCAAmC,CAAC;IAC/E,OAAOO,IAAI,CAACE,IAAI,CAACE,mBAAmB;EACxC,CAAC;EACDC,YAAY,EAAE,MAAAA,CAAA,KAAkC;IAC5C,MAAML,IAAI,GAAG,MAAMX,KAAK,CAACY,GAAG,CAAE,GAAET,YAAa,uBAAsB,CAAC;IACpE,OAAOQ,IAAI,CAACE,IAAI,CAACI,MAAM;EAC3B,CAAC;EACDC,cAAc,EAAG,MAAAA,CAAA,KAAqF;IAClG,MAAMP,IAAI,GAAG,MAAMX,KAAK,CAACY,GAAG,CAAE,GAAET,YAAa,kBAAiB,CAAC;IAC/D,MAAM;MAAEgB,SAAS;MAAEC;IAAgB,CAAC,GAAGT,IAA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AAE,CAACnB,eAAe;MAAEI,iBAAiB,EAACe,EAAE,CAACf;IAAkB,CAAC,CAAC;IACpT,OAAOmB,QAAQ,IAAIH,OAAO,GAAG,IAAI,GAAG,KAAK;EAC7C,CAAC;EACDK,eAAe,EAAGN,EAAyB,IAAK;IAC5C,IAAG,CAACA,EAAE,CAAChB,mBAAmB,EAAC;MAAE,OAAO,KAAK;IAAC;IAC1C,IAAG,CAACgB,EAAE,CAACb,0BAA0B,EAAC;MAAE,OAAO,KAAK;IAAC;IACjD,IAAID,iBAAiB,GAAGqB,UAAU,CAACP,EAAE,CAACd,iBAA2B,CAAC;IAClE,IAAIP,YAAY,GAAG4B,UAAU,CAACP,EAAE,CAACrB,YAAsB,CAAC;IACxD,IAAG6B,KAAK,CAACtB,iBAAiB,CAAC,EAAC;MAAE,OAAO,KAAK;IAAC;IAC3C,IAAGsB,KAAK,CAAC7B,YAAY,CAAC,EAAC;MAAE,OAAO,KAAK;IAAC;IACtC,IAAGA,YAAY,GAAG,CAAC,EAAC;MAAE,OAAO,KAAK;IAAC;IACnC,IAAGO,iBAAiB,IAAI,CAAC,EAAC;MAAE,OAAO,KAAK;IAAC;IACzC,IAAGA,iBAAiB,GAAG,CAAC,EAAC;MAAE,OAAO,KAAK;IAAC;IACxC,OAAO,IAAI;EACf;AACJ,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=CompetitionSelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["CompetitionSeasonManager/components/CompetitionSelector.tsx"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,144 @@
1
+ import React, { useState } from 'react';
2
+ import { TouchableOpacity, View, FlatList } from 'react-native';
3
+ import { view_styles } from '../../constants/styles';
4
+ import CompetitionCard from '../../Engage/components/CompetitionCard';
5
+ import { Button, Icons, Text } from '../../Components';
6
+ import Colors from '../../constants/colors';
7
+ import moment from 'moment-mini';
8
+ const CompetitionsForm = ({
9
+ competition_season,
10
+ competitions,
11
+ competition_result_types,
12
+ competition_types,
13
+ onAddCompetition
14
+ }) => {
15
+ const [expanded, setExpanded] = useState(true);
16
+ const [active_tab, setActiveTab] = useState('active');
17
+ let filtered_comptitions = [...competitions];
18
+ if (active_tab == 'active') {
19
+ filtered_comptitions = filtered_comptitions.filter(c => c.status != 'closed');
20
+ } else {
21
+ filtered_comptitions = filtered_comptitions.filter(c => c.status == 'closed');
22
+ }
23
+ const renderCompetitions = data => {
24
+ const competition_type = competition_types.find(ct => ct.competition_type_id == data.item.competition_type_id);
25
+ const competition_result_type = competition_result_types.find(crt => crt.competition_result_type_id == data.item.competition_result_type_id);
26
+ if (!competition_type || !competition_result_type) {
27
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
28
+ }
29
+ return /*#__PURE__*/React.createElement(View, {
30
+ style: {
31
+ margin: 4
32
+ }
33
+ }, /*#__PURE__*/React.createElement(CompetitionCard, {
34
+ competition: data.item,
35
+ competition_result_type: competition_result_type,
36
+ competition_type: competition_type,
37
+ onCompetitionSelect: comp => console.log(comp)
38
+ }));
39
+ };
40
+ return /*#__PURE__*/React.createElement(View, {
41
+ style: {
42
+ ...view_styles.section
43
+ }
44
+ }, /*#__PURE__*/React.createElement(TouchableOpacity, {
45
+ style: {
46
+ ...view_styles.section_header
47
+ },
48
+ onPress: () => setExpanded(!expanded)
49
+ }, /*#__PURE__*/React.createElement(View, {
50
+ style: {
51
+ flex: 1
52
+ }
53
+ }, /*#__PURE__*/React.createElement(Text, {
54
+ theme: "header"
55
+ }, "Competitions"), /*#__PURE__*/React.createElement(Text, {
56
+ style: {
57
+ marginTop: 3
58
+ },
59
+ theme: "body"
60
+ }, "Below are the competitions that are included in this season")), /*#__PURE__*/React.createElement(Icons.ChevronIcon, {
61
+ direction: expanded ? 'up' : 'down',
62
+ size: 8,
63
+ color: Colors.brand.midnight
64
+ })), expanded ? /*#__PURE__*/React.createElement(View, {
65
+ style: {
66
+ ...view_styles.section_body,
67
+ padding: 0
68
+ }
69
+ }, /*#__PURE__*/React.createElement(View, {
70
+ style: {
71
+ ...view_styles.section_header,
72
+ backgroundColor: Colors.shades.shade100
73
+ }
74
+ }, /*#__PURE__*/React.createElement(View, {
75
+ style: {
76
+ flex: 1
77
+ }
78
+ }, /*#__PURE__*/React.createElement(Text, {
79
+ theme: "header_2"
80
+ }, active_tab == 'active' ? 'Active Competitions' : 'Closed Competitions')), /*#__PURE__*/React.createElement(Button, {
81
+ title: "ADD",
82
+ style: {
83
+ opacity: competition_season.following_season_id ? 0.5 : 1
84
+ },
85
+ title_color: Colors.shades.white,
86
+ backgroundColor: Colors.utility.success,
87
+ onPress: () => {
88
+ if (competition_season.following_season_id) {
89
+ return alert('Competitions are created based on the template season and cannot be customized');
90
+ }
91
+ onAddCompetition();
92
+ }
93
+ })), /*#__PURE__*/React.createElement(View, {
94
+ style: {
95
+ ...view_styles.body_row,
96
+ padding: 0,
97
+ margin: 10,
98
+ backgroundColor: Colors.shades.white,
99
+ borderRadius: 22,
100
+ borderWidth: 4,
101
+ borderColor: Colors.shades.shade100
102
+ }
103
+ }, /*#__PURE__*/React.createElement(Button, {
104
+ title: "ACTIVE",
105
+ title_color: active_tab == 'active' ? Colors.shades.white : Colors.brand.midnight,
106
+ title_weight: active_tab == 'active' ? 'bold' : 'regular',
107
+ padding: 15,
108
+ title_size: 12,
109
+ style: {
110
+ flex: 1
111
+ },
112
+ borderRadiusOverride: {
113
+ borderTopLeftRadius: 22,
114
+ borderBottomLeftRadius: 22,
115
+ borderTopRightRadius: 0,
116
+ borderBottomRightRadius: 0
117
+ },
118
+ backgroundColor: active_tab == 'active' ? Colors.brand.midnight : Colors.shades.white,
119
+ onPress: () => setActiveTab('active')
120
+ }), /*#__PURE__*/React.createElement(Button, {
121
+ title: "CLOSED",
122
+ title_size: 12,
123
+ title_color: active_tab == 'closed' ? Colors.shades.white : Colors.brand.midnight,
124
+ title_weight: active_tab == 'closed' ? 'bold' : 'regular',
125
+ padding: 15,
126
+ style: {
127
+ flex: 1
128
+ },
129
+ borderRadiusOverride: {
130
+ borderTopLeftRadius: 0,
131
+ borderBottomLeftRadius: 0,
132
+ borderTopRightRadius: 22,
133
+ borderBottomRightRadius: 22
134
+ },
135
+ backgroundColor: active_tab == 'closed' ? Colors.brand.midnight : Colors.shades.white,
136
+ onPress: () => setActiveTab('closed')
137
+ })), /*#__PURE__*/React.createElement(FlatList, {
138
+ data: filtered_comptitions.sort((a, b) => moment(b.scheduled_datetime).unix() - moment(a.scheduled_datetime).unix()),
139
+ renderItem: renderCompetitions,
140
+ keyExtractor: item => item.competition_id.toString()
141
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null));
142
+ };
143
+ export default CompetitionsForm;
144
+ //# sourceMappingURL=CompetitionsForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useState","TouchableOpacity","View","FlatList","view_styles","CompetitionCard","Button","Icons","Text","Colors","moment","CompetitionsForm","competition_season","competitions","competition_result_types","competition_types","onAddCompetition","expanded","setExpanded","active_tab","setActiveTab","filtered_comptitions","filter","c","status","renderCompetitions","data","competition_type","find","ct","competition_type_id","item","competition_result_type","crt","competition_result_type_id","createElement","Fragment","style","margin","competition","onCompetitionSelect","comp","console","log","section","section_header","onPress","flex","theme","marginTop","ChevronIcon","direction","size","color","brand","midnight","section_body","padding","backgroundColor","shades","shade100","title","opacity","following_season_id","title_color","white","utility","success","alert","body_row","borderRadius","borderWidth","borderColor","title_weight","title_size","borderRadiusOverride","borderTopLeftRadius","borderBottomLeftRadius","borderTopRightRadius","borderBottomRightRadius","sort","a","b","scheduled_datetime","unix","renderItem","keyExtractor","competition_id","toString"],"sourceRoot":"../../../../src","sources":["CompetitionSeasonManager/components/CompetitionsForm.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,gBAAgB,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,cAAc;AAC/D,SAASC,WAAW,QAAQ,wBAAwB;A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