Run npm format
This commit is contained in:
@@ -5,12 +5,12 @@ import path from 'path';
|
|||||||
const inputDir = '../static/mapFiles/yaml';
|
const inputDir = '../static/mapFiles/yaml';
|
||||||
const outputDir = '../static/mapFiles/json';
|
const outputDir = '../static/mapFiles/json';
|
||||||
|
|
||||||
if (!fs.existsSync(outputDir)) fs.mkdirSync(outputDir, {recursive: true});
|
if (!fs.existsSync(outputDir)) fs.mkdirSync(outputDir, { recursive: true });
|
||||||
|
|
||||||
fs.readdirSync(inputDir).forEach(file => {
|
fs.readdirSync(inputDir).forEach((file) => {
|
||||||
if (file.endsWith('.yaml')) {
|
if (file.endsWith('.yaml')) {
|
||||||
const content = yaml.load(fs.readFileSync(path.join(inputDir, file), 'utf8'));
|
const content = yaml.load(fs.readFileSync(path.join(inputDir, file), 'utf8'));
|
||||||
const fileName = file.replace('.yaml', '.json');
|
const fileName = file.replace('.yaml', '.json');
|
||||||
fs.writeFileSync(path.join(outputDir, fileName), JSON.stringify(content));
|
fs.writeFileSync(path.join(outputDir, fileName), JSON.stringify(content));
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|||||||
@@ -2,7 +2,10 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
|
<meta
|
||||||
|
name="viewport"
|
||||||
|
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"
|
||||||
|
/>
|
||||||
%sveltekit.head%
|
%sveltekit.head%
|
||||||
</head>
|
</head>
|
||||||
<body data-sveltekit-preload-data="hover">
|
<body data-sveltekit-preload-data="hover">
|
||||||
|
|||||||
@@ -1,133 +1,128 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { components } from '$lib/mapRegistry';
|
import { components } from '$lib/mapRegistry';
|
||||||
|
|
||||||
export let feature: any; // Raw Object
|
export let feature: any; // Raw Object
|
||||||
export let activeElec: string; // Active Electrification Type
|
export let activeElec: string; // Active Electrification Type
|
||||||
export let reversed: boolean = false;
|
export let reversed: boolean = false;
|
||||||
|
|
||||||
$: Icon = components[feature.type] || components.default;
|
$: Icon = components[feature.type] || components.default;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="row-container">
|
<div class="row-container">
|
||||||
<div class="mileage-col">
|
<div class="mileage-col">
|
||||||
<span class="miles">{feature.miles + "m" || "" }</span>
|
<span class="miles">{feature.miles + 'm' || ''}</span>
|
||||||
<span class="chains">{feature.chains + "ch" || "" }</span>
|
<span class="chains">{feature.chains + 'ch' || ''}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="icon-col">
|
<div class="icon-col">
|
||||||
<svelte:component
|
<svelte:component this={Icon} {feature} {activeElec} {reversed} />
|
||||||
this={Icon}
|
</div>
|
||||||
{feature}
|
|
||||||
{activeElec}
|
|
||||||
{reversed}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="label-col">
|
<div class="label-col">
|
||||||
{#if feature.name}
|
{#if feature.name}
|
||||||
<div class="feature-name">{feature.name}</div>
|
<div class="feature-name">{feature.name}</div>
|
||||||
{/if}
|
{/if}
|
||||||
{#if feature.description}
|
{#if feature.description}
|
||||||
<div class="feature-desc">{feature.description}</div>
|
<div class="feature-desc">{feature.description}</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.row-container {
|
.row-container {
|
||||||
display: grid;
|
display: grid;
|
||||||
/* Balanced columns: 1fr on both sides keeps the 64px icon in the dead center */
|
/* Balanced columns: 1fr on both sides keeps the 64px icon in the dead center */
|
||||||
grid-template-columns: 3.5rem 64px 1fr;
|
grid-template-columns: 3.5rem 64px 1fr;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mileage-col {
|
.mileage-col {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
padding-right: 12px;
|
padding-right: 12px;
|
||||||
font-family: 'Courier New', Courier, monospace;
|
font-family: 'Courier New', Courier, monospace;
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
color: #64748b; /* Adjusted slightly for contrast */
|
color: #64748b; /* Adjusted slightly for contrast */
|
||||||
}
|
}
|
||||||
|
|
||||||
.miles {
|
.miles {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chains {
|
.chains {
|
||||||
font-size: 0.7rem;
|
font-size: 0.7rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-col {
|
.icon-col {
|
||||||
width: 64px;
|
width: 64px;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
/* Ensure the icon itself is centered if the SVG is smaller than 64px */
|
/* Ensure the icon itself is centered if the SVG is smaller than 64px */
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.label-col {
|
.label-col {
|
||||||
padding-left: 16px;
|
padding-left: 16px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
/* FIX: Allow children to manage their own wrapping */
|
/* FIX: Allow children to manage their own wrapping */
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
/* min-width: 0 is critical for flex children to allow truncation */
|
/* min-width: 0 is critical for flex children to allow truncation */
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.feature-name {
|
.feature-name {
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #1e293b;
|
color: #1e293b;
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
|
|
||||||
/* Allow the title to wrap naturally onto multiple lines */
|
/* Allow the title to wrap naturally onto multiple lines */
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.feature-desc {
|
.feature-desc {
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
-webkit-line-clamp: 2;
|
-webkit-line-clamp: 2;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
/* Firefox Fix: Ensure white-space is normal here too */
|
/* Firefox Fix: Ensure white-space is normal here too */
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
|
|
||||||
line-height: 1.2rem;
|
line-height: 1.2rem;
|
||||||
max-height: 2.4rem;
|
max-height: 2.4rem;
|
||||||
font-size: 0.75rem;
|
font-size: 0.75rem;
|
||||||
color: #64748b;
|
color: #64748b;
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tablet and Desktop scaling */
|
/* Tablet and Desktop scaling */
|
||||||
@media (min-width: 480px) {
|
@media (min-width: 480px) {
|
||||||
.feature-name {
|
.feature-name {
|
||||||
font-size: 1rem; /* The larger title you requested */
|
font-size: 1rem; /* The larger title you requested */
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.feature-desc {
|
.feature-desc {
|
||||||
font-size: 0.85rem; /* Slightly larger desc to match */
|
font-size: 0.85rem; /* Slightly larger desc to match */
|
||||||
line-height: 1.3rem;
|
line-height: 1.3rem;
|
||||||
max-height: 2.6rem;
|
max-height: 2.6rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.label-col {
|
.label-col {
|
||||||
padding-left: 24px; /* More "breathing room" on big screens */
|
padding-left: 24px; /* More "breathing room" on big screens */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,22 +1,27 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getElecColour, type ElecType } from '$lib/railStyles';
|
import { getElecColour, type ElecType } from '$lib/railStyles';
|
||||||
|
|
||||||
export let activeElec: ElecType = 'none';
|
export let activeElec: ElecType = 'none';
|
||||||
export let height: number = 64;
|
export let height: number = 64;
|
||||||
const width = 6;
|
const width = 6;
|
||||||
|
|
||||||
$: colour = getElecColour(activeElec);
|
$: colour = getElecColour(activeElec);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<line x1="32" y1="0" x2="32" y2={height}
|
<line
|
||||||
stroke={colour}
|
x1="32"
|
||||||
stroke-width={width}
|
y1="0"
|
||||||
stroke-linecap="butt" />
|
x2="32"
|
||||||
|
y2={height}
|
||||||
|
stroke={colour}
|
||||||
|
stroke-width={width}
|
||||||
|
stroke-linecap="butt"
|
||||||
|
/>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
svg{
|
svg {
|
||||||
display: block;
|
display: block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,74 +1,80 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import BaseTrack from '$lib/components/mapIcons/BaseTrack.svelte';
|
import BaseTrack from '$lib/components/mapIcons/BaseTrack.svelte';
|
||||||
|
|
||||||
export let feature: {
|
export let feature: {
|
||||||
position: 'over' | 'under';
|
position: 'over' | 'under';
|
||||||
category: 'rail' | 'footbridge' | 'aroad' | 'minorRoad' | 'motorway' | 'waterway';
|
category: 'rail' | 'footbridge' | 'aroad' | 'minorRoad' | 'motorway' | 'waterway';
|
||||||
roadName?: string;
|
roadName?: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
export let activeElec: string;
|
export let activeElec: string;
|
||||||
|
|
||||||
const bridgeStyles = {
|
const bridgeStyles = {
|
||||||
rail: { color: '#ffffff', stroke: '#000000', width: 20, text: '#000000'},
|
rail: { color: '#ffffff', stroke: '#000000', width: 20, text: '#000000' },
|
||||||
footbridge: { color: '#ffffff', stroke: '#475569', width: 10, text: '#475569' },
|
footbridge: { color: '#ffffff', stroke: '#475569', width: 10, text: '#475569' },
|
||||||
aroad: { color: '#00703c', stroke: '#004d29', width: 24, text: '#FFEB3B' },
|
aroad: { color: '#00703c', stroke: '#004d29', width: 24, text: '#FFEB3B' },
|
||||||
minorRoad: { color: '#ffffff', stroke: '#64748b', width: 20, text: '#334155' },
|
minorRoad: { color: '#ffffff', stroke: '#64748b', width: 20, text: '#334155' },
|
||||||
motorway: { color: '#005da1', stroke: '#003e6b', width: 32, text: '#ffffff' },
|
motorway: { color: '#005da1', stroke: '#003e6b', width: 32, text: '#ffffff' },
|
||||||
waterway: { color: '#bae6fd', stroke: '#0369a1', width: 24, text: '#075985' },
|
waterway: { color: '#bae6fd', stroke: '#0369a1', width: 24, text: '#075985' },
|
||||||
pipeline: { color: '#334155', stroke: '#1e293b', width: 4, text: '#334155'},
|
pipeline: { color: '#334155', stroke: '#1e293b', width: 4, text: '#334155' }
|
||||||
}
|
};
|
||||||
|
|
||||||
$: s = bridgeStyles[feature.category] || bridgeStyles.minorRoad;
|
$: s = bridgeStyles[feature.category] || bridgeStyles.minorRoad;
|
||||||
$: isOver = feature.position === 'over';
|
$: isOver = feature.position === 'over';
|
||||||
|
|
||||||
$: topY = 32 - (s.width / 2);
|
$: topY = 32 - s.width / 2;
|
||||||
$: bottomY = 32 + (s.width /2);
|
$: bottomY = 32 + s.width / 2;
|
||||||
|
|
||||||
$: topPath = `M 0 ${topY} Q 8 ${topY} 8 ${topY - 4} M 56 ${topY - 4} Q 56 ${topY} 64 ${topY}`;
|
$: topPath = `M 0 ${topY} Q 8 ${topY} 8 ${topY - 4} M 56 ${topY - 4} Q 56 ${topY} 64 ${topY}`;
|
||||||
$: bottomPath = `M 0 ${bottomY} Q 8 ${bottomY} 8 ${bottomY + 4} M 56 ${bottomY + 4} Q 56 ${bottomY} 64 ${bottomY}`;
|
$: bottomPath = `M 0 ${bottomY} Q 8 ${bottomY} 8 ${bottomY + 4} M 56 ${bottomY + 4} Q 56 ${bottomY} 64 ${bottomY}`;
|
||||||
|
|
||||||
$: bodyPath = `M 0 ${topY} L 64 ${topY} L 64 ${bottomY} L 0 ${bottomY} Z`;
|
$: bodyPath = `M 0 ${topY} L 64 ${topY} L 64 ${bottomY} L 0 ${bottomY} Z`;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svg viewBox="0 0 64 64" width="64" height="64" class="bridge">
|
<svg viewBox="0 0 64 64" width="64" height="64" class="bridge">
|
||||||
{#if !isOver}
|
{#if !isOver}
|
||||||
<path d={bodyPath} fill={s.color} />
|
<path d={bodyPath} fill={s.color} />
|
||||||
<path d={`M 0 ${topY} L 64 ${topY}`} stroke={s.stroke} stroke-width="2" />
|
<path d={`M 0 ${topY} L 64 ${topY}`} stroke={s.stroke} stroke-width="2" />
|
||||||
<path d={`M 0 ${bottomY} L 64 ${bottomY}`} stroke={s.stroke} stroke-width="2" />
|
<path d={`M 0 ${bottomY} L 64 ${bottomY}`} stroke={s.stroke} stroke-width="2" />
|
||||||
<BaseTrack {activeElec} height={64} />
|
<BaseTrack {activeElec} height={64} />
|
||||||
{:else}
|
{:else}
|
||||||
<BaseTrack {activeElec} height={64} />
|
<BaseTrack {activeElec} height={64} />
|
||||||
|
|
||||||
<path d={bodyPath} fill="white" /> <path d={bodyPath} fill={s.color} />
|
<path d={bodyPath} fill="white" /> <path d={bodyPath} fill={s.color} />
|
||||||
|
|
||||||
<g fill="none" stroke={s.stroke} stroke-width="2.5" stroke-linecap="round">
|
<g fill="none" stroke={s.stroke} stroke-width="2.5" stroke-linecap="round">
|
||||||
<path d={`M 0 ${topY} L 64 ${topY}`} />
|
<path d={`M 0 ${topY} L 64 ${topY}`} />
|
||||||
<path d={`M 0 ${bottomY} L 64 ${bottomY}`} />
|
<path d={`M 0 ${bottomY} L 64 ${bottomY}`} />
|
||||||
<path d={`M 0 ${topY} Q 4 ${topY} 4 ${topY-6}`} />
|
<path d={`M 0 ${topY} Q 4 ${topY} 4 ${topY - 6}`} />
|
||||||
<path d={`M 64 ${topY} Q 60 ${topY} 60 ${topY-6}`} />
|
<path d={`M 64 ${topY} Q 60 ${topY} 60 ${topY - 6}`} />
|
||||||
<path d={`M 0 ${bottomY} Q 4 ${bottomY} 4 ${bottomY+6}`} />
|
<path d={`M 0 ${bottomY} Q 4 ${bottomY} 4 ${bottomY + 6}`} />
|
||||||
<path d={`M 64 ${bottomY} Q 60 ${bottomY} 60 ${bottomY+6}`} />
|
<path d={`M 64 ${bottomY} Q 60 ${bottomY} 60 ${bottomY + 6}`} />
|
||||||
</g>
|
</g>
|
||||||
|
|
||||||
{#if feature.roadName}
|
{#if feature.roadName}
|
||||||
<text
|
<text
|
||||||
x="32" y="32"
|
x="32"
|
||||||
text-anchor="middle"
|
y="32"
|
||||||
dominant-baseline="central"
|
text-anchor="middle"
|
||||||
fill={s.text}
|
dominant-baseline="central"
|
||||||
font-family="sans-serif"
|
fill={s.text}
|
||||||
font-weight="bold"
|
font-family="sans-serif"
|
||||||
font-size={s.width > 20 ? "10" : "8"}
|
font-weight="bold"
|
||||||
style="pointer-events: none; text-transform: uppercase; letter-spacing: 0.5px;"
|
font-size={s.width > 20 ? '10' : '8'}
|
||||||
>
|
style="pointer-events: none; text-transform: uppercase; letter-spacing: 0.5px;"
|
||||||
{feature.roadName}
|
>
|
||||||
</text>
|
{feature.roadName}
|
||||||
{/if}
|
</text>
|
||||||
{/if}
|
{/if}
|
||||||
|
{/if}
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
svg { display: block; overflow: visible; }
|
svg {
|
||||||
text { user-select: none; }
|
display: block;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
text {
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,45 +1,57 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import BaseTrack from '$lib/components/mapIcons/BaseTrack.svelte';
|
import BaseTrack from '$lib/components/mapIcons/BaseTrack.svelte';
|
||||||
|
|
||||||
export let feature: {
|
export let feature: {
|
||||||
kind: 'uwc' | 'ahb' | 'mcb' | 'cctv' | 'tmo' | 'foot';
|
kind: 'uwc' | 'ahb' | 'mcb' | 'cctv' | 'tmo' | 'foot';
|
||||||
};
|
};
|
||||||
|
|
||||||
export let activeElec: any;
|
export let activeElec: any;
|
||||||
|
|
||||||
$: type = feature.kind.toLowerCase();
|
$: type = feature.kind.toLowerCase();
|
||||||
$: isFoot = type === 'foot';
|
$: isFoot = type === 'foot';
|
||||||
$: filterCategory = isFoot ? 'foot' : (type === 'uwc' ? 'uwc' : 'level-crossing');
|
$: filterCategory = isFoot ? 'foot' : type === 'uwc' ? 'uwc' : 'level-crossing';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svg viewBox="0 0 64 64" width="64" height="64" class={filterCategory}>
|
<svg viewBox="0 0 64 64" width="64" height="64" class={filterCategory}>
|
||||||
<BaseTrack {activeElec} height={64} />
|
<BaseTrack {activeElec} height={64} />
|
||||||
|
|
||||||
{#if type === 'foot'}
|
{#if type === 'foot'}
|
||||||
<line x1="12" y1="32" x2="52" y2="32" stroke="#475569" stroke-width="2" stroke-dasharray="4 2" />
|
<line
|
||||||
|
x1="12"
|
||||||
|
y1="32"
|
||||||
|
x2="52"
|
||||||
|
y2="32"
|
||||||
|
stroke="#475569"
|
||||||
|
stroke-width="2"
|
||||||
|
stroke-dasharray="4 2"
|
||||||
|
/>
|
||||||
|
{:else if type === 'uwc'}
|
||||||
|
<g stroke="#1e293b" stroke-width="3">
|
||||||
|
<line x1="12" y1="26" x2="26" y2="26" />
|
||||||
|
<line x1="38" y1="38" x2="52" y2="38" />
|
||||||
|
</g>
|
||||||
|
<text x="50" y="32" class="label-right">UWC</text>
|
||||||
|
{:else}
|
||||||
|
<rect x="18" y="22" width="28" height="20" rx="1" fill="#1e293b" />
|
||||||
|
|
||||||
{:else if type === 'uwc'}
|
<circle cx="25" cy="29" r="3.5" fill="#ef4444" />
|
||||||
<g stroke="#1e293b" stroke-width="3">
|
<circle cx="39" cy="29" r="3.5" fill="#ef4444" />
|
||||||
<line x1="12" y1="26" x2="26" y2="26" />
|
<circle cx="32" cy="37" r="3.5" fill="#ffcc00" />
|
||||||
<line x1="38" y1="38" x2="52" y2="38" />
|
<text x="50" y="32" class="label-right">{type.toUpperCase()}</text>
|
||||||
</g>
|
{/if}
|
||||||
<text x="50" y="32" class="label-right">UWC</text>
|
|
||||||
|
|
||||||
{:else}
|
|
||||||
<rect x="18" y="22" width="28" height="20" rx="1" fill="#1e293b" />
|
|
||||||
|
|
||||||
<circle cx="25" cy="29" r="3.5" fill="#ef4444" /> <circle cx="39" cy="29" r="3.5" fill="#ef4444" /> <circle cx="32" cy="37" r="3.5" fill="#ffcc00" /> <text x="50" y="32" class="label-right">{type.toUpperCase()}</text>
|
|
||||||
{/if}
|
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
svg { display: block; overflow: visible; }
|
svg {
|
||||||
.label-right {
|
display: block;
|
||||||
text-anchor: start; /* Align to the left of the start point */
|
overflow: visible;
|
||||||
dominant-baseline: central;
|
}
|
||||||
font-family: sans-serif;
|
.label-right {
|
||||||
font-weight: bold;
|
text-anchor: start; /* Align to the left of the start point */
|
||||||
font-size: 9px;
|
dominant-baseline: central;
|
||||||
fill: #1e293b;
|
font-family: sans-serif;
|
||||||
}
|
font-weight: bold;
|
||||||
|
font-size: 9px;
|
||||||
|
fill: #1e293b;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getElecColour } from '$lib/railStyles';
|
import { getElecColour } from '$lib/railStyles';
|
||||||
import BaseTrack from '$lib/components/mapIcons/BaseTrack.svelte';
|
import BaseTrack from '$lib/components/mapIcons/BaseTrack.svelte';
|
||||||
|
|
||||||
export let activeElec: any;
|
export let activeElec: any;
|
||||||
export let features: any;
|
export let features: any;
|
||||||
|
|
||||||
$: branchColour = getElecColour(features?.elecBranch || activeElec);
|
$: branchColour = getElecColour(features?.elecBranch || activeElec);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svg viewBox="0 0 64 64" width="64" height="64" class="crossover">
|
<svg viewBox="0 0 64 64" width="64" height="64" class="crossover">
|
||||||
<g stroke={branchColour} stroke-width="3" stroke-linecap="round">
|
<g stroke={branchColour} stroke-width="3" stroke-linecap="round">
|
||||||
<line x1="16" y1="44" x2="48" y2="12" />
|
<line x1="16" y1="44" x2="48" y2="12" />
|
||||||
<line x1="16" y1="52" x2="48" y2="20" />
|
<line x1="16" y1="52" x2="48" y2="20" />
|
||||||
</g>
|
</g>
|
||||||
|
|
||||||
<BaseTrack {activeElec} height={64} />
|
<BaseTrack {activeElec} height={64} />
|
||||||
</svg>
|
</svg>
|
||||||
@@ -1,49 +1,59 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getElecColour } from '$lib/railStyles';
|
import { getElecColour } from '$lib/railStyles';
|
||||||
|
|
||||||
export let feature: {
|
export let feature: {
|
||||||
from: {
|
from: {
|
||||||
elec: string;
|
elec: string;
|
||||||
eco?: string;
|
eco?: string;
|
||||||
},
|
};
|
||||||
to: {
|
to: {
|
||||||
elec: string;
|
elec: string;
|
||||||
eco?: string;
|
eco?: string;
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
$: fromColour = getElecColour(feature.from.elec);
|
$: fromColour = getElecColour(feature.from.elec);
|
||||||
$: toColour = getElecColour(feature.to.elec);
|
$: toColour = getElecColour(feature.to.elec);
|
||||||
$: showFromEco = !!feature.from.eco;
|
$: showFromEco = !!feature.from.eco;
|
||||||
$: showToEco = !!feature.to.eco;
|
$: showToEco = !!feature.to.eco;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svg viewBox="0 0 64 64" width="64" height="64" style="overflow: visible;">
|
<svg viewBox="0 0 64 64" width="64" height="64" style="overflow: visible;">
|
||||||
<line x1="32" y1="0" x2="32" y2="32" stroke={fromColour} stroke-width="6" />
|
<line x1="32" y1="0" x2="32" y2="32" stroke={fromColour} stroke-width="6" />
|
||||||
<line x1="32" y1="32" x2="32" y2="64" stroke={toColour} stroke-width="6" />
|
<line x1="32" y1="32" x2="32" y2="64" stroke={toColour} stroke-width="6" />
|
||||||
|
|
||||||
{#if showFromEco || showToEco}
|
{#if showFromEco || showToEco}
|
||||||
<line x1="32" y1="32" x2="800" y2="32"
|
<line
|
||||||
stroke="#ef4444" stroke-width="2" stroke-dasharray="6 3" />
|
x1="32"
|
||||||
|
y1="32"
|
||||||
|
x2="800"
|
||||||
|
y2="32"
|
||||||
|
stroke="#ef4444"
|
||||||
|
stroke-width="2"
|
||||||
|
stroke-dasharray="6 3"
|
||||||
|
/>
|
||||||
|
|
||||||
<g font-family="sans-serif" font-size="10" font-weight="800" text-anchor="start">
|
<g font-family="sans-serif" font-size="10" font-weight="800" text-anchor="start">
|
||||||
{#if showFromEco}
|
{#if showFromEco}
|
||||||
<text x="75" y="24" fill="#b91c1c" style="text-transform: uppercase;">
|
<text x="75" y="24" fill="#b91c1c" style="text-transform: uppercase;">
|
||||||
ECO: {feature.from.eco}
|
ECO: {feature.from.eco}
|
||||||
</text>
|
</text>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if showToEco}
|
{#if showToEco}
|
||||||
<text x="75" y="48" fill="#b91c1c" style="text-transform: uppercase;">
|
<text x="75" y="48" fill="#b91c1c" style="text-transform: uppercase;">
|
||||||
ECO: {feature.to.eco}
|
ECO: {feature.to.eco}
|
||||||
</text>
|
</text>
|
||||||
{/if}
|
{/if}
|
||||||
</g>
|
</g>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<rect x="24" y="30" width="16" height="4" fill="white" stroke="#b91c1c" stroke-width="1.5" />
|
<rect x="24" y="30" width="16" height="4" fill="white" stroke="#b91c1c" stroke-width="1.5" />
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
svg { display: block; overflow: visible; }
|
svg {
|
||||||
|
display: block;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,39 +1,36 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {getElecColour} from '$lib/railStyles';
|
import { getElecColour } from '$lib/railStyles';
|
||||||
import BaseTrack from '$lib/components/mapIcons/BaseTrack.svelte';
|
import BaseTrack from '$lib/components/mapIcons/BaseTrack.svelte';
|
||||||
|
|
||||||
export let feature: {
|
export let feature: {
|
||||||
direction: 'up' | 'down';
|
direction: 'up' | 'down';
|
||||||
diverges: 'left' | 'right';
|
diverges: 'left' | 'right';
|
||||||
elecBranch?: string;
|
elecBranch?: string;
|
||||||
};
|
};
|
||||||
export let activeElec: any;
|
export let activeElec: any;
|
||||||
export let reversed: boolean = false;
|
export let reversed: boolean = false;
|
||||||
|
|
||||||
$: isUp = feature.direction === 'up';
|
$: isUp = feature.direction === 'up';
|
||||||
$: visualUp = reversed ? !isUp : isUp;
|
$: visualUp = reversed ? !isUp : isUp;
|
||||||
|
|
||||||
$: isRight = feature.diverges === 'right';
|
$: isRight = feature.diverges === 'right';
|
||||||
|
|
||||||
$: yStart = visualUp ? 64 : 0;
|
$: yStart = visualUp ? 64 : 0;
|
||||||
$: yEnd = visualUp ? 8 : 56;
|
$: yEnd = visualUp ? 8 : 56;
|
||||||
$: xEnd = isRight ? 56 : 8;
|
$: xEnd = isRight ? 56 : 8;
|
||||||
|
|
||||||
$: branchColour = getElecColour(feature.elecBranch || activeElec);
|
$: branchColour = getElecColour(feature.elecBranch || activeElec);
|
||||||
$: branchPath = `M 32 ${yStart} Q 32 32 ${xEnd} ${yEnd}`;
|
$: branchPath = `M 32 ${yStart} Q 32 32 ${xEnd} ${yEnd}`;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svg viewBox="0 0 64 64" width="64" height="64" class="junction">
|
<svg viewBox="0 0 64 64" width="64" height="64" class="junction">
|
||||||
<path
|
<path d={branchPath} fill="none" stroke={branchColour} stroke-width="5" strone-linecap="round" />
|
||||||
d={branchPath}
|
<BaseTrack {activeElec} height={64} />
|
||||||
fill="none"
|
|
||||||
stroke={branchColour}
|
|
||||||
stroke-width="5"
|
|
||||||
strone-linecap="round"
|
|
||||||
/>
|
|
||||||
<BaseTrack {activeElec} height={64} />
|
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
svg { display: block; overflow: visible; }
|
svg {
|
||||||
|
display: block;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,37 +1,36 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getElecColour } from '$lib/railStyles';
|
import { getElecColour } from '$lib/railStyles';
|
||||||
import BaseTrack from '$lib/components/mapIcons/BaseTrack.svelte';
|
import BaseTrack from '$lib/components/mapIcons/BaseTrack.svelte';
|
||||||
|
|
||||||
export let feature: {
|
export let feature: {
|
||||||
position: 'left' | 'right' | 'both';
|
position: 'left' | 'right' | 'both';
|
||||||
elecLoop?: string;
|
elecLoop?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export let reversed: boolean = false;
|
export let reversed: boolean = false;
|
||||||
export let activeElec: any;
|
export let activeElec: any;
|
||||||
|
|
||||||
$: loopColour = getElecColour(feature.elecLoop || activeElec);
|
$: loopColour = getElecColour(feature.elecLoop || activeElec);
|
||||||
|
|
||||||
$: effectivePosition = (() => {
|
$: effectivePosition = (() => {
|
||||||
if (!reversed || feature.position === 'both') return feature.position;
|
if (!reversed || feature.position === 'both') return feature.position;
|
||||||
return feature.position === 'left' ? 'right' : 'left';
|
return feature.position === 'left' ? 'right' : 'left';
|
||||||
})();
|
})();
|
||||||
|
|
||||||
const leftPath = `M 32 0 Q 8 32 32 64`;
|
const leftPath = `M 32 0 Q 8 32 32 64`;
|
||||||
const rightPath = `M 32 0 Q 56 32 32 64`;
|
const rightPath = `M 32 0 Q 56 32 32 64`;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svg viewBox="0 0 64 64" width="64" height="64" class="loops">
|
<svg viewBox="0 0 64 64" width="64" height="64" class="loops">
|
||||||
<g fill="none" stroke={loopColour} stroke-width="4" stroke-linecap="round">
|
<g fill="none" stroke={loopColour} stroke-width="4" stroke-linecap="round">
|
||||||
{#if effectivePosition === 'left' || feature.position === 'both'}
|
{#if effectivePosition === 'left' || feature.position === 'both'}
|
||||||
<path d={leftPath} />
|
<path d={leftPath} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if effectivePosition === 'right' || feature.position === 'both'}
|
{#if effectivePosition === 'right' || feature.position === 'both'}
|
||||||
<path d={rightPath} />
|
<path d={rightPath} />
|
||||||
{/if}
|
{/if}
|
||||||
</g>
|
</g>
|
||||||
|
|
||||||
<BaseTrack {activeElec} height={64} />
|
|
||||||
|
|
||||||
|
<BaseTrack {activeElec} height={64} />
|
||||||
</svg>
|
</svg>
|
||||||
@@ -1,26 +1,33 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import BaseTrack from '$lib/components/mapIcons/BaseTrack.svelte';
|
import BaseTrack from '$lib/components/mapIcons/BaseTrack.svelte';
|
||||||
|
|
||||||
export let feature: {
|
export let feature: {
|
||||||
from: string;
|
from: string;
|
||||||
to: string;
|
to: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export let activeElec: any;
|
export let activeElec: any;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svg viewBox="0 0 64 64" width="64" height="64" style="overflow: visible;">
|
<svg viewBox="0 0 64 64" width="64" height="64" style="overflow: visible;">
|
||||||
<BaseTrack {activeElec} height={64} />
|
<BaseTrack {activeElec} height={64} />
|
||||||
|
|
||||||
<line x1="-500" y1="32" x2="800" y2="32"
|
<line
|
||||||
stroke="#6366f1" stroke-width="2" stroke-dasharray="8 4" />
|
x1="-500"
|
||||||
|
y1="32"
|
||||||
|
x2="800"
|
||||||
|
y2="32"
|
||||||
|
stroke="#6366f1"
|
||||||
|
stroke-width="2"
|
||||||
|
stroke-dasharray="8 4"
|
||||||
|
/>
|
||||||
|
|
||||||
<g font-family="sans-serif" font-weight="800" font-size="11">
|
<g font-family="sans-serif" font-weight="800" font-size="11">
|
||||||
<text x="70" y="24" fill="#4338ca" style="text-transform: uppercase;">
|
<text x="70" y="24" fill="#4338ca" style="text-transform: uppercase;">
|
||||||
{feature.from}
|
{feature.from}
|
||||||
</text>
|
</text>
|
||||||
<text x="70" y="46" fill="#4338ca" style="text-transform: uppercase;">
|
<text x="70" y="46" fill="#4338ca" style="text-transform: uppercase;">
|
||||||
{feature.to}
|
{feature.to}
|
||||||
</text>
|
</text>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import BaseTrack from '$lib/components/mapIcons/BaseTrack.svelte';
|
import BaseTrack from '$lib/components/mapIcons/BaseTrack.svelte';
|
||||||
|
|
||||||
export let activeElec: string;
|
export let activeElec: string;
|
||||||
export let feature: any;
|
export let feature: any;
|
||||||
export let reversed: boolean;
|
export let reversed: boolean;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svg viewBox="0 0 64 64" width="64" height="64" class="loops">
|
<svg viewBox="0 0 64 64" width="64" height="64" class="loops">
|
||||||
<BaseTrack {activeElec} height={64} />
|
<BaseTrack {activeElec} height={64} />
|
||||||
</svg>
|
</svg>
|
||||||
@@ -1,26 +1,19 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import BaseTrack from '$lib/components/mapIcons/BaseTrack.svelte';
|
import BaseTrack from '$lib/components/mapIcons/BaseTrack.svelte';
|
||||||
import { type ElecType } from '$lib/railStyles';
|
import { type ElecType } from '$lib/railStyles';
|
||||||
|
|
||||||
export let feature;
|
export let feature;
|
||||||
export let activeElec: ElecType;
|
export let activeElec: ElecType;
|
||||||
|
|
||||||
$: isTerminus = feature.terminus;
|
$: isTerminus = feature.terminus;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svg viewBox="0 0 64 64" class="station">
|
<svg viewBox="0 0 64 64" class="station">
|
||||||
{#if !isTerminus}
|
{#if !isTerminus}
|
||||||
<BaseTrack {activeElec} height={64} />
|
<BaseTrack {activeElec} height={64} />
|
||||||
<circle cx="32" cy="32" r="12" fill="white" />
|
<circle cx="32" cy="32" r="12" fill="white" />
|
||||||
<circle cx="32" cy="32" r="12" fill="none" stroke="#000000" stroke-width="3" />
|
<circle cx="32" cy="32" r="12" fill="none" stroke="#000000" stroke-width="3" />
|
||||||
{:else}
|
{:else}
|
||||||
<rect
|
<rect x="8" y="12" width="50" height="50" rx="8" fill="white" stroke="black" stroke-width="3" />
|
||||||
x="8" y="12"
|
{/if}
|
||||||
width="50" height="50"
|
|
||||||
rx="8"
|
|
||||||
fill="white"
|
|
||||||
stroke="black"
|
|
||||||
stroke-width="3"
|
|
||||||
/>
|
|
||||||
{/if}
|
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
@@ -9,18 +9,17 @@ import SignallerChange from '$lib/components/mapIcons/SignallerChange.svelte';
|
|||||||
import ElectrificationChange from '$lib/components/mapIcons/ElectrificationChange.svelte';
|
import ElectrificationChange from '$lib/components/mapIcons/ElectrificationChange.svelte';
|
||||||
import SiteOf from '$lib/components/mapIcons/SiteOf.svelte';
|
import SiteOf from '$lib/components/mapIcons/SiteOf.svelte';
|
||||||
|
|
||||||
|
|
||||||
export const components = {
|
export const components = {
|
||||||
station: Station,
|
station: Station,
|
||||||
junction: Junction,
|
junction: Junction,
|
||||||
crossovers: Crossover,
|
crossovers: Crossover,
|
||||||
siteof: SiteOf,
|
siteof: SiteOf,
|
||||||
bridge: Bridge,
|
bridge: Bridge,
|
||||||
crossover: Crossover,
|
crossover: Crossover,
|
||||||
crossing: Crossing,
|
crossing: Crossing,
|
||||||
loop: Loop,
|
loop: Loop,
|
||||||
loops: Loop,
|
loops: Loop,
|
||||||
signallerChange: SignallerChange,
|
signallerChange: SignallerChange,
|
||||||
electrificationChange: ElectrificationChange,
|
electrificationChange: ElectrificationChange,
|
||||||
default: BaseTrack,
|
default: BaseTrack
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
export type ElecType = 'none' | '25kvac' | '750vdc' | '650vdc' | '1500vdc';
|
export type ElecType = 'none' | '25kvac' | '750vdc' | '650vdc' | '1500vdc';
|
||||||
|
|
||||||
export const elecColours: Record<ElecType, string> = {
|
export const elecColours: Record<ElecType, string> = {
|
||||||
'none': '#344415',
|
none: '#344415',
|
||||||
'25kvac': '#ed4444',
|
'25kvac': '#ed4444',
|
||||||
'750vdc': '#3b82f6',
|
'750vdc': '#3b82f6',
|
||||||
'650vdc': '#eab308',
|
'650vdc': '#eab308',
|
||||||
'1500vdc': '#f97316',
|
'1500vdc': '#f97316'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getElecColour = (type?: ElecType) => elecColours[type ?? 'none'];
|
export const getElecColour = (type?: ElecType) => elecColours[type ?? 'none'];
|
||||||
@@ -1,116 +1,116 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import RouteRow from '$lib/components/RouteRow.svelte';
|
import RouteRow from '$lib/components/RouteRow.svelte';
|
||||||
|
|
||||||
|
const dummyFeatures = [
|
||||||
const dummyFeatures = [
|
{
|
||||||
{
|
type: 'station',
|
||||||
type: 'station',
|
miles: 0,
|
||||||
miles: 0,
|
chains: 0,
|
||||||
chains: 0,
|
name: 'Testington',
|
||||||
name: 'Testington',
|
description: 'Terminus',
|
||||||
description: 'Terminus',
|
terminus: true,
|
||||||
terminus: true,
|
elec: '25kvac'
|
||||||
elec: '25kvac',
|
},
|
||||||
},
|
{
|
||||||
{
|
type: 'station',
|
||||||
type: 'station',
|
miles: 0,
|
||||||
miles: 0,
|
chains: 76,
|
||||||
chains: 76,
|
name: 'Closeby',
|
||||||
name: 'Closeby',
|
description: 'Temporarily closed',
|
||||||
description: 'Temporarily closed',
|
elec: '25kvac'
|
||||||
elec: '25kvac',
|
},
|
||||||
},
|
{
|
||||||
{
|
type: 'junction',
|
||||||
type: 'junction',
|
name: 'Test Junction',
|
||||||
name: 'Test Junction',
|
diverges: 'right',
|
||||||
diverges: 'right',
|
direction: 'down',
|
||||||
direction: 'down',
|
elec: '25kvac',
|
||||||
elec: '25kvac',
|
elecBranch: 'none',
|
||||||
elecBranch: 'none',
|
miles: 1,
|
||||||
miles: 1,
|
chains: 13
|
||||||
chains: 13,
|
},
|
||||||
},
|
{
|
||||||
{
|
type: 'bridge',
|
||||||
type: 'bridge',
|
position: 'over',
|
||||||
position: 'over',
|
category: 'pipeline',
|
||||||
category: 'pipeline',
|
name: 'Waterway Bridge',
|
||||||
name: 'Waterway Bridge',
|
roadName: 'TfL (LU)',
|
||||||
roadName: "TfL (LU)",
|
elec: '25kvac',
|
||||||
elec: '25kvac',
|
miles: 1,
|
||||||
miles: 1,
|
chains: 41
|
||||||
chains: 41,
|
},
|
||||||
},
|
{
|
||||||
{
|
type: 'crossover',
|
||||||
type: 'crossover',
|
name: 'Dolphin junction',
|
||||||
name: 'Dolphin junction',
|
elec: '25kvac',
|
||||||
elec: '25kvac',
|
miles: 1,
|
||||||
miles: 1,
|
chains: 42
|
||||||
chains: 42,
|
},
|
||||||
},
|
{
|
||||||
{
|
type: 'junction',
|
||||||
type: 'junction',
|
name: 'Test Junction South',
|
||||||
name: 'Test Junction South',
|
description: 'To: Banbury West Junction & Birmingham',
|
||||||
description: "To: Banbury West Junction & Birmingham",
|
diverges: 'left',
|
||||||
diverges: 'left',
|
direction: 'down',
|
||||||
direction: 'down',
|
elec: '25kvac',
|
||||||
elec: '25kvac',
|
elecBranch: '650vdc',
|
||||||
elecBranch: '650vdc',
|
miles: 1,
|
||||||
miles: 1,
|
chains: 42
|
||||||
chains: 42,
|
},
|
||||||
},
|
{
|
||||||
{
|
type: 'electrificationChange',
|
||||||
type: 'electrificationChange',
|
from: {
|
||||||
from: {
|
elec: '25kvac',
|
||||||
elec: '25kvac',
|
eco: 'Didcot'
|
||||||
eco: 'Didcot',
|
},
|
||||||
},
|
to: {
|
||||||
to: {
|
elec: 'none'
|
||||||
elec: 'none',
|
}
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
{
|
type: 'crossing',
|
||||||
type: 'crossing',
|
kind: 'ahb',
|
||||||
kind: 'ahb',
|
elec: '25kvac',
|
||||||
elec: '25kvac',
|
name: 'Swindon Lane',
|
||||||
name: 'Swindon Lane',
|
description: 'Controlled by TVSC (Level Crossing WS)'
|
||||||
description: 'Controlled by TVSC (Level Crossing WS)'
|
},
|
||||||
},
|
{
|
||||||
{
|
type: 'loop',
|
||||||
type: 'loop',
|
side: 'both',
|
||||||
side: 'both',
|
elec: '25kvac',
|
||||||
elec: '25kvac',
|
elecLoop: 'none'
|
||||||
elecLoop: 'none',
|
},
|
||||||
},
|
{
|
||||||
{
|
type: 'signallerChange',
|
||||||
type: 'signallerChange',
|
from: 'TVSC - Didcot WS (SB)',
|
||||||
from: 'TVSC - Didcot WS (SB)',
|
to: 'TVSC - Swindon WS (SN)',
|
||||||
to: 'TVSC - Swindon WS (SN)',
|
elec: '25kvac'
|
||||||
elec: '25kvac',
|
},
|
||||||
},
|
{
|
||||||
{
|
type: 'station',
|
||||||
type: 'station',
|
miles: 4,
|
||||||
miles: 4,
|
chains: 13,
|
||||||
chains: 13,
|
name: 'Powerless',
|
||||||
name: 'Powerless',
|
description: "Doesn't exist",
|
||||||
description: "Doesn't exist",
|
elec: '750vdc'
|
||||||
elec: '750vdc',
|
}
|
||||||
}
|
];
|
||||||
]
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1>Welcome to SvelteKit</h1>
|
<h1>Welcome to SvelteKit</h1>
|
||||||
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p>
|
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p>
|
||||||
|
|
||||||
<div class="map-container">
|
<div class="map-container">
|
||||||
{#each dummyFeatures as feature}
|
{#each dummyFeatures as feature}
|
||||||
<RouteRow {feature} activeElec={feature.elec} />
|
<RouteRow {feature} activeElec={feature.elec} />
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.map-container {
|
.map-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 600px;
|
max-width: 600px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,238 +1,240 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import RouteRow from '$lib/components/RouteRow.svelte';
|
import RouteRow from '$lib/components/RouteRow.svelte';
|
||||||
import { slide } from 'svelte/transition';
|
import { slide } from 'svelte/transition';
|
||||||
|
|
||||||
// data.route contains: routeName, routeId, elecStart, elecEnd, routeDetail[]
|
// data.route contains: routeName, routeId, elecStart, elecEnd, routeDetail[]
|
||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
let reversed = false; // Reverses Array, and passes value down to children
|
let reversed = false; // Reverses Array, and passes value down to children
|
||||||
|
|
||||||
let visibleTypes = {
|
let visibleTypes = {
|
||||||
station: true,
|
station: true,
|
||||||
bridge: true,
|
bridge: true,
|
||||||
crossovers: true,
|
crossovers: true,
|
||||||
loop: true,
|
loop: true,
|
||||||
signallerChange: true,
|
signallerChange: true,
|
||||||
electrificationChange: true,
|
electrificationChange: true,
|
||||||
siteof: true,
|
siteof: true,
|
||||||
junction: true,
|
junction: true
|
||||||
}
|
};
|
||||||
|
|
||||||
let showFilters = false;
|
let showFilters = false;
|
||||||
|
|
||||||
// Toggle feature types
|
// Toggle feature types
|
||||||
const toggleFilter = (type: string) => {
|
const toggleFilter = (type: string) => {
|
||||||
visibleTypes[type] = !visibleTypes[type];
|
visibleTypes[type] = !visibleTypes[type];
|
||||||
visibleTypes = visibleTypes;
|
visibleTypes = visibleTypes;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helper to prettify 'types'
|
// Helper to prettify 'types'
|
||||||
const formatLabel = (str: string) => str.replace(/([A-Z])/g, ' $1').replace(/^./, (s) => s.toUpperCase());
|
const formatLabel = (str: string) =>
|
||||||
|
str.replace(/([A-Z])/g, ' $1').replace(/^./, (s) => s.toUpperCase());
|
||||||
|
|
||||||
$: processedFeatures = (() => {
|
$: processedFeatures = (() => {
|
||||||
const list = reversed
|
const list = reversed ? [...data.route.routeDetail].reverse() : [...data.route.routeDetail];
|
||||||
? [...data.route.routeDetail].reverse()
|
|
||||||
: [...data.route.routeDetail];
|
|
||||||
|
|
||||||
// Seed currentElec from the YAML header boundary
|
// Seed currentElec from the YAML header boundary
|
||||||
let currentElec = reversed
|
let currentElec = reversed ? data.route.elecEnd.elec : data.route.elecStart.elec;
|
||||||
? data.route.elecEnd.elec
|
|
||||||
: data.route.elecStart.elec;
|
|
||||||
|
|
||||||
return list.map(f => {
|
return list.map((f) => {
|
||||||
if (f.type === 'electrificationChange') {
|
if (f.type === 'electrificationChange') {
|
||||||
// Transition state: this tile and everything after it
|
// Transition state: this tile and everything after it
|
||||||
// adopts the new electrification.
|
// adopts the new electrification.
|
||||||
currentElec = reversed ? f.from.elec : f.to.elec;
|
currentElec = reversed ? f.from.elec : f.to.elec;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...f,
|
...f,
|
||||||
activeElec: currentElec
|
activeElec: currentElec
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
$: filteredFeatures = processedFeatures.filter(f => {
|
$: filteredFeatures = processedFeatures.filter((f) => {
|
||||||
return visibleTypes[f.type] ?? true;
|
return visibleTypes[f.type] ?? true;
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="map-layout">
|
<div class="map-layout">
|
||||||
<header class="top-nav">
|
<header class="top-nav">
|
||||||
<h1>{data.route.routeName}</h1>
|
<h1>{data.route.routeName}</h1>
|
||||||
<span class="route-code">{data.route.routeId}</span>
|
<span class="route-code">{data.route.routeId}</span>
|
||||||
<div class="quick-actions">
|
<div class="quick-actions">
|
||||||
<button class="icon-btn" on:click={() => reversed = !reversed}>
|
<button class="icon-btn" on:click={() => (reversed = !reversed)}>
|
||||||
⇄ {reversed ? 'UP' : 'DN'}
|
⇄ {reversed ? 'UP' : 'DN'}
|
||||||
</button>
|
</button>
|
||||||
<button class="icon-btn" on:click={() => showFilters = !showFilters}>
|
<button class="icon-btn" on:click={() => (showFilters = !showFilters)}> Settings </button>
|
||||||
Settings
|
</div>
|
||||||
</button>
|
</header>
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
{#if showFilters}
|
{#if showFilters}
|
||||||
<div class="backdrop" on:click={() => showFilters = false}></div>
|
<div class="backdrop" on:click={() => (showFilters = false)}></div>
|
||||||
|
|
||||||
<div class="filter-drawer" transition:slide>
|
<div class="filter-drawer" transition:slide>
|
||||||
<div class="drawer-header">
|
<div class="drawer-header">
|
||||||
<h3>Visibility Filters</h3>
|
<h3>Visibility Filters</h3>
|
||||||
<button class="close-icon" on:click={() => showFilters = false} aria-label="Close">
|
<button class="close-icon" on:click={() => (showFilters = false)} aria-label="Close">
|
||||||
<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2.5">
|
<svg
|
||||||
<path d="M18 6L6 18M6 6l12 12" stroke-linecap="round" stroke-linejoin="round"/>
|
viewBox="0 0 24 24"
|
||||||
</svg>
|
width="20"
|
||||||
</button>
|
height="20"
|
||||||
</div>
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="2.5"
|
||||||
|
>
|
||||||
|
<path d="M18 6L6 18M6 6l12 12" stroke-linecap="round" stroke-linejoin="round" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="drawer-content">
|
<div class="drawer-content">
|
||||||
<div class="filter-flex">
|
<div class="filter-flex">
|
||||||
{#each Object.keys(visibleTypes) as type}
|
{#each Object.keys(visibleTypes) as type}
|
||||||
<button
|
<button
|
||||||
class="filter-chip"
|
class="filter-chip"
|
||||||
class:active={visibleTypes[type]}
|
class:active={visibleTypes[type]}
|
||||||
on:click={() => toggleFilter(type)}
|
on:click={() => toggleFilter(type)}
|
||||||
>
|
>
|
||||||
{formatLabel(type)}
|
{formatLabel(type)}
|
||||||
</button>
|
</button>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<main class="map-spine">
|
<main class="map-spine">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{#each filteredFeatures as f, i (`${f.type}-${f.miles}-${f.chains}-${i}`)}
|
{#each filteredFeatures as f, i (`${f.type}-${f.miles}-${f.chains}-${i}`)}
|
||||||
<RouteRow feature={f} activeElec={f.activeElec} {reversed} />
|
<RouteRow feature={f} activeElec={f.activeElec} {reversed} />
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.map-layout {
|
.map-layout {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-nav {
|
.top-nav {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
background: rgba(255, 255, 255, 0.9);
|
background: rgba(255, 255, 255, 0.9);
|
||||||
backdrop-filter: blur(10px);
|
backdrop-filter: blur(10px);
|
||||||
border-bottom: 1px solid #e2e8f0;
|
border-bottom: 1px solid #e2e8f0;
|
||||||
padding: 0.75rem 1rem;
|
padding: 0.75rem 1rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 1.1rem;
|
font-size: 1.1rem;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
color: #0f172a;
|
color: #0f172a;
|
||||||
letter-spacing: -0.02em;
|
letter-spacing: -0.02em;
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
overflow-wrap: break-word;
|
overflow-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
@media (min-width: 768px) {
|
||||||
.top-nav {
|
.top-nav {
|
||||||
padding: 1rem 2rem;
|
padding: 1rem 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 1.5rem;
|
font-size: 1.5rem;
|
||||||
letter-spacing: -0.03em;
|
letter-spacing: -0.03em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 500px;
|
max-width: 500px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding-top: 1rem;
|
padding-top: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.backdrop {
|
.backdrop {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
background: rgba(0, 0, 0, 0.4);
|
background: rgba(0, 0, 0, 0.4);
|
||||||
z-index: 150;
|
z-index: 150;
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter-drawer {
|
.filter-drawer {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
background: white;
|
background: white;
|
||||||
z-index: 200;
|
z-index: 200;
|
||||||
border-radius: 20px 20px 0 0;
|
border-radius: 20px 20px 0 0;
|
||||||
box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.15);
|
box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.15);
|
||||||
/* Ensure it handles iOS home bar spacing */
|
/* Ensure it handles iOS home bar spacing */
|
||||||
padding-bottom: env(safe-area-inset-bottom, 1rem);
|
padding-bottom: env(safe-area-inset-bottom, 1rem);
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawer-header {
|
.drawer-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 1.25rem 1.5rem 0.75rem;
|
padding: 1.25rem 1.5rem 0.75rem;
|
||||||
border-bottom: 1px solid #f1f5f9;
|
border-bottom: 1px solid #f1f5f9;
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawer-header h3 {
|
.drawer-header h3 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
color: #1e293b;
|
color: #1e293b;
|
||||||
}
|
}
|
||||||
|
|
||||||
.close-icon {
|
.close-icon {
|
||||||
background: #f1f5f9;
|
background: #f1f5f9;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
width: 32px;
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: #64748b;
|
color: #64748b;
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawer-content {
|
.drawer-content {
|
||||||
padding: 1.25rem 1.5rem;
|
padding: 1.25rem 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter-flex {
|
.filter-flex {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: 0.75rem;
|
gap: 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter-chip {
|
.filter-chip {
|
||||||
padding: 0.5rem 1rem;
|
padding: 0.5rem 1rem;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
border: 1px solid #e2e8f0;
|
border: 1px solid #e2e8f0;
|
||||||
background: #f8fafc;
|
background: #f8fafc;
|
||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.2s;
|
transition: all 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter-chip.active {
|
.filter-chip.active {
|
||||||
background: #1e293b;
|
background: #1e293b;
|
||||||
color: white;
|
color: white;
|
||||||
border-color: #1e293b;
|
border-color: #1e293b;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -2,28 +2,28 @@ import type { PageLoad } from '/$types';
|
|||||||
import { error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
|
|
||||||
export const load: PageLoad = async ({ params, fetch }) => {
|
export const load: PageLoad = async ({ params, fetch }) => {
|
||||||
const { slug } = params;
|
const { slug } = params;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`/mapFiles/json/${slug}.json`);
|
const res = await fetch(`/mapFiles/json/${slug}.json`);
|
||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
throw error(404, {
|
throw error(404, {
|
||||||
message: `Route ${slug} not found`
|
message: `Route ${slug} not found`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const rawData = await res.json();
|
const rawData = await res.json();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
route: rawData,
|
route: rawData,
|
||||||
slug: slug,
|
slug: slug
|
||||||
};
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`Error loading map ${slug}: `, err);
|
console.error(`Error loading map ${slug}: `, err);
|
||||||
|
|
||||||
throw error(500, {
|
throw error(500, {
|
||||||
message: `Failed to parse map data for ${slug}`
|
message: `Failed to parse map data for ${slug}`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user