From ae08a64284fdbab812355f0cfbffc0a8fa4ec68e Mon Sep 17 00:00:00 2001 From: Spythere Date: Wed, 2 Mar 2022 22:36:06 +0100 Subject: [PATCH] =?UTF-8?q?Dodano=20wsparcie=20dla=20szlak=C3=B3w=20wewn?= =?UTF-8?q?=C4=99trznych?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/scripts/interfaces/StationRoutes.ts | 6 ++++-- src/store/index.ts | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/scripts/interfaces/StationRoutes.ts b/src/scripts/interfaces/StationRoutes.ts index 662329a..6defae2 100644 --- a/src/scripts/interfaces/StationRoutes.ts +++ b/src/scripts/interfaces/StationRoutes.ts @@ -4,14 +4,16 @@ export default interface StationRoutes { name: string; catenary: boolean; SBL: boolean; - TWB: boolean + TWB: boolean; + isInternal: boolean; }[]; twoWay: { name: string; catenary: boolean; SBL: boolean; - TWB: boolean + TWB: boolean; + isInternal: boolean; }[]; /* [catenary, noCatenary] */ diff --git a/src/store/index.ts b/src/store/index.ts index 36e3c6d..d7ba59f 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -346,13 +346,15 @@ export const store = createStore({ generalInfo: { ...stationData, routes: stationData.routes?.split(";").filter(routeString => routeString).reduce((acc, routeString) => { - const name = routeString.split("_")[0]; - const specs = routeString.split("_")[1].split(""); + const specs1 = routeString.split("_")[0]; + const isInternal = specs1.startsWith('!'); + const name = isInternal ? specs1.replace("!", "") : specs1; - const twoWay = specs[0] == "2"; - const catenary = specs[1] == "E"; - const SBL = specs[2] == "S"; - const TWB = specs[3] ? true : false; + const specs2 = routeString.split("_")[1].split(""); + const twoWay = specs2[0] == "2"; + const catenary = specs2[1] == "E"; + const SBL = specs2[2] == "S"; + const TWB = specs2[3] ? true : false; const propName = twoWay ? catenary @@ -362,8 +364,8 @@ export const store = createStore({ ? 'oneWayCatenaryRouteNames' : 'oneWayNoCatenaryRouteNames'; - acc[twoWay ? 'twoWay' : 'oneWay'].push({ name, SBL, TWB, catenary }); - acc[propName].push(name); + acc[twoWay ? 'twoWay' : 'oneWay'].push({ name, SBL, TWB, catenary, isInternal }); + if(!isInternal) acc[propName].push(name); if (SBL) acc['sblRouteNames'].push(name);