-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add device type's icons to cards #1350
feat: add device type's icons to cards #1350
Conversation
src/components/ZclEndpointCard.vue
Outdated
let category = '' | ||
this.$store.state.zap.selectedZapConfig.zclProperties.forEach((item) => { | ||
if (item.id === packageRef) { | ||
category = item.category |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return category
once it has been populated.
@@ -289,6 +300,15 @@ export default { | |||
} | |||
}, | |||
methods: { | |||
getDeviceCategory(packageRef) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comments to function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the comment format as below for this function too
/** * Specifies the path to the logo image * * @param {*} isTiny - * if value "true", it's used as a tiny logo * if value "false", it's used as a normal logo * @param {*} category - * if value "zigbee", it's used as a zigbee logo * if value "matter", it's used as a matter logo * if value "multiprotocol", it's used as a multiprotocol logo * @param {*} isSelected - * if value "true", it's used as a dark / selected version * if value "false", it's used as a light version * @returns Returns a string value for the src image property */
981b27f
to
0394873
Compare
@@ -289,6 +300,15 @@ export default { | |||
} | |||
}, | |||
methods: { | |||
getDeviceCategory(packageRef) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the comment format as below for this function too
/** * Specifies the path to the logo image * * @param {*} isTiny - * if value "true", it's used as a tiny logo * if value "false", it's used as a normal logo * @param {*} category - * if value "zigbee", it's used as a zigbee logo * if value "matter", it's used as a matter logo * if value "multiprotocol", it's used as a multiprotocol logo * @param {*} isSelected - * if value "true", it's used as a dark / selected version * if value "false", it's used as a light version * @returns Returns a string value for the src image property */
src/components/ZclEndpointCard.vue
Outdated
if (item.id === packageRef) { | ||
if (item.category) { | ||
category = item.category | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just realized the returning in a forEach does not really end the loop but it continues going through the loop regardless.
Can you switch this.$store.state.zap.selectedZapConfig.zclProperties.forEach((item) => { if (item.id === packageRef) { if (item.category) { category = item.category return } } })
to
let zclProperty = this.$store.state.zap.selectedZapConfig.zclProperties.find((item) => (item.id === packageRef && item.category)) if (zclProperty) { category = zclProperty.category } return category
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also switch to a normal for loop and return instead of using forEach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right, thanks. i will fix it
No description provided.