Skip to content

Commit

Permalink
add auto to selection list
Browse files Browse the repository at this point in the history
  • Loading branch information
karwosts authored and bramkragten committed Nov 28, 2023
1 parent e79d42d commit 4c7e4ee
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/panels/media-browser/ha-panel-media-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
mdiGrid,
mdiListBoxOutline,
mdiArrowLeft,
mdiAlphaABoxOutline,
mdiDotsVertical,
} from "@mdi/js";
import { ActionDetail } from "@material/mwc-list";
Expand Down Expand Up @@ -122,6 +123,16 @@ class PanelMediaBrowser extends LitElement {
.label=${this.hass.localize("ui.common.menu")}
.path=${mdiDotsVertical}
></ha-icon-button>
<mwc-list-item graphic="icon">
${this.hass.localize("ui.components.media-browser.auto")}
<ha-svg-icon
class=${this._preferredLayout === "auto"
? "selected_menu_item"
: ""}
slot="graphic"
.path=${mdiAlphaABoxOutline}
></ha-svg-icon>
</mwc-list-item>
<mwc-list-item graphic="icon">
${this.hass.localize("ui.components.media-browser.grid")}
<ha-svg-icon
Expand Down Expand Up @@ -170,12 +181,13 @@ class PanelMediaBrowser extends LitElement {
private async _handleMenuAction(ev: CustomEvent<ActionDetail>) {
switch (ev.detail.index) {
case 0:
this._preferredLayout =
this._preferredLayout === "grid" ? "auto" : "grid";
this._preferredLayout = "auto";
break;
case 1:
this._preferredLayout =
this._preferredLayout === "list" ? "auto" : "list";
this._preferredLayout = "grid";
break;
case 2:
this._preferredLayout = "list";
break;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,7 @@
"video": "Video"
},
"media_player_unavailable": "The selected media player is unavailable.",
"auto": "Auto",
"grid": "Grid",
"list": "List"
},
Expand Down

0 comments on commit 4c7e4ee

Please sign in to comment.