Skip to content

Commit

Permalink
Fix RGB Light
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Aug 18, 2023
1 parent 87e70c1 commit 5be2c39
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 16 deletions.
2 changes: 2 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const gulpHelper = require('@iobroker/vis-2-widgets-react-dev/gulpHelper');

gulpHelper.gulpTasks(gulp, adapterName, __dirname, `${__dirname}/src-widgets/`, [
`${__dirname}/src-widgets/build/static/js/*echarts-for-react_lib_core_js-node_modules_echarts_core*.*`,
`${__dirname}/src-widgets/build/static/js/*spectrum_color_dist_import_mjs*.*`,
`${__dirname}/src-widgets/build/static/js/*uiw_react-color-shade-slider*.*`,
]);

gulp.task('default', gulp.series('widget-build'));
1 change: 1 addition & 0 deletions io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
"Switches",
"Blinds",
"Clock",
"RGBLight",
"SimpleState",
"ViewInWidget",
"Camera",
Expand Down
6 changes: 3 additions & 3 deletions src-widgets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@craco/craco": "^7.1.0",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@iobroker/adapter-react-v5": "^4.4.7",
"@iobroker/adapter-react-v5": "^4.5.0",
"@iobroker/vis-2-widgets-react-dev": "^0.4.6",
"@mui/icons-material": "^5.14.3",
"@mui/material": "^5.14.5",
Expand Down Expand Up @@ -42,7 +42,7 @@
"react-icons": "^4.10.1",
"react-leaflet": "^4.2.1",
"react-scripts": "^5.0.1",
"sass": "^1.65.1",
"sass": "^1.66.0",
"uuid": "^9.0.0"
},
"scripts": {
Expand All @@ -64,4 +64,4 @@
"not ie <= 11",
"not op_mini all"
]
}
}
12 changes: 9 additions & 3 deletions src-widgets/src/RGBLight.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const styles = () => ({

const stateRoles = {
'switch.light': 'switch',
switch: 'switch',
'level.brightness': 'brightness',
'level.dimmer': 'brightness',
'level.color.red': 'red',
'level.color.green': 'green',
Expand Down Expand Up @@ -70,7 +72,7 @@ const loadStates = async (field, data, changeData, socket) => {
class RGBLight extends Generic {
constructor(props) {
super(props);
this.state.dialog = true;
this.state.dialog = false;
this.state.objects = {};
this.state.colorTemperatures = [];
this.sketch = false;
Expand Down Expand Up @@ -342,11 +344,12 @@ class RGBLight extends Generic {

renderSwitch() {
return this.state.objects.switch && <div className={this.props.classes.sliderContainer}>
{Generic.t('Off')}
<Switch
checked={this.state.switch || false}
onChange={e => this.setId('switch', e.target.checked)}
/>
{Generic.getText(this.state.objects?.switch?.common?.name)}
{Generic.t('On')}
</div>;
}

Expand Down Expand Up @@ -455,7 +458,10 @@ class RGBLight extends Generic {
}

renderDialog() {
return <Dialog open={this.state.dialog} onClose={() => this.setState({ dialog: false })}>
if (!this.state.dialog) {
return null;
}
return <Dialog open={!0} onClose={() => this.setState({ dialog: false })}>
<DialogTitle>{this.state.rxData.widgetTitle}</DialogTitle>
<DialogContent style={{ maxWidth: 400 }}>
<div className={this.props.classes.dialogContainer}>
Expand Down
4 changes: 3 additions & 1 deletion src-widgets/src/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,5 +301,7 @@
"vacuumCleaner": "Staubsauger",
"image": "Bild",
"Brightness": "Helligkeit",
"Color temperature": "Farbtemperatur"
"Color temperature": "Farbtemperatur",
"Close": "Schließen",
"Switch color picker": "Farbauswahl wechseln"
}
4 changes: 3 additions & 1 deletion src-widgets/src/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,5 +301,7 @@
"vacuumCleaner": "aspiradora",
"image": "Imagen",
"Brightness": "Brillo",
"Color temperature": "Temperatura del color"
"Color temperature": "Temperatura del color",
"Close": "Cerca",
"Switch color picker": "Cambiar selector de color"
}
4 changes: 3 additions & 1 deletion src-widgets/src/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,5 +301,7 @@
"vacuumCleaner": "aspirateur",
"image": "Image",
"Brightness": "Luminosité",
"Color temperature": "Température de couleur"
"Color temperature": "Température de couleur",
"Close": "Fermer",
"Switch color picker": "Changer de sélecteur de couleur"
}
4 changes: 3 additions & 1 deletion src-widgets/src/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,5 +301,7 @@
"vacuumCleaner": "Aspirapolvere",
"image": "Immagine",
"Brightness": "Luminosità",
"Color temperature": "Temperatura di colore"
"Color temperature": "Temperatura di colore",
"Close": "Vicino",
"Switch color picker": "Cambia selettore colore"
}
4 changes: 3 additions & 1 deletion src-widgets/src/i18n/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,5 +301,7 @@
"vacuumCleaner": "Stofzuiger",
"image": "Afbeelding",
"Brightness": "Helderheid",
"Color temperature": "Kleurtemperatuur"
"Color temperature": "Kleurtemperatuur",
"Close": "Dichtbij",
"Switch color picker": "Wissel van kleurenkiezer"
}
4 changes: 3 additions & 1 deletion src-widgets/src/i18n/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,5 +301,7 @@
"vacuumCleaner": "Odkurzacz",
"image": "Obraz",
"Brightness": "Jasność",
"Color temperature": "Temperatura koloru"
"Color temperature": "Temperatura koloru",
"Close": "Zamknąć",
"Switch color picker": "Przełącz próbnik kolorów"
}
4 changes: 3 additions & 1 deletion src-widgets/src/i18n/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,5 +301,7 @@
"vacuumCleaner": "Aspirador de pó",
"image": "Imagem",
"Brightness": "Brilho",
"Color temperature": "Temperatura de cor"
"Color temperature": "Temperatura de cor",
"Close": "Fechar",
"Switch color picker": "Alternar seletor de cores"
}
4 changes: 3 additions & 1 deletion src-widgets/src/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,5 +301,7 @@
"vacuumCleaner": "Пылесос",
"image": "Изображение",
"Brightness": "Яркость",
"Color temperature": "Цветовая температура"
"Color temperature": "Цветовая температура",
"Close": "Закрывать",
"Switch color picker": "Переключить палитру цветов"
}
4 changes: 3 additions & 1 deletion src-widgets/src/i18n/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,5 +301,7 @@
"vacuumCleaner": "Пилосос",
"image": "Зображення",
"Brightness": "Яскравість",
"Color temperature": "Колірна температура"
"Color temperature": "Колірна температура",
"Close": "Закрити",
"Switch color picker": "Змінити вибір кольору"
}
4 changes: 3 additions & 1 deletion src-widgets/src/i18n/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,5 +301,7 @@
"vacuumCleaner": "吸尘器",
"image": "图像",
"Brightness": "亮度",
"Color temperature": "色温"
"Color temperature": "色温",
"Close": "关闭",
"Switch color picker": "切换颜色选择器"
}

0 comments on commit 5be2c39

Please sign in to comment.