be-components 5.1.8 → 5.1.9

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 (219) hide show
  1. package/lib/commonjs/Components/Icons.js +28 -1
  2. package/lib/commonjs/Components/Icons.js.map +1 -1
  3. package/lib/commonjs/Components/Themed.js +13 -1
  4. package/lib/commonjs/Components/Themed.js.map +1 -1
  5. package/lib/commonjs/SocialComponents/FormattedTextInput/components/TagSelector.js +47 -24
  6. package/lib/commonjs/SocialComponents/FormattedTextInput/components/TagSelector.js.map +1 -1
  7. package/lib/commonjs/SocialComponents/FormattedTextInput/index.js +41 -8
  8. package/lib/commonjs/SocialComponents/FormattedTextInput/index.js.map +1 -1
  9. package/lib/commonjs/SocialComponents/GifSelector/NativeSelector.js +14 -0
  10. package/lib/commonjs/SocialComponents/GifSelector/NativeSelector.js.map +1 -0
  11. package/lib/commonjs/SocialComponents/GifSelector/WebSelector.js +123 -0
  12. package/lib/commonjs/SocialComponents/GifSelector/WebSelector.js.map +1 -0
  13. package/lib/commonjs/SocialComponents/GroupChat/components/GroupMessageCard.js +89 -0
  14. package/lib/commonjs/SocialComponents/GroupChat/components/GroupMessageCard.js.map +1 -0
  15. package/lib/commonjs/SocialComponents/GroupChat/index.js +426 -0
  16. package/lib/commonjs/SocialComponents/GroupChat/index.js.map +1 -0
  17. package/lib/commonjs/SocialComponents/ImageRenderer.js +55 -0
  18. package/lib/commonjs/SocialComponents/ImageRenderer.js.map +1 -0
  19. package/lib/commonjs/SocialComponents/InputBar/components/ActionSelector.js +219 -0
  20. package/lib/commonjs/SocialComponents/InputBar/components/ActionSelector.js.map +1 -0
  21. package/lib/commonjs/SocialComponents/InputBar/index.js +59 -5
  22. package/lib/commonjs/SocialComponents/InputBar/index.js.map +1 -1
  23. package/lib/commonjs/SocialComponents/PostCard/components/ArticleCard.js +2 -0
  24. package/lib/commonjs/SocialComponents/PostCard/components/ArticleCard.js.map +1 -0
  25. package/lib/commonjs/SocialComponents/PostCard/components/ImageList.js +37 -25
  26. package/lib/commonjs/SocialComponents/PostCard/components/ImageList.js.map +1 -1
  27. package/lib/commonjs/SocialComponents/PostCard/index.js +148 -70
  28. package/lib/commonjs/SocialComponents/PostCard/index.js.map +1 -1
  29. package/lib/commonjs/SocialComponents/Poster/index.js +325 -0
  30. package/lib/commonjs/SocialComponents/Poster/index.js.map +1 -0
  31. package/lib/commonjs/SocialComponents/SocialOrderCard.js +8 -3
  32. package/lib/commonjs/SocialComponents/SocialOrderCard.js.map +1 -1
  33. package/lib/commonjs/SocialComponents/SocialOrdersList.js +20 -2
  34. package/lib/commonjs/SocialComponents/SocialOrdersList.js.map +1 -1
  35. package/lib/commonjs/SocialComponents/UrlPreviewCard.js +115 -0
  36. package/lib/commonjs/SocialComponents/UrlPreviewCard.js.map +1 -0
  37. package/lib/commonjs/SocialComponents/api/index.js +383 -0
  38. package/lib/commonjs/SocialComponents/api/index.js.map +1 -1
  39. package/lib/commonjs/SocialComponents/index.js +14 -0
  40. package/lib/commonjs/SocialComponents/index.js.map +1 -1
  41. package/lib/module/Components/Icons.js +28 -1
  42. package/lib/module/Components/Icons.js.map +1 -1
  43. package/lib/module/Components/Themed.js +13 -1
  44. package/lib/module/Components/Themed.js.map +1 -1
  45. package/lib/module/SocialComponents/FormattedTextInput/components/TagSelector.js +48 -25
  46. package/lib/module/SocialComponents/FormattedTextInput/components/TagSelector.js.map +1 -1
  47. package/lib/module/SocialComponents/FormattedTextInput/index.js +41 -8
  48. package/lib/module/SocialComponents/FormattedTextInput/index.js.map +1 -1
  49. package/lib/module/SocialComponents/GifSelector/NativeSelector.js +7 -0
  50. package/lib/module/SocialComponents/GifSelector/NativeSelector.js.map +1 -0
  51. package/lib/module/SocialComponents/GifSelector/WebSelector.js +125 -0
  52. package/lib/module/SocialComponents/GifSelector/WebSelector.js.map +1 -0
  53. package/lib/module/SocialComponents/GroupChat/components/GroupMessageCard.js +82 -0
  54. package/lib/module/SocialComponents/GroupChat/components/GroupMessageCard.js.map +1 -0
  55. package/lib/module/SocialComponents/GroupChat/index.js +418 -0
  56. package/lib/module/SocialComponents/GroupChat/index.js.map +1 -0
  57. package/lib/module/SocialComponents/ImageRenderer.js +48 -0
  58. package/lib/module/SocialComponents/ImageRenderer.js.map +1 -0
  59. package/lib/module/SocialComponents/InputBar/components/ActionSelector.js +210 -0
  60. package/lib/module/SocialComponents/InputBar/components/ActionSelector.js.map +1 -0
  61. package/lib/module/SocialComponents/InputBar/index.js +58 -6
  62. package/lib/module/SocialComponents/InputBar/index.js.map +1 -1
  63. package/lib/module/SocialComponents/PostCard/components/ArticleCard.js +2 -0
  64. package/lib/module/SocialComponents/PostCard/components/ArticleCard.js.map +1 -0
  65. package/lib/module/SocialComponents/PostCard/components/ImageList.js +37 -25
  66. package/lib/module/SocialComponents/PostCard/components/ImageList.js.map +1 -1
  67. package/lib/module/SocialComponents/PostCard/index.js +148 -70
  68. package/lib/module/SocialComponents/PostCard/index.js.map +1 -1
  69. package/lib/module/SocialComponents/Poster/index.js +316 -0
  70. package/lib/module/SocialComponents/Poster/index.js.map +1 -0
  71. package/lib/module/SocialComponents/SocialOrderCard.js +8 -3
  72. package/lib/module/SocialComponents/SocialOrderCard.js.map +1 -1
  73. package/lib/module/SocialComponents/SocialOrdersList.js +21 -3
  74. package/lib/module/SocialComponents/SocialOrdersList.js.map +1 -1
  75. package/lib/module/SocialComponents/UrlPreviewCard.js +106 -0
  76. package/lib/module/SocialComponents/UrlPreviewCard.js.map +1 -0
  77. package/lib/module/SocialComponents/api/index.js +383 -0
  78. package/lib/module/SocialComponents/api/index.js.map +1 -1
  79. package/lib/module/SocialComponents/index.js +3 -1
  80. package/lib/module/SocialComponents/index.js.map +1 -1
  81. package/lib/typescript/lib/commonjs/Components/Icons.d.ts +5 -0
  82. package/lib/typescript/lib/commonjs/Components/Icons.d.ts.map +1 -1
  83. package/lib/typescript/lib/commonjs/Components/Themed.d.ts.map +1 -1
  84. package/lib/typescript/lib/commonjs/SocialComponents/FormattedTextInput/components/TagSelector.d.ts +2 -1
  85. package/lib/typescript/lib/commonjs/SocialComponents/FormattedTextInput/components/TagSelector.d.ts.map +1 -1
  86. package/lib/typescript/lib/commonjs/SocialComponents/FormattedTextInput/index.d.ts +6 -1
  87. package/lib/typescript/lib/commonjs/SocialComponents/FormattedTextInput/index.d.ts.map +1 -1
  88. package/lib/typescript/lib/commonjs/SocialComponents/GifSelector/NativeSelector.d.ts +4 -0
  89. package/lib/typescript/lib/commonjs/SocialComponents/GifSelector/NativeSelector.d.ts.map +1 -0
  90. package/lib/typescript/lib/commonjs/SocialComponents/GifSelector/WebSelector.d.ts +4 -0
  91. package/lib/typescript/lib/commonjs/SocialComponents/GifSelector/WebSelector.d.ts.map +1 -0
  92. package/lib/typescript/lib/commonjs/SocialComponents/GroupChat/components/GroupMessageCard.d.ts +11 -0
  93. package/lib/typescript/lib/commonjs/SocialComponents/GroupChat/components/GroupMessageCard.d.ts.map +1 -0
  94. package/lib/typescript/lib/commonjs/SocialComponents/GroupChat/index.d.ts +14 -0
  95. package/lib/typescript/lib/commonjs/SocialComponents/GroupChat/index.d.ts.map +1 -0
  96. package/lib/typescript/lib/commonjs/SocialComponents/ImageRenderer.d.ts +11 -0
  97. package/lib/typescript/lib/commonjs/SocialComponents/ImageRenderer.d.ts.map +1 -0
  98. package/lib/typescript/lib/commonjs/SocialComponents/InputBar/components/ActionSelector.d.ts +9 -0
  99. package/lib/typescript/lib/commonjs/SocialComponents/InputBar/components/ActionSelector.d.ts.map +1 -0
  100. package/lib/typescript/lib/commonjs/SocialComponents/InputBar/index.d.ts +3 -1
  101. package/lib/typescript/lib/commonjs/SocialComponents/InputBar/index.d.ts.map +1 -1
  102. package/lib/typescript/lib/commonjs/SocialComponents/PostCard/components/ArticleCard.d.ts +1 -0
  103. package/lib/typescript/lib/commonjs/SocialComponents/PostCard/components/ArticleCard.d.ts.map +1 -0
  104. package/lib/typescript/lib/commonjs/SocialComponents/PostCard/components/ImageList.d.ts +1 -2
  105. package/lib/typescript/lib/commonjs/SocialComponents/PostCard/components/ImageList.d.ts.map +1 -1
  106. package/lib/typescript/lib/commonjs/SocialComponents/PostCard/index.d.ts +4 -1
  107. package/lib/typescript/lib/commonjs/SocialComponents/PostCard/index.d.ts.map +1 -1
  108. package/lib/typescript/lib/commonjs/SocialComponents/Poster/index.d.ts +9 -0
  109. package/lib/typescript/lib/commonjs/SocialComponents/Poster/index.d.ts.map +1 -0
  110. package/lib/typescript/lib/commonjs/SocialComponents/SocialOrderCard.d.ts +2 -1
  111. package/lib/typescript/lib/commonjs/SocialComponents/SocialOrderCard.d.ts.map +1 -1
  112. package/lib/typescript/lib/commonjs/SocialComponents/SocialOrdersList.d.ts +2 -1
  113. package/lib/typescript/lib/commonjs/SocialComponents/SocialOrdersList.d.ts.map +1 -1
  114. package/lib/typescript/lib/commonjs/SocialComponents/UrlPreviewCard.d.ts +9 -0
  115. package/lib/typescript/lib/commonjs/SocialComponents/UrlPreviewCard.d.ts.map +1 -0
  116. package/lib/typescript/lib/commonjs/SocialComponents/api/index.d.ts +89 -0
  117. package/lib/typescript/lib/commonjs/SocialComponents/api/index.d.ts.map +1 -1
  118. package/lib/typescript/lib/commonjs/SocialComponents/index.d.ts +2 -0
  119. package/lib/typescript/lib/module/Components/Icons.d.ts +5 -0
  120. package/lib/typescript/lib/module/Components/Icons.d.ts.map +1 -1
  121. package/lib/typescript/lib/module/Components/Themed.d.ts.map +1 -1
  122. package/lib/typescript/lib/module/SocialComponents/FormattedTextInput/components/TagSelector.d.ts +3 -2
  123. package/lib/typescript/lib/module/SocialComponents/FormattedTextInput/components/TagSelector.d.ts.map +1 -1
  124. package/lib/typescript/lib/module/SocialComponents/FormattedTextInput/index.d.ts +6 -1
  125. package/lib/typescript/lib/module/SocialComponents/FormattedTextInput/index.d.ts.map +1 -1
  126. package/lib/typescript/lib/module/SocialComponents/GifSelector/NativeSelector.d.ts +4 -0
  127. package/lib/typescript/lib/module/SocialComponents/GifSelector/NativeSelector.d.ts.map +1 -0
  128. package/lib/typescript/lib/module/SocialComponents/GifSelector/WebSelector.d.ts +13 -0
  129. package/lib/typescript/lib/module/SocialComponents/GifSelector/WebSelector.d.ts.map +1 -0
  130. package/lib/typescript/lib/module/SocialComponents/GroupChat/components/GroupMessageCard.d.ts +11 -0
  131. package/lib/typescript/lib/module/SocialComponents/GroupChat/components/GroupMessageCard.d.ts.map +1 -0
  132. package/lib/typescript/lib/module/SocialComponents/GroupChat/index.d.ts +14 -0
  133. package/lib/typescript/lib/module/SocialComponents/GroupChat/index.d.ts.map +1 -0
  134. package/lib/typescript/lib/module/SocialComponents/ImageRenderer.d.ts +11 -0
  135. package/lib/typescript/lib/module/SocialComponents/ImageRenderer.d.ts.map +1 -0
  136. package/lib/typescript/lib/module/SocialComponents/InputBar/components/ActionSelector.d.ts +10 -0
  137. package/lib/typescript/lib/module/SocialComponents/InputBar/components/ActionSelector.d.ts.map +1 -0
  138. package/lib/typescript/lib/module/SocialComponents/InputBar/index.d.ts +3 -1
  139. package/lib/typescript/lib/module/SocialComponents/InputBar/index.d.ts.map +1 -1
  140. package/lib/typescript/lib/module/SocialComponents/PostCard/components/ArticleCard.d.ts +1 -0
  141. package/lib/typescript/lib/module/SocialComponents/PostCard/components/ArticleCard.d.ts.map +1 -0
  142. package/lib/typescript/lib/module/SocialComponents/PostCard/components/ImageList.d.ts +1 -2
  143. package/lib/typescript/lib/module/SocialComponents/PostCard/components/ImageList.d.ts.map +1 -1
  144. package/lib/typescript/lib/module/SocialComponents/PostCard/index.d.ts +4 -1
  145. package/lib/typescript/lib/module/SocialComponents/PostCard/index.d.ts.map +1 -1
  146. package/lib/typescript/lib/module/SocialComponents/Poster/index.d.ts +11 -0
  147. package/lib/typescript/lib/module/SocialComponents/Poster/index.d.ts.map +1 -0
  148. package/lib/typescript/lib/module/SocialComponents/SocialOrderCard.d.ts +3 -2
  149. package/lib/typescript/lib/module/SocialComponents/SocialOrderCard.d.ts.map +1 -1
  150. package/lib/typescript/lib/module/SocialComponents/SocialOrdersList.d.ts +2 -1
  151. package/lib/typescript/lib/module/SocialComponents/SocialOrdersList.d.ts.map +1 -1
  152. package/lib/typescript/lib/module/SocialComponents/UrlPreviewCard.d.ts +9 -0
  153. package/lib/typescript/lib/module/SocialComponents/UrlPreviewCard.d.ts.map +1 -0
  154. package/lib/typescript/lib/module/SocialComponents/api/index.d.ts +89 -0
  155. package/lib/typescript/lib/module/SocialComponents/api/index.d.ts.map +1 -1
  156. package/lib/typescript/lib/module/SocialComponents/index.d.ts +3 -1
  157. package/lib/typescript/lib/module/SocialComponents/index.d.ts.map +1 -1
  158. package/lib/typescript/src/Components/Icons.d.ts +1 -0
  159. package/lib/typescript/src/Components/Icons.d.ts.map +1 -1
  160. package/lib/typescript/src/Components/Themed.d.ts +1 -0
  161. package/lib/typescript/src/Components/Themed.d.ts.map +1 -1
  162. package/lib/typescript/src/SocialComponents/FormattedTextInput/components/TagSelector.d.ts +2 -1
  163. package/lib/typescript/src/SocialComponents/FormattedTextInput/components/TagSelector.d.ts.map +1 -1
  164. package/lib/typescript/src/SocialComponents/FormattedTextInput/index.d.ts +6 -1
  165. package/lib/typescript/src/SocialComponents/FormattedTextInput/index.d.ts.map +1 -1
  166. package/lib/typescript/src/SocialComponents/GifSelector/NativeSelector.d.ts +4 -0
  167. package/lib/typescript/src/SocialComponents/GifSelector/NativeSelector.d.ts.map +1 -0
  168. package/lib/typescript/src/SocialComponents/GifSelector/WebSelector.d.ts +11 -0
  169. package/lib/typescript/src/SocialComponents/GifSelector/WebSelector.d.ts.map +1 -0
  170. package/lib/typescript/src/SocialComponents/GroupChat/components/GroupMessageCard.d.ts +18 -0
  171. package/lib/typescript/src/SocialComponents/GroupChat/components/GroupMessageCard.d.ts.map +1 -0
  172. package/lib/typescript/src/SocialComponents/GroupChat/index.d.ts +25 -0
  173. package/lib/typescript/src/SocialComponents/GroupChat/index.d.ts.map +1 -0
  174. package/lib/typescript/src/SocialComponents/ImageRenderer.d.ts +21 -0
  175. package/lib/typescript/src/SocialComponents/ImageRenderer.d.ts.map +1 -0
  176. package/lib/typescript/src/SocialComponents/InputBar/components/ActionSelector.d.ts +16 -0
  177. package/lib/typescript/src/SocialComponents/InputBar/components/ActionSelector.d.ts.map +1 -0
  178. package/lib/typescript/src/SocialComponents/InputBar/index.d.ts +10 -1
  179. package/lib/typescript/src/SocialComponents/InputBar/index.d.ts.map +1 -1
  180. package/lib/typescript/src/SocialComponents/PostCard/components/ArticleCard.d.ts +1 -0
  181. package/lib/typescript/src/SocialComponents/PostCard/components/ArticleCard.d.ts.map +1 -0
  182. package/lib/typescript/src/SocialComponents/PostCard/components/ImageList.d.ts +1 -1
  183. package/lib/typescript/src/SocialComponents/PostCard/components/ImageList.d.ts.map +1 -1
  184. package/lib/typescript/src/SocialComponents/PostCard/index.d.ts +4 -2
  185. package/lib/typescript/src/SocialComponents/PostCard/index.d.ts.map +1 -1
  186. package/lib/typescript/src/SocialComponents/Poster/index.d.ts +16 -0
  187. package/lib/typescript/src/SocialComponents/Poster/index.d.ts.map +1 -0
  188. package/lib/typescript/src/SocialComponents/SocialOrderCard.d.ts +2 -1
  189. package/lib/typescript/src/SocialComponents/SocialOrderCard.d.ts.map +1 -1
  190. package/lib/typescript/src/SocialComponents/SocialOrdersList.d.ts +2 -1
  191. package/lib/typescript/src/SocialComponents/SocialOrdersList.d.ts.map +1 -1
  192. package/lib/typescript/src/SocialComponents/UrlPreviewCard.d.ts +10 -0
  193. package/lib/typescript/src/SocialComponents/UrlPreviewCard.d.ts.map +1 -0
  194. package/lib/typescript/src/SocialComponents/api/index.d.ts +37 -1
  195. package/lib/typescript/src/SocialComponents/api/index.d.ts.map +1 -1
  196. package/lib/typescript/src/SocialComponents/index.d.ts +3 -1
  197. package/lib/typescript/src/SocialComponents/index.d.ts.map +1 -1
  198. package/package.json +5 -1
  199. package/src/Components/Icons.tsx +18 -1
  200. package/src/Components/Themed.tsx +11 -1
  201. package/src/SocialComponents/FormattedTextInput/components/TagSelector.tsx +24 -17
  202. package/src/SocialComponents/FormattedTextInput/index.tsx +32 -7
  203. package/src/SocialComponents/GifSelector/NativeSelector.tsx +13 -0
  204. package/src/SocialComponents/GifSelector/WebSelector.tsx +91 -0
  205. package/src/SocialComponents/GroupChat/components/GroupMessageCard.tsx +84 -0
  206. package/src/SocialComponents/GroupChat/index.tsx +333 -0
  207. package/src/SocialComponents/ImageRenderer.tsx +42 -0
  208. package/src/SocialComponents/InputBar/components/ActionSelector.tsx +164 -0
  209. package/src/SocialComponents/InputBar/index.tsx +40 -6
  210. package/src/SocialComponents/PostCard/components/ArticleCard.tsx +2 -0
  211. package/src/SocialComponents/PostCard/components/ImageList.tsx +28 -21
  212. package/src/SocialComponents/PostCard/index.tsx +122 -56
  213. package/src/SocialComponents/Poster/index.tsx +264 -0
  214. package/src/SocialComponents/SocialOrderCard.tsx +4 -6
  215. package/src/SocialComponents/SocialOrdersList.tsx +14 -8
  216. package/src/SocialComponents/UrlPreviewCard.tsx +75 -0
  217. package/src/SocialComponents/api/index.ts +345 -3
  218. package/src/SocialComponents/index.tsx +4 -0
  219. package/src/types.d.ts +58 -0
