Set delayed loading spinner and additional CSP headers

This commit is contained in:
thiloho
2024-09-25 16:02:12 +02:00
parent 0e3c0f094c
commit a9e2bd4cb7
14 changed files with 83 additions and 33 deletions

View File

@@ -14,9 +14,21 @@
? "Dashboard"
: `${$page.url.pathname.charAt(1).toUpperCase()}${$page.url.pathname.slice(2)}`
);
let loading = $state(false);
let loadingDelay: number;
$effect(() => {
if ($navigating && ["link", "goto"].includes($navigating.type)) {
loadingDelay = window.setTimeout(() => (loading = true), 500);
} else {
window.clearTimeout(loadingDelay);
loading = false;
}
});
</script>
{#if $navigating && ["link", "goto"].includes($navigating.type)}
{#if loading}
<LoadingSpinner />
{/if}