From 8f76e9607529cbe01a9d4b2091b0af63da882dfe Mon Sep 17 00:00:00 2001 From: Miguel Sozinho Ramalho <19508417+msramalho@users.noreply.github.com> Date: Thu, 7 Dec 2023 16:58:26 +0000 Subject: [PATCH] adds copiable API link (#79) --- README.md | 1 + src/components/controls/DownloadButton.jsx | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d3cb080..49854ce 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ Read Bellingcat's article about this project in ## Deployment This project is now living in github pages and the API has switched to auto-updated S3 files. +Access it at https://bellingcat-embeds.ams3.cdn.digitaloceanspaces.com/production/ukr/timemap/api.json Release with `npm run deploy`. diff --git a/src/components/controls/DownloadButton.jsx b/src/components/controls/DownloadButton.jsx index c02929f..17c20c0 100644 --- a/src/components/controls/DownloadButton.jsx +++ b/src/components/controls/DownloadButton.jsx @@ -9,6 +9,7 @@ export class DownloadButton extends Component { onDownload(format, domain) { let filename = `ukr-civharm-${dayjs().format("YYYY-MM-DD")}`; if (format === "api") { + console.log(config["API_DATA"]) window.open(config["API_DATA"], '_blank'); }else if (format === "csv") { let outputData = this.getCsvData(domain); @@ -68,6 +69,14 @@ export class DownloadButton extends Component { render() { const { language, domain, format } = this.props; const textByFormat = copy[language].toolbar.download.panel.formats[format]; + + let description = {textByFormat.description}; + + if(format=='api'){ + const endpoint = config["API_DATA"]; + description = {textByFormat.description} Copy API endpoint link from here. + } + return (
{"download"} {textByFormat.label} - {textByFormat.description} + {description}
); }