be-components 4.2.1 → 4.2.2

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 (182) hide show
  1. package/lib/commonjs/Competition/components/CompetitionLeaderboard.js +12 -23
  2. package/lib/commonjs/Competition/components/CompetitionLeaderboard.js.map +1 -1
  3. package/lib/commonjs/Competition/components/EnterCompetitionPrompt.js +191 -100
  4. package/lib/commonjs/Competition/components/EnterCompetitionPrompt.js.map +1 -1
  5. package/lib/commonjs/Competition/components/WagerPickForm.js +8 -2
  6. package/lib/commonjs/Competition/components/WagerPickForm.js.map +1 -1
  7. package/lib/commonjs/Competition/index.js +49 -9
  8. package/lib/commonjs/Competition/index.js.map +1 -1
  9. package/lib/commonjs/Components/ConfirmationModal.js +11 -3
  10. package/lib/commonjs/Components/ConfirmationModal.js.map +1 -1
  11. package/lib/commonjs/Components/SearchBox.js +3 -1
  12. package/lib/commonjs/Components/SearchBox.js.map +1 -1
  13. package/lib/commonjs/MarketComponents/components/ContestOrderStatsCard.js +2 -0
  14. package/lib/commonjs/MarketComponents/components/ContestOrderStatsCard.js.map +1 -1
  15. package/lib/commonjs/MarketMaker/components/Contest.js +39 -41
  16. package/lib/commonjs/MarketMaker/components/Contest.js.map +1 -1
  17. package/lib/commonjs/MarketMaker/components/ContestSelector.js +48 -30
  18. package/lib/commonjs/MarketMaker/components/ContestSelector.js.map +1 -1
  19. package/lib/commonjs/MarketMaker/components/Dashboard.js +14 -73
  20. package/lib/commonjs/MarketMaker/components/Dashboard.js.map +1 -1
  21. package/lib/commonjs/MarketMaker/components/FundOwnershipList.js +27 -30
  22. package/lib/commonjs/MarketMaker/components/FundOwnershipList.js.map +1 -1
  23. package/lib/commonjs/MarketMaker/components/FundSelector.js +30 -33
  24. package/lib/commonjs/MarketMaker/components/FundSelector.js.map +1 -1
  25. package/lib/commonjs/MarketMaker/components/FundingRequestList.js +28 -41
  26. package/lib/commonjs/MarketMaker/components/FundingRequestList.js.map +1 -1
  27. package/lib/commonjs/MarketMaker/components/ManageFundForm.js +1 -1
  28. package/lib/commonjs/MarketMaker/components/ManageFundForm.js.map +1 -1
  29. package/lib/commonjs/MarketMaker/components/MarketSelector.js +26 -24
  30. package/lib/commonjs/MarketMaker/components/MarketSelector.js.map +1 -1
  31. package/lib/commonjs/MarketMaker/components/OrderForm.js +7 -4
  32. package/lib/commonjs/MarketMaker/components/OrderForm.js.map +1 -1
  33. package/lib/commonjs/MarketMaker/index.js +301 -227
  34. package/lib/commonjs/MarketMaker/index.js.map +1 -1
  35. package/lib/commonjs/Squares/index.js +28 -9
  36. package/lib/commonjs/Squares/index.js.map +1 -1
  37. package/lib/module/Competition/components/CompetitionLeaderboard.js +12 -23
  38. package/lib/module/Competition/components/CompetitionLeaderboard.js.map +1 -1
  39. package/lib/module/Competition/components/EnterCompetitionPrompt.js +191 -100
  40. package/lib/module/Competition/components/EnterCompetitionPrompt.js.map +1 -1
  41. package/lib/module/Competition/components/WagerPickForm.js +8 -2
  42. package/lib/module/Competition/components/WagerPickForm.js.map +1 -1
  43. package/lib/module/Competition/index.js +49 -9
  44. package/lib/module/Competition/index.js.map +1 -1
  45. package/lib/module/Components/ConfirmationModal.js +11 -3
  46. package/lib/module/Components/ConfirmationModal.js.map +1 -1
  47. package/lib/module/Components/SearchBox.js +3 -1
  48. package/lib/module/Components/SearchBox.js.map +1 -1
  49. package/lib/module/MarketComponents/components/ContestOrderStatsCard.js +2 -0
  50. package/lib/module/MarketComponents/components/ContestOrderStatsCard.js.map +1 -1
  51. package/lib/module/MarketMaker/components/Contest.js +21 -24
  52. package/lib/module/MarketMaker/components/Contest.js.map +1 -1
  53. package/lib/module/MarketMaker/components/ContestSelector.js +43 -25
  54. package/lib/module/MarketMaker/components/ContestSelector.js.map +1 -1
  55. package/lib/module/MarketMaker/components/Dashboard.js +9 -66
  56. package/lib/module/MarketMaker/components/Dashboard.js.map +1 -1
  57. package/lib/module/MarketMaker/components/FundOwnershipList.js +19 -22
  58. package/lib/module/MarketMaker/components/FundOwnershipList.js.map +1 -1
  59. package/lib/module/MarketMaker/components/FundSelector.js +24 -27
  60. package/lib/module/MarketMaker/components/FundSelector.js.map +1 -1
  61. package/lib/module/MarketMaker/components/FundingRequestList.js +18 -31
  62. package/lib/module/MarketMaker/components/FundingRequestList.js.map +1 -1
  63. package/lib/module/MarketMaker/components/ManageFundForm.js +1 -1
  64. package/lib/module/MarketMaker/components/ManageFundForm.js.map +1 -1
  65. package/lib/module/MarketMaker/components/MarketSelector.js +19 -17
  66. package/lib/module/MarketMaker/components/MarketSelector.js.map +1 -1
  67. package/lib/module/MarketMaker/components/OrderForm.js +7 -4
  68. package/lib/module/MarketMaker/components/OrderForm.js.map +1 -1
  69. package/lib/module/MarketMaker/index.js +298 -223
  70. package/lib/module/MarketMaker/index.js.map +1 -1
  71. package/lib/module/Squares/index.js +28 -9
  72. package/lib/module/Squares/index.js.map +1 -1
  73. package/lib/typescript/lib/commonjs/Competition/components/CompetitionLeaderboard.d.ts.map +1 -1
  74. package/lib/typescript/lib/commonjs/Competition/components/EnterCompetitionPrompt.d.ts +2 -1
  75. package/lib/typescript/lib/commonjs/Competition/components/EnterCompetitionPrompt.d.ts.map +1 -1
  76. package/lib/typescript/lib/commonjs/Competition/components/WagerPickForm.d.ts +3 -1
  77. package/lib/typescript/lib/commonjs/Competition/components/WagerPickForm.d.ts.map +1 -1
  78. package/lib/typescript/lib/commonjs/Competition/index.d.ts +2 -1
  79. package/lib/typescript/lib/commonjs/Competition/index.d.ts.map +1 -1
  80. package/lib/typescript/lib/commonjs/Components/ConfirmationModal.d.ts +2 -1
  81. package/lib/typescript/lib/commonjs/Components/ConfirmationModal.d.ts.map +1 -1
  82. package/lib/typescript/lib/commonjs/Components/SearchBox.d.ts +2 -1
  83. package/lib/typescript/lib/commonjs/Components/SearchBox.d.ts.map +1 -1
  84. package/lib/typescript/lib/commonjs/MarketComponents/components/ContestOrderStatsCard.d.ts +2 -1
  85. package/lib/typescript/lib/commonjs/MarketComponents/components/ContestOrderStatsCard.d.ts.map +1 -1
  86. package/lib/typescript/lib/commonjs/MarketMaker/components/Contest.d.ts.map +1 -1
  87. package/lib/typescript/lib/commonjs/MarketMaker/components/ContestSelector.d.ts +1 -2
  88. package/lib/typescript/lib/commonjs/MarketMaker/components/ContestSelector.d.ts.map +1 -1
  89. package/lib/typescript/lib/commonjs/MarketMaker/components/Dashboard.d.ts +1 -2
  90. package/lib/typescript/lib/commonjs/MarketMaker/components/Dashboard.d.ts.map +1 -1
  91. package/lib/typescript/lib/commonjs/MarketMaker/components/FundOwnershipList.d.ts.map +1 -1
  92. package/lib/typescript/lib/commonjs/MarketMaker/components/FundSelector.d.ts +1 -2
  93. package/lib/typescript/lib/commonjs/MarketMaker/components/FundSelector.d.ts.map +1 -1
  94. package/lib/typescript/lib/commonjs/MarketMaker/components/FundingRequestList.d.ts.map +1 -1
  95. package/lib/typescript/lib/commonjs/MarketMaker/components/MarketSelector.d.ts +1 -2
  96. package/lib/typescript/lib/commonjs/MarketMaker/components/MarketSelector.d.ts.map +1 -1
  97. package/lib/typescript/lib/commonjs/MarketMaker/components/OrderForm.d.ts.map +1 -1
  98. package/lib/typescript/lib/commonjs/MarketMaker/index.d.ts.map +1 -1
  99. package/lib/typescript/lib/commonjs/Squares/index.d.ts +2 -1
  100. package/lib/typescript/lib/commonjs/Squares/index.d.ts.map +1 -1
  101. package/lib/typescript/lib/module/Competition/components/CompetitionLeaderboard.d.ts.map +1 -1
  102. package/lib/typescript/lib/module/Competition/components/EnterCompetitionPrompt.d.ts +2 -1
  103. package/lib/typescript/lib/module/Competition/components/EnterCompetitionPrompt.d.ts.map +1 -1
  104. package/lib/typescript/lib/module/Competition/components/WagerPickForm.d.ts +3 -1
  105. package/lib/typescript/lib/module/Competition/components/WagerPickForm.d.ts.map +1 -1
  106. package/lib/typescript/lib/module/Competition/index.d.ts +2 -1
  107. package/lib/typescript/lib/module/Competition/index.d.ts.map +1 -1
  108. package/lib/typescript/lib/module/Components/ConfirmationModal.d.ts +2 -1
  109. package/lib/typescript/lib/module/Components/ConfirmationModal.d.ts.map +1 -1
  110. package/lib/typescript/lib/module/Components/SearchBox.d.ts +2 -1
  111. package/lib/typescript/lib/module/Components/SearchBox.d.ts.map +1 -1
  112. package/lib/typescript/lib/module/MarketComponents/components/ContestOrderStatsCard.d.ts +2 -1
  113. package/lib/typescript/lib/module/MarketComponents/components/ContestOrderStatsCard.d.ts.map +1 -1
  114. package/lib/typescript/lib/module/MarketMaker/components/Contest.d.ts +1 -2
  115. package/lib/typescript/lib/module/MarketMaker/components/Contest.d.ts.map +1 -1
  116. package/lib/typescript/lib/module/MarketMaker/components/ContestSelector.d.ts +2 -4
  117. package/lib/typescript/lib/module/MarketMaker/components/ContestSelector.d.ts.map +1 -1
  118. package/lib/typescript/lib/module/MarketMaker/components/Dashboard.d.ts +2 -4
  119. package/lib/typescript/lib/module/MarketMaker/components/Dashboard.d.ts.map +1 -1
  120. package/lib/typescript/lib/module/MarketMaker/components/FundOwnershipList.d.ts +1 -2
  121. package/lib/typescript/lib/module/MarketMaker/components/FundOwnershipList.d.ts.map +1 -1
  122. package/lib/typescript/lib/module/MarketMaker/components/FundSelector.d.ts +2 -4
  123. package/lib/typescript/lib/module/MarketMaker/components/FundSelector.d.ts.map +1 -1
  124. package/lib/typescript/lib/module/MarketMaker/components/FundingRequestList.d.ts +1 -2
  125. package/lib/typescript/lib/module/MarketMaker/components/FundingRequestList.d.ts.map +1 -1
  126. package/lib/typescript/lib/module/MarketMaker/components/MarketSelector.d.ts +2 -4
  127. package/lib/typescript/lib/module/MarketMaker/components/MarketSelector.d.ts.map +1 -1
  128. package/lib/typescript/lib/module/MarketMaker/components/OrderForm.d.ts.map +1 -1
  129. package/lib/typescript/lib/module/MarketMaker/index.d.ts +1 -2
  130. package/lib/typescript/lib/module/MarketMaker/index.d.ts.map +1 -1
  131. package/lib/typescript/lib/module/Squares/index.d.ts +2 -1
  132. package/lib/typescript/lib/module/Squares/index.d.ts.map +1 -1
  133. package/lib/typescript/src/Competition/components/CompetitionLeaderboard.d.ts.map +1 -1
  134. package/lib/typescript/src/Competition/components/EnterCompetitionPrompt.d.ts +2 -1
  135. package/lib/typescript/src/Competition/components/EnterCompetitionPrompt.d.ts.map +1 -1
  136. package/lib/typescript/src/Competition/components/WagerPickForm.d.ts +3 -1
  137. package/lib/typescript/src/Competition/components/WagerPickForm.d.ts.map +1 -1
  138. package/lib/typescript/src/Competition/index.d.ts +2 -1
  139. package/lib/typescript/src/Competition/index.d.ts.map +1 -1
  140. package/lib/typescript/src/Components/ConfirmationModal.d.ts +2 -1
  141. package/lib/typescript/src/Components/ConfirmationModal.d.ts.map +1 -1
  142. package/lib/typescript/src/Components/SearchBox.d.ts +2 -1
  143. package/lib/typescript/src/Components/SearchBox.d.ts.map +1 -1
  144. package/lib/typescript/src/MarketComponents/components/ContestOrderStatsCard.d.ts +2 -1
  145. package/lib/typescript/src/MarketComponents/components/ContestOrderStatsCard.d.ts.map +1 -1
  146. package/lib/typescript/src/MarketMaker/components/Contest.d.ts.map +1 -1
  147. package/lib/typescript/src/MarketMaker/components/ContestSelector.d.ts +1 -1
  148. package/lib/typescript/src/MarketMaker/components/ContestSelector.d.ts.map +1 -1
  149. package/lib/typescript/src/MarketMaker/components/Dashboard.d.ts +1 -1
  150. package/lib/typescript/src/MarketMaker/components/Dashboard.d.ts.map +1 -1
  151. package/lib/typescript/src/MarketMaker/components/FundOwnershipList.d.ts.map +1 -1
  152. package/lib/typescript/src/MarketMaker/components/FundSelector.d.ts +1 -2
  153. package/lib/typescript/src/MarketMaker/components/FundSelector.d.ts.map +1 -1
  154. package/lib/typescript/src/MarketMaker/components/FundingRequestList.d.ts.map +1 -1
  155. package/lib/typescript/src/MarketMaker/components/ManageFundForm.d.ts +1 -1
  156. package/lib/typescript/src/MarketMaker/components/ManageFundForm.d.ts.map +1 -1
  157. package/lib/typescript/src/MarketMaker/components/MarketSelector.d.ts +1 -2
  158. package/lib/typescript/src/MarketMaker/components/MarketSelector.d.ts.map +1 -1
  159. package/lib/typescript/src/MarketMaker/components/OrderForm.d.ts +1 -1
  160. package/lib/typescript/src/MarketMaker/components/OrderForm.d.ts.map +1 -1
  161. package/lib/typescript/src/MarketMaker/index.d.ts.map +1 -1
  162. package/lib/typescript/src/Squares/index.d.ts +2 -1
  163. package/lib/typescript/src/Squares/index.d.ts.map +1 -1
  164. package/package.json +1 -1
  165. package/src/Competition/components/CompetitionLeaderboard.tsx +10 -21
  166. package/src/Competition/components/EnterCompetitionPrompt.tsx +98 -59
  167. package/src/Competition/components/WagerPickForm.tsx +4 -2
  168. package/src/Competition/index.tsx +33 -25
  169. package/src/Components/ConfirmationModal.tsx +5 -4
  170. package/src/Components/SearchBox.tsx +4 -2
  171. package/src/MarketComponents/components/ContestOrderStatsCard.tsx +3 -1
  172. package/src/MarketMaker/components/Contest.tsx +21 -21
  173. package/src/MarketMaker/components/ContestSelector.tsx +31 -22
  174. package/src/MarketMaker/components/Dashboard.tsx +9 -24
  175. package/src/MarketMaker/components/FundOwnershipList.tsx +13 -15
  176. package/src/MarketMaker/components/FundSelector.tsx +21 -23
  177. package/src/MarketMaker/components/FundingRequestList.tsx +14 -20
  178. package/src/MarketMaker/components/ManageFundForm.tsx +2 -2
  179. package/src/MarketMaker/components/MarketSelector.tsx +14 -16
  180. package/src/MarketMaker/components/OrderForm.tsx +6 -5
  181. package/src/MarketMaker/index.tsx +166 -94
  182. package/src/Squares/index.tsx +29 -19
