be-components 2.1.3 → 2.1.5
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 +173 -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 +102 -0
- package/lib/commonjs/SocialComponents/PlayerProfile/components/PostsList.js.map +1 -0
- package/lib/commonjs/SocialComponents/PlayerProfile/index.js +565 -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/ImageList.js +51 -0
- package/lib/commonjs/SocialComponents/PostCard/components/ImageList.js.map +1 -0
- package/lib/commonjs/SocialComponents/PostCard/components/PostHeader.js +48 -0
- package/lib/commonjs/SocialComponents/PostCard/components/PostHeader.js.map +1 -0
- package/lib/commonjs/SocialComponents/PostCard/components/PostReactionBar.js +139 -0
- package/lib/commonjs/SocialComponents/PostCard/components/PostReactionBar.js.map +1 -0
- package/lib/commonjs/SocialComponents/PostCard/index.js +236 -0
- package/lib/commonjs/SocialComponents/PostCard/index.js.map +1 -0
- package/lib/commonjs/SocialComponents/SocialOrderCard.js +225 -0
- package/lib/commonjs/SocialComponents/SocialOrderCard.js.map +1 -0
- package/lib/commonjs/SocialComponents/SocialOrdersList.js +104 -0
- package/lib/commonjs/SocialComponents/SocialOrdersList.js.map +1 -0
- package/lib/commonjs/SocialComponents/api/index.js +292 -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 +173 -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 +94 -0
- package/lib/module/SocialComponents/PlayerProfile/components/PostsList.js.map +1 -0
- package/lib/module/SocialComponents/PlayerProfile/index.js +557 -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/ImageList.js +44 -0
- package/lib/module/SocialComponents/PostCard/components/ImageList.js.map +1 -0
- package/lib/module/SocialComponents/PostCard/components/PostHeader.js +41 -0
- package/lib/module/SocialComponents/PostCard/components/PostHeader.js.map +1 -0
- package/lib/module/SocialComponents/PostCard/components/PostReactionBar.js +130 -0
- package/lib/module/SocialComponents/PostCard/components/PostReactionBar.js.map +1 -0
- package/lib/module/SocialComponents/PostCard/index.js +227 -0
- package/lib/module/SocialComponents/PostCard/index.js.map +1 -0
- package/lib/module/SocialComponents/SocialOrderCard.js +216 -0
- package/lib/module/SocialComponents/SocialOrderCard.js.map +1 -0
- package/lib/module/SocialComponents/SocialOrdersList.js +95 -0
- package/lib/module/SocialComponents/SocialOrdersList.js.map +1 -0
- package/lib/module/SocialComponents/api/index.js +292 -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 +6 -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 +13 -0
- package/lib/typescript/src/SocialComponents/PlayerProfile/components/PostsList.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/PlayerProfile/index.d.ts +19 -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/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/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 +13 -0
- package/lib/typescript/src/SocialComponents/PostCard/components/PostReactionBar.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/PostCard/index.d.ts +15 -0
- package/lib/typescript/src/SocialComponents/PostCard/index.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/SocialOrderCard.d.ts +17 -0
- package/lib/typescript/src/SocialComponents/SocialOrderCard.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/SocialOrdersList.d.ts +13 -0
- package/lib/typescript/src/SocialComponents/SocialOrdersList.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/api/index.d.ts +34 -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 +93 -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 +100 -0
- package/src/SocialComponents/PlayerProfile/index.tsx +412 -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/ImageList.tsx +46 -0
- package/src/SocialComponents/PostCard/components/PostHeader.tsx +29 -0
- package/src/SocialComponents/PostCard/components/PostReactionBar.tsx +93 -0
- package/src/SocialComponents/PostCard/index.tsx +176 -0
- package/src/SocialComponents/SocialOrderCard.tsx +146 -0
- package/src/SocialComponents/SocialOrdersList.tsx +101 -0
- package/src/SocialComponents/api/index.ts +170 -3
- package/src/SocialComponents/index.tsx +3 -2
- package/src/types.d.ts +245 -0
|
@@ -15,31 +15,32 @@ type PlayerCardProps = {
|
|
|
15
15
|
player_following?:PlayerFollowerProps,
|
|
16
16
|
show_follow?:boolean,
|
|
17
17
|
style?:any,
|
|
18
|
+
border?:boolean,
|
|
18
19
|
float?:boolean,
|
|
19
20
|
onSelectPlayer:(p:PublicPlayerProps) => void,
|
|
20
21
|
onFollowingUpdate:(pf:PlayerFollowerProps) => void
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
const PlayerCard = ({ player, width, follow_loading, alignment, style, float, show_follow, player_follower, player_following, onSelectPlayer, onFollowingUpdate }:PlayerCardProps) => {
|
|
24
|
+
const PlayerCard = ({ player, width, border, follow_loading, alignment, style, float, show_follow, player_follower, player_following, onSelectPlayer, onFollowingUpdate }:PlayerCardProps) => {
|
|
24
25
|
|
|
25
26
|
let player_style = alignment == 'vertical' ? local_styles.player_vertical : local_styles.player_horizontal;
|
|
26
27
|
let container_style = { ...local_styles.container }
|
|
27
28
|
if(float){ container_style = { ...container_style, ...view_styles.float } }
|
|
28
29
|
return (
|
|
29
|
-
<View style={{ ...container_style, ...style, width }}>
|
|
30
|
+
<View style={{ ...container_style, ...style, width, borderWidth: border?1:0, borderColor:Colors.shades.shade600 }}>
|
|
30
31
|
<TouchableOpacity style={player_style} onPress={() => onSelectPlayer(player)}>
|
|
31
32
|
{alignment == 'vertical' ?
|
|
32
33
|
<View>
|
|
33
34
|
<Image
|
|
34
|
-
source={{ uri: player.profile_pic }}
|
|
35
|
+
source={{ uri: player.profile_pic && player.profile_pic != '' ? player.profile_pic : 'https://res.cloudinary.com/hoabts6mc/image/upload/v1722453927/default_man_n96ofq.webp' }}
|
|
35
36
|
style={{ height:width * 0.5, width:width, borderTopRightRadius:8, borderTopLeftRadius:8 }}
|
|
36
37
|
resizeMode='cover'
|
|
37
38
|
/>
|
|
38
39
|
</View>
|
|
39
40
|
:
|
|
40
|
-
<View
|
|
41
|
+
<View>
|
|
41
42
|
<Image
|
|
42
|
-
source={{ uri: player.profile_pic }}
|
|
43
|
+
source={{ uri: player.profile_pic && player.profile_pic != '' ? player.profile_pic : 'https://res.cloudinary.com/hoabts6mc/image/upload/v1722453927/default_man_n96ofq.webp' }}
|
|
43
44
|
style={{ height:55, width:55, borderTopLeftRadius:8, borderBottomLeftRadius:8}}
|
|
44
45
|
resizeMode='cover'
|
|
45
46
|
/>
|
|
@@ -31,7 +31,8 @@ const PlayerList = ({ players, style, options, onPlayerSelect }:PlayerListProps)
|
|
|
31
31
|
const getListData = async() => {
|
|
32
32
|
if(follow_status){
|
|
33
33
|
setFollowStatusLoading(true);
|
|
34
|
-
const player_followers = await SocialComponentApi.getBulkPlayerfollowers(players.map(p => p.player_id))
|
|
34
|
+
const player_followers = await SocialComponentApi.getBulkPlayerfollowers(players.map(p => p.player_id));
|
|
35
|
+
console.log(player_followers)
|
|
35
36
|
setPlayerFollowers(player_followers)
|
|
36
37
|
setFollowStatusLoading(false);
|
|
37
38
|
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { APIOverrides } from "../../../ApiOverrides";
|
|
3
|
+
import type { OrderProps, PlayerFollowerProps, PlayerFollowerStatsProps, PlayerLinkProps, PostCommentStatProps, PostProps, PostReactionProps, PublicPlayerProps } from "../../../types";
|
|
4
|
+
|
|
5
|
+
let SOCIAL_SVC_API = '';
|
|
6
|
+
let AUTH_SVC_API = '';
|
|
7
|
+
let MK_SVC_API = '';
|
|
8
|
+
|
|
9
|
+
export { SocialProfileApi }
|
|
10
|
+
|
|
11
|
+
const SocialProfileApi = {
|
|
12
|
+
setEnvironment: () => {
|
|
13
|
+
const endpoints = APIOverrides.getEndpoints();
|
|
14
|
+
SOCIAL_SVC_API = endpoints['SOCIAL_SVC_API'] as string;
|
|
15
|
+
AUTH_SVC_API = endpoints['AUTH_SVC_API'] as string;
|
|
16
|
+
MK_SVC_API = endpoints['MK_SVC_API'] as string;
|
|
17
|
+
},
|
|
18
|
+
getPlayerById: async(player_id:string):Promise<PublicPlayerProps | undefined> => {
|
|
19
|
+
try {
|
|
20
|
+
const resp = await axios.get(`${AUTH_SVC_API}/v1/players/player/${player_id}`);
|
|
21
|
+
return resp.data.player
|
|
22
|
+
} catch (e) {
|
|
23
|
+
console.log(e);
|
|
24
|
+
return undefined
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
getPlayerLinksByPlayerId: async(player_id:string):Promise<PlayerLinkProps[]> => {
|
|
28
|
+
try {
|
|
29
|
+
const resp = await axios.get(`${SOCIAL_SVC_API}/v1/links/player/${player_id}`);
|
|
30
|
+
return resp.data.player_links
|
|
31
|
+
} catch (e) {
|
|
32
|
+
console.log(e);
|
|
33
|
+
return []
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
getFollowerStats:async(player_id:string):Promise<PlayerFollowerStatsProps | undefined> => {
|
|
37
|
+
try {
|
|
38
|
+
const resp = await axios.get(`${SOCIAL_SVC_API}/v1/followers/stats/player/${player_id}`)
|
|
39
|
+
const { player_follower_stats } = resp.data;
|
|
40
|
+
return player_follower_stats
|
|
41
|
+
} catch (e) {
|
|
42
|
+
console.log(e)
|
|
43
|
+
return undefined
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
getFollowerStatus: async(player_id:string, following_id:string):Promise<PlayerFollowerProps | undefined> => {
|
|
47
|
+
try {
|
|
48
|
+
const resp = await axios.get(`${SOCIAL_SVC_API}/v1/followers/status?player_id=${player_id}&following_id=${following_id}`);
|
|
49
|
+
console.log(resp.data)
|
|
50
|
+
return resp.data.player_follower
|
|
51
|
+
} catch (e) {
|
|
52
|
+
console.log(e)
|
|
53
|
+
return undefined
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
getPostsByPlayerId: async(player_id:string, offset:number):Promise<PostProps[]> => {
|
|
57
|
+
try {
|
|
58
|
+
const resp = await axios.get(`${SOCIAL_SVC_API}/v1/posts/player/${player_id}?offset=${offset}`)
|
|
59
|
+
return resp.data.posts
|
|
60
|
+
} catch (e) {
|
|
61
|
+
console.log(e);
|
|
62
|
+
return []
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
getPlayerFollowersByPlayerId: async(player_id:string, status:'following'|'followers', offset:number):Promise<PlayerFollowerProps[]> => {
|
|
66
|
+
try {
|
|
67
|
+
const resp = await axios.get(`${SOCIAL_SVC_API}/v1/followers/player/${player_id}?status=${status}&offset=${offset}`)
|
|
68
|
+
console.log(resp.data);
|
|
69
|
+
return resp.data.player_followers
|
|
70
|
+
} catch (e) {
|
|
71
|
+
console.log(e);
|
|
72
|
+
return []
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
getCommentStatsByPostId: async(post_id:string, post_type:'memo'):Promise<PostCommentStatProps | undefined> => {
|
|
76
|
+
try {
|
|
77
|
+
const resp = await axios.get(`${SOCIAL_SVC_API}/v1/posts/comments/stats/post/${post_id}?post_type=${post_type}`)
|
|
78
|
+
console.log(resp.data)
|
|
79
|
+
return resp.data.post_comment_stat
|
|
80
|
+
} catch (e) {
|
|
81
|
+
return undefined
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
getReactionStatsByPostId: async(post_id:string, post_type:'memo') => {
|
|
85
|
+
try {
|
|
86
|
+
const resp = await axios.get(`${SOCIAL_SVC_API}/v1/posts/reactions/stats/post/${post_id}?post_type=${post_type}`)
|
|
87
|
+
return resp.data.post_reaction_stats
|
|
88
|
+
} catch (e) {
|
|
89
|
+
console.log(e)
|
|
90
|
+
return []
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
getReactionsByPostAndPlayer: async(player_id:string, post_id:string, post_type:'memo'):Promise<PostReactionProps[]> => {
|
|
94
|
+
try {
|
|
95
|
+
const resp = await axios.get(`${SOCIAL_SVC_API}/v1/posts/reactions/post/${post_id}?player_id=${player_id}&post_type=${post_type}`)
|
|
96
|
+
return resp.data.post_reactions
|
|
97
|
+
} catch (e) {
|
|
98
|
+
console.log(e);
|
|
99
|
+
return []
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
createPostReaction: async(post_reaction:PostReactionProps):Promise<PostReactionProps|undefined> => {
|
|
103
|
+
try {
|
|
104
|
+
const resp = await axios.post(`${SOCIAL_SVC_API}/v1/posts/reaction/create`, { post_reaction });
|
|
105
|
+
return resp.data.post_reaction
|
|
106
|
+
} catch (e) {
|
|
107
|
+
console.log(e);
|
|
108
|
+
return undefined
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
updatePostReaction : async(post_reaction:PostReactionProps):Promise<PostReactionProps|undefined> => {
|
|
112
|
+
try {
|
|
113
|
+
const resp = await axios.post(`${SOCIAL_SVC_API}/v1/posts/reaction/update`, { post_reaction })
|
|
114
|
+
return resp.data.post_reaction
|
|
115
|
+
} catch (e) {
|
|
116
|
+
console.log(e)
|
|
117
|
+
return undefined
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
getBulkOrders: async(order_ids:string[]):Promise<OrderProps[]> => {
|
|
121
|
+
try {
|
|
122
|
+
const resp = await axios.post(`${MK_SVC_API}/v1/orders/bulk/get`, { order_ids })
|
|
123
|
+
return resp.data.orders
|
|
124
|
+
} catch (e) {
|
|
125
|
+
console.log(e);
|
|
126
|
+
return []
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
getOrdersByPlayerId: async(player_id:string, offset:number):Promise<OrderProps[]> => {
|
|
130
|
+
try {
|
|
131
|
+
const resp = await axios.get(`${MK_SVC_API}/v1/orders/player/${player_id}?offset=${offset}`)
|
|
132
|
+
return resp.data.orders
|
|
133
|
+
} catch (e) {
|
|
134
|
+
console.log(e);
|
|
135
|
+
return []
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { View, ActivityIndicator, ScrollView, Image } from 'react-native';
|
|
3
|
+
import type { PlayerFollowerProps, PublicPlayerProps } from '../../../types';
|
|
4
|
+
import { SocialProfileApi } from '../api';
|
|
5
|
+
import Colors from '../../../constants/colors';
|
|
6
|
+
import { view_styles } from '../../../constants/styles';
|
|
7
|
+
import { Button, Text } from '../../../Components';
|
|
8
|
+
import PlayerList from '../../PlayerList';
|
|
9
|
+
|
|
10
|
+
type PlayerFollowersListProps = {
|
|
11
|
+
status: 'following'|'followers',
|
|
12
|
+
viewing_player:PublicPlayerProps,
|
|
13
|
+
total?:number,
|
|
14
|
+
player_id?:string,
|
|
15
|
+
height?:number,
|
|
16
|
+
onClose:() => void
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const PlayerFollowersList = ({ status, total, height, viewing_player, player_id, onClose }:PlayerFollowersListProps) => {
|
|
20
|
+
const [ list_data, setData ] = useState<{
|
|
21
|
+
loading:boolean,
|
|
22
|
+
player_followers:PlayerFollowerProps[],
|
|
23
|
+
offset:number
|
|
24
|
+
}>({
|
|
25
|
+
loading:false,
|
|
26
|
+
player_followers:[],
|
|
27
|
+
offset:0
|
|
28
|
+
});
|
|
29
|
+
const { loading, player_followers, offset } = list_data;
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
getDataFromServer(0);
|
|
33
|
+
},[]);
|
|
34
|
+
|
|
35
|
+
const getDataFromServer = async(offset:number) => {
|
|
36
|
+
if(loading){ return } //No mashy mashy
|
|
37
|
+
setData({ ...list_data, loading:true });
|
|
38
|
+
let pfs = await SocialProfileApi.getPlayerFollowersByPlayerId(viewing_player.player_id, status, offset);
|
|
39
|
+
setData({
|
|
40
|
+
...list_data,
|
|
41
|
+
loading:false,
|
|
42
|
+
player_followers:pfs,
|
|
43
|
+
offset
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<View style={{ height, ...view_styles.section }}>
|
|
50
|
+
<View style={{ ...view_styles.section_header }}>
|
|
51
|
+
<Image
|
|
52
|
+
source={{ uri: viewing_player.profile_pic && viewing_player.profile_pic != '' ? viewing_player.profile_pic : 'https://res.cloudinary.com/hoabts6mc/image/upload/v1722453927/default_man_n96ofq.webp' }}
|
|
53
|
+
style={{ width: 32, height: 32, borderRadius:100 }}
|
|
54
|
+
resizeMode='cover'
|
|
55
|
+
/>
|
|
56
|
+
<View style={{flex:1, marginLeft:10 }}>
|
|
57
|
+
<Text theme='header'>{status}</Text>
|
|
58
|
+
<Text style={{ marginTop:3 }} theme='body'>{status == 'followers' ? `@${viewing_player.username} Followers`: `Players @${viewing_player.username} is following`}</Text>
|
|
59
|
+
</View>
|
|
60
|
+
{total ?
|
|
61
|
+
<Text theme='header'>{total}</Text>
|
|
62
|
+
:<></>}
|
|
63
|
+
</View>
|
|
64
|
+
<ScrollView style={{ ...view_styles.section_body }}>
|
|
65
|
+
{loading ?
|
|
66
|
+
<ActivityIndicator
|
|
67
|
+
size={'large'}
|
|
68
|
+
color={Colors.brand.midnight}
|
|
69
|
+
style={{ padding:10, alignSelf:'center' }}
|
|
70
|
+
/>
|
|
71
|
+
:<></>}
|
|
72
|
+
<PlayerList
|
|
73
|
+
players={player_followers.map(pf => pf.playerDetails as PublicPlayerProps)}
|
|
74
|
+
onPlayerSelect={(p) => console.log(p)}
|
|
75
|
+
options={{
|
|
76
|
+
direction: 'horizontal',
|
|
77
|
+
follow_status: player_id?true:false
|
|
78
|
+
}}
|
|
79
|
+
/>
|
|
80
|
+
</ScrollView>
|
|
81
|
+
<View style={{ ...view_styles.section_footer }}>
|
|
82
|
+
{offset > 0 ?
|
|
83
|
+
<Button
|
|
84
|
+
title='PREV'
|
|
85
|
+
title_color={Colors.brand.electric}
|
|
86
|
+
backgroundColor='transparent'
|
|
87
|
+
onPress={() => getDataFromServer(offset - 1)}
|
|
88
|
+
/>
|
|
89
|
+
:<View/>}
|
|
90
|
+
<View style={{ flex:1 }} />
|
|
91
|
+
<Button
|
|
92
|
+
title='NEXT'
|
|
93
|
+
title_color={Colors.brand.electric}
|
|
94
|
+
backgroundColor='transparent'
|
|
95
|
+
onPress={() => getDataFromServer(offset + 1)}
|
|
96
|
+
/>
|
|
97
|
+
</View>
|
|
98
|
+
<View style={{ ...view_styles.section_footer }}>
|
|
99
|
+
<Button
|
|
100
|
+
style={{ flex:1 }}
|
|
101
|
+
title='CLOSE'
|
|
102
|
+
title_color={Colors.shades.white}
|
|
103
|
+
backgroundColor={Colors.utility.error}
|
|
104
|
+
onPress={() => onClose()}
|
|
105
|
+
/>
|
|
106
|
+
</View>
|
|
107
|
+
</View>
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export default PlayerFollowersList
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, FlatList, ActivityIndicator } from 'react-native';
|
|
3
|
+
import { useEffect, useState } from "react"
|
|
4
|
+
import type { OrderProps, PostProps, PublicPlayerProps } from "../../../types"
|
|
5
|
+
import { SocialProfileApi } from '../api';
|
|
6
|
+
import PostCard from '../../PostCard';
|
|
7
|
+
import Colors from '../../../constants/colors';
|
|
8
|
+
|
|
9
|
+
type PostsListProps = {
|
|
10
|
+
viewing_player:PublicPlayerProps,
|
|
11
|
+
player_id?:string,
|
|
12
|
+
onRequestAuthenticate:() => void,
|
|
13
|
+
onCopyOrder?:(order:OrderProps) => void,
|
|
14
|
+
onFadeOrder?:(order:OrderProps) => void,
|
|
15
|
+
onViewComments:(post_id:string) => void
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const PostsList = ({ viewing_player, player_id, onRequestAuthenticate, onCopyOrder, onFadeOrder, onViewComments}:PostsListProps) => {
|
|
19
|
+
const [ post_data, setPostData ] = useState<{
|
|
20
|
+
posts_loading:boolean,
|
|
21
|
+
posts:PostProps[],
|
|
22
|
+
orders:OrderProps[],
|
|
23
|
+
posts_offset:number
|
|
24
|
+
}>({
|
|
25
|
+
posts_loading: false,
|
|
26
|
+
posts:[],
|
|
27
|
+
orders:[],
|
|
28
|
+
posts_offset:0
|
|
29
|
+
});
|
|
30
|
+
const { posts_loading, posts, orders } = post_data;
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
getPostData(0);
|
|
34
|
+
},[]);
|
|
35
|
+
|
|
36
|
+
const getPostData = async(offset:number) => {
|
|
37
|
+
setPostData({ ...post_data, posts_loading:true });
|
|
38
|
+
let os:OrderProps[] = []
|
|
39
|
+
const ps = await SocialProfileApi.getPostsByPlayerId(viewing_player.player_id, offset);
|
|
40
|
+
|
|
41
|
+
//Now we need to get the data within the posts!
|
|
42
|
+
let order_ids:string[] = []
|
|
43
|
+
ps.map(p => {
|
|
44
|
+
if(p.memo_orders && p.memo_orders.length > 0){ order_ids = order_ids.concat(p.memo_orders) }
|
|
45
|
+
})
|
|
46
|
+
if(order_ids.length > 0){ os = await SocialProfileApi.getBulkOrders(order_ids) }
|
|
47
|
+
|
|
48
|
+
//Now we need to get all the event data from the
|
|
49
|
+
|
|
50
|
+
setPostData({
|
|
51
|
+
...post_data,
|
|
52
|
+
posts_loading:false,
|
|
53
|
+
posts: ps,
|
|
54
|
+
orders:os,
|
|
55
|
+
posts_offset: offset
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
const renderPosts = (data: { item:PostProps, index:number }) => {
|
|
61
|
+
const post_orders = data.item.memo_orders ? orders.filter(o => data.item.memo_orders.includes(o.order_id)) : []
|
|
62
|
+
return (
|
|
63
|
+
<View>
|
|
64
|
+
<PostCard
|
|
65
|
+
player={viewing_player}
|
|
66
|
+
orders={post_orders}
|
|
67
|
+
post={data.item}
|
|
68
|
+
player_id={player_id}
|
|
69
|
+
onCopyOrder={onCopyOrder}
|
|
70
|
+
onFadeOrder={onFadeOrder}
|
|
71
|
+
onViewComments={onViewComments}
|
|
72
|
+
onRequestAuthenticate={onRequestAuthenticate}
|
|
73
|
+
/>
|
|
74
|
+
</View>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<View>
|
|
81
|
+
<View>
|
|
82
|
+
{posts_loading ?
|
|
83
|
+
<ActivityIndicator size='large' color={Colors.brand.midnight} style={{ padding:10, alignSelf:'center' }} />
|
|
84
|
+
:<></>}
|
|
85
|
+
<FlatList
|
|
86
|
+
key={'player_posts'}
|
|
87
|
+
data={posts}
|
|
88
|
+
renderItem={renderPosts}
|
|
89
|
+
keyExtractor={(item) => item.memo_post_id?.toString()}
|
|
90
|
+
/>
|
|
91
|
+
</View>
|
|
92
|
+
</View>
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export default React.memo(PostsList, (left,right) => {
|
|
97
|
+
if(left.viewing_player?.player_id != right.viewing_player?.player_id){ return false }
|
|
98
|
+
if(left.player_id != right.player_id){ return false }
|
|
99
|
+
return true
|
|
100
|
+
})
|