From 53e3544effa012d36f3b0d732a922ca219b7692a Mon Sep 17 00:00:00 2001 From: memdmp Date: Sat, 23 Aug 2025 19:34:47 +0200 Subject: feat: changes --- src/app.css | 22 ++++++++++++ src/app.html | 2 +- src/lib/Timetable.svelte | 28 ++++++++++----- src/lib/assets/LineGlyph.svelte | 44 +++++++++++++++-------- src/routes/train-ico/[type]/[[line]]/+page.svelte | 7 ++-- 5 files changed, 77 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/app.css b/src/app.css index 211e2c1..70e67da 100644 --- a/src/app.css +++ b/src/app.css @@ -8,6 +8,8 @@ system-ui, sans-serif; } +@custom-variant dark (&:where(.dark, .dark *)); + @keyframes loadingbar { 0% { width: 0; @@ -25,6 +27,26 @@ html { font-family: var(--font-sbb-typo); + @apply dark:scheme-dark; +} +html:has(.no-scroll-body), +body:has(.no-scroll-body) { + overflow-y: hidden; +} + +@keyframes shimmer { + 0% { + background-position: calc(-1 * var(--shimmer-w, 1000px)) 0; + } + 100% { + background-position: var(--shimmer-w, 1000px) 0; + } +} + +.skeleton-shimmer { + animation: shimmer 2s infinite linear; + background-size: var(--shimmer-w, 1000px) 100%; + @apply not-dark:bg-[linear-gradient(to_right,_#f6f7f8_4%,_#edeef1_25%,_#f6f7f8_36%)] bg-[linear-gradient(to_right,_#edeef100_4%,_#edeef110_25%,_#edeef100_36%)]; } @font-face { diff --git a/src/app.html b/src/app.html index 48ea59c..1213eea 100644 --- a/src/app.html +++ b/src/app.html @@ -1,5 +1,5 @@ - + diff --git a/src/lib/Timetable.svelte b/src/lib/Timetable.svelte index 22f9139..c805d6d 100644 --- a/src/lib/Timetable.svelte +++ b/src/lib/Timetable.svelte @@ -271,7 +271,8 @@ {:else} -
- {#if (placeName || placeId) && isResultsPage} + {#if (placeName || placeId) && isResultsPage} +

{m.no_results_title()}

{#each m @@ -382,9 +383,20 @@ >{part}{/if}{/each}

- {:else if placeId} - TODO: add some loader here - {:else} +
+ {:else if placeId} +
+ {#each Array(30) as _} +
+
+
+ {/each} +
+ {:else} +

{m.welcome_title()}

{m.welcome_body_1()} @@ -463,7 +475,7 @@ onclick={() => setSearch('Lindau-Reutin')}>Lindau-Reutin

- {/if} -
+ + {/if} {/if} diff --git a/src/lib/assets/LineGlyph.svelte b/src/lib/assets/LineGlyph.svelte index a92716e..d890438 100644 --- a/src/lib/assets/LineGlyph.svelte +++ b/src/lib/assets/LineGlyph.svelte @@ -96,20 +96,34 @@ }, }; let { - kind: routeShortName, + kind: _routeShortName, type: _type, line: _line, currentColor: _currentColor, - nightIsFilled = true, + forceColor, + dark = false, + negative = true, }: { /** i.e. RE69, TER, etc... */ kind: string; type?: keyof typeof fernverkehrIconMap | string | null; line?: string; - nightIsFilled?: boolean; - } & { - currentColor?: string; - } = $props(); + negative?: boolean; + dark?: boolean; + } & ( + | { + currentColor: string; + forceColor?: boolean; + } + | Record + ) = $props(); + let routeShortName = $derived( + _routeShortName.startsWith('REX ') + ? _routeShortName.length >= 7 + ? 'REX' + : _routeShortName.replace('REX ', 'REX') + : _routeShortName + ); let shortNumberIndex = $derived( routeShortName.split('').findIndex((char) => char.match(/[0-9]/)) @@ -150,13 +164,15 @@ isFernverkehr = $derived( (lineType ?? '').toUpperCase() in fernverkehrIconMap ), - isNightRendering = + isNightRendering = $derived( routeShortName.toUpperCase().startsWith('SN') || - routeShortName.toUpperCase().startsWith('REN') || - routeShortName.toUpperCase().startsWith('IRN'), - isErsatzverkehr = routeShortName.toUpperCase().startsWith('EV'); + routeShortName.toUpperCase().startsWith('REN') || + routeShortName.toUpperCase().startsWith('IRN') + ), + isErsatzverkehr = $derived(routeShortName.toUpperCase().startsWith('EV')); let currentColor = $derived( - _currentColor ?? (isRE ? '#eb0000' : 'currentColor') + (forceColor || !(isRE && !dark) ? _currentColor : undefined) ?? + (isRE && !dark ? '#eb0000' : 'currentColor') ); const sbbFontFamilySvgDeclaration = "font-family: SBB, 'SBB Web', 'Helvetica Neue', Helvetica, Inter, system-ui, sans-serif"; @@ -258,12 +274,12 @@ id="path1-8" style="display:inline;fill:{isErsatzverkehr ? '#e84e10' - : nightIsFilled && isNightRendering + : negative && isNightRendering ? '#000' : 'none'};stroke:{isErsatzverkehr ? '#e84e10' : isNightRendering - ? nightIsFilled + ? negative ? '#000' : '#FFDE15' : currentColor};stroke-opacity:1" @@ -301,7 +317,7 @@ 'fill-opacity:1', `stroke:${ /*isNightRendering - ? nightIsFilled + ? negative '#FFDE15' : currentColor*/ 'none' }`, diff --git a/src/routes/train-ico/[type]/[[line]]/+page.svelte b/src/routes/train-ico/[type]/[[line]]/+page.svelte index 59ec23b..0b7a3ac 100644 --- a/src/routes/train-ico/[type]/[[line]]/+page.svelte +++ b/src/routes/train-ico/[type]/[[line]]/+page.svelte @@ -1,6 +1,7 @@