5 Commits

Author SHA1 Message Date
39511dd428 Improve 'branding' and mobile layout 2026-02-07 20:50:52 +00:00
cfcf651e41 Add favicon 2026-02-07 20:50:39 +00:00
cfa1d44dbc Run prettier 2026-02-07 00:38:56 +00:00
ca5e78e2b1 Add OwlBoard styling 2026-02-07 00:31:37 +00:00
6c10cb628e Fix linter warnings 2026-02-06 23:54:50 +00:00
11 changed files with 1707 additions and 1651 deletions

View File

@@ -6,4 +6,4 @@ bun.lock
bun.lockb
# Miscellaneous
/static/
#/static/

View File

@@ -23,11 +23,11 @@ fs.readdirSync(inputDir).forEach((file) => {
routeStart: content.routeStart || null,
routeEnd: content.routeEnd || null,
created: content.created || null,
checked: content.checked || null,
checked: content.checked || null
});
}
});
fs.writeFileSync(indexFile, JSON.stringify(mapList));
console.log(`Generated ${mapList.length} map files and index.`)
console.log(`Generated ${mapList.length} map files and index.`);

View File

@@ -1,4 +1,4 @@
import { type HandleFetch } from "@sveltejs/kit";
import { type HandleFetch } from '@sveltejs/kit';
export const handleFetch: HandleFetch = async ({ request, fetch }) => {
if (request.url.startsWith('https://maps.owlboard.info')) {
@@ -11,10 +11,10 @@ export const handleFetch: HandleFetch = async ({ request, fetch }) => {
method: request.method,
headers: headers,
body: request.body,
// @ts-ignore - 'duplex' is needed for node fetch with bodies
// @ts-expect-error - 'duplex' is needed for node fetch with bodies
duplex: 'half'
});
}
return fetch(request);
}
};

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -4,7 +4,15 @@
export let feature: {
position: 'over' | 'under';
category: 'rail' |'stream'| 'foot' | 'aroad' | 'minorRoad' | 'motorway' | 'waterway' | 'pipeline';
category:
| 'rail'
| 'stream'
| 'foot'
| 'aroad'
| 'minorRoad'
| 'motorway'
| 'waterway'
| 'pipeline';
roadName?: string;
};
export let activeElec: ElecType;
@@ -98,11 +106,10 @@
{#if isOver}
<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="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} />
<rect x="6" y={32 - s.width / 2} width="52" height={s.width} fill={s.bg} />
{#if s.type === 'road'}
<line
@@ -121,14 +128,16 @@
{/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}`}
/>
<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}
<rect x="6" y={32 - (s.width / 2)} width="52" height={s.width} fill={s.bg} />
<rect x="6" y={32 - s.width / 2} width="52" height={s.width} fill={s.bg} />
{#if s.type === 'road'}
<line
@@ -148,9 +157,13 @@
<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 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}`} />
<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>
<BaseTrack {activeElec} height={64} />

View File

@@ -18,7 +18,7 @@
};
const getPath = (side: 'left' | 'right') => {
const yStart = visualUp ? 64 : 0;
const yStart = visualUp ? 64 : 8;
const yEnd = visualUp ? 8 : 56;
const xEnd = side === 'right' ? 56 : 8;
return `M 32 ${yStart} Q 32 32 ${xEnd} ${yEnd}`;
@@ -34,7 +34,7 @@
</script>
<svg viewBox="0 0 64 64" width="64" height="64" class="junction">
{#each paths as d}
{#each paths as d (d)}
<path {d} fill="none" stroke={branchColour} stroke-width="5" stroke-linecap="round" />
{/each}
<BaseTrack {activeElec} height={64} />

View File

@@ -1,38 +1,58 @@
<script lang="ts">
import type { PageData } from './$types';
import { base } from '$app/paths';
export let data: PageData;
let searchTerm = '';
const formatDate = (dateVal: string | null) => {
if (!dateVal) return '---';
const d = new Date(dateVal);
return d.toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: '2-digit' });
};
$: filteredMaps = data.maps.filter(m =>
$: filteredMaps = data.maps.filter(
(m) =>
m.routeId.toString().includes(searchTerm) ||
m.routeStart.toLowerCase().includes(searchTerm.toLowerCase()) ||
m.routeEnd.toLowerCase().includes(searchTerm.toLowerCase())
);
const vibrate = (patern: number | number[] = 10) => {
if (typeof window !== 'undefined' && window.navigator.vibrate) {
window.navigator.vibrate(pattern);
}
}
const isVerifiedRecently = (dateVal: string | null) => {
if (!dateVal) return 'draft';
const checkedDate = new Date(dateVal).getTime();
const oneYearAgo = Date.now() - (365 * 24 * 60 * 60 * 1000);
const oneYearAgo = Date.now() - 365 * 24 * 60 * 60 * 1000;
return checkedDate > oneYearAgo ? 'verified' : 'stale';
};
const formatDate = (dateVal: string | null) => {
if (!dateVal) return 'N/A';
const date = new Date(dateVal);
// Check for invalid dates to avoid "NaN/NaN/NaN"
if (isNaN(date.getTime())) return 'Invalid Date';
const d = date.getDate().toString().padStart(2, '0');
const m = (date.getMonth() + 1).toString().padStart(2, '0');
const y = date.getFullYear().toString().slice(-2);
return `${d}/${m}/${y}`;
};
</script>
<div class="page-wrapper">
<header class="main-header">
<div class="brand-container">
<img src="https://owlboard.info/images/logo/wide_logo.svg" alt="OwlBoard Logo" class="main-logo" />
<img
src="https://owlboard.info/images/logo/wide_logo.svg"
alt="OwlBoard Logo"
class="main-logo"
/>
<div class="brand-text">
<h1>Routes</h1>
<p class="sub-brand">by OwlBoard</p>
</div>
<div class="search-container">
<input
@@ -42,11 +62,13 @@ const isVerifiedRecently = (dateVal: string | null) => {
class="search-input"
/>
</div>
</div>
</header>
<div class="list-container">
{#each filteredMaps as map}
<a href="/map/{map.routeId.toString().padStart(4, '0')}" class="card">
<a href="https://owlboard.info" class="button-link">Go to OwlBoard Live Departures & PIS</a>
{#each filteredMaps as map (map.routeId)}
<a href="{base}/map/{map.routeId.toString().padStart(4, '0')}" class="card" on:click={() => vibrate(10)}>
<div class="card-top">
<span class="route-id">{map.routeId.toString().padStart(4, '0')}</span>
<span class="status-badge {isVerifiedRecently(map.checked)}">
@@ -62,14 +84,14 @@ const isVerifiedRecently = (dateVal: string | null) => {
<div class="card-body">
<div class="location origin">{map.routeStart}</div>
<div class="path-arrow"></div>
<div class="path-arrow">to</div>
<div class="location destination">{map.routeEnd}</div>
</div>
<div class="card-footer">
<span>Created: {formatDate(map.created)}</span>
<span>Created on {formatDate(map.created)}</span>
{#if map.checked}
<span>• Checked: {formatDate(map.checked)}</span>
<span>• Checked & Updated on {formatDate(map.checked)}</span>
{/if}
</div>
</a>
@@ -83,9 +105,10 @@ const isVerifiedRecently = (dateVal: string | null) => {
/* Mobile-First Base Styles */
:global(body) {
margin: 0;
background-color: #f8fafc;
background-color: #404c55;
background-image: radial-gradient(#2b343c, #404c55);
color: #0f172a;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.page-wrapper {
@@ -96,18 +119,27 @@ const isVerifiedRecently = (dateVal: string | null) => {
.main-header {
margin-bottom: 1.5rem;
position: fixed;
top: 0;
left: 0;
box-sizing: border-box;
width: 100%;
background: #3c6f79;
color: #ebebeb;
z-index: 100;
}
.brand-container {
padding: 15px;
display: flex;
width: 100%;
align-items: center;
box-sizing: border-box;
gap: 1rem;
margin-bottom: 1.5rem;
}
.main-logo {
/* Adjust height to fit your logo's aspect ratio */
height: 48px;
height: 52px;
width: auto;
display: block;
}
@@ -121,68 +153,92 @@ const isVerifiedRecently = (dateVal: string | null) => {
font-style: italic;
}
.sub-brand {
font-size: 0.65rem;
font-weight: 800;
color: #94a3b8;
text-transform: uppercase;
letter-spacing: 0.1em;
margin: 0.2rem 0 0 0;
}
/* Desktop layout adjustment */
@media (min-width: 640px) {
.main-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 3rem;
}
.brand-container {
margin-bottom: 0;
}
.main-logo {
height: 56px;
}
.search-container {
margin-left: auto;
}
.search-input {
width: 100%;
margin-left: auto;
height: 50px;
padding: 0.8rem 1rem;
border: 2px solid #e2e8f0;
border-radius: 12px;
text-align: center;
text-transform: uppercase;
border-radius: 30px;
border: none;
font-size: 1rem;
transition: all 0.3s ease;
box-sizing: border-box; /* Ensures padding doesn't break width */
outline: none;
}
.search-input:focus {
border-color: #3b82f6;
.search-input:hover {
box-shadow: rgba(0, 0, 0, 0.46);
}
/* Card Layout (Mobile) */
.list-container {
display: flex;
flex-direction: column;
gap: 1rem;
padding: 90px 1rem 1rem 1rem;
isolation: isolate;
z-index: 1;
}
@media (max-width: 600px) {
.list-container {
padding-top: 90px;
gap: 0.75rem;
padding-left: 0.5rem;
padding-right: 0.5rem;
}
.card {
padding: 10px 12px;
margin: 0;
border-radius: 4px;
}
.location {
font-size: 1rem;
margin-bottom: 0.1rem;
font-weight: 500;
}
.path-arrow {
color: #fff;
font-size: 0.8rem;
margin: 0.1rem 0;
line-height: 0.75;
}
.card-footer {
font-size: 0.6rem;
line-height: 0.5;
padding-bottom: 2px;
}
}
.card {
display: block;
background: white;
background: #3c6f79;
padding: 1.25rem;
border-radius: 16px;
border-radius: 35px;
text-decoration: none;
color: inherit;
border: 1px solid #e2e8f0;
box-shadow: 0 1px 3px rgba(0,0,0,0.05);
color: #4fd1d1;
text-shadow: 2px 1px 10px rgba(0, 0, 0, 0.29);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.482);
transition: transform 0.1s ease;
cursor: pointer;
}
.card:hover {
transform: scale(1.01);
z-index: 5;
}
.card:active {
transform: scale(0.98); /* Tactile feedback for mobile */
transform: scale(0.99); /* Tactile feedback for mobile */
}
.card-top {
@@ -195,8 +251,9 @@ const isVerifiedRecently = (dateVal: string | null) => {
.route-id {
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-weight: 800;
color: #3b82f6;
background: #eff6ff;
color: #fff;
background: #2d2d2d;
text-shadow: none;
padding: 0.2rem 0.5rem;
border-radius: 6px;
}
@@ -212,29 +269,28 @@ const isVerifiedRecently = (dateVal: string | null) => {
}
.path-arrow {
color: #cbd5e1;
color: #fff;
font-size: 0.9rem;
margin: 0.2rem 0;
}
.card-footer {
font-size: 0.7rem;
color: #64748b;
color: #e2ebeb;
text-transform: uppercase;
font-weight: 600;
letter-spacing: 0.05em;
border-top: 1px solid #f1f5f9;
padding-top: 0.75rem;
padding-top: 0;
}
/* Update your existing badge styles */
.status-badge {
font-size: 0.65rem;
font-weight: 800;
text-shadow: none;
text-transform: uppercase;
padding: 0.3rem 0.6rem;
border-radius: 999px;
white-space: nowrap; /* Prevents label snapping on small screens */
white-space: nowrap;
}
.verified {
@@ -243,8 +299,8 @@ const isVerifiedRecently = (dateVal: string | null) => {
}
.stale {
background: #fef3c7; /* Amber/Yellow background */
color: #92400e; /* Dark brown/gold text */
background: #fef3c7;
color: #92400e;
border: 1px solid #fcd34d;
}
@@ -253,31 +309,22 @@ const isVerifiedRecently = (dateVal: string | null) => {
color: #475569;
}
/* Desktop Adjustments */
@media (min-width: 640px) {
.page-wrapper {
padding: 3rem 1.5rem;
.button-link {
text-decoration: none;
border: none;
background: #3c6f79;
max-width: 360px;
padding: 8px 25px;
margin: auto;
text-align: center;
border-radius: 25px;
width: auto;
color: #e2ebeb;
transition: 0.3s all ease;
font-weight: 620;
}
.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;
}
.button-link:hover {
background: #2b2b2b;
}
</style>

View File

@@ -1,4 +1,4 @@
import type { PageLoad } from "./$types";
import type { PageLoad } from './$types';
export const load: PageLoad = async ({ fetch }) => {
const response = await fetch('map-index.json');

View File

@@ -2,6 +2,7 @@
import RouteRow from '$lib/components/RouteRow.svelte';
import RouteEndLink from '$lib/components/mapIcons/RouteEndLink.svelte';
import { slide } from 'svelte/transition';
import { base } from '$app/paths';
// data.route contains: routeStart, routeEnd, routeId, elecStart, elecEnd, routeDetail[]
export let data;
@@ -60,7 +61,7 @@
<div class="map-layout">
<header class="top-nav">
<div class="nav-cluster">
<a href="/" class="home-link" title="Back to Index">
<a href="{base}/" class="home-link" title="Back to Index">
<span class="home-icon"></span>
</a>
@@ -106,7 +107,7 @@
<div class="drawer-content">
<div class="filter-flex">
{#each Object.keys(visibleTypes) as type}
{#each Object.keys(visibleTypes) as type (type)}
<button
class="filter-chip"
class:active={visibleTypes[type]}
@@ -144,13 +145,19 @@
}
.top-nav {
position: fixed;
width: 100%;
box-sizing: border-box;
top: 0;
left: 0;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.5rem 1rem;
background: #0f172a;
color: white;
background: #3c6f79;
color: #e1ebeb;
gap: 1rem;
z-index: 10000;
}
.nav-cluster {
@@ -166,19 +173,18 @@
justify-content: center;
width: 36px;
height: 36px;
background: #1e293b;
background: #404c55;
border: 1px solid #334155;
border-radius: 8px;
color: #94a3b8;
color: #e1ebeb;
text-decoration: none;
font-size: 1.2rem;
flex-shrink: 0; /* Keeps button from squishing on mobile */
flex-shrink: 0;
transition: all 0.3s ease;
}
.home-link:hover {
background: #334155;
color: white;
border-color: #475569;
background: #2d2d2d;
}
.route-stack {
@@ -192,13 +198,14 @@
font-weight: 800;
margin: 0;
white-space: nowrap;
color: #cce9e9;
overflow: hidden;
text-overflow: ellipsis;
}
.secondary-station {
font-size: 0.7rem;
color: #94a3b8;
color: #cce9e9;
text-transform: uppercase;
font-weight: 600;
}
@@ -208,30 +215,10 @@
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;
}
.secondary-station {
font-size: 0.85rem;
font-weight: 500;
color: #64748b;
letter-spacing: 0.025em;
margin-top: 2px;
}
@media (min-width: 768px) {
.primary-station {
font-size: 1.5rem;
@@ -267,6 +254,7 @@
inset: 0;
background: rgba(0, 0, 0, 0.4);
z-index: 150;
transition: all 0.3s ease;
}
.filter-drawer {
@@ -274,7 +262,7 @@
bottom: 0;
left: 0;
right: 0;
background: white;
background: #3c6f79;
z-index: 200;
border-radius: 20px 20px 0 0;
box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.15);
@@ -287,17 +275,17 @@
justify-content: space-between;
align-items: center;
padding: 1.25rem 1.5rem 0.75rem;
border-bottom: 1px solid #f1f5f9;
border-bottom: 1px solid #e1ebeb;
}
.drawer-header h3 {
margin: 0;
font-size: 1rem;
color: #1e293b;
color: #e1ebeb;
}
.close-icon {
background: #f1f5f9;
background: #404c55;
border: none;
border-radius: 50%;
width: 32px;
@@ -306,7 +294,12 @@
align-items: center;
justify-content: center;
cursor: pointer;
color: #64748b;
color: #e1ebeb;
transition: all 0.3s ease;
}
.close-icon:hover {
background: #2d2d2d;
}
.drawer-content {
@@ -323,14 +316,14 @@
padding: 0.5rem 1rem;
border-radius: 999px;
border: 1px solid #e2e8f0;
background: #f8fafc;
background: #ff6060;
font-size: 0.875rem;
cursor: pointer;
transition: all 0.2s;
}
.filter-chip.active {
background: #1e293b;
background: #00725b;
color: white;
border-color: #1e293b;
}
@@ -345,23 +338,22 @@
display: inline-flex;
align-items: center;
gap: 0.4rem;
border: none;
padding: 0.5rem 0.8rem;
border-radius: 12px;
border: 1px solid #e2e8f0;
background: #f8fafc;
color: #475569;
background: #404c55;
color: #e1ebeb;
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;
transition: all 0.3s ease;
}
.icon-btn:hover {
background: #f1f5f9;
border-color: #cbd5e1;
color: #1e293b;
background: #2d2d2d;
}
.icon-btn:active {

View File

@@ -1179,7 +1179,7 @@ routeDetail:
diverges: right
direction: up
elecBranch: none
description: to Southern Lines (Waterloo/Guildford)
description: Up/Dn Reading Spur to Southern Lines (Waterloo/Guildford)
miles: 35
chains: 40
@@ -1187,6 +1187,7 @@ routeDetail:
position: under
category: rail
name: Low Level Tunnel
description: Reading Low Level line
miles: 35
chains: 40
@@ -1250,4 +1251,4 @@ routeDetail:
- type: continues
routeName: Reading West Jn - Bristol TM
routeId: "0002"
routeId: '0002'

View File

@@ -11,6 +11,9 @@ elecStart:
elecEnd:
elec: none
routeDetail:
- type: continues
routeName: Paddington - Reading West Jn
routeId: '0001'
- type: crossovers
name: Scours Lane Junction
description: Line diverges