diff --git a/src/mushroom-strategy.ts b/src/mushroom-strategy.ts index 0b1bcb0..50573e9 100644 --- a/src/mushroom-strategy.ts +++ b/src/mushroom-strategy.ts @@ -152,7 +152,7 @@ class MushroomStrategy extends HTMLTemplateElement { }); if (domain === 'binary_sensor') { - domainCards = Registry.stackHorizontal(domainCards, 2); + domainCards = Registry.stackHorizontal(domainCards); } return domainCards.length ? { type: 'vertical-stack', cards: [titleCard, ...domainCards] } : null; diff --git a/src/views/HomeView.ts b/src/views/HomeView.ts index 64f7c92..ab23ee8 100644 --- a/src/views/HomeView.ts +++ b/src/views/HomeView.ts @@ -209,7 +209,7 @@ class HomeView extends AbstractView { return { type: 'vertical-stack', - cards: Registry.stackHorizontal(cardConfigurations, 8), + cards: Registry.stackHorizontal(cardConfigurations), }; } @@ -228,12 +228,16 @@ class HomeView extends AbstractView { const cardConfigurations: (TemplateCardConfig | AreaCardConfig)[] = []; + let onlyDefaultCards = true; + for (const area of Registry.areas) { const moduleName = Registry.strategyOptions.areas[area.area_id]?.type ?? Registry.strategyOptions.areas['_']?.type ?? 'default'; let AreaCard; + onlyDefaultCards = onlyDefaultCards && moduleName === 'default'; + try { AreaCard = (await import(`../cards/${moduleName}`)).default; } catch (e) { @@ -254,7 +258,7 @@ class HomeView extends AbstractView { title: (Registry.strategyOptions.home_view.hidden as HomeViewSections[]).includes('areasTitle') ? undefined : localize('generic.areas'), - cards: Registry.stackHorizontal(cardConfigurations, 2), + cards: Registry.stackHorizontal(cardConfigurations, { area: 1, 'custom:mushroom-template-card': 2 }), }; } }