Add do not disturb mode
This commit is contained in:
parent
0041ec3d9a
commit
033fe09829
9 changed files with 140 additions and 9 deletions
Binary file not shown.
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 71 KiB |
Binary file not shown.
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 66 KiB |
|
@ -69,6 +69,64 @@
|
||||||
bind:isOpen
|
bind:isOpen
|
||||||
defaultOpen={false}
|
defaultOpen={false}
|
||||||
>
|
>
|
||||||
|
<!--- Time based do not disturb settings -->
|
||||||
|
<SettingsSwitch
|
||||||
|
id="timeBasedDnd"
|
||||||
|
label={$_('section.settings.timeBasedDnd')}
|
||||||
|
bind:checked={$settings.dnd.timeBasedEnabled}
|
||||||
|
size={$uiSettings.inputSize}
|
||||||
|
/>
|
||||||
|
{#if $settings.dnd.timeBasedEnabled}
|
||||||
|
<Row>
|
||||||
|
<Col>
|
||||||
|
<SettingsInput
|
||||||
|
id="dndStartHour"
|
||||||
|
type="number"
|
||||||
|
min="0"
|
||||||
|
max="23"
|
||||||
|
label={$_('section.settings.dndStartHour')}
|
||||||
|
bind:value={$settings.dnd.startHour}
|
||||||
|
size={$uiSettings.inputSize}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col>
|
||||||
|
<SettingsInput
|
||||||
|
id="dndStartMinute"
|
||||||
|
type="number"
|
||||||
|
min="0"
|
||||||
|
max="59"
|
||||||
|
label={$_('section.settings.dndStartMinute')}
|
||||||
|
bind:value={$settings.dnd.startMinute}
|
||||||
|
size={$uiSettings.inputSize}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Row>
|
||||||
|
<Col>
|
||||||
|
<SettingsInput
|
||||||
|
id="dndEndHour"
|
||||||
|
type="number"
|
||||||
|
min="0"
|
||||||
|
max="23"
|
||||||
|
label={$_('section.settings.dndEndHour')}
|
||||||
|
bind:value={$settings.dnd.endHour}
|
||||||
|
size={$uiSettings.inputSize}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col>
|
||||||
|
<SettingsInput
|
||||||
|
id="dndEndMinute"
|
||||||
|
type="number"
|
||||||
|
min="0"
|
||||||
|
max="59"
|
||||||
|
label={$_('section.settings.dndEndMinute')}
|
||||||
|
bind:value={$settings.dnd.endMinute}
|
||||||
|
size={$uiSettings.inputSize}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<!-- BitAxe Settings -->
|
<!-- BitAxe Settings -->
|
||||||
{#if 'bitaxeEnabled' in $settings}
|
{#if 'bitaxeEnabled' in $settings}
|
||||||
<Row class="mb-3">
|
<Row class="mb-3">
|
||||||
|
|
|
@ -68,7 +68,12 @@
|
||||||
"nostr": "Nostr-Verlag",
|
"nostr": "Nostr-Verlag",
|
||||||
"custom": "Benutzerdefinierter dataquelle"
|
"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": {
|
"control": {
|
||||||
"systemInfo": "Systeminfo",
|
"systemInfo": "Systeminfo",
|
||||||
|
@ -96,7 +101,9 @@
|
||||||
"wifiSignalStrength": "WiFi-Signalstärke",
|
"wifiSignalStrength": "WiFi-Signalstärke",
|
||||||
"wsDataConnection": "BTClock-Datenquelle verbindung",
|
"wsDataConnection": "BTClock-Datenquelle verbindung",
|
||||||
"lightSensor": "Lichtsensor",
|
"lightSensor": "Lichtsensor",
|
||||||
"nostrConnection": "Nostr Relay-Verbindung"
|
"nostrConnection": "Nostr Relay-Verbindung",
|
||||||
|
"doNotDisturb": "Bitte nicht stören",
|
||||||
|
"timeBasedDnd": "Zeitbasierter Zeitplan"
|
||||||
},
|
},
|
||||||
"firmwareUpdater": {
|
"firmwareUpdater": {
|
||||||
"fileUploadSuccess": "Datei erfolgreich hochgeladen, Gerät neu gestartet. WebUI in {countdown} Sekunden neu geladen",
|
"fileUploadSuccess": "Datei erfolgreich hochgeladen, Gerät neu gestartet. WebUI in {countdown} Sekunden neu geladen",
|
||||||
|
|
|
@ -85,7 +85,12 @@
|
||||||
"thirdPartySource": "Use mempool.space/coincap.io",
|
"thirdPartySource": "Use mempool.space/coincap.io",
|
||||||
"ceDisableSSL": "Disable SSL",
|
"ceDisableSSL": "Disable SSL",
|
||||||
"ceEndpoint": "Endpoint hostname",
|
"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": {
|
"control": {
|
||||||
"systemInfo": "System info",
|
"systemInfo": "System info",
|
||||||
|
@ -115,7 +120,9 @@
|
||||||
"wifiSignalStrength": "WiFi Signal strength",
|
"wifiSignalStrength": "WiFi Signal strength",
|
||||||
"wsDataConnection": "BTClock data-source connection",
|
"wsDataConnection": "BTClock data-source connection",
|
||||||
"lightSensor": "Light sensor",
|
"lightSensor": "Light sensor",
|
||||||
"nostrConnection": "Nostr Relay connection"
|
"nostrConnection": "Nostr Relay connection",
|
||||||
|
"doNotDisturb": "Do not disturb",
|
||||||
|
"timeBasedDnd": "Time-based schedule"
|
||||||
},
|
},
|
||||||
"firmwareUpdater": {
|
"firmwareUpdater": {
|
||||||
"fileUploadFailed": "File upload failed. Make sure you have selected the correct file and try again.",
|
"fileUploadFailed": "File upload failed. Make sure you have selected the correct file and try again.",
|
||||||
|
|
|
@ -67,7 +67,12 @@
|
||||||
"nostr": "editorial nostr",
|
"nostr": "editorial nostr",
|
||||||
"custom": "Punto final personalizado"
|
"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": {
|
"control": {
|
||||||
"turnOff": "Apagar",
|
"turnOff": "Apagar",
|
||||||
|
@ -95,7 +100,9 @@
|
||||||
"wifiSignalStrength": "Fuerza de la señal WiFi",
|
"wifiSignalStrength": "Fuerza de la señal WiFi",
|
||||||
"wsDataConnection": "Conexión de fuente de datos BTClock",
|
"wsDataConnection": "Conexión de fuente de datos BTClock",
|
||||||
"lightSensor": "Sensor de luz",
|
"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": {
|
"firmwareUpdater": {
|
||||||
"fileUploadSuccess": "Archivo cargado exitosamente, reiniciando el dispositivo. Recargando WebUI en {countdown} segundos",
|
"fileUploadSuccess": "Archivo cargado exitosamente, reiniciando el dispositivo. Recargando WebUI en {countdown} segundos",
|
||||||
|
|
|
@ -59,7 +59,12 @@
|
||||||
"flOffWhenDark": "Displaylicht uit als het donker is",
|
"flOffWhenDark": "Displaylicht uit als het donker is",
|
||||||
"luxLightToggleText": "Stel in op 0 om uit te schakelen",
|
"luxLightToggleText": "Stel in op 0 om uit te schakelen",
|
||||||
"verticalDesc": "Verticale schermbeschrijving",
|
"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": {
|
"control": {
|
||||||
"systemInfo": "Systeeminformatie",
|
"systemInfo": "Systeeminformatie",
|
||||||
|
@ -86,7 +91,9 @@
|
||||||
"wifiSignalStrength": "WiFi signaalsterkte",
|
"wifiSignalStrength": "WiFi signaalsterkte",
|
||||||
"wsDataConnection": "BTClock-gegevensbron verbinding",
|
"wsDataConnection": "BTClock-gegevensbron verbinding",
|
||||||
"lightSensor": "Licht sensor",
|
"lightSensor": "Licht sensor",
|
||||||
"nostrConnection": "Nostr Relay-verbinding"
|
"nostrConnection": "Nostr Relay-verbinding",
|
||||||
|
"doNotDisturb": "Niet storen",
|
||||||
|
"timeBasedDnd": "Op tijd gebaseerd schema"
|
||||||
},
|
},
|
||||||
"firmwareUpdater": {
|
"firmwareUpdater": {
|
||||||
"fileUploadSuccess": "Bestand geüpload, apparaat herstart. WebUI opnieuw geladen over {countdown} seconden",
|
"fileUploadSuccess": "Bestand geüpload, apparaat herstart. WebUI opnieuw geladen over {countdown} seconden",
|
||||||
|
|
|
@ -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 xs = 12;
|
||||||
export let sm = xs;
|
export let sm = xs;
|
||||||
export let md = sm;
|
export let md = sm;
|
||||||
|
@ -185,7 +195,27 @@
|
||||||
>{#if $status.timerRunning}⏵ {$_('timer.running')}{:else}⏸ {$_(
|
>{#if $status.timerRunning}⏵ {$_('timer.running')}{:else}⏸ {$_(
|
||||||
'timer.stopped'
|
'timer.stopped'
|
||||||
)}{/if}</a
|
)}{/if}</a
|
||||||
|
><br />
|
||||||
|
|
||||||
|
{$_('section.status.doNotDisturb')}:
|
||||||
|
<a
|
||||||
|
id="dndStatusText"
|
||||||
|
href={'#'}
|
||||||
|
style="cursor: pointer"
|
||||||
|
tabindex="0"
|
||||||
|
role="button"
|
||||||
|
aria-pressed="false"
|
||||||
|
on:click={toggleDoNotDisturb($status.dnd?.enabled)}
|
||||||
>
|
>
|
||||||
|
{#if $status.dnd?.active}⏵ {$_('on')}{:else}⏸ {$_('off')}{/if}</a
|
||||||
|
>
|
||||||
|
<small>
|
||||||
|
{#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}
|
||||||
|
</small>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
<hr />
|
<hr />
|
||||||
|
|
|
@ -22,7 +22,14 @@ export const statusJson = {
|
||||||
{ red: 0, green: 0, blue: 0, hex: '#000000' }
|
{ red: 0, green: 0, blue: 0, hex: '#000000' }
|
||||||
],
|
],
|
||||||
isUpdating: true,
|
isUpdating: true,
|
||||||
isFake: true
|
isFake: true,
|
||||||
|
dnd: {
|
||||||
|
enabled: true,
|
||||||
|
timeBasedEnabled: true,
|
||||||
|
startTime: '23:00',
|
||||||
|
endTime: '7:00',
|
||||||
|
active: true
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const settingsJson = {
|
export const settingsJson = {
|
||||||
|
@ -108,6 +115,14 @@ export const settingsJson = {
|
||||||
'ckpool',
|
'ckpool',
|
||||||
'eu_ckpool'
|
'eu_ckpool'
|
||||||
],
|
],
|
||||||
|
dnd: {
|
||||||
|
enabled: false,
|
||||||
|
timeBasedEnabled: true,
|
||||||
|
startHour: 23,
|
||||||
|
startMinute: 0,
|
||||||
|
endHour: 7,
|
||||||
|
endMinute: 0
|
||||||
|
},
|
||||||
availableFonts: ['antonio', 'oswald'],
|
availableFonts: ['antonio', 'oswald'],
|
||||||
invertedColor: false,
|
invertedColor: false,
|
||||||
isLoaded: true,
|
isLoaded: true,
|
||||||
|
|
Loading…
Reference in a new issue