From f2d5c0092a0e4b80449c924a801c97ef6b20385b Mon Sep 17 00:00:00 2001 From: David Mulcahey Date: Mon, 7 Oct 2024 13:16:53 -0400 Subject: [PATCH] Fix ZHA group dashboard display on mobile --- .../zha/zha-groups-dashboard.ts | 64 +++++++++---------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/src/panels/config/integrations/integration-panels/zha/zha-groups-dashboard.ts b/src/panels/config/integrations/integration-panels/zha/zha-groups-dashboard.ts index e6559f63b00c..31674f6a0576 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-groups-dashboard.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-groups-dashboard.ts @@ -24,6 +24,7 @@ import { haStyle } from "../../../../../resources/styles"; import { HomeAssistant, Route } from "../../../../../types"; import { formatAsPaddedHex, sortZHAGroups } from "./functions"; import { zhaTabs } from "./zha-config-dashboard"; +import { LocalizeFunc } from "../../../../../common/translations/localize"; export interface GroupRowData extends ZHAGroup { group?: GroupRowData; @@ -71,38 +72,35 @@ export class ZHAGroupsDashboard extends LitElement { }); private _columns = memoizeOne( - (narrow: boolean): DataTableColumnContainer => - narrow - ? { - name: { - title: "Group", - sortable: true, - filterable: true, - direction: "asc", - flex: 2, - }, - } - : { - name: { - title: this.hass.localize("ui.panel.config.zha.groups.groups"), - sortable: true, - filterable: true, - direction: "asc", - flex: 2, - }, - group_id: { - title: this.hass.localize("ui.panel.config.zha.groups.group_id"), - type: "numeric", - template: (group) => html` ${formatAsPaddedHex(group.group_id)} `, - sortable: true, - }, - members: { - title: this.hass.localize("ui.panel.config.zha.groups.members"), - type: "numeric", - template: (group) => html` ${group.members.length} `, - sortable: true, - }, - } + (localize: LocalizeFunc): DataTableColumnContainer => { + const columns: DataTableColumnContainer = { + name: { + title: localize("ui.panel.config.zha.groups.groups"), + sortable: true, + filterable: true, + showNarrow: true, + main: true, + hideable: false, + moveable: false, + direction: "asc", + flex: 2, + }, + group_id: { + title: localize("ui.panel.config.zha.groups.group_id"), + type: "numeric", + template: (group) => html` ${formatAsPaddedHex(group.group_id)} `, + sortable: true, + }, + members: { + title: localize("ui.panel.config.zha.groups.members"), + type: "numeric", + template: (group) => html` ${group.members.length} `, + sortable: true, + }, + }; + + return columns; + } ); protected render(): TemplateResult { @@ -112,7 +110,7 @@ export class ZHAGroupsDashboard extends LitElement { .hass=${this.hass} .narrow=${this.narrow} .route=${this.route} - .columns=${this._columns(this.narrow)} + .columns=${this._columns(this.hass.localize)} .data=${this._formattedGroups(this._groups)} @row-click=${this._handleRowClicked} clickable