diff --git a/src/panels/config/dashboard/ha-config-dashboard.ts b/src/panels/config/dashboard/ha-config-dashboard.ts index 68a63defe3..8c77470c7f 100644 --- a/src/panels/config/dashboard/ha-config-dashboard.ts +++ b/src/panels/config/dashboard/ha-config-dashboard.ts @@ -43,6 +43,65 @@ import { showAlertDialog } from "../../../dialogs/generic/show-dialog-box"; import { showToast } from "../../../util/toast"; import { documentationUrl } from "../../../util/documentation-url"; +const randomTip = (hass: HomeAssistant) => { + const weighted: string[] = []; + const tips = [ + { + content: hass.localize( + "ui.panel.config.tips.join", + "forums", + html`Forums`, + "twitter", + html`Twitter`, + "discord", + html`Chat`, + "blog", + html`Blog`, + "newsletter", + html`Newsletter + ` + ), + weight: 2, + }, + { content: hass.localize("ui.dialogs.quick-bar.key_c_hint"), weight: 1 }, + ]; + + tips.forEach((tip) => { + for (let i = 0; i < tip.weight; i++) { + weighted.push(tip.content); + } + }); + + return weighted[Math.floor(Math.random() * weighted.length)]; +}; + @customElement("ha-config-dashboard") class HaConfigDashboard extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; @@ -145,49 +204,7 @@ class HaConfigDashboard extends LitElement {
Tip! - - ${this.hass.localize( - "ui.panel.config.tips.join", - "forums", - html`Forums`, - "twitter", - html`Twitter`, - "discord", - html`Chat`, - "blog", - html`Blog`, - "newsletter", - html`Newsletter - ` - )} - + ${randomTip(this.hass)}