adds copiable API link (#79)

This commit is contained in:
Miguel Sozinho Ramalho
2023-12-07 16:58:26 +00:00
committed by GitHub
parent e6a24297fc
commit 8f76e96075
2 changed files with 11 additions and 1 deletions

View File

@@ -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`.

View File

@@ -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 = <span className="download-description">{textByFormat.description}</span>;
if(format=='api'){
const endpoint = config["API_DATA"];
description = <span className="download-description">{textByFormat.description} <a href={endpoint}>Copy API endpoint link from here.</a></span>
}
return (
<div className="download-row">
<span
@@ -78,7 +87,7 @@ export class DownloadButton extends Component {
<i className="material-icons">{"download"}</i>
<span className="tab-caption">{textByFormat.label}</span>
</span>
<span className="download-description">{textByFormat.description}</span>
{description}
</div>
);
}