Clooos / Bubble-Card

Bubble Card is a minimalist card collection for Home Assistant with a nice pop-up touch.
MIT License
1.43k stars 39 forks source link

Horizontal Stack: Use array for buttons #455

Open SLaks opened 2 months ago

SLaks commented 2 months ago

Instead of using numeric prefixes like 1_name:, 2_icon:, etc, can you please accept an array of buttons?

eg,

buttons:
  - name: First button
    icon: mdi:light
  - name: Second button
    ...

This will make it much simpler for me to build a dynamic set of buttons using https://github.com/thomasloven/lovelace-auto-entities or https://github.com/iantrich/config-template-card

Clooos commented 2 months ago

Hi! This is indeed a breaking change that I want to add and this is already in my to-do list, I was thinking of changing this for the v2.

SLaks commented 2 months ago

To reduce / eliminate the breaking change, you can keep the existing code that reads the 1_* fields (eg, until v3), but change the editor to write a buttons: array.

This means that clicking Edit, Save would migrate the underling card config, but legacy cards will keep working until some future version that stops reading the legacy fields.

That future version would have big deprecation warnings; you could even release a minor version that adds a deprecation warning in the rendered card shortly before.

Clooos commented 2 months ago

That was something like that that I had in mind, I will work on that as soon as I can. I really hate what I've did for the YAML of the HBS, I've learned a lot since and this is indeed an error that I need to fix.