ctucx.git: trainsearch

web based trip-planner, fork of https://cyberchaos.dev/yuka/trainsearch

commit bbfeeb681f1aeba2268430fd0119aefc4ddac946
parent 711fa3649f66384b06be7ff11c34f51038f3f081
Author: Yureka <yuka@yuka.dev>
Date: Mon, 23 Dec 2024 12:10:58 +0100

fix modals
3 files changed, 4 insertions(+), 37 deletions(-)
M
src/helpers.js
|
35
-----------------------------------
M
src/journeyView.js
|
3
++-
M
src/tripView.js
|
3
++-
diff --git a/src/helpers.js b/src/helpers.js
@@ -1,6 +1,3 @@
-import { html } from 'lit-html';
-import { settings } from './settings.js';
-
 export const ElementById = (id) => {
 	return document.getElementById(id);
 };

@@ -138,35 +135,3 @@ export const lineAdditionalName = (line) => {
 export const lineDisplayName = (line) => {
 	return line?.name || line?.operator?.name || "???";
 };
-export const remarksModalTemplate = (type, remarks) => html`
-	<table class="remarks">
-		${remarks.map(element => html`
-			<tr>
-			<td>
-				<span class="remark icon-${type}"></span>
-				<span>${element.text}</span>
-			</td>
-			</tr>
-		`)}
-	</table>
-`;
-
-export const travelynxTemplate = (element) => {
-	if (settings.travelynx && element.line && element.line.mode === 'train') {
-		const trainName = lineAdditionalName(element.line) || element.line?.name;
-
-		if (trainName) {
-			return html`
-				<a class="link icon-travelynx" href="https://travelynx.de/s/${element.origin.id}?train=${encodeURIComponent(trainName)}"></a>
-			`;
-		}
-	}
-};
-
-export const showRemarksModal = (type, remarks) => {
-	showModal(t('remarks'), remarksModalTemplate(type, remarks));
-};
-export const remarksTemplate = ([type, remarks]) => !!remarks.length ? html`
-	<a class="link icon-${type}" @click=${() => showRemarksModal(type, remarks)}></a>
-` : '';
-
diff --git a/src/journeyView.js b/src/journeyView.js
@@ -1,6 +1,7 @@
 import { cachedCoachSequence } from './reihung';
 import { settings } from './settings.js';
-import { showDiv, hideDiv, ElementById, formatDateTime, formatDuration, formatPrice, formatTrainTypes, lineAdditionalName, lineDisplayName, remarksTemplate, travelynxTemplate } from './helpers.js';
+import { remarksTemplate, travelynxTemplate } from './templates.js';
+import { showDiv, hideDiv, ElementById, formatDateTime, formatDuration, formatPrice, formatTrainTypes, lineAdditionalName, lineDisplayName } from './helpers.js';
 import { ConsoleLog, parseName, t, timeTemplate, getJourney, refreshJourney, platformTemplate, stopTemplate } from './app_functions.js';
 import { showAlertModal, showLoader, hideOverlay, showModal } from './overlays.js';
 import { go } from './router.js';
diff --git a/src/tripView.js b/src/tripView.js
@@ -1,5 +1,6 @@
 import { settings } from './settings.js';
-import { showDiv, hideDiv, ElementById, formatDateTime, formatDuration, formatPrice, remarksTemplate, travelynxTemplate, lineAdditionalName, lineDisplayName } from './helpers.js';
+import { remarksTemplate, travelynxTemplate } from './templates.js';
+import { showDiv, hideDiv, ElementById, formatDateTime, formatDuration, formatPrice, lineAdditionalName, lineDisplayName } from './helpers.js';
 import { ConsoleLog, parseName, t, timeTemplate, processLeg, platformTemplate, stopTemplate } from './app_functions.js';
 import { showAlertModal, showLoader, hideOverlay, showModal } from './overlays.js';
 import { go } from './router.js';