Skip to content

Commit 05f72e9

Browse files
authoredMay 17, 2023
219 setting an entity alongside any type of tap action is ignored (#234)
* Fix entity alongside any type of tap_action * Updated info.md * Fixed Navigation header url not working * Updated libs
1 parent 407fe18 commit 05f72e9

File tree

7 files changed

+18
-13
lines changed

7 files changed

+18
-13
lines changed
 

‎info.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{% if installed %}
22

33
### Features
4+
{% if version_installed.replace("v", "").replace(".","") | int < 10722 %}
5+
- Fixed `Navigation header url not working`
6+
{% endif %}
7+
48
{% if version_installed.replace("v", "").replace(".","") | int < 10721 %}
59
- Fixed `entity alongside any type of tap_actions`
610
{% endif %}

‎package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "room-card",
3-
"version": "1.07.21",
3+
"version": "1.07.22",
44
"description": "Show entities in Home Assistant's Lovelace UI",
55
"keywords": [
66
"home-assistant",

‎room-card.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎room-card.js.gz

12 Bytes
Binary file not shown.

‎src/entity.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,17 @@ export const clickHandler = (element: LitElement, hass: HomeAssistant, entity: R
185185

186186
export const generateActions = (config: RoomCardConfig, entity: RoomCardEntity) => {
187187
return {
188-
tap_action: generateAction(config.tap_action, entity),
189-
double_tap_action: generateAction(config.double_tap_action, entity),
190-
hold_action: generateAction(config.hold_action, entity),
188+
tap_action: checkAction(config.tap_action, entity?.tap_action),
189+
double_tap_action: checkAction(config.double_tap_action, entity?.double_tap_action),
190+
hold_action: checkAction(config.hold_action, entity?.hold_action),
191191
} as RoomCardEntity
192192
}
193193

194-
export const generateAction = (action: ActionConfig, entity: RoomCardEntity) => {
195-
return entity && action?.action !== undefined && action.action !== "more-info" ? entity : action;
194+
export const checkAction = (action: ActionConfig, entityAction: ActionConfig) => {
195+
return entityAction ?? action;
196196
}
197197

198-
export const renderTitle = (config: RoomCardConfig, hass: HomeAssistant, element: LitElement, entity?: RoomCardEntity, ) : HTMLTemplateResult => {
198+
export const renderTitle = (config: RoomCardConfig, hass: HomeAssistant, element: LitElement, entity?: RoomCardEntity) : HTMLTemplateResult => {
199199
if(config.hide_title === true)
200200
return null;
201201

‎tests/entity/renderTitle.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ describe('Testing entity file function renderValue', () => {
176176
const entity: RoomCardEntity = {
177177
stateObj: stateObj,
178178
show_icon: true,
179-
icon: 'mdi:table'
179+
icon: 'mdi:table',
180+
tap_action: { action: 'navigate' } as NavigateActionConfig
180181
};
181182

182183
stateObj.attributes['title'] = "Test title";

0 commit comments

Comments
 (0)