Skip to content

Commit

Permalink
* (bluefox) Small GUI changes done
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Apr 11, 2024
1 parent b1191b5 commit 9b3d8bf
Show file tree
Hide file tree
Showing 15 changed files with 82 additions and 46 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ This adapter has vis2 widget.
-->

## Changelog
### **WORK IN PROGRESS**
* (bluefox) Small GUI changes done

### 1.3.7 (2024-04-06)
* (bluefox) Corrected widget errors
* (bluefox) Implemented custom types
Expand Down
2 changes: 1 addition & 1 deletion io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
}
},
"native": {
"holidayId": "feiertage.0.heute.boolean",
"holidayId": "",
"profiles": [
{
"id": "58f45953-9821-4746-8046-eaa5d69eaccd",
Expand Down
5 changes: 3 additions & 2 deletions src/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,7 @@ class App extends GenericApp {
onChange={this.onState}
socket={this.socket}
themeType={this.state.themeType}
profile={activeProfile}
/>
</div>;
}
Expand Down Expand Up @@ -888,15 +889,15 @@ class App extends GenericApp {
// if screen width less than 1600
if (this.state.windowWidth < 1600) {
return <IconButton
style={{ marginRight: 20 }}
style={{ marginRight: 20, height: 40, marginTop: 8 }}
title={I18n.t('Advanced settings')}
onClick={() => this.onShowOptions()}
>
<Settings />
</IconButton>;
} else {
return <Button
style={{ marginTop: 12, marginRight: 16 }}
style={{ marginTop: 8, marginRight: 16, minWidth: 130, height: 40 }}
onClick={() => this.onShowOptions()}
startIcon={<Settings />}
variant="outlined"
Expand Down
72 changes: 52 additions & 20 deletions src/src/components/StatePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
import React, { Component } from 'react';

import {
TextField, IconButton,
TextField, IconButton, Button,
} from '@mui/material';
import ClearIcon from '@mui/icons-material/Clear';

Expand All @@ -16,6 +16,29 @@ class StatePanel extends Component {
};
}

async componentDidMount() {
if (this.props.value === true || !this.props.value) {
// check that state exists
const state = await this.props.socket.getObject(this.props.possibleStateId);
if (!state) {
this.props.socket.setObject(this.props.possibleStateId, {
common: {
type: 'boolean',
read: true,
write: true,
role: 'switch',
def: true,
name: this.props.profile.title,
},
type: 'state',
});
}
if (!this.props.value) {
this.props.onChange(true);
}
}
}

stateChange = state => {
if (state === this.props.possibleStateId) {
this.props.onChange(true);
Expand Down Expand Up @@ -51,31 +74,40 @@ class StatePanel extends Component {

return <>
{this.renderSelectIdDialog()}
<TextField
title={I18n.t('You can provide here the state that controls the activation of this profile')}
variant="standard"
style={{ flex: 1 }}
label={I18n.t(title)}
value={this.props.value === true ? this.props.possibleStateId : this.props.value || ''}
onClick={() => this.setState({ showSelectId: true })}
helperText={`(${I18n.t('optional')})`}
InputProps={{
readOnly: true,
endAdornment:
this.props.value !== true ? <IconButton onClick={e => {
e.stopPropagation();
this.stateChange(true);
}}>
<ClearIcon />
</IconButton> : null
}}
/>
<div style={{ display: 'flex' }}>
<TextField
title={I18n.t('You can provide here the state that controls the activation of this profile')}
variant="standard"
style={{ flex: 1 }}
label={I18n.t(title)}
value={this.props.value === true ? this.props.possibleStateId : this.props.value || ''}
helperText={`(${I18n.t('optional')})`}
InputProps={{
readOnly: true,
endAdornment:
this.props.value !== true ? <IconButton onClick={e => {
e.stopPropagation();
this.stateChange(true);
}}>
<ClearIcon />
</IconButton> : null
}}
/>
<Button
style={{ minWidth: 40, height: 40, marginTop: 8 }}
onClick={() => this.setState({ showSelectId: true })}
variant="outlined"
>
...
</Button>
</div>
</>;
}
}

StatePanel.propTypes = {
value: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
profile: PropTypes.object,
onChange: PropTypes.func,
title: PropTypes.string,
socket: PropTypes.object,
Expand Down
6 changes: 3 additions & 3 deletions src/src/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@
"30 m.": "30 M.",
"You cannot enable or disable this profile as it controlled by %s state": "Sie können dieses Profil nicht aktivieren oder deaktivieren, da es vom \"%s\" gesteuert wird",
"Press \"shift\" and move mouse to change more than one slider": "Drücken Sie \"Shift\" und bewegen Sie die Maus, um mehr als einen Schieberegler zu ändern",
"Ignore values if same as previous": "Die Werte, wenn sie mit den vorherigen identisch sind, ignorieren\n",
"Ignore values if same as previous": "Die Werte ignorieren, wenn sie mit den vorherigen identisch sind",
"Do not control if device already in desired state": "Nicht schreiben, falls das Gerät sich bereits im gewünschten Zustand befindet",
"Now": "Jetzt",
"on": "AN",
"off": "AUS",
"Custom": "Anpassbar",
"Advanced settings": "Erweiterte Einstellungen",
"Advanced settings": "Erweitert",
"Holiday": "Feiertag",
"Holiday ID": "Feiertags-ID",
"Apply": "Anwenden",
Expand All @@ -76,4 +76,4 @@
"Errors": "Fehler",
"Advanced profile options": "Erweiterte Profiloptionen",
"Applied for all profiles": "Gilt für alle Profile"
}
}
4 changes: 2 additions & 2 deletions src/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"30 m.": "30 m.",
"You cannot enable or disable this profile as it controlled by %s state": "You cannot enable or disable this profile as it controlled by \"%s\" state",
"Press \"shift\" and move mouse to change more than one slider": "Press \"shift\" and move mouse to change more than one slider",
"Ignore values if same as previous": "Ignore values if same as previous\n",
"Ignore values if same as previous": "Ignore values if same as previous",
"Do not control if device already in desired state": "Do not control if device already in desired state",
"Now": "Now",
"on": "on",
Expand All @@ -76,4 +76,4 @@
"Errors": "Errors",
"Advanced profile options": "Advanced profile options",
"Applied for all profiles": "Applied for all profiles"
}
}
4 changes: 2 additions & 2 deletions src/src/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"30 m.": "30 m.",
"You cannot enable or disable this profile as it controlled by %s state": "No puede habilitar o deshabilitar este perfil ya que está controlado por el estado %s",
"Press \"shift\" and move mouse to change more than one slider": "Presione \"shift\" y mueva el mouse para cambiar más de un control deslizante",
"Ignore values if same as previous": "Ignorar valores si son iguales que los anteriores\n",
"Ignore values if same as previous": "Ignorar valores si son iguales que los anteriores",
"Do not control if device already in desired state": "No controlar si el dispositivo ya está en el estado deseado",
"Now": "Ahora",
"on": "on",
Expand All @@ -76,4 +76,4 @@
"Errors": "Errores",
"Advanced profile options": "Opciones avanzadas de perfil",
"Applied for all profiles": "Aplicado para todos los perfiles."
}
}
4 changes: 2 additions & 2 deletions src/src/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"30 m.": "30 m.",
"You cannot enable or disable this profile as it controlled by %s state": "Vous ne pouvez pas activer ou désactiver ce profil car il est contrôlé par l'état %s",
"Press \"shift\" and move mouse to change more than one slider": "Appuyez sur \"shift\" et déplacez la souris pour modifier plusieurs curseurs",
"Ignore values if same as previous": "Ignorer les valeurs si elles sont identiques aux précédentes\n",
"Ignore values if same as previous": "Ignorer les valeurs si elles sont identiques aux précédentes",
"Do not control if device already in desired state": "Ne contrôlez pas si l'appareil est déjà dans l'état souhaité",
"Now": "Maintenant",
"on": "on",
Expand All @@ -76,4 +76,4 @@
"Errors": "les erreurs",
"Advanced profile options": "Options de profil avancées",
"Applied for all profiles": "Appliqué pour tous les profils"
}
}
4 changes: 2 additions & 2 deletions src/src/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"30 m.": "30 m.",
"You cannot enable or disable this profile as it controlled by %s state": "Non puoi abilitare o disabilitare questo profilo poiché è controllato dallo stato %s",
"Press \"shift\" and move mouse to change more than one slider": "Premi \"shift\" e muovi il mouse per cambiare più di un cursore",
"Ignore values if same as previous": "Ignora i valori se uguali a quelli precedenti\n",
"Ignore values if same as previous": "Ignora i valori se uguali a quelli precedenti",
"Do not control if device already in desired state": "Non controllare se il dispositivo è già nello stato desiderato",
"Now": "Ora",
"on": "on",
Expand All @@ -76,4 +76,4 @@
"Errors": "Errori",
"Advanced profile options": "Opzioni avanzate del profilo",
"Applied for all profiles": "Applicato per tutti i profili"
}
}
4 changes: 2 additions & 2 deletions src/src/i18n/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"30 m.": "30 m.",
"You cannot enable or disable this profile as it controlled by %s state": "U kunt dit profiel niet in- of uitschakelen omdat het wordt beheerd door de status %s",
"Press \"shift\" and move mouse to change more than one slider": "Druk op \"shift\" en beweeg de muis om meer dan één schuifregelaar te wijzigen",
"Ignore values if same as previous": "Negeer waarden als deze hetzelfde zijn als de vorige\n",
"Ignore values if same as previous": "Negeer waarden als deze hetzelfde zijn als de vorige",
"Do not control if device already in desired state": "Controleer niet of het apparaat zich al in de gewenste staat bevindt",
"Now": "Nu",
"on": "on",
Expand All @@ -76,4 +76,4 @@
"Errors": "Fouten",
"Advanced profile options": "Geavanceerde profielopties",
"Applied for all profiles": "Toegepast op alle profielen"
}
}
4 changes: 2 additions & 2 deletions src/src/i18n/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"30 m.": "30 m.",
"You cannot enable or disable this profile as it controlled by %s state": "Nie możesz włączyć ani wyłączyć tego profilu, ponieważ jest on kontrolowany przez stan %s",
"Press \"shift\" and move mouse to change more than one slider": "Naciśnij „shift” i poruszaj myszą, aby zmienić więcej niż jeden suwak",
"Ignore values if same as previous": "Ignoruj wartości, jeśli są takie same jak poprzednie\n",
"Ignore values if same as previous": "Ignoruj wartości, jeśli są takie same jak poprzednie",
"Do not control if device already in desired state": "Nie kontroluj, jeśli urządzenie jest już w pożądanym stanie",
"Now": "Teraz",
"on": "on",
Expand All @@ -76,4 +76,4 @@
"Errors": "Błędy",
"Advanced profile options": "Zaawansowane opcje profilu",
"Applied for all profiles": "Dotyczy wszystkich profili"
}
}
4 changes: 2 additions & 2 deletions src/src/i18n/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"30 m.": "30 m.",
"You cannot enable or disable this profile as it controlled by %s state": "Você não pode ativar ou desativar este perfil, pois ele é controlado pelo estado %s",
"Press \"shift\" and move mouse to change more than one slider": "Pressione \"shift\" e mova o mouse para alterar mais de um controle deslizante",
"Ignore values if same as previous": "Ignore os valores se forem iguais aos anteriores\n",
"Ignore values if same as previous": "Ignore os valores se forem iguais aos anteriores",
"Do not control if device already in desired state": "Não controle se o dispositivo já está no estado desejado",
"Now": "Agora",
"on": "sobre",
Expand All @@ -76,4 +76,4 @@
"Errors": "Erros",
"Advanced profile options": "Opções avançadas de perfil",
"Applied for all profiles": "Aplicado para todos os perfis"
}
}
4 changes: 2 additions & 2 deletions src/src/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"30 m.": "30 м.",
"You cannot enable or disable this profile as it controlled by %s state": "Вы не можете включить или отключить этот профиль, так как он управляется состоянием \"%s\"",
"Press \"shift\" and move mouse to change more than one slider": "Нажмите «Shift» и переместите мышь, чтобы изменить более одного ползунка.",
"Ignore values if same as previous": "Игнорировать значения, если они такие же, как и предыдущие\n",
"Ignore values if same as previous": "Игнорировать значения, если они такие же, как и предыдущие",
"Do not control if device already in desired state": "Не контролировать, если устройство уже находится в желаемом состоянии",
"Now": "Сейчас",
"on": "ВКЛ",
Expand All @@ -76,4 +76,4 @@
"Errors": "Ошибки",
"Advanced profile options": "Расширенные параметры профиля",
"Applied for all profiles": "Применяется для всех профилей"
}
}
4 changes: 2 additions & 2 deletions src/src/i18n/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"search text": "Пошуковий текст",
"You cannot enable or disable this profile as it controlled by %s state": "Ви не можете ввімкнути або вимкнути цей профіль, оскільки він контролюється станом %s",
"Press \"shift\" and move mouse to change more than one slider": "Натисніть «Shift» і перемістіть мишу, щоб змінити більше одного повзунка",
"Ignore values if same as previous": "Ігнорувати значення, якщо такі ж, як попередні\n",
"Ignore values if same as previous": "Ігнорувати значення, якщо такі ж, як попередні",
"Do not control if device already in desired state": "Не контролюйте, якщо пристрій уже в потрібному стані",
"Now": "Зараз",
"on": "ВКЛ",
Expand All @@ -76,4 +76,4 @@
"Errors": "Помилки",
"Advanced profile options": "Розширені параметри профілю",
"Applied for all profiles": "Застосовується для всіх профілів"
}
}
4 changes: 2 additions & 2 deletions src/src/i18n/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"30 m.": "30分钟",
"You cannot enable or disable this profile as it controlled by %s state": "您不能启用或禁用此配置文件,因为它由 %s 状态控制",
"Press \"shift\" and move mouse to change more than one slider": "按下“shift”并移动鼠标即可更改多个滑块",
"Ignore values if same as previous": "如果与之前相同则忽略值\n",
"Ignore values if same as previous": "如果与之前相同则忽略值",
"Do not control if device already in desired state": "如果设备已处于所需状态则不进行控制",
"Now": "现在",
"on": "on",
Expand All @@ -76,4 +76,4 @@
"Errors": "错误",
"Advanced profile options": "高级配置文件选项",
"Applied for all profiles": "适用于所有配置文件"
}
}

0 comments on commit 9b3d8bf

Please sign in to comment.