Procházet zdrojové kódy

Add notifications for turning on/off recipe mode

Lee Morgan před 2 týdny
rodič
revize
be3bb522c4
1 změnil soubory, kde provedl 4 přidání a 1 odebrání
  1. 4 1
      src/routes/recipe/[recipeId]/+page.svelte

+ 4 - 1
src/routes/recipe/[recipeId]/+page.svelte

@@ -1,6 +1,7 @@
 <script>
     import {onMount} from "svelte";
     import {enableRecipeMode, disableRecipeMode, attachVisibilityReacquire} from "$lib/wakeLock.js";
+    import {notify} from "$lib/notifier.svelte.js";
 
     let {data} = $props();
     let on = $state(false);
@@ -9,9 +10,11 @@
         if(on){
             await disableRecipeMode();
             on = false;
+            notify("success", "Recipe mode on. Screen will not turn off");
             return;
         }
         on = await enableRecipeMode();
+        notify("warning", "Recipe mode off.")
     }
 
     onMount(()=>{
@@ -54,7 +57,7 @@
         <a class="button" href="/recipe/{data.recipe.id}/edit">Edit</a>
         <button>Printable PDF</button>
         <button>Link</button>
-        <button onclick={toggle}>{on ? "Recipe Mode On" : "Recipe Mode Off"}</button>
+        <button onclick={toggle}>Recipe Mode</button>
     </div>
 </div>