Skip to content

Commit 22f084b

Browse files
committed
show nag notice if contact/location is missing
original commit 152d7c69a9a918443ca9191f199dbffdf2e282bd reworked for current meshviewer
1 parent f9e9f8c commit 22f084b

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

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;
@@ -208,6 +209,16 @@ export const config: Config = {
208209
name: "node.coordinates",
209210
value: "GeoURI",
210211
},
212+
{
213+
name: "node.contact",
214+
value: function (d) {
215+
if (d.owner) {
216+
return d.owner;
217+
} else {
218+
return h("span", { props: { className: "missing" } }, "keine Kontaktinformation hinterlegt");
219+
}
220+
}
221+
},
211222
{
212223
name: "node.hardware",
213224
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
@@ -148,3 +148,8 @@
148148
.offline {
149149
color: $color-offline;
150150
}
151+
152+
.missing {
153+
color: $color-offline;
154+
font-style: italic;
155+
}

0 commit comments

Comments
 (0)