be-components 4.3.3 → 4.3.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.
Files changed (47) hide show
  1. package/lib/commonjs/Components/Slider.js +2 -0
  2. package/lib/commonjs/Components/Slider.js.map +1 -1
  3. package/lib/commonjs/SocialComponents/AudioPlayer.js +116 -185
  4. package/lib/commonjs/SocialComponents/AudioPlayer.js.map +1 -1
  5. package/lib/commonjs/SocialComponents/PodcastEpisodeCard.js +40 -35
  6. package/lib/commonjs/SocialComponents/PodcastEpisodeCard.js.map +1 -1
  7. package/lib/commonjs/SocialComponents/PodcastModule/components/ClaimPodcastModal.js +51 -49
  8. package/lib/commonjs/SocialComponents/PodcastModule/components/ClaimPodcastModal.js.map +1 -1
  9. package/lib/commonjs/SocialComponents/PodcastModule/index.js +337 -335
  10. package/lib/commonjs/SocialComponents/PodcastModule/index.js.map +1 -1
  11. package/lib/module/Components/Slider.js +2 -0
  12. package/lib/module/Components/Slider.js.map +1 -1
  13. package/lib/module/SocialComponents/AudioPlayer.js +111 -180
  14. package/lib/module/SocialComponents/AudioPlayer.js.map +1 -1
  15. package/lib/module/SocialComponents/PodcastEpisodeCard.js +31 -26
  16. package/lib/module/SocialComponents/PodcastEpisodeCard.js.map +1 -1
  17. package/lib/module/SocialComponents/PodcastModule/components/ClaimPodcastModal.js +31 -28
  18. package/lib/module/SocialComponents/PodcastModule/components/ClaimPodcastModal.js.map +1 -1
  19. package/lib/module/SocialComponents/PodcastModule/index.js +336 -334
  20. package/lib/module/SocialComponents/PodcastModule/index.js.map +1 -1
  21. package/lib/typescript/lib/commonjs/Components/Slider.d.ts.map +1 -1
  22. package/lib/typescript/lib/commonjs/SocialComponents/AudioPlayer.d.ts +3 -1
  23. package/lib/typescript/lib/commonjs/SocialComponents/AudioPlayer.d.ts.map +1 -1
  24. package/lib/typescript/lib/commonjs/SocialComponents/PodcastEpisodeCard.d.ts.map +1 -1
  25. package/lib/typescript/lib/commonjs/SocialComponents/PodcastModule/components/ClaimPodcastModal.d.ts.map +1 -1
  26. package/lib/typescript/lib/commonjs/SocialComponents/PodcastModule/index.d.ts.map +1 -1
  27. package/lib/typescript/lib/module/Components/Slider.d.ts.map +1 -1
  28. package/lib/typescript/lib/module/SocialComponents/AudioPlayer.d.ts +4 -5
  29. package/lib/typescript/lib/module/SocialComponents/AudioPlayer.d.ts.map +1 -1
  30. package/lib/typescript/lib/module/SocialComponents/PodcastEpisodeCard.d.ts +1 -2
  31. package/lib/typescript/lib/module/SocialComponents/PodcastEpisodeCard.d.ts.map +1 -1
  32. package/lib/typescript/lib/module/SocialComponents/PodcastModule/components/ClaimPodcastModal.d.ts +1 -2
  33. package/lib/typescript/lib/module/SocialComponents/PodcastModule/components/ClaimPodcastModal.d.ts.map +1 -1
  34. package/lib/typescript/lib/module/SocialComponents/PodcastModule/index.d.ts +1 -2
  35. package/lib/typescript/lib/module/SocialComponents/PodcastModule/index.d.ts.map +1 -1
  36. package/lib/typescript/src/Components/Slider.d.ts.map +1 -1
  37. package/lib/typescript/src/SocialComponents/AudioPlayer.d.ts +8 -1
  38. package/lib/typescript/src/SocialComponents/AudioPlayer.d.ts.map +1 -1
  39. package/lib/typescript/src/SocialComponents/PodcastEpisodeCard.d.ts.map +1 -1
  40. package/lib/typescript/src/SocialComponents/PodcastModule/components/ClaimPodcastModal.d.ts.map +1 -1
  41. package/lib/typescript/src/SocialComponents/PodcastModule/index.d.ts.map +1 -1
  42. package/package.json +2 -2
  43. package/src/Components/Slider.tsx +2 -0
  44. package/src/SocialComponents/AudioPlayer.tsx +86 -172
  45. package/src/SocialComponents/PodcastEpisodeCard.tsx +23 -23
  46. package/src/SocialComponents/PodcastModule/components/ClaimPodcastModal.tsx +18 -24
  47. package/src/SocialComponents/PodcastModule/index.tsx +132 -130
