diff --git a/frontend/.env.expand b/frontend/.env.expand index 93b6e9df93..58cf2498ab 100644 --- a/frontend/.env.expand +++ b/frontend/.env.expand @@ -44,3 +44,4 @@ REACT_APP_ENVIRONMENT=$TM_ENVIRONMENT REACT_APP_TM_DEFAULT_CHANGESET_COMMENT=$TM_DEFAULT_CHANGESET_COMMENT REACT_APP_RAPID_EDITOR_URL=$RAPID_EDITOR_URL REACT_APP_EXPORT_TOOL_S3_URL=$EXPORT_TOOL_S3_URL +REACT_APP_ENABLE_EXPORT_TOOL=$ENABLE_EXPORT_TOOL diff --git a/frontend/src/components/projectDetail/downloadOsmData.js b/frontend/src/components/projectDetail/downloadOsmData.js index 350f9d2dc8..f6cf249d5a 100644 --- a/frontend/src/components/projectDetail/downloadOsmData.js +++ b/frontend/src/components/projectDetail/downloadOsmData.js @@ -3,6 +3,8 @@ import { RoadIcon, HomeIcon, WavesIcon, TaskIcon, AsteriskIcon } from '../svgIco import FileFormatCard from './fileFormatCard'; import Popup from 'reactjs-popup'; import { EXPORT_TOOL_S3_URL } from '../../config'; +import messages from './messages'; +import { FormattedMessage } from 'react-intl'; export const TITLED_ICONS = [ { Icon: RoadIcon, title: 'roads', value: 'ROADS' }, @@ -47,9 +49,6 @@ export const DownloadOsmData = ({ projectMappingTypes, project }) => { // Check if the request was successful if (response.ok) { - // Set the state to indicate that the file download is complete - setIsDownloadingState({ title: title, fileFormat: fileFormat, isDownloading: false }); - // Get the file data as a blob const blob = await response.blob(); @@ -66,6 +65,8 @@ export const DownloadOsmData = ({ projectMappingTypes, project }) => { document.body.appendChild(link); link.click(); document.body.removeChild(link); + // Set the state to indicate that the file download is complete + setIsDownloadingState({ title: title, fileFormat: fileFormat, isDownloading: false }); } else { // Show a popup and throw an error if the request was not successful setShowPopup(true); @@ -87,7 +88,12 @@ export const DownloadOsmData = ({ projectMappingTypes, project }) => { setShowPopup(false)}> {(close) => (
-

Data Not Available.

+

+ +

+

+ +

{/* Download OSM Data section Start */} - -
- - - -

- -

- -
+ {/* Converted String to Integer */} + {+ENABLE_EXPORT_TOOL === 1 && ( +
+ + + +

+ +

+ +
+ )} {/* Download OSM Data section End */} diff --git a/frontend/src/components/projectDetail/messages.js b/frontend/src/components/projectDetail/messages.js index 72009a3d17..cd457852c4 100644 --- a/frontend/src/components/projectDetail/messages.js +++ b/frontend/src/components/projectDetail/messages.js @@ -227,6 +227,15 @@ export default defineMessages({ id: 'project.detail.sections.downloadOsmData', defaultMessage: 'Download OSM Data', }, + errorDownloadOsmData: { + id: 'project.detail.sections.errorDownloadOsmData', + defaultMessage: 'Data Extraction Unavailable', + }, + errorDownloadOsmDataDescription: { + id: 'project.detail.sections.errorDownloadOsmDataDescription', + defaultMessage: + 'The data extract you are attempting to download is currently inactive or unavailable. Please ensure that the extract is active and try again later.', + }, viewInOsmcha: { id: 'project.detail.sections.contributions.osmcha', defaultMessage: 'Changesets in OSMCha', diff --git a/frontend/src/config/index.js b/frontend/src/config/index.js index 16348cf611..343f7c3171 100644 --- a/frontend/src/config/index.js +++ b/frontend/src/config/index.js @@ -60,6 +60,7 @@ export const POTLATCH2_EDITOR_URL = export const RAPID_EDITOR_URL = process.env.REACT_APP_RAPID_EDITOR_URL || 'https://mapwith.ai/rapid'; export const EXPORT_TOOL_S3_URL = process.env.REACT_APP_EXPORT_TOOL_S3_URL || ''; +export const ENABLE_EXPORT_TOOL = process.env.REACT_APP_ENABLE_EXPORT_TOOL || ''; export const TASK_COLOURS = { READY: '#fff',