Fix offline mode toggle and add network verification
- Change OfflinePlaceholder icon to use offline.svg instead of Power icon - Add flex-shrink protection to Toggle component to prevent collapsing - Add network verification when disabling offline mode: - Check network connectivity before switching to online - Show semi-transparent overlay during check - Revert to offline and show toast if no internet available - Add check_network Tauri command to verify connectivity - Add i18n strings for noNetworkToast and checkingNetwork (en/es)
This commit is contained in:
1 parent
5c1fb23899
commit
373e61f0bd
8 files changed
+95
-18
No files matched your search
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { WifiOff, CloudOff, Power, Library } from 'lucide-svelte';
|
||||
import { Library } from 'lucide-svelte';
|
||||
import { t } from '$lib/i18n';
|
||||
import type { OfflineReason } from '$lib/stores/offlineStore';
|
||||
|
||||
@@ -9,24 +9,12 @@
|
||||
}
|
||||
|
||||
let { reason = null, onGoToLibrary }: Props = $props();
|
||||
|
||||
// Get icon based on reason
|
||||
function getIcon(r: OfflineReason | null) {
|
||||
switch (r) {
|
||||
case 'no_network': return WifiOff;
|
||||
case 'not_logged_in': return CloudOff;
|
||||
case 'manual_override': return Power;
|
||||
default: return WifiOff;
|
||||
}
|
||||
}
|
||||
|
||||
const icon = $derived(getIcon(reason));
|
||||
</script>
|
||||
|
||||
<div class="offline-placeholder" role="alert" aria-live="polite">
|
||||
<div class="content">
|
||||
<div class="icon-container" aria-hidden="true">
|
||||
<svelte:component this={icon} size={64} strokeWidth={1.5} />
|
||||
<img src="/offline.svg" alt="" class="offline-icon" />
|
||||
</div>
|
||||
<h2>
|
||||
{#if reason === 'no_network'}
|
||||
@@ -80,6 +68,12 @@
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.offline-icon {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
filter: brightness(0) invert(0.6);
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 600;
|
||||
|
||||
Reference in new issue
Block a user