be-components 1.2.7 → 1.2.8

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 (123) hide show
  1. package/lib/commonjs/Competition/components/CompetitionCard.js +1 -1
  2. package/lib/commonjs/Competition/components/CompetitionCard.js.map +1 -1
  3. package/lib/commonjs/Competition/components/EnterCompetitionPrompt.js +1 -1
  4. package/lib/commonjs/Competition/components/EnterCompetitionPrompt.js.map +1 -1
  5. package/lib/commonjs/CompetitionManager/api/index.js +577 -0
  6. package/lib/commonjs/CompetitionManager/api/index.js.map +1 -0
  7. package/lib/commonjs/CompetitionManager/components/CompetitionContestsForm.js +439 -0
  8. package/lib/commonjs/CompetitionManager/components/CompetitionContestsForm.js.map +1 -0
  9. package/lib/commonjs/CompetitionManager/components/CompetitionInfoForm.js +269 -0
  10. package/lib/commonjs/CompetitionManager/components/CompetitionInfoForm.js.map +1 -0
  11. package/lib/commonjs/CompetitionManager/components/CompetitionMatchMarketCard.js +142 -0
  12. package/lib/commonjs/CompetitionManager/components/CompetitionMatchMarketCard.js.map +1 -0
  13. package/lib/commonjs/CompetitionManager/components/CompetitionSettingsForm.js +370 -0
  14. package/lib/commonjs/CompetitionManager/components/CompetitionSettingsForm.js.map +1 -0
  15. package/lib/commonjs/CompetitionManager/components/MarketSelector.js +99 -0
  16. package/lib/commonjs/CompetitionManager/components/MarketSelector.js.map +1 -0
  17. package/lib/commonjs/CompetitionManager/index.js +188 -0
  18. package/lib/commonjs/CompetitionManager/index.js.map +1 -0
  19. package/lib/commonjs/Components/Dropdown.js +98 -0
  20. package/lib/commonjs/Components/Dropdown.js.map +1 -0
  21. package/lib/commonjs/Components/Icons.js +1 -1
  22. package/lib/commonjs/Components/Icons.js.map +1 -1
  23. package/lib/commonjs/Markets/api/index.js +28 -0
  24. package/lib/commonjs/Markets/api/index.js.map +1 -0
  25. package/lib/commonjs/Markets/components/MarketButton.js +25 -0
  26. package/lib/commonjs/Markets/components/MarketButton.js.map +1 -0
  27. package/lib/commonjs/Squares/api/index.js.map +1 -1
  28. package/lib/commonjs/Squares/components/PrizeCard.js +161 -0
  29. package/lib/commonjs/Squares/components/PrizeCard.js.map +1 -0
  30. package/lib/commonjs/Squares/components/SquareCard.js.map +1 -1
  31. package/lib/commonjs/Squares/index.js +10 -1
  32. package/lib/commonjs/Squares/index.js.map +1 -1
  33. package/lib/commonjs/constants/styles.js +10 -0
  34. package/lib/commonjs/constants/styles.js.map +1 -1
  35. package/lib/commonjs/index.js +7 -0
  36. package/lib/commonjs/index.js.map +1 -1
  37. package/lib/module/Competition/components/CompetitionCard.js +1 -1
  38. package/lib/module/Competition/components/CompetitionCard.js.map +1 -1
  39. package/lib/module/Competition/components/EnterCompetitionPrompt.js +1 -1
  40. package/lib/module/Competition/components/EnterCompetitionPrompt.js.map +1 -1
  41. package/lib/module/CompetitionManager/api/index.js +571 -0
  42. package/lib/module/CompetitionManager/api/index.js.map +1 -0
  43. package/lib/module/CompetitionManager/components/CompetitionContestsForm.js +434 -0
  44. package/lib/module/CompetitionManager/components/CompetitionContestsForm.js.map +1 -0
  45. package/lib/module/CompetitionManager/components/CompetitionInfoForm.js +262 -0
  46. package/lib/module/CompetitionManager/components/CompetitionInfoForm.js.map +1 -0
  47. package/lib/module/CompetitionManager/components/CompetitionMatchMarketCard.js +135 -0
  48. package/lib/module/CompetitionManager/components/CompetitionMatchMarketCard.js.map +1 -0
  49. package/lib/module/CompetitionManager/components/CompetitionSettingsForm.js +364 -0
  50. package/lib/module/CompetitionManager/components/CompetitionSettingsForm.js.map +1 -0
  51. package/lib/module/CompetitionManager/components/MarketSelector.js +92 -0
  52. package/lib/module/CompetitionManager/components/MarketSelector.js.map +1 -0
  53. package/lib/module/CompetitionManager/index.js +179 -0
  54. package/lib/module/CompetitionManager/index.js.map +1 -0
  55. package/lib/module/Components/Dropdown.js +89 -0
  56. package/lib/module/Components/Dropdown.js.map +1 -0
  57. package/lib/module/Components/Icons.js +1 -1
  58. package/lib/module/Components/Icons.js.map +1 -1
  59. package/lib/module/Markets/api/index.js +23 -0
  60. package/lib/module/Markets/api/index.js.map +1 -0
  61. package/lib/module/Markets/components/MarketButton.js +18 -0
  62. package/lib/module/Markets/components/MarketButton.js.map +1 -0
  63. package/lib/module/Squares/api/index.js.map +1 -1
  64. package/lib/module/Squares/components/PrizeCard.js +152 -0
  65. package/lib/module/Squares/components/PrizeCard.js.map +1 -0
  66. package/lib/module/Squares/components/SquareCard.js.map +1 -1
  67. package/lib/module/Squares/index.js +10 -1
  68. package/lib/module/Squares/index.js.map +1 -1
  69. package/lib/module/constants/styles.js +10 -0
  70. package/lib/module/constants/styles.js.map +1 -1
  71. package/lib/module/index.js +2 -1
  72. package/lib/module/index.js.map +1 -1
  73. package/lib/typescript/src/CompetitionManager/api/index.d.ts +109 -0
  74. package/lib/typescript/src/CompetitionManager/api/index.d.ts.map +1 -0
  75. package/lib/typescript/src/CompetitionManager/components/CompetitionContestsForm.d.ts +23 -0
  76. package/lib/typescript/src/CompetitionManager/components/CompetitionContestsForm.d.ts.map +1 -0
  77. package/lib/typescript/src/CompetitionManager/components/CompetitionInfoForm.d.ts +10 -0
  78. package/lib/typescript/src/CompetitionManager/components/CompetitionInfoForm.d.ts.map +1 -0
  79. package/lib/typescript/src/CompetitionManager/components/CompetitionMatchMarketCard.d.ts +17 -0
  80. package/lib/typescript/src/CompetitionManager/components/CompetitionMatchMarketCard.d.ts.map +1 -0
  81. package/lib/typescript/src/CompetitionManager/components/CompetitionSettingsForm.d.ts +13 -0
  82. package/lib/typescript/src/CompetitionManager/components/CompetitionSettingsForm.d.ts.map +1 -0
  83. package/lib/typescript/src/CompetitionManager/components/MarketSelector.d.ts +13 -0
  84. package/lib/typescript/src/CompetitionManager/components/MarketSelector.d.ts.map +1 -0
  85. package/lib/typescript/src/CompetitionManager/index.d.ts +8 -0
  86. package/lib/typescript/src/CompetitionManager/index.d.ts.map +1 -0
  87. package/lib/typescript/src/Components/Dropdown.d.ts +15 -0
  88. package/lib/typescript/src/Components/Dropdown.d.ts.map +1 -0
  89. package/lib/typescript/src/Markets/api/index.d.ts +7 -0
  90. package/lib/typescript/src/Markets/api/index.d.ts.map +1 -0
  91. package/lib/typescript/src/Markets/components/MarketButton.d.ts +11 -0
  92. package/lib/typescript/src/Markets/components/MarketButton.d.ts.map +1 -0
  93. package/lib/typescript/src/Squares/api/index.d.ts +2 -1
  94. package/lib/typescript/src/Squares/api/index.d.ts.map +1 -1
  95. package/lib/typescript/src/Squares/components/PrizeCard.d.ts +11 -0
  96. package/lib/typescript/src/Squares/components/PrizeCard.d.ts.map +1 -0
  97. package/lib/typescript/src/Squares/components/SquareCard.d.ts.map +1 -1
  98. package/lib/typescript/src/Squares/index.d.ts.map +1 -1
  99. package/lib/typescript/src/constants/styles.d.ts +10 -0
  100. package/lib/typescript/src/constants/styles.d.ts.map +1 -1
  101. package/lib/typescript/src/index.d.ts +2 -1
  102. package/lib/typescript/src/index.d.ts.map +1 -1
  103. package/package.json +1 -1
  104. package/src/Competition/components/CompetitionCard.tsx +1 -1
  105. package/src/Competition/components/EnterCompetitionPrompt.tsx +2 -2
  106. package/src/CompetitionManager/api/index.ts +484 -0
  107. package/src/CompetitionManager/components/CompetitionContestsForm.tsx +473 -0
  108. package/src/CompetitionManager/components/CompetitionInfoForm.tsx +171 -0
  109. package/src/CompetitionManager/components/CompetitionMatchMarketCard.tsx +155 -0
  110. package/src/CompetitionManager/components/CompetitionSettingsForm.tsx +229 -0
  111. package/src/CompetitionManager/components/MarketSelector.tsx +66 -0
  112. package/src/CompetitionManager/index.tsx +163 -0
  113. package/src/Components/Dropdown.tsx +78 -0
  114. package/src/Components/Icons.tsx +1 -1
  115. package/src/Markets/api/index.ts +18 -0
  116. package/src/Markets/components/MarketButton.tsx +24 -0
  117. package/src/Squares/api/index.ts +2 -2
  118. package/src/Squares/components/PrizeCard.tsx +90 -0
  119. package/src/Squares/components/SquareCard.tsx +0 -1
  120. package/src/Squares/index.tsx +12 -2
  121. package/src/constants/styles.ts +5 -0
  122. package/src/index.tsx +2 -0
  123. package/src/types.d.ts +26 -2
