- 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)
53 lines
931 B
Svelte
53 lines
931 B
Svelte
<script lang="ts">
|
|
interface Props {
|
|
enabled: boolean;
|
|
onchange: (enabled: boolean) => void;
|
|
}
|
|
|
|
let { enabled, onchange }: Props = $props();
|
|
</script>
|
|
|
|
<button
|
|
class="toggle"
|
|
class:enabled
|
|
onclick={() => onchange(!enabled)}
|
|
role="switch"
|
|
aria-checked={enabled}
|
|
>
|
|
<div class="thumb"></div>
|
|
</button>
|
|
|
|
<style>
|
|
.toggle {
|
|
position: relative;
|
|
width: 44px;
|
|
min-width: 44px;
|
|
height: 24px;
|
|
border-radius: 9999px;
|
|
border: none;
|
|
background-color: #333333;
|
|
cursor: pointer;
|
|
transition: background-color 150ms ease;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.toggle.enabled {
|
|
background-color: var(--accent-primary);
|
|
}
|
|
|
|
.thumb {
|
|
position: absolute;
|
|
top: 2px;
|
|
left: 2px;
|
|
width: 20px;
|
|
height: 20px;
|
|
border-radius: 50%;
|
|
background-color: white;
|
|
transition: transform 150ms ease;
|
|
}
|
|
|
|
.toggle.enabled .thumb {
|
|
transform: translateX(20px);
|
|
}
|
|
</style>
|