From 5f00ce4a5f01fc315ebed155cafde3bb8a33703c Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 11 Apr 2024 13:50:12 -0700 Subject: move sw to layout --- src/routes/(app)/[username]/(profile)/+page.svelte | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'src/routes/(app)') diff --git a/src/routes/(app)/[username]/(profile)/+page.svelte b/src/routes/(app)/[username]/(profile)/+page.svelte index 9443c063..81cee136 100644 --- a/src/routes/(app)/[username]/(profile)/+page.svelte +++ b/src/routes/(app)/[username]/(profile)/+page.svelte @@ -2,7 +2,6 @@ import { browser } from "$app/environment"; import { goto, invalidate } from "$app/navigation"; import { btc, f, sat, post } from "$lib/utils"; - import { onMount } from "svelte"; import Icon from "$comp/Icon.svelte"; import Balance from "$comp/Balance.svelte"; import DeleteItem from "$comp/DeleteItem.svelte"; @@ -10,6 +9,7 @@ import { fade } from "svelte/transition"; import { cubicIn } from "svelte/easing"; import { flip } from "svelte/animate"; + import { installPrompt } from "$lib/store"; import { dndzone, @@ -103,19 +103,10 @@ (dragDisabled = user?.username !== subject?.username || window.innerWidth < 768); - let installPrompt; - onMount(() => { - if (!browser) return; - window.addEventListener("beforeinstallprompt", (event) => { - event.preventDefault(); - installPrompt = event; - }); - }); - let install = async () => { - if (!installPrompt) return; - await installPrompt.prompt(); - installPrompt = null; + if (!$installPrompt) return; + await $installPrompt.prompt(); + $installPrompt = null; }; @@ -163,14 +154,14 @@ - {#if installPrompt} + {#if $installPrompt} {/if} -- cgit v1.2.3