diff --git a/src/panels/config/dashboard/ha-config-dashboard.ts b/src/panels/config/dashboard/ha-config-dashboard.ts index 5b54bc8850..334ee0c822 100644 --- a/src/panels/config/dashboard/ha-config-dashboard.ts +++ b/src/panels/config/dashboard/ha-config-dashboard.ts @@ -80,7 +80,13 @@ class HaConfigDashboard extends LitElement { @internalProperty() private _dashboards: LovelaceDashboard[] = []; + @internalProperty() private _width: number; + + @internalProperty() private mqls?: MediaQueryList[]; + protected render(): TemplateResult { + const integrationsToShow = + this._width === 4 ? 6 : this._width === 3 ? 4 : this.narrow ? 2 : 6; return html` @@ -216,61 +222,63 @@ class HaConfigDashboard extends LitElement {
- ${this._configEntries?.map((entry) => { - const devices = this._getDevices(entry); - const services = this._getServices(entry); - const entities = this._getEntities(entry); + ${this._configEntries + ?.slice(0, integrationsToShow) + .map((entry) => { + const devices = this._getDevices(entry); + const services = this._getServices(entry); + const entities = this._getEntities(entry); - return html` -
-
- + return html` +
+
+ +
+

+ ${entry.localized_domain_name} +

+

+ ${entry.localized_domain_name === entry.title + ? "" + : entry.title} +

+ ${devices.length || services.length || entities.length + ? html` +
+ ${devices.length + ? html`${this.hass.localize( + "ui.panel.config.integrations.config_entry.devices", + "count", + devices.length + )}${services.length ? "," : ""}` + : ""} + ${services.length + ? html`${this.hass.localize( + "ui.panel.config.integrations.config_entry.services", + "count", + services.length + )}` + : ""} + ${(devices.length || services.length) && + entities.length + ? this.hass.localize("ui.common.and") + : ""} + ${entities.length + ? html`${this.hass.localize( + "ui.panel.config.integrations.config_entry.entities", + "count", + entities.length + )}` + : ""} +
+ ` + : ""}
-

- ${entry.localized_domain_name} -

-

- ${entry.localized_domain_name === entry.title - ? "" - : entry.title} -

- ${devices.length || services.length || entities.length - ? html` -
- ${devices.length - ? html`${this.hass.localize( - "ui.panel.config.integrations.config_entry.devices", - "count", - devices.length - )}${services.length ? "," : ""}` - : ""} - ${services.length - ? html`${this.hass.localize( - "ui.panel.config.integrations.config_entry.services", - "count", - services.length - )}` - : ""} - ${(devices.length || services.length) && - entities.length - ? this.hass.localize("ui.common.and") - : ""} - ${entities.length - ? html`${this.hass.localize( - "ui.panel.config.integrations.config_entry.entities", - "count", - entities.length - )}` - : ""} -
- ` - : ""} -
- `; - })} + `; + })}