be-components 2.1.2 → 2.1.4
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 +144 -0
- package/lib/commonjs/Components/Icons.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/TeamEventMarket/api/index.js +1 -1
- package/lib/commonjs/MarketComponents/components/TeamEventMarket/api/index.js.map +1 -1
- package/lib/commonjs/SocialComponents/PlayerCard.js +7 -6
- package/lib/commonjs/SocialComponents/PlayerCard.js.map +1 -1
- package/lib/commonjs/SocialComponents/PlayerList.js +1 -0
- package/lib/commonjs/SocialComponents/PlayerList.js.map +1 -1
- package/lib/commonjs/SocialComponents/PlayerProfile/api/index.js +149 -0
- package/lib/commonjs/SocialComponents/PlayerProfile/api/index.js.map +1 -0
- package/lib/commonjs/SocialComponents/PlayerProfile/components/PlayerFollowersList.js +138 -0
- package/lib/commonjs/SocialComponents/PlayerProfile/components/PlayerFollowersList.js.map +1 -0
- package/lib/commonjs/SocialComponents/PlayerProfile/components/PostsList.js +94 -0
- package/lib/commonjs/SocialComponents/PlayerProfile/components/PostsList.js.map +1 -0
- package/lib/commonjs/SocialComponents/PlayerProfile/index.js +501 -0
- package/lib/commonjs/SocialComponents/PlayerProfile/index.js.map +1 -0
- package/lib/commonjs/SocialComponents/PostCard/components/DraftTextEntities.js +36 -0
- package/lib/commonjs/SocialComponents/PostCard/components/DraftTextEntities.js.map +1 -0
- package/lib/commonjs/SocialComponents/PostCard/components/DraftTextViewer.js +59 -0
- package/lib/commonjs/SocialComponents/PostCard/components/DraftTextViewer.js.map +1 -0
- package/lib/commonjs/SocialComponents/PostCard/components/EntityHelpers.js +52 -0
- package/lib/commonjs/SocialComponents/PostCard/components/EntityHelpers.js.map +1 -0
- package/lib/commonjs/SocialComponents/PostCard/components/PostHeader.js +47 -0
- package/lib/commonjs/SocialComponents/PostCard/components/PostHeader.js.map +1 -0
- package/lib/commonjs/SocialComponents/PostCard/components/PostReactionBar.js +113 -0
- package/lib/commonjs/SocialComponents/PostCard/components/PostReactionBar.js.map +1 -0
- package/lib/commonjs/SocialComponents/PostCard/index.js +124 -0
- package/lib/commonjs/SocialComponents/PostCard/index.js.map +1 -0
- package/lib/commonjs/SocialComponents/SocialOrderCard.js +115 -0
- package/lib/commonjs/SocialComponents/SocialOrderCard.js.map +1 -0
- package/lib/commonjs/SocialComponents/SocialOrdersList.js +96 -0
- package/lib/commonjs/SocialComponents/SocialOrdersList.js.map +1 -0
- package/lib/commonjs/SocialComponents/api/index.js +204 -1
- package/lib/commonjs/SocialComponents/api/index.js.map +1 -1
- package/lib/commonjs/SocialComponents/index.js +7 -0
- package/lib/commonjs/SocialComponents/index.js.map +1 -1
- package/lib/module/Components/Icons.js +144 -0
- package/lib/module/Components/Icons.js.map +1 -1
- package/lib/module/MarketComponents/components/TeamEventMarket/api/index.js +1 -1
- package/lib/module/MarketComponents/components/TeamEventMarket/api/index.js.map +1 -1
- package/lib/module/SocialComponents/PlayerCard.js +7 -6
- package/lib/module/SocialComponents/PlayerCard.js.map +1 -1
- package/lib/module/SocialComponents/PlayerList.js +1 -0
- package/lib/module/SocialComponents/PlayerList.js.map +1 -1
- package/lib/module/SocialComponents/PlayerProfile/api/index.js +143 -0
- package/lib/module/SocialComponents/PlayerProfile/api/index.js.map +1 -0
- package/lib/module/SocialComponents/PlayerProfile/components/PlayerFollowersList.js +129 -0
- package/lib/module/SocialComponents/PlayerProfile/components/PlayerFollowersList.js.map +1 -0
- package/lib/module/SocialComponents/PlayerProfile/components/PostsList.js +86 -0
- package/lib/module/SocialComponents/PlayerProfile/components/PostsList.js.map +1 -0
- package/lib/module/SocialComponents/PlayerProfile/index.js +493 -0
- package/lib/module/SocialComponents/PlayerProfile/index.js.map +1 -0
- package/lib/module/SocialComponents/PostCard/components/DraftTextEntities.js +27 -0
- package/lib/module/SocialComponents/PostCard/components/DraftTextEntities.js.map +1 -0
- package/lib/module/SocialComponents/PostCard/components/DraftTextViewer.js +51 -0
- package/lib/module/SocialComponents/PostCard/components/DraftTextViewer.js.map +1 -0
- package/lib/module/SocialComponents/PostCard/components/EntityHelpers.js +41 -0
- package/lib/module/SocialComponents/PostCard/components/EntityHelpers.js.map +1 -0
- package/lib/module/SocialComponents/PostCard/components/PostHeader.js +40 -0
- package/lib/module/SocialComponents/PostCard/components/PostHeader.js.map +1 -0
- package/lib/module/SocialComponents/PostCard/components/PostReactionBar.js +104 -0
- package/lib/module/SocialComponents/PostCard/components/PostReactionBar.js.map +1 -0
- package/lib/module/SocialComponents/PostCard/index.js +115 -0
- package/lib/module/SocialComponents/PostCard/index.js.map +1 -0
- package/lib/module/SocialComponents/SocialOrderCard.js +108 -0
- package/lib/module/SocialComponents/SocialOrderCard.js.map +1 -0
- package/lib/module/SocialComponents/SocialOrdersList.js +87 -0
- package/lib/module/SocialComponents/SocialOrdersList.js.map +1 -0
- package/lib/module/SocialComponents/api/index.js +204 -1
- package/lib/module/SocialComponents/api/index.js.map +1 -1
- package/lib/module/SocialComponents/index.js +2 -1
- package/lib/module/SocialComponents/index.js.map +1 -1
- package/lib/typescript/src/Components/Icons.d.ts +5 -0
- package/lib/typescript/src/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/PlayerCard.d.ts +2 -1
- package/lib/typescript/src/SocialComponents/PlayerCard.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/PlayerList.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/PlayerProfile/api/index.d.ts +19 -0
- package/lib/typescript/src/SocialComponents/PlayerProfile/api/index.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/PlayerProfile/components/PlayerFollowersList.d.ts +13 -0
- package/lib/typescript/src/SocialComponents/PlayerProfile/components/PlayerFollowersList.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/PlayerProfile/components/PostsList.d.ts +9 -0
- package/lib/typescript/src/SocialComponents/PlayerProfile/components/PostsList.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/PlayerProfile/index.d.ts +9 -0
- package/lib/typescript/src/SocialComponents/PlayerProfile/index.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/PostCard/components/DraftTextEntities.d.ts +4 -0
- package/lib/typescript/src/SocialComponents/PostCard/components/DraftTextEntities.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/PostCard/components/DraftTextViewer.d.ts +12 -0
- package/lib/typescript/src/SocialComponents/PostCard/components/DraftTextViewer.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/PostCard/components/EntityHelpers.d.ts +12 -0
- package/lib/typescript/src/SocialComponents/PostCard/components/EntityHelpers.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/PostCard/components/PostHeader.d.ts +9 -0
- package/lib/typescript/src/SocialComponents/PostCard/components/PostHeader.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/PostCard/components/PostReactionBar.d.ts +11 -0
- package/lib/typescript/src/SocialComponents/PostCard/components/PostReactionBar.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/PostCard/index.d.ts +11 -0
- package/lib/typescript/src/SocialComponents/PostCard/index.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/SocialOrderCard.d.ts +13 -0
- package/lib/typescript/src/SocialComponents/SocialOrderCard.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/SocialOrdersList.d.ts +9 -0
- package/lib/typescript/src/SocialComponents/SocialOrdersList.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/api/index.d.ts +26 -2
- package/lib/typescript/src/SocialComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/index.d.ts +2 -1
- package/lib/typescript/src/SocialComponents/index.d.ts.map +1 -1
- package/package.json +5 -1
- package/src/Components/Icons.tsx +76 -0
- package/src/MarketComponents/components/TeamEventMarket/api/index.ts +1 -1
- package/src/SocialComponents/PlayerCard.tsx +6 -5
- package/src/SocialComponents/PlayerList.tsx +2 -1
- package/src/SocialComponents/PlayerProfile/api/index.ts +138 -0
- package/src/SocialComponents/PlayerProfile/components/PlayerFollowersList.tsx +111 -0
- package/src/SocialComponents/PlayerProfile/components/PostsList.tsx +92 -0
- package/src/SocialComponents/PlayerProfile/index.tsx +380 -0
- package/src/SocialComponents/PostCard/components/DraftTextEntities.tsx +25 -0
- package/src/SocialComponents/PostCard/components/DraftTextViewer.tsx +61 -0
- package/src/SocialComponents/PostCard/components/EntityHelpers.tsx +44 -0
- package/src/SocialComponents/PostCard/components/PostHeader.tsx +29 -0
- package/src/SocialComponents/PostCard/components/PostReactionBar.tsx +75 -0
- package/src/SocialComponents/PostCard/index.tsx +105 -0
- package/src/SocialComponents/SocialOrderCard.tsx +75 -0
- package/src/SocialComponents/SocialOrdersList.tsx +93 -0
- package/src/SocialComponents/api/index.ts +119 -4
- package/src/SocialComponents/index.tsx +3 -2
- package/src/types.d.ts +245 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { View, TouchableOpacity } from 'react-native';
|
|
3
|
+
import DraftTextViewer from './components/DraftTextViewer';
|
|
4
|
+
import type { OrderProps, PostCommentStatProps, PostProps, PostReactionStatsProps, PublicPlayerProps } from '../../types';
|
|
5
|
+
import PostHeader from './components/PostHeader';
|
|
6
|
+
import { view_styles } from '../../constants/styles';
|
|
7
|
+
import { useIsInViewport } from '../../Components/ViewportObserver';
|
|
8
|
+
import { SocialProfileApi } from '../PlayerProfile/api';
|
|
9
|
+
import PostReactionBar from './components/PostReactionBar';
|
|
10
|
+
import Colors from '../../constants/colors';
|
|
11
|
+
import { Icons, Text } from '../../Components';
|
|
12
|
+
import SocialOrdersList from '../SocialOrdersList';
|
|
13
|
+
|
|
14
|
+
type PostCardProps = {
|
|
15
|
+
post: PostProps,
|
|
16
|
+
player:PublicPlayerProps,
|
|
17
|
+
orders:OrderProps[],
|
|
18
|
+
player_id?:string
|
|
19
|
+
}
|
|
20
|
+
const PostCard = ({ post, player, orders }:PostCardProps) => {
|
|
21
|
+
const [ post_data, setPostData ] = useState<{
|
|
22
|
+
loading:boolean,
|
|
23
|
+
reactions_loaded:boolean,
|
|
24
|
+
post_comment_stat:PostCommentStatProps,
|
|
25
|
+
post_reaction_stats:PostReactionStatsProps[],
|
|
26
|
+
}>({
|
|
27
|
+
loading:false,
|
|
28
|
+
reactions_loaded: false,
|
|
29
|
+
post_comment_stat: { activity_post_id:post.memo_post_id, comment_count: 0 },
|
|
30
|
+
post_reaction_stats: []
|
|
31
|
+
})
|
|
32
|
+
const { reactions_loaded, post_reaction_stats, post_comment_stat } = post_data;
|
|
33
|
+
/*
|
|
34
|
+
const [ my_data, setMyData ] = useState<{
|
|
35
|
+
my_data_loading:boolean,
|
|
36
|
+
my_reactions:PostReactionProps[]
|
|
37
|
+
}>({
|
|
38
|
+
my_data_loading:false,
|
|
39
|
+
my_reactions:[]
|
|
40
|
+
})
|
|
41
|
+
*/
|
|
42
|
+
const post_ref = useRef();
|
|
43
|
+
const is_in_viewport = useIsInViewport(post_ref);
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if(!is_in_viewport || reactions_loaded){ return }
|
|
47
|
+
getPostReactionData();
|
|
48
|
+
},[is_in_viewport])
|
|
49
|
+
|
|
50
|
+
const getPostReactionData = async() => {
|
|
51
|
+
setPostData({ ...post_data, loading: true });
|
|
52
|
+
const pr_stats = await SocialProfileApi.getReactionStatsByPostId(post.memo_post_id, 'memo');
|
|
53
|
+
//const pc_stat = await SocialProfileApi.getCommentStatsByPostId(post.memo_post_id, 'memo');
|
|
54
|
+
setPostData({
|
|
55
|
+
...post_data,
|
|
56
|
+
reactions_loaded:true,
|
|
57
|
+
loading: false,
|
|
58
|
+
post_reaction_stats: pr_stats
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<View ref={post_ref as any} style={{ ...view_styles.section }}>
|
|
64
|
+
<PostHeader
|
|
65
|
+
player={player}
|
|
66
|
+
post={post}
|
|
67
|
+
/>
|
|
68
|
+
<View>
|
|
69
|
+
<Text theme='header_2'>{post.title}</Text>
|
|
70
|
+
</View>
|
|
71
|
+
<View style={{ ...view_styles.section_body }}>
|
|
72
|
+
<DraftTextViewer
|
|
73
|
+
post_id={post.memo_post_id}
|
|
74
|
+
formatted_body={post.formatted_body}
|
|
75
|
+
view_type='memo'
|
|
76
|
+
text_fallback={post.body}
|
|
77
|
+
/>
|
|
78
|
+
</View>
|
|
79
|
+
{post.memo_orders && post.memo_orders.length > 0 ?
|
|
80
|
+
<SocialOrdersList
|
|
81
|
+
orders={orders}
|
|
82
|
+
direction='horizontal'
|
|
83
|
+
/>
|
|
84
|
+
:<></>}
|
|
85
|
+
<View style={{ ...view_styles.section_footer, padding:5, backgroundColor:Colors.shades.white }}>
|
|
86
|
+
<View style={{}}>
|
|
87
|
+
<PostReactionBar
|
|
88
|
+
post_reaction_stats={post_reaction_stats}
|
|
89
|
+
my_post_reactions={[]}
|
|
90
|
+
onReactionSelect={(r) => console.log(r)}
|
|
91
|
+
/>
|
|
92
|
+
</View>
|
|
93
|
+
<TouchableOpacity
|
|
94
|
+
style={{ flex:1, flexDirection:'row', alignItems:'center', justifyContent:'flex-end' }}
|
|
95
|
+
onPress={() => console.log('SHOW ME THE COMMENTS')}
|
|
96
|
+
>
|
|
97
|
+
<Text style={{ marginRight:4 }} theme='header_2'>{post_comment_stat.comment_count}</Text>
|
|
98
|
+
<Icons.ChatIcon size={18} color={Colors.brand.midnight}/>
|
|
99
|
+
</TouchableOpacity>
|
|
100
|
+
</View>
|
|
101
|
+
</View>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export default PostCard
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Image } from 'react-native';
|
|
3
|
+
import type { AthleteProps, LeagueProps, OrderProps, TeamProps } from '../types';
|
|
4
|
+
import { view_styles } from '../constants/styles';
|
|
5
|
+
import { Button, Icons, Text } from '../Components';
|
|
6
|
+
import { SocialOrderHelpers } from './api';
|
|
7
|
+
import Colors from '../constants/colors';
|
|
8
|
+
|
|
9
|
+
type SocialOrderCardProps = {
|
|
10
|
+
contest_title:string,
|
|
11
|
+
contest_time:string,
|
|
12
|
+
order:OrderProps,
|
|
13
|
+
athlete?:AthleteProps,
|
|
14
|
+
team?:TeamProps,
|
|
15
|
+
league?:LeagueProps
|
|
16
|
+
}
|
|
17
|
+
const SocialOrderCard = ({ league, team, order, contest_title, contest_time }:SocialOrderCardProps) => {
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<View style={{ ...view_styles.section }}>
|
|
21
|
+
<View style={{ ...view_styles.section_header }}>
|
|
22
|
+
{league ?
|
|
23
|
+
<Image
|
|
24
|
+
source={{ uri: league.league_image }}
|
|
25
|
+
style={{ height:30, width:30, borderRadius:4 }}
|
|
26
|
+
resizeMode='cover'
|
|
27
|
+
/>
|
|
28
|
+
:
|
|
29
|
+
<View style={{ height:30, width:30, borderRadius:4, justifyContent:'center', alignItems:'center', backgroundColor:SocialOrderHelpers.getIconColor(order) }}>
|
|
30
|
+
<Icons.ActivityIcon size={14} color={Colors.shades.white}/>
|
|
31
|
+
</View>
|
|
32
|
+
}
|
|
33
|
+
<View style={{ flex:1, marginLeft:10 }}>
|
|
34
|
+
<Text theme='header_2'>{contest_title}</Text>
|
|
35
|
+
<Text style={{ marginTop:3 }} theme='body_2'>{contest_time}</Text>
|
|
36
|
+
</View>
|
|
37
|
+
</View>
|
|
38
|
+
<View style={{ ...view_styles.section_body }}>
|
|
39
|
+
<View style={{ ...view_styles.body_row }}>
|
|
40
|
+
{team ?
|
|
41
|
+
<Image
|
|
42
|
+
source={{ uri: team.image?.url }}
|
|
43
|
+
style={{ height:30, width:30 }}
|
|
44
|
+
resizeMode='cover'
|
|
45
|
+
/>
|
|
46
|
+
:<></>}
|
|
47
|
+
<View style={{ flex:1, marginLeft:10 }}>
|
|
48
|
+
<Text theme='header_2'>{order.title} {SocialOrderHelpers.getOddsLabel(order.odds)}</Text>
|
|
49
|
+
</View>
|
|
50
|
+
</View>
|
|
51
|
+
</View>
|
|
52
|
+
|
|
53
|
+
{order.resolution_status == 'inprogress' ?
|
|
54
|
+
<View style={{ ...view_styles.body_row, padding:0 }}>
|
|
55
|
+
<Button
|
|
56
|
+
style={{ flex:1, borderRadius:0, borderBottomLeftRadius:8 }}
|
|
57
|
+
title='Copy'
|
|
58
|
+
title_color={Colors.shades.white}
|
|
59
|
+
backgroundColor={Colors.brand.midnight}
|
|
60
|
+
onPress={() => console.log('COPY THIS ORDER!')}
|
|
61
|
+
/>
|
|
62
|
+
<Button
|
|
63
|
+
style={{ flex:1, borderRadius:0, borderBottomRightRadius:8 }}
|
|
64
|
+
title='Fade'
|
|
65
|
+
title_color={Colors.shades.white}
|
|
66
|
+
backgroundColor={Colors.brand.cyan}
|
|
67
|
+
onPress={() => console.log('FADE THIS ORDER!')}
|
|
68
|
+
/>
|
|
69
|
+
</View>
|
|
70
|
+
:<></>}
|
|
71
|
+
</View>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default SocialOrderCard
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { View, FlatList } from 'react-native';
|
|
3
|
+
import type { AthleteProps, EventProps, LeagueProps, MatchProps, OrderProps, TeamProps, TournamentProps } from '../types';
|
|
4
|
+
import SocialOrderCard from './SocialOrderCard';
|
|
5
|
+
import { SocialComponentApi, SocialOrderHelpers } from './api';
|
|
6
|
+
|
|
7
|
+
type SocialOrdersListProps = {
|
|
8
|
+
orders:OrderProps[],
|
|
9
|
+
direction: 'vertical'|'horizontal'
|
|
10
|
+
}
|
|
11
|
+
const SocialOrdersList = ({ orders, direction }:SocialOrdersListProps) => {
|
|
12
|
+
const [list_data, setListData] = useState<{
|
|
13
|
+
loading:boolean,
|
|
14
|
+
leagues:LeagueProps[],
|
|
15
|
+
events:EventProps[],
|
|
16
|
+
tournaments:TournamentProps[],
|
|
17
|
+
matches:MatchProps[],
|
|
18
|
+
athletes:AthleteProps[],
|
|
19
|
+
teams:TeamProps[]
|
|
20
|
+
}>({
|
|
21
|
+
loading:false,
|
|
22
|
+
leagues:[],
|
|
23
|
+
events:[],
|
|
24
|
+
tournaments:[],
|
|
25
|
+
matches:[],
|
|
26
|
+
athletes:[],
|
|
27
|
+
teams:[]
|
|
28
|
+
});
|
|
29
|
+
const { leagues, events, tournaments, matches, athletes, teams } = list_data;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
SocialComponentApi.setEnvironment()
|
|
35
|
+
getDataFromServer();
|
|
36
|
+
},[orders.length])
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
const getDataFromServer = async() => {
|
|
40
|
+
setListData({ ...list_data, loading:true });
|
|
41
|
+
//Get event_ids
|
|
42
|
+
const { event_ids, tournament_ids, match_ids, athlete_ids, team_ids } = SocialOrderHelpers.getIdsFromOrders(orders);
|
|
43
|
+
console.log(team_ids)
|
|
44
|
+
let l = await SocialComponentApi.getLeagues();
|
|
45
|
+
let e = await SocialComponentApi.getEventsByEventIds(event_ids);
|
|
46
|
+
let t = await SocialComponentApi.getTournamentsByTournamentIds(tournament_ids);
|
|
47
|
+
let m = await SocialComponentApi.getMatchesByMatchIds(match_ids);
|
|
48
|
+
let a = await SocialComponentApi.getAthletesByIds(athlete_ids);
|
|
49
|
+
let tm = await SocialComponentApi.getTeamsByIds(team_ids);
|
|
50
|
+
//Now lets grab the data!
|
|
51
|
+
setListData({
|
|
52
|
+
...list_data,
|
|
53
|
+
loading:false,
|
|
54
|
+
leagues: l,
|
|
55
|
+
events: e,
|
|
56
|
+
tournaments: t,
|
|
57
|
+
matches: m,
|
|
58
|
+
athletes: a,
|
|
59
|
+
teams: tm
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
const renderOrders = (data:{item:OrderProps, index:number}) => {
|
|
66
|
+
let { title, time, league, team, athlete } = SocialOrderHelpers.getContestDetails(data.item, events, tournaments, matches, athletes, teams, leagues);
|
|
67
|
+
return (
|
|
68
|
+
<View>
|
|
69
|
+
<SocialOrderCard
|
|
70
|
+
league={league}
|
|
71
|
+
team={team}
|
|
72
|
+
athlete={athlete}
|
|
73
|
+
contest_title={title}
|
|
74
|
+
contest_time={time}
|
|
75
|
+
order={data.item}
|
|
76
|
+
/>
|
|
77
|
+
</View>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<View>
|
|
83
|
+
<FlatList
|
|
84
|
+
data={orders}
|
|
85
|
+
renderItem={renderOrders}
|
|
86
|
+
horizontal={direction == 'horizontal' ? true : false}
|
|
87
|
+
keyExtractor={(item) => item.order_id.toString()}
|
|
88
|
+
/>
|
|
89
|
+
</View>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export default SocialOrdersList
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import { APIOverrides } from "../../ApiOverrides";
|
|
3
|
-
import type { PlayerFollowerProps } from "../../types";
|
|
3
|
+
import type { AthleteProps, EventProps, LeagueProps, MatchProps, OrderProps, PlayerFollowerProps, TeamProps, TournamentProps } from "../../types";
|
|
4
|
+
import Colors from "../../constants/colors";
|
|
5
|
+
import moment from "moment-mini";
|
|
4
6
|
|
|
5
7
|
let SOCIAL_SVC_API = '';
|
|
8
|
+
let EVENT_SVC_API = '';
|
|
6
9
|
|
|
7
|
-
export { SocialComponentApi }
|
|
10
|
+
export { SocialComponentApi, SocialOrderHelpers }
|
|
8
11
|
|
|
9
12
|
const SocialComponentApi = {
|
|
10
13
|
setEnvironment: () => {
|
|
11
14
|
const endpoints = APIOverrides.getEndpoints();
|
|
12
15
|
SOCIAL_SVC_API = endpoints['SOCIAL_SVC_API'] as string;
|
|
13
|
-
|
|
16
|
+
EVENT_SVC_API = endpoints['EVENT_SVC_API'] as string;
|
|
17
|
+
},
|
|
18
|
+
getLeagues: async():Promise<LeagueProps[]> => {
|
|
19
|
+
try {
|
|
20
|
+
const resp = await axios.get(`${EVENT_SVC_API}/v1/leagues`);
|
|
21
|
+
return resp.data.leagues
|
|
22
|
+
} catch (e) {
|
|
23
|
+
return []
|
|
24
|
+
}
|
|
14
25
|
},
|
|
15
26
|
getBulkPlayerfollowers: async(player_ids:string[]) => {
|
|
16
27
|
const resp = await axios.post(`${SOCIAL_SVC_API}/v1/followers/bulk/get`, { player_ids })
|
|
@@ -19,5 +30,109 @@ const SocialComponentApi = {
|
|
|
19
30
|
savePlayerFollower: async(player_follower:PlayerFollowerProps):Promise<PlayerFollowerProps> => {
|
|
20
31
|
const resp = await axios.post(`${SOCIAL_SVC_API}/v1/followers/player/create`, { player_follower })
|
|
21
32
|
return resp.data.player_follower
|
|
22
|
-
}
|
|
33
|
+
},
|
|
34
|
+
getEventsByEventIds: async(event_ids:string[]):Promise<EventProps[]> => {
|
|
35
|
+
if(event_ids.length == 0){ return [] }
|
|
36
|
+
try {
|
|
37
|
+
const resp = await axios.post(`${EVENT_SVC_API}/v1/events/bulk/get`, { attribute:'event_id', values: event_ids })
|
|
38
|
+
return resp.data.events
|
|
39
|
+
} catch (e) {
|
|
40
|
+
return []
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
getMatchesByMatchIds: async(match_ids:string[]):Promise<MatchProps[]> => {
|
|
44
|
+
if(match_ids.length == 0){ return [] }
|
|
45
|
+
try {
|
|
46
|
+
const resp = await axios.post(`${EVENT_SVC_API}/v1/matches/bulk/get`, { attribute: 'match_id', values: match_ids })
|
|
47
|
+
return resp.data.matches
|
|
48
|
+
} catch (e) {
|
|
49
|
+
return []
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
getAthletesByIds : async(athlete_ids:string[]):Promise<AthleteProps[]> => {
|
|
53
|
+
if(athlete_ids.length == 0){ return [] }
|
|
54
|
+
try {
|
|
55
|
+
const resp = await axios.post(`${EVENT_SVC_API}/v1/athletes/bulk/get`, { attribute: 'athlete_id', values: athlete_ids })
|
|
56
|
+
return resp.data.athletes
|
|
57
|
+
} catch (e) {
|
|
58
|
+
return []
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
getTournamentsByTournamentIds: async(tournament_ids:string[]):Promise<TournamentProps[]> => {
|
|
62
|
+
if(tournament_ids.length == 0){ return [] }
|
|
63
|
+
try {
|
|
64
|
+
const resp = await axios.post(`${EVENT_SVC_API}/v1/tournaments/bulk/get`, { attribute: 'event_id', values: tournament_ids })
|
|
65
|
+
return resp.data.tournaments
|
|
66
|
+
} catch (e) {
|
|
67
|
+
return []
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
getTeamsByIds: async(team_ids:string[]) => {
|
|
71
|
+
if(team_ids.length == 0){ return [] }
|
|
72
|
+
try {
|
|
73
|
+
const resp = await axios.post(`${EVENT_SVC_API}/v1/teams/bulk/get`, { attribute:'team_id', values: team_ids })
|
|
74
|
+
return resp.data.teams
|
|
75
|
+
} catch (e) {
|
|
76
|
+
return []
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
const SocialOrderHelpers = {
|
|
83
|
+
getIconColor: (order:OrderProps) => {
|
|
84
|
+
switch(order.status){
|
|
85
|
+
case 'approved':
|
|
86
|
+
return Colors.brand.electric
|
|
87
|
+
case 'closed':
|
|
88
|
+
return Colors.brand.midnight
|
|
89
|
+
case 'cancelled':
|
|
90
|
+
return Colors.highlights.highlight200
|
|
91
|
+
default:
|
|
92
|
+
return Colors.shades.black
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
getIdsFromOrders: (orders:OrderProps[]) => {
|
|
96
|
+
let event_ids:string[] = [], tournament_ids:string[] = [], match_ids:string[] = [], athlete_ids:string[] = [], team_ids:string[] = []
|
|
97
|
+
orders.map(o => {
|
|
98
|
+
if(o.event_type == 'team'){ event_ids.push(o.event_id) }
|
|
99
|
+
if(o.event_type == 'tournament'){ tournament_ids.push(o.event_id) }
|
|
100
|
+
if(o.event_type == 'match'){ match_ids.push(o.event_id) }
|
|
101
|
+
if(o.side_type == 'athlete'){ athlete_ids.push(o.side_id) }
|
|
102
|
+
if(o.side_type == 'team'){ team_ids.push(o.side_id) }
|
|
103
|
+
})
|
|
104
|
+
return { event_ids, tournament_ids, match_ids, athlete_ids, team_ids }
|
|
105
|
+
},
|
|
106
|
+
getContestDetails: (order:OrderProps, events:EventProps[], tournaments:TournamentProps[], matches:MatchProps[], athletes:AthleteProps[], teams:TeamProps[], leagues:LeagueProps[]):{ title:string, time:string, league?:LeagueProps, athlete?:AthleteProps, team?:TeamProps } => {
|
|
107
|
+
let athlete = order.side_type == 'athlete' ? athletes.find(a => a.athlete_id == order.side_id) : undefined
|
|
108
|
+
let team = order.side_type == 'team' ? teams.find(t => t.team_id == order.side_id) : undefined;
|
|
109
|
+
|
|
110
|
+
switch(order.event_type){
|
|
111
|
+
case 'team':
|
|
112
|
+
console.log('HERE WE GO')
|
|
113
|
+
let event = events.find(e => e.event_id == order.event_id);
|
|
114
|
+
console.log(event)
|
|
115
|
+
if(!event){ return { team, athlete, title: '', time: '' } }
|
|
116
|
+
let league = leagues.find(l => l.league_id == event.league_id);
|
|
117
|
+
return { team, athlete, league, title: event.event_title, time: event.status == 'scheduled' ? moment(event.scheduled_datetime).format('MM/DD @ hh:mm a') : event.time_detail ?? '' }
|
|
118
|
+
case 'match':
|
|
119
|
+
let match = matches.find(m => m.match_id == order.event_id);
|
|
120
|
+
if(!match){ return { team, athlete, title: '', time: '' } }
|
|
121
|
+
let tourney = tournaments.find(t => t.tournament_id == match.tournament_id);
|
|
122
|
+
let m_league = leagues.find(l => l.league_id == tourney?.league_id)
|
|
123
|
+
return { team, athlete, league: m_league, title: match.match_title, time: moment(match.scheduled_datetime).format('MM/DD @ hh:mm a') }
|
|
124
|
+
case 'tournament':
|
|
125
|
+
let tournament = tournaments.find(t => t.tournament_id == order.event_id);
|
|
126
|
+
if(!tournament){ return { title: '', time: '' } }
|
|
127
|
+
const t_league = leagues.find(l => l.league_id == tournament.league_id)
|
|
128
|
+
return { team, athlete, league: t_league, title: tournament.tournament_name, time: moment(tournament.scheduled_datetime).format('MM/DD @ hh:mm a') }
|
|
129
|
+
default : return { title: '', time: '' }
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
getOddsLabel: (odds:number, decimals?:number) => {
|
|
133
|
+
let new_odds = odds.toFixed()
|
|
134
|
+
if(decimals){ new_odds = odds.toFixed(decimals) }
|
|
135
|
+
if(odds < 0){ return `${new_odds}` }
|
|
136
|
+
return `+${new_odds}`
|
|
137
|
+
},
|
|
23
138
|
}
|
package/src/types.d.ts
CHANGED
|
@@ -1742,3 +1742,248 @@ export interface OrderProps {
|
|
|
1742
1742
|
no_bet?:boolean,
|
|
1743
1743
|
no_bet_reason?:string
|
|
1744
1744
|
}
|
|
1745
|
+
|
|
1746
|
+
|
|
1747
|
+
|
|
1748
|
+
//SOCIAL COMPONENTS
|
|
1749
|
+
|
|
1750
|
+
export interface PlayerLinkProps {
|
|
1751
|
+
player_link_id: string,
|
|
1752
|
+
player_id: string,
|
|
1753
|
+
link_type: 'twitter' | 'rss_podcast' | 'rss_article' | 'custom' | 'linked_in',
|
|
1754
|
+
link_full:string,
|
|
1755
|
+
link_display:string,
|
|
1756
|
+
link?:LinkProps,
|
|
1757
|
+
create_datetime:any,
|
|
1758
|
+
last_update_datetime:any,
|
|
1759
|
+
link_status:'active'|'pending'|'inactive',
|
|
1760
|
+
last_feed_pull_datetime?:any
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
export interface PlayerFollowerStatsProps {
|
|
1764
|
+
player_id:string,
|
|
1765
|
+
following_count: number,
|
|
1766
|
+
follower_count:number,
|
|
1767
|
+
team_member_count:number
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
|
|
1771
|
+
|
|
1772
|
+
export interface PlayerTagProps {
|
|
1773
|
+
player_tag_id:string,
|
|
1774
|
+
player_id:string,
|
|
1775
|
+
tag_id:string,
|
|
1776
|
+
tag: string,
|
|
1777
|
+
tag_type:'selected'|'earned'|'company',
|
|
1778
|
+
company_id?:string,
|
|
1779
|
+
status: string,
|
|
1780
|
+
companyDetails?:PublicPlayerProps,
|
|
1781
|
+
create_datetime: any,
|
|
1782
|
+
last_update_datetime:any
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
interface EntityMapProps {
|
|
1786
|
+
value: {
|
|
1787
|
+
type: string,
|
|
1788
|
+
mutability:string,
|
|
1789
|
+
data: any
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
export interface RawDraftJSProps {
|
|
1793
|
+
blocks:any[],
|
|
1794
|
+
entityMap:EntityMapProps
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
export interface PostProps {
|
|
1798
|
+
memo_post_id:string,
|
|
1799
|
+
player_id:string,
|
|
1800
|
+
title:string,
|
|
1801
|
+
body:string,
|
|
1802
|
+
formatted_body?: RawDraftJSProps,
|
|
1803
|
+
status:'active'|'hidden',
|
|
1804
|
+
memo_events:any[],
|
|
1805
|
+
memo_urls:string[],
|
|
1806
|
+
post_type:string,
|
|
1807
|
+
memo_podcast_episodes?:string[],
|
|
1808
|
+
featured?:boolean,
|
|
1809
|
+
memo_podcasts?:string[],
|
|
1810
|
+
memo_article_feeds?:string[],
|
|
1811
|
+
memo_teams:any[],
|
|
1812
|
+
memo_images:any[],
|
|
1813
|
+
memo_videos:any[],
|
|
1814
|
+
memo_players:any[],
|
|
1815
|
+
memo_topics:TagProps[],
|
|
1816
|
+
edited:boolean,
|
|
1817
|
+
external_social_id:string,
|
|
1818
|
+
memo_location:any,
|
|
1819
|
+
memo_positions:any[],
|
|
1820
|
+
memo_orders:any[],
|
|
1821
|
+
memo_hashtags:string[],
|
|
1822
|
+
create_datetime:any,
|
|
1823
|
+
last_update_datetime:any,
|
|
1824
|
+
url_metadata:URLMetadataProps[],
|
|
1825
|
+
url_preview:any,
|
|
1826
|
+
memo_competitions:any[],
|
|
1827
|
+
my_reactions:PostReactionProps[],
|
|
1828
|
+
comment_count:number,
|
|
1829
|
+
reaction_details:PostReactionStatsProps[],
|
|
1830
|
+
comment_details:PostCommentProps[],
|
|
1831
|
+
playerDetails?:PublicPlayerProps,
|
|
1832
|
+
rss_link_id?:string,
|
|
1833
|
+
shared_post_id?:string,
|
|
1834
|
+
memo_polls?:string[],
|
|
1835
|
+
shared_post_type?:string,
|
|
1836
|
+
shared_post?:PostProps,
|
|
1837
|
+
memo_podcast?:PodcastProps,
|
|
1838
|
+
memo_articles?:string[]
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
|
|
1842
|
+
export interface URLMetadataProps {
|
|
1843
|
+
charset:string,
|
|
1844
|
+
ogDescription:string,
|
|
1845
|
+
ogImage: {
|
|
1846
|
+
height:string,
|
|
1847
|
+
type: string,
|
|
1848
|
+
url: string,
|
|
1849
|
+
width:string
|
|
1850
|
+
},
|
|
1851
|
+
ogLocale:string,
|
|
1852
|
+
ogSiteName: string,
|
|
1853
|
+
ogTitle:string,
|
|
1854
|
+
ogType:string,
|
|
1855
|
+
ogUrl:string,
|
|
1856
|
+
requestUrl:string,
|
|
1857
|
+
success:boolean,
|
|
1858
|
+
twitterCard:string,
|
|
1859
|
+
twitterDescription: string,
|
|
1860
|
+
twitterImage?:{
|
|
1861
|
+
alt?:string,
|
|
1862
|
+
height?:string,
|
|
1863
|
+
url:string,
|
|
1864
|
+
width?:string
|
|
1865
|
+
},
|
|
1866
|
+
twitterTitle:string
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
|
|
1870
|
+
export interface PostReactionProps {
|
|
1871
|
+
post_reaction_id:string;
|
|
1872
|
+
activity_post_id:string;
|
|
1873
|
+
player_id:string;
|
|
1874
|
+
reaction:string;
|
|
1875
|
+
status:'visible'|'hidden';
|
|
1876
|
+
post_type: 'memo' | 'activity' | 'comment';
|
|
1877
|
+
create_datetime:any;
|
|
1878
|
+
last_update_datetime:any;
|
|
1879
|
+
playerDetails?:PublicPlayerProps;
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
export interface PostReactionStatsProps {
|
|
1883
|
+
activity_post_id:string,
|
|
1884
|
+
reaction: string,
|
|
1885
|
+
reaction_count:number
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
export interface PostCommentProps {
|
|
1889
|
+
post_comment_id:string,
|
|
1890
|
+
activity_post_id:string,
|
|
1891
|
+
player_id:string,
|
|
1892
|
+
message:string,
|
|
1893
|
+
status:'active'|'hidden',
|
|
1894
|
+
edited:boolean,
|
|
1895
|
+
post_type: 'memo' | 'activity',
|
|
1896
|
+
related_comment_id:string,
|
|
1897
|
+
create_datetime:any,
|
|
1898
|
+
last_update_datetime:any,
|
|
1899
|
+
playerDetails?:PublicPlayerProps,
|
|
1900
|
+
formatted_body: RawDraftJSProps,
|
|
1901
|
+
my_reactions:PostReactionProps[],
|
|
1902
|
+
reaction_details:PostReactionStatsProps[],
|
|
1903
|
+
comment_orders?:string[],
|
|
1904
|
+
comment_urls?:string[],
|
|
1905
|
+
comment_images?:any[],
|
|
1906
|
+
comment_videos?:any[],
|
|
1907
|
+
url_metadata?:any[],
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
|
|
1911
|
+
export interface PostCommentStatProps {
|
|
1912
|
+
activity_post_id: string,
|
|
1913
|
+
comment_count: number,
|
|
1914
|
+
top_comment?: PostCommentProps
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
|
|
1918
|
+
export interface PodcastProps {
|
|
1919
|
+
podcast_id: string,
|
|
1920
|
+
company_id?: string,
|
|
1921
|
+
lead_email?:string,
|
|
1922
|
+
lead_contact_name?:string,
|
|
1923
|
+
secondary_contact?:string,
|
|
1924
|
+
last_episode_pull?:any,
|
|
1925
|
+
title: string,
|
|
1926
|
+
description: string,
|
|
1927
|
+
claim_status?:string,
|
|
1928
|
+
global_rank?:number,
|
|
1929
|
+
publisher_original?:string,
|
|
1930
|
+
publisher_highlighted?:string,
|
|
1931
|
+
website?:string,
|
|
1932
|
+
listen_notes_score?:number,
|
|
1933
|
+
listen_notes_id?:string,
|
|
1934
|
+
image_override?:any
|
|
1935
|
+
description_override?:string,
|
|
1936
|
+
suggested_text?:string,
|
|
1937
|
+
key_words?:string[];
|
|
1938
|
+
player_ids?: string[];
|
|
1939
|
+
image?: any,
|
|
1940
|
+
rss_url?: string,
|
|
1941
|
+
status: string,
|
|
1942
|
+
create_datetime:any,
|
|
1943
|
+
last_update_datetime:any
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
|
|
1947
|
+
export interface PodcastEpisodesProps {
|
|
1948
|
+
podcast_episode_id:string,
|
|
1949
|
+
podcast_id:string,
|
|
1950
|
+
url:string,
|
|
1951
|
+
length:string | number,
|
|
1952
|
+
type: string,
|
|
1953
|
+
author?:string,
|
|
1954
|
+
description?:string,
|
|
1955
|
+
image?: {
|
|
1956
|
+
url:string,
|
|
1957
|
+
height?:number,
|
|
1958
|
+
width?:number
|
|
1959
|
+
},
|
|
1960
|
+
image_override?:any,
|
|
1961
|
+
description_override?:string,
|
|
1962
|
+
explicit?:boolean,
|
|
1963
|
+
episode?:string,
|
|
1964
|
+
guid?:string,
|
|
1965
|
+
title:string,
|
|
1966
|
+
external_link?:string,
|
|
1967
|
+
publish_date:any,
|
|
1968
|
+
status: 'visible' | 'hidden',
|
|
1969
|
+
create_datetime:any,
|
|
1970
|
+
last_update_datetime: any,
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
export interface ArticleProps {
|
|
1974
|
+
article_id:string,
|
|
1975
|
+
company_id:string,
|
|
1976
|
+
url:string,
|
|
1977
|
+
author?:string,
|
|
1978
|
+
contentSnippet?:string,
|
|
1979
|
+
image?: {
|
|
1980
|
+
url:string,
|
|
1981
|
+
width:string,
|
|
1982
|
+
height:string,
|
|
1983
|
+
type:string
|
|
1984
|
+
},
|
|
1985
|
+
guid?:string,
|
|
1986
|
+
title:string,
|
|
1987
|
+
pubDate:any,
|
|
1988
|
+
status: string
|
|
1989
|
+
}
|