be-components 7.4.0 → 7.4.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 (149) hide show
  1. package/lib/commonjs/CreateEngagement/index.js +3 -0
  2. package/lib/commonjs/CreateEngagement/index.js.map +1 -1
  3. package/lib/commonjs/FlashMarket/api/index.js +61 -0
  4. package/lib/commonjs/FlashMarket/api/index.js.map +1 -1
  5. package/lib/commonjs/FlashMarket/components/ManageFlashMarket.js +55 -81
  6. package/lib/commonjs/FlashMarket/components/ManageFlashMarket.js.map +1 -1
  7. package/lib/commonjs/MyAction/api/index.js +580 -0
  8. package/lib/commonjs/MyAction/api/index.js.map +1 -0
  9. package/lib/commonjs/MyAction/components/BracketRow.js +67 -0
  10. package/lib/commonjs/MyAction/components/BracketRow.js.map +1 -0
  11. package/lib/commonjs/MyAction/components/CompetitionRow.js +68 -0
  12. package/lib/commonjs/MyAction/components/CompetitionRow.js.map +1 -0
  13. package/lib/commonjs/MyAction/components/ContestStatRow.js +265 -0
  14. package/lib/commonjs/MyAction/components/ContestStatRow.js.map +1 -0
  15. package/lib/commonjs/MyAction/components/FlashRow.js +131 -0
  16. package/lib/commonjs/MyAction/components/FlashRow.js.map +1 -0
  17. package/lib/commonjs/MyAction/components/ParlayRow.js +236 -0
  18. package/lib/commonjs/MyAction/components/ParlayRow.js.map +1 -0
  19. package/lib/commonjs/MyAction/components/SquaresRow.js +83 -0
  20. package/lib/commonjs/MyAction/components/SquaresRow.js.map +1 -0
  21. package/lib/commonjs/MyAction/index.js +354 -0
  22. package/lib/commonjs/MyAction/index.js.map +1 -0
  23. package/lib/commonjs/PartnerPortal/components/EmbedManager.js +42 -0
  24. package/lib/commonjs/PartnerPortal/components/EmbedManager.js.map +1 -1
  25. package/lib/commonjs/PartnerPortal/components/StringSelector.js +90 -0
  26. package/lib/commonjs/PartnerPortal/components/StringSelector.js.map +1 -0
  27. package/lib/commonjs/index.js +7 -0
  28. package/lib/commonjs/index.js.map +1 -1
  29. package/lib/commonjs/types.d.js.map +1 -1
  30. package/lib/module/CreateEngagement/index.js +3 -0
  31. package/lib/module/CreateEngagement/index.js.map +1 -1
  32. package/lib/module/FlashMarket/api/index.js +61 -0
  33. package/lib/module/FlashMarket/api/index.js.map +1 -1
  34. package/lib/module/FlashMarket/components/ManageFlashMarket.js +55 -81
  35. package/lib/module/FlashMarket/components/ManageFlashMarket.js.map +1 -1
  36. package/lib/module/MyAction/api/index.js +573 -0
  37. package/lib/module/MyAction/api/index.js.map +1 -0
  38. package/lib/module/MyAction/components/BracketRow.js +60 -0
  39. package/lib/module/MyAction/components/BracketRow.js.map +1 -0
  40. package/lib/module/MyAction/components/CompetitionRow.js +61 -0
  41. package/lib/module/MyAction/components/CompetitionRow.js.map +1 -0
  42. package/lib/module/MyAction/components/ContestStatRow.js +258 -0
  43. package/lib/module/MyAction/components/ContestStatRow.js.map +1 -0
  44. package/lib/module/MyAction/components/FlashRow.js +124 -0
  45. package/lib/module/MyAction/components/FlashRow.js.map +1 -0
  46. package/lib/module/MyAction/components/ParlayRow.js +229 -0
  47. package/lib/module/MyAction/components/ParlayRow.js.map +1 -0
  48. package/lib/module/MyAction/components/SquaresRow.js +76 -0
  49. package/lib/module/MyAction/components/SquaresRow.js.map +1 -0
  50. package/lib/module/MyAction/index.js +344 -0
  51. package/lib/module/MyAction/index.js.map +1 -0
  52. package/lib/module/PartnerPortal/components/EmbedManager.js +42 -0
  53. package/lib/module/PartnerPortal/components/EmbedManager.js.map +1 -1
  54. package/lib/module/PartnerPortal/components/StringSelector.js +83 -0
  55. package/lib/module/PartnerPortal/components/StringSelector.js.map +1 -0
  56. package/lib/module/index.js +2 -1
  57. package/lib/module/index.js.map +1 -1
  58. package/lib/module/types.d.js.map +1 -1
  59. package/lib/typescript/lib/commonjs/CreateEngagement/index.d.ts.map +1 -1
  60. package/lib/typescript/lib/commonjs/FlashMarket/api/index.d.ts +1 -0
  61. package/lib/typescript/lib/commonjs/FlashMarket/api/index.d.ts.map +1 -1
  62. package/lib/typescript/lib/commonjs/FlashMarket/components/ManageFlashMarket.d.ts.map +1 -1
  63. package/lib/typescript/lib/commonjs/MyAction/api/index.d.ts +110 -0
  64. package/lib/typescript/lib/commonjs/MyAction/api/index.d.ts.map +1 -0
  65. package/lib/typescript/lib/commonjs/MyAction/components/BracketRow.d.ts +8 -0
  66. package/lib/typescript/lib/commonjs/MyAction/components/BracketRow.d.ts.map +1 -0
  67. package/lib/typescript/lib/commonjs/MyAction/components/CompetitionRow.d.ts +9 -0
  68. package/lib/typescript/lib/commonjs/MyAction/components/CompetitionRow.d.ts.map +1 -0
  69. package/lib/typescript/lib/commonjs/MyAction/components/ContestStatRow.d.ts +15 -0
  70. package/lib/typescript/lib/commonjs/MyAction/components/ContestStatRow.d.ts.map +1 -0
  71. package/lib/typescript/lib/commonjs/MyAction/components/FlashRow.d.ts +10 -0
  72. package/lib/typescript/lib/commonjs/MyAction/components/FlashRow.d.ts.map +1 -0
  73. package/lib/typescript/lib/commonjs/MyAction/components/ParlayRow.d.ts +15 -0
  74. package/lib/typescript/lib/commonjs/MyAction/components/ParlayRow.d.ts.map +1 -0
  75. package/lib/typescript/lib/commonjs/MyAction/components/SquaresRow.d.ts +8 -0
  76. package/lib/typescript/lib/commonjs/MyAction/components/SquaresRow.d.ts.map +1 -0
  77. package/lib/typescript/lib/commonjs/MyAction/index.d.ts +7 -0
  78. package/lib/typescript/lib/commonjs/MyAction/index.d.ts.map +1 -0
  79. package/lib/typescript/lib/commonjs/PartnerPortal/components/EmbedManager.d.ts.map +1 -1
  80. package/lib/typescript/lib/commonjs/PartnerPortal/components/StringSelector.d.ts +8 -0
  81. package/lib/typescript/lib/commonjs/PartnerPortal/components/StringSelector.d.ts.map +1 -0
  82. package/lib/typescript/lib/commonjs/index.d.ts +1 -0
  83. package/lib/typescript/lib/commonjs/index.d.ts.map +1 -1
  84. package/lib/typescript/lib/module/CreateEngagement/index.d.ts.map +1 -1
  85. package/lib/typescript/lib/module/FlashMarket/api/index.d.ts +1 -0
  86. package/lib/typescript/lib/module/FlashMarket/api/index.d.ts.map +1 -1
  87. package/lib/typescript/lib/module/FlashMarket/components/ManageFlashMarket.d.ts.map +1 -1
  88. package/lib/typescript/lib/module/MyAction/api/index.d.ts +110 -0
  89. package/lib/typescript/lib/module/MyAction/api/index.d.ts.map +1 -0
  90. package/lib/typescript/lib/module/MyAction/components/BracketRow.d.ts +8 -0
  91. package/lib/typescript/lib/module/MyAction/components/BracketRow.d.ts.map +1 -0
  92. package/lib/typescript/lib/module/MyAction/components/CompetitionRow.d.ts +9 -0
  93. package/lib/typescript/lib/module/MyAction/components/CompetitionRow.d.ts.map +1 -0
  94. package/lib/typescript/lib/module/MyAction/components/ContestStatRow.d.ts +15 -0
  95. package/lib/typescript/lib/module/MyAction/components/ContestStatRow.d.ts.map +1 -0
  96. package/lib/typescript/lib/module/MyAction/components/FlashRow.d.ts +10 -0
  97. package/lib/typescript/lib/module/MyAction/components/FlashRow.d.ts.map +1 -0
  98. package/lib/typescript/lib/module/MyAction/components/ParlayRow.d.ts +15 -0
  99. package/lib/typescript/lib/module/MyAction/components/ParlayRow.d.ts.map +1 -0
  100. package/lib/typescript/lib/module/MyAction/components/SquaresRow.d.ts +8 -0
  101. package/lib/typescript/lib/module/MyAction/components/SquaresRow.d.ts.map +1 -0
  102. package/lib/typescript/lib/module/MyAction/index.d.ts +7 -0
  103. package/lib/typescript/lib/module/MyAction/index.d.ts.map +1 -0
  104. package/lib/typescript/lib/module/PartnerPortal/components/EmbedManager.d.ts.map +1 -1
  105. package/lib/typescript/lib/module/PartnerPortal/components/StringSelector.d.ts +8 -0
  106. package/lib/typescript/lib/module/PartnerPortal/components/StringSelector.d.ts.map +1 -0
  107. package/lib/typescript/lib/module/index.d.ts +2 -1
  108. package/lib/typescript/lib/module/index.d.ts.map +1 -1
  109. package/lib/typescript/src/CreateEngagement/index.d.ts.map +1 -1
  110. package/lib/typescript/src/FlashMarket/api/index.d.ts +1 -0
  111. package/lib/typescript/src/FlashMarket/api/index.d.ts.map +1 -1
  112. package/lib/typescript/src/FlashMarket/components/ManageFlashMarket.d.ts.map +1 -1
  113. package/lib/typescript/src/MyAction/api/index.d.ts +103 -0
  114. package/lib/typescript/src/MyAction/api/index.d.ts.map +1 -0
  115. package/lib/typescript/src/MyAction/components/BracketRow.d.ts +10 -0
  116. package/lib/typescript/src/MyAction/components/BracketRow.d.ts.map +1 -0
  117. package/lib/typescript/src/MyAction/components/CompetitionRow.d.ts +15 -0
  118. package/lib/typescript/src/MyAction/components/CompetitionRow.d.ts.map +1 -0
  119. package/lib/typescript/src/MyAction/components/ContestStatRow.d.ts +18 -0
  120. package/lib/typescript/src/MyAction/components/ContestStatRow.d.ts.map +1 -0
  121. package/lib/typescript/src/MyAction/components/FlashRow.d.ts +12 -0
  122. package/lib/typescript/src/MyAction/components/FlashRow.d.ts.map +1 -0
  123. package/lib/typescript/src/MyAction/components/ParlayRow.d.ts +18 -0
  124. package/lib/typescript/src/MyAction/components/ParlayRow.d.ts.map +1 -0
  125. package/lib/typescript/src/MyAction/components/SquaresRow.d.ts +10 -0
  126. package/lib/typescript/src/MyAction/components/SquaresRow.d.ts.map +1 -0
  127. package/lib/typescript/src/MyAction/index.d.ts +14 -0
  128. package/lib/typescript/src/MyAction/index.d.ts.map +1 -0
  129. package/lib/typescript/src/PartnerPortal/components/EmbedManager.d.ts.map +1 -1
  130. package/lib/typescript/src/PartnerPortal/components/StringSelector.d.ts +10 -0
  131. package/lib/typescript/src/PartnerPortal/components/StringSelector.d.ts.map +1 -0
  132. package/lib/typescript/src/index.d.ts +2 -1
  133. package/lib/typescript/src/index.d.ts.map +1 -1
  134. package/package.json +3 -3
  135. package/src/CreateEngagement/index.tsx +4 -1
  136. package/src/FlashMarket/api/index.ts +72 -0
  137. package/src/FlashMarket/components/ManageFlashMarket.tsx +10 -0
  138. package/src/MyAction/api/index.ts +393 -0
  139. package/src/MyAction/components/BracketRow.tsx +34 -0
  140. package/src/MyAction/components/CompetitionRow.tsx +39 -0
  141. package/src/MyAction/components/ContestStatRow.tsx +153 -0
  142. package/src/MyAction/components/FlashRow.tsx +74 -0
  143. package/src/MyAction/components/ParlayRow.tsx +137 -0
  144. package/src/MyAction/components/SquaresRow.tsx +55 -0
  145. package/src/MyAction/index.tsx +316 -0
  146. package/src/PartnerPortal/components/EmbedManager.tsx +20 -0
  147. package/src/PartnerPortal/components/StringSelector.tsx +55 -0
  148. package/src/index.tsx +2 -0
  149. package/src/types.d.ts +12 -0
