feat(ui): endless gallery scroll

This commit is contained in:
psychedelicious 2023-05-05 10:56:27 +10:00
parent b0557aa16b
commit 350ffecc1f

View File

@ -170,6 +170,14 @@ const ImageGalleryContent = () => {
} }
}, []); }, []);
const handleEndReached = useCallback(() => {
if (currentCategory === 'results') {
dispatch(receivedResultImagesPage());
} else if (currentCategory === 'uploads') {
dispatch(receivedUploadImagesPage());
}
}, [dispatch, currentCategory]);
return ( return (
<Flex flexDirection="column" w="full" h="full" gap={4}> <Flex flexDirection="column" w="full" h="full" gap={4}>
<Flex <Flex
@ -310,6 +318,7 @@ const ImageGalleryContent = () => {
<VirtuosoGrid <VirtuosoGrid
style={{ height: '100%' }} style={{ height: '100%' }}
data={images} data={images}
endReached={handleEndReached}
components={{ components={{
Item: ItemContainer, Item: ItemContainer,
List: ListContainer, List: ListContainer,