@@ -0,0 +1,364 @@
1
+ import { FlatList, TextInput, TouchableOpacity, View } from "react-native";
2
+ import React, { useEffect, useState } from "react";
3
+ import { ManageCompetitionApi } from "../api";
4
+ import Colors from "../../constants/colors";
5
+ import { Icons, Text } from "../../Components";
6
+ import { view_styles } from "../../constants/styles";
7
+ import DropDown from "../../Components/Dropdown";
8
+ const market_types = ['FOR_MONEY', 'FREE'];
9
+ const CompetitionSettingsForm = ({
10
+ player,
11
+ width,
12
+ competition,
13
+ competition_types,
14
+ competition_result_types,
15
+ onCompetitionUpdate
16
+ }) => {
17
+ const [expanded, setExpanded] = useState(false);
18
+ //const [ player_selector_visible, setPlayerSelectorVisible ] = useState(false);
19
+ const [pacer, setPacer] = useState();
20
+ const competition_type = competition_types.find(ct => ct.competition_type_id == competition?.competition_type_id);
21
+ const competition_result_type = competition_result_types.find(crt => crt.competition_result_type_id == competition?.competition_result_type_id);
22
+ useEffect(() => {
23
+ if (!competition?.pacer_id) {
24
+ return;
25
+ }
26
+ if (competition.pacer_id == pacer?.player_id) {
27
+ return;
28
+ } //Already got him/her
29
+ getPacerFromServer(competition.pacer_id);
30
+ }, [competition?.pacer_id]);
31
+ useEffect(() => {
32
+ if (!competition_result_type) {
33
+ return;
34
+ }
35
+ if (competition_result_type.type == 'outpace' && !competition.pacer_id) {
36
+ setPacer(player);
37
+ onCompetitionUpdate({
38
+ ...competition,
39
+ pacer_id: player?.player_id
40
+ });
41
+ }
42
+ }, [competition_result_type?.type]);
43
+ const getPacerFromServer = async player_id => {
44
+ const ps = await ManageCompetitionApi.getPlayersByPlayerIds([player_id]);
45
+ setPacer(ps[0]);
46
+ };
47
+ const renderMarketTypes = data => {
48
+ const selected = data.item == competition.market_type ? true : false;
49
+ return /*#__PURE__*/React.createElement(TouchableOpacity, {
50
+ style: {
51
+ minWidth: 75,
52
+ margin: 1,
53
+ borderRadius: 8,
54
+ padding: 10,
55
+ backgroundColor: selected ? Colors.brand.midnight : undefined
56
+ },
57
+ onPress: () => onCompetitionUpdate({
58
+ ...competition,
59
+ market_type: data.item
60
+ })
61
+ }, /*#__PURE__*/React.createElement(Text, {
62
+ textAlign: "center",
63
+ color: selected ? Colors.shades.white : Colors.brand.midnight,
64
+ weight: selected ? 'bold' : 'regular',
65
+ size: 14
66
+ }, data.item == 'FOR_MONEY' ? 'USD' : 'EDGE COINS'));
67
+ };
68
+ const renderCompetitionTypes = data => {
69
+ const selected = data.item.competition_type_id == competition.competition_type_id ? true : false;
70
+ return /*#__PURE__*/React.createElement(TouchableOpacity, {
71
+ style: {
72
+ minWidth: 75,
73
+ margin: 1,
74
+ borderRadius: 8,
75
+ padding: 10,
76
+ backgroundColor: selected ? Colors.brand.midnight : undefined
77
+ },
78
+ onPress: () => onCompetitionUpdate({
79
+ ...competition,
80
+ competition_type_id: data.item.competition_type_id
81
+ })
82
+ }, /*#__PURE__*/React.createElement(Text, {
83
+ textAlign: "center",
84
+ color: selected ? Colors.shades.white : Colors.brand.midnight,
85
+ weight: selected ? 'bold' : 'regular',
86
+ size: 14
87
+ }, data.item.type_label));
88
+ };
89
+ if (!competition) {
90
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
91
+ }
92
+ return /*#__PURE__*/React.createElement(View, {
93
+ style: {
94
+ ...view_styles.section,
95
+ flexGrow: 1
96
+ }
97
+ }, /*#__PURE__*/React.createElement(TouchableOpacity, {
98
+ style: view_styles.section_header,
99
+ onPress: () => setExpanded(!expanded)
100
+ }, /*#__PURE__*/React.createElement(View, {
101
+ style: {
102
+ flex: 1
103
+ }
104
+ }, /*#__PURE__*/React.createElement(Text, {
105
+ theme: "header"
106
+ }, "Competition Settings"), /*#__PURE__*/React.createElement(Text, {
107
+ style: {
108
+ marginTop: 3
109
+ },
110
+ theme: "body"
111
+ }, "Manage the high level information of this competition")), /*#__PURE__*/React.createElement(Icons.ChevronIcon, {
112
+ direction: expanded ? 'up' : 'down',
113
+ color: Colors.brand.midnight,
114
+ size: 8
115
+ })), expanded ? /*#__PURE__*/React.createElement(View, {
116
+ nativeID: "competition_settings",
117
+ style: {
118
+ ...view_styles.section_body,
119
+ maxWidth: width,
120
+ backgroundColor: Colors.shades.shade100
121
+ }
122
+ }, /*#__PURE__*/React.createElement(View, {
123
+ nativeID: "competition_currency",
124
+ style: {
125
+ ...view_styles.body_row,
126
+ flexWrap: 'wrap',
127
+ maxWidth: width
128
+ }
129
+ }, /*#__PURE__*/React.createElement(View, {
130
+ style: {
131
+ flex: 1,
132
+ margin: 5,
133
+ minWidth: 200
134
+ }
135
+ }, /*#__PURE__*/React.createElement(Text, {
136
+ theme: "header_2"
137
+ }, "Competition Currency"), /*#__PURE__*/React.createElement(Text, {
138
+ style: {
139
+ marginTop: 3
140
+ },
141
+ theme: "body"
142
+ }, "Is the ticket price in real-money or edge coins?")), /*#__PURE__*/React.createElement(View, {
143
+ style: {
144
+ justifyContent: 'flex-end',
145
+ margin: 5,
146
+ borderRadius: 8,
147
+ backgroundColor: Colors.shades.white
148
+ }
149
+ }, /*#__PURE__*/React.createElement(FlatList, {
150
+ data: market_types,
151
+ renderItem: renderMarketTypes,
152
+ keyExtractor: item => item,
153
+ horizontal: true
154
+ }))), /*#__PURE__*/React.createElement(View, {
155
+ nativeID: "competition_type",
156
+ style: {
157
+ ...view_styles.body_row,
158
+ flexWrap: 'wrap',
159
+ maxWidth: width
160
+ }
161
+ }, /*#__PURE__*/React.createElement(View, {
162
+ style: {
163
+ flex: 1,
164
+ margin: 5,
165
+ minWidth: 200
166
+ }
167
+ }, /*#__PURE__*/React.createElement(Text, {
168
+ theme: "header_2"
169
+ }, "Competition Type"), /*#__PURE__*/React.createElement(Text, {
170
+ style: {
171
+ marginTop: 3
172
+ },
173
+ theme: "body"
174
+ }, competition_type ? competition_type.description : 'Choose the type of competition this is.')), /*#__PURE__*/React.createElement(View, {
175
+ style: {
176
+ justifyContent: 'flex-end',
177
+ margin: 5,
178
+ borderRadius: 8,
179
+ backgroundColor: Colors.shades.white
180
+ }
181
+ }, /*#__PURE__*/React.createElement(FlatList, {
182
+ data: competition_types,
183
+ renderItem: renderCompetitionTypes,
184
+ keyExtractor: item => item.competition_type_id.toString(),
185
+ horizontal: true
186
+ }))), /*#__PURE__*/React.createElement(View, {
187
+ nativeID: "competition_payout",
188
+ style: {
189
+ ...view_styles.body_row,
190
+ flexWrap: 'wrap',
191
+ maxWidth: width
192
+ }
193
+ }, /*#__PURE__*/React.createElement(View, {
194
+ style: {
195
+ flex: 1,
196
+ margin: 5,
197
+ minWidth: 200
198
+ }
199
+ }, /*#__PURE__*/React.createElement(Text, {
200
+ theme: "header_2"
201
+ }, "Competition Payout Type"), /*#__PURE__*/React.createElement(Text, {
202
+ style: {
203
+ marginTop: 3
204
+ },
205
+ theme: "body"
206
+ }, competition_result_type ? competition_result_type.description : 'Choose the type of payout for this competition')), /*#__PURE__*/React.createElement(View, {
207
+ style: {
208
+ justifyContent: 'flex-end',
209
+ margin: 5,
210
+ borderRadius: 8,
211
+ backgroundColor: Colors.shades.white
212
+ }
213
+ }, /*#__PURE__*/React.createElement(DropDown, {
214
+ dropdown_options: [{
215
+ value: 'competition_result_type_id',
216
+ eligible_options: competition_result_types.map(t => t.label)
217
+ }],
218
+ selected_value: competition_result_type?.label ?? '',
219
+ onOptionSelect: type => {
220
+ const new_result_type = competition_result_types.find(crt => crt.label == type);
221
+ if (!new_result_type) {
222
+ return;
223
+ }
224
+ onCompetitionUpdate({
225
+ ...competition,
226
+ competition_result_type_id: new_result_type.competition_result_type_id
227
+ });
228
+ }
229
+ }))), /*#__PURE__*/React.createElement(View, {
230
+ nativeID: "buy_in",
231
+ style: {
232
+ ...view_styles.body_row,
233
+ flexWrap: 'wrap',
234
+ maxWidth: width
235
+ }
236
+ }, /*#__PURE__*/React.createElement(View, {
237
+ style: {
238
+ flex: 1,
239
+ margin: 5,
240
+ minWidth: 200
241
+ }
242
+ }, /*#__PURE__*/React.createElement(Text, {
243
+ theme: "header_2"
244
+ }, "Ticket Price"), /*#__PURE__*/React.createElement(Text, {
245
+ style: {
246
+ marginTop: 3
247
+ },
248
+ theme: "body"
249
+ }, "Set the amount required to purchase a ticket to participate")), /*#__PURE__*/React.createElement(TextInput, {
250
+ style: {
251
+ ...view_styles.input,
252
+ textAlign: 'center',
253
+ margin: 5,
254
+ width: 100,
255
+ backgroundColor: Colors.shades.white
256
+ },
257
+ onChangeText: text => onCompetitionUpdate({
258
+ ...competition,
259
+ buy_in: text
260
+ }),
261
+ placeholder: "25",
262
+ value: competition.buy_in,
263
+ placeholderTextColor: Colors.brand.slate
264
+ })), /*#__PURE__*/React.createElement(View, {
265
+ nativeID: "Max Tickets",
266
+ style: {
267
+ flexDirection: 'row',
268
+ flexWrap: 'wrap',
269
+ padding: 10,
270
+ borderBottomWidth: 1,
271
+ borderBottomColor: Colors.shades.white
272
+ }
273
+ }, /*#__PURE__*/React.createElement(View, {
274
+ style: {
275
+ flex: 1,
276
+ marginRight: 5
277
+ }
278
+ }, /*#__PURE__*/React.createElement(Text, {
279
+ theme: "header_2"
280
+ }, "Max Tickets"), /*#__PURE__*/React.createElement(Text, {
281
+ style: {
282
+ marginTop: 3
283
+ },
284
+ theme: "body"
285
+ }, "Maximum number of tickets that can be sold")), /*#__PURE__*/React.createElement(TextInput, {
286
+ style: {
287
+ ...view_styles.input,
288
+ textAlign: 'center',
289
+ width: 100,
290
+ backgroundColor: Colors.shades.white
291
+ },
292
+ onChangeText: text => onCompetitionUpdate({
293
+ ...competition,
294
+ available_tickets: text
295
+ }),
296
+ placeholder: "100",
297
+ value: competition.available_tickets,
298
+ placeholderTextColor: Colors.brand.slate
299
+ }))) : /*#__PURE__*/React.createElement(React.Fragment, null));
300
+ };
301
+ export default CompetitionSettingsForm;
302
+
303
+ /*
304
+ {competition_result_type?.type == 'outpace' ?
305
+ <View nativeID="competition_payout_type" style={{ flexDirection:'row', flexWrap:'wrap', padding:10, borderBottomWidth:1, borderBottomColor:Colors.shades.white }}>
306
+ <View style={{ flex:1, marginRight:5 }}>
307
+ <Text size={16} color={Colors.brand.midnight} weight='bold'>Pacer</Text>
308
+ <Text size={14} color={Colors.brand.midnight} weight='regular'>Select the player that must be beat</Text>
309
+ </View>
310
+ <View style={{ flexDirection:'row', padding:5, backgroundColor:Colors.shades.white, borderRadius:8 }}>
311
+ {pacer?
312
+ <View style={{ flexDirection:'row', padding:5, backgroundColor:Colors.shades.white, borderRightWidth:1, borderRightColor:Colors.shades.shade600 }}>
313
+ <Image
314
+ source={{ uri: pacer.profile_pic }}
315
+ style={{ height:40, width:40, padding:5 }}
316
+ resizeMode="cover"
317
+ />
318
+ <View style={{ flex:1, padding:5 }}>
319
+ <Text size={14} color={Colors.brand.midnight}>@{pacer.username}</Text>
320
+ </View>
321
+ </View>
322
+ :<></>}
323
+ <Button
324
+ title={pacer?'Change':'Add Pacer'}
325
+ title_color={Colors.brand.electric}
326
+ onPress={() => setPlayerSelectorVisible(true)}
327
+ />
328
+ </View>
329
+ </View>
330
+ :<></>}
331
+ */
332
+
333
+ /*
334
+ <View style={{ position:'absolute', top:0, left:0, right:0, alignItems:'center' }}>
335
+ <PlayerSelector
336
+ visible={player_selector_visible}
337
+ onPlayerSelect={(player) => {
338
+ setPacer(player)
339
+ onCompetitionUpdate({ ...competition, pacer_id:player.player_id })
340
+ setPlayerSelectorVisible(false)
341
+ }}
342
+ onClose={() => setPlayerSelectorVisible(false)}
343
+ />
344
+ </View>
345
+ */
346
+
347
+ /*
348
+ {creator?.role == 'admin' ?
349
+ <View nativeID="Guaranteed_payout" style={{ flexDirection:'row', flexWrap:'wrap', padding:10, borderBottomWidth:1, borderBottomColor:Colors.shades.white }}>
350
+ <View style={{ flex:1, marginRight:5 }}>
351
+ <Text size={16} color={Colors.brand.midnight} weight='bold'>Guaranteed Payout (ADMIN ONLY)</Text>
352
+ <Text size={14} color={Colors.brand.midnight} weight='regular'>How much payout is guaranteed?</Text>
353
+ </View>
354
+ <TextInput
355
+ style={{ padding:10, borderRadius:8, backgroundColor:Colors.shades.white }}
356
+ onChangeText={(text) => onCompetitionUpdate({ ...competition, guaranteed_payout: text })}
357
+ placeholder="0"
358
+ value={competition.guaranteed_payout}
359
+ placeholderTextColor={Colors.brand.slate}
360
+ />
361
+ </View>
362
+ :<></>}
363
+ */
364
+ //# sourceMappingURL=CompetitionSettingsForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FlatList","TextInput","TouchableOpacity","View","React","useEffect","useState","ManageCompetitionApi","Colors","Icons","Text","view_styles","DropDown","market_types","CompetitionSettingsForm","player","width","competition","competition_types","competition_result_types","onCompetitionUpdate","expanded","setExpanded","pacer","setPacer","competition_type","find","ct","competition_type_id","competition_result_type","crt","competition_result_type_id","pacer_id","player_id","getPacerFromServer","type","ps","getPlayersByPlayerIds","renderMarketTypes","data","selected","item","market_type","createElement","style","minWidth","margin","borderRadius","padding","backgroundColor","brand","midnight","undefined","onPress","textAlign","color","shades","white","weight","size","renderCompetitionTypes","type_label","Fragment","section","flexGrow","section_header","flex","theme","marginTop","ChevronIcon","direction","nativeID","section_body","maxWidth","shade100","body_row","flexWrap","justifyContent","renderItem","keyExtractor","horizontal","description","toString","dropdown_options","value","eligible_options","map","t","label","selected_value","onOptionSelect","new_result_type","input","onChangeText","text","buy_in","placeholder","placeholderTextColor","slate","flexDirection","borderBottomWidth","borderBottomColor","marginRight","available_tickets"],"sourceRoot":"../../../../src","sources":["CompetitionManager/components/CompetitionSettingsForm.tsx"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,SAAS,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AAC1E,OAAOC,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAElD,SAASC,oBAAoB,QAAQ,QAAQ;AAC7C,OAAOC,MAAM,MAAM,wBAAwB;AAC3C,SAASC,KAAK,EAAEC,IAAI,QAAQ,kBAAkB;AAC9C,SAASC,WAAW,QAAQ,wBAAwB;AACpD,O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,CACJ,CAAC,gBACV9F,KAAA,CAAAuC,aAAA,CAAAvC,KAAA,CAAA0D,QAAA,MAAI,CACH,CAAC;AAEf,CAAC;AAED,eAAehD,uBAAuB;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -0,0 +1,92 @@
1
+ import React from 'react';
2
+ import { FlatList, ScrollView, TouchableOpacity, View } from "react-native";
3
+ import { Button, Switch, Text } from '../../Components';
4
+ import Colors from '../../constants/colors';
5
+ import { view_styles } from '../../constants/styles';
6
+ const MarketSelector = ({
7
+ visible,
8
+ markets,
9
+ selected_markets,
10
+ onSelectMarket,
11
+ onDeselectMarket,
12
+ onClose
13
+ }) => {
14
+ const renderMarkets = data => {
15
+ const selected = selected_markets.includes(data.item.market_id) ? true : false;
16
+ return /*#__PURE__*/React.createElement(TouchableOpacity, {
17
+ style: {
18
+ flexDirection: 'row',
19
+ alignItems: 'center',
20
+ padding: 10,
21
+ borderBottomWidth: 1,
22
+ borderColor: Colors.shades.shade600
23
+ },
24
+ onPress: () => selected ? onDeselectMarket(data.item) : onSelectMarket(data.item)
25
+ }, /*#__PURE__*/React.createElement(View, {
26
+ style: {
27
+ flex: 1,
28
+ marginRight: 10
29
+ }
30
+ }, /*#__PURE__*/React.createElement(Text, {
31
+ size: 14,
32
+ color: Colors.brand.midnight,
33
+ weight: "bold"
34
+ }, data.item.type == 'Stat' ? data.item.stat_label : data.item.type), /*#__PURE__*/React.createElement(Text, {
35
+ style: {
36
+ marginTop: 3
37
+ },
38
+ size: 14,
39
+ color: Colors.brand.midnight,
40
+ weight: "regular"
41
+ }, data.item.description)), /*#__PURE__*/React.createElement(Switch, {
42
+ switch_type: "on_off",
43
+ value: selected,
44
+ onChange: () => {
45
+ if (!selected) {
46
+ return onSelectMarket(data.item);
47
+ }
48
+ return onDeselectMarket(data.item);
49
+ }
50
+ }));
51
+ };
52
+ if (!visible) {
53
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
54
+ }
55
+ return /*#__PURE__*/React.createElement(View, {
56
+ style: {
57
+ borderRadius: 8,
58
+ minWidth: 250,
59
+ maxHeight: 450,
60
+ backgroundColor: Colors.shades.white,
61
+ ...view_styles.float
62
+ }
63
+ }, /*#__PURE__*/React.createElement(View, {
64
+ style: {
65
+ flexDirection: 'row'
66
+ }
67
+ }, /*#__PURE__*/React.createElement(View, {
68
+ style: {
69
+ flex: 1
70
+ }
71
+ }), /*#__PURE__*/React.createElement(Button, {
72
+ title: "CLOSE",
73
+ style: {
74
+ alignSelf: 'flex-end'
75
+ },
76
+ backgroundColor: Colors.brand.electric,
77
+ padding: 10,
78
+ title_color: Colors.shades.white,
79
+ borderRadius: 8,
80
+ onPress: () => onClose()
81
+ })), /*#__PURE__*/React.createElement(ScrollView, {
82
+ style: {
83
+ flex: 1
84
+ }
85
+ }, /*#__PURE__*/React.createElement(FlatList, {
86
+ data: markets,
87
+ renderItem: renderMarkets,
88
+ keyExtractor: item => item.market_id.toString()
89
+ })));
90
+ };
91
+ export default MarketSelector;
92
+ //# sourceMappingURL=MarketSelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","FlatList","ScrollView","TouchableOpacity","View","Button","Switch","Text","Colors","view_styles","MarketSelector","visible","markets","selected_markets","onSelectMarket","onDeselectMarket","onClose","renderMarkets","data","selected","includes","item","market_id","createElement","style","flexDirection","alignItems","padding","borderBottomWidth","borderColor","shades","shade600","onPress","flex","marginRight","size","color","brand","midnight","weight","type","stat_label","marginTop","description","switch_type","value","onChange","Fragment","borderRadius","minWidth","maxHeight","backgroundColor","white","float","title","alignSelf","electric","title_color","renderItem","keyExtractor","toString"],"sourceRoot":"../../../../src","sources":["CompetitionManager/components/MarketSelector.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,EAAEC,UAAU,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AAE3E,SAASC,MAAM,EAAEC,MAAM,EAAEC,IAAI,QAAQ,kBAAkB;AACvD,OAAOC,MAAM,MAAM,wBAAwB;AAC3C,SAASC,WAAW,QAAQ,wBAAwB;AAUpD,MAAMC,cAAc,GAAGA,CAAC;EAAEC,OAAO;EAAEC,OAAO;EAAEC,gBAAgB;EAAEC,cAAc;EAAEC,gBAAgB;EAAEC;AAA8B,CAAC,KAAK;EAGhI,MAAMC,aAAa,GAAIC,IAAqC,IAAK;IAC7D,MAAMC,QAAQ,GAAGN,gBAAgB,CAACO,QAAQ,CAACF,IAAI,CAACG,IAAI,CAACC,SAAS,CAAC,GAAG,IAAI,GAAG,KAAK;IAC9E,oBACItB,KAAA,CAAAuB,aAAA,CAACpB,gBAAgB;MAACqB,KAAK,EAAE;QAAEC,aAAa,EAAC,KAAK;QAAEC,UAAU,EAAC,QAAQ;QAAEC,OAAO,EAAC,EAAE;QAAEC,iBAAiB,EAAC,CAAC;QAAEC,WAAW,EAACrB,MAAM,CAACsB,MAAM,CAACC;MAAS,CAAE;MAACC,OAAO,EAAEA,CAAA,KAAMb,QAAQ,GAAGJ,gBAAgB,CAACG,IAAI,CAACG,IAAI,CAAC,GAAGP,cAAc,CAACI,IAAI,CAACG,IAAI;IAAE,gBAC1NrB,KAAA,CAAAuB,aAAA,CAACnB,IAAI;MAACoB,KAAK,EAAE;QAAES,IAAI,EAAC,CAAC;QAAEC,WAAW,EAAC;MAAG;IAAE,gBACpClC,KAAA,CAAAuB,aAAA,CAAChB,IAAI;MAAC4B,IAAI,EAAE,EAAG;MAACC,KAAK,EAAE5B,MAAM,CAAC6B,KAAK,CAACC,QAAS;MAACC,MAAM,EAAC;I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AAE,CAAE,CAAC,eAC3BjC,KAAA,CAAAuB,aAAA,CAAClB,MAAM;IACCiD,KAAK,EAAC,OAAO;IACb9B,KAAK,EAAE;MAAE+B,SAAS,EAAC;IAAW,CAAE;IAChCJ,eAAe,EAAE3C,MAAM,CAAC6B,KAAK,CAACmB,QAAS;IACvC7B,OAAO,EAAE,EAAG;IACZ8B,WAAW,EAAEjD,MAAM,CAACsB,MAAM,CAACsB,KAAM;IACjCJ,YAAY,EAAE,CAAE;IAChBhB,OAAO,EAAEA,CAAA,KAAMhB,OAAO,CAAC;EAAE,CAC5B,CACH,CAAC,eACPhB,KAAA,CAAAuB,aAAA,CAACrB,UAAU;IAACsB,KAAK,EAAE;MAAES,IAAI,EAAC;IAAE;EAAE,gBAC1BjC,KAAA,CAAAuB,aAAA,CAACtB,QAAQ;IACLiB,IAAI,EAAEN,OAAQ;IACd8C,UAAU,EAAEzC,aAAc;IAC1B0C,YAAY,EAAGtC,IAAI,IAAKA,IAAI,CAACC,SAAS,CAACsC,QAAQ,CAAC;EAAE,CACrD,CACO,CACV,CAAC;AAEf,CAAC;AAED,eAAelD,cAAc","ignoreList":[]}
@@ -0,0 +1,179 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { ScrollView, View, ActivityIndicator } from "react-native";
3
+ import { view_styles } from '../constants/styles';
4
+ import CompetitionInfoForm from './components/CompetitionInfoForm';
5
+ import Colors from '../constants/colors';
6
+ import { ManageCompetitionApi, ManageCompetitionMatchApi } from './api';
7
+ import CompetitionSettingsForm from './components/CompetitionSettingsForm';
8
+ import CompetitionContestsForm from './components/CompetitionContestsForm';
9
+ const CompetitionManager = ({
10
+ competition_id
11
+ }) => {
12
+ const [module_size, setModuleSize] = useState({
13
+ height: 0,
14
+ width: 0
15
+ });
16
+ const [competition_data, setCompetitionData] = useState({
17
+ loaded: false,
18
+ loading: false,
19
+ competition_result_types: [],
20
+ competition_types: [],
21
+ competition_matches: [],
22
+ competition_payout_types: [],
23
+ competition_match_markets: [],
24
+ markets: [],
25
+ leagues: [],
26
+ events: [],
27
+ tournaments: [],
28
+ matches: [],
29
+ teams: [],
30
+ athletes: []
31
+ });
32
+ const {
33
+ loaded,
34
+ competition,
35
+ competition_result_types,
36
+ competition_types,
37
+ draft_competition,
38
+ competition_matches,
39
+ competition_match_markets,
40
+ markets,
41
+ leagues,
42
+ events,
43
+ tournaments,
44
+ matches,
45
+ teams,
46
+ athletes
47
+ } = competition_data;
48
+ useEffect(() => {
49
+ if (!loaded) {
50
+ ManageCompetitionApi.setEnvironment();
51
+ }
52
+ getDataFromServer(competition_id);
53
+ }, [competition_id]);
54
+ const getDataFromServer = async id => {
55
+ const c = await ManageCompetitionApi.getCompetitionById(id);
56
+ const cm_resp = await ManageCompetitionMatchApi.getCompetitionMatchesByCompetitionId(id);
57
+ const options = await ManageCompetitionApi.getCompetitionOptions();
58
+ const lgs = await ManageCompetitionApi.getLeagues();
59
+ const mks = await ManageCompetitionApi.getMarkets();
60
+ //Get unique contests
61
+ let event_ids = cm_resp.competition_matches.filter(cm => cm.event_type == 'team').map(cm => cm.event_id);
62
+ let tournament_ids = cm_resp.competition_matches.filter(cm => cm.event_type == 'tournament').map(cm => cm.event_id);
63
+ let match_ids = cm_resp.competition_matches.filter(cm => cm.event_type == 'match').map(cm => cm.event_id);
64
+ //Get unique side ids
65
+ let athlete_ids = cm_resp.competition_matches.filter(cm => cm.side_type_override == 'athlete').map(cm => cm.side_id_override ?? '0');
66
+ let team_ids = cm_resp.competition_matches.filter(cm => cm.side_type_override == 'team').map(cm => cm.side_id_override ?? '0');
67
+ let c_events = [];
68
+ if (event_ids.length > 0) {
69
+ c_events = await ManageCompetitionMatchApi.getEventsByEventIds(event_ids);
70
+ }
71
+ let c_tournaments = [];
72
+ if (tournament_ids.length > 0) {
73
+ c_tournaments = await ManageCompetitionMatchApi.getTournamentsByTournamentIds(tournament_ids);
74
+ }
75
+ let c_matches = [];
76
+ if (match_ids.length > 0) {
77
+ c_matches = await ManageCompetitionMatchApi.getMatchesByMatchIds(match_ids);
78
+ }
79
+ let c_teams = [];
80
+ if (team_ids.length > 0) {
81
+ c_teams = await ManageCompetitionMatchApi.getTeamsByIds(team_ids);
82
+ }
83
+ let c_athletes = [];
84
+ if (athlete_ids.length > 0) {
85
+ c_athletes = await ManageCompetitionMatchApi.getAthletesByIds(athlete_ids);
86
+ }
87
+ setCompetitionData({
88
+ ...competition_data,
89
+ loading: false,
90
+ competition: c,
91
+ leagues: lgs,
92
+ competition_types: options.competition_types,
93
+ competition_payout_types: options.competition_payout_types,
94
+ competition_result_types: options.competition_result_types,
95
+ draft_competition: c,
96
+ competition_matches: cm_resp.competition_matches,
97
+ competition_match_markets: cm_resp.competition_match_markets,
98
+ events: c_events,
99
+ markets: mks,
100
+ tournaments: c_tournaments,
101
+ matches: c_matches,
102
+ teams: c_teams,
103
+ athletes: c_athletes
104
+ });
105
+ };
106
+ if (!competition || !draft_competition) {
107
+ return /*#__PURE__*/React.createElement(View, {
108
+ style: {
109
+ flex: 1
110
+ }
111
+ }, /*#__PURE__*/React.createElement(ActivityIndicator, {
112
+ size: "large",
113
+ color: Colors.brand.midnight,
114
+ style: {
115
+ padding: 20,
116
+ alignSelf: 'center'
117
+ }
118
+ }));
119
+ }
120
+ console.log(module_size);
121
+ return /*#__PURE__*/React.createElement(View, {
122
+ style: {
123
+ flex: 1
124
+ }
125
+ }, /*#__PURE__*/React.createElement(ScrollView, {
126
+ style: {
127
+ flex: 1
128
+ },
129
+ onLayout: ev => {
130
+ const {
131
+ width,
132
+ height
133
+ } = ev.nativeEvent.layout;
134
+ setModuleSize({
135
+ height,
136
+ width
137
+ });
138
+ }
139
+ }, /*#__PURE__*/React.createElement(View, {
140
+ style: {
141
+ ...view_styles.wrapper
142
+ }
143
+ }, /*#__PURE__*/React.createElement(CompetitionInfoForm, {
144
+ competition: draft_competition,
145
+ width: module_size.width - 20,
146
+ onCompetitionUpdate: comp => setCompetitionData({
147
+ ...competition_data,
148
+ draft_competition: comp
149
+ })
150
+ }), /*#__PURE__*/React.createElement(CompetitionSettingsForm, {
151
+ competition: draft_competition,
152
+ width: module_size.width - 20,
153
+ competition_result_types: competition_result_types,
154
+ competition_types: competition_types,
155
+ onCompetitionUpdate: comp => setCompetitionData({
156
+ ...competition_data,
157
+ draft_competition: comp
158
+ })
159
+ }), /*#__PURE__*/React.createElement(CompetitionContestsForm, {
160
+ width: module_size.width - 20,
161
+ competition: draft_competition,
162
+ competition_matches: competition_matches,
163
+ competition_match_markets: competition_match_markets,
164
+ events: events,
165
+ teams: teams,
166
+ athletes: athletes,
167
+ tournaments: tournaments,
168
+ matches: matches,
169
+ leagues: leagues,
170
+ markets: markets,
171
+ onSaveCompetitionMatch: () => console.log('SAVE EVENT'),
172
+ onDeleteCompetitionMatch: () => console.log('DELEVE'),
173
+ onUpdateCompetitionMatch: () => console.log('UPDATE'),
174
+ onSaveCompetitionMatchMarkets: smms => console.log(smms),
175
+ onDeleteCompetitionMatchMarkets: cmms => console.log(cmms)
176
+ }))));
177
+ };
178
+ export default CompetitionManager;
179
+ //# sourceMappingURL=index.js.map