Skip to content

Commit

Permalink
Add Gazetteer implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
dokempf committed Jul 25, 2024
1 parent 569d6c3 commit 0c8bb78
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
55 changes: 55 additions & 0 deletions src/components/fields/CustomDataTypeGazetteer.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<script>
import { dataLanguagesStore } from "../../lib/stores";
import { fieldData } from "../../lib/easydbHelpers";
import { A } from "flowbite-svelte";
import { ArrowUpRightFromSquareOutline } from "flowbite-svelte-icons";
export let data;
export let table;
export let field;
const fdata = fieldData(data, table, field);
const l10n = {
"populated-place": {
"de-DE": "Bewohnter Ort"
},
"administrative-unit": {
"de-DE": "Verwaltungseinheit"
},
"archaeological-site": {
"de-DE": "Archäologischer Ort"
},
"archaeological-area": {
"de-DE": "Archäologischer Bereich"
},
"continent": {
"de-DE": "Kontinent"
},
"building-institution": {
"de-DE": "Standort/Institution"
},
"landform": {
"de-DE": "Landform"
},
"hydrography": {
"de-DE": "Hydrographie"
}
};
function detailString() {
if ((fdata.length === 0) || (!$dataLanguagesStore.includes("de-DE"))) {
return "";
}
return `(${fdata.types.map((t) => l10n[t]["de-DE"]).join(", ")})`;
}
console.log(fdata);
</script>


{fdata.displayName} {detailString()}
<A href={"https://gazetteer.dainst.org/app/#!/show/" + fdata.gazId}>
<ArrowUpRightFromSquareOutline class="w-4 h-4"/>
</A>
2 changes: 2 additions & 0 deletions src/components/logic/FieldDispatch.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Import our field components
import Boolean from "../fields/Boolean.svelte";
import CustomDataTypeGazetteer from "../fields/CustomDataTypeGazetteer.svelte";
import CustomDataTypeGeonames from "../fields/CustomDataTypeGeonames.svelte";
import CustomDataTypeLink from "../fields/CustomDataTypeLink.svelte";
import CustomDataTypeUbhdgnd from "../fields/CustomDataTypeUBHDGND.svelte";
Expand All @@ -29,6 +30,7 @@
const componentMapping = {
"boolean": Boolean,
"custom:base.custom-data-type-gazetteer.gazetteer": CustomDataTypeGazetteer,
"custom:base.custom-data-type-geonames.geonames": CustomDataTypeGeonames,
"custom:base.custom-data-type-link.link": CustomDataTypeLink,
"custom:base.custom-data-type-ubhdgnd.ubhdgnd": CustomDataTypeUbhdgnd,
Expand Down

0 comments on commit 0c8bb78

Please sign in to comment.