diff --git a/flake.nix b/flake.nix index 1ed812b..1b9b626 100644 --- a/flake.nix +++ b/flake.nix @@ -111,6 +111,14 @@ ''; }; 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 = diff --git a/map-desktop/src/api/listItems.ts b/map-desktop/src/api/listItems.ts index 5a4db7c..e045c69 100644 --- a/map-desktop/src/api/listItems.ts +++ b/map-desktop/src/api/listItems.ts @@ -23,7 +23,8 @@ export class GeoLocation { } const longitude = parseFloat(longitudeString); 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; if (timeString === null) { throw new Error('Missing time'); @@ -54,7 +55,8 @@ export class TrackedItem { if (id === null) { 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) { throw new Error('Missing name'); }