forked from btclock/webui
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
|
||||
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 -->
|
||||
{#if 'bitaxeEnabled' in $settings}
|
||||
<Row class="mb-3">
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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.",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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}</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}
|
||||
<hr />
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue