be-components 2.1.4 → 2.1.6
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.
- package/lib/commonjs/Components/Icons.js +29 -0
- package/lib/commonjs/Components/Icons.js.map +1 -1
- package/lib/commonjs/SocialComponents/PlayerProfile/components/PostsList.js +10 -2
- package/lib/commonjs/SocialComponents/PlayerProfile/components/PostsList.js.map +1 -1
- package/lib/commonjs/SocialComponents/PlayerProfile/index.js +110 -27
- package/lib/commonjs/SocialComponents/PlayerProfile/index.js.map +1 -1
- package/lib/commonjs/SocialComponents/PostCard/components/ImageList.js +51 -0
- package/lib/commonjs/SocialComponents/PostCard/components/ImageList.js.map +1 -0
- package/lib/commonjs/SocialComponents/PostCard/components/PostHeader.js +2 -1
- package/lib/commonjs/SocialComponents/PostCard/components/PostHeader.js.map +1 -1
- package/lib/commonjs/SocialComponents/PostCard/components/PostReactionBar.js +29 -3
- package/lib/commonjs/SocialComponents/PostCard/components/PostReactionBar.js.map +1 -1
- package/lib/commonjs/SocialComponents/PostCard/index.js +130 -19
- package/lib/commonjs/SocialComponents/PostCard/index.js.map +1 -1
- package/lib/commonjs/SocialComponents/SocialOrderCard.js +139 -29
- package/lib/commonjs/SocialComponents/SocialOrderCard.js.map +1 -1
- package/lib/commonjs/SocialComponents/SocialOrdersList.js +11 -3
- package/lib/commonjs/SocialComponents/SocialOrdersList.js.map +1 -1
- package/lib/commonjs/SocialComponents/api/index.js +88 -0
- package/lib/commonjs/SocialComponents/api/index.js.map +1 -1
- package/lib/module/Components/Icons.js +29 -0
- package/lib/module/Components/Icons.js.map +1 -1
- package/lib/module/SocialComponents/PlayerProfile/components/PostsList.js +10 -2
- package/lib/module/SocialComponents/PlayerProfile/components/PostsList.js.map +1 -1
- package/lib/module/SocialComponents/PlayerProfile/index.js +110 -27
- package/lib/module/SocialComponents/PlayerProfile/index.js.map +1 -1
- package/lib/module/SocialComponents/PostCard/components/ImageList.js +44 -0
- package/lib/module/SocialComponents/PostCard/components/ImageList.js.map +1 -0
- package/lib/module/SocialComponents/PostCard/components/PostHeader.js +2 -1
- package/lib/module/SocialComponents/PostCard/components/PostHeader.js.map +1 -1
- package/lib/module/SocialComponents/PostCard/components/PostReactionBar.js +30 -4
- package/lib/module/SocialComponents/PostCard/components/PostReactionBar.js.map +1 -1
- package/lib/module/SocialComponents/PostCard/index.js +130 -19
- package/lib/module/SocialComponents/PostCard/index.js.map +1 -1
- package/lib/module/SocialComponents/SocialOrderCard.js +138 -30
- package/lib/module/SocialComponents/SocialOrderCard.js.map +1 -1
- package/lib/module/SocialComponents/SocialOrdersList.js +11 -3
- package/lib/module/SocialComponents/SocialOrdersList.js.map +1 -1
- package/lib/module/SocialComponents/api/index.js +88 -0
- package/lib/module/SocialComponents/api/index.js.map +1 -1
- package/lib/typescript/src/Components/Icons.d.ts +1 -0
- package/lib/typescript/src/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/PlayerProfile/components/PostsList.d.ts +6 -2
- package/lib/typescript/src/SocialComponents/PlayerProfile/components/PostsList.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/PlayerProfile/index.d.ts +12 -1
- package/lib/typescript/src/SocialComponents/PlayerProfile/index.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/PostCard/components/ImageList.d.ts +9 -0
- package/lib/typescript/src/SocialComponents/PostCard/components/ImageList.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/PostCard/components/PostReactionBar.d.ts +4 -2
- package/lib/typescript/src/SocialComponents/PostCard/components/PostReactionBar.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/PostCard/index.d.ts +5 -1
- package/lib/typescript/src/SocialComponents/PostCard/index.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/SocialOrderCard.d.ts +6 -2
- package/lib/typescript/src/SocialComponents/SocialOrderCard.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/SocialOrdersList.d.ts +6 -2
- package/lib/typescript/src/SocialComponents/SocialOrdersList.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/api/index.d.ts +9 -1
- package/lib/typescript/src/SocialComponents/api/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Components/Icons.tsx +17 -0
- package/src/SocialComponents/PlayerProfile/components/PostsList.tsx +10 -2
- package/src/SocialComponents/PlayerProfile/index.tsx +69 -29
- package/src/SocialComponents/PostCard/components/ImageList.tsx +46 -0
- package/src/SocialComponents/PostCard/components/PostHeader.tsx +1 -1
- package/src/SocialComponents/PostCard/components/PostReactionBar.tsx +23 -5
- package/src/SocialComponents/PostCard/index.tsx +84 -14
- package/src/SocialComponents/SocialOrderCard.tsx +90 -19
- package/src/SocialComponents/SocialOrdersList.tsx +12 -4
- package/src/SocialComponents/api/index.ts +53 -1
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { View, FlatList } from 'react-native';
|
|
3
|
-
import type { AthleteProps, EventProps, LeagueProps, MatchProps, OrderProps, TeamProps, TournamentProps } from '../types';
|
|
3
|
+
import type { AthleteProps, EventProps, LeagueProps, MatchProps, OrderProps, PublicPlayerProps, TeamProps, TournamentProps } from '../types';
|
|
4
4
|
import SocialOrderCard from './SocialOrderCard';
|
|
5
5
|
import { SocialComponentApi, SocialOrderHelpers } from './api';
|
|
6
6
|
|
|
7
7
|
type SocialOrdersListProps = {
|
|
8
|
+
players:PublicPlayerProps[],
|
|
9
|
+
show_player?:boolean,
|
|
8
10
|
orders:OrderProps[],
|
|
9
|
-
direction: 'vertical'|'horizontal'
|
|
11
|
+
direction: 'vertical'|'horizontal',
|
|
12
|
+
onCopyOrder?:(order:OrderProps) => void,
|
|
13
|
+
onFadeOrder?:(order:OrderProps) => void
|
|
10
14
|
}
|
|
11
|
-
const SocialOrdersList = ({ orders, direction }:SocialOrdersListProps) => {
|
|
15
|
+
const SocialOrdersList = ({ players, show_player, orders, direction, onCopyOrder, onFadeOrder }:SocialOrdersListProps) => {
|
|
12
16
|
const [list_data, setListData] = useState<{
|
|
13
17
|
loading:boolean,
|
|
14
18
|
leagues:LeagueProps[],
|
|
@@ -40,7 +44,6 @@ const SocialOrdersList = ({ orders, direction }:SocialOrdersListProps) => {
|
|
|
40
44
|
setListData({ ...list_data, loading:true });
|
|
41
45
|
//Get event_ids
|
|
42
46
|
const { event_ids, tournament_ids, match_ids, athlete_ids, team_ids } = SocialOrderHelpers.getIdsFromOrders(orders);
|
|
43
|
-
console.log(team_ids)
|
|
44
47
|
let l = await SocialComponentApi.getLeagues();
|
|
45
48
|
let e = await SocialComponentApi.getEventsByEventIds(event_ids);
|
|
46
49
|
let t = await SocialComponentApi.getTournamentsByTournamentIds(tournament_ids);
|
|
@@ -64,15 +67,20 @@ const SocialOrdersList = ({ orders, direction }:SocialOrdersListProps) => {
|
|
|
64
67
|
|
|
65
68
|
const renderOrders = (data:{item:OrderProps, index:number}) => {
|
|
66
69
|
let { title, time, league, team, athlete } = SocialOrderHelpers.getContestDetails(data.item, events, tournaments, matches, athletes, teams, leagues);
|
|
70
|
+
let player = players.find(p => p.player_id == data.item.player_id)
|
|
67
71
|
return (
|
|
68
72
|
<View>
|
|
69
73
|
<SocialOrderCard
|
|
74
|
+
show_player={show_player}
|
|
75
|
+
player={player}
|
|
70
76
|
league={league}
|
|
71
77
|
team={team}
|
|
72
78
|
athlete={athlete}
|
|
73
79
|
contest_title={title}
|
|
74
80
|
contest_time={time}
|
|
75
81
|
order={data.item}
|
|
82
|
+
onFadeOrder={onFadeOrder}
|
|
83
|
+
onCopyOrder={onCopyOrder}
|
|
76
84
|
/>
|
|
77
85
|
</View>
|
|
78
86
|
)
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import { APIOverrides } from "../../ApiOverrides";
|
|
3
|
-
import type { AthleteProps, EventProps, LeagueProps, MatchProps, OrderProps, PlayerFollowerProps, TeamProps, TournamentProps } from "../../types";
|
|
3
|
+
import type { AthleteProps, EventProps, LeagueProps, MatchProps, OrderProps, PlayerFollowerProps, PostReactionProps, TeamProps, TournamentProps } from "../../types";
|
|
4
4
|
import Colors from "../../constants/colors";
|
|
5
5
|
import moment from "moment-mini";
|
|
6
6
|
|
|
7
7
|
let SOCIAL_SVC_API = '';
|
|
8
8
|
let EVENT_SVC_API = '';
|
|
9
|
+
let MK_SVC_API = '';
|
|
9
10
|
|
|
10
11
|
export { SocialComponentApi, SocialOrderHelpers }
|
|
11
12
|
|
|
@@ -14,6 +15,8 @@ const SocialComponentApi = {
|
|
|
14
15
|
const endpoints = APIOverrides.getEndpoints();
|
|
15
16
|
SOCIAL_SVC_API = endpoints['SOCIAL_SVC_API'] as string;
|
|
16
17
|
EVENT_SVC_API = endpoints['EVENT_SVC_API'] as string;
|
|
18
|
+
MK_SVC_API = endpoints['MK_SVC_API'] as string;
|
|
19
|
+
|
|
17
20
|
},
|
|
18
21
|
getLeagues: async():Promise<LeagueProps[]> => {
|
|
19
22
|
try {
|
|
@@ -23,6 +26,14 @@ const SocialComponentApi = {
|
|
|
23
26
|
return []
|
|
24
27
|
}
|
|
25
28
|
},
|
|
29
|
+
reverseOrder: async(order:OrderProps):Promise<OrderProps | undefined> => {
|
|
30
|
+
try {
|
|
31
|
+
const resp = await axios.post(`${MK_SVC_API}/v1/orders/order/reverse`, { order })
|
|
32
|
+
return resp.data.order
|
|
33
|
+
} catch (e) {
|
|
34
|
+
return undefined
|
|
35
|
+
}
|
|
36
|
+
},
|
|
26
37
|
getBulkPlayerfollowers: async(player_ids:string[]) => {
|
|
27
38
|
const resp = await axios.post(`${SOCIAL_SVC_API}/v1/followers/bulk/get`, { player_ids })
|
|
28
39
|
return resp.data.player_followers
|
|
@@ -76,6 +87,24 @@ const SocialComponentApi = {
|
|
|
76
87
|
return []
|
|
77
88
|
}
|
|
78
89
|
},
|
|
90
|
+
createPostReaction: async(post_reaction:PostReactionProps):Promise<PostReactionProps|undefined> => {
|
|
91
|
+
try {
|
|
92
|
+
const resp = await axios.post(`${SOCIAL_SVC_API}/v1/posts/reaction/create`, { post_reaction });
|
|
93
|
+
return resp.data.post_reaction
|
|
94
|
+
} catch (e) {
|
|
95
|
+
console.log(e);
|
|
96
|
+
return undefined
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
updatePostReaction : async(post_reaction:PostReactionProps):Promise<PostReactionProps|undefined> => {
|
|
100
|
+
try {
|
|
101
|
+
const resp = await axios.post(`${SOCIAL_SVC_API}/v1/posts/reaction/update`, { post_reaction })
|
|
102
|
+
return resp.data.post_reaction
|
|
103
|
+
} catch (e) {
|
|
104
|
+
console.log(e)
|
|
105
|
+
return undefined
|
|
106
|
+
}
|
|
107
|
+
},
|
|
79
108
|
}
|
|
80
109
|
|
|
81
110
|
|
|
@@ -92,6 +121,29 @@ const SocialOrderHelpers = {
|
|
|
92
121
|
return Colors.shades.black
|
|
93
122
|
}
|
|
94
123
|
},
|
|
124
|
+
getResultDetails: (order:OrderProps) => {
|
|
125
|
+
if(order.resolution_status == 'inprogress'){ return { result_label: '', color:Colors.brand.midnight } }
|
|
126
|
+
if(order.resolution_status == 'closed' && !order.positions[0]){ return { result_label: 'CANCELLED', color:Colors.brand.slate } }
|
|
127
|
+
let position = order.positions[0]
|
|
128
|
+
if(!position || position.status == 'inprogress'){ return { result_label: '', color:Colors.brand.midnight } }
|
|
129
|
+
switch(position.result_ind){
|
|
130
|
+
case 'win': return { result_label: 'WIN', color:Colors.utility.success }
|
|
131
|
+
case 'lose': return { result_label: 'LOSE', color:Colors.utility.error }
|
|
132
|
+
case 'draw': return { result_label: 'DRAW', color:Colors.brand.midnight }
|
|
133
|
+
default: return { result_label: '', color:Colors.brand.midnight }
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
calcPotentialWinnings :(odds:number, amt:number) => {
|
|
137
|
+
let potential_winnings;
|
|
138
|
+
if (odds > 0) {
|
|
139
|
+
var earningsMultiplyer = (odds/100) + 1;
|
|
140
|
+
potential_winnings = Math.round(earningsMultiplyer * amt * 100) / 100;
|
|
141
|
+
} else {
|
|
142
|
+
var earningsMultiplyer = (100/(Math.abs(odds))) + 1;
|
|
143
|
+
potential_winnings = Math.round(earningsMultiplyer * amt * 100) / 100;
|
|
144
|
+
}
|
|
145
|
+
return potential_winnings
|
|
146
|
+
},
|
|
95
147
|
getIdsFromOrders: (orders:OrderProps[]) => {
|
|
96
148
|
let event_ids:string[] = [], tournament_ids:string[] = [], match_ids:string[] = [], athlete_ids:string[] = [], team_ids:string[] = []
|
|
97
149
|
orders.map(o => {
|