From fbbf39ff84bcd1da00100b224cd6cd51373a27cb Mon Sep 17 00:00:00 2001 From: Ludwig Chieng Date: Sat, 23 Dec 2023 16:11:33 +0100 Subject: [PATCH] feat: add line map --- src/routes/timetables/[line]/+page.svelte | 167 +++++++++++++++++++++- static/schemas/line-maps/line-maps.d.ts | 19 +-- 2 files changed, 172 insertions(+), 14 deletions(-) diff --git a/src/routes/timetables/[line]/+page.svelte b/src/routes/timetables/[line]/+page.svelte index b5d8f4d..bf7f3ee 100644 --- a/src/routes/timetables/[line]/+page.svelte +++ b/src/routes/timetables/[line]/+page.svelte @@ -1,7 +1,170 @@ + +
+ + {#each data.lineMap as row} + + {#each row.drawing as cell} + + {/each} + {#if row.slugName} + + {/if} + + {/each} +
+ {#if cell === '*'} + + + + {:else if cell === '^'} + + + + + {:else if cell === 'v'} + + + + + {:else if cell === 'o\\'} + + + + {:else if cell === 'o/'} + + + + {:else if cell === '\\o'} + + + + {:else if cell === '/o'} + + + + {:else if cell === '\\.'} + + + + {:else if cell === '/.'} + + + + {:else if cell === '.\\'} + + + + {:else if cell === './'} + + + + {/if} + {#if ['↑', '↓'].includes(cell)} + {cell} + {/if} + + + {row.displayName} + {#if row.lineConnections} +
+ {#each row.lineConnections as connection} + {connection.line} + {/each} +
+ {/if} +
+
+
+ + diff --git a/static/schemas/line-maps/line-maps.d.ts b/static/schemas/line-maps/line-maps.d.ts index 71d6fec..75148e0 100644 --- a/static/schemas/line-maps/line-maps.d.ts +++ b/static/schemas/line-maps/line-maps.d.ts @@ -10,15 +10,10 @@ type Stop = { lineConnections: Array<{ line: string; slugName: string }>; }; -export type LineMap = Array< - | { - drawing: string[]; - isTerminus: true; - slugName: string; - displayName: string; - lineConnections: Array<{ line: string; slugName: string }>; - } - | { - drawing: string[]; - } ->; +export type LineMap = Array<{ + drawing: string[]; + isTerminus?: true; + slugName?: string; + displayName?: string; + lineConnections?: Array<{ line: string; slugName: string }>; +}>;