From 62ed1d54b02b971cd11f6957500b7ca627bd27a1 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Tue, 25 Apr 2023 12:41:53 +0200 Subject: [PATCH] Voice assistant cloud upsell (#16299) --- .../config/voice-assistants/cloud-discover.ts | 206 ++++++++++++++++++ .../ha-config-voice-assistants-assistants.ts | 49 +---- src/translations/en.json | 16 ++ 3 files changed, 229 insertions(+), 42 deletions(-) create mode 100644 src/panels/config/voice-assistants/cloud-discover.ts diff --git a/src/panels/config/voice-assistants/cloud-discover.ts b/src/panels/config/voice-assistants/cloud-discover.ts new file mode 100644 index 0000000000..f762251d78 --- /dev/null +++ b/src/panels/config/voice-assistants/cloud-discover.ts @@ -0,0 +1,206 @@ +import { mdiMicrophoneMessage, mdiOpenInNew } from "@mdi/js"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import { customElement, property } from "lit/decorators"; +import "../../../components/ha-card"; +import type { HomeAssistant } from "../../../types"; +import { brandsUrl } from "../../../util/brands-url"; +import "../../../components/ha-svg-icon"; +import "../../../components/ha-button"; +import { isComponentLoaded } from "../../../common/config/is_component_loaded"; + +@customElement("cloud-discover") +export class CloudDiscover extends LitElement { + @property({ attribute: false }) public hass!: HomeAssistant; + + protected render() { + return html` + +
+

+ ${this.hass.localize( + "ui.panel.config.voice_assistants.assistants.cloud.header" + )} +

+
+
+
+ Google Assistant + Amazon Alexa +
+

+ ${this.hass.localize( + "ui.panel.config.voice_assistants.assistants.cloud.features.assistants.title" + )} +

+

+ ${this.hass.localize( + "ui.panel.config.voice_assistants.assistants.cloud.features.assistants.text" + )} +

+
+
+
+
+ +
+
+

+ ${this.hass.localize( + "ui.panel.config.voice_assistants.assistants.cloud.features.speech.title" + )} +

+

+ ${this.hass.localize( + "ui.panel.config.voice_assistants.assistants.cloud.features.speech.text" + )} +

+
+
+ +
+ ${isComponentLoaded(this.hass, "cloud") + ? html` + + ` + : nothing} +
+ `; + } + + static get styles(): CSSResultGroup { + return css` + ha-card { + display: flex; + flex-direction: column; + } + .card-content { + padding: 24px 16px; + } + .card-actions { + display: flex; + justify-content: space-between; + } + .header { + font-weight: 400; + font-size: 28px; + line-height: 36px; + text-align: center; + max-width: 600px; + margin: 0 auto 8px auto; + } + @media (min-width: 800px) { + .header { + font-size: 32px; + line-height: 40px; + margin-bottom: 16px; + } + } + .features { + display: grid; + grid-template-columns: auto; + grid-gap: 16px; + padding: 16px; + } + @media (min-width: 600px) { + .features { + grid-template-columns: repeat(2, 1fr); + } + } + .feature { + display: flex; + flex-direction: column; + align-items: center; + text-align: center; + margin-bottom: 16px; + } + .feature .logos { + margin-bottom: 16px; + } + .feature .logos > * { + width: 40px; + height: 40px; + margin: 0 4px; + } + .round-icon { + border-radius: 50%; + color: #6e41ab; + background-color: #e8dcf7; + display: flex; + align-items: center; + justify-content: center; + font-size: 24px; + } + .feature h2 { + font-weight: 500; + font-size: 16px; + line-height: 24px; + margin-top: 0; + margin-bottom: 8px; + } + .feature p { + font-weight: 400; + font-size: 14px; + line-height: 20px; + margin: 0; + } + .more { + display: flex; + align-items: center; + justify-content: center; + } + .more a { + text-decoration: none; + color: var(--primary-color); + font-weight: 500; + font-size: 14px; + } + .more a ha-svg-icon { + --mdc-icon-size: 16px; + } + `; + } +} + +declare global { + interface HTMLElementTagNameMap { + "cloud-discover": CloudDiscover; + } +} diff --git a/src/panels/config/voice-assistants/ha-config-voice-assistants-assistants.ts b/src/panels/config/voice-assistants/ha-config-voice-assistants-assistants.ts index 76ae8707d8..64c438da74 100644 --- a/src/panels/config/voice-assistants/ha-config-voice-assistants-assistants.ts +++ b/src/panels/config/voice-assistants/ha-config-voice-assistants-assistants.ts @@ -11,6 +11,7 @@ import "./assist-pref"; import "./cloud-alexa-pref"; import "./cloud-google-pref"; import { voiceAssistantTabs } from "./ha-config-voice-assistants"; +import "./cloud-discover"; @customElement("ha-config-voice-assistants-assistants") export class HaConfigVoiceAssistantsAssistants extends LitElement { @@ -39,10 +40,11 @@ export class HaConfigVoiceAssistantsAssistants extends LitElement { >
${isComponentLoaded(this.hass, "assist_pipeline") - ? html`` + ? html` ` : nothing} ${this.cloudStatus?.logged_in - ? html`` - : html` -
- With Home Assistant Cloud, you can connect your Home - Assistant instance in a few simple clicks to both Google - Assistant and Amazon Alexa. If you can connect it to Home - Assistant, you can now control it with your voice using the - Amazon Echo, Google Home or your Android phone. -
- -
- ${isComponentLoaded(this.hass, "cloud") - ? html` - - - - ${this.hass.localize( - "ui.panel.config.cloud.login.start_trial" - )} -
- ${this.hass.localize( - "ui.panel.config.cloud.login.trial_info" - )} -
-
- -
-
-
` - : ""}`} + > + ` + : html``}
`; diff --git a/src/translations/en.json b/src/translations/en.json index 2b65cf3942..431c8aa8e1 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -2055,6 +2055,22 @@ "tts_voice": "Voice" } } + }, + "cloud": { + "header": "Get the best assistant with Home Assistant Cloud", + "features": { + "assistants": { + "title": "Google Assistant and Amazon Alexa", + "text": "Control all your Home Assistant devices via any Google Assistant-enabled or Alexa-enabled device." + }, + "speech": { + "title": "Better speech options", + "text": "Bring personality to your home by having it speak to you using our neural-network powered speech-to-text and text-to-speech services." + } + }, + "and_more": "And more", + "try_one_month": "Try 1 month for free", + "sign_in": "Sign in" } }, "expose": {