be-components 6.5.1 → 6.5.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 (199) hide show
  1. package/lib/commonjs/ApiOverrides/index.js +4 -4
  2. package/lib/commonjs/ApiOverrides/index.js.map +1 -1
  3. package/lib/commonjs/Authenticator/Components/StrategyForm.js +2 -0
  4. package/lib/commonjs/Authenticator/Components/StrategyForm.js.map +1 -1
  5. package/lib/commonjs/Authenticator/index.js +1 -0
  6. package/lib/commonjs/Authenticator/index.js.map +1 -1
  7. package/lib/commonjs/Clarity/SmartEvents.js +19 -0
  8. package/lib/commonjs/Clarity/SmartEvents.js.map +1 -0
  9. package/lib/commonjs/Components/AutoPageFlatList.js +92 -0
  10. package/lib/commonjs/Components/AutoPageFlatList.js.map +1 -0
  11. package/lib/commonjs/Components/AutoScrollFlatList.js.map +1 -1
  12. package/lib/commonjs/Components/CircularFadeOut.js +34 -0
  13. package/lib/commonjs/Components/CircularFadeOut.js.map +1 -0
  14. package/lib/commonjs/Components/Jerseys.js +5 -2
  15. package/lib/commonjs/Components/Jerseys.js.map +1 -1
  16. package/lib/commonjs/Components/LinearDiagnal.js +3 -1
  17. package/lib/commonjs/Components/LinearDiagnal.js.map +1 -1
  18. package/lib/commonjs/Components/Pagination.js +4 -4
  19. package/lib/commonjs/Components/Pagination.js.map +1 -1
  20. package/lib/commonjs/Components/Themed.js +4 -1
  21. package/lib/commonjs/Components/Themed.js.map +1 -1
  22. package/lib/commonjs/Components/index.js +14 -0
  23. package/lib/commonjs/Components/index.js.map +1 -1
  24. package/lib/commonjs/EventComponents/TeamProfile/index.js.map +1 -1
  25. package/lib/commonjs/GuideView/index.js +216 -0
  26. package/lib/commonjs/GuideView/index.js.map +1 -0
  27. package/lib/commonjs/MarketComponents/api/index.js +25 -0
  28. package/lib/commonjs/MarketComponents/api/index.js.map +1 -1
  29. package/lib/commonjs/MarketComponents/components/AthleteMarket/index.js +2 -2
  30. package/lib/commonjs/MarketComponents/components/AthleteMarket/index.js.map +1 -1
  31. package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js +19 -6
  32. package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
  33. package/lib/commonjs/MarketComponents/components/TeamTournamentMarket/index.js +2 -1
  34. package/lib/commonjs/MarketComponents/components/TeamTournamentMarket/index.js.map +1 -1
  35. package/lib/commonjs/RankingsCard/api/index.js +88 -0
  36. package/lib/commonjs/RankingsCard/api/index.js.map +1 -0
  37. package/lib/commonjs/RankingsCard/index.js +663 -0
  38. package/lib/commonjs/RankingsCard/index.js.map +1 -0
  39. package/lib/commonjs/index.js +21 -0
  40. package/lib/commonjs/index.js.map +1 -1
  41. package/lib/commonjs/types.d.js +1 -0
  42. package/lib/commonjs/types.d.js.map +1 -1
  43. package/lib/module/ApiOverrides/index.js +4 -4
  44. package/lib/module/ApiOverrides/index.js.map +1 -1
  45. package/lib/module/Authenticator/Components/StrategyForm.js +2 -0
  46. package/lib/module/Authenticator/Components/StrategyForm.js.map +1 -1
  47. package/lib/module/Authenticator/index.js +1 -0
  48. package/lib/module/Authenticator/index.js.map +1 -1
  49. package/lib/module/Clarity/SmartEvents.js +13 -0
  50. package/lib/module/Clarity/SmartEvents.js.map +1 -0
  51. package/lib/module/Components/AutoPageFlatList.js +84 -0
  52. package/lib/module/Components/AutoPageFlatList.js.map +1 -0
  53. package/lib/module/Components/AutoScrollFlatList.js.map +1 -1
  54. package/lib/module/Components/CircularFadeOut.js +27 -0
  55. package/lib/module/Components/CircularFadeOut.js.map +1 -0
  56. package/lib/module/Components/Jerseys.js +5 -2
  57. package/lib/module/Components/Jerseys.js.map +1 -1
  58. package/lib/module/Components/LinearDiagnal.js +3 -1
  59. package/lib/module/Components/LinearDiagnal.js.map +1 -1
  60. package/lib/module/Components/Pagination.js +4 -4
  61. package/lib/module/Components/Pagination.js.map +1 -1
  62. package/lib/module/Components/Themed.js +4 -1
  63. package/lib/module/Components/Themed.js.map +1 -1
  64. package/lib/module/Components/index.js +3 -1
  65. package/lib/module/Components/index.js.map +1 -1
  66. package/lib/module/EventComponents/TeamProfile/index.js.map +1 -1
  67. package/lib/module/GuideView/index.js +209 -0
  68. package/lib/module/GuideView/index.js.map +1 -0
  69. package/lib/module/MarketComponents/api/index.js +25 -0
  70. package/lib/module/MarketComponents/api/index.js.map +1 -1
  71. package/lib/module/MarketComponents/components/AthleteMarket/index.js +2 -2
  72. package/lib/module/MarketComponents/components/AthleteMarket/index.js.map +1 -1
  73. package/lib/module/MarketComponents/components/TeamEventMarket/index.js +19 -6
  74. package/lib/module/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
  75. package/lib/module/MarketComponents/components/TeamTournamentMarket/index.js +2 -1
  76. package/lib/module/MarketComponents/components/TeamTournamentMarket/index.js.map +1 -1
  77. package/lib/module/RankingsCard/api/index.js +82 -0
  78. package/lib/module/RankingsCard/api/index.js.map +1 -0
  79. package/lib/module/RankingsCard/index.js +655 -0
  80. package/lib/module/RankingsCard/index.js.map +1 -0
  81. package/lib/module/index.js +4 -1
  82. package/lib/module/index.js.map +1 -1
  83. package/lib/module/types.d.js +1 -0
  84. package/lib/module/types.d.js.map +1 -1
  85. package/lib/typescript/lib/commonjs/Authenticator/Components/StrategyForm.d.ts.map +1 -1
  86. package/lib/typescript/lib/commonjs/Authenticator/index.d.ts.map +1 -1
  87. package/lib/typescript/lib/commonjs/Clarity/SmartEvents.d.ts +14 -0
  88. package/lib/typescript/lib/commonjs/Clarity/SmartEvents.d.ts.map +1 -0
  89. package/lib/typescript/lib/commonjs/Components/AutoPageFlatList.d.ts +12 -0
  90. package/lib/typescript/lib/commonjs/Components/AutoPageFlatList.d.ts.map +1 -0
  91. package/lib/typescript/lib/commonjs/Components/CircularFadeOut.d.ts +9 -0
  92. package/lib/typescript/lib/commonjs/Components/CircularFadeOut.d.ts.map +1 -0
  93. package/lib/typescript/lib/commonjs/Components/Jerseys.d.ts +3 -1
  94. package/lib/typescript/lib/commonjs/Components/Jerseys.d.ts.map +1 -1
  95. package/lib/typescript/lib/commonjs/Components/LinearDiagnal.d.ts +2 -1
  96. package/lib/typescript/lib/commonjs/Components/LinearDiagnal.d.ts.map +1 -1
  97. package/lib/typescript/lib/commonjs/Components/Themed.d.ts.map +1 -1
  98. package/lib/typescript/lib/commonjs/Components/index.d.ts +2 -0
  99. package/lib/typescript/lib/commonjs/GuideView/index.d.ts +7 -0
  100. package/lib/typescript/lib/commonjs/GuideView/index.d.ts.map +1 -0
  101. package/lib/typescript/lib/commonjs/MarketComponents/api/index.d.ts +3 -0
  102. package/lib/typescript/lib/commonjs/MarketComponents/api/index.d.ts.map +1 -1
  103. package/lib/typescript/lib/commonjs/RankingsCard/api/index.d.ts +14 -0
  104. package/lib/typescript/lib/commonjs/RankingsCard/api/index.d.ts.map +1 -0
  105. package/lib/typescript/lib/commonjs/RankingsCard/index.d.ts +7 -0
  106. package/lib/typescript/lib/commonjs/RankingsCard/index.d.ts.map +1 -0
  107. package/lib/typescript/lib/commonjs/index.d.ts +3 -0
  108. package/lib/typescript/lib/commonjs/index.d.ts.map +1 -1
  109. package/lib/typescript/lib/module/Authenticator/Components/StrategyForm.d.ts.map +1 -1
  110. package/lib/typescript/lib/module/Authenticator/index.d.ts.map +1 -1
  111. package/lib/typescript/lib/module/Clarity/SmartEvents.d.ts +13 -0
  112. package/lib/typescript/lib/module/Clarity/SmartEvents.d.ts.map +1 -0
  113. package/lib/typescript/lib/module/Components/AutoPageFlatList.d.ts +12 -0
  114. package/lib/typescript/lib/module/Components/AutoPageFlatList.d.ts.map +1 -0
  115. package/lib/typescript/lib/module/Components/CircularFadeOut.d.ts +9 -0
  116. package/lib/typescript/lib/module/Components/CircularFadeOut.d.ts.map +1 -0
  117. package/lib/typescript/lib/module/Components/Jerseys.d.ts +3 -1
  118. package/lib/typescript/lib/module/Components/Jerseys.d.ts.map +1 -1
  119. package/lib/typescript/lib/module/Components/LinearDiagnal.d.ts +2 -1
  120. package/lib/typescript/lib/module/Components/LinearDiagnal.d.ts.map +1 -1
  121. package/lib/typescript/lib/module/Components/Spring.d.ts +1 -1
  122. package/lib/typescript/lib/module/Components/Themed.d.ts.map +1 -1
  123. package/lib/typescript/lib/module/Components/index.d.ts +3 -1
  124. package/lib/typescript/lib/module/Components/index.d.ts.map +1 -1
  125. package/lib/typescript/lib/module/GuideView/index.d.ts +8 -0
  126. package/lib/typescript/lib/module/GuideView/index.d.ts.map +1 -0
  127. package/lib/typescript/lib/module/LocationTracker/api/index.d.ts +2 -2
  128. package/lib/typescript/lib/module/LocationTracker/api/index.d.ts.map +1 -1
  129. package/lib/typescript/lib/module/MarketComponents/api/index.d.ts +3 -0
  130. package/lib/typescript/lib/module/MarketComponents/api/index.d.ts.map +1 -1
  131. package/lib/typescript/lib/module/MarketComponents/components/TeamEventMarket/index.d.ts +2 -1
  132. package/lib/typescript/lib/module/MarketComponents/components/TeamEventMarket/index.d.ts.map +1 -1
  133. package/lib/typescript/lib/module/MarketComponents/components/TeamTournamentMarket/index.d.ts +2 -1
  134. package/lib/typescript/lib/module/MarketComponents/components/TeamTournamentMarket/index.d.ts.map +1 -1
  135. package/lib/typescript/lib/module/RankingsCard/api/index.d.ts +13 -0
  136. package/lib/typescript/lib/module/RankingsCard/api/index.d.ts.map +1 -0
  137. package/lib/typescript/lib/module/RankingsCard/index.d.ts +9 -0
  138. package/lib/typescript/lib/module/RankingsCard/index.d.ts.map +1 -0
  139. package/lib/typescript/lib/module/index.d.ts +4 -1
  140. package/lib/typescript/lib/module/index.d.ts.map +1 -1
  141. package/lib/typescript/src/Authenticator/Components/StrategyForm.d.ts.map +1 -1
  142. package/lib/typescript/src/Authenticator/index.d.ts.map +1 -1
  143. package/lib/typescript/src/Clarity/SmartEvents.d.ts +13 -0
  144. package/lib/typescript/src/Clarity/SmartEvents.d.ts.map +1 -0
  145. package/lib/typescript/src/Components/AutoPageFlatList.d.ts +15 -0
  146. package/lib/typescript/src/Components/AutoPageFlatList.d.ts.map +1 -0
  147. package/lib/typescript/src/Components/AutoScrollFlatList.d.ts.map +1 -1
  148. package/lib/typescript/src/Components/CircularFadeOut.d.ts +10 -0
  149. package/lib/typescript/src/Components/CircularFadeOut.d.ts.map +1 -0
  150. package/lib/typescript/src/Components/Jerseys.d.ts +3 -1
  151. package/lib/typescript/src/Components/Jerseys.d.ts.map +1 -1
  152. package/lib/typescript/src/Components/LinearDiagnal.d.ts +3 -1
  153. package/lib/typescript/src/Components/LinearDiagnal.d.ts.map +1 -1
  154. package/lib/typescript/src/Components/Pagination.d.ts +2 -2
  155. package/lib/typescript/src/Components/Pagination.d.ts.map +1 -1
  156. package/lib/typescript/src/Components/Themed.d.ts +1 -0
  157. package/lib/typescript/src/Components/Themed.d.ts.map +1 -1
  158. package/lib/typescript/src/Components/index.d.ts +3 -1
  159. package/lib/typescript/src/Components/index.d.ts.map +1 -1
  160. package/lib/typescript/src/EventComponents/TeamProfile/index.d.ts.map +1 -1
  161. package/lib/typescript/src/GuideView/index.d.ts +8 -0
  162. package/lib/typescript/src/GuideView/index.d.ts.map +1 -0
  163. package/lib/typescript/src/MarketComponents/api/index.d.ts +9 -1
  164. package/lib/typescript/src/MarketComponents/api/index.d.ts.map +1 -1
  165. package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts +3 -2
  166. package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts.map +1 -1
  167. package/lib/typescript/src/MarketComponents/components/TeamTournamentMarket/index.d.ts +2 -1
  168. package/lib/typescript/src/MarketComponents/components/TeamTournamentMarket/index.d.ts.map +1 -1
  169. package/lib/typescript/src/MarketComponents/index.d.ts +4 -2
  170. package/lib/typescript/src/MarketComponents/index.d.ts.map +1 -1
  171. package/lib/typescript/src/RankingsCard/api/index.d.ts +20 -0
  172. package/lib/typescript/src/RankingsCard/api/index.d.ts.map +1 -0
  173. package/lib/typescript/src/RankingsCard/index.d.ts +8 -0
  174. package/lib/typescript/src/RankingsCard/index.d.ts.map +1 -0
  175. package/lib/typescript/src/index.d.ts +4 -1
  176. package/lib/typescript/src/index.d.ts.map +1 -1
  177. package/package.json +1 -1
  178. package/src/ApiOverrides/index.ts +4 -4
  179. package/src/Authenticator/Components/StrategyForm.tsx +2 -0
  180. package/src/Authenticator/index.tsx +2 -0
  181. package/src/Clarity/SmartEvents.ts +13 -0
  182. package/src/Components/AutoPageFlatList.tsx +99 -0
  183. package/src/Components/AutoScrollFlatList.tsx +0 -1
  184. package/src/Components/CircularFadeOut.tsx +36 -0
  185. package/src/Components/Jerseys.tsx +5 -3
  186. package/src/Components/LinearDiagnal.tsx +4 -3
  187. package/src/Components/Pagination.tsx +6 -4
  188. package/src/Components/Themed.tsx +6 -4
  189. package/src/Components/index.tsx +4 -0
  190. package/src/EventComponents/TeamProfile/index.tsx +0 -1
  191. package/src/GuideView/index.tsx +176 -0
  192. package/src/MarketComponents/api/index.ts +26 -1
  193. package/src/MarketComponents/components/AthleteMarket/index.tsx +2 -2
  194. package/src/MarketComponents/components/TeamEventMarket/index.tsx +17 -6
  195. package/src/MarketComponents/components/TeamTournamentMarket/index.tsx +3 -2
  196. package/src/RankingsCard/api/index.ts +80 -0
  197. package/src/RankingsCard/index.tsx +398 -0
  198. package/src/index.tsx +6 -2
  199. package/src/types.d.ts +53 -2
