build map webapp

This commit is contained in:
Morten Delenk 2022-08-22 14:21:49 +01:00
parent 0c95c7b2e9
commit 503824167e
No known key found for this signature in database
GPG key ID: 5130416C797067B6
2 changed files with 12 additions and 2 deletions

View file

@ -111,6 +111,14 @@
''; '';
}; };
invtracker-docs = pkgs.callPackage ./doc.nix { inherit self texlive-env; }; invtracker-docs = pkgs.callPackage ./doc.nix { inherit self texlive-env; };
invtracker-web = pkgs.mkYarnPackage rec {
pname = "invtracker-web";
version = self.lastModifiedDate;
src = "${self}/map-desktop";
yarnLock = "${self}/map-desktop/yarn.lock";
buildPhase = "yarn run build";
installPhase = "cp -rv dist $out";
};
}; };
hydraJobs = hydraJobs =

View file

@ -23,7 +23,8 @@ export class GeoLocation {
} }
const longitude = parseFloat(longitudeString); const longitude = parseFloat(longitudeString);
const altitudeNode = node.getElementsByTagName('alt')[0]; const altitudeNode = node.getElementsByTagName('alt')[0];
const altitude = altitudeNode !== undefined ? parseFloat(altitudeNode.textContent) : null; const altitudeText = altitudeNode === null ? null : altitudeNode.textContent;
const altitude = altitudeText !== null ? parseFloat(altitudeText) : null;
const timeString = node.getElementsByTagName('time')[0].textContent; const timeString = node.getElementsByTagName('time')[0].textContent;
if (timeString === null) { if (timeString === null) {
throw new Error('Missing time'); throw new Error('Missing time');
@ -54,7 +55,8 @@ export class TrackedItem {
if (id === null) { if (id === null) {
throw new Error('Missing id'); throw new Error('Missing id');
} }
const nameNode = node.getElementsByTagName('name')[0].textContent; const nameNode = node.getElementsByTagName('name')[0];
const name = nameNode === null ? null : nameNode.textContent;
if (name === null) { if (name === null) {
throw new Error('Missing name'); throw new Error('Missing name');
} }