adds data preloading back

This commit is contained in:
Christian Beutel
2025-01-10 17:12:00 +01:00
parent 4ee3162654
commit ace5ebb607
5 changed files with 9 additions and 40 deletions

View File

@@ -92,10 +92,6 @@
} }
$: user = browser ? $currentUser : pb.authStore.model; $: user = browser ? $currentUser : pb.authStore.model;
function loggedIn() {
return user !== null && user !== undefined;
}
</script> </script>
<Drawer bind:open={drawerOpen}> <Drawer bind:open={drawerOpen}>
@@ -112,17 +108,10 @@
</div> </div>
<div class="flex flex-col px-12 gap-8"> <div class="flex flex-col px-12 gap-8">
{#each navBarItems as item} {#each navBarItems as item}
<a <a class="font-semibold text-xl" href={item.value}>{item.text}</a>
class="font-semibold text-xl"
href={item.value}
data-sveltekit-preload-data="off">{item.text}</a
>
{/each} {/each}
{#if $currentUser} {#if $currentUser}
<a <a class="font-semibold text-xl" href="/lists"
class="font-semibold text-xl"
href="/lists"
data-sveltekit-preload-data="off"
>{$_("list", { values: { n: 2 } })}</a >{$_("list", { values: { n: 2 } })}</a
> >
{/if} {/if}
@@ -139,10 +128,7 @@
<a href="/profile/{user.id}"> <a href="/profile/{user.id}">
<img <img
class="rounded-full w-10 aspect-square" class="rounded-full w-10 aspect-square"
src={getFileURL( src={getFileURL(user, user.avatar) ||
user,
user.avatar,
) ||
`https://api.dicebear.com/7.x/initials/svg?seed=${user.username}&backgroundType=gradientLinear`} `https://api.dicebear.com/7.x/initials/svg?seed=${user.username}&backgroundType=gradientLinear`}
alt="avatar" alt="avatar"
/> />
@@ -172,7 +158,7 @@
</Drawer> </Drawer>
<nav class="flex justify-between items-center p-6"> <nav class="flex justify-between items-center p-6">
<a href="/" data-sveltekit-preload-data="off"> <a href="/">
{#if $theme == "light"} {#if $theme == "light"}
<LogoText></LogoText> <LogoText></LogoText>
{:else} {:else}
@@ -185,17 +171,10 @@
style="width: {$indicatorWidth}px; left: {$indicatorPosition}px; scale: {$indicatorScale}" style="width: {$indicatorWidth}px; left: {$indicatorPosition}px; scale: {$indicatorScale}"
></div> ></div>
{#each navBarItems as item} {#each navBarItems as item}
<a <a class="font-semibold z-10" href={item.value}>{item.text}</a>
class="font-semibold z-10"
href={item.value}
data-sveltekit-preload-data="off">{item.text}</a
>
{/each} {/each}
{#if user} {#if user}
<a <a class="font-semibold z-10" href="/lists"
class="font-semibold z-10"
href="/lists"
data-sveltekit-preload-data="off"
>{$_("list", { values: { n: 2 } })}</a >{$_("list", { values: { n: 2 } })}</a
> >
{/if} {/if}
@@ -226,10 +205,7 @@
> >
<img <img
class="rounded-full w-full h-full" class="rounded-full w-full h-full"
src={getFileURL( src={getFileURL(user, user.avatar) ||
user,
user.avatar,
) ||
`https://api.dicebear.com/7.x/initials/svg?seed=${user.username}&backgroundType=gradientLinear`} `https://api.dicebear.com/7.x/initials/svg?seed=${user.username}&backgroundType=gradientLinear`}
alt="avatar" alt="avatar"
/> />

View File

@@ -178,7 +178,6 @@
class="max-w-full flex-1" class="max-w-full flex-1"
class:basis-full={selectedDisplayOption === "list"} class:basis-full={selectedDisplayOption === "list"}
href="/trail/view/{trail.id}" href="/trail/view/{trail.id}"
data-sveltekit-preload-data="off"
> >
{#if selectedDisplayOption === "cards"} {#if selectedDisplayOption === "cards"}
<TrailCard fullWidth={fullWidthCards} {trail} <TrailCard fullWidth={fullWidthCards} {trail}

View File

@@ -69,7 +69,7 @@
{/if} {/if}
<NavBar></NavBar> <NavBar></NavBar>
<PageLoadingBar ></PageLoadingBar> <PageLoadingBar class="text-content"></PageLoadingBar>
<Toast></Toast> <Toast></Toast>
<slot /> <slot />

View File

@@ -138,7 +138,6 @@
<a <a
class="inline-block btn-primary btn-large" class="inline-block btn-primary btn-large"
href="/trail/edit/new" href="/trail/edit/new"
data-sveltekit-preload-data="off"
role="button">{$_("new-trail")}</a role="button">{$_("new-trail")}</a
> >
{:else} {:else}
@@ -153,7 +152,6 @@
<a <a
class="inline-block btn-primary btn-large" class="inline-block btn-primary btn-large"
href="/trails" href="/trails"
data-sveltekit-preload-data="off"
role="button">{$_("explore")}</a role="button">{$_("explore")}</a
> >
{/if} {/if}
@@ -173,10 +171,7 @@
class="grid grid-cols-1 lg:grid-cols-2 justify-items-center gap-8 py-8" class="grid grid-cols-1 lg:grid-cols-2 justify-items-center gap-8 py-8"
> >
{#each $categories as category} {#each $categories as category}
<a <a href="/trails?category={category.id}">
href="/trails?category={category.id}"
data-sveltekit-preload-data="off"
>
<CategoryCard {category}></CategoryCard> <CategoryCard {category}></CategoryCard>
</a> </a>
{/each} {/each}

View File

@@ -256,7 +256,6 @@
{/if} {/if}
{#each trails as trail, i} {#each trails as trail, i}
<a <a
data-sveltekit-preload-data="off"
href="map/trail/{trail.id}" href="map/trail/{trail.id}"
> >
<TrailCard <TrailCard