From ac8f923d924310b437a153cae5a6bbc618fb451d Mon Sep 17 00:00:00 2001 From: SumanthBA Date: Fri, 13 Sep 2019 12:21:41 +0530 Subject: [PATCH] lazy loading handled --- src/components/galleryPage/galleryPage.jsx | 21 +++++++++++++++------ src/routes.jsx | 3 ++- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/components/galleryPage/galleryPage.jsx b/src/components/galleryPage/galleryPage.jsx index 292b7f8..5c1e195 100644 --- a/src/components/galleryPage/galleryPage.jsx +++ b/src/components/galleryPage/galleryPage.jsx @@ -4,13 +4,22 @@ import urlConstructor from '../../scripts/urlConstructor'; import $ from "jquery"; -let lazyloadImages = $("img"); -let lazyloadThrottleTimeout; - class GalleryPage extends Component{ - getPhotos = (photos) =>{ + getPhotos = (photos , currentPage) =>{ + + if(currentPage === 1){ + return photos.map( item => { + let photoUrl = urlConstructor.getPhotoUrl(item.farm, item.server, item.id, item.secret, 'b'); + + return( + + ); + }); + } + + return photos.map( item => { let photoUrl = urlConstructor.getPhotoUrl(item.farm, item.server, item.id, item.secret, 'b'); let smallUrl = urlConstructor.getPhotoUrl(item.farm, item.server, item.id, item.secret, 's'); @@ -32,10 +41,10 @@ class GalleryPage extends Component{ } }); - const {photos} = this.props; + const {currentPage, photos} = this.props; return(
- { this.getPhotos(photos) } + { this.getPhotos(photos, currentPage) }
); } diff --git a/src/routes.jsx b/src/routes.jsx index bc2fc1d..88981cf 100644 --- a/src/routes.jsx +++ b/src/routes.jsx @@ -47,6 +47,7 @@ class Routes extends Component{ render(){ const {groups, isfetching } = this.props.groupsPage; + return( {/*{ this.state.showModal ? :
}*/} @@ -55,7 +56,7 @@ class Routes extends Component{
{ - ( Object.keys(groups).length > 0 && !isfetching) + ( Object.keys(groups).length > 0 && !isfetching && window.location.pathname !== "/groups/gallery" ) ?