Skip to content
This repository has been archived by the owner on Oct 8, 2020. It is now read-only.

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
maykar committed May 27, 2020
1 parent 75b15d9 commit 57c4ca7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
/.rpt2_cache/
package-lock.json
dist
yarn.lock
yarn.lock
yarn-error.log
4 changes: 3 additions & 1 deletion src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export const tabIndexByName = tab => {
export const invertNumArray = show_tabs => {
if (show_tabs && show_tabs.length) {
const total_tabs = [];
for (let i = 0; i < ha_elements().tabs.length; i += 1) total_tabs.push(i);
const haElem = ha_elements();
if (!haElem || !haElem.tabs) return [];
for (let i = 0; i < haElem.tabs.length; i += 1) total_tabs.push(i);
return total_tabs.filter(el => !show_tabs.includes(el));
}
};
Expand Down
1 change: 1 addition & 0 deletions src/style-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export const styleHeader = (config, ch, haElem = ha_elements()) => {
if (config.tab_icons && headerType.tabs.length) {
for (const tab in config.tab_icons) {
const index = tabIndexByName(tab);
if (!headerType.tabs[index]) continue;
const haIcon = headerType.tabs[index].querySelector('ha-icon');
if (!config.tab_icons[tab]) haIcon.icon = haElem.lovelace.config.views[index].icon;
else haIcon.icon = config.tab_icons[tab];
Expand Down

0 comments on commit 57c4ca7

Please sign in to comment.