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],
|
||||
}, self.panel
|
||||
).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}"
|
||||
return result
|
||||
|
||||
|
||||
@@ -199,11 +199,15 @@ class LovelaceUIPanel:
|
||||
match entity_id.split(".")[0]:
|
||||
# handle internal stuff
|
||||
case 'navigate':
|
||||
iid = entity_id.split(".")[1]
|
||||
self.privious_cards.append(self.current_card)
|
||||
self.current_card = self.searchCard(iid)
|
||||
card_iid = entity_id.split(".")[1]
|
||||
if card_iid == "UP":
|
||||
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)
|
||||
|
||||
# send ha stuff to ha
|
||||
case _:
|
||||
ha_control.handle_buttons(entity_id, btype, value)
|
||||
|
||||
Reference in New Issue
Block a user