diff --git a/src/entrypoints/popup/pages/settings/PerSiteDisables.svelte b/src/entrypoints/popup/pages/settings/PerSiteDisables.svelte index c2cc303..1c42696 100644 --- a/src/entrypoints/popup/pages/settings/PerSiteDisables.svelte +++ b/src/entrypoints/popup/pages/settings/PerSiteDisables.svelte @@ -6,6 +6,9 @@ import { getHostFromId, hosts } from '@/lib/host'; import { PerDomainSettings, type PerDomainConfig } from '@/lib/settings'; + /* constants */ + const ALL_HOSTS = '__all__'; + /* states */ let perDomainMap = $state>({}); let expanded = $state(null); @@ -51,7 +54,11 @@ async function onHostAdd(domain: string, hostId: string) { if (!hostId) return; - await PerDomainSettings.setHostDisabled(domain, hostId, true); + if (hostId === ALL_HOSTS) { + await PerDomainSettings.setAllDisabled(domain, true); + } else { + await PerDomainSettings.setHostDisabled(domain, hostId, true); + } await loadMap(); } @@ -174,6 +181,10 @@ class="flex-1 min-w-0 text-xs bg-gray-900/60 border border-gray-700 rounded px-1.5 py-1 text-gray-100 cursor-pointer focus:border-linux-mint-green focus:outline-none transition-colors" > + {#if !settings.allDisabled} + + + {/if} {#each availableHosts as host (host.id)} {/each} @@ -184,7 +195,7 @@ disabled={!selectedHostId} onclick={() => onHostAdd(domain, selectedHostId).then(() => (selectedHostId = ''))} > - Add + {selectedHostId === ALL_HOSTS ? 'Disable all' : 'Add'}