Refactor column count of person cards in Home view

Having many persons, the cards would take up a lot of space in the Home
view. Now, a horizontal stack allows up to 8 cards.
This commit is contained in:
DigiLive
2025-05-02 10:02:32 +02:00
parent 5ee0500f08
commit 8ba322b838
2 changed files with 2 additions and 3 deletions

View File

@@ -265,7 +265,7 @@ class Registry {
* Each horizontal stack contains a specified number of cards. * Each horizontal stack contains a specified number of cards.
* *
* @param {LovelaceCardConfig[]} cardConfigurations - Array of card configurations to be stacked. * @param {LovelaceCardConfig[]} cardConfigurations - Array of card configurations to be stacked.
* @param {number} columnCount - Number of cards per horizontal stack. * @param {number} columnCount - Maximal number of cards per horizontal stack.
*/ */
static stackHorizontal(cardConfigurations: LovelaceCardConfig[], columnCount: number): StackCardConfig[] { static stackHorizontal(cardConfigurations: LovelaceCardConfig[], columnCount: number): StackCardConfig[] {
const stackedCardConfigurations: StackCardConfig[] = []; const stackedCardConfigurations: StackCardConfig[] = [];

View File

@@ -207,10 +207,9 @@ class HomeView extends AbstractView {
.map((person) => new PersonCard(person).getCard()), .map((person) => new PersonCard(person).getCard()),
); );
// FIXME: The columns are too narrow when having many persons.
return { return {
type: 'vertical-stack', type: 'vertical-stack',
cards: Registry.stackHorizontal(cardConfigurations, 2), cards: Registry.stackHorizontal(cardConfigurations, 8),
}; };
} }