From 745d31e44a4d11ffdac38b6a43c699cd9362643a Mon Sep 17 00:00:00 2001
From: izawartka <59137928+izawartka@users.noreply.github.com>
Date: Fri, 11 Jul 2025 01:42:17 +0200
Subject: [PATCH] Added on-hover switches info
+TrackHoverInfoPopup now displays switch ID and model if the hovered track is part of a switch
*Fixed typo: renamed the "Switches names" layer to "Switch names"
---
.../map/track-hover-info/TrackHoverInfoPopup.js | 13 ++++++++++++-
src/helpers/constants.js | 3 +--
src/model/switch.js | 1 +
3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/components/map/track-hover-info/TrackHoverInfoPopup.js b/src/components/map/track-hover-info/TrackHoverInfoPopup.js
index 7d96871..8d17120 100644
--- a/src/components/map/track-hover-info/TrackHoverInfoPopup.js
+++ b/src/components/map/track-hover-info/TrackHoverInfoPopup.js
@@ -20,12 +20,23 @@ export default function TrackHoverInfoPopup(props) {
+
);
}
+function InfoPopupSwitchItems(props) {
+ const { track } = props;
+ if (!track.switch) return null;
+
+ return <>
+
+
+ >
+}
+
function processItemValue(value, options) {
const { translationConstKey, join, subOptions, suffix } = options || {};
@@ -37,7 +48,7 @@ function processItemValue(value, options) {
return TrackHoverInfoConsts[translationConstKey]?.[value] || value;
}
- if (!value) {
+ if (value === undefined || value === null || value === '') {
return "N/A";
}
diff --git a/src/helpers/constants.js b/src/helpers/constants.js
index bdce374..5665913 100644
--- a/src/helpers/constants.js
+++ b/src/helpers/constants.js
@@ -70,12 +70,11 @@ const Constants = {
},
{
id: 'switches-names',
- name: 'Switches names',
+ name: 'Switch names',
default: false,
},
{
id: 'isolations-ids',
- name: 'Isolations IDs',
name: 'Isolations',
default: false,
},
diff --git a/src/model/switch.js b/src/model/switch.js
index f0a898a..b19cc39 100644
--- a/src/model/switch.js
+++ b/src/model/switch.js
@@ -7,6 +7,7 @@ import Constants from "../helpers/constants.js";
export default class Switch extends SceneryObject {
model;
+ bare_model;
data;
id_isolation;
id_switch;