From 27cbc8e56e47ba6179d6cc0f11b7a1667ed1c2a0 Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Tue, 23 Nov 2021 14:32:00 +0100 Subject: [PATCH] animation --- src/client/App.svelte | 18 +++++++++++------- src/client/blocked.js | 4 ++-- src/client/dismiss.js | 5 +++++ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/client/App.svelte b/src/client/App.svelte index 8776707..bb867a4 100644 --- a/src/client/App.svelte +++ b/src/client/App.svelte @@ -28,28 +28,30 @@ diff --git a/src/client/blocked.js b/src/client/blocked.js index 853d80b..32ecef9 100644 --- a/src/client/blocked.js +++ b/src/client/blocked.js @@ -1,5 +1,5 @@ import browser from 'webextension-polyfill' -import { readable } from 'svelte/store' +import { writable } from 'svelte/store' async function check(set) { if (window.document.hidden) return @@ -10,7 +10,7 @@ async function check(set) { set(isBlocked) } -export const blocked = new readable(false, (set) => { +export const blocked = new writable(false, (set) => { check(set) const interval = setInterval(() => check(set), 1000) return () => clearInterval(interval) diff --git a/src/client/dismiss.js b/src/client/dismiss.js index 086aeec..c616289 100644 --- a/src/client/dismiss.js +++ b/src/client/dismiss.js @@ -4,7 +4,11 @@ dayjs.extend(duration) import browser from 'webextension-polyfill' +import { isDev } from '../shared/utils' +import { blocked } from './blocked' + export const buttons = [ + ...(isDev ? [{ label: 'Dev', duration: dayjs.duration({ seconds: 5 }) }] : []), { label: '1 minute', duration: dayjs.duration({ minutes: 1 }) }, { label: '5 minutes', duration: dayjs.duration({ minutes: 5 }) }, { label: '15 minutes', duration: dayjs.duration({ minutes: 15 }) }, @@ -17,4 +21,5 @@ export function dismiss(duration) { duration: duration.asMilliseconds(), host: window.location.host, }) + blocked.set(false) }