@@ -0,0 +1,164 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { ActivityIndicator, FlatList, Modal } from "react-native"
3
+ import { Button, Text, View } from '../../../Components/Themed';
4
+ import { SocialComponentApi, SocialOrderHelpers } from '../../api';
5
+ import type { AthleteProps, EventProps, LeagueProps, MatchProps, OrderProps, TeamProps, TournamentProps } from '../../../types';
6
+ import { useColors } from '../../../constants/useColors';
7
+ import SocialOrderCard from '../../SocialOrderCard';
8
+
9
+ type ActionSelectProps = {
10
+ visible:boolean,
11
+ onClose:() => void,
12
+ onTagOrder:(order:OrderProps) => void,
13
+ insets?:{ top:number, left:number, right:number, bottom:number }
14
+ }
15
+
16
+ const sections = ['toggle','orders']
17
+ const ActionSelector = ({ visible, insets, onClose, onTagOrder }:ActionSelectProps) => {
18
+ const Colors = useColors();
19
+ const [ tagged_action, setTaggedAction ] = useState<{
20
+ tagged_orders:string[]
21
+ }>({
22
+ tagged_orders:[]
23
+ });
24
+ const { tagged_orders } = tagged_action;
25
+ const [ action_state, setActionState ] = useState<{
26
+ loading:boolean,
27
+ orders:OrderProps[],
28
+ events:EventProps[],
29
+ tournaments:TournamentProps[],
30
+ matches:MatchProps[],
31
+ leagues:LeagueProps[],
32
+ teams:TeamProps[],
33
+ athletes:AthleteProps[]
34
+ }>({
35
+ loading:false,
36
+ orders:[],
37
+ events: [],
38
+ tournaments:[],
39
+ leagues:[],
40
+ teams:[],
41
+ matches:[],
42
+ athletes:[]
43
+ });
44
+ const { loading, orders, events, athletes, leagues, tournaments, matches, teams } = action_state;
45
+
46
+ useEffect(() => {
47
+ if(!visible){ return setTaggedAction({ ...tagged_action, tagged_orders: [] })}
48
+ getMyAction()
49
+ },[visible]);
50
+
51
+ const getMyAction = async() => {
52
+ setActionState({ ...action_state, loading:true });
53
+ const ords = await SocialComponentApi.getMyAction()
54
+ const { event_ids, tournament_ids, match_ids, athlete_ids, team_ids } = SocialOrderHelpers.getIdsFromOrders(ords);
55
+ let l = await SocialComponentApi.getLeagues();
56
+ let e = await SocialComponentApi.getEventsByEventIds(event_ids);
57
+ let t = await SocialComponentApi.getTournamentsByTournamentIds(tournament_ids);
58
+ let m = await SocialComponentApi.getMatchesByMatchIds(match_ids);
59
+ let a = await SocialComponentApi.getAthletesByIds(athlete_ids);
60
+ let tm = await SocialComponentApi.getTeamsByIds(team_ids);
61
+ setActionState({
62
+ ...action_state,
63
+ loading:false,
64
+ leagues: l,
65
+ teams:tm,
66
+ orders:ords,
67
+ matches: m,
68
+ tournaments: t,
69
+ events: e,
70
+ athletes: a
71
+ });
72
+ }
73
+
74
+ const renderOrders = (data: { item:OrderProps, index:number }) => {
75
+ const { time, title, league } = SocialOrderHelpers.getContestDetails(data.item, events, tournaments, matches, athletes, teams, leagues);
76
+ const tagged = tagged_orders.includes(data.item.order_id) ? true : false
77
+ return (
78
+ <View transparent style={{ margin:5, borderWidth:tagged?2:0, borderColor:Colors.text.success}}>
79
+ <SocialOrderCard
80
+ order={data.item}
81
+ league={league}
82
+ onTagOrder={(order) => {
83
+ if(tagged){
84
+ setTaggedAction({
85
+ ...tagged_action,
86
+ tagged_orders: tagged_orders.filter(o => o != order.order_id)
87
+ });
88
+ } else {
89
+ setTaggedAction({
90
+ ...tagged_action,
91
+ tagged_orders: tagged_orders.filter(o => o != order.order_id).concat(order.order_id)
92
+ });
93
+ }
94
+
95
+ onTagOrder(order)
96
+ }}
97
+ contest_time={time}
98
+ contest_title={title}
99
+ />
100
+ </View>
101
+
102
+ )
103
+ }
104
+
105
+ const renderSections = (data:{ item:string, index:number }) => {
106
+ switch(data.item){
107
+ case 'toggle':
108
+ return <></>
109
+ case 'orders':
110
+ return (
111
+ <View transparent style={{ padding:10 }}>
112
+ <FlatList
113
+ key={`action_orders`}
114
+ keyExtractor={(item) => item.order_id.toString()}
115
+ renderItem={renderOrders}
116
+ data={orders}
117
+ />
118
+ </View>
119
+
120
+ )
121
+ default: return <></>
122
+ }
123
+ }
124
+
125
+ return (
126
+ <Modal
127
+ visible={visible}
128
+ style={{ flex:1 }}
129
+ animationType='slide'
130
+ transparent
131
+ >
132
+ <View type='blur' style={{ flex:1, paddingTop:insets?.top, paddingBottom:insets?.bottom }}>
133
+ <View float style={{ flex:1, margin:20 }}>
134
+ <View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
135
+ <View transparent style={{ flex:1 }}>
136
+ <Text theme='h1'>Your Current Action</Text>
137
+ <Text style={{ marginTop:3 }} theme='description'>Select the order or other action you would like to tag!</Text>
138
+ </View>
139
+ <Button
140
+ style={{ height:30, width:30, borderRadius:100, justifyContent:'center', alignItems:'center', padding:0 }}
141
+ title='X'
142
+ float
143
+ type='close'
144
+ onPress={() => onClose()}
145
+ />
146
+ </View>
147
+ {loading ?
148
+ <ActivityIndicator style={{ padding:20, alignSelf:'center' }} size='large' color={Colors.text.h1}/>
149
+ :<></>}
150
+ <View transparent style={{ flex:1 }}>
151
+ <FlatList
152
+ data={sections}
153
+ key={'action_selector_sections'}
154
+ keyExtractor={item => item}
155
+ renderItem={renderSections}
156
+ />
157
+ </View>
158
+ </View>
159
+ </View>
160
+ </Modal>
161
+ )
162
+ }
163
+
164
+ export default ActionSelector
@@ -1,35 +1,63 @@
1
- import React from 'react';
2
- import { View } from "../../Components/Themed"
1
+ import React, { useState } from 'react';
2
+ import { Button, View } from "../../Components/Themed"
3
3
  import { FlatList } from 'react-native';
