Skip to content

Commit

Permalink
Sort custom cards in card picker (#20517)
Browse files Browse the repository at this point in the history
  • Loading branch information
karwosts authored Apr 14, 2024
1 parent 27c53b3 commit 5317a11
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/panels/lovelace/editor/card-editor/hui-card-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => ({
Expand Down

0 comments on commit 5317a11

Please sign in to comment.