diff options
| -rw-r--r-- | db.json | 4 | ||||
| -rw-r--r-- | src/graph.js | 5 | ||||
| -rw-r--r-- | src/utils/index.js | 20 | ||||
| -rw-r--r-- | src/views/Clock.js | 3 | ||||
| -rw-r--r-- | src/views/Detail.js | 10 | ||||
| -rw-r--r-- | src/views/Gallery.js | 3 |
6 files changed, 27 insertions, 18 deletions
@@ -1846,8 +1846,8 @@ "type": "jpg" } ], - "citation": "<b>
</b>1961<br>\nDocument <br>\n21.5 x 27.9<br>\nCourtesy the United Nations <br>\nIn 1625, Hugo Grotius collected the thoughts of his predecessors together with his own to publish <i>On the Law of War and Peace</i>, which earned him the colloquial title of the father of International Law. Grotius essentially proposed that international society should be governed by mutual agreements and laws rather than by the force of warfare. A key concept in the manuscript is the idea of exterritoriality—or diplomatic immunity—for ambassadors while travelling in foreign states. It follows that, if the role of the ambassador is to maintain clear communication—especially during trying situations—the means of communication must also be clear, and confidential, between the ambassador abroad and the sovereign home state. Various acts and statutes have attempted to legalize reciprocal understanding between nations, but current law is based upon the Vienna Convention on Diplomatic Relations, ratified in 1961 by the member states of the United Nations. Article 27 of the treaty outlines, in purposefully vague terms, the inviolability of the diplomatic bag, which must not be opened nor delayed, as an essential component of healthy international relations. While not explicitly stated in the treaty, it is almost universally acknowledged that x-raying such a bag would violate the intention of the law, and so as a general rule is not conducted. A year after discovering painting <i>no6092</i>, the second world war interrupted Anthony Blunt’s academic life. Among Blunt’s portfolio of tasks as a spy during the war was the development and management of espionage unit Operation XXX, or TripleX. It would seem Blunt shifted his analysis of pouches-in-paintings to the analysis of pouches-in-politics. Blunt’s XXX program devised a method for the secret interception of diplomatic pouches, which are supposed to have immunity from police and Custom officers’ search and seizure rights while in transit. <br>\n", - "description": "", + "citation": "<b>
</b>1961<br>\nDocument <br>\n21.5 x 27.9<br>\nCourtesy the United Nations <br>\n", + "description": "<p>\nIn 1625, Hugo Grotius collected the thoughts of his predecessors together with his own to publish <i>On the Law of War and Peace</i>, which earned him the colloquial title of the father of International Law. Grotius essentially proposed that international society should be governed by mutual agreements and laws rather than by the force of warfare. A key concept in the manuscript is the idea of exterritoriality—or diplomatic immunity—for ambassadors while travelling in foreign states. It follows that, if the role of the ambassador is to maintain clear communication—especially during trying situations—the means of communication must also be clear, and confidential, between the ambassador abroad and the sovereign home state. Various acts and statutes have attempted to legalize reciprocal understanding between nations, but current law is based upon the Vienna Convention on Diplomatic Relations, ratified in 1961 by the member states of the United Nations. Article 27 of the treaty outlines, in purposefully vague terms, the inviolability of the diplomatic bag, which must not be opened nor delayed, as an essential component of healthy international relations. While not explicitly stated in the treaty, it is almost universally acknowledged that x-raying such a bag would violate the intention of the law, and so as a general rule is not conducted. A year after discovering painting <i>no6092</i>, the second world war interrupted Anthony Blunt’s academic life. Among Blunt’s portfolio of tasks as a spy during the war was the development and management of espionage unit Operation XXX, or TripleX. It would seem Blunt shifted his analysis of pouches-in-paintings to the analysis of pouches-in-politics. Blunt’s XXX program devised a method for the secret interception of diplomatic pouches, which are supposed to have immunity from police and Custom officers’ search and seizure rights while in transit. \n</p>\n\n", "author": "UNITED NATIONS ", "thumbnail": { "uri": "assets/data_store/47-UN/47-UN-thumb.jpg", diff --git a/src/graph.js b/src/graph.js index 3a0e8a1..7381f49 100644 --- a/src/graph.js +++ b/src/graph.js @@ -2,6 +2,7 @@ import * as THREE from "three"; import ForceGraph3D from "3d-force-graph"; import SpriteText from "three-spritetext"; import { union } from "./utils/set_utils.js"; +import { randint, choice, pad } from "./utils/index.js"; const IMG_SCALE = 16; const MAIN_IMG_SCALE = 80; @@ -20,7 +21,7 @@ export default function buildGraph({ db, objects, handlers }) { db.page.forEach((item, index) => { const node = { - title: index + 1 + " " + item.title, + title: pad(index + 1) + " " + item.title, id: index, data: item, groups: [], @@ -210,6 +211,4 @@ export default function buildGraph({ db, objects, handlers }) { // stars(); } -const randint = (limit) => Math.floor(Math.random() * limit); -const choice = (list) => list[randint(list.length)]; const commonGroups = (a, b) => union(a.groups, b.groups); diff --git a/src/utils/index.js b/src/utils/index.js new file mode 100644 index 0000000..ee9dae9 --- /dev/null +++ b/src/utils/index.js @@ -0,0 +1,20 @@ +/** + * Utility functions + */ + +export const rand = (n) => Math.random() * n; +export const randint = (limit) => Math.floor(Math.random() * limit); +export const choice = (list) => list[randint(list.length)]; + +export const mod = (n, m) => n - m * Math.floor(n / m); + +export const pad = (value) => (value < 10 ? "0" + value : value); + +export const capitalizeWord = (text = "") => + text ? text.charAt(0).toUpperCase() + text.slice(1) : ""; + +export const capitalize = (text = "") => + String(text || "") + .split(" ") + .map(capitalizeWord) + .join(" "); diff --git a/src/views/Clock.js b/src/views/Clock.js index a394b62..fe5039a 100644 --- a/src/views/Clock.js +++ b/src/views/Clock.js @@ -3,6 +3,7 @@ */ import React, { useState, useEffect } from "react"; +import { rand } from "../utils/index.js"; const clock = { width: "20vw", @@ -104,5 +105,3 @@ export default function Clock({ utc }) { // hour transform origin: 40 x 515 // 88 / 533 // minute transform origin: 37 x 622 // 72 x 740 // second transform origin: 11 x 751 // 24 x 980 - -const rand = (n) => Math.random() * n; diff --git a/src/views/Detail.js b/src/views/Detail.js index b1c4dcf..70f4561 100644 --- a/src/views/Detail.js +++ b/src/views/Detail.js @@ -7,6 +7,7 @@ import React from "react"; import Gallery from "./Gallery.js"; import Clocks from "./Clocks.js"; import Vimeo from "@u-wave/react-vimeo"; +import { pad } from "../utils/index.js"; export default function Detail({ node, visible, onClose }) { if (!node) { @@ -59,12 +60,3 @@ export default function Detail({ node, visible, onClose }) { </div> ); } - -const pad = (value) => (value < 10 ? "0" + value : value); -const capitalizeWord = (text = "") => - text ? text.charAt(0).toUpperCase() + text.slice(1) : ""; -const capitalize = (text = "") => - String(text || "") - .split(" ") - .map(capitalizeWord) - .join(" "); diff --git a/src/views/Gallery.js b/src/views/Gallery.js index c2bd62d..ec1b234 100644 --- a/src/views/Gallery.js +++ b/src/views/Gallery.js @@ -3,6 +3,7 @@ */ import React, { useState, useEffect } from "react"; +import { mod } from "../utils/index.js"; export default function Gallery({ images, visible }) { const hasItems = !!images?.length; @@ -71,5 +72,3 @@ export default function Gallery({ images, visible }) { </div> ); } - -const mod = (n, m) => n - m * Math.floor(n / m); |
