@@ -23,7 +23,10 @@ import Header from '../../../Components/UIComp/Header';
2323import { goBack } from '../../../Navigation/NavigationService' ;
2424import GalleryImage from './GalleryImage' ;
2525import VerticalView from './VerticalView' ;
26- import { downloadComicBook , showRewardedAd } from '../../../InkNest-Externals/Redux/Actions/Download' ;
26+ import {
27+ downloadComicBook ,
28+ showRewardedAd ,
29+ } from '../../../InkNest-Externals/Redux/Actions/Download' ;
2730import { updateData , setScrollPreference } from '../../../Redux/Reducers' ;
2831import { handleScrollModeChange } from '../../../Utils/ScrollModeUtils' ;
2932import { NAVIGATION } from '../../../Constants' ;
@@ -51,10 +54,14 @@ export function ComicBook({navigation, route}) {
5154
5255 const loading = useSelector ( state => state ?. data ?. loading ) ;
5356 const error = useSelector ( state => state ?. data ?. error ) ;
54- const userScrollPreference = useSelector ( state => state ?. data ?. scrollPreference ) ;
57+ const userScrollPreference = useSelector (
58+ state => state ?. data ?. scrollPreference ,
59+ ) ;
5560
5661 const [ imageLinkIndex , setImageLinkIndex ] = useState ( 0 ) ;
57- const [ isVerticalScroll , setIsVerticalScroll ] = useState ( userScrollPreference === 'vertical' ) ;
62+ const [ isVerticalScroll , setIsVerticalScroll ] = useState (
63+ userScrollPreference === 'vertical' ,
64+ ) ;
5865 const [ isModalVisible , setIsModalVisible ] = useState ( false ) ;
5966 const [ downloadLoading , setDownloadLoading ] = useState ( false ) ;
6067 const [ progress , setProgress ] = useState ( { downloaded : 0 , total : 0 } ) ;
@@ -174,7 +181,11 @@ export function ComicBook({navigation, route}) {
174181
175182 if ( loading ) {
176183 return (
177- < SafeAreaView style = { styles . container } >
184+ < SafeAreaView
185+ style = { [
186+ styles . container ,
187+ { justifyContent : 'center' , alignItems : 'center' } ,
188+ ] } >
178189 < Text style = { styles . text } > Loading comic data...</ Text >
179190 </ SafeAreaView >
180191 ) ;
@@ -183,22 +194,98 @@ export function ComicBook({navigation, route}) {
183194 if ( error ) {
184195 return (
185196 < SafeAreaView style = { styles . container } >
186- < Text style = { styles . text } > Error: { error } </ Text >
197+ < Header
198+ style = { {
199+ width : '100%' ,
200+ height : heightPercentageToDP ( '4%' ) ,
201+ flexDirection : 'row' ,
202+ justifyContent : 'space-between' ,
203+ alignItems : 'center' ,
204+ paddingHorizontal : 12 ,
205+ } } >
206+ < TouchableOpacity
207+ onPress = { ( ) => {
208+ analytics ( ) . logEvent ( 'go_back_error' , {
209+ screen : 'ComicBook' ,
210+ comicBookLink : comicBookLink ?. toString ( ) ,
211+ DetailsPageLink : detailsPageLink ?. toString ( ) ,
212+ } ) ;
213+ goBack ( ) ;
214+ } } >
215+ < Ionicons
216+ name = "arrow-back"
217+ size = { 24 }
218+ color = "#fff"
219+ style = { { marginRight : 10 , opacity : 0.9 } }
220+ />
221+ </ TouchableOpacity >
222+ < Text
223+ style = { {
224+ fontSize : 14 ,
225+ fontWeight : '700' ,
226+ color : '#fff' ,
227+ opacity : 0.9 ,
228+ } } >
229+ Comic Book
230+ </ Text >
231+ < View style = { { flex : 0.1 } } />
232+ </ Header >
233+ < View style = { { flex : 1 , justifyContent : 'center' , alignItems : 'center' } } >
234+ < Text style = { styles . text } > Error: { error } </ Text >
235+ </ View >
187236 </ SafeAreaView >
188237 ) ;
189238 }
190239
191- if ( ! comicBook ) {
240+ if ( ! comicBook ?. images ?. length > 0 ) {
192241 return (
193242 < SafeAreaView style = { styles . container } >
194- < Text style = { styles . text } > No data available</ Text >
243+ < Header
244+ style = { {
245+ width : '100%' ,
246+ height : heightPercentageToDP ( '4%' ) ,
247+ flexDirection : 'row' ,
248+ justifyContent : 'space-between' ,
249+ alignItems : 'center' ,
250+ paddingHorizontal : 12 ,
251+ } } >
252+ < TouchableOpacity
253+ onPress = { ( ) => {
254+ analytics ( ) . logEvent ( 'go_back_nodata' , {
255+ screen : 'ComicBook' ,
256+ comicBookLink : comicBookLink ?. toString ( ) ,
257+ DetailsPageLink : detailsPageLink ?. toString ( ) ,
258+ } ) ;
259+ goBack ( ) ;
260+ } } >
261+ < Ionicons
262+ name = "arrow-back"
263+ size = { 24 }
264+ color = "#fff"
265+ style = { { marginRight : 10 , opacity : 0.9 } }
266+ />
267+ </ TouchableOpacity >
268+ < Text
269+ style = { {
270+ fontSize : 14 ,
271+ fontWeight : '700' ,
272+ color : '#fff' ,
273+ opacity : 0.9 ,
274+ } } >
275+ Comic Book
276+ </ Text >
277+ < View style = { { flex : 0.1 } } />
278+ </ Header >
279+ < View style = { { flex : 1 , justifyContent : 'center' , alignItems : 'center' } } >
280+ < Text style = { styles . text } > No data available</ Text >
281+ </ View >
195282 </ SafeAreaView >
196283 ) ;
197284 }
198285
199286 return (
200287 < >
201- < SafeAreaView style = { { flex : 1 , backgroundColor : '#14142A' } } >
288+ < SafeAreaView style = { styles . container } >
202289 < Header
203290 style = { {
204291 width : '100%' ,
@@ -243,7 +330,7 @@ export function ComicBook({navigation, route}) {
243330 color : '#fff' ,
244331 opacity : 0.9 ,
245332 } } >
246- Page: { imageLinkIndex + 1 } / { comicBook ?. images . length }
333+ Page: { imageLinkIndex + 1 } / { comicBook ?. images ? .length }
247334 </ Text >
248335
249336 < TouchableOpacity onPress = { ( ) => setIsModalVisible ( true ) } >
@@ -321,7 +408,7 @@ export function ComicBook({navigation, route}) {
321408 setScrollPreference ,
322409 ( ) => setIsModalVisible ( false ) ,
323410 'ComicBook' ,
324- comicBookLink
411+ comicBookLink ,
325412 ) ;
326413 } } >
327414 < Text style = { styles . text } >
@@ -494,8 +581,6 @@ const styles = StyleSheet.create({
494581 container : {
495582 flex : 1 ,
496583 backgroundColor : '#14142A' ,
497- justifyContent : 'center' ,
498- alignItems : 'center' ,
499584 } ,
500585 text : {
501586 fontSize : 20 ,
0 commit comments