Compare commits
10 Commits
0.0.1
...
d53748f8ae
| Author | SHA1 | Date | |
|---|---|---|---|
| d53748f8ae | |||
| d406db9d18 | |||
| 07e5e4023c | |||
| cf0b1396ea | |||
| 39ca73b015 | |||
| f38ba5a971 | |||
| 379180df7d | |||
| 7ae9951fda | |||
| 7dfba5e240 | |||
| 74572b3ede |
@@ -3,7 +3,7 @@ run-name: ${{ gitea.actor }} is building and pushing
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
create:
|
create:
|
||||||
tags: "*"
|
tags: '*'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GITEA_DOMAIN: git.fjla.uk
|
GITEA_DOMAIN: git.fjla.uk
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,6 +2,7 @@ node_modules
|
|||||||
|
|
||||||
# Transpiled JSON
|
# Transpiled JSON
|
||||||
/static/mapFiles/json/
|
/static/mapFiles/json/
|
||||||
|
/static/map-index.json
|
||||||
|
|
||||||
# Output
|
# Output
|
||||||
.output
|
.output
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ WORKDIR /app
|
|||||||
COPY --from=builder /app/build ./build
|
COPY --from=builder /app/build ./build
|
||||||
COPY --from=builder /app/node_modules ./node_modules
|
COPY --from=builder /app/node_modules ./node_modules
|
||||||
COPY --from=builder /app/package.json ./package.json
|
COPY --from=builder /app/package.json ./package.json
|
||||||
|
COPY --from=builder /app/static ./static
|
||||||
|
|
||||||
USER node
|
USER node
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,30 @@ import path from 'path';
|
|||||||
|
|
||||||
const inputDir = './static/mapFiles/yaml';
|
const inputDir = './static/mapFiles/yaml';
|
||||||
const outputDir = './static/mapFiles/json';
|
const outputDir = './static/mapFiles/json';
|
||||||
|
const indexFile = './static/map-index.json';
|
||||||
|
|
||||||
if (!fs.existsSync(outputDir)) fs.mkdirSync(outputDir, { recursive: true });
|
if (!fs.existsSync(outputDir)) fs.mkdirSync(outputDir, { recursive: true });
|
||||||
|
|
||||||
|
const mapList = [];
|
||||||
|
|
||||||
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 fullPath = path.join(inputDir, file);
|
||||||
|
const content = yaml.load(fs.readFileSync(fullPath, '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));
|
||||||
|
|
||||||
|
mapList.push({
|
||||||
|
routeId: content.routeId || null,
|
||||||
|
routeStart: content.routeStart || null,
|
||||||
|
routeEnd: content.routeEnd || null,
|
||||||
|
created: content.created || null,
|
||||||
|
checked: content.checked || null,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fs.writeFileSync(indexFile, JSON.stringify(mapList));
|
||||||
|
|
||||||
|
console.log(`Generated ${mapList.length} map files and index.`)
|
||||||
|
|||||||
20
src/hooks.server.ts
Normal file
20
src/hooks.server.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { type HandleFetch } from "@sveltejs/kit";
|
||||||
|
|
||||||
|
export const handleFetch: HandleFetch = async ({ request, fetch }) => {
|
||||||
|
if (request.url.startsWith('https://maps.owlboard.info')) {
|
||||||
|
const newUrl = request.url.replace('https://maps.owlboard.info', 'http://localhost:3000');
|
||||||
|
|
||||||
|
const headers = new Headers(request.headers);
|
||||||
|
headers.set('host', 'maps.owlboard.info');
|
||||||
|
|
||||||
|
request = new Request(newUrl, {
|
||||||
|
method: request.method,
|
||||||
|
headers: headers,
|
||||||
|
body: request.body,
|
||||||
|
// @ts-ignore - 'duplex' is needed for node fetch with bodies
|
||||||
|
duplex: 'half'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return fetch(request);
|
||||||
|
}
|
||||||
@@ -1,80 +1,194 @@
|
|||||||
<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';
|
||||||
|
|
||||||
export let feature: {
|
export let feature: {
|
||||||
position: 'over' | 'under';
|
position: 'over' | 'under';
|
||||||
category: 'rail' | 'footbridge' | 'aroad' | 'minorRoad' | 'motorway' | 'waterway';
|
category: 'rail' |'stream'| 'foot' | 'aroad' | 'minorRoad' | 'motorway' | 'waterway' | 'pipeline';
|
||||||
roadName?: string;
|
roadName?: string;
|
||||||
};
|
};
|
||||||
|
export let activeElec: ElecType;
|
||||||
export let activeElec: string;
|
|
||||||
|
|
||||||
const bridgeStyles = {
|
const bridgeStyles = {
|
||||||
rail: { color: '#ffffff', stroke: '#000000', width: 20, text: '#000000' },
|
rail: {
|
||||||
footbridge: { color: '#ffffff', stroke: '#475569', width: 10, text: '#475569' },
|
stroke: '#0f172a',
|
||||||
aroad: { color: '#00703c', stroke: '#004d29', width: 24, text: '#FFEB3B' },
|
width: 22,
|
||||||
minorRoad: { color: '#ffffff', stroke: '#64748b', width: 20, text: '#334155' },
|
bg: '#334155',
|
||||||
motorway: { color: '#005da1', stroke: '#003e6b', width: 32, text: '#ffffff' },
|
text: '#ffffff',
|
||||||
waterway: { color: '#bae6fd', stroke: '#0369a1', width: 24, text: '#075985' },
|
textBg: '#000000',
|
||||||
pipeline: { color: '#334155', stroke: '#1e293b', width: 4, text: '#334155' }
|
textBorder: '',
|
||||||
|
type: 'rail'
|
||||||
|
},
|
||||||
|
foot: {
|
||||||
|
stroke: '#475569',
|
||||||
|
width: 10,
|
||||||
|
bg: '#94a3b8',
|
||||||
|
text: '#ffffff',
|
||||||
|
textBg: '#000000',
|
||||||
|
textBorder: '',
|
||||||
|
type: 'path'
|
||||||
|
},
|
||||||
|
aroad: {
|
||||||
|
stroke: '#065f46',
|
||||||
|
width: 32,
|
||||||
|
bg: '#059669',
|
||||||
|
text: '#ffd200',
|
||||||
|
textBg: '#00703c',
|
||||||
|
textBorder: '#ffd200',
|
||||||
|
type: 'road'
|
||||||
|
},
|
||||||
|
minorRoad: {
|
||||||
|
stroke: '#334155',
|
||||||
|
width: 24,
|
||||||
|
bg: '#475569',
|
||||||
|
text: '#000000',
|
||||||
|
textBg: '#ffffff',
|
||||||
|
textBorder: '#000000',
|
||||||
|
type: 'road'
|
||||||
|
},
|
||||||
|
motorway: {
|
||||||
|
stroke: '#1e40af',
|
||||||
|
width: 40,
|
||||||
|
bg: '#3b82f6',
|
||||||
|
text: '#ffffff',
|
||||||
|
textBg: '#007ac1',
|
||||||
|
textBorder: '#ffffff',
|
||||||
|
type: 'road'
|
||||||
|
},
|
||||||
|
waterway: {
|
||||||
|
stroke: '#0369a1',
|
||||||
|
width: 32,
|
||||||
|
bg: '#bae6fd',
|
||||||
|
text: '#075985',
|
||||||
|
textBg: '#000000',
|
||||||
|
textBorder: '',
|
||||||
|
type: 'water'
|
||||||
|
},
|
||||||
|
stream: {
|
||||||
|
stroke: '#0369a1',
|
||||||
|
width: 4,
|
||||||
|
bg: '#bae6fd',
|
||||||
|
text: '#075985',
|
||||||
|
textBg: '#000000',
|
||||||
|
textBorder: '',
|
||||||
|
type: 'water'
|
||||||
|
},
|
||||||
|
pipeline: {
|
||||||
|
stroke: '#1e293b',
|
||||||
|
width: 4,
|
||||||
|
bg: '#1e293b',
|
||||||
|
text: '#ffffff',
|
||||||
|
textBg: '#000000',
|
||||||
|
textBorder: '',
|
||||||
|
type: 'path'
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$: 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;
|
$: xLeft = 6;
|
||||||
$: bottomY = 32 + s.width / 2;
|
$: xRight = 58;
|
||||||
|
|
||||||
$: topPath = `M 0 ${topY} Q 8 ${topY} 8 ${topY - 4} M 56 ${topY - 4} Q 56 ${topY} 64 ${topY}`;
|
const yTop = 16;
|
||||||
$: bottomPath = `M 0 ${bottomY} Q 8 ${bottomY} 8 ${bottomY + 4} M 56 ${bottomY + 4} Q 56 ${bottomY} 64 ${bottomY}`;
|
const yBottom = 48;
|
||||||
|
|
||||||
$: 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={`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" />
|
|
||||||
<BaseTrack {activeElec} height={64} />
|
<BaseTrack {activeElec} height={64} />
|
||||||
|
|
||||||
|
|
||||||
|
<!-- White edge, to provide separation between abutment line and bridge content -->
|
||||||
|
<rect x=0 y={32 - (s.width / 2) - 4} width="64" height="{s.width + 8}" fill="white" />
|
||||||
|
|
||||||
|
<rect x="6" y={32 - (s.width / 2)} width="52" height={s.width} fill={s.bg} />
|
||||||
|
|
||||||
|
{#if s.type === 'road'}
|
||||||
|
<line
|
||||||
|
x1={xLeft}
|
||||||
|
y1="32"
|
||||||
|
x2={xRight}
|
||||||
|
y2="32"
|
||||||
|
stroke="white"
|
||||||
|
stroke-width="1.5"
|
||||||
|
stroke-dasharray="4 3"
|
||||||
|
opacity="0.6"
|
||||||
|
/>
|
||||||
|
{:else if s.type === 'rail'}
|
||||||
|
<line x1={xLeft} y1="28" x2={xRight} y2="28" stroke="#cbd5e1" stroke-width="1.5" />
|
||||||
|
<line x1={xLeft} y1="36" x2={xRight} y2="36" stroke="#cbd5e1" stroke-width="1.5" />
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<g fill="none" stroke={s.stroke} stroke-width="2.5" stroke-linecap="square">
|
||||||
|
<path d={`M 20 ${32 - s.width / 2 - 6} L 20 ${32 - s.width / 2 - 4} L 44 ${32 - s.width / 2 - 4} L 44 ${32 - s.width / 2 - 6}`} />
|
||||||
|
|
||||||
|
<path d={`M 20 ${32 + s.width / 2 + 6} L 20 ${32 + s.width / 2 + 4} L 44 ${32 + s.width / 2 + 4} L 44 ${32 + s.width / 2 + 6}`} />
|
||||||
|
</g>
|
||||||
{:else}
|
{:else}
|
||||||
<BaseTrack {activeElec} height={64} />
|
|
||||||
|
|
||||||
<path d={bodyPath} fill="white" /> <path d={bodyPath} fill={s.color} />
|
|
||||||
|
|
||||||
<g fill="none" stroke={s.stroke} stroke-width="2.5" stroke-linecap="round">
|
<rect x="6" y={32 - (s.width / 2)} width="52" height={s.width} fill={s.bg} />
|
||||||
<path d={`M 0 ${topY} L 64 ${topY}`} />
|
|
||||||
<path d={`M 0 ${bottomY} L 64 ${bottomY}`} />
|
{#if s.type === 'road'}
|
||||||
<path d={`M 0 ${topY} Q 4 ${topY} 4 ${topY - 6}`} />
|
<line
|
||||||
<path d={`M 64 ${topY} Q 60 ${topY} 60 ${topY - 6}`} />
|
x1={xLeft}
|
||||||
<path d={`M 0 ${bottomY} Q 4 ${bottomY} 4 ${bottomY + 6}`} />
|
y1="32"
|
||||||
<path d={`M 64 ${bottomY} Q 60 ${bottomY} 60 ${bottomY + 6}`} />
|
x2={xRight}
|
||||||
|
y2="32"
|
||||||
|
stroke="white"
|
||||||
|
stroke-width="1.5"
|
||||||
|
stroke-dasharray="4 3"
|
||||||
|
opacity="0.6"
|
||||||
|
/>
|
||||||
|
{:else if s.type === 'rail'}
|
||||||
|
<line x1={xLeft} y1="28" x2={xRight} y2="28" stroke="#cbd5e1" stroke-width="1.5" />
|
||||||
|
<line x1={xLeft} y1="36" x2={xRight} y2="36" stroke="#cbd5e1" stroke-width="1.5" />
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<rect x="26" y={yTop} width="12" height="64" fill="white" />
|
||||||
|
<g stroke={s.stroke} stroke-width="2.5" fill="none" stroke-linecap="square">
|
||||||
|
<path d={`M 24 ${(32 - (s.width / 2)) - 5} L 25 ${(32 - (s.width / 2)) - 5} L 25 ${(32 - (s.width / 2)) + s.width + 5} L 24 ${(32 - (s.width / 2)) + s.width + 5}`} />
|
||||||
|
|
||||||
|
<path d={`M 40 ${(32 - (s.width / 2)) - 5} L 39 ${(32 - (s.width / 2)) - 5} L 39 ${(32 - (s.width / 2)) + s.width + 5} L 40 ${(32 - (s.width / 2)) + s.width + 5}`} />
|
||||||
</g>
|
</g>
|
||||||
|
|
||||||
{#if feature.roadName}
|
<BaseTrack {activeElec} height={64} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if feature.roadName}
|
||||||
|
<g class="label-group">
|
||||||
|
<rect
|
||||||
|
x={32 - feature.roadName.length * 3 - 4}
|
||||||
|
y="27"
|
||||||
|
width={feature.roadName.length * 6 + 8}
|
||||||
|
height="10"
|
||||||
|
stroke={s.textBorder || s.textBg}
|
||||||
|
stroke-width="1"
|
||||||
|
fill={s.textBg}
|
||||||
|
rx="3"
|
||||||
|
ry="4"
|
||||||
|
/>
|
||||||
<text
|
<text
|
||||||
x="32"
|
x="32"
|
||||||
y="32"
|
y="32"
|
||||||
text-anchor="middle"
|
text-anchor="middle"
|
||||||
dominant-baseline="central"
|
dominant-baseline="central"
|
||||||
fill={s.text}
|
fill={s.text}
|
||||||
font-family="sans-serif"
|
font-family="ui-monospace, monospace"
|
||||||
font-weight="bold"
|
font-weight="900"
|
||||||
font-size={s.width > 20 ? '10' : '8'}
|
font-size="8"
|
||||||
style="pointer-events: none; text-transform: uppercase; letter-spacing: 0.5px;"
|
|
||||||
>
|
>
|
||||||
{feature.roadName}
|
{feature.roadName}
|
||||||
</text>
|
</text>
|
||||||
{/if}
|
</g>
|
||||||
{/if}
|
{/if}
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
svg {
|
|
||||||
display: block;
|
|
||||||
overflow: visible;
|
|
||||||
}
|
|
||||||
text {
|
text {
|
||||||
user-select: none;
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getElecColour } from '$lib/railStyles';
|
import { getElecColour } from '$lib/railStyles';
|
||||||
|
import type { ElecType } from '$lib/railStyles';
|
||||||
|
|
||||||
export let feature: {
|
export let feature: {
|
||||||
from: {
|
from: {
|
||||||
elec: string;
|
elec: ElecType;
|
||||||
eco?: string;
|
eco?: string;
|
||||||
};
|
};
|
||||||
to: {
|
to: {
|
||||||
elec: string;
|
elec: ElecType;
|
||||||
eco?: string;
|
eco?: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,43 +1,48 @@
|
|||||||
<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' | 'both';
|
diverges: 'left' | 'right' | 'both';
|
||||||
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;
|
||||||
|
$: visualSide = (side: 'left' | 'right') => {
|
||||||
|
if (!reversed) return side;
|
||||||
|
return side === 'left' ? 'right' : 'left';
|
||||||
|
};
|
||||||
|
|
||||||
const getPath = (side: 'left' | 'right') => {
|
const getPath = (side: 'left' | 'right') => {
|
||||||
const yStart = visualUp ? 64 : 0;
|
const yStart = visualUp ? 64 : 0;
|
||||||
const yEnd = visualUp ? 8 : 56;
|
const yEnd = visualUp ? 8 : 56;
|
||||||
const xEnd = side === 'right' ? 56 : 8;
|
const xEnd = side === 'right' ? 56 : 8;
|
||||||
return `M 32 ${yStart} Q 32 32 ${xEnd} ${yEnd}`;
|
return `M 32 ${yStart} Q 32 32 ${xEnd} ${yEnd}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
$: paths = (() => {
|
$: paths = (() => {
|
||||||
if (feature.diverges === 'both') return [getPath('left'), getPath('right')];
|
if (feature.diverges === 'both') return [getPath('left'), getPath('right')];
|
||||||
return [getPath(feature.diverges)];
|
const effectiveSide = visualSide(feature.diverges as 'left' | 'right');
|
||||||
})();
|
return [getPath(effectiveSide)];
|
||||||
|
})();
|
||||||
|
|
||||||
$: branchColour = getElecColour(feature.elecBranch || activeElec);
|
$: branchColour = getElecColour(feature.elecBranch || activeElec);
|
||||||
</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">
|
||||||
{#each paths as d}
|
{#each paths as d}
|
||||||
<path {d} fill="none" stroke={branchColour} stroke-width="5" stroke-linecap="round" />
|
<path {d} fill="none" stroke={branchColour} stroke-width="5" stroke-linecap="round" />
|
||||||
{/each}
|
{/each}
|
||||||
<BaseTrack {activeElec} height={64} />
|
<BaseTrack {activeElec} height={64} />
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
svg {
|
svg {
|
||||||
display: block;
|
display: block;
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,93 +1,121 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export let feature: {
|
export let feature: {
|
||||||
routeName: string;
|
routeName: string;
|
||||||
routeId: string;
|
routeId: string;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="link-wrapper">
|
<div class="link-wrapper">
|
||||||
<a href="/map/{feature.routeId}" class="wide-button">
|
<a href="/map/{feature.routeId}" class="wide-button">
|
||||||
<div class="accent-bar"></div>
|
<div class="content">
|
||||||
<div class="content">
|
<div class="header-row">
|
||||||
<span class="sub-text">Continue to next map</span>
|
<span class="sub-text">Go to</span>
|
||||||
<span class="main-text">{feature.routeName}</span>
|
<span class="route-id-chip">{feature.routeId}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="icon">
|
<span class="main-text">{feature.routeName}</span>
|
||||||
<svg viewBox="0 0 24 24" width="20" height="20">
|
</div>
|
||||||
<path d="M5 12h14M12 5l7 7-7 7" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
||||||
</svg>
|
<div class="icon-circle">
|
||||||
</div>
|
<svg viewBox="0 0 24 24" width="20" height="20">
|
||||||
</a>
|
<path
|
||||||
|
d="M5 12h14M12 5l7 7-7 7"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="3"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.link-wrapper {
|
.link-wrapper {
|
||||||
position: relative;
|
padding: 16px;
|
||||||
z-index: 100;
|
width: 100%;
|
||||||
padding: 12px;
|
box-sizing: border-box;
|
||||||
width: 100%;
|
}
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wide-button {
|
.wide-button {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
border: 2px solid #e2e8f0;
|
border: 1px solid #e2e8f0;
|
||||||
border-radius: 12px;
|
border-radius: 16px;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
overflow: hidden;
|
padding: 12px 16px;
|
||||||
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
.accent-bar {
|
.content {
|
||||||
width: 6px;
|
flex: 1;
|
||||||
align-self: stretch;
|
display: flex;
|
||||||
background: #475569;
|
flex-direction: column;
|
||||||
}
|
gap: 4px;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.content {
|
.header-row {
|
||||||
flex: 1;
|
display: flex;
|
||||||
padding: 12px 16px;
|
align-items: center;
|
||||||
display: flex;
|
gap: 8px;
|
||||||
flex-direction: column;
|
}
|
||||||
gap: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sub-text {
|
.sub-text {
|
||||||
font-size: 10px;
|
font-size: 0.65rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
letter-spacing: 0.05em;
|
letter-spacing: 0.05em;
|
||||||
color: #94a3b8;
|
color: #64748b;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-text {
|
.route-id-chip {
|
||||||
font-size: 16px;
|
font-size: 0.6rem;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
color: #1e293b;
|
background: #f1f5f9;
|
||||||
}
|
color: #475569;
|
||||||
|
padding: 2px 6px;
|
||||||
|
border-radius: 6px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
.icon {
|
.main-text {
|
||||||
padding-right: 20px;
|
font-size: 1rem;
|
||||||
color: #cbd5e1;
|
font-weight: 800;
|
||||||
transition: transform 0.2s ease;
|
color: #0f172a;
|
||||||
}
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-circle {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: #f8fafc;
|
||||||
|
border-radius: 50%;
|
||||||
|
color: #94a3b8;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
margin-left: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
.wide-button:hover {
|
.wide-button:hover {
|
||||||
border-color: #94a3b8;
|
border-color: #cbd5e1;
|
||||||
background: #f8fafc;
|
background: #fdfdfd;
|
||||||
}
|
box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
.wide-button:hover .icon {
|
.wide-button:hover .icon-circle {
|
||||||
color: #475569;
|
background: #4f46e5;
|
||||||
transform: translateX(4px);
|
color: #ffffff;
|
||||||
}
|
transform: rotate(-45deg);
|
||||||
|
}
|
||||||
|
|
||||||
.wide-button:active {
|
.wide-button:active {
|
||||||
transform: scale(0.98);
|
transform: scale(0.98);
|
||||||
background: #f1f5f9;
|
}
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
@@ -6,7 +6,14 @@
|
|||||||
to: string;
|
to: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export let reversed: boolean = false;
|
||||||
|
|
||||||
export let activeElec: any;
|
export let activeElec: any;
|
||||||
|
|
||||||
|
$: effectiveFeature = {
|
||||||
|
from: reversed ? feature.to : feature.from,
|
||||||
|
to: reversed ? feature.from : feature.to
|
||||||
|
};
|
||||||
</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;">
|
||||||
@@ -24,10 +31,10 @@
|
|||||||
|
|
||||||
<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}
|
{effectiveFeature.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}
|
{effectiveFeature.to}
|
||||||
</text>
|
</text>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
@@ -1,56 +1,59 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import BaseTrack from "./BaseTrack.svelte";
|
import BaseTrack from './BaseTrack.svelte';
|
||||||
|
|
||||||
export let feature: {
|
export let feature: {
|
||||||
tunnelType: "start" | "whole" | "end";
|
tunnelType: 'start' | 'whole' | 'end';
|
||||||
length: string;
|
length: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export let activeElec: any;
|
export let activeElec: any;
|
||||||
|
|
||||||
export let reversed: boolean = false;
|
export let reversed: boolean = false;
|
||||||
|
|
||||||
const portalColour = "#475569"; // Slate grey
|
const portalColour = '#475569'; // Slate grey
|
||||||
|
|
||||||
$: effectiveType = (() => {
|
$: effectiveType = (() => {
|
||||||
if (!reversed || feature.tunnelType === 'whole') return feature.tunnelType;
|
if (!reversed || feature.tunnelType === 'whole') return feature.tunnelType;
|
||||||
return feature.tunnelType === 'start' ? 'end' : 'start';
|
return feature.tunnelType === 'start' ? 'end' : 'start';
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svg viewBox="0 0 64 64" width="64" height="64" class="tunnel">
|
<svg viewBox="0 0 64 64" width="64" height="64" class="tunnel">
|
||||||
<BaseTrack {activeElec} height={64} />
|
<BaseTrack {activeElec} height={64} />
|
||||||
|
|
||||||
<g fill="none" stroke={portalColour} stroke-width="3" stroke-linecap="round">
|
<g fill="none" stroke={portalColour} stroke-width="3" stroke-linecap="round">
|
||||||
{#if effectiveType === 'whole'}
|
{#if effectiveType === 'whole'}
|
||||||
<path d="M 16 12 Q 32 24 48 12" />
|
<path d="M 16 12 Q 32 24 48 12" />
|
||||||
<path d="M 16 52 Q 32 40 48 52" />
|
<path d="M 16 52 Q 32 40 48 52" />
|
||||||
|
{:else if effectiveType === 'start'}
|
||||||
|
<path d="M 16 12 Q 32 24 48 12" />
|
||||||
|
{:else if effectiveType === 'end'}
|
||||||
|
<path d="M 16 52 Q 32 40 48 52" />
|
||||||
|
{/if}
|
||||||
|
</g>
|
||||||
|
|
||||||
{:else if effectiveType === 'start'}
|
{#if feature.tunnelType === 'whole' && feature.length}
|
||||||
<path d="M 16 12 Q 32 24 48 12" />
|
<rect x="12" y="26" width="40" height="12" fill="white" />
|
||||||
|
<text
|
||||||
{:else if effectiveType === 'end'}
|
x="32"
|
||||||
<path d="M 16 52 Q 32 40 48 52" />
|
y="35"
|
||||||
{/if}
|
text-anchor="middle"
|
||||||
</g>
|
font-size="8.5"
|
||||||
|
font-weight="bold"
|
||||||
{#if feature.tunnelType === 'whole' && feature.length}
|
fill={portalColour}
|
||||||
<rect x="12" y="26" width="40" height="12" fill="white" />
|
class="t-text"
|
||||||
<text
|
>
|
||||||
x="32"
|
{feature.length}
|
||||||
y="35"
|
</text>
|
||||||
text-anchor="middle"
|
{/if}
|
||||||
font-size="8.5"
|
|
||||||
font-weight="bold"
|
|
||||||
fill={portalColour}
|
|
||||||
class="t-text"
|
|
||||||
>
|
|
||||||
{feature.length}
|
|
||||||
</text>
|
|
||||||
{/if}
|
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
svg { display: block; overflow: visible; }
|
svg {
|
||||||
.t-text { font-family: ui-monospace, monospace; }
|
display: block;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
.t-text {
|
||||||
|
font-family: ui-monospace, monospace;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -23,5 +23,5 @@ export const components = {
|
|||||||
signallerChange: SignallerChange,
|
signallerChange: SignallerChange,
|
||||||
electrificationChange: ElectrificationChange,
|
electrificationChange: ElectrificationChange,
|
||||||
default: BaseTrack,
|
default: BaseTrack,
|
||||||
tunnel: Tunnel,
|
tunnel: Tunnel
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,116 +1,236 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import RouteRow from '$lib/components/RouteRow.svelte';
|
import type { PageData } from './$types';
|
||||||
|
export let data: PageData;
|
||||||
|
|
||||||
const dummyFeatures = [
|
let searchTerm = '';
|
||||||
{
|
|
||||||
type: 'station',
|
const formatDate = (dateVal: string | null) => {
|
||||||
miles: 0,
|
if (!dateVal) return '---';
|
||||||
chains: 0,
|
const d = new Date(dateVal);
|
||||||
name: 'Testington',
|
return d.toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: '2-digit' });
|
||||||
description: 'Terminus',
|
};
|
||||||
terminus: true,
|
|
||||||
elec: '25kvac'
|
$: filteredMaps = data.maps.filter(m =>
|
||||||
},
|
m.routeId.toString().includes(searchTerm) ||
|
||||||
{
|
m.routeStart.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||||
type: 'station',
|
m.routeEnd.toLowerCase().includes(searchTerm.toLowerCase())
|
||||||
miles: 0,
|
);
|
||||||
chains: 76,
|
|
||||||
name: 'Closeby',
|
const isVerifiedRecently = (dateVal: string | null) => {
|
||||||
description: 'Temporarily closed',
|
if (!dateVal) return 'draft';
|
||||||
elec: '25kvac'
|
|
||||||
},
|
const checkedDate = new Date(dateVal).getTime();
|
||||||
{
|
const oneYearAgo = Date.now() - (365 * 24 * 60 * 60 * 1000);
|
||||||
type: 'junction',
|
|
||||||
name: 'Test Junction',
|
return checkedDate > oneYearAgo ? 'verified' : 'stale';
|
||||||
diverges: 'right',
|
};
|
||||||
direction: 'down',
|
|
||||||
elec: '25kvac',
|
|
||||||
elecBranch: 'none',
|
|
||||||
miles: 1,
|
|
||||||
chains: 13
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'bridge',
|
|
||||||
position: 'over',
|
|
||||||
category: 'pipeline',
|
|
||||||
name: 'Waterway Bridge',
|
|
||||||
roadName: 'TfL (LU)',
|
|
||||||
elec: '25kvac',
|
|
||||||
miles: 1,
|
|
||||||
chains: 41
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'crossover',
|
|
||||||
name: 'Dolphin junction',
|
|
||||||
elec: '25kvac',
|
|
||||||
miles: 1,
|
|
||||||
chains: 42
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'junction',
|
|
||||||
name: 'Test Junction South',
|
|
||||||
description: 'To: Banbury West Junction & Birmingham',
|
|
||||||
diverges: 'left',
|
|
||||||
direction: 'down',
|
|
||||||
elec: '25kvac',
|
|
||||||
elecBranch: '650vdc',
|
|
||||||
miles: 1,
|
|
||||||
chains: 42
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'electrificationChange',
|
|
||||||
from: {
|
|
||||||
elec: '25kvac',
|
|
||||||
eco: 'Didcot'
|
|
||||||
},
|
|
||||||
to: {
|
|
||||||
elec: 'none'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'crossing',
|
|
||||||
kind: 'ahb',
|
|
||||||
elec: '25kvac',
|
|
||||||
name: 'Swindon Lane',
|
|
||||||
description: 'Controlled by TVSC (Level Crossing WS)'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'loop',
|
|
||||||
side: 'both',
|
|
||||||
elec: '25kvac',
|
|
||||||
elecLoop: 'none'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'signallerChange',
|
|
||||||
from: 'TVSC - Didcot WS (SB)',
|
|
||||||
to: 'TVSC - Swindon WS (SN)',
|
|
||||||
elec: '25kvac'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'station',
|
|
||||||
miles: 4,
|
|
||||||
chains: 13,
|
|
||||||
name: 'Powerless',
|
|
||||||
description: "Doesn't exist",
|
|
||||||
elec: '750vdc'
|
|
||||||
}
|
|
||||||
];
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1>Welcome to SvelteKit</h1>
|
<div class="page-wrapper">
|
||||||
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p>
|
<header class="main-header">
|
||||||
|
<h1>ROUTE_DB</h1>
|
||||||
|
<div class="search-container">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
bind:value={searchTerm}
|
||||||
|
placeholder="Search index..."
|
||||||
|
class="search-input"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
<div class="map-container">
|
<div class="list-container">
|
||||||
{#each dummyFeatures as feature}
|
{#each filteredMaps as map}
|
||||||
<RouteRow {feature} activeElec={feature.elec} />
|
<a href="/map/{map.routeId.toString().padStart(4, '0')}" class="card">
|
||||||
{/each}
|
<div class="card-top">
|
||||||
|
<span class="route-id">{map.routeId.toString().padStart(4, '0')}</span>
|
||||||
|
<span class="status-badge {isVerifiedRecently(map.checked)}">
|
||||||
|
{#if isVerifiedRecently(map.checked) === 'verified'}
|
||||||
|
Reviewed
|
||||||
|
{:else if isVerifiedRecently(map.checked) === 'stale'}
|
||||||
|
Needs review
|
||||||
|
{:else}
|
||||||
|
Draft
|
||||||
|
{/if}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="location origin">{map.routeStart}</div>
|
||||||
|
<div class="path-arrow">↓</div>
|
||||||
|
<div class="location destination">{map.routeEnd}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-footer">
|
||||||
|
<span>Created: {formatDate(map.created)}</span>
|
||||||
|
{#if map.checked}
|
||||||
|
<span>• Checked: {formatDate(map.checked)}</span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
{:else}
|
||||||
|
<div class="empty-state">No maps found.</div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.map-container {
|
/* Mobile-First Base Styles */
|
||||||
width: 100%;
|
:global(body) {
|
||||||
max-width: 600px;
|
margin: 0;
|
||||||
margin: 0 auto;
|
background-color: #f8fafc;
|
||||||
font-family: sans-serif;
|
color: #0f172a;
|
||||||
}
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-wrapper {
|
||||||
|
padding: 1rem;
|
||||||
|
max-width: 800px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-header {
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
font-weight: 900;
|
||||||
|
letter-spacing: -0.05em;
|
||||||
|
margin: 0 0 1rem 0;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.8rem 1rem;
|
||||||
|
border: 2px solid #e2e8f0;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 1rem;
|
||||||
|
box-sizing: border-box; /* Ensures padding doesn't break width */
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-input:focus {
|
||||||
|
border-color: #3b82f6;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Card Layout (Mobile) */
|
||||||
|
.list-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
display: block;
|
||||||
|
background: white;
|
||||||
|
padding: 1.25rem;
|
||||||
|
border-radius: 16px;
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
box-shadow: 0 1px 3px rgba(0,0,0,0.05);
|
||||||
|
transition: transform 0.1s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:active {
|
||||||
|
transform: scale(0.98); /* Tactile feedback for mobile */
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-top {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.route-id {
|
||||||
|
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
||||||
|
font-weight: 800;
|
||||||
|
color: #3b82f6;
|
||||||
|
background: #eff6ff;
|
||||||
|
padding: 0.2rem 0.5rem;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-body {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.location {
|
||||||
|
font-size: 1.125rem;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.path-arrow {
|
||||||
|
color: #cbd5e1;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
margin: 0.2rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-footer {
|
||||||
|
font-size: 0.7rem;
|
||||||
|
color: #64748b;
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
border-top: 1px solid #f1f5f9;
|
||||||
|
padding-top: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update your existing badge styles */
|
||||||
|
.status-badge {
|
||||||
|
font-size: 0.65rem;
|
||||||
|
font-weight: 800;
|
||||||
|
text-transform: uppercase;
|
||||||
|
padding: 0.3rem 0.6rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
white-space: nowrap; /* Prevents label snapping on small screens */
|
||||||
|
}
|
||||||
|
|
||||||
|
.verified {
|
||||||
|
background: #dcfce7;
|
||||||
|
color: #166534;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stale {
|
||||||
|
background: #fef3c7; /* Amber/Yellow background */
|
||||||
|
color: #92400e; /* Dark brown/gold text */
|
||||||
|
border: 1px solid #fcd34d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.draft {
|
||||||
|
background: #f1f5f9;
|
||||||
|
color: #475569;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Desktop Adjustments */
|
||||||
|
@media (min-width: 640px) {
|
||||||
|
.page-wrapper {
|
||||||
|
padding: 3rem 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-input {
|
||||||
|
width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.path-arrow {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0 0.5rem;
|
||||||
|
transform: rotate(-90deg); /* Turn down arrow into right arrow */
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-body {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
17
src/routes/+page.ts
Normal file
17
src/routes/+page.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import type { PageLoad } from "./$types";
|
||||||
|
|
||||||
|
export const load: PageLoad = async ({ fetch }) => {
|
||||||
|
const response = await fetch('map-index.json');
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
return { maps: [] };
|
||||||
|
}
|
||||||
|
|
||||||
|
const maps = await response.json();
|
||||||
|
|
||||||
|
return {
|
||||||
|
maps: maps.sort((a: any, b: any) => {
|
||||||
|
return Number(a.routeId) - Number(b.routeId);
|
||||||
|
})
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -2,7 +2,10 @@ import { json } from '@sveltejs/kit';
|
|||||||
import type { RequestHandler } from './$types';
|
import type { RequestHandler } from './$types';
|
||||||
|
|
||||||
export const GET: RequestHandler = () => {
|
export const GET: RequestHandler = () => {
|
||||||
return json({ status: 'ok', uptime: process.uptime() }, {
|
return json(
|
||||||
status: 200
|
{ status: 'ok', uptime: process.uptime() },
|
||||||
});
|
{
|
||||||
|
status: 200
|
||||||
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import RouteRow from '$lib/components/RouteRow.svelte';
|
import RouteRow from '$lib/components/RouteRow.svelte';
|
||||||
import RouteEndLink from '$lib/components/mapIcons/RouteEndLink.svelte';
|
import RouteEndLink from '$lib/components/mapIcons/RouteEndLink.svelte';
|
||||||
import { slide } from 'svelte/transition';
|
import { slide } from 'svelte/transition';
|
||||||
|
|
||||||
// data.route contains: routeName, routeId, elecStart, elecEnd, routeDetail[]
|
// data.route contains: routeStart, routeEnd, 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
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
electrificationChange: true,
|
electrificationChange: true,
|
||||||
siteof: true,
|
siteof: true,
|
||||||
junction: true,
|
junction: true,
|
||||||
tunnel: true,
|
tunnel: true
|
||||||
};
|
};
|
||||||
|
|
||||||
let showFilters = false;
|
let showFilters = false;
|
||||||
@@ -58,16 +58,31 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="map-layout">
|
<div class="map-layout">
|
||||||
<header class="top-nav">
|
<header class="top-nav">
|
||||||
<h1>{data.route.routeName}</h1>
|
<div class="nav-cluster">
|
||||||
<span class="route-code">{data.route.routeId}</span>
|
<a href="/" class="home-link" title="Back to Index">
|
||||||
<div class="quick-actions">
|
<span class="home-icon">⌂</span>
|
||||||
<button class="icon-btn" on:click={() => (reversed = !reversed)}>
|
</a>
|
||||||
⇄ {reversed ? 'UP' : 'DN'}
|
|
||||||
</button>
|
<div class="route-stack">
|
||||||
<button class="icon-btn" on:click={() => (showFilters = !showFilters)}> Settings </button>
|
{#if data?.route}
|
||||||
</div>
|
<h1 class="primary-station">
|
||||||
</header>
|
{reversed ? data.route.routeEnd : data.route.routeStart}
|
||||||
|
</h1>
|
||||||
|
<span class="secondary-station">
|
||||||
|
to {reversed ? data.route.routeStart : data.route.routeEnd}
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="quick-actions">
|
||||||
|
<button class="icon-btn" on:click={() => (reversed = !reversed)}>
|
||||||
|
⇄ {reversed ? 'UP' : 'DN'}
|
||||||
|
</button>
|
||||||
|
<button class="icon-btn" on:click={() => (showFilters = !showFilters)}> Settings </button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
{#if showFilters}
|
{#if showFilters}
|
||||||
<div class="backdrop" on:click={() => (showFilters = false)}></div>
|
<div class="backdrop" on:click={() => (showFilters = false)}></div>
|
||||||
@@ -108,53 +123,130 @@
|
|||||||
<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}`)}
|
||||||
{#if (f.type === 'continues')}
|
{#if f.type === 'continues'}
|
||||||
<RouteEndLink feature={f} />
|
<RouteEndLink feature={f} />
|
||||||
{:else}
|
{:else}
|
||||||
<RouteRow feature={f} activeElec={f.activeElec} {reversed} />
|
<RouteRow feature={f} activeElec={f.activeElec} {reversed} />
|
||||||
{/if}
|
{/if}
|
||||||
{/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;
|
||||||
|
margin-top: 0;
|
||||||
|
padding-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-nav {
|
.top-nav {
|
||||||
position: sticky;
|
display: flex;
|
||||||
top: 0;
|
align-items: center;
|
||||||
z-index: 100;
|
justify-content: space-between;
|
||||||
background: rgba(255, 255, 255, 0.9);
|
padding: 0.5rem 1rem;
|
||||||
backdrop-filter: blur(10px);
|
background: #0f172a;
|
||||||
border-bottom: 1px solid #e2e8f0;
|
color: white;
|
||||||
padding: 0.75rem 1rem;
|
gap: 1rem;
|
||||||
display: flex;
|
}
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
.nav-cluster {
|
||||||
gap: 1rem;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1rem;
|
||||||
|
min-width: 0; /* Prevents flex children from overflowing */
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-link {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
background: #1e293b;
|
||||||
|
border: 1px solid #334155;
|
||||||
|
border-radius: 8px;
|
||||||
|
color: #94a3b8;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
flex-shrink: 0; /* Keeps button from squishing on mobile */
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-link:hover {
|
||||||
|
background: #334155;
|
||||||
|
color: white;
|
||||||
|
border-color: #475569;
|
||||||
|
}
|
||||||
|
|
||||||
|
.route-stack {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.primary-station {
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 800;
|
||||||
|
margin: 0;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.secondary-station {
|
||||||
|
font-size: 0.7rem;
|
||||||
|
color: #94a3b8;
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-btn {
|
||||||
|
background: #1e293b;
|
||||||
|
border: 1px solid #334155;
|
||||||
|
color: white;
|
||||||
|
padding: 0.4rem 0.6rem;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: bold;
|
||||||
|
cursor: pointer;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-spine {
|
||||||
|
padding-top: 72px;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
.secondary-station {
|
||||||
flex: 1;
|
font-size: 0.85rem;
|
||||||
min-width: 0;
|
font-weight: 500;
|
||||||
margin: 0;
|
color: #64748b;
|
||||||
font-size: 1.1rem;
|
letter-spacing: 0.025em;
|
||||||
font-weight: 800;
|
margin-top: 2px;
|
||||||
line-height: 1.2;
|
|
||||||
color: #0f172a;
|
|
||||||
letter-spacing: -0.02em;
|
|
||||||
white-space: normal;
|
|
||||||
overflow-wrap: break-word;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
@media (min-width: 768px) {
|
||||||
|
.primary-station {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
.secondary-station {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
.top-nav {
|
.top-nav {
|
||||||
padding: 1rem 2rem;
|
padding: 0 2rem;
|
||||||
|
height: 90px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map-spine {
|
||||||
|
padding-top: 90px;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
@@ -242,4 +334,37 @@
|
|||||||
color: white;
|
color: white;
|
||||||
border-color: #1e293b;
|
border-color: #1e293b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.quick-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.5rem;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.4rem;
|
||||||
|
padding: 0.5rem 0.8rem;
|
||||||
|
border-radius: 12px;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
background: #f8fafc;
|
||||||
|
color: #475569;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 700;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-btn:hover {
|
||||||
|
background: #f1f5f9;
|
||||||
|
border-color: #cbd5e1;
|
||||||
|
color: #1e293b;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-btn:active {
|
||||||
|
transform: scale(0.96);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
routeName: Paddington - Reading West Jn
|
routeStart: Paddington
|
||||||
|
routeEnd: Reading West Jn
|
||||||
routeId: 0001
|
routeId: 0001
|
||||||
|
created: 2026-02-04
|
||||||
|
checked: 2026-02-06
|
||||||
signallerStart: TVSC Paddington WS
|
signallerStart: TVSC Paddington WS
|
||||||
signallerEnd: TVSC Reading WS
|
signallerEnd: TVSC Reading WS
|
||||||
elecStart:
|
elecStart:
|
||||||
@@ -117,8 +120,8 @@ routeDetail:
|
|||||||
chains: 73
|
chains: 73
|
||||||
|
|
||||||
- type: junction
|
- type: junction
|
||||||
name: Kensal Green South Junction
|
name: Kensal Green East Junction
|
||||||
diverges: right
|
diverges: both
|
||||||
direction: down
|
direction: down
|
||||||
description: to Crossrail & North Pole Depots
|
description: to Crossrail & North Pole Depots
|
||||||
miles: 2
|
miles: 2
|
||||||
@@ -141,11 +144,16 @@ routeDetail:
|
|||||||
- type: junction
|
- type: junction
|
||||||
name: Old Oak Common East
|
name: Old Oak Common East
|
||||||
diverges: left
|
diverges: left
|
||||||
direction: up
|
direction: down
|
||||||
description: to Crossrail Depot
|
description: to Crossrail Depot
|
||||||
miles: 2
|
miles: 2
|
||||||
chains: 62
|
chains: 62
|
||||||
|
|
||||||
|
- type: siteof
|
||||||
|
name: Old Oak Common HS2 interchange
|
||||||
|
miles: 3
|
||||||
|
chains: 0
|
||||||
|
|
||||||
- type: junction
|
- type: junction
|
||||||
name: Old Oak Common West
|
name: Old Oak Common West
|
||||||
diverges: left
|
diverges: left
|
||||||
@@ -432,7 +440,7 @@ routeDetail:
|
|||||||
- type: bridge
|
- type: bridge
|
||||||
name: Yeading Brook
|
name: Yeading Brook
|
||||||
position: under
|
position: under
|
||||||
category: waterway
|
category: stream
|
||||||
miles: 10
|
miles: 10
|
||||||
chains: 29
|
chains: 29
|
||||||
|
|
||||||
@@ -450,6 +458,11 @@ routeDetail:
|
|||||||
miles: 10
|
miles: 10
|
||||||
chains: 32
|
chains: 32
|
||||||
|
|
||||||
|
- type: crossovers
|
||||||
|
name: Hayes East
|
||||||
|
miles: 10
|
||||||
|
chains: 45
|
||||||
|
|
||||||
- type: bridge
|
- type: bridge
|
||||||
position: under
|
position: under
|
||||||
category: waterway
|
category: waterway
|
||||||
@@ -500,7 +513,7 @@ routeDetail:
|
|||||||
chains: 22
|
chains: 22
|
||||||
|
|
||||||
- type: crossovers
|
- type: crossovers
|
||||||
name: West Drayton East
|
name: West Drayton East Junction
|
||||||
miles: 12
|
miles: 12
|
||||||
chains: 67
|
chains: 67
|
||||||
|
|
||||||
@@ -529,6 +542,7 @@ routeDetail:
|
|||||||
diverges: left
|
diverges: left
|
||||||
direction: down
|
direction: down
|
||||||
description: Colnbrook Freight (near Heathrow)
|
description: Colnbrook Freight (near Heathrow)
|
||||||
|
elecBranch: none
|
||||||
miles: 13
|
miles: 13
|
||||||
chains: 31
|
chains: 31
|
||||||
|
|
||||||
@@ -568,7 +582,7 @@ routeDetail:
|
|||||||
- type: bridge
|
- type: bridge
|
||||||
name: Stream
|
name: Stream
|
||||||
position: under
|
position: under
|
||||||
category: waterway
|
category: stream
|
||||||
miles: 14
|
miles: 14
|
||||||
chains: 10
|
chains: 10
|
||||||
|
|
||||||
@@ -616,7 +630,7 @@ routeDetail:
|
|||||||
- type: bridge
|
- type: bridge
|
||||||
name: Stream
|
name: Stream
|
||||||
position: under
|
position: under
|
||||||
category: waterway
|
category: stream
|
||||||
miles: 15
|
miles: 15
|
||||||
chains: 61
|
chains: 61
|
||||||
|
|
||||||
@@ -850,7 +864,7 @@ routeDetail:
|
|||||||
- type: bridge
|
- type: bridge
|
||||||
name: Stream
|
name: Stream
|
||||||
position: under
|
position: under
|
||||||
category: waterway
|
category: stream
|
||||||
miles: 23
|
miles: 23
|
||||||
chains: 66
|
chains: 66
|
||||||
|
|
||||||
@@ -1027,9 +1041,11 @@ routeDetail:
|
|||||||
chains: 1
|
chains: 1
|
||||||
|
|
||||||
- type: junction
|
- type: junction
|
||||||
|
name: Henley Branch Junction
|
||||||
diverges: left
|
diverges: left
|
||||||
direction: down
|
direction: down
|
||||||
description: Henley-on-Thames from Platform 4 only
|
description: Henley-on-Thames from Platform 4 only
|
||||||
|
elecBranch: none
|
||||||
miles: 31
|
miles: 31
|
||||||
chains: 4
|
chains: 4
|
||||||
|
|
||||||
@@ -1162,6 +1178,7 @@ routeDetail:
|
|||||||
name: Reading New Junction
|
name: Reading New Junction
|
||||||
diverges: right
|
diverges: right
|
||||||
direction: up
|
direction: up
|
||||||
|
elecBranch: none
|
||||||
description: to Southern Lines (Waterloo/Guildford)
|
description: to Southern Lines (Waterloo/Guildford)
|
||||||
miles: 35
|
miles: 35
|
||||||
chains: 40
|
chains: 40
|
||||||
@@ -1177,6 +1194,7 @@ routeDetail:
|
|||||||
name: Reading East Junction
|
name: Reading East Junction
|
||||||
diverges: left
|
diverges: left
|
||||||
direction: up
|
direction: up
|
||||||
|
elecBranch: none
|
||||||
description: to Southern Lines (Waterloo/Guildford)
|
description: to Southern Lines (Waterloo/Guildford)
|
||||||
miles: 35
|
miles: 35
|
||||||
chains: 61
|
chains: 61
|
||||||
|
|||||||
18
static/mapFiles/yaml/0002.yaml
Normal file
18
static/mapFiles/yaml/0002.yaml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
routeStart: Reading West Jn
|
||||||
|
routeEnd: Bristol TM
|
||||||
|
routeId: 0002
|
||||||
|
created: 2026-02-04
|
||||||
|
checked:
|
||||||
|
signallerStart: TVSC Reading WS
|
||||||
|
signallerEnd: TVSC Temple Meads WS
|
||||||
|
elecStart:
|
||||||
|
elec: 25kvac
|
||||||
|
eco: Didcot (TVSC)
|
||||||
|
elecEnd:
|
||||||
|
elec: none
|
||||||
|
routeDetail:
|
||||||
|
- type: crossovers
|
||||||
|
name: Scours Lane Junction
|
||||||
|
description: Line diverges
|
||||||
|
miles: 38
|
||||||
|
chains: 90
|
||||||
Reference in New Issue
Block a user