Skip to content

Commit

Permalink
feature: default to icons for favorites list (and show titles)
Browse files Browse the repository at this point in the history
  • Loading branch information
punxaphil committed Feb 7, 2024
1 parent 0b38887 commit 47a0637
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ export class Card extends LitElement {
} else {
this.section = PLAYER;
}
newConfig.mediaBrowserItemsPerRow = newConfig.mediaBrowserItemsPerRow || 4;
this.config = newConfig;
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/media-browser-icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class MediaBrowserIcons extends LitElement {
class="button"
@click=${() => this.dispatchEvent(customEvent(MEDIA_ITEM_SELECTED, item))}
>
${renderMediaBrowserItem(item, !item.thumbnail || !!this.config.mediaBrowserShowTitleForThumbnailIcons)}
${renderMediaBrowserItem(item, !item.thumbnail || !this.config.mediaBrowserHideTitleForThumbnailIcons)}
</ha-control-button>
`,
)}
Expand Down
2 changes: 1 addition & 1 deletion src/editor/advanced-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const ADVANCED_SCHEMA = [
name: 'artworkHostname',
},
{
name: 'mediaBrowserShowTitleForThumbnailIcons',
name: 'mediaBrowserHideTitleForThumbnailIcons',
selector: { boolean: {} },
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/editor/general-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const GENERAL_SCHEMA = [
{
type: 'integer',
name: 'mediaBrowserItemsPerRow',
default: 1,
default: 4,
required: true,
valueMin: 1,
valueMax: 30,
Expand Down
2 changes: 1 addition & 1 deletion src/sections/media-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class MediaBrowser extends LitElement {
until(
this.getFavorites(this.activePlayer).then((items) => {
if (items?.length) {
return (this.config.mediaBrowserItemsPerRow ?? 0) > 1
return (this.config.mediaBrowserItemsPerRow ?? 4) > 1
? html`
<sonos-media-browser-icons
.items=${items}
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export interface CardConfig extends LovelaceCardConfig {
customThumbnailIfMissing?: CustomThumbnails;
mediaBrowserTitlesToIgnore?: string[];
mediaBrowserItemsPerRow?: number;
mediaBrowserShowTitleForThumbnailIcons?: boolean;
mediaBrowserHideTitleForThumbnailIcons?: boolean;
topFavorites?: string[];
numberOfFavoritesToShow?: number;
hideBrowseMediaButton?: boolean;
Expand Down

0 comments on commit 47a0637

Please sign in to comment.