Skip to content

Commit

Permalink
feat: Show success message when observations export finishes (#622)
Browse files Browse the repository at this point in the history
  • Loading branch information
achou11 authored Nov 9, 2021
1 parent c9c3382 commit 0713c5b
Show file tree
Hide file tree
Showing 8 changed files with 274 additions and 175 deletions.
52 changes: 30 additions & 22 deletions messages/renderer/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,62 +155,70 @@
"renderer.components.MapEditor.index.notes": {
"message": "Description"
},
"renderer.components.MapFilter.DataExportDialog.cancel": {
"renderer.components.MapFilter.DataExportDialog.ExportDetailsForm.cancel": {
"description": "cancel button",
"message": "Cancel"
},
"renderer.components.MapFilter.DataExportDialog.close": {
"description": "Close button (shown if user has no data to export)",
"message": "Close"
},
"renderer.components.MapFilter.DataExportDialog.defaultExportFilename": {
"renderer.components.MapFilter.DataExportDialog.ExportDetailsForm.defaultExportFilename": {
"description": "Default filename for exported data",
"message": "mapeo-observation-data"
},
"renderer.components.MapFilter.DataExportDialog.exportAll": {
"renderer.components.MapFilter.DataExportDialog.ExportDetailsForm.exportAll": {
"message": "All {count} observations"
},
"renderer.components.MapFilter.DataExportDialog.exportFiltered": {
"renderer.components.MapFilter.DataExportDialog.ExportDetailsForm.exportFiltered": {
"message": "{count} filtered observations"
},
"renderer.components.MapFilter.DataExportDialog.filteredOrAll": {
"renderer.components.MapFilter.DataExportDialog.ExportDetailsForm.filteredOrAll": {
"description": "Label for select to export all data or only filtered",
"message": "Only filtered data or all data?"
},
"renderer.components.MapFilter.DataExportDialog.format": {
"renderer.components.MapFilter.DataExportDialog.ExportDetailsForm.format": {
"description": "Label for data format selector",
"message": "Data format"
},
"renderer.components.MapFilter.DataExportDialog.includePhotos": {
"renderer.components.MapFilter.DataExportDialog.ExportDetailsForm.includePhotos": {
"description": "Label for select to include photos in export",
"message": "Also export photos?"
},
"renderer.components.MapFilter.DataExportDialog.includePhotosHint": {
"renderer.components.MapFilter.DataExportDialog.ExportDetailsForm.includePhotosHint": {
"description": "Hint shown when user has selected photos to be included in the export",
"message": "Export will be a zip file including data and photos"
},
"renderer.components.MapFilter.DataExportDialog.includePhotosNone": {
"renderer.components.MapFilter.DataExportDialog.ExportDetailsForm.includePhotosNone": {
"description": "Label for select option to include no photos in export",
"message": "No Photos"
},
"renderer.components.MapFilter.DataExportDialog.includePhotosOriginal": {
"renderer.components.MapFilter.DataExportDialog.ExportDetailsForm.includePhotosOriginal": {
"description": "Label for select option to include full size photos in export",
"message": "Full size photos"
},
"renderer.components.MapFilter.DataExportDialog.includePhotosPreview": {
"renderer.components.MapFilter.DataExportDialog.ExportDetailsForm.includePhotosPreview": {
"description": "Label for select option to include preview size photos in export",
"message": "Preview size photos"
},
"renderer.components.MapFilter.DataExportDialog.noData": {
"description": "Shown when there is no data to export",
"message": "You don't yet have any data to export."
},
"renderer.components.MapFilter.DataExportDialog.save": {
"renderer.components.MapFilter.DataExportDialog.ExportDetailsForm.save": {
"description": "Save button",
"message": "Save"
},
"renderer.components.MapFilter.DataExportDialog.title": {
"description": "Title for webmaps export dialog",
"renderer.components.MapFilter.DataExportDialog.ExportDetailsForm.title": {
"description": "Title for export dialog",
"message": "Export Observations"
},
"renderer.components.MapFilter.DataExportDialog.ExportSuccessful.exportSuccessful": {
"message": "Successfully exported observations."
},
"renderer.components.MapFilter.DataExportDialog.ExportSuccessful.exportSuccessfulButton": {
"message": "OK"
},
"renderer.components.MapFilter.DataExportDialog.NoData.close": {
"message": "Close"
},
"renderer.components.MapFilter.DataExportDialog.NoData.noData": {
"message": "You don't yet have any data to export."
},
"renderer.components.MapFilter.DataExportDialog.Template.title": {
"description": "Title for observations export dialog",
"message": "Export Observations"
},
"renderer.components.MapFilter.ExportButton.exportButton": {
Expand Down
30 changes: 30 additions & 0 deletions src/renderer/components/MapFilter/DataExportDialog/Content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react'

import { ExportDetailsForm } from './ExportDetailsForm'
import { ExportSuccessful } from './ExportSuccessful'
import { NoData } from './NoData'

export const Content = ({
allObservations,
filteredObservations,
getMediaUrl,
onClose
}) => {
const [showExportSuccess, setShowExportSuccess] = React.useState(false)

const noData = allObservations.length === 0

return noData ? (
<NoData onClose={onClose} />
) : showExportSuccess ? (
<ExportSuccessful onClose={onClose} />
) : (
<ExportDetailsForm
allObservations={allObservations}
filteredObservations={filteredObservations}
getMediaUrl={getMediaUrl}
onClose={onClose}
onSuccess={() => setShowExportSuccess(true)}
/>
)
}
Loading

0 comments on commit 0713c5b

Please sign in to comment.