be-components 7.4.0 → 7.4.3

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 (201) hide show
  1. package/lib/commonjs/ApiOverrides/index.js +4 -0
  2. package/lib/commonjs/ApiOverrides/index.js.map +1 -1
  3. package/lib/commonjs/BettorBot/api/index.js +64 -0
  4. package/lib/commonjs/BettorBot/api/index.js.map +1 -0
  5. package/lib/commonjs/BettorBot/components/BroadcastMessageCard.js +233 -0
  6. package/lib/commonjs/BettorBot/components/BroadcastMessageCard.js.map +1 -0
  7. package/lib/commonjs/BettorBot/components/ServerInfoCard.js +126 -0
  8. package/lib/commonjs/BettorBot/components/ServerInfoCard.js.map +1 -0
  9. package/lib/commonjs/BettorBot/index.js +532 -0
  10. package/lib/commonjs/BettorBot/index.js.map +1 -0
  11. package/lib/commonjs/CreateEngagement/index.js +3 -0
  12. package/lib/commonjs/CreateEngagement/index.js.map +1 -1
  13. package/lib/commonjs/FlashMarket/api/index.js +61 -0
  14. package/lib/commonjs/FlashMarket/api/index.js.map +1 -1
  15. package/lib/commonjs/FlashMarket/components/ManageFlashMarket.js +55 -81
  16. package/lib/commonjs/FlashMarket/components/ManageFlashMarket.js.map +1 -1
  17. package/lib/commonjs/MyAction/api/index.js +580 -0
  18. package/lib/commonjs/MyAction/api/index.js.map +1 -0
  19. package/lib/commonjs/MyAction/components/BracketRow.js +67 -0
  20. package/lib/commonjs/MyAction/components/BracketRow.js.map +1 -0
  21. package/lib/commonjs/MyAction/components/CompetitionRow.js +68 -0
  22. package/lib/commonjs/MyAction/components/CompetitionRow.js.map +1 -0
  23. package/lib/commonjs/MyAction/components/ContestStatRow.js +265 -0
  24. package/lib/commonjs/MyAction/components/ContestStatRow.js.map +1 -0
  25. package/lib/commonjs/MyAction/components/FlashRow.js +131 -0
  26. package/lib/commonjs/MyAction/components/FlashRow.js.map +1 -0
  27. package/lib/commonjs/MyAction/components/ParlayRow.js +236 -0
  28. package/lib/commonjs/MyAction/components/ParlayRow.js.map +1 -0
  29. package/lib/commonjs/MyAction/components/SquaresRow.js +83 -0
  30. package/lib/commonjs/MyAction/components/SquaresRow.js.map +1 -0
  31. package/lib/commonjs/MyAction/index.js +354 -0
  32. package/lib/commonjs/MyAction/index.js.map +1 -0
  33. package/lib/commonjs/PartnerPortal/components/EmbedManager.js +42 -0
  34. package/lib/commonjs/PartnerPortal/components/EmbedManager.js.map +1 -1
  35. package/lib/commonjs/PartnerPortal/components/StringSelector.js +90 -0
  36. package/lib/commonjs/PartnerPortal/components/StringSelector.js.map +1 -0
  37. package/lib/commonjs/index.js +14 -0
  38. package/lib/commonjs/index.js.map +1 -1
  39. package/lib/commonjs/types.d.js.map +1 -1
  40. package/lib/module/ApiOverrides/index.js +4 -0
  41. package/lib/module/ApiOverrides/index.js.map +1 -1
  42. package/lib/module/BettorBot/api/index.js +57 -0
  43. package/lib/module/BettorBot/api/index.js.map +1 -0
  44. package/lib/module/BettorBot/components/BroadcastMessageCard.js +226 -0
  45. package/lib/module/BettorBot/components/BroadcastMessageCard.js.map +1 -0
  46. package/lib/module/BettorBot/components/ServerInfoCard.js +119 -0
  47. package/lib/module/BettorBot/components/ServerInfoCard.js.map +1 -0
  48. package/lib/module/BettorBot/index.js +524 -0
  49. package/lib/module/BettorBot/index.js.map +1 -0
  50. package/lib/module/CreateEngagement/index.js +3 -0
  51. package/lib/module/CreateEngagement/index.js.map +1 -1
  52. package/lib/module/FlashMarket/api/index.js +61 -0
  53. package/lib/module/FlashMarket/api/index.js.map +1 -1
  54. package/lib/module/FlashMarket/components/ManageFlashMarket.js +55 -81
  55. package/lib/module/FlashMarket/components/ManageFlashMarket.js.map +1 -1
  56. package/lib/module/MyAction/api/index.js +573 -0
  57. package/lib/module/MyAction/api/index.js.map +1 -0
  58. package/lib/module/MyAction/components/BracketRow.js +60 -0
  59. package/lib/module/MyAction/components/BracketRow.js.map +1 -0
  60. package/lib/module/MyAction/components/CompetitionRow.js +61 -0
  61. package/lib/module/MyAction/components/CompetitionRow.js.map +1 -0
  62. package/lib/module/MyAction/components/ContestStatRow.js +258 -0
  63. package/lib/module/MyAction/components/ContestStatRow.js.map +1 -0
  64. package/lib/module/MyAction/components/FlashRow.js +124 -0
  65. package/lib/module/MyAction/components/FlashRow.js.map +1 -0
  66. package/lib/module/MyAction/components/ParlayRow.js +229 -0
  67. package/lib/module/MyAction/components/ParlayRow.js.map +1 -0
  68. package/lib/module/MyAction/components/SquaresRow.js +76 -0
  69. package/lib/module/MyAction/components/SquaresRow.js.map +1 -0
  70. package/lib/module/MyAction/index.js +344 -0
  71. package/lib/module/MyAction/index.js.map +1 -0
  72. package/lib/module/PartnerPortal/components/EmbedManager.js +42 -0
  73. package/lib/module/PartnerPortal/components/EmbedManager.js.map +1 -1
  74. package/lib/module/PartnerPortal/components/StringSelector.js +83 -0
  75. package/lib/module/PartnerPortal/components/StringSelector.js.map +1 -0
  76. package/lib/module/index.js +3 -1
  77. package/lib/module/index.js.map +1 -1
  78. package/lib/module/types.d.js.map +1 -1
  79. package/lib/typescript/lib/commonjs/ApiOverrides/index.d.ts.map +1 -1
  80. package/lib/typescript/lib/commonjs/BettorBot/api/index.d.ts +9 -0
  81. package/lib/typescript/lib/commonjs/BettorBot/api/index.d.ts.map +1 -0
  82. package/lib/typescript/lib/commonjs/BettorBot/components/BroadcastMessageCard.d.ts +10 -0
  83. package/lib/typescript/lib/commonjs/BettorBot/components/BroadcastMessageCard.d.ts.map +1 -0
  84. package/lib/typescript/lib/commonjs/BettorBot/components/ServerInfoCard.d.ts +10 -0
  85. package/lib/typescript/lib/commonjs/BettorBot/components/ServerInfoCard.d.ts.map +1 -0
  86. package/lib/typescript/lib/commonjs/BettorBot/index.d.ts +7 -0
  87. package/lib/typescript/lib/commonjs/BettorBot/index.d.ts.map +1 -0
  88. package/lib/typescript/lib/commonjs/CreateEngagement/index.d.ts.map +1 -1
  89. package/lib/typescript/lib/commonjs/FlashMarket/api/index.d.ts +1 -0
  90. package/lib/typescript/lib/commonjs/FlashMarket/api/index.d.ts.map +1 -1
  91. package/lib/typescript/lib/commonjs/FlashMarket/components/ManageFlashMarket.d.ts.map +1 -1
  92. package/lib/typescript/lib/commonjs/MyAction/api/index.d.ts +110 -0
  93. package/lib/typescript/lib/commonjs/MyAction/api/index.d.ts.map +1 -0
  94. package/lib/typescript/lib/commonjs/MyAction/components/BracketRow.d.ts +8 -0
  95. package/lib/typescript/lib/commonjs/MyAction/components/BracketRow.d.ts.map +1 -0
  96. package/lib/typescript/lib/commonjs/MyAction/components/CompetitionRow.d.ts +9 -0
  97. package/lib/typescript/lib/commonjs/MyAction/components/CompetitionRow.d.ts.map +1 -0
  98. package/lib/typescript/lib/commonjs/MyAction/components/ContestStatRow.d.ts +15 -0
  99. package/lib/typescript/lib/commonjs/MyAction/components/ContestStatRow.d.ts.map +1 -0
  100. package/lib/typescript/lib/commonjs/MyAction/components/FlashRow.d.ts +10 -0
  101. package/lib/typescript/lib/commonjs/MyAction/components/FlashRow.d.ts.map +1 -0
  102. package/lib/typescript/lib/commonjs/MyAction/components/ParlayRow.d.ts +15 -0
  103. package/lib/typescript/lib/commonjs/MyAction/components/ParlayRow.d.ts.map +1 -0
  104. package/lib/typescript/lib/commonjs/MyAction/components/SquaresRow.d.ts +8 -0
  105. package/lib/typescript/lib/commonjs/MyAction/components/SquaresRow.d.ts.map +1 -0
  106. package/lib/typescript/lib/commonjs/MyAction/index.d.ts +7 -0
  107. package/lib/typescript/lib/commonjs/MyAction/index.d.ts.map +1 -0
  108. package/lib/typescript/lib/commonjs/PartnerPortal/components/EmbedManager.d.ts.map +1 -1
  109. package/lib/typescript/lib/commonjs/PartnerPortal/components/StringSelector.d.ts +8 -0
  110. package/lib/typescript/lib/commonjs/PartnerPortal/components/StringSelector.d.ts.map +1 -0
  111. package/lib/typescript/lib/commonjs/index.d.ts +2 -0
  112. package/lib/typescript/lib/commonjs/index.d.ts.map +1 -1
  113. package/lib/typescript/lib/module/ApiOverrides/index.d.ts.map +1 -1
  114. package/lib/typescript/lib/module/BettorBot/api/index.d.ts +8 -0
  115. package/lib/typescript/lib/module/BettorBot/api/index.d.ts.map +1 -0
  116. package/lib/typescript/lib/module/BettorBot/components/BroadcastMessageCard.d.ts +10 -0
  117. package/lib/typescript/lib/module/BettorBot/components/BroadcastMessageCard.d.ts.map +1 -0
  118. package/lib/typescript/lib/module/BettorBot/components/ServerInfoCard.d.ts +10 -0
  119. package/lib/typescript/lib/module/BettorBot/components/ServerInfoCard.d.ts.map +1 -0
  120. package/lib/typescript/lib/module/BettorBot/index.d.ts +7 -0
  121. package/lib/typescript/lib/module/BettorBot/index.d.ts.map +1 -0
  122. package/lib/typescript/lib/module/CreateEngagement/index.d.ts.map +1 -1
  123. package/lib/typescript/lib/module/FlashMarket/api/index.d.ts +1 -0
  124. package/lib/typescript/lib/module/FlashMarket/api/index.d.ts.map +1 -1
  125. package/lib/typescript/lib/module/FlashMarket/components/ManageFlashMarket.d.ts.map +1 -1
  126. package/lib/typescript/lib/module/MyAction/api/index.d.ts +110 -0
  127. package/lib/typescript/lib/module/MyAction/api/index.d.ts.map +1 -0
  128. package/lib/typescript/lib/module/MyAction/components/BracketRow.d.ts +8 -0
  129. package/lib/typescript/lib/module/MyAction/components/BracketRow.d.ts.map +1 -0
  130. package/lib/typescript/lib/module/MyAction/components/CompetitionRow.d.ts +9 -0
  131. package/lib/typescript/lib/module/MyAction/components/CompetitionRow.d.ts.map +1 -0
  132. package/lib/typescript/lib/module/MyAction/components/ContestStatRow.d.ts +15 -0
  133. package/lib/typescript/lib/module/MyAction/components/ContestStatRow.d.ts.map +1 -0
  134. package/lib/typescript/lib/module/MyAction/components/FlashRow.d.ts +10 -0
  135. package/lib/typescript/lib/module/MyAction/components/FlashRow.d.ts.map +1 -0
  136. package/lib/typescript/lib/module/MyAction/components/ParlayRow.d.ts +15 -0
  137. package/lib/typescript/lib/module/MyAction/components/ParlayRow.d.ts.map +1 -0
  138. package/lib/typescript/lib/module/MyAction/components/SquaresRow.d.ts +8 -0
  139. package/lib/typescript/lib/module/MyAction/components/SquaresRow.d.ts.map +1 -0
  140. package/lib/typescript/lib/module/MyAction/index.d.ts +7 -0
  141. package/lib/typescript/lib/module/MyAction/index.d.ts.map +1 -0
  142. package/lib/typescript/lib/module/PartnerPortal/components/EmbedManager.d.ts.map +1 -1
  143. package/lib/typescript/lib/module/PartnerPortal/components/StringSelector.d.ts +8 -0
  144. package/lib/typescript/lib/module/PartnerPortal/components/StringSelector.d.ts.map +1 -0
  145. package/lib/typescript/lib/module/index.d.ts +3 -1
  146. package/lib/typescript/lib/module/index.d.ts.map +1 -1
  147. package/lib/typescript/src/ApiOverrides/index.d.ts.map +1 -1
  148. package/lib/typescript/src/BettorBot/api/index.d.ts +9 -0
  149. package/lib/typescript/src/BettorBot/api/index.d.ts.map +1 -0
  150. package/lib/typescript/src/BettorBot/components/BroadcastMessageCard.d.ts +15 -0
  151. package/lib/typescript/src/BettorBot/components/BroadcastMessageCard.d.ts.map +1 -0
  152. package/lib/typescript/src/BettorBot/components/ServerInfoCard.d.ts +12 -0
  153. package/lib/typescript/src/BettorBot/components/ServerInfoCard.d.ts.map +1 -0
  154. package/lib/typescript/src/BettorBot/index.d.ts +9 -0
  155. package/lib/typescript/src/BettorBot/index.d.ts.map +1 -0
  156. package/lib/typescript/src/CreateEngagement/index.d.ts.map +1 -1
  157. package/lib/typescript/src/FlashMarket/api/index.d.ts +1 -0
  158. package/lib/typescript/src/FlashMarket/api/index.d.ts.map +1 -1
  159. package/lib/typescript/src/FlashMarket/components/ManageFlashMarket.d.ts.map +1 -1
  160. package/lib/typescript/src/MyAction/api/index.d.ts +103 -0
  161. package/lib/typescript/src/MyAction/api/index.d.ts.map +1 -0
  162. package/lib/typescript/src/MyAction/components/BracketRow.d.ts +10 -0
  163. package/lib/typescript/src/MyAction/components/BracketRow.d.ts.map +1 -0
  164. package/lib/typescript/src/MyAction/components/CompetitionRow.d.ts +15 -0
  165. package/lib/typescript/src/MyAction/components/CompetitionRow.d.ts.map +1 -0
  166. package/lib/typescript/src/MyAction/components/ContestStatRow.d.ts +18 -0
  167. package/lib/typescript/src/MyAction/components/ContestStatRow.d.ts.map +1 -0
  168. package/lib/typescript/src/MyAction/components/FlashRow.d.ts +12 -0
  169. package/lib/typescript/src/MyAction/components/FlashRow.d.ts.map +1 -0
  170. package/lib/typescript/src/MyAction/components/ParlayRow.d.ts +18 -0
  171. package/lib/typescript/src/MyAction/components/ParlayRow.d.ts.map +1 -0
  172. package/lib/typescript/src/MyAction/components/SquaresRow.d.ts +10 -0
  173. package/lib/typescript/src/MyAction/components/SquaresRow.d.ts.map +1 -0
  174. package/lib/typescript/src/MyAction/index.d.ts +14 -0
  175. package/lib/typescript/src/MyAction/index.d.ts.map +1 -0
  176. package/lib/typescript/src/PartnerPortal/components/EmbedManager.d.ts.map +1 -1
  177. package/lib/typescript/src/PartnerPortal/components/StringSelector.d.ts +10 -0
  178. package/lib/typescript/src/PartnerPortal/components/StringSelector.d.ts.map +1 -0
  179. package/lib/typescript/src/index.d.ts +3 -1
  180. package/lib/typescript/src/index.d.ts.map +1 -1
  181. package/package.json +3 -3
  182. package/src/ApiOverrides/index.ts +4 -0
  183. package/src/BettorBot/api/index.ts +49 -0
  184. package/src/BettorBot/components/BroadcastMessageCard.tsx +159 -0
  185. package/src/BettorBot/components/ServerInfoCard.tsx +73 -0
  186. package/src/BettorBot/index.tsx +295 -0
  187. package/src/CreateEngagement/index.tsx +4 -1
  188. package/src/FlashMarket/api/index.ts +72 -0
  189. package/src/FlashMarket/components/ManageFlashMarket.tsx +10 -0
  190. package/src/MyAction/api/index.ts +393 -0
  191. package/src/MyAction/components/BracketRow.tsx +34 -0
  192. package/src/MyAction/components/CompetitionRow.tsx +39 -0
  193. package/src/MyAction/components/ContestStatRow.tsx +153 -0
  194. package/src/MyAction/components/FlashRow.tsx +74 -0
  195. package/src/MyAction/components/ParlayRow.tsx +137 -0
  196. package/src/MyAction/components/SquaresRow.tsx +55 -0
  197. package/src/MyAction/index.tsx +316 -0
  198. package/src/PartnerPortal/components/EmbedManager.tsx +20 -0
  199. package/src/PartnerPortal/components/StringSelector.tsx +55 -0
  200. package/src/index.tsx +4 -0
  201. package/src/types.d.ts +60 -0
