diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Timetable.svelte | 28 | ||||
-rw-r--r-- | src/lib/assets/LineGlyph.svelte | 44 |
2 files changed, 50 insertions, 22 deletions
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 @@ <LineGlyph currentColor="#fff" kind={routeShortName} - nightIsFilled={false} + negative={false} + dark /> {:else} <span @@ -372,8 +373,8 @@ {/each} {:else} <div class="flex items-center justify-center"> - <div class="results max-w-2xl"> - {#if (placeName || placeId) && isResultsPage} + {#if (placeName || placeId) && isResultsPage} + <div class="results max-w-2xl relative"> <h2 class="text-2xl opacity-90">{m.no_results_title()}</h2> <p> {#each m @@ -382,9 +383,20 @@ >{part}</b >{/if}{/each} </p> - {:else if placeId} - TODO: add some loader here - {:else} + </div> + {:else if placeId} + <div + class="flex flex-col gap-2 justify-stretch w-full no-scroll-body" + style="--shimmer-w: 2000px" + > + {#each Array(30) as _} + <div class="h-[7.575rem] relative bg-[#28282C] rounded-xl"> + <div class="w-full h-full skeleton-shimmer rounded-xl"></div> + </div> + {/each} + </div> + {:else} + <div class="results max-w-2xl relative"> <h2 class="text-2xl opacity-90">{m.welcome_title()}</h2> <p class="pb-1"> {m.welcome_body_1()} @@ -463,7 +475,7 @@ onclick={() => setSearch('Lindau-Reutin')}>Lindau-Reutin</button > </div> - {/if} - </div> + </div> + {/if} </div> {/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<string, never> + ) = $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' }`, |