Skip to content

Commit e6b6de4

Browse files
committed
show nag notice if contact/location is missing
original commit 152d7c69a9a918443ca9191f199dbffdf2e282bd reworked for current meshviewer
1 parent 9606fad commit e6b6de4

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

lib/config_default.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { LanguageCode } from "./utils/language.js";
22
import { Node, NodeId } from "./utils/node.js";
33
import { GeoJSONOptions, GridLayerOptions, LatLngBoundsExpression } from "leaflet";
44
import { GeoJsonObject } from "geojson";
5+
import { h } from "snabbdom";
56

67
interface NodeAttr {
78
name: string;
@@ -212,6 +213,16 @@ export const config: Config = {
212213
name: "node.coordinates",
213214
value: "GeoURI",
214215
},
216+
{
217+
name: "node.contact",
218+
value: function (d) {
219+
if (d.owner) {
220+
return d.owner;
221+
} else {
222+
return h("span", { props: { className: "missing" } }, "keine Kontaktinformation hinterlegt");
223+
}
224+
}
225+
},
215226
{
216227
name: "node.hardware",
217228
value: "model",

lib/utils/node.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ self.showStatus = function showStatus(node: Node) {
103103

104104
self.showGeoURI = function showGeoURI(data: Node) {
105105
if (!helper.hasLocation(data)) {
106-
return undefined;
106+
return h(
107+
"td",
108+
{ props: { className: "missing" } },
109+
"kein Standort hinterlegt"
110+
);
107111
}
108112

109113
return h(

scss/modules/_sidebar.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,8 @@
152152
.offline {
153153
color: variables.$color-offline;
154154
}
155+
156+
.missing {
157+
color: variables.$color-offline;
158+
font-style: italic;
159+
}

0 commit comments

Comments
 (0)