@@ -0,0 +1,74 @@
1
+ import React, { useState } from 'react';
2
+ import { Button, Text, View } from "../../Components/Themed"
3
+ import type { PollOptionProps, PollProps, PollResponseProps } from "../../types"
4
+ import { useColors } from '../../constants/useColors';
5
+ import { Icons } from '../../Components';
6
+ import { FlatList } from 'react-native';
7
+
8
+ type FlashRowProps = {
9
+ market_type:'FOR_MONEY'|'FREE',
10
+ poll:PollProps,
11
+ poll_responses:PollResponseProps[],
12
+ poll_options:PollOptionProps[],
13
+ width:number
14
+ }
15
+
16
+ const FlashRow = ({ market_type, poll, poll_options, poll_responses, width }:FlashRowProps) => {
17
+ const Colors = useColors();
18
+ const [ expanded, setExpanded ] = useState(false);
19
+
20
+ const cl = market_type == 'FOR_MONEY' ? '$' : 'E'
21
+ const risk = poll_responses.reduce((a,b) => a + parseFloat(b.stake as string), 0);
22
+ const settled = poll.status == 'closed' ? true : false
23
+ const winnings = poll_responses.reduce((a,b) => a + b.winnings, 0);
24
+
25
+ const renderResponses = (data:{ item:PollResponseProps, index:number }) => {
26
+ const option = poll_options.find(o => o.poll_option_id == data.item.poll_option_id);
27
+ if(!option){ return <></> }
28
+ return (
29
+ <View type='row' style={{ borderBottomWidth:1, borderColor:Colors.borders.light }}>
30
+ <View transparent style={{ flex:1, marginLeft:10 }}>
31
+ <Text theme='h1' size={12}>{option.option_name}</Text>
32
+ </View>
33
+ <View style={{ margin:5, minWidth:40, justifyContent:'center', alignItems:'center' }}>
34
+ <Text theme='h1' size={12}>{cl}{parseFloat(data.item.stake as string).toFixed(2)}</Text>
35
+ <Text theme='light' size={12}>Risk</Text>
36
+ </View>
37
+ </View>
38
+ )
39
+ }
40
+
41
+ return (
42
+ <View>
43
+ <View type='row' style={{ padding:10, borderBottomWidth:1, borderColor:Colors.borders.light, flexWrap:'wrap' }}>
44
+ <Icons.FlameIcon size={25} color={Colors.text.h1} />
45
+ <Button transparent style={{ borderRadius:0, padding:0, borderLeftWidth:1, borderColor:Colors.borders.light, flexGrow:1, marginLeft:6, paddingLeft:6, minWidth:75 }} onPress={() => setExpanded(!expanded)}>
46
+ <Text theme='h1' style={{ maxWidth:width * 0.55 }}>{poll.poll_question}</Text>
47
+ <Text theme='light' style={{ marginTop:3 }} color={Colors.text.action}>See {poll_responses.length} Responses</Text>
48
+ </Button>
49
+ <View style={{ margin:5, minWidth:40, justifyContent:'center', alignItems:'center' }}>
50
+ <Text theme='h1'>{cl}{risk.toFixed(2)}</Text>
51
+ <Text theme='light'>Risk</Text>
52
+ </View>
53
+ {settled ?
54
+ <View style={{ margin:5, minWidth:40, justifyContent:'center', alignItems:'center' }}>
55
+ <Text theme='h1'>{cl}{winnings.toFixed(2)}</Text>
56
+ <Text theme='light'>Winnings</Text>
57
+ </View>
58
+ :<></>}
59
+ </View>
60
+ {expanded ?
61
+ <View transparent style={{ padding:10 }}>
62
+ <FlatList
63
+ data={poll_responses}
64
+ keyExtractor={item => item.poll_response_id.toString()}
65
+ renderItem={renderResponses}
66
+ key={`flash_${poll.poll_id}_responses`}
67
+ />
68
+ </View>
69
+ :<></>}
70
+ </View>
71
+ )
72
+ }
73
+
74
+ export default FlashRow
@@ -0,0 +1,137 @@
1
+ import React, { useState } from 'react';
2
+ import { Button, Text, View } from "../../Components/Themed"
3
+ import type { AthleteProps, EventProps, LeagueProps, MatchProps, OrderProps, ParlayPositionProps, ParlayProps, TeamProps, TournamentProps } from "../../types"
4
+ import { useColors } from '../../constants/useColors';
5
+ import { Icons } from '../../Components';
6
+ import { MyActionHelpers } from '../api';
7
+ import { FlatList, Image } from 'react-native';
8
+ import { AthleteImage, TeamImage } from '../../Components/Jerseys';
9
+ import { MarketComponentHelpers } from '../../MarketComponents/api';
10
+
11
+ type ParlayRowProps = {
12
+ market_type:'FOR_MONEY'|'FREE',
13
+ leagues:LeagueProps[],
14
+ events:EventProps[],
15
+ tournaments:TournamentProps[],
16
+ matches:MatchProps[],
17
+ athletes:AthleteProps[],
18
+ teams:TeamProps[],
19
+ parlay:ParlayProps,
20
+ parlay_orders:OrderProps[],
21
+ parlay_positions:ParlayPositionProps[]
22
+ width:number
23
+ }
24
+
25
+ const ParlayRow = ({ market_type, parlay, events, matches, tournaments, athletes, teams, parlay_orders, parlay_positions, leagues }:ParlayRowProps) => {
26
+ const Colors = useColors();
27
+ const [ expanded, setExpanded ] = useState(false);
28
+
29
+ const cl = market_type == 'FOR_MONEY' ? '$' : 'E'
30
+ const legs = parlay_orders.length
31
+ const { stake, result_ind, winnings, potential_winnings } = MyActionHelpers.aggregatePositions(parlay, parlay_positions);
32
+ const settled = result_ind ? true : false
33
+
34
+ const renderLegResult = (result_ind?:'win'|'lose'|'draw'|'inprogress') => {
35
+ switch(result_ind){
36
+ case 'win':
37
+ return <Icons.CheckIcon size={14} color={Colors.text.success} />
38
+ case 'lose':
39
+ return <Icons.CloseIcon size={14} color={Colors.text.error} />
40
+ case 'draw':
41
+ return <Icons.AlertIcon size={14} color={Colors.text.warning}/>
42
+ default:
43
+ return <Icons.ActivityIcon size={14} color={Colors.text.h1} />
44
+ }
45
+ }
46
+
47
+ const renderOrders = (data:{ item:OrderProps, index:number }) => {
48
+ const { contest_title, athlete, team, league } = MyActionHelpers.getDetailsForOrder(data.item, events, tournaments, matches, athletes, teams, leagues);
49
+ const result_ind = data.item.positions[0]?.result_ind
50
+ return (
51
+ <View type='row' style={{ padding:10, borderBottomWidth:1, borderColor:Colors.borders.light }}>
52
+ {team ?
53
+ <TeamImage
54
+ team={team}
55
+ league={league}
56
+ size={10}
57
+ />
58
+ :athlete ?
59
+ <AthleteImage
60
+ athlete={athlete}
61
+ league={league}
62
+ size={18}
63
+ />
64
+ :league ?
65
+ <Image
66
+ source={{ uri: league.league_image }}
67
+ style={{ height:18, width:18 }}
68
+ resizeMode="cover"
69
+ />
70
+ :<></>
71
+ }
72
+
73
+ <View transparent style={{ flex:1, marginLeft:8 }}>
74
+ <Text theme='h2'>{data.item.title}</Text>
75
+ <View transparent style={{ marginTop:3 }}>
76
+ <Text theme="description">{contest_title}</Text>
77
+ </View>
78
+ </View>
79
+ {data.item.resolution_status != 'closed' ?
80
+ <Button transparent style={{ marginRight:4, marginLeft:4, padding:10, flexDirection:'row', justifyContent:'center', alignItems:'center' }} onPress={() => console.log('ehy')}>
81
+ <Icons.ActivityIcon size={18} color={Colors.text.action} />
82
+ <Text theme="action"> View</Text>
83
+ </Button>
84
+ :<></>}
85
+ <View style={{ padding:10 }}>
86
+ <Text theme="description">{MarketComponentHelpers.getOddsLabel(data.item.odds)}</Text>
87
+ </View>
88
+ {renderLegResult(result_ind)}
89
+ {result_ind == 'draw' ?
90
+ <View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, justifyContent:'center' }}>
91
+ <View style={{ borderBottomWidth:1, borderColor:Colors.borders.light, marginRight:20, marginLeft:20 }} />
92
+ </View>
93
+ :<></>}
94
+ </View>
95
+ )
96
+ }
97
+
98
+
99
+ return (
100
+ <View transparent style={{ padding:10, borderBottomWidth:1, borderColor:Colors.borders.light, borderWidth:expanded?1:undefined }}>
101
+ <View type='row' style={{ flexWrap:'wrap' }}>
102
+ <Icons.ParlayIcon size={20} color={Colors.text.h1} />
103
+ <Button transparent style={{ borderRadius:0, padding:0, borderLeftWidth:1, borderColor:Colors.borders.light, flexGrow:1, marginLeft:6, paddingLeft:6, minWidth:75 }} onPress={() => setExpanded(!expanded)}>
104
+ <Text theme='h1'>{parlay.name}</Text>
105
+ <Text theme='light' style={{ marginTop:3 }} color={Colors.text.action}>See {legs} legs</Text>
106
+ </Button>
107
+ <View style={{ margin:5, minWidth:40, justifyContent:'center', alignItems:'center' }}>
108
+ <Text theme='h1' color={Colors.text.warning}>{cl}{stake.toFixed(2)}</Text>
109
+ <Text theme='light' color={Colors.text.warning}>Risk</Text>
110
+ </View>
111
+ {settled ?
112
+ <View style={{ margin:5, minWidth:40, justifyContent:'center', alignItems:'center' }}>
113
+ <Text theme='h1'>{cl}{winnings.toFixed(2)}</Text>
114
+ <Text theme='light'>Winnings</Text>
115
+ </View>
116
+ :
117
+ <View style={{ margin:5, minWidth:40, justifyContent:'center', alignItems:'center' }}>
118
+ <Text theme='h1'>{cl}{potential_winnings.toFixed(2)}</Text>
119
+ <Text theme='light'>Potential</Text>
120
+ </View>
121
+ }
122
+ </View>
123
+ {expanded ?
124
+ <View transparent style={{ padding:10 }}>
125
+ <FlatList
126
+ data={parlay_orders}
127
+ keyExtractor={item => item.order_id.toString()}
128
+ renderItem={renderOrders}
129
+ key={`parlay_${parlay.parlay_id}_orders`}
130
+ />
131
+ </View>
132
+ :<></>}
133
+ </View>
134
+ )
135
+ }
136
+
137
+ export default ParlayRow
@@ -0,0 +1,55 @@
1
+ import React, { useState } from 'react';
2
+ import { Button, Text, View } from "../../Components/Themed"
3
+ import type { PlayerSquareProps, SquaresCompetitionProps } from "../../types"
4
+ import { useColors } from '../../constants/useColors';
5
+ import { Icons } from '../../Components';
6
+ import { FlatList } from 'react-native';
7
+
8
+ type SquaresRowProps = {
9
+ market_type:'FOR_MONEY'|'FREE',
10
+ squares_competition:SquaresCompetitionProps,
11
+ width:number
12
+ }
13
+
14
+ const SquaresRow = ({ market_type, squares_competition, width }:SquaresRowProps) => {
15
+ const Colors = useColors();
16
+ const [ expanded, setExpanded ] = useState(false);
17
+ const cl = market_type == 'FOR_MONEY' ? '$' : 'E'
18
+
19
+ const renderSquares = (data:{item:PlayerSquareProps, index:number}) => {
20
+ console.log(data.item)
21
+ return (
22
+ <View>
23
+ <Text>SQUARE</Text>
24
+ </View>
25
+ )
26
+ }
27
+
28
+ return (
29
+ <View>
30
+ <View type='row' style={{ padding:10, borderBottomWidth:1, borderColor:Colors.borders.light, flexWrap:'wrap' }}>
31
+ <Icons.SquaresIcon size={22} color={Colors.text.h1} />
32
+ <Button transparent style={{ borderRadius:0, padding:0, borderLeftWidth:1, borderColor:Colors.borders.light, flexGrow:1, marginLeft:6, paddingLeft:6, minWidth:75 }} onPress={() => setExpanded(!expanded)}>
33
+ <Text theme='h1' style={{ maxWidth:width * 0.55 }}>{squares_competition.sq_comp_name}</Text>
34
+ <Text theme='light' style={{ marginTop:3 }} color={Colors.text.action}>See My Squares</Text>
35
+ </Button>
36
+ <View style={{ margin:5, minWidth:40, justifyContent:'center', alignItems:'center' }}>
37
+ <Text theme='h1'>{cl}{(0).toFixed(2)}</Text>
38
+ <Text theme='light'>Risk</Text>
39
+ </View>
40
+
41
+ </View>
42
+ {expanded ?
43
+ <View transparent style={{ padding:10 }}>
44
+ <FlatList
45
+ data={[]}
46
+ renderItem={renderSquares}
47
+ key={`square_${squares_competition.sq_comp_id}_list`}
48
+ />
49
+ </View>
50
+ :<></>}
51
+ </View>
52
+ )
53
+ }
54
+
55
+ export default SquaresRow
@@ -0,0 +1,316 @@
1
+ /**
2
+ * My Action Components
3
+ * This is responsible for viewing all of your action in one spot
4
+ * @returns
5
+ */
6
+ import React, { useEffect, useState } from 'react';
7
+ import { Text, View } from "../Components/Themed"
8
+ import { FlatList } from 'react-native';
9
+ import type { ActionListProps, AthleteProps, BracketCompetitionProps, CompetitionPlayerProps, CompetitionProps, CompetitionRecordProps, CompetitionResultProps, CompetitionResultTypeProps, CompetitionTypeProps, EventProps, LeagueProps, MatchProps, MyPlayerProps, OrderProps, ParlayPositionProps, ParlayProps, PollOptionProps, PollProps, PollResponseProps, SquaresCompetitionProps, TeamProps, TournamentProps } from '../types';
10
+ import { MyActionApi, MyActionHelpers } from './api';
11
+ //import { useColors } from '../constants/useColors';
12
+ import ContestStatRow from './components/ContestStatRow';
13
+ import ParlayRow from './components/ParlayRow';
14
+ import FlashRow from './components/FlashRow';
15
+ import SquaresRow from './components/SquaresRow';
16
+ import CompetitionRow from './components/CompetitionRow';
17
+ import BracketRow from './components/BracketRow';
18
+
19
+ type MyActionProps = {
20
+ me:MyPlayerProps,
21
+ market_type:'FOR_MONEY'|'FREE'
22
+ }
23
+
24
+
25
+ const sections = [ 'header', 'action' ]
26
+ const MyAction = ({ me, market_type }:MyActionProps) => {
27
+ //const Colors = useColors();
28
+ const [ size, setSize ] = useState({ width:0, height:0 });
29
+ const [ contest_state, setContestState ] = useState<{
30
+ loading:boolean,
31
+ leagues:LeagueProps[],
32
+ events:EventProps[],
33
+ tournaments:TournamentProps[],
34
+ matches:MatchProps[],
35
+ athletes:AthleteProps[],
36
+ teams:TeamProps[]
37
+ }>({
38
+ loading:false,
39
+ events:[],
40
+ matches:[],
41
+ leagues:[],
42
+ tournaments:[],
43
+ athletes: [],
44
+ teams:[]
45
+ });
46
+ const { events, tournaments, matches, teams, athletes, leagues } = contest_state;
47
+ const [ engagement_state, setEngagementState ] = useState<{
48
+ loading:boolean,
49
+ competitions:CompetitionProps[],
50
+ competition_players:CompetitionPlayerProps[],
51
+ competition_records:CompetitionRecordProps[],
52
+ competition_results:CompetitionResultProps[],
53
+ competition_types:CompetitionTypeProps[],
54
+ competition_result_types:CompetitionResultTypeProps[],
55
+ squares_competitions:SquaresCompetitionProps[],
56
+ bracket_competitions:BracketCompetitionProps[]
57
+ }>({
58
+ loading:false,
59
+ competitions:[],
60
+ competition_players:[],
61
+ competition_result_types:[],
62
+ competition_results:[],
63
+ competition_records:[],
64
+ competition_types:[],
65
+ squares_competitions:[],
66
+ bracket_competitions:[]
67
+ });
68
+ const { competition_players, competition_records, competition_result_types, competition_results, competition_types, competitions, squares_competitions, bracket_competitions } = engagement_state;
69
+ const [ active_flash_state, setActiveFlashState ] = useState<{
70
+ loading:boolean,
71
+ poll_responses:PollResponseProps[],
72
+ polls:PollProps[],
73
+ poll_options:PollOptionProps[],
74
+ }>({
75
+ loading: false,
76
+ poll_options:[],
77
+ poll_responses:[],
78
+ polls:[],
79
+ });
80
+ const { polls, poll_options, poll_responses } = active_flash_state;
81
+
82
+ const [ active_order_state, setActiveOrderState ] = useState<{
83
+ loading:boolean,
84
+ orders:OrderProps[],
85
+ parlays:ParlayProps[],
86
+ parlay_positions:ParlayPositionProps[],
87
+ parlay_orders:OrderProps[]
88
+ }>({
89
+ loading:false,
90
+ orders: [],
91
+ parlays:[],
92
+ parlay_positions:[],
93
+ parlay_orders:[]
94
+ });
95
+ const { orders, parlays, parlay_orders, parlay_positions } = active_order_state;
96
+
97
+ const action_list = MyActionHelpers.sortAction(orders, parlays, parlay_orders, polls, competitions, squares_competitions, bracket_competitions);
98
+ //const stats = MyActionHelpers.getActionStats(orders, parlays, parlay_positions, competitions, squares_competitions, bracket_competitions)
99
+
100
+ useEffect(() => {
101
+ if(!me){ return }
102
+ MyActionApi.setEnvironment();
103
+ getActiveOrderData();
104
+ getActiveFlashData();
105
+ getActiveEngagements();
106
+ },[me]);
107
+
108
+ const getActiveEngagements = async() => {
109
+ setEngagementState({ ...engagement_state, loading:true });
110
+ const options = await MyActionApi.EngagementApi.getCompetitionOptions();
111
+ const c_resp = await MyActionApi.EngagementApi.getMyActiveCompetitions();
112
+ const s_resp = await MyActionApi.EngagementApi.getMyActiveSquaresCompetitions();
113
+ const b_resp = await MyActionApi.EngagementApi.getMyActiveBracketCompetitions();
114
+ setEngagementState({
115
+ ...engagement_state,
116
+ loading:false,
117
+ competition_types: options.competition_types,
118
+ competition_result_types: options.competition_result_types,
119
+ competitions: c_resp.competitions,
120
+ competition_players: c_resp.competition_players,
121
+ competition_records: c_resp.competition_records,
122
+ competition_results: c_resp.competition_results,
123
+ squares_competitions: s_resp.squares_competitions,
124
+ bracket_competitions: b_resp.bracket_competitions
125
+ });
126
+ }
127
+
128
+ const getActiveFlashData = async() => {
129
+ setActiveFlashState({ ...active_flash_state, loading:true });
130
+ const sfa = await MyActionApi.FlashApi.getMyFlashAction();
131
+ setActiveFlashState({
132
+ ...active_flash_state,
133
+ polls: sfa.polls,
134
+ poll_responses: sfa.poll_responses,
135
+ poll_options: sfa.poll_options,
136
+ loading:false
137
+ })
138
+ }
139
+
140
+ const getActiveOrderData = async() => {
141
+ setActiveOrderState({ ...active_order_state, loading:true });
142
+ const soa = await MyActionApi.OrderApi.getMyAction();
143
+ setActiveOrderState({
144
+ ...active_order_state,
145
+ orders: soa.orders,
146
+ parlays: soa.parlays,
147
+ parlay_orders: soa.parlay_orders,
148
+ parlay_positions: soa.parlay_positions,
149
+ loading:false
150
+ });
151
+ getContestData(soa.orders.concat(soa.parlay_orders))
152
+ }
153
+
154
+ const getContestData = async(orders:OrderProps[]) => {
155
+ setContestState({ ...contest_state, loading:true });
156
+ const { event_ids, tournament_ids, match_ids, athlete_ids, team_ids } = MyActionHelpers.getContestsFromOrders(orders);
157
+ const s_contests = await MyActionHelpers.getContestsByIds(event_ids, tournament_ids, match_ids, athlete_ids, team_ids);
158
+ const s_leagues = await MyActionApi.ContestApi.getLeagues();
159
+ setContestState({
160
+ ...contest_state,
161
+ leagues: s_leagues,
162
+ events: s_contests.events,
163
+ tournaments: s_contests.tournaments,
164
+ matches: s_contests.matches,
165
+ athletes: s_contests.athletes,
166
+ teams: s_contests.teams,
167
+ loading:false
168
+ })
169
+ }
170
+
171
+ const renderAction = (data:{ item:ActionListProps, index:number }) => {
172
+ switch(data.item.type){
173
+ case 'contest':
174
+ if(!data.item.contest_type){ return <></> }
175
+ const event = events.find(e => data.item.contest_type == 'team' && e.event_id == data.item.id);
176
+ const tournament = tournaments.find(t => data.item.contest_type == 'tournament' && t.tournament_id == data.item.id);
177
+ const match = matches.find(m => data.item.contest_type == 'match' && m.match_id == data.item.id);
178
+ const { contest_title, scheduled_datetime } = MyActionHelpers.getContestDetails(data.item.contest_type, event, tournament, match);
179
+ return (
180
+ <ContestStatRow
181
+ leagues={leagues}
182
+ events={events}
183
+ tournaments={tournaments}
184
+ matches={matches}
185
+ teams={teams}
186
+ athletes={athletes}
187
+ market_type={market_type}
188
+ width={size.width}
189
+ contest_label={contest_title}
190
+ time_detail={scheduled_datetime.format('MMM DD YYYY @ hh:mm a')}
191
+ orders={data.item.orders}
192
+ />
193
+ )
194
+ case 'parlay':
195
+ const parlay = parlays.find(p => p.parlay_id == data.item.id);
196
+ const p_orders = parlay_orders.filter(po => po.parlay_id == data.item.id);
197
+ const p_positions = parlay_positions.filter(pp => pp.parlay_id == data.item.id);
198
+ if(!parlay){ return <></> }
199
+ return (
200
+ <ParlayRow
201
+ parlay={parlay}
202
+ leagues={leagues}
203
+ events={events}
204
+ tournaments={tournaments}
205
+ matches={matches}
206
+ athletes={athletes}
207
+ teams={teams}
208
+ parlay_orders={p_orders}
209
+ parlay_positions={p_positions}
210
+ market_type={market_type}
211
+ width={size.width}
212
+ />
213
+ )
214
+ case 'flash':
215
+ const poll = polls.find(p => p.poll_id == data.item.id);
216
+ if(!poll){ return <></> }
217
+ let responses = poll_responses.filter(pr => pr.poll_id == data.item.id);
218
+ let options = poll_options.filter(po => po.poll_id == data.item.id);
219
+ return (
220
+ <FlashRow
221
+ poll={poll}
222
+ poll_options={options}
223
+ poll_responses={responses}
224
+ market_type={market_type}
225
+ width={size.width}
226
+ />
227
+ )
228
+ case 'squares':
229
+ const squares_competition = squares_competitions.find(sc => sc.sq_comp_id == data.item.id);
230
+ if(!squares_competition){ return <></> }
231
+ return (
232
+ <SquaresRow
233
+ squares_competition={squares_competition}
234
+ market_type={market_type}
235
+ width={size.width}
236
+ />
237
+ )
238
+ case 'competition':
239
+ const competition = competitions.find(c => c.competition_id == data.item.id);
240
+ if(!competition){ return <></> }
241
+ const competition_type = competition_types.find(ct => ct.competition_type_id == competition.competition_type_id);
242
+ const competition_result_type = competition_result_types.find(crt => crt.competition_result_type_id == competition.competition_result_type_id);
243
+ const competition_player = competition_players.find(cp => cp.competition_id == data.item.id);
244
+ const competition_record = competition_records.find(cr => cr.competition_id == data.item.id);
245
+ const competition_result = competition_results.find(cr => cr.competition_id == data.item.id);
246
+ if(!competition_result_type || !competition_type ||!competition_player || !competition_record || !competition_result){ return <></> }
247
+ return (
248
+ <CompetitionRow
249
+ competition={competition}
250
+ competition_player={competition_player}
251
+ competition_record={competition_record}
252
+ competition_result={competition_result}
253
+ competition_result_type={competition_result_type}
254
+ competition_type={competition_type}
255
+ market_type={market_type}
256
+ width={size.width}
257
+ />
258
+ )
259
+ case 'bracket':
260
+ const bracket_competition = bracket_competitions.find(bc => bc.bracket_competition_id == data.item.id);
261
+ if(!bracket_competition){ return <></> }
262
+ return (
263
+ <BracketRow
264
+ bracket_competition={bracket_competition}
265
+ width={size.width}
266
+ market_type={market_type}
267
+ />
268
+ )
269
+ default: return <></>
270
+ }
271
+ }
272
+
273
+ const renderSections = (data:{ item:string, index:number }) => {
274
+ switch(data.item){
275
+ case 'header':
276
+ return (
277
+ <></>
278
+ )
279
+ case 'action':
280
+ return (
281
+ <View>
282
+ <View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
283
+ <View transparent style={{ flex:1 }}>
284
+ <Text theme='h1'>My Action</Text>
285
+ <Text theme='description' style={{ marginTop:3 }}>Action List</Text>
286
+ </View>
287
+ </View>
288
+ <FlatList
289
+ data={action_list}
290
+ key={'action_list'}
291
+ keyExtractor={(item) => item.id.toString()}
292
+ renderItem={renderAction}
293
+ />
294
+ </View>
295
+ )
296
+ default: return <></>
297
+ }
298
+ }
299
+
300
+
301
+ return (
302
+ <View transparent style={{ flex:1 }} onLayout={(ev) => {
303
+ const { width, height } = ev.nativeEvent.layout
304
+ setSize({ width, height });
305
+ }}>
306
+ <FlatList
307
+ data={sections}
308
+ key={'action_sections'}
309
+ keyExtractor={item => item}
310
+ renderItem={renderSections}
311
+ />
312
+ </View>
313
+ )
314
+ }
315
+
316
+ export default MyAction
@@ -12,6 +12,7 @@ import CompetitionSelector from './CompetitionSelector';
12
12
  import SquaresSelector from './SquaresSelector';
