vasqued2 / ha-teamtracker-card

A Home Assistant frontend custom card that will display real-time updates for teams tracked with the ha-teamtracker integration. Has custom in-game layouts for football, baseball, basketball, hockey, soccer, golf, tennis, racing, and mma.
GNU General Public License v3.0
75 stars 16 forks source link

Added odds, overunder and tv-network to visual editor #102

Closed TheGlorySaint closed 3 weeks ago

TheGlorySaint commented 1 month ago

Added extra selectables to visual editor for odds, overunder and tv-network, because with every new update like the last, my custom configuration got resent to the standard one. I made the configuration in the pre.js file, but this is no more present in the dist folder

vasqued2 commented 1 month ago

Thanks for the update, however I do not plan on incorporating the ability to modify additional card styles with more configuration settings. The card-mod card is a much more flexible alternative. It will allow you to accomplish everything you are trying to do and more. And it will not require ongoing changes to the card w/ every update. All you have to do is install card-mod from HACS and then append the appropriate configuration YAML to override whatever you want.

Here is an example that hides the same fields you are hiding with your new config settings. Additionally, the last part displays the league where the odds used to display, which your changes do not support. This is one example of how card-mod is much more flexible than what can be accomplished via config settings. And of course you could hide/replace any additional field you want as well.

type: custom:teamtracker-card
entity: sensor.tt_ncaaf_osu
outline: true
outline_color: lightgray
show_league: false
show_rank: true
home_side: ''
debug: false
show_timeouts: true
title: Test Cardmod Hides
card_title: Test cardmod Hides and Overrides
card_mod:
  style: |
    .odds {
        visibility: hidden;
    }
    .overunder {
        visibility: hidden;
    }
    .network {
        visibility: hidden;
    }
    .odds::after {
        visibility: visible;
        content: "{{ state_attr('sensor.tt_ncaaf_osu', 'league') }}";
    }

If you want to continue to modify the card directly you still can.

To address the "Custom element doesn't exist" problem some people were experiencing with upgrades, I migrated to use the Javascript bundler Parcel. You can read about it here. If you want to continue to build your own version of the card, it should give you enough to rebuild it from the code in the src/ directory and populate the single bundled Javascript file in the dist/ directory. As you pointed out, once you make those changes, you will either have to keep making them or refrain from further updates. Personally I think card-mod is a much better solution but if you want to continue to maintain your own version, you can.

Hope this helps. Let me know if you have any questions or have trouble doing whatever you decide to do.

TheGlorySaint commented 3 weeks ago

Thank you vasqued. Sad to hear that something like this will not be merged.

Thank you for the example you provided.

vasqued2 commented 3 weeks ago

Sorry, it's not this one change specifically, but the total off all requests of this nature that come in. Everyone has a request to tweak the card, change color, change font, remove an element, add an element, move an element. There's another request out right now to add a " - " between the two scores, etc.

I could find no way to make it easily configurable in all the requested ways, not to mention maintainable and testable, across the many variations. That's when I realized that card-mod could enable all of those requests and if something came in that it couldn't do, it was easier to make it compatible than to enable all the individual variations. I made the decision to grandfather in the existing configurations but not to add more.

Hope you understand.