Skip to content

Commit

Permalink
Update numeric transformers
Browse files Browse the repository at this point in the history
  • Loading branch information
amberstarlight committed Jul 13, 2024
1 parent 5189944 commit a78ec9c
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 35 deletions.
29 changes: 19 additions & 10 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified .yarn/install-state.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"scripts": {
"lint": "yarn eslint .",
"fix": "yarn eslint . --fix",
"prettier": "yarn prettier -w .",
"fmt": "yarn prettier -w .",
"api:dev": "yarn workspace @starlight/api run dev",
"ui:dev": "yarn workspace @starlight/ui run dev"
},
Expand Down
1 change: 0 additions & 1 deletion packages/api/zigbee2mqttService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ class MqttDevice {
expose,
value,
);
console.log(response);
return response;
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
},
"devDependencies": {
"@starlight/types": "workspace:^",
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@vitejs/plugin-react": "^4.2.1",
Expand Down
7 changes: 4 additions & 3 deletions packages/ui/src/components/DeviceSettings/generator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,13 @@ export const deviceSettingsGenerator = (
};

updateDeviceState(
deviceSettingsState,
setDeviceSettingsState,
device.friendly_name,
"color",
newMqttColor,
);
).then((res) => {
const updated = Object.assign(deviceSettingsState, res);
setDeviceSettingsState(updated);
});
}}
/>,
);
Expand Down
1 change: 0 additions & 1 deletion packages/ui/src/components/GroupSettings/GroupSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ function GroupSettings(props) {
.then((res) => res.json())
.then((data) => {
setGroupSettingsState(data.data);
console.log(data.data);
});
}, []);

Expand Down
20 changes: 10 additions & 10 deletions packages/ui/src/utils/transformers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ export const numericTransformer = (
displayValue={displayValue}
onChange={(event) => {
const newMqttValue = event.target.value;
updateDeviceState(
deviceSettingsState,
setDeviceSettingsState,
device.friendly_name,
feature.name,
newMqttValue,
updateDeviceState(device.ieee_address, feature.name, newMqttValue).then(
(res) => {
const updated = Object.assign(deviceSettingsState, res);
setDeviceSettingsState(updated);
},
);
}}
/>,
Expand All @@ -57,12 +56,13 @@ export const numericTransformer = (
text={stringTidy(preset.name)}
onClick={() => {
updateDeviceState(
deviceSettingsState,
setDeviceSettingsState,
device.friendly_name,
device.ieee_address,
feature.name,
preset.value,
);
).then((res) => {
const updated = Object.assign(deviceSettingsState, res);
setDeviceSettingsState(updated);
});
}}
></Button>
));
Expand Down
24 changes: 17 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -950,8 +950,8 @@ __metadata:
resolution: "@starlight/ui@workspace:packages/ui"
dependencies:
"@starlight/types": "workspace:^"
"@types/react": "npm:^18.2.66"
"@types/react-dom": "npm:^18.2.22"
"@types/react": "npm:^18.3.3"
"@types/react-dom": "npm:^18.3.0"
"@typescript-eslint/eslint-plugin": "npm:^7.2.0"
"@typescript-eslint/parser": "npm:^7.2.0"
"@vitejs/plugin-react": "npm:^4.2.1"
Expand Down Expand Up @@ -1171,16 +1171,16 @@ __metadata:
languageName: node
linkType: hard

"@types/react-dom@npm:^18.2.22":
version: 18.2.25
resolution: "@types/react-dom@npm:18.2.25"
"@types/react-dom@npm:^18.3.0":
version: 18.3.0
resolution: "@types/react-dom@npm:18.3.0"
dependencies:
"@types/react": "npm:*"
checksum: 10c0/87604407eca6884c5b4d4657cb511dc5ba28ea1cfa5d0ce1fc2d659a7ad1b64ae85dcda60e3f010641f9a52a6a60dfcaa6be3b0d0de9d624475052a13dae01f4
checksum: 10c0/6c90d2ed72c5a0e440d2c75d99287e4b5df3e7b011838cdc03ae5cd518ab52164d86990e73246b9d812eaf02ec351d74e3b4f5bd325bf341e13bf980392fd53b
languageName: node
linkType: hard

"@types/react@npm:*, @types/react@npm:^18.2.66":
"@types/react@npm:*":
version: 18.2.76
resolution: "@types/react@npm:18.2.76"
dependencies:
Expand All @@ -1190,6 +1190,16 @@ __metadata:
languageName: node
linkType: hard

"@types/react@npm:^18.3.3":
version: 18.3.3
resolution: "@types/react@npm:18.3.3"
dependencies:
"@types/prop-types": "npm:*"
csstype: "npm:^3.0.2"
checksum: 10c0/fe455f805c5da13b89964c3d68060cebd43e73ec15001a68b34634604a78140e6fc202f3f61679b9d809dde6d7a7c2cb3ed51e0fd1462557911db09879b55114
languageName: node
linkType: hard

"@types/readable-stream@npm:^4.0.5":
version: 4.0.10
resolution: "@types/readable-stream@npm:4.0.10"
Expand Down

0 comments on commit a78ec9c

Please sign in to comment.