@@ -0,0 +1,153 @@
1
+ import React, { useState } from 'react';
2
+ import { Button, Text, View } from "../../Components/Themed"
3
+ import type { AthleteProps, EventProps, LeagueProps, MatchProps, OrderProps, 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 ContestStatRowProps = {
12
+ market_type:'FOR_MONEY'|'FREE',
13
+ contest_label:string,
14
+ time_detail:string,
15
+ orders:OrderProps[],
16
+ leagues:LeagueProps[],
17
+ events:EventProps[],
18
+ tournaments:TournamentProps[],
19
+ matches:MatchProps[],
20
+ athletes:AthleteProps[],
21
+ teams:TeamProps[],
22
+ width:number
23
+ }
24
+
25
+ const ContestStatRow = ({ market_type, contest_label, orders, width, events, tournaments, matches, athletes, teams, leagues }:ContestStatRowProps) => {
26
+ const Colors = useColors();
27
+ const [ expanded, setExpanded ] = useState(false);
28
+ const stats = MyActionHelpers.calcAllOrderStats(orders);
29
+ const stake = stats.unresolved_stake + stats.resolved_stake
30
+ const potential_winnings = stats.unresolved_potential_winnings + stats.resolved_potential_winnings
31
+ const cl = market_type == 'FOR_MONEY' ? '$' : 'E'
32
+ //Is this in progress?
33
+ const in_progress = stats.open_amt > 0 ? true : false
34
+ const settled = stats.result_ind ? true : false
35
+
36
+
37
+ const renderLegResult = (result_ind?:'win'|'lose'|'draw'|'inprogress') => {
38
+ switch(result_ind){
39
+ case 'win':
40
+ return <Icons.CheckIcon size={14} color={Colors.text.success} />
41
+ case 'lose':
42
+ return <Icons.CloseIcon size={14} color={Colors.text.error} />
43
+ case 'draw':
44
+ return <Icons.AlertIcon size={14} color={Colors.text.warning}/>
45
+ default:
46
+ return <Icons.ActivityIcon size={14} color={Colors.text.h1} />
47
+ }
48
+ }
49
+
50
+ const renderOrders = (data:{ item:OrderProps, index:number }) => {
51
+ const { contest_title, athlete, team, league } = MyActionHelpers.getDetailsForOrder(data.item, events, tournaments, matches, athletes, teams, leagues);
52
+ const result_ind = data.item.positions[0]?.result_ind
53
+ return (
54
+ <View type='row' style={{ padding:10, borderBottomWidth:1, borderColor:Colors.borders.light }}>
55
+ {team ?
56
+ <TeamImage
57
+ team={team}
58
+ league={league}
59
+ size={10}
60
+ />
61
+ :athlete ?
62
+ <AthleteImage
63
+ athlete={athlete}
64
+ league={league}
65
+ size={24}
66
+ />
67
+ :league ?
68
+ <Image
69
+ source={{ uri: league.league_image }}
70
+ style={{ height:18, width:18 }}
71
+ resizeMode="cover"
72
+ />
73
+ :<></>
74
+ }
75
+
76
+ <View transparent style={{ flex:1, marginLeft:8 }}>
77
+ <Text theme='h2'>{data.item.title}</Text>
78
+ <View transparent style={{ marginTop:3 }}>
79
+ <Text theme="description">{contest_title}</Text>
80
+ </View>
81
+ </View>
82
+ {data.item.resolution_status != 'closed' ?
83
+ <Button float style={{ marginRight:4, marginLeft:4, padding:10, flexDirection:'row', justifyContent:'center', alignItems:'center' }} onPress={() => console.log('ehy')}>
84
+ <Icons.ActivityIcon size={18} color={Colors.text.action} />
85
+ <Text theme="action"> View</Text>
86
+ </Button>
87
+ :<></>}
88
+ <View style={{ padding:10 }}>
89
+ <Text theme="description">{MarketComponentHelpers.getOddsLabel(data.item.odds)}</Text>
90
+ </View>
91
+ {renderLegResult(result_ind)}
92
+ {result_ind == 'draw' ?
93
+ <View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, justifyContent:'center' }}>
94
+ <View style={{ borderBottomWidth:1, borderColor:Colors.borders.light, marginRight:20, marginLeft:20 }} />
95
+ </View>
96
+ :<></>}
97
+ </View>
98
+ )
99
+ }
100
+
101
+ return (
102
+ <View transparent style={{ borderWidth:expanded ? 1: 0, borderColor:expanded ? Colors.text.action: undefined }}>
103
+ <View type='row' style={{ padding:10, borderBottomWidth:1, borderColor:Colors.borders.light, flexWrap:'wrap' }}>
104
+ <Button float style={{ padding:5 }}>
105
+ <Icons.OrderIcon size={14} color={Colors.text.action} />
106
+ </Button>
107
+ <Button transparent style={{ borderRadius:0, padding:0, borderLeftWidth:1, borderColor:Colors.borders.light, flexGrow:1, marginLeft:6, paddingLeft:6, minWidth:75 }} onPress={() => setExpanded(!expanded)}>
108
+ <Text theme='h1' style={{ maxWidth: width * 0.5 }}>{contest_label}</Text>
109
+ <Text theme='light' color={Colors.text.action} style={{ marginTop:3 }}>See {orders.length} Orders</Text>
110
+ </Button>
111
+ {width > 500 ?
112
+ <View style={{ margin:5, minWidth:40, justifyContent:'center', alignItems:'center' }}>
113
+ <Text theme='h1'>{orders.length}</Text>
114
+ <Text theme='light'>Orders</Text>
115
+ </View>
116
+ :<></>}
117
+ {in_progress ?
118
+ <View style={{ margin:5, minWidth:40, justifyContent:'center', alignItems:'center' }}>
119
+ <Text theme='h1' color={Colors.text.warning}>{stats.open_amt.toFixed(2)}</Text>
120
+ <Text theme='light' color={Colors.text.warning}>Open</Text>
121
+ </View>
122
+ :<></>}
123
+ <View style={{ margin:5, minWidth:40, justifyContent:'center', alignItems:'center' }}>
124
+ <Text theme='h1'>{cl}{stake.toFixed(2)}</Text>
125
+ <Text theme='light'>Risk</Text>
126
+ </View>
127
+ {settled ?
128
+ <View style={{ margin:5, minWidth:40, justifyContent:'center', alignItems:'center' }}>
129
+ <Text theme='h1'>{cl}{stats.winnings.toFixed(2)}</Text>
130
+ <Text theme='light'>Winnings</Text>
131
+ </View>
132
+ :
133
+ <View style={{ margin:5, minWidth:40, justifyContent:'center', alignItems:'center' }}>
134
+ <Text theme='h1'>{cl}{potential_winnings.toFixed(2)}</Text>
135
+ <Text theme='light'>Potential</Text>
136
+ </View>
137
+ }
138
+ </View>
139
+ {expanded ?
140
+ <View transparent style={{ padding:10 }}>
141
+ <FlatList
142
+ data={orders}
143
+ keyExtractor={item => item.order_id.toString()}
144
+ renderItem={renderOrders}
145
+ key={`contest_${contest_label}_orders`}
146
+ />
147
+ </View>
148
+ :<></>}
149
+ </View>
150
+ )
151
+ }
152
+
153
+ export default ContestStatRow
@@ -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