4
4
  import { Icons } from '../../Components';
5
5
  import { useColors } from '../../constants/useColors';
6
6
  import ImageUploader from '../../Components/ImageUploader';
7
+ import ActionSelector from './components/ActionSelector';
8
+ import type { OrderProps } from '../../types';
7
9
 
8
10
  type InputBarProps = {
9
11
  actions: string[],
10
- onImageUpload: (image: { url:string, [key:string]:any }) => void
12
+ width:number,
13
+ insets?:{ top:number, left:number, right:number, bottom:number },
14
+ onImageUpload: (image: { url:string, [key:string]:any }) => void,
15
+ onTagOrder?:(order:OrderProps) => void
11
16
  }
12
17
 
13
- const InputBar = ({ actions, onImageUpload } : InputBarProps) => {
18
+ const InputBar = ({ actions, insets, onImageUpload, onTagOrder } : InputBarProps) => {
19
+ //const [ gif_select, setGifSelect ] = useState(false);
20
+
21
+ const [ input_state, setInputState ] = useState<{
22
+ action_selector_visible: boolean
23
+ }>({
24
+ action_selector_visible: false
25
+ });
26
+ const { action_selector_visible } = input_state
27
+
14
28
  const Colors = useColors();
15
29
 
16
30
  const renderActions = (data:{ item:string, index:number }) => {
17
31
  switch(data.item){
18
32
  case 'image':
19
33
  return (
20
- <View float>
34
+ <View style={{ margin:4, justifyContent:'center', alignItems:'center' }}>
21
35
  <ImageUploader
22
36
  public_id={(Math.random()*100000).toFixed()}
23
37
  onFinishUpload={(obj) => onImageUpload({ ...obj, url: obj.secure_url })}
24
38
  >
25
- <Icons.ImageIcon size={20} color={Colors.text.h1} />
39
+ <Icons.ImageIcon size={16} color={Colors.text.action} />
26
40
  </ImageUploader>
27
41
  </View>
28
42
  )
43
+ case 'action':
44
+ return (
45
+ <Button style={{ justifyContent:'center', alignItems:'center', margin:4, padding:10 }} onPress={() => setInputState({ ...input_state, action_selector_visible:true })}>
46
+ <Icons.ActivityIcon size={18} color={Colors.text.action} />
47
+ </Button>
48
+ )
49
+ case 'gif':
50
+ return (
51
+ <Button style={{ justifyContent:'center', alignItems:'center', margin:4, padding:10 }} onPress={() => console.log('')}>
52
+ <Icons.GIFIcon size={18} color={Colors.text.action} />
53
+ </Button>
54
+ )
29
55
  default: return <></>
30
56
  }
31
57
  }
32
58
 
59
+
60
+
33
61
  return (
34
62
  <View transparent style={{ flexDirection:'row', alignItems:'center', padding:2 }}>
35
63
  <FlatList
@@ -39,6 +67,12 @@ const InputBar = ({ actions, onImageUpload } : InputBarProps) => {
39
67
  keyExtractor={(item) => item}
40
68
  renderItem={renderActions}
41
69
  />
70
+ <ActionSelector
71
+ visible={action_selector_visible}
72
+ insets={insets}
73
+ onTagOrder={(order) => onTagOrder ? onTagOrder(order) : console.log('')}
74
+ onClose={() => setInputState({ ...input_state, action_selector_visible: false })}
75
+ />
42
76
  </View>
43
77
  )
44
78
  }
@@ -1,43 +1,50 @@
1
1
  import React from 'react';
2
2
  import { FlatList, View, Image } from 'react-native';
3
+ import { Button } from '../../../Components/Themed';
4
+ import { SocialComponentHelpers } from '../../api';
3
5
 
4
6
  type ImageListProps = {
5
7
  post_id:string,
6
8
  images: any[],
7
- width:number
9
+ width:number,
8
10
  }
9
- const ImageList = ({ post_id, width, images }:ImageListProps) => {
11
+ const ImageList = ({ width, images }:ImageListProps) => {
12
+
13
+ const new_images = SocialComponentHelpers.organizeImages(images, width-2, 250, 2, 150)
10
14
 
11
- const resizeImage = (image:any) => {
12
- let image_width = image.width ?? width
13
- let image_height = image.height ?? width
14
- const ratio = image_height / image_width
15
- let new_width = width
16
- let new_height = width * ratio
17
- return { width: new_width, height: new_height }
18
- }
19
15
 
20
- const renderImages = (data: { item:any, index:number }) => {
21
- const { width, height } = resizeImage(data.item);
16
+ const renderImages = (data:{ item:any, index:number }) => {
22
17
  return (
23
- <View>
18
+ <Button float style={{ padding:0, paddingLeft:data.item.paddingLeft, paddingRight:data.item.paddingRight }}>
24
19
  <Image
25
- source={{ uri:data.item.url }}
26
- style={{ width, height }}
20
+ source={{ uri: data.item.url }}
21
+ style={{ height: data.item.scaledHeight, width: data.item.scaledWidth, borderRadius:8 }}
27
22
  resizeMode='cover'
28
23
  />
24
+ </Button>
25
+ )
26
+ }
27
+
28
+ const renderImageRows = (data: { item:any, index:number }) => {
29
+ return (
30
+ <View style={{ alignItems:'center', marginBottom:2 }}>
31
+ <FlatList
32
+ data={data.item}
33
+ renderItem={renderImages}
34
+ scrollEnabled={false}
35
+ horizontal
36
+ />
29
37
  </View>
38
+
30
39
  )
31
40
  }
32
41
 
33
42
  return (
34
- <View>
43
+ <View style={{ flexDirection:'row', justifyContent:'center', flexWrap:'wrap' }}>
35
44
  <FlatList
36
- key={`${post_id}_post_images`}
37
- data={images}
38
- horizontal
39
- renderItem={renderImages}
40
- keyExtractor={(item) => item.url}
45
+ data={new_images}
46
+ keyExtractor={(item, index) => `${item.length}_${index}`}
47
+ renderItem={renderImageRows}
41
48
  />
42
49
  </View>
43
50
  )
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useRef, useState } from 'react';
2
- import type { ArticleProps, OrderProps, PostCommentStatProps, PostProps, PostReactionProps, PostReactionStatsProps, PublicPlayerProps } from '../../types';
2
+ import type { ArticleProps, OrderProps, PostCommentStatProps, PostProps, PostReactionProps, PostReactionStatsProps, PublicPlayerProps, TextTagProps } from '../../types';
3
3
  import PostHeader from './components/PostHeader';
4
4
  import { useIsInViewport } from '../../Components/ViewportObserver';
5
5
  import { SocialProfileApi } from '../PlayerProfile/api';
@@ -11,6 +11,10 @@ import ImageList from './components/ImageList';
11
11
  import { SocialComponentApi } from '../api';
12
12
  import { Button, Text, View } from '../../Components/Themed';
13
13
  import { useColors } from '../../constants/useColors';
14
+ import { FormattedText } from '../FormattedTextInput/FormattedText';
15
+ import ArticleCard from '../ArticleCard';
16
+ import UrlPreviewCard from '../UrlPreviewCard';
17
+ import { FlatList } from 'react-native';
14
18
 
15
19
 
16
20
  type PostCardProps = {
@@ -19,13 +23,18 @@ type PostCardProps = {
19
23
  articles:ArticleProps[],
20
24
  orders:OrderProps[],
21
25
  player_id?:string,
26
+ width:number,
27
+ onSelectTag:(tag:TextTagProps) => void,
22
28
  onSelectPlayer:(p:PublicPlayerProps) => void,
23
29
  onRequestAuthenticate:() => void,
24
30
  onCopyOrder?:(order:OrderProps) => void,
25
31
  onFadeOrder?:(order:OrderProps) => void,
26
32
  onViewComments?:(post_id:string) => void
27
33
  }
28
- const PostCard = ({ player_id, post, player, orders, onRequestAuthenticate, onCopyOrder, onFadeOrder, onViewComments, onSelectPlayer }:PostCardProps) => {
34
+
35
+ const sections = ['header', 'title', 'body', 'orders','images','articles', 'urls', 'footer']
36
+
37
+ const PostCard = ({ player_id, width, articles, post, player, orders, onRequestAuthenticate, onCopyOrder, onFadeOrder, onViewComments, onSelectPlayer, onSelectTag }:PostCardProps) => {
29
38
  const Colors = useColors();
30
39
  const [ post_data, setPostData ] = useState<{
31
40
  loading:boolean,
@@ -120,64 +129,121 @@ const PostCard = ({ player_id, post, player, orders, onRequestAuthenticate, onCo
120
129
  }
121
130
  }
122
131
 
132
+ const renderSections = (data:{ item:string, index:number }) => {
133
+ switch(data.item){
134
+ case 'header':
135
+ if(!player){ return <></> }
136
+ return (
137
+ <PostHeader
138
+ player={player}
139
+ post={post}
140
+ onSelectPlayer={onSelectPlayer}
141
+ />
142
+ )
143
+ case 'title':
144
+ return (
145
+ <View transparent style={{ padding:10 }}>
146
+ <Text theme='h2'>{post.title}</Text>
147
+ </View>
148
+ )
149
+ case 'body':
150
+ return (
151
+ <View transparent style={{ padding:20, paddingTop:0, paddingBottom:0 }}>
152
+ {post.formatted_text ?
153
+ <FormattedText
154
+ text={post.formatted_text}
155
+ tags={post.tags ?? []}
156
+ onSelectTag={(tag) => onSelectTag(tag)}
157
+ />
158
+ :
159
+ <Text theme='description'>{post.body}</Text>
160
+ }
161
+ </View>
162
+ )
163
+ case 'orders':
164
+ if(!player || !post.memo_orders){ return <></> }
165
+ return (
166
+ <View style={{ padding:10 }}>
167
+ <SocialOrdersList
168
+ players={[player]}
169
+ orders={orders}
170
+ maxWidth={300}
171
+ direction='horizontal'
172
+ onCopyOrder={onCopyOrder}
173
+ onFadeOrder={onFadeOrder}
174
+ />
175
+ </View>
176
+ )
177
+ case 'artciles':
178
+ if(!post.memo_articles || !articles[0]){ return <></> }
179
+ return (
180
+ <View transparent>
181
+ <ArticleCard
182
+ article={articles[0]}
183
+ width={width}
184
+ onSelectArticle={() => console.log('hey')}
185
+ />
186
+ </View>
187
+ )
188
+ case 'urls':
189
+ if(!post.memo_urls || !post.memo_urls[0]){ return <></> }
190
+ return (
191
+ <View transparent style={{ margin:5 }}>
192
+ <UrlPreviewCard
193
+ url={post.memo_urls[0]}
194
+ width={width - 10}
195
+ max_height={175}
196
+
197
+ />
198
+ </View>
199
+ )
200
+ case 'images':
201
+ if(!post.memo_images || post.memo_images.length == 0){ return <></> }
202
+ return (
203
+ <View transparent style={{ padding:10 }}>
204
+ <ImageList
205
+ post_id={post.memo_post_id}
206
+ images={post.memo_images}
207
+ width={width - 20} //Take out the padding
208
+ />
209
+ </View>
210
+ )
211
+ case 'footer':
212
+ return (
213
+ <View type='footer' style={{ flexDirection:'row', alignItems:'center', padding:5, borderBottomRightRadius:8, borderBottomLeftRadius:8 }}>
214
+ <View float transparent style={{ padding:5 }}>
215
+ <PostReactionBar
216
+ loading={my_data_loading}
217
+ post_id={post.memo_post_id}
218
+ post_reaction_stats={post_reaction_stats ?? []}
219
+ my_post_reactions={my_reactions ?? []}
220
+ onReactionSelect={(r) => handleReaction(r)}
221
+ />
222
+ </View>
223
+ {onViewComments ?
224
+ <Button
225
+ style={{ flex:1, flexDirection:'row', alignItems:'center', justifyContent:'flex-end' }}
226
+ onPress={() => onViewComments(post.memo_post_id)}
227
+ >
228
+ <Text style={{ marginRight:4 }} theme='h2'>{post_comment_stat.comment_count}</Text>
229
+ <Icons.ChatIcon size={18} color={Colors.text.h1}/>
230
+ </Button>
231
+ :<></>}
232
+ </View>
233
+ )
234
+ default: return <></>
235
+ }
236
+ }
237
+
123
238
 
124
239
  return (
125
240
  <View float ref={post_ref as any}>
126
- {player ?
127
- <PostHeader
128
- player={player}
129
- post={post}
130
- onSelectPlayer={onSelectPlayer}
131
- />
132
- :<></>}
133
- <View transparent style={{ padding:10 }}>
134
- <Text theme='h2'>{post.title}</Text>
135
- </View>
136
- <View transparent style={{ padding:10, paddingTop:0, paddingBottom:0 }}>
137
- <Text theme='description'>{post.body}</Text>
138
- </View>
139
- {post.memo_articles && post.memo_articles.length > 0 ?
140
- <View transparent>
141
-
142
- </View>
143
- :<></>}
144
- {player && post.memo_orders && post.memo_orders.length > 0 ?
145
- <SocialOrdersList
146
- players={[player]}
147
- orders={orders}
148
- maxWidth={300}
149
- direction='horizontal'
150
- onCopyOrder={onCopyOrder}
151
- onFadeOrder={onFadeOrder}
241
+ <FlatList
242
+ data={sections}
243
+ renderItem={renderSections}
244
+ key={`post_sections`}
245
+ keyExtractor={item => item}
152
246
  />
153
- :<></>}
154
- {post.memo_images && post.memo_images.length > 0 ?
155
- <ImageList
156
- post_id={post.memo_post_id}
157
- images={post.memo_images}
158
- width={300}
159
- />
160
- :<></>}
161
- <View type='footer' style={{ flexDirection:'row', alignItems:'center', padding:5 }}>
162
- <View float transparent style={{ padding:5 }}>
163
- <PostReactionBar
164
- loading={my_data_loading}
165
- post_id={post.memo_post_id}
166
- post_reaction_stats={post_reaction_stats ?? []}
167
- my_post_reactions={my_reactions ?? []}
168
- onReactionSelect={(r) => handleReaction(r)}
169
- />
170
- </View>
171
- {onViewComments ?
172
- <Button
173
- style={{ flex:1, flexDirection:'row', alignItems:'center', justifyContent:'flex-end' }}
174
- onPress={() => onViewComments(post.memo_post_id)}
175
- >
176
- <Text style={{ marginRight:4 }} theme='h2'>{post_comment_stat.comment_count}</Text>
177
- <Icons.ChatIcon size={18} color={Colors.text.h1}/>
178
- </Button>
179
- :<></>}
180
- </View>
181
247
  </View>
182
248
  )
183
249
  }