Add station data and parser for the script.

Need to do:
 - Write the StationIfno modal and enable toggling it's display.
This commit is contained in:
2026-03-11 17:26:57 +00:00
parent 904942e078
commit 11ec2574f0
24 changed files with 410 additions and 283 deletions

View File

@@ -1,7 +1,7 @@
<script lang="ts">
import { components } from '$lib/mapRegistry';
import type { ElecType } from '$lib/railStyles';
import { IconArrowNarrowRight } from '@tabler/icons-svelte';
import { IconArrowNarrowRight, IconInfoCircle } from '@tabler/icons-svelte';
type featureType = "station" | "junction" | "crossovers" | "siteof" | "bridge" | "minorBridge" | "crossover" | "crossing" | "loop" | "loops" | "signallerChange" | "electrificationChange" | "default" | "tunnel";
export let feature: {name: string; type: featureType; goto?: string; entryPoint?: string; miles: number; chains: number; description?: string}; // Raw Object
@@ -13,9 +13,14 @@
// Linking Logic
$: isLinkable = !!(feature.goto && feature.entryPoint);
$: href = `/map/${feature.goto}#${feature.entryPoint}`;
$: stationInfo = (feature.type === "station" && feature.stationInfo && feature.crs);
const slugify = (str?: string) =>
str?.toLocaleLowerCase().trim().replace(/\s+/g, '-') ?? 'unknown';
function stationInfo(crs) {
console.log(`Date requested for CRS: ${crs}`)
}
</script>
<div class="row-container" id={slugify(feature.name)}>
@@ -37,6 +42,12 @@
<div class="feature-desc">{feature.description}</div>
{/if}
</div>
{#if stationInfo}
<div class="link-indicator" on:click={stationInfo(feature.crs)}>
<IconInfoCircle />
</div>
{/if}
{#if isLinkable}
<div class="link-indicator">
<IconArrowNarrowRight />