Feature: ask permission before loading structured data

This commit is contained in:
Pieter Vander Vennet 2025-07-25 16:16:21 +02:00
parent a72f5c0010
commit 1e69accbd9

View file

@ -29,7 +29,11 @@
export let feature: Feature
export let readonly = false
export let sourceUrl: Store<string>
/**
* A switch that signals that the information should be downloaded.
* The actual 'download' code is _not_ implemented here
*/
export let downloadInformation : UIEventSource<boolean>
export let collapsed: boolean
const t = Translations.t.external
@ -49,8 +53,14 @@
<LoginToggle {state} silentFail>
{#if !$sourceUrl || !$enableLogin}
<!-- empty block -->
{:else if !$downloadInformation}
<button on:click={() => downloadInformation.set(true)}>
Attempt to download information from the website {$sourceUrl}
</button>
{:else if $externalData === undefined}
<Loading />
<div class="flex justify-center">
<Loading />
</div>
{:else if $externalData["error"] !== undefined}
<div class="subtle low-interaction rounded p-2 px-4 italic">
<Tr t={Translations.t.external.error} />