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.
- package/lib/commonjs/Components/Slider.js +2 -0
- package/lib/commonjs/Components/Slider.js.map +1 -1
- package/lib/commonjs/SocialComponents/AudioPlayer.js +116 -185
- package/lib/commonjs/SocialComponents/AudioPlayer.js.map +1 -1
- package/lib/commonjs/SocialComponents/PodcastEpisodeCard.js +40 -35
- package/lib/commonjs/SocialComponents/PodcastEpisodeCard.js.map +1 -1
- package/lib/commonjs/SocialComponents/PodcastModule/components/ClaimPodcastModal.js +51 -49
- package/lib/commonjs/SocialComponents/PodcastModule/components/ClaimPodcastModal.js.map +1 -1
- package/lib/commonjs/SocialComponents/PodcastModule/index.js +337 -335
- package/lib/commonjs/SocialComponents/PodcastModule/index.js.map +1 -1
- package/lib/module/Components/Slider.js +2 -0
- package/lib/module/Components/Slider.js.map +1 -1
- package/lib/module/SocialComponents/AudioPlayer.js +111 -180
- package/lib/module/SocialComponents/AudioPlayer.js.map +1 -1
- package/lib/module/SocialComponents/PodcastEpisodeCard.js +31 -26
- package/lib/module/SocialComponents/PodcastEpisodeCard.js.map +1 -1
- package/lib/module/SocialComponents/PodcastModule/components/ClaimPodcastModal.js +31 -28
- package/lib/module/SocialComponents/PodcastModule/components/ClaimPodcastModal.js.map +1 -1
- package/lib/module/SocialComponents/PodcastModule/index.js +336 -334
- package/lib/module/SocialComponents/PodcastModule/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/Components/Slider.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/SocialComponents/AudioPlayer.d.ts +3 -1
- package/lib/typescript/lib/commonjs/SocialComponents/AudioPlayer.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/SocialComponents/PodcastEpisodeCard.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/SocialComponents/PodcastModule/components/ClaimPodcastModal.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/SocialComponents/PodcastModule/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Components/Slider.d.ts.map +1 -1
- package/lib/typescript/lib/module/SocialComponents/AudioPlayer.d.ts +4 -5
- package/lib/typescript/lib/module/SocialComponents/AudioPlayer.d.ts.map +1 -1
- package/lib/typescript/lib/module/SocialComponents/PodcastEpisodeCard.d.ts +1 -2
- package/lib/typescript/lib/module/SocialComponents/PodcastEpisodeCard.d.ts.map +1 -1
- package/lib/typescript/lib/module/SocialComponents/PodcastModule/components/ClaimPodcastModal.d.ts +1 -2
- package/lib/typescript/lib/module/SocialComponents/PodcastModule/components/ClaimPodcastModal.d.ts.map +1 -1
- package/lib/typescript/lib/module/SocialComponents/PodcastModule/index.d.ts +1 -2
- package/lib/typescript/lib/module/SocialComponents/PodcastModule/index.d.ts.map +1 -1
- package/lib/typescript/src/Components/Slider.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/AudioPlayer.d.ts +8 -1
- package/lib/typescript/src/SocialComponents/AudioPlayer.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/PodcastEpisodeCard.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/PodcastModule/components/ClaimPodcastModal.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/PodcastModule/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/Components/Slider.tsx +2 -0
- package/src/SocialComponents/AudioPlayer.tsx +86 -172
- package/src/SocialComponents/PodcastEpisodeCard.tsx +23 -23
- package/src/SocialComponents/PodcastModule/components/ClaimPodcastModal.tsx +18 -24
- package/src/SocialComponents/PodcastModule/index.tsx +132 -130
|
@@ -1,77 +1,44 @@
|
|
|
1
|
-
import React, { useEffect,
|
|
2
|
-
import {
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { Image, ActivityIndicator } from 'react-native';
|
|
3
3
|
import { SocialComponentApi, SocialPodcastHelpers } from './api';
|
|
4
4
|
import type { PlayerPodcastEpisodeProps, PlayerPodcastProps, PodcastEpisodesProps } from '../types';
|
|
5
|
-
import {
|
|
6
|
-
import { view_styles } from '../constants/styles';
|
|
7
|
-
import Colors from '../constants/colors';
|
|
5
|
+
import { Icons } from '../Components';
|
|
8
6
|
import Slider from '../Components/Slider';
|
|
7
|
+
import { Audio, type AVPlaybackStatusSuccess } from 'expo-av';
|
|
8
|
+
import { Button, Text, View } from '../Components/Themed';
|
|
9
|
+
import { useColors } from '../constants/useColors';
|
|
10
|
+
|
|
9
11
|
|
|
10
12
|
type AudioPlayerProps = {
|
|
11
13
|
podcast_episode_id:string,
|
|
12
14
|
player_id?:string,
|
|
15
|
+
onSelectEpisode?:(data:{ podcast_episode:PodcastEpisodesProps, player_podcast?:PlayerPodcastProps, player_podcast_episode?:PlayerPodcastEpisodeProps }) => void,
|
|
16
|
+
style?:any,
|
|
13
17
|
onClose:() => void
|
|
14
18
|
}
|
|
15
|
-
const AudioPlayer = ({podcast_episode_id, player_id, onClose}:AudioPlayerProps) => {
|
|
16
|
-
|
|
19
|
+
const AudioPlayer = ({podcast_episode_id, player_id, style, onClose, onSelectEpisode}:AudioPlayerProps) => {
|
|
20
|
+
const Colors = useColors();
|
|
17
21
|
const [ audio_size, setAudioSize ] = useState({ width:50 });
|
|
18
22
|
const [ audio_data, setAudioData ] = useState<{
|
|
19
23
|
audio_loading:boolean,
|
|
20
24
|
podcast_episode?:PodcastEpisodesProps,
|
|
25
|
+
audio_player?:Audio.Sound,
|
|
21
26
|
}>({
|
|
22
27
|
audio_loading:false,
|
|
23
28
|
});
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
time_remaining:number,
|
|
31
|
-
minimum_value: number,
|
|
32
|
-
maximum_value:number
|
|
33
|
-
}>({
|
|
34
|
-
duration:0,
|
|
35
|
-
loaded:false,
|
|
36
|
-
status: 'paused',
|
|
37
|
-
current_time:0,
|
|
38
|
-
time_remaining:0,
|
|
39
|
-
minimum_value:0,
|
|
40
|
-
maximum_value: 0
|
|
41
|
-
});
|
|
42
|
-
const { loaded, status, current_time, time_remaining, maximum_value, minimum_value } = time_data;
|
|
43
|
-
|
|
44
|
-
const [ player_data, setPlayerData ] = useState<{
|
|
29
|
+
const [ audio_status, setAudioStatus ] = useState<AVPlaybackStatusSuccess|undefined>(undefined)
|
|
30
|
+
const curr_time = (audio_status?.positionMillis ?? 0) / 1000
|
|
31
|
+
const dur_time = (audio_status?.durationMillis && !isNaN(audio_status.durationMillis) ? audio_status.durationMillis : 1000000) / 1000
|
|
32
|
+
const rem_time = dur_time - curr_time < 0 ? 0 : dur_time - curr_time
|
|
33
|
+
const { audio_loading, podcast_episode, audio_player } = audio_data;
|
|
34
|
+
const [ player_data, setPlayerData ] = useState<{
|
|
45
35
|
player_loading:boolean,
|
|
46
36
|
player_podcast?:PlayerPodcastProps,
|
|
47
37
|
player_podcast_episode?:PlayerPodcastEpisodeProps
|
|
48
38
|
}>({
|
|
49
39
|
player_loading: false
|
|
50
40
|
});
|
|
51
|
-
const { player_loading, player_podcast } = player_data;
|
|
52
|
-
|
|
53
|
-
const audio_ref:any = useRef(null);
|
|
54
|
-
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
const handleBeforeUnload = async(event:any) => {
|
|
57
|
-
event.preventDefault();
|
|
58
|
-
event.returnValue = ''; // This is required for some browsers to show a confirmation dialog
|
|
59
|
-
// Perform any cleanup or save data here
|
|
60
|
-
if(audio_ref?.current){
|
|
61
|
-
await SocialComponentApi.pausePodcastEpisode(podcast_episode_id, audio_ref.current.currentTime);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
if(Platform.OS == 'web'){
|
|
66
|
-
window.addEventListener('beforeunload', handleBeforeUnload);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return () => {
|
|
70
|
-
if(Platform.OS == 'web'){
|
|
71
|
-
window.removeEventListener('beforeunload', handleBeforeUnload);
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
},[])
|
|
41
|
+
const { player_loading, player_podcast, player_podcast_episode } = player_data;
|
|
75
42
|
|
|
76
43
|
|
|
77
44
|
useEffect(() => {
|
|
@@ -82,10 +49,24 @@ const AudioPlayer = ({podcast_episode_id, player_id, onClose}:AudioPlayerProps)
|
|
|
82
49
|
const getAudioData = async(pod_episode_id:string) => {
|
|
83
50
|
setAudioData({ ...audio_data, audio_loading:true })
|
|
84
51
|
const episode = await SocialComponentApi.getPodcastEpisodeById(pod_episode_id);
|
|
52
|
+
const { sound, status } = await Audio.Sound.createAsync({ uri: episode?.url ?? ''})
|
|
53
|
+
setAudioStatus(status as AVPlaybackStatusSuccess)
|
|
54
|
+
sound.setProgressUpdateIntervalAsync(1000);
|
|
55
|
+
sound.setOnPlaybackStatusUpdate(status => setAudioStatus(status as AVPlaybackStatusSuccess));
|
|
56
|
+
|
|
57
|
+
if(player_id){
|
|
58
|
+
let pdata = await getPlayerData(pod_episode_id);
|
|
59
|
+
if(pdata?.player_podcast_episode){
|
|
60
|
+
await sound.setPositionAsync(pdata.player_podcast_episode.pause_timestamp)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
85
65
|
setAudioData({
|
|
86
66
|
...audio_data,
|
|
87
67
|
audio_loading: false,
|
|
88
|
-
podcast_episode: episode
|
|
68
|
+
podcast_episode: episode,
|
|
69
|
+
audio_player: sound,
|
|
89
70
|
})
|
|
90
71
|
}
|
|
91
72
|
|
|
@@ -102,168 +83,104 @@ const AudioPlayer = ({podcast_episode_id, player_id, onClose}:AudioPlayerProps)
|
|
|
102
83
|
}
|
|
103
84
|
|
|
104
85
|
const startAudio = async() => {
|
|
105
|
-
if(!
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
audio_ref?.current.play();
|
|
86
|
+
if(!audio_player){ return alert('Unable to play audio at this time') }
|
|
87
|
+
await audio_player.playAsync();
|
|
88
|
+
|
|
109
89
|
if(player_id){
|
|
110
90
|
setPlayerData({ ...player_data, player_loading: true });
|
|
111
91
|
const p_resp = await SocialComponentApi.startPodcastEpisode(podcast_episode_id);
|
|
112
92
|
setPlayerData({ ...player_data, player_loading: false, player_podcast: p_resp?.player_podcast, player_podcast_episode: p_resp?.player_podcast_episode });
|
|
113
93
|
}
|
|
114
|
-
setTimeData({
|
|
115
|
-
...time_data,
|
|
116
|
-
current_time: cur_time,
|
|
117
|
-
time_remaining: dur - cur_time,
|
|
118
|
-
duration: dur,
|
|
119
|
-
status: 'playing'
|
|
120
|
-
})
|
|
121
94
|
}
|
|
122
95
|
|
|
123
96
|
const pauseAudio = async() => {
|
|
124
|
-
if(!
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
97
|
+
if(!audio_player){ return alert('Unable to play audio at this time') }
|
|
98
|
+
|
|
99
|
+
const status:any = await audio_player.pauseAsync();
|
|
100
|
+
let cur_time = status.positionMillis ?? 0
|
|
128
101
|
|
|
129
102
|
if(player_id){
|
|
130
103
|
setPlayerData({ ...player_data, player_loading: true });
|
|
131
104
|
const p_resp = await SocialComponentApi.pausePodcastEpisode(podcast_episode_id, cur_time);
|
|
132
105
|
setPlayerData({ ...player_data, player_loading: false, player_podcast, player_podcast_episode: p_resp });
|
|
133
106
|
}
|
|
134
|
-
setTimeData({
|
|
135
|
-
...time_data,
|
|
136
|
-
current_time: cur_time,
|
|
137
|
-
time_remaining: dur - cur_time,
|
|
138
|
-
duration: dur,
|
|
139
|
-
status: 'paused'
|
|
140
|
-
})
|
|
141
|
-
}
|
|
142
107
|
|
|
143
|
-
const handleTimeChange = () => {
|
|
144
|
-
if(!loaded || player_loading || audio_loading){ return }
|
|
145
|
-
if(!audio_ref?.current){ return }//Error
|
|
146
|
-
let cur_time = audio_ref.current.currentTime
|
|
147
|
-
let dur = audio_ref.current.duration
|
|
148
|
-
setTimeData({
|
|
149
|
-
...time_data,
|
|
150
|
-
current_time: cur_time,
|
|
151
|
-
time_remaining: dur - cur_time,
|
|
152
|
-
duration: dur,
|
|
153
|
-
})
|
|
154
108
|
}
|
|
155
109
|
|
|
156
|
-
const
|
|
157
|
-
if(!
|
|
158
|
-
|
|
159
|
-
const dur = audio_ref.current.duration
|
|
160
|
-
let cur_time = 0
|
|
161
|
-
if(player_id){
|
|
162
|
-
let p_data = await getPlayerData(podcast_episode_id);
|
|
163
|
-
if(p_data?.player_podcast_episode && audio_ref?.current){
|
|
164
|
-
audio_ref.current.currentTime = p_data.player_podcast_episode.pause_timestamp
|
|
165
|
-
cur_time = p_data.player_podcast_episode.pause_timestamp
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
setTimeData({
|
|
170
|
-
...time_data,
|
|
171
|
-
current_time: cur_time,
|
|
172
|
-
minimum_value: 0,
|
|
173
|
-
maximum_value: dur,
|
|
174
|
-
time_remaining: dur - cur_time,
|
|
175
|
-
status: 'playing',
|
|
176
|
-
loaded:true
|
|
177
|
-
});
|
|
178
|
-
audio_ref.current.play()
|
|
110
|
+
const handleStartSliding = () => {
|
|
111
|
+
if(!audio_player){ return }
|
|
112
|
+
audio_player.pauseAsync()
|
|
179
113
|
}
|
|
180
114
|
|
|
181
|
-
const handleStartTimeChange = () => {
|
|
182
|
-
if(!audio_ref?.current || !loaded){ return }
|
|
183
|
-
const cur = audio_ref.current.currentTime
|
|
184
|
-
let dur = audio_ref.current.duration
|
|
185
|
-
setTimeData({
|
|
186
|
-
...time_data,
|
|
187
|
-
current_time: cur,
|
|
188
|
-
duration: dur,
|
|
189
|
-
time_remaining: dur - cur,
|
|
190
|
-
status: 'paused'
|
|
191
|
-
})
|
|
192
|
-
audio_ref.current.pause();
|
|
193
|
-
}
|
|
194
115
|
|
|
195
|
-
const handleManualTimeChange = (val:number) => {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
...time_data,
|
|
201
|
-
current_time: val,
|
|
202
|
-
duration: dur,
|
|
203
|
-
status: 'playing',
|
|
204
|
-
time_remaining: dur - val
|
|
205
|
-
});
|
|
206
|
-
audio_ref.current.play();
|
|
116
|
+
const handleManualTimeChange = async(val:number) => {
|
|
117
|
+
//updat manual time!!
|
|
118
|
+
if(!audio_player){ return }
|
|
119
|
+
await audio_player.setPositionAsync(val * 1000);
|
|
120
|
+
await audio_player.playAsync();
|
|
207
121
|
}
|
|
208
122
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
if(Platform.OS != 'web'){ return <></> }
|
|
212
|
-
|
|
213
123
|
return (
|
|
214
|
-
<View style={{
|
|
124
|
+
<View float type='row' style={{ flex:1, borderRadius:8, ...style }} onLayout={(ev) => {
|
|
215
125
|
const { width } = ev.nativeEvent.layout
|
|
216
126
|
setAudioSize({ width })
|
|
217
127
|
}}>
|
|
218
128
|
{!podcast_episode || audio_loading ?
|
|
219
|
-
<ActivityIndicator size='large' color={Colors.
|
|
129
|
+
<ActivityIndicator size='large' color={Colors.text.h1} style={{ alignSelf:'center' }} />
|
|
220
130
|
:
|
|
221
|
-
<View style={{
|
|
222
|
-
<View>
|
|
131
|
+
<View transparent type='row' style={{ flex:1 }}>
|
|
132
|
+
<View transparent>
|
|
223
133
|
<Image
|
|
224
134
|
source={{ uri: SocialPodcastHelpers.getEpisodeImage(podcast_episode) }}
|
|
225
|
-
style={{ width: audio_size.width * 0.
|
|
135
|
+
style={{ width: audio_size.width * 0.135, height: audio_size.width * 0.135 }}
|
|
226
136
|
resizeMode='cover'
|
|
227
137
|
/>
|
|
228
|
-
<View style={{ position:'absolute', top:0, left:0, right:0, bottom:0, justifyContent:'center', alignItems:'center' }}>
|
|
229
|
-
{
|
|
230
|
-
<
|
|
231
|
-
<Icons.PlayIcon size={12} color={Colors.
|
|
232
|
-
</
|
|
233
|
-
:
|
|
234
|
-
<
|
|
235
|
-
<Icons.PauseIcon size={12} color={Colors.
|
|
236
|
-
</
|
|
138
|
+
<View transparent style={{ position:'absolute', top:0, left:0, right:0, bottom:0, justifyContent:'center', alignItems:'center' }}>
|
|
139
|
+
{audio_status && !audio_status.isPlaying ?
|
|
140
|
+
<Button float style={{ borderRadius:100, padding:10 }} onPress={() => startAudio() }>
|
|
141
|
+
<Icons.PlayIcon size={12} color={Colors.text.success} />
|
|
142
|
+
</Button>
|
|
143
|
+
:audio_status &&audio_status.isPlaying ?
|
|
144
|
+
<Button float style={{ borderRadius:100, padding:10 }} onPress={() => pauseAudio() }>
|
|
145
|
+
<Icons.PauseIcon size={12} color={Colors.text.error} />
|
|
146
|
+
</Button>
|
|
237
147
|
:<></>}
|
|
238
148
|
</View>
|
|
239
149
|
</View>
|
|
240
|
-
<View style={{ flex:1
|
|
241
|
-
<View style={{ flex:1 }}>
|
|
242
|
-
<
|
|
243
|
-
|
|
244
|
-
|
|
150
|
+
<View transparent type='row' style={{ flex:1 }}>
|
|
151
|
+
<View transparent style={{ flex:1, padding:5, marginBottom:5 }}>
|
|
152
|
+
<Button
|
|
153
|
+
disabled={!onSelectEpisode}
|
|
154
|
+
onPress={() => onSelectEpisode? onSelectEpisode({ podcast_episode: podcast_episode, player_podcast:player_podcast, player_podcast_episode:player_podcast_episode }) : console.log('')}
|
|
155
|
+
transparent type='text' style={{ padding:5 }}>
|
|
156
|
+
<Text size={14} theme='h1'>{podcast_episode.title}</Text>
|
|
157
|
+
</Button>
|
|
158
|
+
<View transparent style={{ flexDirection:'row', alignItems:'center' }}>
|
|
159
|
+
<Text style={{ padding:5, width:50, alignSelf:'center' }} size={12} theme='description'>{SocialPodcastHelpers.formatTime(curr_time)}</Text>
|
|
160
|
+
{audio_status ?
|
|
245
161
|
<Slider
|
|
246
162
|
width={audio_size.width * 0.47}
|
|
247
|
-
value={
|
|
248
|
-
minimum_value={
|
|
249
|
-
maximum_value={
|
|
250
|
-
onSlidingStart={() =>
|
|
163
|
+
value={curr_time}
|
|
164
|
+
minimum_value={0}
|
|
165
|
+
maximum_value={dur_time}
|
|
166
|
+
onSlidingStart={() => handleStartSliding()}
|
|
251
167
|
onSlidingComplete={(val) => handleManualTimeChange(val)}
|
|
252
168
|
/>
|
|
253
|
-
|
|
169
|
+
:<></>}
|
|
170
|
+
<Text style={{ padding:5, width:50, alignSelf:'center' }} size={12} theme='description'>-{SocialPodcastHelpers.formatTime(isNaN(rem_time)?0:rem_time)}</Text>
|
|
254
171
|
</View>
|
|
255
172
|
{player_loading || audio_loading ?
|
|
256
|
-
<View style={{ position:'absolute', top:0, left:0, bottom:0, right:0, justifyContent:'center' }}>
|
|
257
|
-
<ActivityIndicator size='small' color={Colors.
|
|
173
|
+
<View transparent style={{ position:'absolute', top:0, left:0, bottom:0, right:0, justifyContent:'center' }}>
|
|
174
|
+
<ActivityIndicator size='small' color={Colors.text.h1} />
|
|
258
175
|
</View>
|
|
259
176
|
:<></>}
|
|
260
177
|
</View>
|
|
261
|
-
<View style={{ marginLeft:10, flexDirection:'row', alignItems:'center' }}>
|
|
178
|
+
<View transparent style={{ marginLeft:10, marginRight:10, flexDirection:'row', alignItems:'center' }}>
|
|
262
179
|
<Button
|
|
263
|
-
|
|
180
|
+
float
|
|
181
|
+
style={{ borderRadius:100, height:20, width:20, justifyContent:'center', alignItems:'center' }}
|
|
264
182
|
title='X'
|
|
265
|
-
|
|
266
|
-
title_color={Colors.brand.midnight}
|
|
183
|
+
type='close'
|
|
267
184
|
onPress={async() => {
|
|
268
185
|
await pauseAudio();
|
|
269
186
|
onClose();
|
|
@@ -274,9 +191,6 @@ const AudioPlayer = ({podcast_episode_id, player_id, onClose}:AudioPlayerProps)
|
|
|
274
191
|
</View>
|
|
275
192
|
</View>
|
|
276
193
|
}
|
|
277
|
-
{Platform.OS == 'web' && podcast_episode ?
|
|
278
|
-
<audio onLoad={(ev) => console.log(ev)} ref={audio_ref} onDurationChange={() => handleLoad()} onTimeUpdate={() => handleTimeChange()} src={podcast_episode.url} />
|
|
279
|
-
:<></>}
|
|
280
194
|
</View>
|
|
281
195
|
|
|
282
196
|
)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Image
|
|
3
|
-
import { view_styles } from "../constants/styles";
|
|
2
|
+
import { Image } from 'react-native';
|
|
4
3
|
import type { PlayerPodcastEpisodeProps, PodcastEpisodesProps, PodcastProps } from '../types';
|
|
5
|
-
import { Icons
|
|
4
|
+
import { Icons } from '../Components';
|
|
6
5
|
import { SocialPodcastHelpers } from './api';
|
|
7
|
-
import Colors from '../constants/colors';
|
|
8
6
|
import moment from 'moment-mini';
|
|
7
|
+
import { useColors } from '../constants/useColors';
|
|
8
|
+
import { Button, Text, View } from '../Components/Themed';
|
|
9
9
|
|
|
10
10
|
type PodcastEpisodeCardProps = {
|
|
11
11
|
podcast_episode:PodcastEpisodesProps
|
|
@@ -17,45 +17,45 @@ type PodcastEpisodeCardProps = {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
const PodcastEpisodeCard = ({ width, podcast_episode, player_podcast_episode, onSelectEpisode, onShare }: PodcastEpisodeCardProps ) => {
|
|
20
|
-
|
|
20
|
+
const Colors = useColors();
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
|
-
<
|
|
24
|
-
<View style={{
|
|
25
|
-
<View style={{ flex:1 }}>
|
|
26
|
-
<Text theme='
|
|
23
|
+
<Button style={{ width, padding:0 }} onPress={() => onSelectEpisode(podcast_episode)}>
|
|
24
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
|
|
25
|
+
<View transparent style={{ flex:1 }}>
|
|
26
|
+
<Text theme='h1'>{moment(podcast_episode.publish_date).format('MMM DD YYYY')}</Text>
|
|
27
27
|
</View>
|
|
28
28
|
{onShare?
|
|
29
|
-
<
|
|
30
|
-
<Icons.ShareIcon size={14} color={Colors.
|
|
31
|
-
</
|
|
29
|
+
<Button transparent style={{ padding:5 }} onPress={() => onShare(podcast_episode)}>
|
|
30
|
+
<Icons.ShareIcon size={14} color={Colors.text.action} />
|
|
31
|
+
</Button>
|
|
32
32
|
:<></>}
|
|
33
33
|
</View>
|
|
34
|
-
<View
|
|
35
|
-
<View>
|
|
34
|
+
<View transparent type='body'>
|
|
35
|
+
<View transparent>
|
|
36
36
|
<Image
|
|
37
37
|
source={{ uri: SocialPodcastHelpers.getEpisodeImage(podcast_episode) }}
|
|
38
38
|
style={{ width: width, height: width * 0.666 }}
|
|
39
39
|
/>
|
|
40
|
-
<View style={{ position:'absolute', top:0, left:0, right:0, bottom:0,
|
|
41
|
-
<View style={{
|
|
42
|
-
<View style={{
|
|
43
|
-
<Icons.PlayIcon size={18} color={Colors.
|
|
40
|
+
<View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, justifyContent:'center', alignItems:'center' }}>
|
|
41
|
+
<View transparent style={{ borderRadius:22, padding:10 }}>
|
|
42
|
+
<View float type='row' style={{ padding:10 }}>
|
|
43
|
+
<Icons.PlayIcon size={18} color={Colors.text.action} />
|
|
44
44
|
{player_podcast_episode ?
|
|
45
|
-
<Text size={14} color={Colors.
|
|
45
|
+
<Text size={14} color={Colors.text.action} weight='semibold' style={{ marginLeft:10 }}>Resume</Text>
|
|
46
46
|
:
|
|
47
|
-
<Text size={14} color={Colors.
|
|
47
|
+
<Text size={14} color={Colors.text.action} weight='semibold' style={{ marginLeft:10 }}>Play</Text>
|
|
48
48
|
}
|
|
49
49
|
</View>
|
|
50
50
|
</View>
|
|
51
51
|
</View>
|
|
52
52
|
</View>
|
|
53
|
-
<View style={{ padding:10 }}>
|
|
54
|
-
<Text theme='
|
|
53
|
+
<View transparent style={{ padding:10 }}>
|
|
54
|
+
<Text theme='h2'>{podcast_episode.title}</Text>
|
|
55
55
|
</View>
|
|
56
56
|
</View>
|
|
57
57
|
|
|
58
|
-
</
|
|
58
|
+
</Button>
|
|
59
59
|
)
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Image } from 'react-native';
|
|
3
3
|
import type { PodcastProps } from '../../../types';
|
|
4
|
-
import { view_styles } from '../../../constants/styles';
|
|
5
|
-
import { Button, Text } from '../../../Components';
|
|
6
|
-
import Colors from '../../../constants/colors';
|
|
7
4
|
import { SocialPodcastHelpers } from '../../api';
|
|
8
5
|
import { PodcastApi } from '../api';
|
|
6
|
+
import { Button, Text, View } from '../../../Components/Themed';
|
|
9
7
|
|
|
10
8
|
type ClaimPodcastModalProps = {
|
|
11
9
|
podcast:PodcastProps,
|
|
@@ -26,49 +24,45 @@ const ClaimPodcastModal = ({ podcast, onClose, onPodcastUpdate }:ClaimPodcastMod
|
|
|
26
24
|
}
|
|
27
25
|
|
|
28
26
|
return (
|
|
29
|
-
<View
|
|
30
|
-
<View style={{
|
|
27
|
+
<View float>
|
|
28
|
+
<View type='header' style={{ flexDirection:'row', borderTopRightRadius:8, borderTopLeftRadius:8, padding:10 }}>
|
|
31
29
|
<Image
|
|
32
30
|
source={{ uri: SocialPodcastHelpers.getPodcastImage(podcast) }}
|
|
33
31
|
style={{ width:50, height:50, borderRadius:4 }}
|
|
34
32
|
resizeMode='cover'
|
|
35
33
|
/>
|
|
36
|
-
<View style={{ flex:1, marginLeft:10 }}>
|
|
37
|
-
<Text theme='
|
|
38
|
-
<Text style={{ marginTop:3 }} theme='
|
|
34
|
+
<View transparent style={{ flex:1, marginLeft:10 }}>
|
|
35
|
+
<Text theme='h1'>Is this your podcast?</Text>
|
|
36
|
+
<Text style={{ marginTop:3 }} theme='description'>Claim this podcast and get it prioritized over other similar podcasts!</Text>
|
|
39
37
|
</View>
|
|
40
38
|
</View>
|
|
41
|
-
<View style={{
|
|
42
|
-
<Text style={{ marginBottom:10 }} theme='
|
|
43
|
-
<View style={{
|
|
39
|
+
<View type='body' style={{ padding:10 }}>
|
|
40
|
+
<Text style={{ marginBottom:10 }} theme='h1'>Benefits of claiming podcast</Text>
|
|
41
|
+
<View type='row' style={{ alignItems:'flex-start', padding:5 }}>
|
|
44
42
|
<Text size={40} weight='bold'>*</Text>
|
|
45
|
-
<Text style={{ marginLeft:10 }} theme='
|
|
43
|
+
<Text style={{ marginLeft:10 }} theme='h2'>PodQuest, BettorEdge's proprietary podcast recommendation engine will suggest your podcast to interested parties based on their betting history!</Text>
|
|
46
44
|
</View>
|
|
47
|
-
<View style={{
|
|
45
|
+
<View type='row' style={{ alignItems:'flex-start', paddingTop:5 }}>
|
|
48
46
|
<Text size={40} weight='bold'>*</Text>
|
|
49
|
-
<Text style={{ marginLeft:10 }} theme='
|
|
47
|
+
<Text style={{ marginLeft:10 }} theme='h2'>Adds the podcast to your profile for people to see your bets, takes, and podcasts all in one place!</Text>
|
|
50
48
|
</View>
|
|
51
|
-
<View style={{
|
|
49
|
+
<View type='row' style={{ alignItems:'flex-start', paddingTop:5 }}>
|
|
52
50
|
<Text size={40} weight='bold'>*</Text>
|
|
53
|
-
<Text style={{ marginLeft:10 }} theme='
|
|
51
|
+
<Text style={{ marginLeft:10 }} theme='h2'>Additionally, it gets you a referral code allowing you to make money on users sent to BettorEdge!</Text>
|
|
54
52
|
</View>
|
|
55
53
|
</View>
|
|
56
|
-
<View style={{
|
|
54
|
+
<View style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomRightRadius:8, borderBottomLeftRadius:8 }}>
|
|
57
55
|
<Button
|
|
58
56
|
title='No Thanks'
|
|
59
57
|
style={{flex:1}}
|
|
60
|
-
|
|
61
|
-
title_color={Colors.shades.white}
|
|
62
|
-
backgroundColor={Colors.utility.error}
|
|
58
|
+
type='error'
|
|
63
59
|
onPress={() => onClose()}
|
|
64
60
|
/>
|
|
65
61
|
<Button
|
|
66
62
|
title='Request Claim'
|
|
67
63
|
style={{flex:2, marginLeft:5, opacity:loading?0.5:1}}
|
|
68
|
-
|
|
64
|
+
type='success'
|
|
69
65
|
disabled={loading}
|
|
70
|
-
title_color={Colors.shades.white}
|
|
71
|
-
backgroundColor={Colors.utility.success}
|
|
72
66
|
onPress={() => handleClaimPodcast()}
|
|
73
67
|
/>
|
|
74
68
|
</View>
|