@@ -1,8 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { View } from 'react-native';
3
2
  import { MarketMakerApi, MarketMaketHelpers } from './api';
4
- //import { view_styles } from '../constants/styles';
5
- import Colors from '../constants/colors';
6
3
  import ContestSelector from './components/ContestSelector';
7
4
  import Dashboard from './components/Dashboard';
8
5
  import MarketSelector from './components/MarketSelector';
@@ -14,6 +11,10 @@ import FundingRequestList from './components/FundingRequestList';
14
11
  import FundOwnershipList from './components/FundOwnershipList';
15
12
  import SocketManager from '../Socket';
16
13
  import OrderForm from './components/OrderForm';
14
+ import { Text, View } from '../Components/Themed';
15
+ import { FlatList, Modal } from 'react-native';
16
+ const contest_sections = ['header', 'toggle', 'funds', 'fund_owners', 'fund_requests', 'contests', 'markets'];
17
+ const dashboard_sections = ['dashboard'];
17
18
  const MarketMaker = ({
18
19
  player_id,
19
20
  access_token,
@@ -32,7 +33,6 @@ const MarketMaker = ({
32
33
  matches: []
33
34
  });
34
35
  const {
35
- loaded,
36
36
  leagues,
37
37
  events,
38
38
  markets,
@@ -116,12 +116,6 @@ const MarketMaker = ({
116
116
  loadModule();
117
117
  getLocation();
118
118
  }, [player_id]);
119
- useEffect(() => {
120
- if (!fund?.fund_id || !loaded) {
121
- return;
122
- }
123
- getDashData(fund.fund_id);
124
- }, [fund]);
125
119
  useEffect(() => {
126
120
  if (!ba_socket_data) {
127
121
  return;
@@ -175,6 +169,10 @@ const MarketMaker = ({
175
169
  }
176
170
  };
177
171
  const getDashData = async fund_id => {
172
+ setDashData({
173
+ ...dash_data,
174
+ loading: true
175
+ });
178
176
  //Now load Dash data
179
177
  console.log('1');
180
178
  const ba = await MarketMakerApi.getBestAvailableOrders();
@@ -205,6 +203,7 @@ const MarketMaker = ({
205
203
  ...dash_data,
206
204
  loaded: true,
207
205
  loading: false,
206
+ fund: fund_response.fund,
208
207
  funding_requests: fr_requests,
209
208
  players: plays,
210
209
  fund_ownerships: fund_response.fund_ownerships,
@@ -216,6 +215,9 @@ const MarketMaker = ({
216
215
  selected_markets: my_action_data.markets
217
216
  });
218
217
  };
218
+ const handleSelectFund = async fund => {
219
+ await getDashData(fund.fund_id);
220
+ };
219
221
  const getDataForMyAction = async (orders, markets) => {
220
222
  const ev_ids = orders.filter(o => o.event_type == 'team').map(o => o.event_id);
221
223
  const mks = markets.filter(m => orders.map(o => o.market_id.toString()).includes(m.market_id.toString()));
@@ -261,229 +263,278 @@ const MarketMaker = ({
261
263
  trades: trades.filter(t => t.event_id != e.event_id)
262
264
  });
263
265
  };
266
+ const renderSections = data => {
267
+ switch (data.item) {
268
+ case 'header':
269
+ return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(Text, null, "Fund Manager!"));
270
+ case 'funds':
271
+ return /*#__PURE__*/React.createElement(View, {
272
+ style: {
273
+ margin: 5
274
+ }
275
+ }, /*#__PURE__*/React.createElement(FundSelector, {
276
+ funds: funds,
277
+ selected_fund_id: dash_data.fund?.fund_id,
278
+ onEditFund: f => {
279
+ setEditingFund(f);
280
+ },
281
+ onCreateFund: f => {
282
+ setDashData({
283
+ ...dash_data,
284
+ fund: f
285
+ });
286
+ setEditingFund(f);
287
+ },
288
+ onSelectFund: f => handleSelectFund(f)
289
+ }));
290
+ case 'contests':
291
+ return /*#__PURE__*/React.createElement(View, {
292
+ style: {
293
+ margin: 5
294
+ }
295
+ }, /*#__PURE__*/React.createElement(ContestSelector, {
296
+ maxHeight: 300,
297
+ leagues: leagues.filter(l => l.status == 'active'),
298
+ events: events,
299
+ onSelectEvent: e => handleSelectEvent(e),
300
+ onDeselectEvent: e => handleDeselectEvent(e),
301
+ onSelectMatch: m => console.log(m),
302
+ onSelectTournament: t => console.log(t),
303
+ tournaments: [],
304
+ matches: [],
305
+ selected_events: selected_events.map(e => e.event_id),
306
+ selected_matches: [],
307
+ selected_tournaments: []
308
+ }));
309
+ case 'markets':
310
+ return /*#__PURE__*/React.createElement(View, {
311
+ style: {
312
+ margin: 5
313
+ }
314
+ }, /*#__PURE__*/React.createElement(MarketSelector, {
315
+ markets: selectable_markets.sort((a, b) => parseInt(a.market_id) - parseInt(b.market_id)),
316
+ onSelectMarket: m => setDashData({
317
+ ...dash_data,
318
+ selected_markets: dash_data.selected_markets.concat(m)
319
+ }),
320
+ onDeselectMarket: m => setDashData({
321
+ ...dash_data,
322
+ selected_markets: dash_data.selected_markets.filter(se => se.market_id != m.market_id)
323
+ }),
324
+ selected_markets: selected_markets.map(m => m.market_id)
325
+ }));
326
+ case 'fund_owners':
327
+ if (!fund) {
328
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
329
+ }
330
+ return /*#__PURE__*/React.createElement(View, {
331
+ style: {
332
+ margin: 5
333
+ }
334
+ }, /*#__PURE__*/React.createElement(FundOwnershipList, {
335
+ fund_ownerships: fund_ownerships,
336
+ players: players
337
+ }));
338
+ case 'fund_requests':
339
+ if (!fund) {
340
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
341
+ }
342
+ return /*#__PURE__*/React.createElement(View, {
343
+ style: {
344
+ margin: 5
345
+ }
346
+ }, /*#__PURE__*/React.createElement(FundingRequestList, {
347
+ funding_requests: funding_requests,
348
+ players: players,
349
+ onApproveRequest: async fr_id => {
350
+ const app_response = await MarketMakerApi.approveRequest(fr_id);
351
+ if (!app_response) {
352
+ return alert('Unable to process');
353
+ }
354
+ setDashData({
355
+ ...dash_data,
356
+ fund: app_response.fund,
357
+ fund_ownerships: app_response.fund_ownerships,
358
+ funding_requests: funding_requests.filter(fr => fr.funding_request_id != fr_id)
359
+ });
360
+ },
361
+ onDeclineRequest: async fr_id => {
362
+ const app_response = await MarketMakerApi.declineRequest(fr_id);
363
+ if (!app_response) {
364
+ return alert('Unable to process');
365
+ }
366
+ setDashData({
367
+ ...dash_data,
368
+ funding_requests: funding_requests.filter(fr => fr.funding_request_id != fr_id)
369
+ });
370
+ }
371
+ }));
372
+ case 'dashboard':
373
+ return /*#__PURE__*/React.createElement(View, {
374
+ style: {
375
+ margin: 5
376
+ }
377
+ }, /*#__PURE__*/React.createElement(Dashboard, {
378
+ loaded: dash_data.loaded,
379
+ leagues: leagues,
380
+ fund: fund,
381
+ athletes: athletes,
382
+ events: selected_events,
383
+ tournaments: selected_tournaments,
384
+ matches: selected_matches,
385
+ markets: selected_markets,
386
+ best_available_orders: available_orders,
387
+ trades: trades,
388
+ prices: external_prices,
389
+ external_name: external_name,
390
+ orders: orders,
391
+ fund_orders: fund_orders,
392
+ onOrder: async (o, avail) => {
393
+ console.log(o);
394
+ setDraftOrder({
395
+ visible: true,
396
+ order: o,
397
+ available: avail
398
+ });
399
+ },
400
+ onDepositFund: async amount => {
401
+ if (!fund) {
402
+ return alert('Unable to process');
403
+ }
404
+ const dep_resp = await MarketMakerApi.depositRequest(fund.fund_id, amount);
405
+ console.log(dep_resp);
406
+ },
407
+ onLayoffCapital: async amount => {
408
+ if (!fund) {
409
+ return alert('Unable to process');
410
+ }
411
+ const layoff_resp = await MarketMakerApi.layoffCapital(fund.fund_id, amount);
412
+ if (!layoff_resp) {
413
+ return alert('Unable to process');
414
+ }
415
+ setDashData({
416
+ ...dash_data,
417
+ fund: layoff_resp.fund,
418
+ orders: orders.filter(o => !layoff_resp.orders.find(newo => newo.order_id == o.order_id)).concat(layoff_resp.orders)
419
+ });
420
+ },
421
+ onWorkCapital: async amount => {
422
+ if (!fund) {
423
+ return alert('Unable to process');
424
+ }
425
+ const work_response = await MarketMakerApi.workCapital(fund.fund_id, amount);
426
+ if (!work_response) {
427
+ return alert('Unable to process');
428
+ }
429
+ setDashData({
430
+ ...dash_data,
431
+ fund: work_response.fund,
432
+ orders: work_response.orders
433
+ });
434
+ },
435
+ onClearMarket: async order_ids => {
436
+ const new_orders = await MarketMakerApi.cancelOrders(order_ids);
437
+ setDashData({
438
+ ...dash_data,
439
+ orders: orders.filter(o => !new_orders.find(no => no.order_id == o.order_id)).concat(new_orders)
440
+ });
441
+ },
442
+ onSetMarket: (orders, market, prices) => {
443
+ if (!location.region || !location.coordinates) {
444
+ return alert('Location could not be verified to process orders');
445
+ }
446
+ orders = orders.map(o => {
447
+ return {
448
+ ...o,
449
+ location: location.coordinates,
450
+ region: location.region
451
+ };
452
+ });
453
+ setMarketFormData({
454
+ ...set_market_form_data,
455
+ set_market_form_visible: true,
456
+ set_market_market: market,
457
+ set_market_orders: orders,
458
+ set_market_form_key: `${Math.random()}`,
459
+ set_market_prices: prices
460
+ });
461
+ }
462
+ }));
463
+ default:
464
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
465
+ }
466
+ };
264
467
  return /*#__PURE__*/React.createElement(View, {
265
468
  style: {
266
- flex: 1,
267
- backgroundColor: Colors.shades.white
469
+ flex: 1
268
470
  }
269
471
  }, /*#__PURE__*/React.createElement(View, {
270
472
  style: {
271
473
  flexDirection: 'row'
272
474
  }
273
- }, /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(FundSelector, {
274
- funds: funds,
275
- maxHeight: 300,
276
- selected_fund_id: dash_data.fund?.fund_id,
277
- onEditFund: f => {
278
- setEditingFund(f);
279
- },
280
- onCreateFund: f => {
281
- setDashData({
282
- ...dash_data,
283
- fund: f
284
- });
285
- setEditingFund(f);
286
- },
287
- onSelectFund: f => {
288
- setDashData({
289
- ...dash_data,
290
- fund: f
291
- });
292
- }
293
- }), fund ? /*#__PURE__*/React.createElement(FundOwnershipList, {
294
- fund_ownerships: fund_ownerships,
295
- players: players
296
- }) : /*#__PURE__*/React.createElement(React.Fragment, null), fund ? /*#__PURE__*/React.createElement(FundingRequestList, {
297
- funding_requests: funding_requests,
298
- players: players,
299
- onApproveRequest: async fr_id => {
300
- const app_response = await MarketMakerApi.approveRequest(fr_id);
301
- if (!app_response) {
302
- return alert('Unable to process');
303
- }
304
- setDashData({
305
- ...dash_data,
306
- fund: app_response.fund,
307
- fund_ownerships: app_response.fund_ownerships,
308
- funding_requests: funding_requests.filter(fr => fr.funding_request_id != fr_id)
309
- });
310
- },
311
- onDeclineRequest: async fr_id => {
312
- const app_response = await MarketMakerApi.declineRequest(fr_id);
313
- if (!app_response) {
314
- return alert('Unable to process');
315
- }
316
- setDashData({
317
- ...dash_data,
318
- funding_requests: funding_requests.filter(fr => fr.funding_request_id != fr_id)
319
- });
475
+ }, /*#__PURE__*/React.createElement(View, {
476
+ style: {
477
+ flex: 1
320
478
  }
321
- }) : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement(ContestSelector, {
322
- maxHeight: 300,
323
- leagues: leagues.filter(l => l.status == 'active'),
324
- events: events,
325
- onSelectEvent: e => handleSelectEvent(e),
326
- onDeselectEvent: e => handleDeselectEvent(e),
327
- onSelectMatch: m => console.log(m),
328
- onSelectTournament: t => console.log(t),
329
- tournaments: [],
330
- matches: [],
331
- selected_events: selected_events.map(e => e.event_id),
332
- selected_matches: [],
333
- selected_tournaments: []
334
- }), /*#__PURE__*/React.createElement(MarketSelector, {
335
- maxHeight: 300,
336
- markets: selectable_markets.sort((a, b) => parseInt(a.market_id) - parseInt(b.market_id)),
337
- onSelectMarket: m => setDashData({
338
- ...dash_data,
339
- selected_markets: dash_data.selected_markets.concat(m)
340
- }),
341
- onDeselectMarket: m => setDashData({
342
- ...dash_data,
343
- selected_markets: dash_data.selected_markets.filter(se => se.market_id != m.market_id)
344
- }),
345
- selected_markets: selected_markets.map(m => m.market_id)
479
+ }, /*#__PURE__*/React.createElement(FlatList, {
480
+ data: contest_sections,
481
+ key: 'contest_sections',
482
+ keyExtractor: item => item,
483
+ renderItem: renderSections
346
484
  })), /*#__PURE__*/React.createElement(View, {
347
485
  style: {
348
- flexGrow: 1,
349
- flexShrink: 1
486
+ flex: 3
350
487
  }
351
- }, /*#__PURE__*/React.createElement(Dashboard, {
352
- loaded: dash_data.loaded,
353
- leagues: leagues,
354
- fund: fund,
355
- athletes: athletes,
356
- events: selected_events,
357
- tournaments: selected_tournaments,
358
- matches: selected_matches,
359
- markets: selected_markets,
360
- best_available_orders: available_orders,
361
- trades: trades,
362
- prices: external_prices,
363
- external_name: external_name,
364
- orders: orders,
365
- fund_orders: fund_orders,
366
- onOrder: async (o, avail) => {
367
- console.log(o);
368
- setDraftOrder({
369
- visible: true,
370
- order: o,
371
- available: avail
372
- });
373
- },
374
- onDepositFund: async amount => {
375
- if (!fund) {
376
- return alert('Unable to process');
377
- }
378
- const dep_resp = await MarketMakerApi.depositRequest(fund.fund_id, amount);
379
- console.log(dep_resp);
380
- },
381
- onLayoffCapital: async amount => {
382
- if (!fund) {
383
- return alert('Unable to process');
384
- }
385
- const layoff_resp = await MarketMakerApi.layoffCapital(fund.fund_id, amount);
386
- if (!layoff_resp) {
387
- return alert('Unable to process');
388
- }
389
- setDashData({
390
- ...dash_data,
391
- fund: layoff_resp.fund,
392
- orders: orders.filter(o => !layoff_resp.orders.find(newo => newo.order_id == o.order_id)).concat(layoff_resp.orders)
393
- });
394
- },
395
- onWorkCapital: async amount => {
396
- if (!fund) {
397
- return alert('Unable to process');
398
- }
399
- const work_response = await MarketMakerApi.workCapital(fund.fund_id, amount);
400
- if (!work_response) {
401
- return alert('Unable to process');
402
- }
403
- setDashData({
404
- ...dash_data,
405
- fund: work_response.fund,
406
- orders: work_response.orders
407
- });
408
- },
409
- onClearMarket: async order_ids => {
410
- const new_orders = await MarketMakerApi.cancelOrders(order_ids);
411
- setDashData({
412
- ...dash_data,
413
- orders: orders.filter(o => !new_orders.find(no => no.order_id == o.order_id)).concat(new_orders)
414
- });
415
- },
416
- onSetMarket: (orders, market, prices) => {
417
- if (!location.region || !location.coordinates) {
418
- return alert('Location could not be verified to process orders');
419
- }
420
- orders = orders.map(o => {
421
- return {
422
- ...o,
423
- location: location.coordinates,
424
- region: location.region
425
- };
426
- });
427
- setMarketFormData({
428
- ...set_market_form_data,
429
- set_market_form_visible: true,
430
- set_market_market: market,
431
- set_market_orders: orders,
432
- set_market_form_key: `${Math.random()}`,
433
- set_market_prices: prices
434
- });
488
+ }, /*#__PURE__*/React.createElement(FlatList, {
489
+ data: dashboard_sections,
490
+ key: 'dashboard_sections',
491
+ keyExtractor: item => item,
492
+ renderItem: renderSections
493
+ }))), /*#__PURE__*/React.createElement(Modal, {
494
+ visible: editing_fund ? true : false,
495
+ transparent: true,
496
+ style: {
497
+ flex: 1
435
498
  }
436
- }), fund && draft_order.order && draft_order.visible ? /*#__PURE__*/React.createElement(View, {
499
+ }, /*#__PURE__*/React.createElement(View, {
500
+ type: "blur",
437
501
  style: {
438
- position: 'absolute',
439
- bottom: 0,
440
- left: 0,
441
- right: 0,
442
- top: 0,
443
- backgroundColor: Colors.shades.black_faded,
502
+ flex: 1,
444
503
  justifyContent: 'center',
445
504
  alignItems: 'center'
446
505
  }
447
- }, /*#__PURE__*/React.createElement(OrderForm, {
448
- fund: fund,
449
- order: draft_order.order,
450
- available: draft_order.available,
451
- onClose: () => setDraftOrder({
452
- visible: false
453
- }),
454
- onSubmit: async order => {
455
- if (!fund) {
456
- return alert('Unable to process');
457
- }
458
- if (!location.region || !location.coordinates) {
459
- return alert('Location could not be verified to process orders');
460
- }
461
- const new_orders = await MarketMakerApi.addOrdersToFund(fund.fund_id, [{
462
- ...order,
463
- location: location.coordinates,
464
- region: location.region
465
- }]);
506
+ }, /*#__PURE__*/React.createElement(View, {
507
+ style: {
508
+ width: 500
509
+ }
510
+ }, /*#__PURE__*/React.createElement(ManageFundForm, {
511
+ fund: editing_fund,
512
+ onClose: () => setEditingFund(undefined),
513
+ onFundUpdate: f => {
514
+ setEditingFund(undefined);
466
515
  setDashData({
467
516
  ...dash_data,
468
- fund_orders: fund_orders.concat(new_orders.fund_orders),
469
- orders: orders.concat(new_orders.orders)
470
- });
471
- setDraftOrder({
472
- visible: false
517
+ fund: f
473
518
  });
474
519
  }
475
- })) : /*#__PURE__*/React.createElement(React.Fragment, null), fund && set_market_form_visible && set_market_market ? /*#__PURE__*/React.createElement(View, {
520
+ })))), /*#__PURE__*/React.createElement(Modal, {
521
+ visible: fund && set_market_form_visible && set_market_market ? true : false,
476
522
  style: {
477
- position: 'absolute',
478
- bottom: 0,
479
- left: 0,
480
- right: 0,
481
- top: 0,
482
- backgroundColor: Colors.shades.black_faded,
523
+ flex: 1
524
+ },
525
+ transparent: true
526
+ }, /*#__PURE__*/React.createElement(View, {
527
+ type: "blur",
528
+ style: {
529
+ flex: 1,
483
530
  justifyContent: 'center',
484
531
  alignItems: 'center'
485
532
  }
486
- }, /*#__PURE__*/React.createElement(SetMarketForm, {
533
+ }, /*#__PURE__*/React.createElement(View, {
534
+ style: {
535
+ width: 500
536
+ }
537
+ }, fund && set_market_market ? /*#__PURE__*/React.createElement(SetMarketForm, {
487
538
  fund: fund,
488
539
  form_key: set_market_form_key,
489
540
  market: set_market_market,
@@ -516,28 +567,52 @@ const MarketMaker = ({
516
567
  set_market_form_key: '',
517
568
  set_market_prices: []
518
569
  })
519
- })) : /*#__PURE__*/React.createElement(React.Fragment, null), editing_fund ? /*#__PURE__*/React.createElement(View, {
570
+ }) : /*#__PURE__*/React.createElement(React.Fragment, null)))), /*#__PURE__*/React.createElement(Modal, {
571
+ visible: draft_order.order ? true : false,
572
+ style: {
573
+ flex: 1
574
+ },
575
+ transparent: true
576
+ }, /*#__PURE__*/React.createElement(View, {
577
+ type: "blur",
520
578
  style: {
521
- position: 'absolute',
522
- bottom: 0,
523
- left: 0,
524
- right: 0,
525
- top: 0,
526
- backgroundColor: Colors.shades.black_faded,
579
+ flex: 1,
527
580
  justifyContent: 'center',
528
581
  alignItems: 'center'
529
582
  }
530
- }, /*#__PURE__*/React.createElement(ManageFundForm, {
531
- fund: editing_fund,
532
- onClose: () => setEditingFund(undefined),
533
- onFundUpdate: f => {
534
- setEditingFund(undefined);
583
+ }, /*#__PURE__*/React.createElement(View, {
584
+ style: {
585
+ width: 500
586
+ }
587
+ }, fund ? /*#__PURE__*/React.createElement(OrderForm, {
588
+ fund: fund,
589
+ order: draft_order.order,
590
+ available: draft_order.available,
591
+ onClose: () => setDraftOrder({
592
+ visible: false
593
+ }),
594
+ onSubmit: async order => {
595
+ if (!fund) {
596
+ return alert('Unable to process');
597
+ }
598
+ if (!location.region || !location.coordinates) {
599
+ return alert('Location could not be verified to process orders');
600
+ }
601
+ const new_orders = await MarketMakerApi.addOrdersToFund(fund.fund_id, [{
602
+ ...order,
603
+ location: location.coordinates,
604
+ region: location.region
605
+ }]);
535
606
  setDashData({
536
607
  ...dash_data,
537
- fund: f
608
+ fund_orders: fund_orders.concat(new_orders.fund_orders),
609
+ orders: orders.concat(new_orders.orders)
610
+ });
611
+ setDraftOrder({
612
+ visible: false
538
613
  });
539
614
  }
540
- })) : /*#__PURE__*/React.createElement(React.Fragment, null))), /*#__PURE__*/React.createElement(SocketManager, {
615
+ }) : /*#__PURE__*/React.createElement(React.Fragment, null)))), /*#__PURE__*/React.createElement(SocketManager, {
541
616
  subscribed_events: ['V1_LOAD_BEST_AVAILABLE', 'V1_UPDATE_FUND'],
542
617
  access_token: access_token,
543
618
  distinct_id: distinct_id,