@@ -1,15 +1,16 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { View, ActivityIndicator, Image, ScrollView, TouchableOpacity, FlatList } from "react-native"
2
+ import { ActivityIndicator, Image, FlatList } from "react-native"
3
3
  import type { MyPlayerProps, PlayerPodcastEpisodeProps, PodcastEpisodesProps, PodcastProps, PublicPlayerProps } from '../../types';
4
4
  import { PodcastApi } from './api';
5
- import Colors from '../../constants/colors';
6
5
  import { SocialPodcastHelpers } from '../api';
7
- import { view_styles } from '../../constants/styles';
8
- import { Button, Icons, Spring, Text } from '../../Components';
6
+ import { Icons } from '../../Components';
9
7
  import PodcastEpisodeCard from '../PodcastEpisodeCard';
10
8
  import moment from 'moment-mini';
11
9
  import PlayerCard from '../PlayerCard';
12
10
  import ClaimPodcastModal from './components/ClaimPodcastModal';
11
+ import { Button, Text, View } from '../../Components/Themed';
12
+ import { useColors } from '../../constants/useColors';
13
+ import Pagination from '../../Components/Pagination';
13
14
 
14
15
  type PodcastModuleProps = {
15
16
  player_id?:string,
@@ -21,8 +22,9 @@ type PodcastModuleProps = {
21
22
  onSelectEpisode:(pe:PodcastEpisodesProps) => void
22
23
  onSelectPlayer?:(p:PublicPlayerProps) => void
23
24
  }
24
-
25
+ const sections = ['header', 'players', 'episodes'];
25
26
  const PodcastModule = ({ podcast_id, player_id, padding_insets, onSelectEpisode, onBack, onShareEpisode, onSharePodcast, onSelectPlayer }:PodcastModuleProps) => {
27
+ const Colors = useColors();
26
28
  const [ module_size, setModuleSize ] = useState({ height:700, width:330 });
27
29
  const [ show_claim, setShowClaim ] = useState(false);
28
30
  const [ pod_data, setPodData ] = useState<{
@@ -96,7 +98,7 @@ const PodcastModule = ({ podcast_id, player_id, padding_insets, onSelectEpisode,
96
98
 
97
99
  const renderPlayers = (data:{item:PublicPlayerProps, index:number}) => {
98
100
  return (
99
- <View style={{ padding:4 }}>
101
+ <View float style={{ padding:4 }}>
100
102
  <PlayerCard
101
103
  player={data.item}
102
104
  width={135}
@@ -114,7 +116,7 @@ const PodcastModule = ({ podcast_id, player_id, padding_insets, onSelectEpisode,
114
116
  const ep_width = (module_size.width - 60) / 2
115
117
  const ppe = player_podcast_episodes.find(pp => pp.podcast_episode_id == data.item.podcast_episode_id);
116
118
  return (
117
- <View>
119
+ <View float style={{ margin:7 }}>
118
120
  <PodcastEpisodeCard
119
121
  podcast_episode={data.item}
120
122
  player_podcast_episode={ppe}
@@ -126,96 +128,112 @@ const PodcastModule = ({ podcast_id, player_id, padding_insets, onSelectEpisode,
126
128
  )
127
129
  }
128
130
 
129
- if(!podcast || loading){
130
- return (
131
- <View style={{ flex:1 }}>
132
- <ActivityIndicator style={{ padding:20, alignSelf: 'center' }} size='large' color={Colors.brand.midnight} />
133
- </View>
134
- )
135
- }
136
131
 
137
132
  let height = module_size.height * 0.5
138
133
  let width = module_size.width
139
134
 
140
- let description = `${podcast.description.slice(0,200)}...`
141
- if(podcast.description_override){ description = `${podcast.description.slice(0,200)}...` }
142
-
143
- return (
144
- <View style={{ flex:1 }}>
145
- <View style={{ flex:1, backgroundColor:Colors.shades.white }} onLayout={(ev) => {
146
- const { height, width } = ev.nativeEvent.layout
147
- setModuleSize({ width, height });
148
- }}>
149
- <ScrollView style={{ flex:1 }}>
135
+ const renderSections = (data:{ item:string, index:number }) => {
136
+ switch(data.item){
137
+ case 'header':
138
+ if(!podcast){ return <></> }
139
+ let description = `${podcast.description.slice(0,200)}...`
140
+ if(podcast.description_override){ description = `${podcast.description.slice(0,200)}...` }
141
+
142
+ return (
150
143
  <View nativeID='podcast_header'>
151
144
  <Image
152
145
  source={{ uri: SocialPodcastHelpers.getPodcastImage(podcast) }}
153
146
  style={{ width, height }}
154
147
  resizeMode='cover'
155
148
  />
156
- <View style={{ padding:20, position:'absolute', bottom:0, left:0, right:0, ...style.blur }}>
157
- <TouchableOpacity
149
+ <View type='blur' style={{ padding:20, position:'absolute', bottom:0, left:0, right:0 }}>
150
+ <Button
151
+ type='success'
158
152
  onPress={() => {
159
153
  let episode = podcast_episodes.sort((a,b) => moment(b.publish_date).unix() - moment(a.publish_date).unix())[0]
160
154
  if(!episode){ return alert('Unable to process') }
161
155
  onSelectEpisode(episode)
162
156
  }}
163
157
  disabled={podcast_episodes.length == 0 ? true : false}
164
- style={{ padding:10, borderRadius:8, width:module_size.width*0.7, flexDirection:'row', alignItems:'center', justifyContent:'center', alignSelf:'center', backgroundColor:Colors.shades.white, ...view_styles.float }}>
165
- <Icons.PlayIcon size={20} color={Colors.brand.electric}/>
166
- <Text style={{ marginLeft:15 }} weight='bold' color={Colors.brand.electric}>Play Episode</Text>
167
- </TouchableOpacity>
168
- {!podcast.claim_status ?
169
- <TouchableOpacity
170
- style={{ padding:10, marginTop:5, borderRadius:8, width:module_size.width*0.7, flexDirection:'row', alignItems:'center', justifyContent:'center', alignSelf:'center', backgroundColor:Colors.utility.success, ...view_styles.float }}
158
+ style={{ padding:10, borderRadius:8, width:module_size.width*0.7, flexDirection:'row', alignItems:'center', justifyContent:'center', alignSelf:'center' }}>
159
+ <Icons.PlayIcon size={20} color={Colors.text.action}/>
160
+ <Text style={{ marginLeft:15 }} weight='bold' color={Colors.text.h1}>Play Episode</Text>
161
+ </Button>
162
+ {podcast.claim_status ?
163
+ <Button
164
+ type='success'
165
+ style={{ padding:10, marginTop:5, borderRadius:8, width:module_size.width*0.7, flexDirection:'row', alignItems:'center', justifyContent:'center', alignSelf:'center' }}
171
166
  onPress={() => setShowClaim(true)}>
172
- <Icons.HeadphoneIcon size={20} color={Colors.shades.white}/>
173
- <Text style={{ marginLeft:15 }} weight='bold' color={Colors.shades.white}>Claim This Podcast!</Text>
174
- </TouchableOpacity>
167
+ <Icons.HeadphoneIcon size={20} color={Colors.text.h1}/>
168
+ <Text style={{ marginLeft:15 }} weight='bold' color={Colors.text.h1}>Claim This Podcast!</Text>
169
+ </Button>
175
170
  :podcast.claim_status == 'requested' && player?.role != 'admin' ?
176
171
  <View
177
- style={{ padding:10, marginTop:5, borderRadius:8, width:module_size.width*0.7, flexDirection:'row', alignItems:'center', justifyContent:'center', alignSelf:'center', backgroundColor:Colors.brand.midnight, ...view_styles.float }}>
178
- <Icons.HeadphoneIcon size={20} color={Colors.shades.white}/>
179
- <Text style={{ marginLeft:15 }} weight='bold' color={Colors.shades.white}>Claim Requested!</Text>
172
+ style={{ padding:10, marginTop:5, borderRadius:8, width:module_size.width*0.7, flexDirection:'row', alignItems:'center', justifyContent:'center', alignSelf:'center' }}>
173
+ <Icons.HeadphoneIcon size={20} color={Colors.text.h1}/>
174
+ <Text style={{ marginLeft:15 }} weight='bold' color={Colors.text.h1}>Claim Requested!</Text>
180
175
  </View>
181
176
  :podcast.claim_status == 'requested' && player?.role == 'admin' ?
182
- <TouchableOpacity
183
- style={{ padding:10, marginTop:5, borderRadius:8, width:module_size.width*0.7, flexDirection:'row', alignItems:'center', justifyContent:'center', alignSelf:'center', backgroundColor:Colors.utility.success, ...view_styles.float }}
177
+ <Button
178
+ type='success'
179
+ style={{ padding:10, marginTop:5, borderRadius:8, width:module_size.width*0.7, flexDirection:'row', alignItems:'center', justifyContent:'center', alignSelf:'center' }}
184
180
  onPress={() => approveClaim()}>
185
- <Icons.HeadphoneIcon size={20} color={Colors.shades.white}/>
186
- <Text style={{ marginLeft:15 }} weight='bold' color={Colors.shades.white}>Approve Claim Request!</Text>
187
- </TouchableOpacity>
181
+ <Icons.HeadphoneIcon size={20} color={Colors.text.h1}/>
182
+ <Text style={{ marginLeft:15 }} weight='bold' color={Colors.text.h1}>Approve Claim Request!</Text>
183
+ </Button>
188
184
  :<></>}
189
- <View style={{ marginTop:10 }}>
190
- <Text size={24} weight='bold' color={Colors.shades.white}>{podcast.title}</Text>
191
- <Text style={{ marginTop:4 }} color={Colors.shades.white} weight='semibold'>{description}</Text>
185
+ <View transparent style={{ marginTop:10 }}>
186
+ <Text size={24} weight='bold' color={Colors.text.h1}>{podcast.title}</Text>
187
+ <Text style={{ marginTop:4 }} color={Colors.text.h1} weight='semibold'>{description}</Text>
192
188
  </View>
193
189
  {podcast.claim_status == 'claimed' ?
194
- <View style={{ position:'absolute', top:20, left:5, height:40, width:40, borderRadius:100, justifyContent:'center', alignItems:'center' }}>
195
- <Icons.CheckCirlceIcon size={30} color={Colors.utility.success} />
190
+ <View transparent style={{ position:'absolute', top:20, left:5, height:40, width:40, borderRadius:100, justifyContent:'center', alignItems:'center' }}>
191
+ <Icons.CheckCirlceIcon size={30} color={Colors.text.success} />
196
192
  </View>
197
193
  :<></>}
198
194
  {podcast.claim_status == 'claimed' && claimed_player ?
199
- <TouchableOpacity style={{ position:'absolute', top:20, right:5, justifyContent:'center', alignItems:'center' }}
195
+ <Button transparent float style={{ position:'absolute', padding:0, top:20, right:5, borderRadius:100, justifyContent:'center', alignItems:'center' }}
200
196
  onPress={() => onSelectPlayer ? onSelectPlayer(claimed_player) : console.log('')}>
201
197
  <Image
202
198
  source={{ uri: claimed_player.profile_pic && claimed_player.profile_pic != '' ? claimed_player.profile_pic:'https://res.cloudinary.com/hoabts6mc/image/upload/v1722453927/default_man_n96ofq.webp' }}
203
199
  style={{ height:40, width:40, borderRadius:100 }}
204
200
  resizeMode='cover'
205
201
  />
206
- </TouchableOpacity>
202
+ </Button>
203
+ :<></>}
204
+ </View>
205
+ <View transparent style={{ position:'absolute', top:padding_insets?.top ?? 0, left:0, right:0, flexDirection:'row', alignItems:'center', padding:10 }}>
206
+ {onBack ?
207
+ <Button
208
+ float
209
+ style={{ height:50, width:50, borderRadius:100, justifyContent:'center', alignItems:'center' }}
210
+ onPress={() => onBack()}>
211
+ <Icons.ChevronIcon direction='left' color={Colors.text.action} size={14} />
212
+ </Button>
213
+ :<></>}
214
+ <View style={{ flex:1 }} />
215
+ {onSharePodcast ?
216
+ <Button
217
+ float
218
+ style={{ height:50, width:50, borderRadius:100, justifyContent:'center', alignItems:'center' }}
219
+ onPress={() => onSharePodcast(podcast)}>
220
+ <Icons.ShareIcon color={Colors.text.action} size={14} />
221
+ </Button>
207
222
  :<></>}
208
223
  </View>
209
224
  </View>
210
- {players.length > 0 ?
211
- <View style={{ ...view_styles.section }}>
212
- <View style={{ ...view_styles.section_header }}>
213
- <View style={{ flex:1 }}>
214
- <Text theme='header'>Podcasters</Text>
215
- <Text style={{ marginTop:3 }} theme='body_2'>Below are the players that put this podcast on! Check out their profiles</Text>
225
+ )
226
+ case 'players':
227
+ if(players.length == 0){ return <></> }
228
+ return (
229
+ <View>
230
+ <View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
231
+ <View transparent style={{ flex:1 }}>
232
+ <Text theme='h1'>Podcasters</Text>
233
+ <Text style={{ marginTop:3 }} theme='description'>Below are the players that put this podcast on! Check out their profiles</Text>
216
234
  </View>
217
235
  </View>
218
- <View style={{ ...view_styles.section_body, padding:10 }}>
236
+ <View style={{ padding:10 }}>
219
237
  <FlatList
220
238
  key='podcastors'
221
239
  data={players}
@@ -226,94 +244,78 @@ const PodcastModule = ({ podcast_id, player_id, padding_insets, onSelectEpisode,
226
244
  />
227
245
  </View>
228
246
  </View>
229
- :<></>}
230
- <View style={{ ...view_styles.section }}>
231
- <View style={{ ...view_styles.section_header }}>
232
- <View style={{ flex:1 }}>
233
- <Text theme='header'>Episodes</Text>
234
- <Text style={{ marginTop:3 }} theme='body_2'>Select an episode below to listed to it!</Text>
247
+ )
248
+ case 'episodes':
249
+ return (
250
+ <View>
251
+ <View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
252
+ <View transparent style={{ flex:1 }}>
253
+ <Text theme='h1'>Episodes</Text>
254
+ <Text style={{ marginTop:3 }} theme='description'>Select an episode below to listed to it!</Text>
235
255
  </View>
236
256
  </View>
237
- <View style={{ ...view_styles.section_body, padding:0 }}>
238
- <View style={{ ...view_styles.body_row }}>
239
- {episodes_offset > 0 ?
240
- <Button
241
- title='PREV'
242
- title_color={Colors.brand.electric}
243
- backgroundColor='transparent'
244
- onPress={() => getEpisdoesFromServer(podcast_id, episodes_offset - 1)}
245
- />
246
- :<View/>}
247
- <View style={{ flex:1 }} />
248
- <Button
249
- title='NEXT'
250
- title_color={Colors.brand.electric}
251
- backgroundColor='transparent'
252
- onPress={() => getEpisdoesFromServer(podcast_id, episodes_offset + 1)}
253
- />
254
- </View>
257
+ <View transparent>
258
+ <Pagination
259
+ offset={episodes_offset}
260
+ onNext={() => getEpisdoesFromServer(podcast_id, episodes_offset + 1)}
261
+ onPrevious={() => getEpisdoesFromServer(podcast_id, episodes_offset - 1)}
262
+ />
255
263
  {episodes_loading ?
256
- <ActivityIndicator style={{ padding:20, alignSelf:'center' }} size='large' color={Colors.brand.midnight} />
264
+ <ActivityIndicator style={{ padding:20, alignSelf:'center' }} size='large' color={Colors.text.h1} />
257
265
  :<></>}
258
- <View style={{ flexDirection:'row', flexWrap: 'wrap' }}>
266
+ <View transparent style={{ flexDirection:'row', flexWrap: 'wrap', justifyContent:'center' }}>
259
267
  {podcast_episodes.sort((a,b) => moment(b.publish_date).unix() - moment(a.publish_date).unix()).map((e,i) => {
260
268
  return renderEpsidoes({ item:e, index:i })
261
269
  })}
262
270
  </View>
263
271
  </View>
264
272
  </View>
265
- </ScrollView>
266
- <View style={{ position:'absolute', top:padding_insets?.top ?? 0, left:0, right:0, flexDirection:'row', alignItems:'center' }}>
267
- {onBack ?
268
- <TouchableOpacity
269
- style={{ ...view_styles.section, backgroundColor:Colors.shades.shade100, height:50, width:50, borderRadius:100, justifyContent:'center', alignItems:'center' }}
270
- onPress={() => onBack()}>
271
- <Icons.ChevronIcon direction='left' color={Colors.brand.midnight} size={14} />
272
- </TouchableOpacity>
273
- :<></>}
274
- <View style={{ flex:1 }} />
275
- {onSharePodcast ?
276
- <TouchableOpacity
277
- style={{ ...view_styles.section, backgroundColor:Colors.shades.shade100, height:50, width:50, borderRadius:100, justifyContent:'center', alignItems:'center' }}
278
- onPress={() => onSharePodcast(podcast)}>
279
- <Icons.ShareIcon color={Colors.brand.electric} size={14} />
280
- </TouchableOpacity>
281
- :<></>}
282
- </View>
283
-
284
- </View>
285
- {show_claim ?
286
- <View style={{ position:'absolute', flex:1, backgroundColor:Colors.shades.black_faded, top:0, left:0, right:0, bottom:0, justifyContent:'flex-end' }}>
287
- <Spring
288
- slide='vertical'
289
- to={0}
290
- from={500}
291
-
292
- >
293
- <ClaimPodcastModal
294
- podcast={podcast}
295
- width={module_size.width - 20}
296
- onClose={() => setShowClaim(false)}
297
- onPodcastUpdate={(pod) => {
298
- setShowClaim(false);
299
- setPodData({
300
- ...pod_data,
301
- podcast: pod
302
- })
303
- }}
273
+ )
274
+ default: return <></>
275
+ }
276
+ }
277
+
278
+
279
+ return (
280
+ <View style={{ flex:1 }}>
281
+ <View style={{ flex:1 }} onLayout={(ev) => {
282
+ const { height, width } = ev.nativeEvent.layout
283
+ setModuleSize({ width, height });
284
+ }}>
285
+ {loading ?
286
+ <ActivityIndicator style={{ padding:20, alignSelf:'center' }} size='large' color={Colors.text.h1} />
287
+ :<></>}
288
+ <FlatList
289
+ data={sections}
290
+ refreshing={pod_data.loading}
291
+ onRefresh={() => getPodDataFromServer(podcast_id, 0)}
292
+ key={'podcast_sections'}
293
+ keyExtractor={(item) => item}
294
+ renderItem={renderSections}
304
295
  />
305
- </Spring>
306
296
  </View>
297
+ {show_claim && podcast ?
298
+ <View type='blur' style={{ position:'absolute', top:0, right:0, left:0, bottom:0, justifyContent:'center', alignItems:'center', padding:20 }}>
299
+ <View style={{ maxWidth: 500 }}>
300
+ <ClaimPodcastModal
301
+ podcast={podcast}
302
+ width={module_size.width - 20}
303
+ onClose={() => setShowClaim(false)}
304
+ onPodcastUpdate={(pod) => {
305
+ setShowClaim(false);
306
+ setPodData({
307
+ ...pod_data,
308
+ podcast: pod
309
+ })
310
+ }}
311
+ />
312
+ </View>
313
+ </View>
307
314
  :<></>}
315
+
308
316
  </View>
309
317
  )
310
318
  }
311
319
 
312
320
  export default PodcastModule
313
321
 
314
- const style:any = {
315
- blur: {
316
- backdropFilter: 'blur(75px)',
317
- backgroundColor:Colors.shades.black_faded_heavy
318
- }
319
- }