diff --git a/src/panels/config/integrations/ha-config-flow-card.ts b/src/panels/config/integrations/ha-config-flow-card.ts index 8509ab2e5f..77be858ca8 100644 --- a/src/panels/config/integrations/ha-config-flow-card.ts +++ b/src/panels/config/integrations/ha-config-flow-card.ts @@ -1,15 +1,10 @@ +import type { RequestSelectedDetail } from "@material/mwc-list/mwc-list-item"; +import { mdiBookshelf, mdiCog, mdiDotsVertical, mdiOpenInNew } from "@mdi/js"; import { css, html, LitElement, TemplateResult } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; -import { - mdiBookshelf, - mdiCog, - mdiDotsVertical, - mdiEyeOff, - mdiOpenInNew, -} from "@mdi/js"; -import type { RequestSelectedDetail } from "@material/mwc-list/mwc-list-item"; import { fireEvent } from "../../../common/dom/fire_event"; +import { shouldHandleRequestSelectedEvent } from "../../../common/mwc/handle-request-selected-event"; import { ATTENTION_SOURCES, DISCOVERY_SOURCES, @@ -17,13 +12,12 @@ import { localizeConfigFlowTitle, } from "../../../data/config_flow"; import type { IntegrationManifest } from "../../../data/integration"; -import { shouldHandleRequestSelectedEvent } from "../../../common/mwc/handle-request-selected-event"; import { showConfigFlowDialog } from "../../../dialogs/config-flow/show-dialog-config-flow"; import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box"; import type { HomeAssistant } from "../../../types"; +import { documentationUrl } from "../../../util/documentation-url"; import type { DataEntryFlowProgressExtended } from "./ha-config-integrations"; import "./ha-integration-action-card"; -import { documentationUrl } from "../../../util/documentation-url"; @customElement("ha-config-flow-card") export class HaConfigFlowCard extends LitElement { @@ -38,16 +32,10 @@ export class HaConfigFlowCard extends LitElement { return html` @@ -60,72 +48,75 @@ export class HaConfigFlowCard extends LitElement { }` )} > - - - ${this.flow.context.configuration_url - ? html` - - ${this.hass.localize( - "ui.panel.config.integrations.config_entry.open_configuration_url" - )} - - - - ` - : ""} - ${this.manifest - ? html`` + : ""} + ${this.flow.context.configuration_url || this.manifest + ? html` + + ${this.flow.context.configuration_url + ? html` - - ${this.hass.localize( - "ui.panel.config.integrations.config_entry.documentation" - )} - - - - ` - : ""} - ${DISCOVERY_SOURCES.includes(this.flow.context.source) && - this.flow.context.unique_id - ? html` - - ${this.hass.localize( - "ui.panel.config.integrations.ignore.ignore" - )} - - - ` - : ""} - + ? "_self" + : "_blank"} + > + + ${this.hass.localize( + "ui.panel.config.integrations.config_entry.open_configuration_url" + )} + + + + ` + : ""} + ${this.manifest + ? html` + + ${this.hass.localize( + "ui.panel.config.integrations.config_entry.documentation" + )} + + + + ` + : ""} + ` + : ""} `; } @@ -174,14 +165,6 @@ export class HaConfigFlowCard extends LitElement { } static styles = css` - .attention { - --state-color: var(--error-color); - --text-on-state-color: var(--text-primary-color); - } - .discovered { - --state-color: var(--primary-color); - --text-on-state-color: var(--text-primary-color); - } a { text-decoration: none; color: var(--primary-color); diff --git a/src/panels/config/integrations/ha-config-integrations-dashboard.ts b/src/panels/config/integrations/ha-config-integrations-dashboard.ts index 9a39a25eab..969c44bbbf 100644 --- a/src/panels/config/integrations/ha-config-integrations-dashboard.ts +++ b/src/panels/config/integrations/ha-config-integrations-dashboard.ts @@ -377,46 +377,57 @@ class HaConfigIntegrationsDashboard extends SubscribeMixin(LitElement) { `} ${this._showIgnored - ? html`
- ${ignoredConfigEntries.map( - (entry: ConfigEntryExtended) => html` - - ` - )} -
` + ? html`

+ ${this.hass.localize( + "ui.panel.config.integrations.ignore.ignored" + )} +

+
+ ${ignoredConfigEntries.map( + (entry: ConfigEntryExtended) => html` + + ` + )} +
` : ""} ${configEntriesInProgress.length - ? html`
- ${configEntriesInProgress.map( - (flow: DataEntryFlowProgressExtended) => html` - - ` - )} -
` + ? html`

+ ${this.hass.localize("ui.panel.config.integrations.discovered")} +

+
+ ${configEntriesInProgress.map( + (flow: DataEntryFlowProgressExtended) => html` + + ` + )} +
` : ""} ${this._showDisabled - ? html`
- ${disabledConfigEntries.map( - (entry: ConfigEntryExtended) => html` - - ` - )} -
` + ? html`

+ ${this.hass.localize("ui.panel.config.integrations.disabled")} +

+
+ ${disabledConfigEntries.map( + (entry: ConfigEntryExtended) => html` + + ` + )} +
` : ""}
${integrations.length @@ -756,6 +767,8 @@ class HaConfigIntegrationsDashboard extends SubscribeMixin(LitElement) { .empty-message { margin: auto; text-align: center; + grid-column-start: 1; + grid-column-end: -1; } .empty-message h1 { margin-bottom: 0; @@ -851,6 +864,9 @@ class HaConfigIntegrationsDashboard extends SubscribeMixin(LitElement) { .menu-badge-container { position: relative; } + h1 { + margin: 8px 0 0 16px; + } ha-button-menu { color: var(--primary-text-color); } diff --git a/src/panels/config/integrations/ha-integration-action-card.ts b/src/panels/config/integrations/ha-integration-action-card.ts index bd81203095..0d708df2ef 100644 --- a/src/panels/config/integrations/ha-integration-action-card.ts +++ b/src/panels/config/integrations/ha-integration-action-card.ts @@ -1,9 +1,14 @@ import { css, html, LitElement, TemplateResult } from "lit"; import { customElement, property } from "lit/decorators"; -import type { IntegrationManifest } from "../../../data/integration"; +import { + domainToName, + type IntegrationManifest, +} from "../../../data/integration"; import type { HomeAssistant } from "../../../types"; import "./ha-integration-header"; import "../../../components/ha-card"; +import { brandsUrl } from "../../../util/brands-url"; +import { haStyle } from "../../../resources/styles"; @customElement("ha-integration-action-card") export class HaIntegrationActionCard extends LitElement { @@ -22,49 +27,94 @@ export class HaIntegrationActionCard extends LitElement { protected render(): TemplateResult { return html` - - - +
+ +

${this.label}

+

+ ${this.localizedDomainName || + domainToName(this.hass.localize, this.domain, this.manifest)} +

+
-
+
+
`; } - static styles = css` - ha-card { - display: flex; - flex-direction: column; - height: 100%; - --ha-card-border-color: var(--state-color); - --mdc-theme-primary: var(--state-color); - } - .filler { - flex: 1; - } - .attention { - --state-color: var(--error-color); - --text-on-state-color: var(--text-primary-color); - } - .discovered { - --state-color: var(--primary-color); - --text-on-state-color: var(--text-primary-color); - } - .actions { - display: flex; - justify-content: space-between; - align-items: center; - padding: 8px 6px 0; - height: 48px; - } - `; + private _onImageLoad(ev) { + ev.target.style.visibility = "initial"; + } + + private _onImageError(ev) { + ev.target.style.visibility = "hidden"; + } + + static styles = [ + haStyle, + css` + ha-card { + display: flex; + flex-direction: column; + height: 100%; + } + img { + width: 40px; + height: 40px; + } + h2 { + font-size: 16px; + font-weight: 400; + margin-top: 8px; + margin-bottom: 0; + } + h3 { + font-size: 14px; + margin: 0; + } + .header-button { + position: absolute; + top: 8px; + right: 8px; + } + .filler { + flex: 1; + } + .attention { + --state-color: var(--error-color); + --text-on-state-color: var(--text-primary-color); + } + .card-content { + display: flex; + justify-content: center; + flex-direction: column; + align-items: center; + } + .card-actions { + border-top: none; + padding-top: 0; + padding-bottom: 16px; + justify-content: center; + display: flex; + } + :host ::slotted(*) { + margin-right: 8px; + } + :host ::slotted(:last-child) { + margin-right: 0; + } + `, + ]; } declare global { diff --git a/src/panels/config/integrations/ha-integration-header.ts b/src/panels/config/integrations/ha-integration-header.ts index 63f119041d..44fc4497be 100644 --- a/src/panels/config/integrations/ha-integration-header.ts +++ b/src/panels/config/integrations/ha-integration-header.ts @@ -10,10 +10,6 @@ import { brandsUrl } from "../../../util/brands-url"; export class HaIntegrationHeader extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public banner?: string; - - @property() public label?: string; - @property() public error?: string; @property() public warning?: string; @@ -25,25 +21,11 @@ export class HaIntegrationHeader extends LitElement { @property({ attribute: false }) public manifest?: IntegrationManifest; protected render(): TemplateResult { - let primary: string; - let secondary: string | undefined; - const domainName = this.localizedDomainName || domainToName(this.hass.localize, this.domain, this.manifest); - if (this.label) { - primary = this.label; - secondary = - primary.toLowerCase() === domainName.toLowerCase() - ? undefined - : domainName; - } else { - primary = domainName; - } - return html` - ${!this.banner ? "" : html``}
- ${primary} + ${domainName}
${this.error ? html`
@@ -74,8 +56,6 @@ export class HaIntegrationHeader extends LitElement { ${this .warning}
` - : secondary - ? html`
${secondary}
` : nothing}
@@ -94,16 +74,6 @@ export class HaIntegrationHeader extends LitElement { } static styles = css` - .banner { - background-color: var(--state-color); - color: var(--text-on-state-color); - text-align: center; - padding: 2px; - - /* Padding is subtracted for nested elements with border radiuses */ - border-top-left-radius: calc(var(--ha-card-border-radius, 12px) - 2px); - border-top-right-radius: calc(var(--ha-card-border-radius, 12px) - 2px); - } .header { display: flex; position: relative; @@ -126,8 +96,7 @@ export class HaIntegrationHeader extends LitElement { } .primary, .warning, - .error, - .secondary { + .error { word-wrap: break-word; display: -webkit-box; -webkit-box-orient: vertical; @@ -152,10 +121,6 @@ export class HaIntegrationHeader extends LitElement { -webkit-line-clamp: 1; font-size: 0.9em; } - .secondary { - font-size: 14px; - color: var(--secondary-text-color); - } .error ha-svg-icon { margin-right: 4px; color: var(--error-color); diff --git a/src/translations/en.json b/src/translations/en.json index ee9351d365..042ec31ac6 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -3301,6 +3301,7 @@ "description": "Manage integrations with services or devices", "integration": "integration", "discovered": "Discovered", + "disabled": "Disabled", "available_integrations": "Available integrations", "new_flow": "Setup another instance of {integration}", "attention": "Attention required",