Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add photo album download #2568

Merged
merged 1 commit into from
Mar 24, 2022
Merged

Add photo album download #2568

merged 1 commit into from
Mar 24, 2022

Conversation

celinaryholt
Copy link
Contributor

@celinaryholt celinaryholt commented Mar 20, 2022

Closes webkom/lego#2066

I made it possible to download an entire photo album instead of having to download each photo one by one.

image

Copy link
Contributor

@erlingfn erlingfn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! This creates a useful feature, and this code implements it well. Just a little nitpick.

@@ -30,7 +33,7 @@ export function fetch(
},
propagateError: true,
})
);
).then(() => SelectGalleryPicturesByGalleryId(getState(), { galleryId }));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be moved into the downloadNext function inside Gallerydetail, as it is only useful for that call, and is unnecessary for the other uses of fetch.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I was not able to move the selector to GalleryDetail, as this component does not have access to getState(). But I have now changed it to use the existing pictures prop instead, as this seems to be in sync.
In addition, I have added a gallery clear action. This is because the image URLs expire one minute after retrieval. So if the user has had the page open for longer than this, the download will fail for the already fetched images. Let me know if this is a suitable solution.

Copy link
Member

@LudvigHz LudvigHz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 💯
This looks very good!

Ideally, we would do this on the server, both to offload the client, save on bandwidth to S3, and be able to cache the archive.

I think this a nice addition in any case, but IMO we should move this functionality to the backend in the future if we merge this.

@LudvigHz LudvigHz requested a review from erlingfn March 23, 2022 22:13
Copy link
Contributor

@erlingfn erlingfn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Agree that we should ideally have this in the backend, yet it is better to have it implemented here than to not have it implemented at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Functionality for downloading an entire album
3 participants