diff --git a/doc/screenshot-dark.webp b/doc/screenshot-dark.webp index f003bb7..ed7ae3c 100644 Binary files a/doc/screenshot-dark.webp and b/doc/screenshot-dark.webp differ diff --git a/doc/screenshot-light.webp b/doc/screenshot-light.webp index cf87152..4309e88 100644 Binary files a/doc/screenshot-light.webp and b/doc/screenshot-light.webp differ diff --git a/src/lib/components/settings/ExtraFeaturesSettings.svelte b/src/lib/components/settings/ExtraFeaturesSettings.svelte index 2d6615c..bea0033 100644 --- a/src/lib/components/settings/ExtraFeaturesSettings.svelte +++ b/src/lib/components/settings/ExtraFeaturesSettings.svelte @@ -69,6 +69,64 @@ bind:isOpen defaultOpen={false} > + + + {#if $settings.dnd.timeBasedEnabled} + + + + + + + + + + + + + + + + + {/if} + {#if 'bitaxeEnabled' in $settings} diff --git a/src/lib/locales/de.json b/src/lib/locales/de.json index d1ee257..2044e49 100644 --- a/src/lib/locales/de.json +++ b/src/lib/locales/de.json @@ -68,7 +68,12 @@ "nostr": "Nostr-Verlag", "custom": "Benutzerdefinierter dataquelle" }, - "fontName": "Schriftart" + "fontName": "Schriftart", + "timeBasedDnd": "Aktivieren Sie den Zeitplan „Bitte nicht stören“.", + "dndStartHour": "Startstunde", + "dndStartMinute": "Startminute", + "dndEndHour": "Endstunde", + "dndEndMinute": "Schlussminute" }, "control": { "systemInfo": "Systeminfo", @@ -96,7 +101,9 @@ "wifiSignalStrength": "WiFi-Signalstärke", "wsDataConnection": "BTClock-Datenquelle verbindung", "lightSensor": "Lichtsensor", - "nostrConnection": "Nostr Relay-Verbindung" + "nostrConnection": "Nostr Relay-Verbindung", + "doNotDisturb": "Bitte nicht stören", + "timeBasedDnd": "Zeitbasierter Zeitplan" }, "firmwareUpdater": { "fileUploadSuccess": "Datei erfolgreich hochgeladen, Gerät neu gestartet. WebUI in {countdown} Sekunden neu geladen", diff --git a/src/lib/locales/en.json b/src/lib/locales/en.json index 85579e7..302de09 100644 --- a/src/lib/locales/en.json +++ b/src/lib/locales/en.json @@ -85,7 +85,12 @@ "thirdPartySource": "Use mempool.space/coincap.io", "ceDisableSSL": "Disable SSL", "ceEndpoint": "Endpoint hostname", - "fontName": "Font" + "fontName": "Font", + "timeBasedDnd": "Enable Do Not Disturb time schedule", + "dndStartHour": "Start hour", + "dndStartMinute": "Start minute", + "dndEndHour": "End hour", + "dndEndMinute": "End minute" }, "control": { "systemInfo": "System info", @@ -115,7 +120,9 @@ "wifiSignalStrength": "WiFi Signal strength", "wsDataConnection": "BTClock data-source connection", "lightSensor": "Light sensor", - "nostrConnection": "Nostr Relay connection" + "nostrConnection": "Nostr Relay connection", + "doNotDisturb": "Do not disturb", + "timeBasedDnd": "Time-based schedule" }, "firmwareUpdater": { "fileUploadFailed": "File upload failed. Make sure you have selected the correct file and try again.", diff --git a/src/lib/locales/es.json b/src/lib/locales/es.json index a4eba79..4033cab 100644 --- a/src/lib/locales/es.json +++ b/src/lib/locales/es.json @@ -67,7 +67,12 @@ "nostr": "editorial nostr", "custom": "Punto final personalizado" }, - "fontName": "Fuente" + "fontName": "Fuente", + "timeBasedDnd": "Habilitar el horario de No molestar", + "dndStartHour": "Hora de inicio", + "dndStartMinute": "Minuto de inicio", + "dndEndHour": "Hora final", + "dndEndMinute": "Minuto final" }, "control": { "turnOff": "Apagar", @@ -95,7 +100,9 @@ "wifiSignalStrength": "Fuerza de la señal WiFi", "wsDataConnection": "Conexión de fuente de datos BTClock", "lightSensor": "Sensor de luz", - "nostrConnection": "Conexión de relé Nostr" + "nostrConnection": "Conexión de relé Nostr", + "doNotDisturb": "No molestar", + "timeBasedDnd": "Horario basado en el tiempo" }, "firmwareUpdater": { "fileUploadSuccess": "Archivo cargado exitosamente, reiniciando el dispositivo. Recargando WebUI en {countdown} segundos", diff --git a/src/lib/locales/nl.json b/src/lib/locales/nl.json index a6dc486..b239905 100644 --- a/src/lib/locales/nl.json +++ b/src/lib/locales/nl.json @@ -59,7 +59,12 @@ "flOffWhenDark": "Displaylicht uit als het donker is", "luxLightToggleText": "Stel in op 0 om uit te schakelen", "verticalDesc": "Verticale schermbeschrijving", - "fontName": "Lettertype" + "fontName": "Lettertype", + "timeBasedDnd": "Schakel het tijdschema Niet storen in", + "dndStartHour": "Begin uur", + "dndStartMinute": "Beginminuut", + "dndEndHour": "Eind uur", + "dndEndMinute": "Einde minuut" }, "control": { "systemInfo": "Systeeminformatie", @@ -86,7 +91,9 @@ "wifiSignalStrength": "WiFi signaalsterkte", "wsDataConnection": "BTClock-gegevensbron verbinding", "lightSensor": "Licht sensor", - "nostrConnection": "Nostr Relay-verbinding" + "nostrConnection": "Nostr Relay-verbinding", + "doNotDisturb": "Niet storen", + "timeBasedDnd": "Op tijd gebaseerd schema" }, "firmwareUpdater": { "fileUploadSuccess": "Bestand geüpload, apparaat herstart. WebUI opnieuw geladen over {countdown} seconden", diff --git a/src/routes/Status.svelte b/src/routes/Status.svelte index e889a0b..a659af0 100644 --- a/src/routes/Status.svelte +++ b/src/routes/Status.svelte @@ -97,6 +97,16 @@ } }; + const toggleDoNotDisturb = (currentStatus: boolean) => (e: Event) => { + e.preventDefault(); + console.log(currentStatus); + if (!currentStatus) { + fetch(`${PUBLIC_BASE_URL}/api/dnd/enable`); + } else { + fetch(`${PUBLIC_BASE_URL}/api/dnd/disable`); + } + }; + export let xs = 12; export let sm = xs; export let md = sm; @@ -185,7 +195,27 @@ >{#if $status.timerRunning}⏵ {$_('timer.running')}{:else}⏸ {$_( 'timer.stopped' )}{/if}
+ + {$_('section.status.doNotDisturb')}: + + {#if $status.dnd?.active}⏵ {$_('on')}{:else}⏸ {$_('off')}{/if} + + {#if $status.dnd?.timeBasedEnabled} + {$_('section.status.timeBasedDnd')} ( {$settings.dnd + .startHour}:{$settings.dnd.startMinute.toString().padStart(2, '0')} - {$settings + .dnd.endHour}:{$settings.dnd.endMinute.toString().padStart(2, '0')} ) + {/if} + {/if} {/if}
diff --git a/tests/shared.ts b/tests/shared.ts index 821f202..ec2bb2d 100644 --- a/tests/shared.ts +++ b/tests/shared.ts @@ -22,7 +22,14 @@ export const statusJson = { { red: 0, green: 0, blue: 0, hex: '#000000' } ], isUpdating: true, - isFake: true + isFake: true, + dnd: { + enabled: true, + timeBasedEnabled: true, + startTime: '23:00', + endTime: '7:00', + active: true + } }; export const settingsJson = { @@ -108,6 +115,14 @@ export const settingsJson = { 'ckpool', 'eu_ckpool' ], + dnd: { + enabled: false, + timeBasedEnabled: true, + startHour: 23, + startMinute: 0, + endHour: 7, + endMinute: 0 + }, availableFonts: ['antonio', 'oswald'], invertedColor: false, isLoaded: true,