diff --git a/src/lib/animation/index.ts b/src/lib/animation/index.ts index 466868a..319cee8 100644 --- a/src/lib/animation/index.ts +++ b/src/lib/animation/index.ts @@ -1,3 +1,4 @@ +import { isMobile } from "$lib/store/index.svelte"; import type { AnimationConfig, FlipParams } from "svelte/animate"; import { cubicOut } from "svelte/easing"; import { @@ -19,7 +20,7 @@ export function fade(node: HTMLElement, options: FadeParams) { } export function fly(node: HTMLElement, options: FlyParams) { - if (localStorage.getItem("motion") === "false") return {}; + if (localStorage.getItem("motion") === "false" || isMobile) return {}; const animation = svelteFly(node, options); return animation; } diff --git a/src/lib/store/index.svelte.ts b/src/lib/store/index.svelte.ts index da9d7ea..4c053a2 100644 --- a/src/lib/store/index.svelte.ts +++ b/src/lib/store/index.svelte.ts @@ -194,3 +194,5 @@ export function setMotion(motion: boolean) { export const files = new Files(); export const showGradient = writable(true); export const gradientColor = writable(""); + +export const isMobile = writable(false); diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts deleted file mode 100644 index 763ee6d..0000000 --- a/src/routes/+layout.server.ts +++ /dev/null @@ -1,11 +0,0 @@ -export const load = ({ url, request }) => { - const { pathname } = url; - const ua = request.headers.get("user-agent"); - const isMobile = /mobile/i.test(ua || ""); - const isFirefox = /firefox/i.test(ua || ""); - return { - pathname, - isMobile, - isFirefox, - }; -}; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 47495a7..182a6f7 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,17 +1,19 @@