13
13
  import FlashSelector from './FlashSelector';
14
14
  import FlashMarketSelector from './FlashMarketSelector';
15
+ import StringSelector from './StringSelector';
15
16
 
16
17
  type EmbedManagerProps = {
17
18
  company_embed_id:string,
@@ -163,6 +164,25 @@ const EmbedManager = ({ float, me, company_id, company_embed_id, onFocusPosition
163
164
  />
164
165
  </View>
165
166
  )
167
+ case 'string_selector':
168
+ if(!data.item.options){ return <></> }
169
+ return (
170
+ <View transparent style={{ borderBottomWidth:1, borderColor:Colors.borders.light, padding:10 }}>
171
+ <View transparent>
172
+ <Text theme='h1'>{data.item.label}</Text>
173
+ <Text theme='description' style={{ marginTop:3 }}>{data.item.description}</Text>
174
+ </View>
175
+ <View transparent style={{ marginTop:10 }}>
176
+ <StringSelector
177
+ active_value={value}
178
+ options={data.item.options}
179
+ onSelectOption={(option) => {
180
+ setEmbedData({ ...embed_data, draft_company_embed: { ...draft_company_embed, properties: { ...draft_company_embed.properties, [data.item.property]: option?.value } } })
181
+ }}
182
+ />
183
+ </View>
184
+ </View>
185
+ )
166
186
  case 'switch':
167
187
  //Switch is going to be either a 1 or a 0. 0 is off
168
188
  const boolean_value = value && value == '1' ? true : false
@@ -0,0 +1,55 @@
1
+ import React, { useState } from "react";
2
+ import type { StringSelectorOptionProps } from "../../types";
3
+ import { useColors } from "../../constants/useColors";
4
+ import { Button, Text, View } from "../../Components/Themed";
5
+ import { FlatList } from "react-native";
6
+ import { Icons } from "../../Components";
7
+
8
+ type StringSelectorProps = {
9
+ active_value?:string,
10
+ options: StringSelectorOptionProps[],
11
+ onSelectOption:(option:StringSelectorOptionProps | undefined) => void
12
+ }
13
+ const StringSelector = ({ active_value, options, onSelectOption }:StringSelectorProps) => {
14
+ const Colors = useColors();
15
+ const [ visible, setVisible ] = useState(false);
16
+
17
+ const active_option = options.find(o => o.value == active_value);
18
+
19
+
20
+ const renderLeagues = (data:{ item:StringSelectorOptionProps, index:number }) => {
21
+ return (
22
+ <Button
23
+ transparent
24
+ style={{ flexDirection:'row', alignItems:'center', padding:10, borderRadius:0, borderBottomWidth:1, borderColor:Colors.borders.light }}
25
+ onPress={() => { setVisible(false); onSelectOption(data.item) }}
26
+ >
27
+ <View transparent style={{ flex:1, marginLeft:10 }}>
28
+ <Text theme='h1'>{data.item.label}</Text>
29
+ <Text theme='description' style={{ marginTop:3 }}>{data.item.description}</Text>
30
+ </View>
31
+ </Button>
32
+ )
33
+ }
34
+
35
+ return (
36
+ <View style={{ padding:15 }} float>
37
+ <Button transparent style={{ padding:0, flexDirection:'row', alignItems:'center' }} onPress={() => { setVisible(!visible); onSelectOption(undefined)}}>
38
+ <Text style={{ flex:1, marginRight:10 }} theme='h1'>{active_option?.label ?? 'Select Option'}</Text>
39
+ <Icons.ChevronIcon direction={visible?'up':'down'} color={Colors.text.h1} size={8} />
40
+ </Button>
41
+ {visible ?
42
+ <View transparent style={{ marginTop:20 }}>
43
+ <FlatList
44
+ data={options.sort((a,b) => a.value.localeCompare(b.value))}
45
+ key={'string_option_selector'}
46
+ keyExtractor={item => item.value.toString()}
47
+ renderItem={renderLeagues}
48
+ />
49
+ </View>
50
+ :<></>}
51
+ </View>
52
+ )
53
+ }
54
+
55
+ export default StringSelector