diff --git a/public/obs-overlay.html b/public/obs-overlay.html
index bee9547..ffaf68d 100644
--- a/public/obs-overlay.html
+++ b/public/obs-overlay.html
@@ -37,6 +37,13 @@
}
});
+ setInterval(() => {
+ if (active && typeof active.remaining === 'number') {
+ active.remaining = Math.max(0, active.remaining - 1000);
+ render();
+ }
+ }, 1000);
+
function render() {
const el = document.getElementById('timer');
if (!active || active.remaining == null) {
diff --git a/public/service-worker.js b/public/service-worker.js
index 8bed9cd..e1d4dd5 100644
--- a/public/service-worker.js
+++ b/public/service-worker.js
@@ -10,6 +10,11 @@ self.addEventListener('install', (event) => {
self.addEventListener('fetch', (event) => {
if (event.request.method !== 'GET') return;
event.respondWith(
- fetch(event.request).catch(() => caches.match(event.request).then((response) => response || caches.match(OFFLINE_URL)))
+ fetch(event.request).catch(() => {
+ if (event.request.mode === 'navigate') {
+ return caches.match(OFFLINE_URL);
+ }
+ return caches.match(event.request);
+ })
);
});
diff --git a/src/components/TimerImportExport.tsx b/src/components/TimerImportExport.tsx
index a2cd9d1..47546e7 100644
--- a/src/components/TimerImportExport.tsx
+++ b/src/components/TimerImportExport.tsx
@@ -32,6 +32,9 @@ const TimerImportExport: React.FC = () => {
const format = ext === 'csv' ? 'csv' : 'json';
const timers = importTimers(text, format);
dispatch({ type: 'setAll', timers });
+ import('../services/timerSync').then(({ saveTimer }) => {
+ timers.forEach((tmr) => saveTimer(tmr));
+ });
} catch (err) {
console.error(err);
alert(t('timerList.importError'));
diff --git a/src/components/TimerList.tsx b/src/components/TimerList.tsx
index b43d395..a42b361 100644
--- a/src/components/TimerList.tsx
+++ b/src/components/TimerList.tsx
@@ -13,10 +13,10 @@ const TimerList: React.FC = () => {
return (
- {state.timers.map((t) => (
-
-
-