diff --git a/web/i18n/en/settings.json b/web/i18n/en/settings.json index fba788e2..9004c1f8 100644 --- a/web/i18n/en/settings.json +++ b/web/i18n/en/settings.json @@ -105,6 +105,10 @@ "advanced.debug": "debug", "advanced.debug.title": "enable debug features", "advanced.debug.description": "gives you access to a page with various info that can be useful for debugging.", + "advanced.debug.device": "device", + "advanced.debug.app": "app", + "advanced.debug.settings": "settings", + "advanced.debug.version": "version", "advanced.data": "settings data", diff --git a/web/src/routes/settings/debug/+page.svelte b/web/src/routes/settings/debug/+page.svelte index 71079369..1e801cb4 100644 --- a/web/src/routes/settings/debug/+page.svelte +++ b/web/src/routes/settings/debug/+page.svelte @@ -2,11 +2,35 @@ import { onMount } from "svelte"; import { goto } from "$app/navigation"; + import ActionButton from "$components/buttons/ActionButton.svelte"; + import CopyIcon from "$components/misc/CopyIcon.svelte"; + + import { t } from "$lib/i18n/translations"; + import { copyURL } from "$lib/download"; import { version } from "$lib/version"; import { device, app } from "$lib/device"; import { defaultNavPage } from "$lib/subnav"; import settings, { storedSettings } from "$lib/state/settings"; + $: sections = [ + { title: $t("settings.advanced.debug.device"), data: device }, + { title: $t("settings.advanced.debug.app"), data: app }, + { + title: $t("settings.advanced.debug.settings"), + data: $storedSettings, + }, + { title: $t("settings.advanced.debug.version"), data: $version }, + ]; + + let lastCopiedSection = -1; + let lastCopiedSectionResetTimeout: ReturnType; + + $: if (lastCopiedSection) { + lastCopiedSectionResetTimeout = setTimeout(() => { + lastCopiedSection = -1; + }, 1500); + } + onMount(() => { if (!$settings.advanced.debug) { goto(defaultNavPage("settings"), { replaceState: true }); @@ -16,25 +40,25 @@ {#if $settings.advanced.debug}
-

device:

-
- {JSON.stringify(device, null, 2)} -
- -

app:

-
- {JSON.stringify(app, null, 2)} -
- -

settings:

-
- {JSON.stringify($storedSettings, null, 2)} -
- -

version:

-
- {JSON.stringify($version, null, 2)} -
+ {#each sections as { title, data }, i} +

{title}:

+
+ {JSON.stringify(data, null, 2)} +
+ { + clearTimeout(lastCopiedSectionResetTimeout); + lastCopiedSection = i; + copyURL(JSON.stringify(data, null, 2)); + }} + > + + {lastCopiedSection === i + ? $t("button.copied") + : $t("button.copy")} + + {/each}
{/if}