From 08728eca9059bef8e7ddaa592a384d5ee972f81a Mon Sep 17 00:00:00 2001 From: eewing Date: Fri, 6 Mar 2026 10:30:58 -0600 Subject: [PATCH] feat(layout): add ParticlesBackground component and conditional rendering based on browser environment - Introduced the `ParticlesBackground` component to enhance the visual experience in the layout. - Updated the header rendering logic to conditionally display based on the browser environment, ensuring compatibility with server-side rendering. --- .../effects/ParticlesBackground.svelte | 176 ++++++++++++++++++ src/routes/+layout.svelte | 16 +- 2 files changed, 188 insertions(+), 4 deletions(-) create mode 100644 src/lib/components/effects/ParticlesBackground.svelte diff --git a/src/lib/components/effects/ParticlesBackground.svelte b/src/lib/components/effects/ParticlesBackground.svelte new file mode 100644 index 0000000..119838c --- /dev/null +++ b/src/lib/components/effects/ParticlesBackground.svelte @@ -0,0 +1,176 @@ + + +{#if browser && isDesktop} + +{/if} diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 969665a..3ea5976 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -2,6 +2,7 @@ import { onMount } from 'svelte'; import { goto } from '$app/navigation'; import { page } from '$app/stores'; + import { browser } from '$app/environment'; import { Toaster } from 'svelte-sonner'; import './app.css'; import favicon from '$lib/assets/favicon.svg'; @@ -11,6 +12,7 @@ import { Switch } from '$lib/components/ui/switch/index.js'; import LogOutIcon from '@lucide/svelte/icons/log-out'; import MoonIcon from '@lucide/svelte/icons/moon'; + import ParticlesBackground from '$lib/components/effects/ParticlesBackground.svelte'; let { data, children } = $props(); let cleanupRealtime: (() => void) | undefined; @@ -78,8 +80,13 @@ }} /> -{#if showHeader} -
+{#if browser && showHeader} + +{/if} + +
+ {#if showHeader} +
-{/if} + {/if} -{@render children()} + {@render children()} +