@@ -81,7 +81,8 @@ type DispatchProps = {
81
81
type ReduxProps = {
82
82
getYaksInProgress : boolean ,
83
83
currentYakIds : { byTime : number [ ] , byScore : number [ ] } ,
84
- yakMap : { [ id : number ] : Yak }
84
+ yakMap : { [ id : number ] : Yak } ,
85
+ canBeActiveInScenes : boolean
85
86
} ;
86
87
87
88
type SortOption = 'score' | 'time' ;
@@ -101,11 +102,14 @@ type State = {
101
102
selectedYakId : null | number
102
103
} ;
103
104
104
- function mapStateToProps ( { yaks } : ReduxState ) : ReduxProps {
105
+ function mapStateToProps ( { yaks, client } : ReduxState ) : ReduxProps {
105
106
const { inProgress, byId, currentYakIds } = yaks ;
106
107
const currentYakIdsGreaterThan5 = currentYakIds . filter (
107
108
id => byId [ id ] . score > - 5
108
109
) ;
110
+ if ( ! client ) {
111
+ throw new Error ( 'Redux Client is null in Yak List' ) ;
112
+ }
109
113
return {
110
114
getYaksInProgress : inProgress . get ,
111
115
currentYakIds : {
@@ -118,7 +122,8 @@ function mapStateToProps({ yaks }: ReduxState): ReduxProps {
118
122
return 0 ;
119
123
} )
120
124
} ,
121
- yakMap : byId
125
+ yakMap : byId ,
126
+ canBeActiveInScenes : client . settings . canBeActiveInScenes
122
127
} ;
123
128
}
124
129
@@ -266,28 +271,68 @@ class YakListScreen extends React.Component<Props, State> {
266
271
currentYakIds,
267
272
navigation,
268
273
getYaksInProgress,
269
- getYaks
274
+ getYaks,
275
+ canBeActiveInScenes
270
276
} = this . props ;
271
- if ( ! yaksLoaded ) {
272
- return (
273
- < View
274
- style = { {
275
- flex : 1 ,
276
- alignContent : 'center' ,
277
- justifyContent : 'center'
278
- } }
277
+
278
+ const lockedAccountCopy =
279
+ 'Your account is currently locked. Please check your email for more information.' ;
280
+
281
+ const LockedBody = (
282
+ < View
283
+ style = { {
284
+ flex : 1 ,
285
+ paddingHorizontal : '10.1%' ,
286
+ alignContent : 'center' ,
287
+ justifyContent : 'center'
288
+ } }
289
+ >
290
+ < Text style = { [ textStyles . headline3Style , { textAlign : 'center' } ] } >
291
+ { '👀' }
292
+ </ Text >
293
+ < Text
294
+ style = { [
295
+ textStyles . subtitle1Style ,
296
+ {
297
+ textAlign : 'center' ,
298
+ color : Colors . Grapefruit
299
+ }
300
+ ] }
279
301
>
280
- < ActivityIndicator />
281
- </ View >
282
- ) ;
283
- }
302
+ { lockedAccountCopy }
303
+ </ Text >
304
+ </ View >
305
+ ) ;
306
+
307
+ const LoadingBody = (
308
+ < View
309
+ style = { {
310
+ flex : 1 ,
311
+ alignContent : 'center' ,
312
+ justifyContent : 'center'
313
+ } }
314
+ >
315
+ < ActivityIndicator />
316
+ </ View >
317
+ ) ;
318
+
284
319
const refreshComponent = (
285
320
< RefreshControl
286
321
refreshing = { refreshManuallyTriggered }
287
322
onRefresh = { this . _onRefresh }
288
323
/>
289
324
) ;
290
325
326
+ const TitleComponent = (
327
+ < Text style = { textStyles . headline5Style } >
328
+ { 'Jumbo' }
329
+ < Text style = { textStyles . headline5StyleDemibold } > { 'Yak' } </ Text >
330
+ </ Text >
331
+ ) ;
332
+ const Footer = (
333
+ < View style = { { height : NEW_ICON_HEIGHT + NEW_ICON_PADDING * 2 } } />
334
+ ) ;
335
+
291
336
const Header = (
292
337
< View
293
338
style = { {
@@ -323,14 +368,76 @@ class YakListScreen extends React.Component<Props, State> {
323
368
</ View >
324
369
) ;
325
370
326
- const TitleComponent = (
327
- < Text style = { textStyles . headline5Style } >
328
- { 'Jumbo' }
329
- < Text style = { textStyles . headline5StyleDemibold } > { 'Yak' } </ Text >
330
- </ Text >
331
- ) ;
332
- const Footer = (
333
- < View style = { { height : NEW_ICON_HEIGHT + NEW_ICON_PADDING * 2 } } />
371
+ const Body = (
372
+ < View style = { { flex : 1 } } >
373
+ < ImageBackground
374
+ source = { wavesFull }
375
+ style = { { width : '100%' , height : '100%' , position : 'absolute' } }
376
+ />
377
+ { Header }
378
+ < FlatList
379
+ ref = { ref => {
380
+ this . flatListRef = ref ;
381
+ } }
382
+ data = {
383
+ sortBy === 'time' ? currentYakIds . byTime : currentYakIds . byScore
384
+ }
385
+ renderItem = { ( { item : id } ) => {
386
+ return this . _renderYak ( id ) ;
387
+ } }
388
+ keyExtractor = { id => {
389
+ return `${ id } ` ;
390
+ } }
391
+ ItemSeparatorComponent = { this . _renderSeparator }
392
+ refreshControl = { refreshComponent }
393
+ ListFooterComponent = { Footer }
394
+ />
395
+ < View
396
+ style = { {
397
+ position : 'absolute' ,
398
+ right : 0 ,
399
+ bottom : 0 ,
400
+ padding : NEW_ICON_PADDING ,
401
+ justifyContent : 'center' ,
402
+ elevation : 1 ,
403
+ shadowColor : Colors . Black ,
404
+ shadowOpacity : 0.57 ,
405
+ shadowRadius : 2 ,
406
+ shadowOffset : {
407
+ height : 2 ,
408
+ width : 1
409
+ }
410
+ } }
411
+ >
412
+ < Animatable . View
413
+ animation = "swing"
414
+ easing = "ease-out"
415
+ iterationCount = "infinite"
416
+ iterationDelay = { 10000 }
417
+ delay = { 10000 }
418
+ >
419
+ < View
420
+ style = { {
421
+ width : NEW_ICON_HEIGHT ,
422
+ height : NEW_ICON_HEIGHT ,
423
+ backgroundColor : Colors . Grapefruit ,
424
+ borderRadius : NEW_ICON_HEIGHT ,
425
+ alignItems : 'center' ,
426
+ justifyContent : 'center'
427
+ } }
428
+ >
429
+ < CustomIcon
430
+ name = { 'pencil' }
431
+ color = { Colors . White }
432
+ size = { 30 }
433
+ onPress = { ( ) => {
434
+ navigation . navigate ( routes . YakNew ) ;
435
+ } }
436
+ />
437
+ </ View >
438
+ </ Animatable . View >
439
+ </ View >
440
+ </ View >
334
441
) ;
335
442
return (
336
443
< View style = { { flex : 1 } } >
@@ -359,75 +466,9 @@ class YakListScreen extends React.Component<Props, State> {
359
466
} }
360
467
centerComponent = { TitleComponent }
361
468
/>
362
- < View style = { { flex : 1 } } >
363
- < ImageBackground
364
- source = { wavesFull }
365
- style = { { width : '100%' , height : '100%' , position : 'absolute' } }
366
- />
367
- { Header }
368
- < FlatList
369
- ref = { ref => {
370
- this . flatListRef = ref ;
371
- } }
372
- data = {
373
- sortBy === 'time' ? currentYakIds . byTime : currentYakIds . byScore
374
- }
375
- renderItem = { ( { item : id } ) => {
376
- return this . _renderYak ( id ) ;
377
- } }
378
- keyExtractor = { id => {
379
- return `${ id } ` ;
380
- } }
381
- ItemSeparatorComponent = { this . _renderSeparator }
382
- refreshControl = { refreshComponent }
383
- ListFooterComponent = { Footer }
384
- />
385
- < View
386
- style = { {
387
- position : 'absolute' ,
388
- right : 0 ,
389
- bottom : 0 ,
390
- padding : NEW_ICON_PADDING ,
391
- justifyContent : 'center' ,
392
- elevation : 1 ,
393
- shadowColor : Colors . Black ,
394
- shadowOpacity : 0.57 ,
395
- shadowRadius : 2 ,
396
- shadowOffset : {
397
- height : 2 ,
398
- width : 1
399
- }
400
- } }
401
- >
402
- < Animatable . View
403
- animation = "swing"
404
- easing = "ease-out"
405
- iterationCount = "infinite"
406
- iterationDelay = { 10000 }
407
- delay = { 10000 }
408
- >
409
- < View
410
- style = { {
411
- width : NEW_ICON_HEIGHT ,
412
- height : NEW_ICON_HEIGHT ,
413
- backgroundColor : Colors . Grapefruit ,
414
- borderRadius : NEW_ICON_HEIGHT ,
415
- alignItems : 'center' ,
416
- justifyContent : 'center'
417
- } }
418
- >
419
- < CustomIcon
420
- name = { 'pencil' }
421
- color = { Colors . White }
422
- size = { 30 }
423
- onPress = { ( ) => {
424
- navigation . navigate ( routes . YakNew ) ;
425
- } }
426
- />
427
- </ View >
428
- </ Animatable . View >
429
- </ View >
430
- </ View >
469
+ { ! yaksLoaded && LoadingBody }
470
+ { yaksLoaded && ! canBeActiveInScenes && LockedBody }
471
+ { yaksLoaded && canBeActiveInScenes && Body }
431
472
{ this . _renderActionSheet ( ) }
432
473
{ this . _renderReportPopup ( ) }
433
474
</ View >
0 commit comments