Allow dismissing (#7712)

This commit is contained in:
Paulus Schoutsen 2020-11-17 16:14:37 +01:00 committed by GitHub
parent bbe4c95109
commit cbddebeaa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 7 deletions

2
.gitignore vendored
View File

@ -37,4 +37,4 @@ yarn-error.log
.tool-versions .tool-versions
# Home Assistant config # Home Assistant config
config /config

View File

@ -13,6 +13,7 @@ import {
import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { isComponentLoaded } from "../../../common/config/is_component_loaded";
import "../../../components/ha-card"; import "../../../components/ha-card";
import "../../../components/ha-icon-next"; import "../../../components/ha-icon-next";
import "../../../components/ha-svg-icon";
import "../../../components/ha-menu-button"; import "../../../components/ha-menu-button";
import { CloudStatus } from "../../../data/cloud"; import { CloudStatus } from "../../../data/cloud";
import { haStyle } from "../../../resources/styles"; import { haStyle } from "../../../resources/styles";
@ -20,7 +21,8 @@ import { HomeAssistant } from "../../../types";
import "../ha-config-section"; import "../ha-config-section";
import { configSections } from "../ha-panel-config"; import { configSections } from "../ha-panel-config";
import "./ha-config-navigation"; import "./ha-config-navigation";
import { mdiCloudLock } from "@mdi/js"; import { mdiClose, mdiCloudLock } from "@mdi/js";
import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box";
const CONF_HAPPENING = new Date() < new Date("2020-12-13T23:00:00Z"); const CONF_HAPPENING = new Date() < new Date("2020-12-13T23:00:00Z");
@ -69,17 +71,22 @@ class HaConfigDashboard extends LitElement {
</ha-card> </ha-card>
` `
: ""} : ""}
${CONF_HAPPENING ${CONF_HAPPENING && !localStorage.dismissConf2020
? html` ? html`
<ha-card class="conf-card" <ha-card class="conf-card">
><a <a
target="_blank" target="_blank"
href="https://www.home-assistant.io/conference" href="https://www.home-assistant.io/conference"
rel="noopener noreferrer" rel="noopener noreferrer"
> >
<img src="/static/images/conference.png" /> <img src="/static/images/conference.png" />
<div class="carrot"><ha-icon-next></ha-icon-next></div></a <div class="carrot"><ha-icon-next></ha-icon-next></div>
></ha-card> </a>
<ha-svg-icon
.path=${mdiClose}
@click=${this._dismissConference}
></ha-svg-icon>
</ha-card>
` `
: ""} : ""}
${Object.values(configSections).map( ${Object.values(configSections).map(
@ -157,6 +164,33 @@ class HaConfigDashboard extends LitElement {
`; `;
} }
private async _dismissConference() {
if (
await showConfirmationDialog(this, {
title: "Home Assistant Conference",
text: html`
If you've
<a
target="_blank"
href="https://hopin.to/events/home-assistant-conference"
rel="noopener noreferrer"
>bought your ticket</a
>
or have
<a
target="_blank"
href="https://www.youtube.com/watch?v=xSB_MuKkgxE"
rel="noopener noreferrer"
>subscribed to the livestream</a
>, you might want to dismiss this banner. Do you want to continue?
`,
})
) {
localStorage.dismissConf2020 = "1";
this.requestUpdate();
}
}
static get styles(): CSSResultArray { static get styles(): CSSResultArray {
return [ return [
haStyle, haStyle,
@ -196,6 +230,12 @@ class HaConfigDashboard extends LitElement {
align-items: center; align-items: center;
color: white; color: white;
} }
.conf-card ha-svg-icon {
position: absolute;
bottom: -4px;
left: -4px;
color: #a2cdf3;
}
.promo-advanced { .promo-advanced {
text-align: center; text-align: center;
color: var(--secondary-text-color); color: var(--secondary-text-color);