@@ -89,64 +89,73 @@ class Verse extends Component {
89
89
const array = match || verse . translations || [ ] ;
90
90
91
91
return array . map ( translation => (
92
- < Translation translation = { translation } index = { translation . id } key = { translation . id } />
92
+ < Translation
93
+ translation = { translation }
94
+ index = { translation . id }
95
+ key = { translation . id }
96
+ />
93
97
) ) ;
94
98
}
95
99
96
100
renderMedia ( ) {
97
- const { verse, mediaActions, isSearched } = this . props ;
101
+ const { verse, mediaActions, isSearched, isPdf } = this . props ;
98
102
99
103
if ( isSearched || ! verse . mediaContents ) return false ;
104
+ if ( isPdf ) return false ;
100
105
101
106
return (
102
107
< div >
103
- {
104
- verse . mediaContents . map ( ( content , index ) => (
105
- < div
106
- className = { `${ styles . translation } translation` }
107
- key = { index }
108
- >
109
- < h2 className = "text-translation times-new" >
110
- < small >
111
- < a
112
- tabIndex = "-1"
113
- className = "pointer"
114
- onClick = { ( ) => mediaActions . setMedia ( content ) }
115
- data-metrics-event-name = "Media Click"
116
- data-metrics-media-content-url = { content . url }
117
- data-metrics-media-content-id = { content . id }
118
- data-metrics-media-content-verse-key = { verse . verseKey }
119
- >
120
- < LocaleFormattedMessage
121
- id = "verse.media.lectureFrom"
122
- defaultMessage = "Watch lecture by {from}"
123
- values = { { from : content . authorName } }
124
- />
125
- </ a >
126
- </ small >
127
- </ h2 >
128
- </ div >
129
- ) )
130
- }
108
+ { verse . mediaContents . map ( ( content , index ) => (
109
+ < div className = { `${ styles . translation } translation` } key = { index } >
110
+ < h2 className = "text-translation times-new" >
111
+ < small >
112
+ < a
113
+ tabIndex = "-1"
114
+ className = "pointer"
115
+ onClick = { ( ) => mediaActions . setMedia ( content ) }
116
+ data-metrics-event-name = "Media Click"
117
+ data-metrics-media-content-url = { content . url }
118
+ data-metrics-media-content-id = { content . id }
119
+ data-metrics-media-content-verse-key = { verse . verseKey }
120
+ >
121
+ < LocaleFormattedMessage
122
+ id = "verse.media.lectureFrom"
123
+ defaultMessage = "Watch lecture by {from}"
124
+ values = { { from : content . authorName } }
125
+ />
126
+ </ a >
127
+ </ small >
128
+ </ h2 >
129
+ </ div >
130
+ ) ) }
131
131
</ div >
132
132
) ;
133
133
}
134
134
135
135
renderText ( ) {
136
- const { verse, tooltip, currentVerse, isPlaying, audioActions, isSearched } = this . props ; // eslint-disable-line max-len
136
+ const {
137
+ verse,
138
+ tooltip,
139
+ currentVerse,
140
+ isPlaying,
141
+ audioActions,
142
+ isSearched
143
+ } = this . props ; // eslint-disable-line max-len
137
144
// NOTE: Some 'word's are glyphs (jeem). Not words and should not be clicked for audio
138
145
let wordAudioPosition = - 1 ;
139
146
const renderText = false ; // userAgent.isBot;
140
147
141
- const text = verse . words . map ( word => ( // eslint-disable-line
148
+ const text = verse . words . map ( ( word ) => ( // eslint-disable-line
142
149
< Word
143
150
word = { word }
144
151
key = { `${ word . position } -${ word . code } -${ word . lineNum } ` }
145
152
currentVerse = { currentVerse }
146
153
tooltip = { tooltip }
147
154
isPlaying = { isPlaying }
148
155
audioActions = { audioActions }
149
- audioPosition = { word . charType === 'word' ? wordAudioPosition += 1 : null }
156
+ audioPosition = {
157
+ word . charType === 'word' ? ( wordAudioPosition += 1 ) : null
158
+ }
150
159
isSearched = { isSearched }
151
160
useTextFont = { renderText }
152
161
/>
@@ -162,17 +171,22 @@ class Verse extends Component {
162
171
}
163
172
164
173
renderPlayLink ( ) {
165
- const { isSearched, verse, currentVerse, isPlaying } = this . props ;
174
+ const { isSearched, verse, currentVerse, isPlaying, isPdf } = this . props ;
166
175
const playing = verse . verseKey === currentVerse && isPlaying ;
167
176
177
+ if ( isPdf ) return false ;
178
+
168
179
if ( ! isSearched ) {
169
180
return (
170
181
< a
171
182
tabIndex = "-1"
172
183
onClick = { ( ) => this . handlePlay ( verse ) }
173
184
className = "text-muted"
174
185
>
175
- < i className = { `ss-icon ${ playing ? 'ss-pause' : 'ss-play' } vertical-align-middle` } /> { ' ' }
186
+ < i
187
+ className = { `ss-icon ${ playing ? 'ss-pause' : 'ss-play' } vertical-align-middle` }
188
+ />
189
+ { ' ' }
176
190
< LocaleFormattedMessage
177
191
id = { playing ? 'actions.pause' : 'actions.play' }
178
192
defaultMessage = { playing ? 'Pause' : 'Play' }
@@ -185,19 +199,25 @@ class Verse extends Component {
185
199
}
186
200
187
201
renderCopyLink ( ) {
188
- const { isSearched, verse } = this . props ;
202
+ const { isSearched, verse, isPdf } = this . props ;
203
+
204
+ if ( isPdf ) return false ;
189
205
190
206
if ( ! isSearched ) {
191
- return (
192
- < Copy text = { verse . textMadani } verseKey = { verse . verseKey } />
193
- ) ;
207
+ return < Copy text = { verse . textMadani } verseKey = { verse . verseKey } /> ;
194
208
}
195
209
196
210
return false ;
197
211
}
198
212
199
213
renderBookmark ( ) {
200
- const { verse, bookmarked, isAuthenticated, bookmarkActions, isSearched } = this . props ;
214
+ const {
215
+ verse,
216
+ bookmarked,
217
+ isAuthenticated,
218
+ bookmarkActions,
219
+ isSearched
220
+ } = this . props ;
201
221
202
222
if ( isSearched || ! isAuthenticated ) return false ;
203
223
@@ -226,10 +246,7 @@ class Verse extends Component {
226
246
className = "text-muted"
227
247
>
228
248
< i className = "ss-icon ss-bookmark vertical-align-middle" /> { ' ' }
229
- < LocaleFormattedMessage
230
- id = "verse.bookmark"
231
- defaultMessage = "Bookmark"
232
- />
249
+ < LocaleFormattedMessage id = "verse.bookmark" defaultMessage = "Bookmark" />
233
250
</ a >
234
251
) ;
235
252
}
@@ -271,13 +288,15 @@ class Verse extends Component {
271
288
}
272
289
273
290
renderControls ( ) {
291
+ const { isPdf } = this . props ;
292
+
274
293
return (
275
294
< div className = { `col-md-1 col-sm-1 ${ styles . controls } ` } >
276
295
{ this . renderAyahBadge ( ) }
277
296
{ this . renderPlayLink ( ) }
278
297
{ this . renderCopyLink ( ) }
279
298
{ this . renderBookmark ( ) }
280
- { this . renderShare ( ) }
299
+ { ! isPdf && this . renderShare ( ) }
281
300
</ div >
282
301
) ;
283
302
}
@@ -319,12 +338,14 @@ Verse.propTypes = {
319
338
currentVerse : PropTypes . string ,
320
339
userAgent : PropTypes . object , // eslint-disable-line
321
340
audio : PropTypes . number . isRequired ,
322
- loadAudio : PropTypes . func . isRequired
341
+ loadAudio : PropTypes . func . isRequired ,
342
+ isPdf : PropTypes . bool
323
343
} ;
324
344
325
345
Verse . defaultProps = {
326
346
currentWord : null ,
327
- isSearched : false
347
+ isSearched : false ,
348
+ isPdf : false
328
349
} ;
329
350
330
351
export default connect ( ( ) => ( { } ) , { loadAudio } ) ( Verse ) ;
0 commit comments