Giter Site home page Giter Site logo

Comments (6)

dmyoung9 avatar dmyoung9 commented on July 1, 2024

I can confirm the same behavior:

This is in the Android app, so they aren't cut off (because the sidebar is expanded), but I am definitely having that badge on all my custom items.

from custom-sidebar-v2.

dmyoung9 avatar dmyoung9 commented on July 1, 2024

Correction: This is behaving slightly differently for me on PC (Chrome) that in is in the Android app.

image

It isn't showing on every single custom icon, but it is on a couple, so I'm not sure what's the determining factor.

from custom-sidebar-v2.

dmyoung9 avatar dmyoung9 commented on July 1, 2024

@galloween Any ideas on how to solve this?

from custom-sidebar-v2.

ianwitherow avatar ianwitherow commented on July 1, 2024

This was bothering me. I can submit a PR but I haven't been seeing much communication or activity on this repo by the author so it might go unmerged. (Edit - never mind, clearly wasn't looking in the right place! @galloween Let me know if you'd like me to submit a PR, or if you'd rather address this a different way)

The problem is that when you add a new item it clones an existing item, modifies it, then appends it. If the cloned item has a badge, the new item will too.

Here's my fix:

  • Edit your custom-sidebar-v2/custom-sidebar-v2.js file (I'm using HACS and mine was in www/community)

  • Find the function createItem (should be around line 277)

  • Anywhere in the if (cln) {} block, add this:

        if (config_entry.new_item) {
          // If the cloned item has a configuration badge, remove it.
          cln.querySelector(".configuration-badge")?.remove();
        }

E.g.,
image

This will ensure any items that you're adding (instead of moving around) will not have the number badge.

Side note: I struggled with getting Home Assistant to serve up a current version of the custom-sidebar-v2.js file instead of feeding me a cached copy (tried hard refreshing, clearing cache, restarting HA; always got the original copy). I ended up changing the .js filename (and updating the reference in my configuration.yaml's extra_module_url). If someone could tell me how to actually clear the cache for that I'd appreciate it! I'm using HACS which might have something to do with it.

Second edit: Re-reading the original message in this issue, I'm wondering if this can happen to folks even when an item isn't flagged with "new_item": true. If this is the case, we could instead add another option to the entry items such as "badge": false. Just a thought.

from custom-sidebar-v2.

n00bcodr avatar n00bcodr commented on July 1, 2024

I just added your forked repo.
I think it only shows on "new_item". But will test it and see if it is showing on all the entries.

from custom-sidebar-v2.

n00bcodr avatar n00bcodr commented on July 1, 2024

@ianwitherow do you plan to maintain your fork? 😄
This breaks on the latest HA release (2023.4)

from custom-sidebar-v2.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.