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

feat(tupaiaWeb): RN-1403: Export images from visuals #5911

Merged
merged 13 commits into from
Oct 23, 2024
Merged

Conversation

alexd-bes
Copy link
Contributor

@alexd-bes alexd-bes commented Sep 18, 2024

Issue RN-1403: Export images from visuals

Changes:

  • Add support for export of images from multi photograph visuals

Screenshots:

Screenshot 2024-09-19 at 10 43 50 AM

Screenshot 2024-09-19 at 10 44 33 AM

import { useDashboard } from '../../../Dashboard';
import { useDownloadImages } from './useDownloadImages';
import { ExportIconButton } from '../../../EnlargedDashboardItem';
import { SmallAlert } from '@tupaia/ui-components';
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be above the local imports

images: ViewReport['data'],
) => {
return useMutation(
['images', projectCode, entityCode, dashboardCode, reportCode],
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you really need a mutation key, right?

async () => {
return Promise.all(
images?.map(photo => {
return fetch(photo.value, {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we use async await syntax instead?

onSuccess: async fetchedImages => {
if (!fetchedImages?.length) return;
// if there is only one image, download it directly
if (fetchedImages.length === 1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nice idea just returning the file if there is just one download

Copy link
Contributor

@tcaiger tcaiger left a comment

Choose a reason for hiding this comment

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

Nice one!

avaek and others added 4 commits October 7, 2024 08:51
merge: update branch with latest dev
merge: update branch with latest dev before testing
merge: update branch with latest dev
@tcaiger tcaiger merged commit 6dbf3b9 into dev Oct 23, 2024
44 checks passed
@tcaiger tcaiger deleted the rn-1403-export-images branch October 23, 2024 20:19
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.

3 participants