diff --git a/config.js b/config.js index cf8e78a..511701a 100755 --- a/config.js +++ b/config.js @@ -3,10 +3,11 @@ const one_day = 1440; const config = { title: "ukraine", display_title: "Civilian Harm\nin Ukraine", - SERVER_ROOT: "https://ukraine.bellingcat.com/ukraine-server", - EVENTS_EXT: "/api/ukraine/export_events/deeprows", - SOURCES_EXT: "/api/ukraine/export_sources/deepids", - ASSOCIATIONS_EXT: "/api/ukraine/export_associations/deeprows", + SERVER_ROOT: "https://bellingcat-embeds.ams3.cdn.digitaloceanspaces.com/production/ukr", + EVENTS_EXT: "/timemap/events.json", + SOURCES_EXT: "/timemap/sources.json", + ASSOCIATIONS_EXT: "/timemap/associations.json", + API_DATA: "https://bellingcat-embeds.ams3.cdn.digitaloceanspaces.com/production/ukr/timemap/api.json", MAPBOX_TOKEN: "pk.eyJ1IjoiYmVsbGluZ2NhdC1tYXBib3giLCJhIjoiY2tleW0wbWliMDA1cTJ5bzdkbTRraHgwZSJ9.GJQkjPzj8554VhR5SPsfJg", // MEDIA_EXT: "/api/media", @@ -38,7 +39,7 @@ const config = { { label: "Zoom to 1 month", duration: 31 * one_day }, { label: "Zoom to 6 months", duration: 6 * 31 * one_day }, { label: "Zoom to 1 year", duration: 12 * 31 * one_day }, - { label: "Zoom to 1.5 years", duration: 18 * 31 * one_day }, + { label: "Zoom to 2 years", duration: 24 * 31 * one_day }, ], range: { /** diff --git a/package.json b/package.json index f268fb6..4e049db 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "scripts": { "dev": "vite", "build": "vite build", + "preview": "vite preview", "dev:wsl": "vite --host", "test": "vitest", "eslint": "eslint src --ext jsx", diff --git a/src/common/data/copy.json b/src/common/data/copy.json index eac9782..d36377c 100644 --- a/src/common/data/copy.json +++ b/src/common/data/copy.json @@ -214,6 +214,10 @@ "title": "Download events", "description": "Export the most recent available events in different formats.", "formats": { + "api": { + "label": "API", + "description": "An API endpoint where you can always fetch the entire dataset in JSON format with tools like curl. Useful for integrating the data in other services and visualizaitons." + }, "csv": { "label": "CSV", "description": "CSV file where sources and filters are concatenated into a single column each due to data structure limitations." diff --git a/src/components/controls/DownloadButton.jsx b/src/components/controls/DownloadButton.jsx index a5cb12e..c02929f 100644 --- a/src/components/controls/DownloadButton.jsx +++ b/src/components/controls/DownloadButton.jsx @@ -3,11 +3,14 @@ import dayjs from "dayjs"; import { Parser } from "@json2csv/plainjs"; import copy from "../../common/data/copy.json"; import { downloadAsFile } from "../../common/utilities"; +import config from "../../../config"; export class DownloadButton extends Component { onDownload(format, domain) { let filename = `ukr-civharm-${dayjs().format("YYYY-MM-DD")}`; - if (format === "csv") { + if (format === "api") { + window.open(config["API_DATA"], '_blank'); + }else if (format === "csv") { let outputData = this.getCsvData(domain); downloadAsFile(`${filename}.csv`, outputData); } else if (format === "json") { diff --git a/src/components/controls/DownloadPanel.jsx b/src/components/controls/DownloadPanel.jsx index c679749..e956a8b 100644 --- a/src/components/controls/DownloadPanel.jsx +++ b/src/components/controls/DownloadPanel.jsx @@ -13,6 +13,7 @@ const DownloadPanel = ({ language, title, description, domain }) => { }} />