Sort custom cards in card picker (#20517)

This commit is contained in:
karwosts 2024-04-14 13:32:35 -07:00 committed by GitHub
parent 27c53b3241
commit 5317a11c39
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 7 deletions

View File

@ -278,13 +278,21 @@ export class HuiCardPicker extends LitElement {
if (customCards.length > 0) {
cards = cards.concat(
customCards.map((ccard: CustomCardEntry) => ({
type: ccard.type,
name: ccard.name,
description: ccard.description,
showElement: ccard.preview,
isCustom: true,
}))
customCards
.map((ccard: CustomCardEntry) => ({
type: ccard.type,
name: ccard.name,
description: ccard.description,
showElement: ccard.preview,
isCustom: true,
}))
.sort((a, b) =>
stringCompare(
a.name || a.type,
b.name || b.type,
this.hass?.language
)
)
);
}
this._cards = cards.map((card: Card) => ({