Skip to content

Commit

Permalink
fix(wirepas): improve lightbulb display
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Feb 13, 2024
1 parent c5f1c43 commit 3bbb4f4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/wirepas/WirepasGatewayTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { useSettings } from '../context/Settings.js'
import { useWebsocket } from '../context/WebsocketConnection.js'
import { ButtonPressDiff } from '../ButtonPress.js'
import type { ButtonPress as ButtonPressData } from '../context/Devices.js'
import { sum } from 'lodash-es'

export const WirepasGatewayTile = ({
gateway,
Expand Down Expand Up @@ -134,7 +135,8 @@ const Node = ({
b: false,
...(node.payload?.led ?? {}),
}
const color = [r ? 255 : 128, g ? 255 : 128, b ? 255 : 128]
const color = [r ? 255 : 0, g ? 255 : 0, b ? 255 : 0]
const noColor = sum(color) === 0
const {
settings: { managementCodes },
} = useSettings()
Expand All @@ -161,10 +163,10 @@ const Node = ({
<button
type="button"
class="btn btn-link"
style={{ color: `rgb(${color.join(',')})` }}
style={{ color: noColor ? 'gray' : `rgb(${color.join(',')})` }}
onClick={() => setConfigureLED((c) => !c)}
>
<Lightbulb strokeWidth={1} />
<Lightbulb strokeWidth={noColor ? 1 : 2} />
</button>
) : (
<span style={{ color: `rgb(${color.join(',')})` }}>
Expand Down

0 comments on commit 3bbb4f4

Please sign in to comment.