From 092f8dd714c1e71ab485387d2c6395e9c1f3009b Mon Sep 17 00:00:00 2001 From: Santiago Lo Coco Date: Tue, 23 Apr 2024 14:49:22 +0200 Subject: [PATCH] Update project name --- package-lock.json | 4 ++-- package.json | 2 +- src/routes/+page.svelte | 10 ++++------ src/routes/timer/+page.svelte | 29 +++++++++++++++++++---------- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/package-lock.json b/package-lock.json index 279ab7a..9b3c8a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "svelte", + "name": "BreakOften", "version": "0.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "svelte", + "name": "BreakOften", "version": "0.0.1", "dependencies": { "svelte-sound": "^0.6.0" diff --git a/package.json b/package.json index 37f100a..846423b 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "svelte", + "name": "BreakOften", "version": "0.0.1", "private": true, "scripts": { diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index c474047..e83482a 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,4 +1,4 @@ - -->
diff --git a/src/routes/timer/+page.svelte b/src/routes/timer/+page.svelte index 58d9014..87a96f1 100644 --- a/src/routes/timer/+page.svelte +++ b/src/routes/timer/+page.svelte @@ -16,7 +16,7 @@ import type { Writable } from "svelte/store"; import { Sound } from "svelte-sound"; import click_mp4 from "../../assets/Bells.mp3"; - + const MINI_BREAK_DURATION = 0.15 * 60 * 1000; // 1 minutes // const MINI_BREAK_DURATION = 20 * 60 * 1000; // 20 minutes const MINI_BREAK_INTERVAL = 5 * 1000; // 20 seconds @@ -32,11 +32,11 @@ }; const showNotification = (title: string, options: NotificationOptions) => { - if (Notification.permission === 'granted') { + if (Notification.permission === "granted") { // new Notification(title, options); - } else if (Notification.permission !== 'denied') { - Notification.requestPermission().then(permission => { - if (permission === 'granted') { + } else if (Notification.permission !== "denied") { + Notification.requestPermission().then((permission) => { + if (permission === "granted") { // new Notification(title, options); } }); @@ -58,7 +58,7 @@ state.set("Ready"); miniBreakCount++; timeLeftDisplay.set(formatTime(MINI_BREAK_DURATION)); - showNotification('Ready', { body: 'Continue working!' }); + showNotification("Ready", { body: "Continue working!" }); playSound(); // Adjust volume as needed return MINI_BREAK_DURATION; } @@ -66,14 +66,18 @@ state.set("Long Break"); miniBreakCount = 0; timeLeftDisplay.set(formatTime(LONG_BREAK_DURATION)); - showNotification('Long Break', { body: 'Take a 5-minute break now!' }); + showNotification("Long Break", { + body: "Take a 5-minute break now!", + }); playSound(); // Adjust volume as needed return LONG_BREAK_DURATION; } else { state.set("Mini Break"); // miniBreakCount++; timeLeftDisplay.set(formatTime(MINI_BREAK_INTERVAL)); - showNotification('Mini Break', { body: 'Take a 20-second break now!' }); + showNotification("Mini Break", { + body: "Take a 20-second break now!", + }); playSound(); // Adjust volume as needed return MINI_BREAK_INTERVAL; } @@ -125,7 +129,9 @@
-

Prevent Computer Vision Syndrome

+

+ Prevent Computer Vision Syndrome +

{$state}

{#if $state !== "Ready"}

Time left until Ready: {$timeLeftDisplay}

@@ -133,7 +139,10 @@

Time left until break: {$timeLeftDisplay}

{/if} {#if $state !== "Ready"} - + {/if}