@@ -0,0 +1,655 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { Button, Text, View } from "../Components/Themed";
3
+ import { RankingsApi, RankingsHelpers } from './api';
4
+ import { ActivityIndicator, FlatList, Image } from 'react-native';
5
+ import moment from 'moment-mini';
6
+ import { useColors } from '../constants/useColors';
7
+ import { Icons } from '../Components';
8
+ import { TeamImage } from '../Components/Jerseys';
9
+ const RankingsCard = ({
10
+ league_id,
11
+ team_id
12
+ }) => {
13
+ const Colors = useColors();
14
+ const [show_types, setShowTypes] = useState(false);
15
+ const [show_years, setShowYears] = useState(false);
16
+ const [show_sub_divisions, setShowSubDivisions] = useState(false);
17
+ const [rankings_state, setRankingsState] = useState({
18
+ loading: false,
19
+ teams: [],
20
+ ranking_type: 'PRE',
21
+ active_division: '',
22
+ years: [2025, 2024, 2023],
23
+ year: 2025,
24
+ ranking_types: [],
25
+ sub_type: 'sub_division',
26
+ leagues: [],
27
+ team_rankings: [],
28
+ team_records: [],
29
+ divisions: [],
30
+ sub_divisions: []
31
+ });
32
+ const {
33
+ loading,
34
+ team,
35
+ ranking_type,
36
+ active_sub_division,
37
+ active_division,
38
+ years,
39
+ year,
40
+ ranking_types,
41
+ league,
42
+ sub_type,
43
+ teams,
44
+ team_rankings,
45
+ team_records,
46
+ divisions
47
+ } = rankings_state;
48
+ const division_teams = teams.filter(t => t.division == active_division);
49
+ let available_sub_divisions = [...new Set(division_teams.map(t => t.sub_division ?? 'NA'))].filter(sd => sd && sd != 'NA');
50
+ let visible_sub_divisions = [...available_sub_divisions];
51
+ if (active_sub_division) {
52
+ visible_sub_divisions = available_sub_divisions.filter(sd => sd == active_sub_division);
53
+ }
54
+ useEffect(() => {
55
+ getRankings(league_id);
56
+ }, [league_id, team_id]);
57
+ const getRankings = async (id, local_year) => {
58
+ RankingsApi.setEnvironment();
59
+ setRankingsState({
60
+ ...rankings_state,
61
+ loading: true
62
+ });
63
+ const api_leagues = await RankingsApi.getLeagues();
64
+ let api_league = api_leagues.find(l => l.league_id == id);
65
+ const st = await RankingsApi.getStandingsByLeague(league_id, local_year ?? api_league?.active_year ?? moment().year());
66
+ if (!st) {
67
+ return alert('Unable to load standings at this time');
68
+ }
69
+ const api_ranking_types = [...new Set(st.team_rankings.map(r => r.ranking_type))];
70
+ const api_ranking_type = st.league.active_season_type ?? 'REG';
71
+ let api_divisions = [...new Set(st.teams.map(t => t.division ?? 'NA'))].filter(sd => sd && sd != 'NA');
72
+ let api_active_sub_division = undefined;
73
+ let api_active_division = st.teams.find(t => t.team_id == team_id)?.division;
74
+ if (!api_active_division && api_divisions.length > 2) {
75
+ api_active_division = RankingsHelpers.sortDivisions(id, api_divisions)[0];
76
+ }
77
+ let api_sub_divisions = [...new Set(st.teams.map(t => t.sub_division ?? 'NA'))].filter(sd => sd && sd != 'NA');
78
+ if (team_id) {
79
+ api_active_sub_division = st.teams.find(T => T.team_id == team_id)?.sub_division;
80
+ }
81
+ let api_team = st.teams.find(t => t.team_id == team_id);
82
+ let api_team_record = st.team_records.find(r => r.team_id == team_id && r.record_type == api_ranking_type && r.sub_type == 'overall');
83
+ let api_team_ranking = st.team_rankings.find(r => r.team_id == team_id && r.ranking_type == api_ranking_type);
84
+ setRankingsState({
85
+ ...rankings_state,
86
+ loading: false,
87
+ ranking_type: api_ranking_type,
88
+ league: st.league,
89
+ team: api_team,
90
+ active_division: api_active_division,
91
+ active_sub_division: api_active_sub_division,
92
+ year: local_year ?? st.league.active_year ?? moment().year(),
93
+ team_records: st.team_records,
94
+ ranking_types: api_ranking_types,
95
+ team_rankings: st.team_rankings,
96
+ team_ranking: api_team_ranking,
97
+ team_record: api_team_record,
98
+ leagues: api_leagues,
99
+ teams: st.teams,
100
+ divisions: api_divisions,
101
+ sub_divisions: api_sub_divisions
102
+ });
103
+ };
104
+ const renderSubDivisionOptions = data => {
105
+ return /*#__PURE__*/React.createElement(Button, {
106
+ style: {
107
+ borderRadius: 0,
108
+ padding: 10,
109
+ borderBottomWidth: 1,
110
+ borderColor: Colors.borders.light,
111
+ flexDirection: 'row',
112
+ alignItems: 'center'
113
+ },
114
+ onPress: () => {
115
+ setRankingsState({
116
+ ...rankings_state,
117
+ active_sub_division: data.item
118
+ });
119
+ setShowSubDivisions(false);
120
+ }
121
+ }, /*#__PURE__*/React.createElement(Text, {
122
+ theme: "h2",
123
+ textAlign: "center"
124
+ }, RankingsHelpers.getRankingTypeDescriptor(data.item)));
125
+ };
126
+ const renderTypes = data => {
127
+ return /*#__PURE__*/React.createElement(Button, {
128
+ style: {
129
+ borderRadius: 0,
130
+ padding: 10,
131
+ borderBottomWidth: 1,
132
+ borderColor: Colors.borders.light,
133
+ flexDirection: 'row',
134
+ alignItems: 'center'
135
+ },
136
+ onPress: () => {
137
+ setRankingsState({
138
+ ...rankings_state,
139
+ ranking_type: data.item
140
+ });
141
+ setShowTypes(false);
142
+ }
143
+ }, /*#__PURE__*/React.createElement(Text, {
144
+ theme: "h2",
145
+ textAlign: "center"
146
+ }, RankingsHelpers.getRankingTypeDescriptor(data.item)));
147
+ };
148
+ const renderYears = data => {
149
+ return /*#__PURE__*/React.createElement(Button, {
150
+ style: {
151
+ padding: 10,
152
+ borderBottomWidth: 1,
153
+ borderColor: Colors.borders.light,
154
+ flexDirection: 'row',
155
+ alignItems: 'center'
156
+ },
157
+ onPress: () => {
158
+ getRankings(league_id, data.item);
159
+ setShowYears(false);
160
+ }
161
+ }, /*#__PURE__*/React.createElement(Text, {
162
+ theme: "h1"
163
+ }, data.item.toString()));
164
+ };
165
+ const renderDivisionOptions = data => {
166
+ const active = active_division == data.item ? true : false;
167
+ return /*#__PURE__*/React.createElement(Button, {
168
+ transparent: true,
169
+ style: {
170
+ borderRadius: 0,
171
+ flex: 1,
172
+ padding: 10,
173
+ alignItems: 'center',
174
+ justifyContent: 'flex-end',
175
+ borderBottomWidth: 1,
176
+ borderColor: active ? Colors.text.success : Colors.borders.light
177
+ },
178
+ onPress: () => setRankingsState({
179
+ ...rankings_state,
180
+ active_division: data.item,
181
+ active_sub_division: undefined
182
+ })
183
+ }, /*#__PURE__*/React.createElement(Text, {
184
+ textAlign: "center",
185
+ color: active ? Colors.text.success : Colors.text.h1,
186
+ theme: active ? 'h2' : 'description'
187
+ }, RankingsHelpers.getDivisionLabel(data.item)));
188
+ };
189
+ const renderTeams = data => {
190
+ const team = teams.find(t => t.team_id == data.item.team_id);
191
+ if (!team) {
192
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
193
+ }
194
+ const team_record = team_records.find(tr => tr.record_type == ranking_type && tr.sub_type == 'overall' && tr.team_id == team.team_id);
195
+ const win_pct = RankingsHelpers.getWinPct(team_record?.wins ?? 0, team_record?.losses ?? 0, team_record?.draws ?? 0);
196
+ const active = data.item.team_id == team_id ? true : false;
197
+ return /*#__PURE__*/React.createElement(View, {
198
+ type: "row",
199
+ style: {
200
+ borderBottomWidth: 1,
201
+ borderColor: Colors.borders.light,
202
+ padding: 5
203
+ }
204
+ }, /*#__PURE__*/React.createElement(View, {
205
+ transparent: true,
206
+ style: {
207
+ flex: 1,
208
+ padding: 10
209
+ }
210
+ }, /*#__PURE__*/React.createElement(View, {
211
+ transparent: true,
212
+ style: {
213
+ flexDirection: 'row',
214
+ alignItems: 'center'
215
+ }
216
+ }, /*#__PURE__*/React.createElement(TeamImage, {
217
+ team: team,
218
+ padding: 2,
219
+ size: 14
220
+ }), team.rank ? /*#__PURE__*/React.createElement(Text, {
221
+ theme: "h2",
222
+ color: Colors.text.action,
223
+ style: {
224
+ marginLeft: 5
225
+ }
226
+ }, team.rank) : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement(Text, {
227
+ theme: "h1",
228
+ size: 12,
229
+ style: {
230
+ marginLeft: 5
231
+ },
232
+ color: active ? Colors.text.success : Colors.text.h1
233
+ }, team.market_name, " ", team.name))), team_record ? /*#__PURE__*/React.createElement(View, {
234
+ style: {
235
+ flex: 1,
236
+ flexDirection: 'row',
237
+ alignItems: 'center'
238
+ }
239
+ }, /*#__PURE__*/React.createElement(View, {
240
+ style: {
241
+ flex: 1
242
+ }
243
+ }, /*#__PURE__*/React.createElement(Text, {
244
+ theme: "h2",
245
+ textAlign: "center"
246
+ }, team_record.wins)), /*#__PURE__*/React.createElement(View, {
247
+ style: {
248
+ flex: 1
249
+ }
250
+ }, /*#__PURE__*/React.createElement(Text, {
251
+ theme: "h2",
252
+ textAlign: "center"
253
+ }, team_record.losses)), /*#__PURE__*/React.createElement(View, {
254
+ style: {
255
+ flex: 1
256
+ }
257
+ }, /*#__PURE__*/React.createElement(Text, {
258
+ theme: "h2",
259
+ textAlign: "center"
260
+ }, team_record.draws)), /*#__PURE__*/React.createElement(View, {
261
+ style: {
262
+ flex: 1
263
+ }
264
+ }, /*#__PURE__*/React.createElement(Text, {
265
+ theme: "h2",
266
+ textAlign: "center"
267
+ }, (win_pct * 100).toFixed(2), "%"))) : /*#__PURE__*/React.createElement(React.Fragment, null));
268
+ };
269
+ const renderSubDivisions = data => {
270
+ const sub_division_teams = data.teams.filter(t => t.sub_division == data.item);
271
+ const sub_division_rankings = team_rankings.filter(tr => sub_division_teams.map(dt => dt.team_id).includes(tr.team_id) && tr.ranking_type == ranking_type && tr.sub_type == sub_type);
272
+ if (sub_division_teams.length == 0) {
273
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
274
+ }
275
+ if (sub_division_rankings.length == 0) {
276
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
277
+ }
278
+ return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
279
+ type: "header",
280
+ style: {
281
+ flexDirection: 'row',
282
+ alignItems: 'center'
283
+ }
284
+ }, /*#__PURE__*/React.createElement(View, {
285
+ transparent: true,
286
+ style: {
287
+ flex: 1,
288
+ padding: 10
289
+ }
290
+ }, /*#__PURE__*/React.createElement(Text, {
291
+ theme: "h1"
292
+ }, data.item)), /*#__PURE__*/React.createElement(View, {
293
+ transparent: true,
294
+ style: {
295
+ flex: 1,
296
+ flexDirection: 'row',
297
+ alignItems: 'center'
298
+ }
299
+ }, /*#__PURE__*/React.createElement(View, {
300
+ transparent: true,
301
+ style: {
302
+ flex: 1
303
+ }
304
+ }, /*#__PURE__*/React.createElement(Text, {
305
+ theme: "h2",
306
+ textAlign: "center"
307
+ }, "W")), /*#__PURE__*/React.createElement(View, {
308
+ transparent: true,
309
+ style: {
310
+ flex: 1
311
+ }
312
+ }, /*#__PURE__*/React.createElement(Text, {
313
+ theme: "h2",
314
+ textAlign: "center"
315
+ }, "L")), /*#__PURE__*/React.createElement(View, {
316
+ transparent: true,
317
+ style: {
318
+ flex: 1
319
+ }
320
+ }, /*#__PURE__*/React.createElement(Text, {
321
+ theme: "h2",
322
+ textAlign: "center"
323
+ }, "D")), /*#__PURE__*/React.createElement(View, {
324
+ transparent: true,
325
+ style: {
326
+ flex: 1
327
+ }
328
+ }, /*#__PURE__*/React.createElement(Text, {
329
+ theme: "h2",
330
+ textAlign: "center"
331
+ }, "PCT")))), /*#__PURE__*/React.createElement(FlatList, {
332
+ data: sub_division_rankings.sort((a, b) => a.rank - b.rank),
333
+ key: 'sub_division_teams',
334
+ keyExtractor: item => item.team_ranking_id.toString(),
335
+ renderItem: renderTeams
336
+ }));
337
+ };
338
+ const renderDivisions = data => {
339
+ let division_teams = teams.filter(t => t.division == data.item);
340
+ let division_sub_divisions = [...new Set(division_teams.map(t => t.sub_division ?? 'NA'))].filter(sd => sd && sd != 'NA');
341
+ return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
342
+ type: "header",
343
+ style: {
344
+ padding: 10
345
+ }
346
+ }, /*#__PURE__*/React.createElement(Text, null, data.item)), division_sub_divisions.length > 0 ? /*#__PURE__*/React.createElement(FlatList, {
347
+ key: 'sub_division_list',
348
+ keyExtractor: item => item,
349
+ renderItem: ({
350
+ item,
351
+ index
352
+ }) => renderSubDivisions({
353
+ item,
354
+ index,
355
+ teams: division_teams
356
+ }),
357
+ data: division_sub_divisions
358
+ }) : /*#__PURE__*/React.createElement(React.Fragment, null));
359
+ };
360
+ if (!league) {
361
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
362
+ }
363
+ return /*#__PURE__*/React.createElement(View, null, team ? /*#__PURE__*/React.createElement(View, {
364
+ style: {
365
+ flexDirection: 'row'
366
+ }
367
+ }, /*#__PURE__*/React.createElement(TeamImage, {
368
+ team: team,
369
+ size: 20
370
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement(View, {
371
+ type: "header",
372
+ style: {
373
+ flexDirection: 'row',
374
+ alignItems: 'center',
375
+ padding: 10
376
+ }
377
+ }, /*#__PURE__*/React.createElement(Image, {
378
+ source: {
379
+ uri: league.league_image
380
+ },
381
+ style: {
382
+ height: 35,
383
+ width: 35
384
+ },
385
+ resizeMode: "contain"
386
+ }), /*#__PURE__*/React.createElement(View, {
387
+ transparent: true,
388
+ style: {
389
+ flex: 1,
390
+ marginLeft: 10
391
+ }
392
+ }, /*#__PURE__*/React.createElement(Text, {
393
+ theme: "h1"
394
+ }, league.league_name, " ", RankingsHelpers.getRankingTypeDescriptor(ranking_type), " ", league.active_year ?? moment().year())), /*#__PURE__*/React.createElement(Button, {
395
+ float: true,
396
+ style: {
397
+ padding: 10,
398
+ flexDirection: 'row',
399
+ alignItems: 'center'
400
+ },
401
+ onPress: () => setShowYears(true)
402
+ }, /*#__PURE__*/React.createElement(Text, {
403
+ theme: "h2",
404
+ style: {
405
+ marginRight: 10
406
+ }
407
+ }, year), /*#__PURE__*/React.createElement(Icons.ChevronIcon, {
408
+ direction: "down",
409
+ size: 6,
410
+ color: Colors.text.h1
411
+ })), active_division ? /*#__PURE__*/React.createElement(Button, {
412
+ float: true,
413
+ style: {
414
+ padding: 10,
415
+ flexDirection: 'row',
416
+ alignItems: 'center'
417
+ },
418
+ onPress: () => setShowSubDivisions(true)
419
+ }, /*#__PURE__*/React.createElement(Text, {
420
+ theme: "h2",
421
+ style: {
422
+ marginRight: 10
423
+ }
424
+ }, active_sub_division ?? 'All Conferences'), /*#__PURE__*/React.createElement(Icons.ChevronIcon, {
425
+ direction: "down",
426
+ size: 6,
427
+ color: Colors.text.h1
428
+ })) : /*#__PURE__*/React.createElement(Button, {
429
+ float: true,
430
+ style: {
431
+ padding: 10,
432
+ flexDirection: 'row',
433
+ alignItems: 'center'
434
+ },
435
+ onPress: () => setShowTypes(true)
436
+ }, /*#__PURE__*/React.createElement(Text, {
437
+ theme: "h2",
438
+ style: {
439
+ marginRight: 10
440
+ }
441
+ }, RankingsHelpers.getRankingTypeDescriptor(ranking_type)), /*#__PURE__*/React.createElement(Icons.ChevronIcon, {
442
+ direction: "down",
443
+ size: 6,
444
+ color: Colors.text.h1
445
+ }))), /*#__PURE__*/React.createElement(View, {
446
+ type: "body"
447
+ }, active_division ? /*#__PURE__*/React.createElement(View, {
448
+ style: {
449
+ flexDirection: 'row'
450
+ }
451
+ }, RankingsHelpers.sortDivisions(league_id, divisions).map((d, i) => {
452
+ return renderDivisionOptions({
453
+ item: d,
454
+ index: i
455
+ });
456
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null), active_division ? /*#__PURE__*/React.createElement(FlatList, {
457
+ data: visible_sub_divisions.sort((a, b) => a.localeCompare(b)),
458
+ renderItem: ({
459
+ item,
460
+ index
461
+ }) => renderSubDivisions({
462
+ item,
463
+ index,
464
+ teams: division_teams
465
+ }),
466
+ key: 'division_list',
467
+ keyExtractor: item => item
468
+ }) : /*#__PURE__*/React.createElement(FlatList, {
469
+ data: divisions.sort((a, b) => a.localeCompare(b)),
470
+ renderItem: renderDivisions,
471
+ key: 'division_list',
472
+ keyExtractor: item => item
473
+ })), show_types ? /*#__PURE__*/React.createElement(View, {
474
+ type: "blur",
475
+ style: {
476
+ position: 'absolute',
477
+ top: 0,
478
+ left: 0,
479
+ right: 0,
480
+ bottom: 0,
481
+ paddingTop: 20,
482
+ alignItems: 'center'
483
+ }
484
+ }, /*#__PURE__*/React.createElement(View, {
485
+ float: true,
486
+ style: {
487
+ height: 400,
488
+ width: 400
489
+ }
490
+ }, /*#__PURE__*/React.createElement(View, {
491
+ type: "header",
492
+ style: {
493
+ padding: 10,
494
+ flexDirection: 'row',
495
+ borderTopRightRadius: 8,
496
+ borderTopLeftRadius: 8
497
+ }
498
+ }, /*#__PURE__*/React.createElement(View, {
499
+ transparent: true,
500
+ style: {
501
+ flex: 1
502
+ }
503
+ }, /*#__PURE__*/React.createElement(Text, {
504
+ theme: "h1"
505
+ }, "Select Type"))), /*#__PURE__*/React.createElement(View, {
506
+ transparent: true,
507
+ type: "body",
508
+ style: {
509
+ flex: 1
510
+ }
511
+ }, /*#__PURE__*/React.createElement(FlatList, {
512
+ data: ranking_types,
513
+ key: 'ranking_types',
514
+ keyExtractor: item => item,
515
+ renderItem: renderTypes
516
+ })), /*#__PURE__*/React.createElement(View, {
517
+ type: "footer",
518
+ style: {
519
+ borderBottomRightRadius: 8,
520
+ borderBottomLeftRadius: 8,
521
+ padding: 10
522
+ }
523
+ }, /*#__PURE__*/React.createElement(Button, {
524
+ title: "CLOSE",
525
+ type: "close",
526
+ onPress: () => setShowTypes(false)
527
+ })))) : /*#__PURE__*/React.createElement(React.Fragment, null), show_sub_divisions ? /*#__PURE__*/React.createElement(View, {
528
+ type: "blur",
529
+ style: {
530
+ position: 'absolute',
531
+ top: 0,
532
+ left: 0,
533
+ right: 0,
534
+ bottom: 0,
535
+ paddingTop: 20,
536
+ alignItems: 'center'
537
+ }
538
+ }, /*#__PURE__*/React.createElement(View, {
539
+ float: true,
540
+ style: {
541
+ height: 400,
542
+ width: 400
543
+ }
544
+ }, /*#__PURE__*/React.createElement(View, {
545
+ type: "header",
546
+ style: {
547
+ padding: 10,
548
+ flexDirection: 'row',
549
+ borderTopRightRadius: 8,
550
+ borderTopLeftRadius: 8
551
+ }
552
+ }, /*#__PURE__*/React.createElement(View, {
553
+ transparent: true,
554
+ style: {
555
+ flex: 1
556
+ }
557
+ }, /*#__PURE__*/React.createElement(Text, {
558
+ theme: "h1"
559
+ }, "Select Conference"))), /*#__PURE__*/React.createElement(View, {
560
+ transparent: true,
561
+ type: "body",
562
+ style: {
563
+ flex: 1
564
+ }
565
+ }, /*#__PURE__*/React.createElement(FlatList, {
566
+ data: available_sub_divisions,
567
+ key: 'sub_division_options',
568
+ keyExtractor: item => item,
569
+ renderItem: renderSubDivisionOptions
570
+ })), /*#__PURE__*/React.createElement(View, {
571
+ type: "footer",
572
+ style: {
573
+ borderBottomRightRadius: 8,
574
+ borderBottomLeftRadius: 8,
575
+ padding: 10
576
+ }
577
+ }, /*#__PURE__*/React.createElement(Button, {
578
+ title: "CLOSE",
579
+ type: "close",
580
+ onPress: () => setShowTypes(false)
581
+ })))) : /*#__PURE__*/React.createElement(React.Fragment, null), show_years ? /*#__PURE__*/React.createElement(View, {
582
+ type: "blur",
583
+ style: {
584
+ position: 'absolute',
585
+ top: 0,
586
+ left: 0,
587
+ right: 0,
588
+ bottom: 0,
589
+ paddingTop: 20,
590
+ alignItems: 'center'
591
+ }
592
+ }, /*#__PURE__*/React.createElement(View, {
593
+ float: true,
594
+ style: {
595
+ height: 400,
596
+ width: 400
597
+ }
598
+ }, /*#__PURE__*/React.createElement(View, {
599
+ type: "header",
600
+ style: {
601
+ padding: 10,
602
+ flexDirection: 'row',
603
+ borderTopRightRadius: 8,
604
+ borderTopLeftRadius: 8
605
+ }
606
+ }, /*#__PURE__*/React.createElement(View, {
607
+ transparent: true,
608
+ style: {
609
+ flex: 1
610
+ }
611
+ }, /*#__PURE__*/React.createElement(Text, {
612
+ theme: "h1"
613
+ }, "Select Year"))), /*#__PURE__*/React.createElement(View, {
614
+ transparent: true,
615
+ type: "body",
616
+ style: {
617
+ flex: 1
618
+ }
619
+ }, /*#__PURE__*/React.createElement(FlatList, {
620
+ data: years,
621
+ key: 'years_list',
622
+ keyExtractor: item => item.toString(),
623
+ renderItem: renderYears
624
+ })), /*#__PURE__*/React.createElement(View, {
625
+ type: "footer",
626
+ style: {
627
+ borderBottomRightRadius: 8,
628
+ borderBottomLeftRadius: 8,
629
+ padding: 10
630
+ }
631
+ }, /*#__PURE__*/React.createElement(Button, {
632
+ title: "CLOSE",
633
+ type: "close",
634
+ onPress: () => setShowYears(false)
635
+ })))) : /*#__PURE__*/React.createElement(React.Fragment, null), loading ? /*#__PURE__*/React.createElement(View, {
636
+ type: "blur",
637
+ style: {
638
+ position: 'absolute',
639
+ top: 0,
640
+ left: 0,
641
+ right: 0,
642
+ bottom: 0,
643
+ paddingTop: 20,
644
+ alignItems: 'center'
645
+ }
646
+ }, /*#__PURE__*/React.createElement(ActivityIndicator, {
647
+ style: {
648
+ marginTop: 50
649
+ },
650
+ size: 30,
651
+ color: Colors.text.h1
652
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null));
653
+ };
654
+ export default RankingsCard;
655
+ //# sourceMappingURL=index.js.map