diff --git a/packages/dm-gui-components/src/DeviceCard.tsx b/packages/dm-gui-components/src/DeviceCard.tsx index 5050ec84f..07e0ecc56 100644 --- a/packages/dm-gui-components/src/DeviceCard.tsx +++ b/packages/dm-gui-components/src/DeviceCard.tsx @@ -336,7 +336,7 @@ class DeviceCard extends Component { const icon = this.state.icon ? ( this.state.icon?.length < 20 ? ( - getDeviceIcon(this.state.icon as Types | 'hub3' | 'node' | 'controller' | 'hub5') || ( + getDeviceIcon(this.state.icon as Types) || ( ) ) : ( @@ -522,6 +522,24 @@ class DeviceCard extends Component { ? this.props.device.status : [this.props.device.status]; + const icon = this.state.icon ? ( + this.state.icon?.length < 20 ? ( + getDeviceIcon(this.state.icon as Types, imgStyle) || ( + + ) + ) : ( + + ) + ) : ( + + ); + return ( { socket={this.props.socket} /> ) : null} - + {icon} ; } -export function getDeviceIcon(type: Types | 'hub3' | 'node' | 'controller' | 'hub5'): React.JSX.Element | null { +export function getDeviceIcon(type: Types, style?: React.CSSProperties): React.JSX.Element | null { if (type === 'hub3') { - return ; + return ; } if (type === 'node') { - return ; + return ; } if (type === 'hub5') { - return ; + return ; } if (type === 'controller') { - return ; + return ; } - if (type === Types.airCondition) { - return ; + if (type === 'airCondition') { + return ; } - if (type === Types.blind) { - return ; + if (type === 'blind') { + return ; } - if (type === Types.camera) { - return ; + if (type === 'camera') { + return ; } - if (type === Types.chart) { - return ; + if (type === 'chart') { + return ; } - if (type === Types.ct) { - return ; + if (type === 'ct') { + return ; } - if (type === Types.dimmer) { - return ; + if (type === 'dimmer') { + return ; } - if (type === Types.door) { - return ; + if (type === 'door') { + return ; } - if (type === Types.fireAlarm) { - return ; + if (type === 'fireAlarm') { + return ; } - if (type === Types.floodAlarm) { - return ; + if (type === 'floodAlarm') { + return ; } - if (type === Types.humidity) { - return ; + if (type === 'humidity') { + return ; } - if (type === Types.image) { - return ; + if (type === 'image') { + return ; } - if (type === Types.light) { - return ; + if (type === 'light') { + return ; } - if (type === Types.lock) { - return ; + if (type === 'lock') { + return ; } - if (type === Types.location) { - return ; + if (type === 'location') { + return ; } - if (type === Types.media) { - return ; + if (type === 'media') { + return ; } - if (type === Types.motion) { - return ; + if (type === 'motion') { + return ; } - if (type === Types.rgb) { - return ; + if (type === 'rgb') { + return ; } - if (type === Types.rgbSingle) { - return ; + if (type === 'rgbSingle') { + return ; } - if (type === Types.rgbwSingle) { - return ; + if (type === 'rgbwSingle') { + return ; } - if (type === Types.slider) { - return ; + if (type === 'slider') { + return ; } - if (type === Types.socket) { - return ; + if (type === 'socket') { + return ; } - if (type === Types.temperature) { - return ; + if (type === 'temperature') { + return ; } - if (type === Types.thermostat) { - return ; + if (type === 'thermostat') { + return ; } - if (type === Types.volume) { - return ; + if (type === 'volume') { + return ; } - if (type === Types.volumeGroup) { - return ; + if (type === 'volumeGroup') { + return ; } - if (type === Types.weatherCurrent) { - return ; + if (type === 'weatherCurrent') { + return ; } - if (type === Types.weatherForecast) { - return ; + if (type === 'weatherForecast') { + return ; } - if (type === Types.window) { - return ; + if (type === 'window') { + return ; } - if (type === Types.windowTilt) { - return ; + if (type === 'windowTilt') { + return ; } - if (type === Types.blindButtons) { - return ; + if (type === 'blindButtons') { + return ; } - if (type === Types.button) { - return ; + if (type === 'button') { + return ; } - if (type === Types.buttonSensor) { - return ; + if (type === 'buttonSensor') { + return ; } - if (type === Types.cie) { - return ; + if (type === 'cie') { + return ; } - if (type === Types.gate) { - return ; + if (type === 'gate') { + return ; } - if (type === Types.hue) { - return ; + if (type === 'hue') { + return ; } - if (type === Types.info) { - return ; + if (type === 'info') { + return ; } - if (type === Types.instance) { - return ; + if (type === 'instance') { + return ; } - if (type === Types.unknown) { - return ; + if (type === 'unknown') { + return ; } - if (type === Types.vacuumCleaner) { - return ; + if (type === 'vacuumCleaner') { + return ; } - if (type === Types.warning) { - return ; + if (type === 'warning') { + return ; } return null; }