mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-20 22:47:01 +01:00
implement navigation up
This commit is contained in:
@@ -246,6 +246,14 @@ class HACard(panel_cards.Card):
|
|||||||
'color': [255, 255, 255],
|
'color': [255, 255, 255],
|
||||||
}, self.panel
|
}, self.panel
|
||||||
).render()[1:]
|
).render()[1:]
|
||||||
|
if not self.iid_prev and not self.iid_next:
|
||||||
|
leftBtn = panel_cards.Entity(self.locale,
|
||||||
|
{
|
||||||
|
'entity': f'navigate.UP',
|
||||||
|
'icon': 'mdi:arrow-left-bold',
|
||||||
|
'color': [255, 255, 255],
|
||||||
|
}, self.panel
|
||||||
|
).render()[1:]
|
||||||
result = f"{leftBtn}~{rightBtn}"
|
result = f"{leftBtn}~{rightBtn}"
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
@@ -199,11 +199,15 @@ class LovelaceUIPanel:
|
|||||||
match entity_id.split(".")[0]:
|
match entity_id.split(".")[0]:
|
||||||
# handle internal stuff
|
# handle internal stuff
|
||||||
case 'navigate':
|
case 'navigate':
|
||||||
iid = entity_id.split(".")[1]
|
card_iid = entity_id.split(".")[1]
|
||||||
self.privious_cards.append(self.current_card)
|
if card_iid == "UP":
|
||||||
self.current_card = self.searchCard(iid)
|
self.current_card = self.privious_cards.pop()
|
||||||
|
# TODO Handle privious_cards empty with default card
|
||||||
|
self.render_current_page(switchPages=True)
|
||||||
|
else:
|
||||||
|
self.privious_cards.append(self.current_card)
|
||||||
|
self.current_card = self.searchCard(card_iid)
|
||||||
self.render_current_page(switchPages=True)
|
self.render_current_page(switchPages=True)
|
||||||
|
|
||||||
# send ha stuff to ha
|
# send ha stuff to ha
|
||||||
case _:
|
case _:
|
||||||
ha_control.handle_buttons(entity_id, btype, value)
|
ha_control.handle_buttons(entity_id, btype, value)
|
||||||
|
|||||||
Reference in New Issue
Block a user