-
Notifications
You must be signed in to change notification settings - Fork 7
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
Conversation
import { useDashboard } from '../../../Dashboard'; | ||
import { useDownloadImages } from './useDownloadImages'; | ||
import { ExportIconButton } from '../../../EnlargedDashboardItem'; | ||
import { SmallAlert } from '@tupaia/ui-components'; |
There was a problem hiding this comment.
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], |
There was a problem hiding this comment.
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, { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one!
merge: update branch with latest dev
merge: update branch with latest dev before testing
merge: update branch with latest dev
Issue RN-1403: Export images from visuals
Changes:
Screenshots: