feat(layout): collapsible offline/API-error banner with improved messages
Replace the static full-width offline banner with a two-state toggle: expanded banner (default) with a collapse button, and a small chip in the top-right corner when collapsed. Adds a subtitle line explaining what still works offline vs. what requires network. Changes "No API" chip label to "API Error" and "Offline" title to "Device Offline". Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,8 @@ import '../app.css';
|
|||||||
// *** Import other supporting libraries
|
// *** Import other supporting libraries
|
||||||
import {
|
import {
|
||||||
RefreshCw,
|
RefreshCw,
|
||||||
|
WifiOff,
|
||||||
|
ChevronDown,
|
||||||
} from '@lucide/svelte';
|
} from '@lucide/svelte';
|
||||||
|
|
||||||
// Highlight JS
|
// Highlight JS
|
||||||
@@ -408,16 +410,45 @@ $effect(() => {
|
|||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
{#if browser && (is_offline || api_unreachable)}
|
{#if browser && (is_offline || api_unreachable)}
|
||||||
<div
|
{#if show_connection_details}
|
||||||
class="preset-filled-error-200-800 fixed top-0 right-0 left-0 z-100 flex items-center justify-center gap-4 p-4 text-center shadow-2xl print:hidden">
|
<!-- Expanded banner -->
|
||||||
<span class="text-xl font-bold"
|
<div
|
||||||
>{is_offline ? 'Offline' : api_error_msg}</span>
|
class="preset-filled-error-200-800 fixed top-0 right-0 left-0 z-100 flex items-center justify-center gap-4 p-4 text-center shadow-2xl print:hidden">
|
||||||
<button
|
<WifiOff size="1.2em" class="shrink-0 opacity-70" />
|
||||||
class="btn btn-sm preset-tonal-surface"
|
<div class="flex flex-col items-center gap-0.5">
|
||||||
onclick={() => window.location.reload()}>
|
<span class="text-xl font-bold leading-tight">
|
||||||
|
{is_offline ? 'Device Offline' : api_error_msg}
|
||||||
|
</span>
|
||||||
|
<span class="text-xs opacity-75">
|
||||||
|
{#if is_offline}
|
||||||
|
Cached event data is still available for search and print · Edits require network
|
||||||
|
{:else}
|
||||||
|
The Aether server could not be reached — check your connection or contact support
|
||||||
|
{/if}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
class="btn btn-sm preset-tonal-surface"
|
||||||
|
onclick={() => window.location.reload()}>
|
||||||
<RefreshCw size="1em" class="opacity-60" /> Retry
|
<RefreshCw size="1em" class="opacity-60" /> Retry
|
||||||
</button>
|
</button>
|
||||||
</div>
|
<button
|
||||||
|
class="btn btn-sm preset-tonal-surface"
|
||||||
|
title="Collapse"
|
||||||
|
onclick={() => { show_connection_details = false; }}>
|
||||||
|
<ChevronDown size="1em" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<!-- Collapsed indicator — small chip, top-right corner -->
|
||||||
|
<button
|
||||||
|
class="preset-filled-error-200-800 fixed top-2 right-2 z-100 flex items-center gap-1.5 rounded-full px-3 py-1.5 text-sm font-bold shadow-lg print:hidden"
|
||||||
|
title={is_offline ? 'Device Offline — click to expand' : `${api_error_msg} — click to expand`}
|
||||||
|
onclick={() => { show_connection_details = true; }}>
|
||||||
|
<WifiOff size="0.9em" class="shrink-0" />
|
||||||
|
{is_offline ? 'Offline' : 'API Error'}
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if browser && flag_expired}
|
{#if browser && flag_expired}
|
||||||
|
|||||||
Reference in New Issue
Block a user