be-components 2.3.5 → 2.3.8
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/Engage/components/CompanyCard.js +26 -2
- package/lib/commonjs/Engage/components/CompanyCard.js.map +1 -1
- package/lib/commonjs/Engage/components/EngageHeader.js +6 -2
- package/lib/commonjs/Engage/components/EngageHeader.js.map +1 -1
- package/lib/commonjs/Engage/index.js +6 -2
- package/lib/commonjs/Engage/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/OrderGradeBar.js +3 -3
- package/lib/commonjs/MarketComponents/components/OrderGradeBar.js.map +1 -1
- package/lib/commonjs/SocialComponents/ArticleCard.js +73 -0
- package/lib/commonjs/SocialComponents/ArticleCard.js.map +1 -0
- package/lib/commonjs/SocialComponents/CompanyProfile/api/index.js +175 -0
- package/lib/commonjs/SocialComponents/CompanyProfile/api/index.js.map +1 -0
- package/lib/commonjs/SocialComponents/CompanyProfile/index.js +592 -0
- package/lib/commonjs/SocialComponents/CompanyProfile/index.js.map +1 -0
- package/lib/commonjs/SocialComponents/PodcastCard.js +53 -0
- package/lib/commonjs/SocialComponents/PodcastCard.js.map +1 -0
- package/lib/commonjs/SocialComponents/PodcastEpisodeCard.js +63 -0
- package/lib/commonjs/SocialComponents/PodcastEpisodeCard.js.map +1 -0
- package/lib/commonjs/SocialComponents/PodcastModule/api/index.js +53 -0
- package/lib/commonjs/SocialComponents/PodcastModule/api/index.js.map +1 -0
- package/lib/commonjs/SocialComponents/PodcastModule/index.js +242 -0
- package/lib/commonjs/SocialComponents/PodcastModule/index.js.map +1 -0
- package/lib/commonjs/SocialComponents/api/index.js +23 -1
- package/lib/commonjs/SocialComponents/api/index.js.map +1 -1
- package/lib/commonjs/SocialComponents/index.js +14 -0
- package/lib/commonjs/SocialComponents/index.js.map +1 -1
- package/lib/module/Engage/components/CompanyCard.js +24 -2
- package/lib/module/Engage/components/CompanyCard.js.map +1 -1
- package/lib/module/Engage/components/EngageHeader.js +6 -2
- package/lib/module/Engage/components/EngageHeader.js.map +1 -1
- package/lib/module/Engage/index.js +6 -2
- package/lib/module/Engage/index.js.map +1 -1
- package/lib/module/MarketComponents/components/OrderGradeBar.js +3 -3
- package/lib/module/MarketComponents/components/OrderGradeBar.js.map +1 -1
- package/lib/module/SocialComponents/ArticleCard.js +66 -0
- package/lib/module/SocialComponents/ArticleCard.js.map +1 -0
- package/lib/module/SocialComponents/CompanyProfile/api/index.js +169 -0
- package/lib/module/SocialComponents/CompanyProfile/api/index.js.map +1 -0
- package/lib/module/SocialComponents/CompanyProfile/index.js +583 -0
- package/lib/module/SocialComponents/CompanyProfile/index.js.map +1 -0
- package/lib/module/SocialComponents/PodcastCard.js +46 -0
- package/lib/module/SocialComponents/PodcastCard.js.map +1 -0
- package/lib/module/SocialComponents/PodcastEpisodeCard.js +56 -0
- package/lib/module/SocialComponents/PodcastEpisodeCard.js.map +1 -0
- package/lib/module/SocialComponents/PodcastModule/api/index.js +47 -0
- package/lib/module/SocialComponents/PodcastModule/api/index.js.map +1 -0
- package/lib/module/SocialComponents/PodcastModule/index.js +233 -0
- package/lib/module/SocialComponents/PodcastModule/index.js.map +1 -0
- package/lib/module/SocialComponents/api/index.js +23 -1
- package/lib/module/SocialComponents/api/index.js.map +1 -1
- package/lib/module/SocialComponents/index.js +3 -1
- package/lib/module/SocialComponents/index.js.map +1 -1
- package/lib/typescript/src/Engage/components/CompanyCard.d.ts +4 -2
- package/lib/typescript/src/Engage/components/CompanyCard.d.ts.map +1 -1
- package/lib/typescript/src/Engage/components/EngageHeader.d.ts +4 -2
- package/lib/typescript/src/Engage/components/EngageHeader.d.ts.map +1 -1
- package/lib/typescript/src/Engage/index.d.ts +4 -2
- package/lib/typescript/src/Engage/index.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/ArticleCard.d.ts +12 -0
- package/lib/typescript/src/SocialComponents/ArticleCard.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/CompanyProfile/api/index.d.ts +34 -0
- package/lib/typescript/src/SocialComponents/CompanyProfile/api/index.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/CompanyProfile/index.d.ts +19 -0
- package/lib/typescript/src/SocialComponents/CompanyProfile/index.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/PodcastCard.d.ts +10 -0
- package/lib/typescript/src/SocialComponents/PodcastCard.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/PodcastEpisodeCard.d.ts +11 -0
- package/lib/typescript/src/SocialComponents/PodcastEpisodeCard.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/PodcastModule/api/index.d.ts +9 -0
- package/lib/typescript/src/SocialComponents/PodcastModule/api/index.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/PodcastModule/index.d.ts +14 -0
- package/lib/typescript/src/SocialComponents/PodcastModule/index.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/api/index.d.ts +6 -2
- package/lib/typescript/src/SocialComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/index.d.ts +3 -1
- package/lib/typescript/src/SocialComponents/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Engage/components/CompanyCard.tsx +27 -5
- package/src/Engage/components/EngageHeader.tsx +6 -2
- package/src/Engage/index.tsx +6 -2
- package/src/MarketComponents/components/OrderGradeBar.tsx +3 -3
- package/src/SocialComponents/ArticleCard.tsx +54 -0
- package/src/SocialComponents/CompanyProfile/api/index.ts +151 -0
- package/src/SocialComponents/CompanyProfile/index.tsx +438 -0
- package/src/SocialComponents/PodcastCard.tsx +31 -0
- package/src/SocialComponents/PodcastEpisodeCard.tsx +41 -0
- package/src/SocialComponents/PodcastModule/api/index.ts +44 -0
- package/src/SocialComponents/PodcastModule/index.tsx +161 -0
- package/src/SocialComponents/api/index.ts +18 -3
- package/src/SocialComponents/index.tsx +5 -2
- package/src/types.d.ts +99 -0
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { View, ActivityIndicator, Image, ScrollView, FlatList, TouchableOpacity } from 'react-native';
|
|
3
|
+
import type { ArticleFeedProps, ArticleProps, BEEventProps, BracketCompetitionProps, BracketProps, CompanyProps, CompetitionProps, CompetitionResultTypeProps, CompetitionTypeProps, EventProps, LeagueProps, PodcastProps, PublicPlayerProps, SquaresCompetitionProps } from '../../types';
|
|
4
|
+
import type { CompanyMemberProps } from '../../Authenticator/api/types';
|
|
5
|
+
import { CompanyProfileApi, CompanyProfileHelpers } from './api';
|
|
6
|
+
import Colors from '../../constants/colors';
|
|
7
|
+
import { Icons, Text } from '../../Components';
|
|
8
|
+
import { view_styles } from '../../constants/styles';
|
|
9
|
+
import PlayerCard from '../PlayerCard';
|
|
10
|
+
import CompetitionCard from '../../Engage/components/CompetitionCard';
|
|
11
|
+
import BracketCompetitionCard from '../../Engage/components/BracketCompetitionCard';
|
|
12
|
+
import SquaresCompetitionCard from '../../Engage/components/SquaresCompetitionCard';
|
|
13
|
+
import ArticleCard from '../ArticleCard';
|
|
14
|
+
import PodcastCard from '../PodcastCard';
|
|
15
|
+
import moment from 'moment-mini';
|
|
16
|
+
|
|
17
|
+
type CompanyProfileProps = {
|
|
18
|
+
company_id:string,
|
|
19
|
+
padding_insets?:{ top:number, bottom:number },
|
|
20
|
+
onSelectCompetition:(c:CompetitionProps) => void,
|
|
21
|
+
onSelectBracketCompetition:(bc:BracketCompetitionProps) => void,
|
|
22
|
+
onSelectSquaresCompetition:(sc:SquaresCompetitionProps) => void,
|
|
23
|
+
onArticleSelect:(article:ArticleProps) => void,
|
|
24
|
+
onEvent?:(be_event:BEEventProps) => void,
|
|
25
|
+
onSelectPodcast:(pod:PodcastProps) => void,
|
|
26
|
+
onBack?:() => void
|
|
27
|
+
}
|
|
28
|
+
const CompanyProfile = ({ company_id, padding_insets, onSelectCompetition, onSelectBracketCompetition, onSelectSquaresCompetition, onArticleSelect, onEvent, onSelectPodcast, onBack }:CompanyProfileProps) => {
|
|
29
|
+
const [ module_size, setModuleSize ] = useState({ height:700, width:300 });
|
|
30
|
+
const [ podcast_data, setPodcastData ] = useState<{
|
|
31
|
+
podcast_loading:boolean,
|
|
32
|
+
podcasts:PodcastProps[]
|
|
33
|
+
}>({
|
|
34
|
+
podcast_loading:false,
|
|
35
|
+
podcasts:[]
|
|
36
|
+
});
|
|
37
|
+
const { podcasts } = podcast_data;
|
|
38
|
+
|
|
39
|
+
const [ company_data, setCompanyData ] = useState<{
|
|
40
|
+
company_loading:boolean
|
|
41
|
+
active_toggle:string,
|
|
42
|
+
company?:CompanyProps,
|
|
43
|
+
company_members:CompanyMemberProps[],
|
|
44
|
+
players:PublicPlayerProps[]
|
|
45
|
+
}>({
|
|
46
|
+
company_loading: false,
|
|
47
|
+
company_members: [],
|
|
48
|
+
players:[],
|
|
49
|
+
active_toggle: 'Comps'
|
|
50
|
+
});
|
|
51
|
+
const { company_loading, company_members, company, players, active_toggle } = company_data;
|
|
52
|
+
|
|
53
|
+
const [ competition_data, setCompetitionData ] = useState<{
|
|
54
|
+
competition_loading:boolean,
|
|
55
|
+
competition_types:CompetitionTypeProps[],
|
|
56
|
+
leagues:LeagueProps[],
|
|
57
|
+
brackets:BracketProps[],
|
|
58
|
+
competition_result_types:CompetitionResultTypeProps[],
|
|
59
|
+
competitions:CompetitionProps[],
|
|
60
|
+
events:EventProps[],
|
|
61
|
+
bracket_competitions:BracketCompetitionProps[],
|
|
62
|
+
squares_competitions:SquaresCompetitionProps[],
|
|
63
|
+
offset:number
|
|
64
|
+
}>({
|
|
65
|
+
competition_loading: false,
|
|
66
|
+
offset: 0,
|
|
67
|
+
competitions:[],
|
|
68
|
+
leagues:[],
|
|
69
|
+
competition_types:[],
|
|
70
|
+
brackets: [],
|
|
71
|
+
events:[],
|
|
72
|
+
competition_result_types:[],
|
|
73
|
+
bracket_competitions:[],
|
|
74
|
+
squares_competitions: [],
|
|
75
|
+
})
|
|
76
|
+
const { competition_loading, competitions, bracket_competitions, brackets, squares_competitions, events, competition_result_types, competition_types, leagues } = competition_data;
|
|
77
|
+
const sorted_comps = CompanyProfileHelpers.sortComps(competitions, bracket_competitions, squares_competitions);
|
|
78
|
+
|
|
79
|
+
const [ feed_data, setFeedData ] = useState<{
|
|
80
|
+
feed_loading:boolean,
|
|
81
|
+
article_feeds:ArticleFeedProps[],
|
|
82
|
+
articles:ArticleProps[],
|
|
83
|
+
feed_offset:number
|
|
84
|
+
}>({
|
|
85
|
+
feed_loading: false,
|
|
86
|
+
article_feeds:[],
|
|
87
|
+
articles:[],
|
|
88
|
+
feed_offset:0
|
|
89
|
+
});
|
|
90
|
+
const { feed_loading, article_feeds, articles } = feed_data;
|
|
91
|
+
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
CompanyProfileApi.setEnvironment();
|
|
94
|
+
if(!company_id){ return }
|
|
95
|
+
getCompanyDataFromServer(company_id);
|
|
96
|
+
getPodcastsFromServer(company_id, 0);
|
|
97
|
+
},[company_id]);
|
|
98
|
+
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
switch(active_toggle){
|
|
101
|
+
case 'Comps':
|
|
102
|
+
getCompsFromServer(company_id, 0);
|
|
103
|
+
return
|
|
104
|
+
case 'Feeds':
|
|
105
|
+
getFeedFromServer(company_id, 0);
|
|
106
|
+
return
|
|
107
|
+
default: return
|
|
108
|
+
}
|
|
109
|
+
},[active_toggle]);
|
|
110
|
+
|
|
111
|
+
const getPodcastsFromServer = async(id:string, offset:number) => {
|
|
112
|
+
setPodcastData({ ...podcast_data, podcast_loading:true });
|
|
113
|
+
const ps = await CompanyProfileApi.getPodcastsByCompanyId(id, offset);
|
|
114
|
+
setPodcastData({
|
|
115
|
+
...podcast_data,
|
|
116
|
+
podcast_loading: false,
|
|
117
|
+
podcasts: ps
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const getFeedFromServer = async(id:string, offset:number) => {
|
|
122
|
+
setFeedData({ ...feed_data, feed_loading:true });
|
|
123
|
+
const feeds = await CompanyProfileApi.getArticleFeedsByCompanyId(id);
|
|
124
|
+
const arts = await CompanyProfileApi.getArticlesByCompanyId(id, offset);
|
|
125
|
+
setFeedData({
|
|
126
|
+
...feed_data,
|
|
127
|
+
feed_loading: false,
|
|
128
|
+
article_feeds: feeds,
|
|
129
|
+
articles: arts,
|
|
130
|
+
feed_offset:offset
|
|
131
|
+
})
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const getCompsFromServer = async(id:string, offset:number) => {
|
|
135
|
+
setCompetitionData({ ...competition_data, competition_loading: true });
|
|
136
|
+
const comps = await CompanyProfileApi.getCompetitionsByCompanyId(id, offset, 'active');
|
|
137
|
+
const bcs = await CompanyProfileApi.getBracketCompetitionsByCompanyId(id, offset, 'active');
|
|
138
|
+
const scs = await CompanyProfileApi.getSquaresCompsByCompanyId(id, 'active');
|
|
139
|
+
const opts = await CompanyProfileApi.getCompetitionOptions();
|
|
140
|
+
const lgs = await CompanyProfileApi.getLeagues();
|
|
141
|
+
if(!opts){ return alert('Unable to get competition details') }
|
|
142
|
+
const bks = await CompanyProfileApi.getBracketsByIds(bcs.map(bc => bc.bracket_id));
|
|
143
|
+
const es = await CompanyProfileApi.getEventsByEventIds(scs.map(sc => sc.event_id));
|
|
144
|
+
setCompetitionData({
|
|
145
|
+
...competition_data,
|
|
146
|
+
competition_loading: false,
|
|
147
|
+
competitions:comps.filter(c => !c.invite_only),
|
|
148
|
+
bracket_competitions: bcs,
|
|
149
|
+
squares_competitions: scs,
|
|
150
|
+
leagues:lgs,
|
|
151
|
+
brackets: bks,
|
|
152
|
+
competition_result_types: opts.competition_result_types,
|
|
153
|
+
events: es,
|
|
154
|
+
competition_types: opts.competition_types,
|
|
155
|
+
offset
|
|
156
|
+
})
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const getCompanyDataFromServer = async(id:string) => {
|
|
160
|
+
if(onEvent){
|
|
161
|
+
onEvent({
|
|
162
|
+
event_name:'company_view',
|
|
163
|
+
event_data: {
|
|
164
|
+
company_id:id,
|
|
165
|
+
view_type:'profile',
|
|
166
|
+
view_location: 'profile'
|
|
167
|
+
},
|
|
168
|
+
level:2
|
|
169
|
+
})
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
setCompanyData({ ...company_data, company_loading:true });
|
|
173
|
+
const c_resp = await CompanyProfileApi.getCompanyById(id);
|
|
174
|
+
if(!c_resp){ return alert('Unable to get company details. Please try again later') }
|
|
175
|
+
let ps = await CompanyProfileApi.getPlayersByPlayerIds(c_resp.company_members.map(cm => cm.player_id))
|
|
176
|
+
setCompanyData({
|
|
177
|
+
...company_data,
|
|
178
|
+
company_loading:false,
|
|
179
|
+
company: c_resp.company,
|
|
180
|
+
company_members: c_resp.company_members,
|
|
181
|
+
players: ps,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const renderMembers = (data: { item:CompanyMemberProps, index:number }) => {
|
|
186
|
+
const player = players.find(p => p.player_id == data.item.player_id);
|
|
187
|
+
if(!player){ return <></> }
|
|
188
|
+
return (
|
|
189
|
+
<View style={{ padding:4 }}>
|
|
190
|
+
<PlayerCard
|
|
191
|
+
player={player}
|
|
192
|
+
width={120}
|
|
193
|
+
border
|
|
194
|
+
alignment='vertical'
|
|
195
|
+
onSelectPlayer={(p) => console.log(p)}
|
|
196
|
+
onFollowingUpdate={(pf) => console.log(pf)}
|
|
197
|
+
/>
|
|
198
|
+
</View>
|
|
199
|
+
)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const renderArticles = (data:{ item:ArticleProps, index:number }) => {
|
|
203
|
+
const article_feed = article_feeds.find(af => af.article_feed_id == data.item.article_feed_id);
|
|
204
|
+
let article_width = (module_size.width - 60) / 2
|
|
205
|
+
if(article_width > 240){ article_width = 240 }
|
|
206
|
+
return (
|
|
207
|
+
<View style={{ width:article_width, margin:5 }}>
|
|
208
|
+
<ArticleCard
|
|
209
|
+
article_feed={article_feed}
|
|
210
|
+
article={data.item}
|
|
211
|
+
width={article_width}
|
|
212
|
+
onSelectArticle={onArticleSelect}
|
|
213
|
+
onEvent={onEvent}
|
|
214
|
+
/>
|
|
215
|
+
</View>
|
|
216
|
+
)
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const renderPodcasts = (data: { item:PodcastProps }) => {
|
|
220
|
+
let pod_width = (module_size.width) / 3
|
|
221
|
+
if(pod_width > 200){ pod_width = 200 }
|
|
222
|
+
return (
|
|
223
|
+
<View style={{ }}>
|
|
224
|
+
<PodcastCard
|
|
225
|
+
podcast={data.item}
|
|
226
|
+
width={pod_width}
|
|
227
|
+
onSelectPodcast={onSelectPodcast}
|
|
228
|
+
|
|
229
|
+
/>
|
|
230
|
+
</View>
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const renderToggles = (data:{ item:string, index:number }) => {
|
|
235
|
+
const active = data.item == active_toggle ? true : false
|
|
236
|
+
return (
|
|
237
|
+
<TouchableOpacity style={{ width: (module_size.width - 65) / 2, padding:15, borderRadius:22, backgroundColor:active?Colors.brand.midnight:'transparent' }}
|
|
238
|
+
onPress={() => setCompanyData({ ...company_data, active_toggle: data.item })}>
|
|
239
|
+
<Text textAlign='center' weight='bold' size={14} color={active ?Colors.shades.white:Colors.brand.midnight}>{data.item}</Text>
|
|
240
|
+
</TouchableOpacity>
|
|
241
|
+
)
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const renderComps = (data: { item:{ type: 'competition'|'squares_competition'|'bracket_competition', id:string, start_time:any }, index:number }) => {
|
|
245
|
+
switch(data.item.type){
|
|
246
|
+
case 'competition':
|
|
247
|
+
const competition = competitions.find(c => c.competition_id == data.item.id);
|
|
248
|
+
if(!competition){ return <></> }
|
|
249
|
+
const competition_type = competition_types.find(ct => ct.competition_type_id == competition.competition_type_id);
|
|
250
|
+
if(!competition_type){ return <></> }
|
|
251
|
+
const competition_result_type = competition_result_types.find(ct => ct.competition_result_type_id == competition.competition_result_type_id);
|
|
252
|
+
if(!competition_result_type){ return <></> }
|
|
253
|
+
return (
|
|
254
|
+
<CompetitionCard
|
|
255
|
+
competition={competition}
|
|
256
|
+
company={company}
|
|
257
|
+
competition_type={competition_type}
|
|
258
|
+
competition_result_type={competition_result_type}
|
|
259
|
+
onCompetitionSelect={onSelectCompetition}
|
|
260
|
+
|
|
261
|
+
/>
|
|
262
|
+
)
|
|
263
|
+
case 'bracket_competition':
|
|
264
|
+
const bracket_competition = bracket_competitions.find(bc => bc.bracket_competition_id == data.item.id);
|
|
265
|
+
if(!bracket_competition){ return <></> }
|
|
266
|
+
const crt = competition_result_types.find(ct => ct.competition_result_type_id == bracket_competition.competition_result_type_id);
|
|
267
|
+
if(!crt){ return <></> }
|
|
268
|
+
const bracket = brackets.find(b => b.bracket_id == bracket_competition.bracket_id);
|
|
269
|
+
const league = leagues.find(l => l.league_id == bracket?.league_id);
|
|
270
|
+
return (
|
|
271
|
+
<BracketCompetitionCard
|
|
272
|
+
bracket_competition={bracket_competition}
|
|
273
|
+
competition_result_type={crt}
|
|
274
|
+
company={company}
|
|
275
|
+
bracket={bracket}
|
|
276
|
+
league={league}
|
|
277
|
+
onCompetitionSelect={onSelectBracketCompetition}
|
|
278
|
+
/>
|
|
279
|
+
)
|
|
280
|
+
case 'squares_competition':
|
|
281
|
+
const squares_competition = squares_competitions.find(sc => sc.sq_comp_id == data.item.id);
|
|
282
|
+
if(!squares_competition){ return <></> }
|
|
283
|
+
const event = events.find(e => e.event_id == squares_competition.event_id);
|
|
284
|
+
return (
|
|
285
|
+
<SquaresCompetitionCard
|
|
286
|
+
squares_competition={squares_competition}
|
|
287
|
+
onSelectCompetition={onSelectSquaresCompetition}
|
|
288
|
+
company={company}
|
|
289
|
+
event={event}
|
|
290
|
+
/>
|
|
291
|
+
)
|
|
292
|
+
default: return <></>
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if(company_loading || !company){
|
|
297
|
+
return (
|
|
298
|
+
<View style={{ flex:1 }}>
|
|
299
|
+
<ActivityIndicator style={{ padding:20, alignSelf:'center' }} size='large' color={Colors.brand.midnight} />
|
|
300
|
+
</View>
|
|
301
|
+
)
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
return (
|
|
305
|
+
<View style={{ flex:1 }}>
|
|
306
|
+
<View style={{ flex:1, backgroundColor:Colors.shades.black_faded }} onLayout={(ev) => {
|
|
307
|
+
const { height, width } = ev.nativeEvent.layout
|
|
308
|
+
setModuleSize({ width, height });
|
|
309
|
+
}}>
|
|
310
|
+
<View style={{ position:'absolute', top:0, left:0, right:0, alignItems:'center' }} nativeID='profile_image'>
|
|
311
|
+
<Image
|
|
312
|
+
source={{ uri: company.company_image?.url }}
|
|
313
|
+
style={{ width: module_size.width, height: module_size.width, borderBottomRightRadius:50, borderBottomLeftRadius:50 }}
|
|
314
|
+
resizeMode='cover'
|
|
315
|
+
/>
|
|
316
|
+
</View>
|
|
317
|
+
<ScrollView style={{ flex:1 }}>
|
|
318
|
+
<View style={{ ...view_styles.section, marginTop:module_size.width - 150 }}>
|
|
319
|
+
<View style={{ ...view_styles.section_header }}>
|
|
320
|
+
<View style={{ flex:1, marginRight:10 }}>
|
|
321
|
+
<Text theme='header'>{company.company_name}</Text>
|
|
322
|
+
<Text style={{ marginTop:4 }} theme='body_2'>{company.company_description}</Text>
|
|
323
|
+
</View>
|
|
324
|
+
<View style={{ backgroundColor:Colors.highlights.highlight500, padding:10, borderRadius:22 }}>
|
|
325
|
+
<Text size={10} weight='bold' color={Colors.shades.white} textAlign='center'>{company.type.toUpperCase()}</Text>
|
|
326
|
+
</View>
|
|
327
|
+
</View>
|
|
328
|
+
</View>
|
|
329
|
+
<View style={{ ...view_styles.section }}>
|
|
330
|
+
<View style={{ ...view_styles.section_header }}>
|
|
331
|
+
<View style={{ flex:1 }}>
|
|
332
|
+
<Text theme='header'>Company Members</Text>
|
|
333
|
+
<Text style={{ marginTop:3 }} theme='body_2'>The following are members of {company.company_name}</Text>
|
|
334
|
+
</View>
|
|
335
|
+
<View style={{ padding:10 }}>
|
|
336
|
+
<Text theme='header_2'>{company_members.length}</Text>
|
|
337
|
+
</View>
|
|
338
|
+
</View>
|
|
339
|
+
<View style={view_styles.section_body}>
|
|
340
|
+
<View style={{ ...view_styles.body_row }}>
|
|
341
|
+
<View style={{ flex:1 }}>
|
|
342
|
+
<FlatList
|
|
343
|
+
key='company_members'
|
|
344
|
+
horizontal
|
|
345
|
+
showsHorizontalScrollIndicator={false}
|
|
346
|
+
data={company_members}
|
|
347
|
+
renderItem={renderMembers}
|
|
348
|
+
keyExtractor={(item) => item.player_id.toString()}
|
|
349
|
+
/>
|
|
350
|
+
</View>
|
|
351
|
+
</View>
|
|
352
|
+
</View>
|
|
353
|
+
</View>
|
|
354
|
+
{podcasts.length > 0 ?
|
|
355
|
+
<View style={{ ...view_styles.section }}>
|
|
356
|
+
<View style={{ ...view_styles.section_header }}>
|
|
357
|
+
<View style={{ flex:1 }}>
|
|
358
|
+
<Text theme='header'>Podcasts</Text>
|
|
359
|
+
<Text style={{ marginTop:3 }} theme='body_2'>The following are podcasts hosted by {company.company_name}</Text>
|
|
360
|
+
</View>
|
|
361
|
+
<View style={{ padding:10 }}>
|
|
362
|
+
<Text theme='header_2'>{podcasts.length}</Text>
|
|
363
|
+
</View>
|
|
364
|
+
</View>
|
|
365
|
+
<View style={{ ...view_styles.section_body, padding:0 }}>
|
|
366
|
+
<View style={{ ...view_styles.body_row }}>
|
|
367
|
+
<View style={{ flex:1 }}>
|
|
368
|
+
<FlatList
|
|
369
|
+
key='company_pods'
|
|
370
|
+
horizontal
|
|
371
|
+
showsHorizontalScrollIndicator={false}
|
|
372
|
+
data={podcasts}
|
|
373
|
+
renderItem={renderPodcasts}
|
|
374
|
+
keyExtractor={(item) => item.podcast_id.toString()}
|
|
375
|
+
/>
|
|
376
|
+
</View>
|
|
377
|
+
</View>
|
|
378
|
+
</View>
|
|
379
|
+
</View>
|
|
380
|
+
:<></>}
|
|
381
|
+
<View style={{ ...view_styles.section }}>
|
|
382
|
+
<View style={{ ...view_styles.section_header }}>
|
|
383
|
+
<View style={{ flex:1 }}>
|
|
384
|
+
<Text theme='header'>Engage</Text>
|
|
385
|
+
<Text style={{ marginTop:3 }} theme='body_2'>Use the toggles below to see recent activity from {company.company_name}</Text>
|
|
386
|
+
</View>
|
|
387
|
+
</View>
|
|
388
|
+
<View style={{ ...view_styles.section_body, padding:0 }}>
|
|
389
|
+
<View style={{ ...view_styles.body_row, margin:10, marginLeft:20, marginRight:20, borderRadius:22, padding:1, backgroundColor:Colors.shades.shade100 }}>
|
|
390
|
+
<FlatList
|
|
391
|
+
key={'toggles'}
|
|
392
|
+
horizontal
|
|
393
|
+
showsHorizontalScrollIndicator={false}
|
|
394
|
+
data={['Comps', 'Feeds']}
|
|
395
|
+
renderItem={renderToggles}
|
|
396
|
+
keyExtractor={(item) => item}
|
|
397
|
+
/>
|
|
398
|
+
</View>
|
|
399
|
+
{active_toggle == 'Comps' ?
|
|
400
|
+
<View>
|
|
401
|
+
{competition_loading ?
|
|
402
|
+
<ActivityIndicator size='large' color={Colors.brand.midnight} style={{ padding:20, alignSelf:'center' }} />
|
|
403
|
+
:<></>}
|
|
404
|
+
<FlatList
|
|
405
|
+
key={'comps_list'}
|
|
406
|
+
data={sorted_comps.sort((a,b) => a.start_time.unix() - b.start_time.unix())}
|
|
407
|
+
renderItem={renderComps}
|
|
408
|
+
keyExtractor={(item) => `${item.id}:${item.type}`}
|
|
409
|
+
/>
|
|
410
|
+
</View>
|
|
411
|
+
:active_toggle == 'Feeds' ?
|
|
412
|
+
<View>
|
|
413
|
+
{feed_loading ?
|
|
414
|
+
<ActivityIndicator size='large' color={Colors.brand.midnight} style={{ padding:20, alignSelf:'center' }} />
|
|
415
|
+
:<></>}
|
|
416
|
+
<View style={{ flexDirection:'row', flexWrap:'wrap' }}>
|
|
417
|
+
{articles.sort((a,b) => moment(b.create_datetime).unix() - moment(a.create_datetime).unix()).map((a,i) => {
|
|
418
|
+
return renderArticles({ item: a, index:i })
|
|
419
|
+
})}
|
|
420
|
+
</View>
|
|
421
|
+
</View>
|
|
422
|
+
:<></>}
|
|
423
|
+
</View>
|
|
424
|
+
</View>
|
|
425
|
+
</ScrollView>
|
|
426
|
+
{onBack ?
|
|
427
|
+
<TouchableOpacity
|
|
428
|
+
style={{ position:'absolute', top:padding_insets?.top ?? 0, left:0, ...view_styles.section, backgroundColor:Colors.shades.shade100, height:50, width:50, borderRadius:100, justifyContent:'center', alignItems:'center' }}
|
|
429
|
+
onPress={() => onBack()}>
|
|
430
|
+
<Icons.ChevronIcon direction='left' color={Colors.brand.midnight} size={14} />
|
|
431
|
+
</TouchableOpacity>
|
|
432
|
+
:<></>}
|
|
433
|
+
</View>
|
|
434
|
+
</View>
|
|
435
|
+
)
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
export default CompanyProfile
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Image, TouchableOpacity } from 'react-native';
|
|
3
|
+
import type { PodcastProps } from '../types';
|
|
4
|
+
import { view_styles } from '../constants/styles';
|
|
5
|
+
import { Text } from '../Components';
|
|
6
|
+
import { SocialPodcastHelpers } from './api';
|
|
7
|
+
import moment from 'moment-mini';
|
|
8
|
+
|
|
9
|
+
type PodcastCardType = {
|
|
10
|
+
podcast:PodcastProps,
|
|
11
|
+
width:number,
|
|
12
|
+
onSelectPodcast:(podcast:PodcastProps) => void
|
|
13
|
+
}
|
|
14
|
+
const PodcastCard = ({ podcast, width, onSelectPodcast }:PodcastCardType) => {
|
|
15
|
+
return (
|
|
16
|
+
<TouchableOpacity style={{ ...view_styles.section, width, flex:1 }} onPress={() => onSelectPodcast(podcast)}>
|
|
17
|
+
<Image
|
|
18
|
+
source={{ uri: SocialPodcastHelpers.getPodcastImage(podcast) }}
|
|
19
|
+
style={{ width:width, height:width*0.666, borderTopRightRadius:8, borderTopLeftRadius:8 }}
|
|
20
|
+
resizeMode='cover'
|
|
21
|
+
/>
|
|
22
|
+
<View style={{ padding:10, flex:1 }}>
|
|
23
|
+
<Text theme='header_2'>{podcast.title}</Text>
|
|
24
|
+
</View>
|
|
25
|
+
<View style={{ ...view_styles.section_footer }}>
|
|
26
|
+
<Text theme='body'>{moment(podcast.last_update_datetime).fromNow()}</Text>
|
|
27
|
+
</View>
|
|
28
|
+
</TouchableOpacity>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
export default PodcastCard
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Image, View, TouchableOpacity } from 'react-native';
|
|
3
|
+
import { view_styles } from "../constants/styles";
|
|
4
|
+
import type { PodcastEpisodesProps, PodcastProps } from '../types';
|
|
5
|
+
import { Text } from '../Components';
|
|
6
|
+
import { SocialPodcastHelpers } from './api';
|
|
7
|
+
import Colors from '../constants/colors';
|
|
8
|
+
|
|
9
|
+
type PodcastEpisodeCardProps = {
|
|
10
|
+
podcast_episode:PodcastEpisodesProps
|
|
11
|
+
podcast?:PodcastProps,
|
|
12
|
+
width:number,
|
|
13
|
+
onSelectEpisode:(pe:PodcastEpisodesProps) => void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const PodcastEpisodeCard = ({ width, podcast_episode, podcast, onSelectEpisode }: PodcastEpisodeCardProps ) => {
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<TouchableOpacity style={{ ...view_styles.section, flex:1, width, borderWidth:1, borderColor:Colors.shades.shade600 }} onPress={() => onSelectEpisode(podcast_episode)}>
|
|
21
|
+
{podcast ?
|
|
22
|
+
<View style={{ ...view_styles.section_header }}>
|
|
23
|
+
<View style={{ flex:1 }}>
|
|
24
|
+
<Text theme='header'>{podcast.title}</Text>
|
|
25
|
+
</View>
|
|
26
|
+
</View>
|
|
27
|
+
:<></>}
|
|
28
|
+
<View style={{ ...view_styles.section_body, padding:0 }}>
|
|
29
|
+
<Image
|
|
30
|
+
source={{ uri: SocialPodcastHelpers.getEpisodeImage(podcast_episode) }}
|
|
31
|
+
style={{ width: width, height: width * 0.666, borderTopRightRadius:podcast?0:8, borderTopLeftRadius:podcast?0:8 }}
|
|
32
|
+
/>
|
|
33
|
+
<View style={{ padding:10 }}>
|
|
34
|
+
<Text theme='header_2'>{podcast_episode.title}</Text>
|
|
35
|
+
</View>
|
|
36
|
+
</View>
|
|
37
|
+
</TouchableOpacity>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default PodcastEpisodeCard
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { APIOverrides } from "../../../ApiOverrides";
|
|
3
|
+
import type { PodcastEpisodesProps, PodcastProps, PublicPlayerProps } from "../../../types";
|
|
4
|
+
|
|
5
|
+
let SOCIAL_SVC_API = '';
|
|
6
|
+
let AUTH_SVC_API = '';
|
|
7
|
+
|
|
8
|
+
export { PodcastApi }
|
|
9
|
+
|
|
10
|
+
const PodcastApi = {
|
|
11
|
+
setEnvironment: () => {
|
|
12
|
+
const endpoints = APIOverrides.getEndpoints();
|
|
13
|
+
SOCIAL_SVC_API = endpoints['SOCIAL_SVC_API'] as string;
|
|
14
|
+
AUTH_SVC_API = endpoints['AUTH_SVC_API'] as string;
|
|
15
|
+
},
|
|
16
|
+
getPodcastById: async(podcast_id:string):Promise<PodcastProps | undefined> => {
|
|
17
|
+
try {
|
|
18
|
+
const resp = await axios.get(`${SOCIAL_SVC_API}/v1/podcasts/podcast/${podcast_id}`)
|
|
19
|
+
return resp.data.podcast
|
|
20
|
+
} catch (e) {
|
|
21
|
+
return undefined
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
getPodcastEpisodesByPodcast: async(podcast_id:string, offset:number):Promise<PodcastEpisodesProps[]> => {
|
|
25
|
+
try {
|
|
26
|
+
const resp = await axios.get(`${SOCIAL_SVC_API}/v1/podcasts/episodes/podcast/${podcast_id}?offset=${offset}`);
|
|
27
|
+
return resp.data.podcast_episodes
|
|
28
|
+
} catch (e) {
|
|
29
|
+
console.log(e);
|
|
30
|
+
return []
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
getPlayersByPlayerIds: async (player_ids?: string[]): Promise<PublicPlayerProps[]> => {
|
|
34
|
+
if(!player_ids){ return [] }
|
|
35
|
+
if (player_ids.length == 0) { return [] }
|
|
36
|
+
try {
|
|
37
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/players/bulk/get`, { player_ids })
|
|
38
|
+
return resp.data.players
|
|
39
|
+
} catch (e) {
|
|
40
|
+
console.log(e);
|
|
41
|
+
return []
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
}
|